diff mbox

[v5,2/3] ti-gfx: add new package

Message ID 1373639678-7357-2-git-send-email-spenser@gillilanding.com
State Superseded
Headers show

Commit Message

Spenser Gilliland July 12, 2013, 2:34 p.m. UTC
adds accelerated GPU support for the OMAP35xx, AM35xx, AM37xx, DM37xx,
AM387x, C6A814x, AM389x, C6A816x, and AM335x platforms.

Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Sundareson, Prabindh <prabu@ti.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Sinan Akpolat <sinan@linkas.com.tr>
---
 package/Config.in                              |   1 +
 package/opengl/libegl/libegl.mk                |   4 +
 package/opengl/libgles/libgles.mk              |   4 +
 package/ti-gfx/Config.in                       |  69 +++++++++
 package/ti-gfx/S80ti-gfx                       |  54 +++++++
 package/ti-gfx/egl.pc                          |  12 ++
 package/ti-gfx/esrev.sh                        |  59 ++++++++
 package/ti-gfx/glesv2.pc                       |  12 ++
 package/ti-gfx/powervr.ini                     |   2 +
 package/ti-gfx/ti-gfx-km_install_modules.patch |  19 +++
 package/ti-gfx/ti-gfx-newclkapi.patch          | 143 ++++++++++++++++++
 package/ti-gfx/ti-gfx.mk                       | 195 +++++++++++++++++++++++++
 12 files changed, 574 insertions(+)
 create mode 100644 package/ti-gfx/Config.in
 create mode 100644 package/ti-gfx/S80ti-gfx
 create mode 100644 package/ti-gfx/egl.pc
 create mode 100644 package/ti-gfx/esrev.sh
 create mode 100644 package/ti-gfx/glesv2.pc
 create mode 100644 package/ti-gfx/powervr.ini
 create mode 100644 package/ti-gfx/ti-gfx-km_install_modules.patch
 create mode 100644 package/ti-gfx/ti-gfx-newclkapi.patch
 create mode 100644 package/ti-gfx/ti-gfx.mk

Comments

Thomas Petazzoni July 13, 2013, 2:11 p.m. UTC | #1
Dear Spenser Gilliland,

On Fri, 12 Jul 2013 09:34:37 -0500, Spenser Gilliland wrote:

> diff --git a/package/opengl/libegl/libegl.mk b/package/opengl/libegl/libegl.mk
> index bd8040d..00e1f19 100644
> --- a/package/opengl/libegl/libegl.mk
> +++ b/package/opengl/libegl/libegl.mk
> @@ -10,6 +10,10 @@ ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
>  LIBEGL_DEPENDENCIES += rpi-userland
>  endif
>  
> +ifeq ($(BR2_PACKAGE_TI_GFX),y)
> +LIBEGL_DEPENDENCIES += ti-gfx
> +endif

No, if you have introduced the powervr virtual package, then libegl
should not directly depend on ti-gfx, but instead libegl should depend
on powervr, which itself will depend on ti-gfx.

Generally speaking, I think this introduction of the powervr virtual
package is a bit unfortunate for now. Your ti-gfx package was almost
ready for merging, and now it's no longer the case. We should stop
making further feature additions, and focus on getting ti-gfx merged.
Later on, *when* a second PowerVR package appears, it would have been
time to do the necessary work.

But well, now that you've starting doing it, I guess it doesn't make
sense to go backward and remove it again. But then please do it
cleanly:

 * PATCH 1: add the virtual powervr package, with the necessary changes
   to libegl.mk and libgles2.mk, to add the libegl -> powervr and
   libgles2 -> powervr dependencies.

 * PATCH 2: add the ti-gfx package, with the necessary change to
   powervr.mk to add the powervr -> ti-gfx dependency.

Other than that, I think the package is ready now.

Thanks!

Thomas
Spenser Gilliland July 13, 2013, 5:08 p.m. UTC | #2
On Sat, Jul 13, 2013 at 9:11 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Spenser Gilliland,
>
> On Fri, 12 Jul 2013 09:34:37 -0500, Spenser Gilliland wrote:
>
>> diff --git a/package/opengl/libegl/libegl.mk b/package/opengl/libegl/libegl.mk
>> index bd8040d..00e1f19 100644
>> --- a/package/opengl/libegl/libegl.mk
>> +++ b/package/opengl/libegl/libegl.mk
>> @@ -10,6 +10,10 @@ ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
>>  LIBEGL_DEPENDENCIES += rpi-userland
>>  endif
>>
>> +ifeq ($(BR2_PACKAGE_TI_GFX),y)
>> +LIBEGL_DEPENDENCIES += ti-gfx
>> +endif
>
> No, if you have introduced the powervr virtual package, then libegl
> should not directly depend on ti-gfx, but instead libegl should depend
> on powervr, which itself will depend on ti-gfx.

I don't believe this to be correct.  There is not specific dependency
chain as each powervr package implements its own set of egl/gles/vg.
The point of the PowerVR package is for each package that takes
advantage of PowerVR specific features.  IE. QT4.

Therefore, ti-gfx should depend on libgles, libegl,and powervr.

Thanks,
Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate
Thomas Petazzoni July 13, 2013, 5:14 p.m. UTC | #3
Dear Spenser Gilliland,

On Sat, 13 Jul 2013 12:08:45 -0500, Spenser Gilliland wrote:

> > No, if you have introduced the powervr virtual package, then libegl
> > should not directly depend on ti-gfx, but instead libegl should depend
> > on powervr, which itself will depend on ti-gfx.
> 
> I don't believe this to be correct.  There is not specific dependency
> chain as each powervr package implements its own set of egl/gles/vg.
> The point of the PowerVR package is for each package that takes
> advantage of PowerVR specific features.  IE. QT4.
> 
> Therefore, ti-gfx should depend on libgles, libegl,and powervr.

I guess you mean "should provide" and not "should depend". But ok, as
discussed on IRC, I see what you mean. We consider libegl, libgles2 and
powervr to be separate virtual features, and it happens that ti-gfx
provides all of them.

Best regards,

Thomas
Peter Korsgaard July 15, 2013, 8:18 p.m. UTC | #4
>>>>> "S" == Spenser Gilliland <spenser@gillilanding.com> writes:

 S> adds accelerated GPU support for the OMAP35xx, AM35xx, AM37xx, DM37xx,
 S> AM387x, C6A814x, AM389x, C6A816x, and AM335x platforms.

Nit: I think the C6Ax devices are more commonly referred to as DMx.


 S> +++ b/package/ti-gfx/Config.in
 S> @@ -0,0 +1,69 @@
 S> +config BR2_PACKAGE_TI_GFX
 S> +	bool "ti-gfx"
 S> +	select BR2_PACKAGE_HAS_OPENGL_EGL
 S> +	select BR2_PACKAGE_HAS_OPENGL_ES
 S> +	select BR2_PACKAGE_HAS_POWERVR
 S> +	depends on BR2_LINUX_KERNEL && BR2_TOOLCHAIN_USES_GLIBC && BR2_arm
 S> +	help
 S> +	  Graphics libraries for TI boards.
 S> +
 S> +	  http://downloads.ti.com/dsps/dsps_public_sw/gfxsdk/
 S> +
 S> +if BR2_PACKAGE_TI_GFX
 S> +
 S> +config BR2_PACKAGE_TI_GFX_DEBUG
 S> +	bool "enable debug support"
 S> +	help
 S> +	  Turns on debugging in the kernel module, install libraries built with
 S> +	  debugging enabled, installs various tests and installs esrev script.
 S> +
 S> +config BR2_PACKAGE_TI_GFX_DEMOS
 S> +	bool "install demos"
 S> +	default y
 S> +	help
 S> +	  Install the OGLES2ChameleonMan and OGLES2MagicLantern demos
 S> +
 S> +config BR2_PACKAGE_TI_GFX_EGLIMAGE
 S> +	bool "install eglimage version of libraries"
 S> +	help
 S> +	  Installs OpenGL libaries which support the eglimage api.
 S> +
 S> +config BR2_PACKAGE_TI_GFX_HARD_FLOAT
 S> +	bool "use hard float binaries"
 S> +	help
 S> +	  Install hard float binaries (required if using a hard float toolchain)
 S> +
 S> +choice
 S> +	prompt "Target"
 S> +	default BR2_PACKAGE_TI_GFX_ES3
 S> +	help
 S> +	  Select the SOC for which you would like to install drivers. Please 

Trailing space (here and elsewhere).


 S> diff --git a/package/ti-gfx/S80ti-gfx b/package/ti-gfx/S80ti-gfx
 S> new file mode 100644
 S> index 0000000..ee2250e
 S> --- /dev/null
 S> +++ b/package/ti-gfx/S80ti-gfx
 S> @@ -0,0 +1,54 @@
 S> +#!/bin/sh
 S> +
 S> +start() {
 S> +	echo "ti-gfx: starting pvr driver"
 S> +
 S> +	BITSPERPIXEL="$(fbset | awk '/geom/ {print $6}')"
 S> +	YRES="$(fbset | awk '/geom/ {print $3}')"
 S> +	# Set RGBA ordering to something the drivers like
 S> +	if [ "$BITSPERPIXEL" = "32" ] ; then
 S> +		fbset -rgba 8/16,8/8,8/0,8/24
 S> +	fi
 S> +	# Try to enable triple buffering when there's enough VRAM
 S> +	fbset -vyres $(( YRES*3 ))
 S> +
 S> +	modprobe omaplfb
 S> +	modprobe bufferclass_ti

Aren't you missing a modprobe of the pvr module itself?

 S> +
 S> +	pvr_maj=$(awk '$2=="pvrsrvkm" { print $1; }' /proc/devices)
 S> +	if [ -e /dev/pvrsrvkm ] ; then
 S> +		rm -f /dev/pvrsrvkm
 S> +	fi

There's not really any reason to do the check as you are using rm -f

 S> +
 S> +	mknod /dev/pvrsrvkm c $pvr_maj 0
 S> +	chmod 666 /dev/pvrsrvkm

666 seems like a security issue. As things run as root by default,
perhaps we should just use 600?

 S> +
 S> +	if ! /usr/bin/pvrsrvctl --start --no-module; then
 S> +		echo "ti-gfx: unable to start server"
 S> +	fi
 S> +}	

Trailing spaces.

 S> +
 S> +stop() {
 S> +	echo "ti-gfx: stopping pvr driver"
 S> +
 S> +	rmmod bufferclass_ti
 S> +	rmmod omaplfb
 S> +	rmmod pvrsrvkm
 S> +}
 S> +
 S> +case "$1" in 

And here as well.

 S> diff --git a/package/ti-gfx/esrev.sh b/package/ti-gfx/esrev.sh
 S> new file mode 100644
 S> index 0000000..bd8b64e
 S> --- /dev/null
 S> +++ b/package/ti-gfx/esrev.sh
 S> @@ -0,0 +1,59 @@
 S> +#!/bin/sh
 S> +
 S> +# Debug script to determine proper ES revision for the current board. The 

Trailing spaces.

 S> +++ b/package/ti-gfx/ti-gfx.mk
 S> @@ -0,0 +1,195 @@
 S> +###############################################################################
 S> +#
 S> +# ti-gfx 

Trailing spaces

 S> +#
 S> +###############################################################################
 S> +
 S> +TI_GFX_VERSION = 4_09_00_01
 S> +TI_GFX_SO_VERSION = 1.9.2188537
 S> +
 S> +ifeq ($(BR2_PACKAGE_TI_GFX_HARD_FLOAT),y)
 S> +TI_GFX_SOURCE = Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_hardfp_minimal_demos.bin
 S> +else
 S> +TI_GFX_SOURCE = Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_minimal_demos.bin
 S> +endif
 S> +
 S> +TI_GFX_SITE = http://downloads.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/$(TI_GFX_VERSION)/exports/
 S> +TI_GFX_LICENSE = Technology / Software Publicly Available
 S> +TI_GFX_LICENSE_FILES = TSPA.txt
 S> +TI_GFX_INSTALL_STAGING = YES
 S> +
 S> +TI_GFX_DEPENDENCIES = linux
 S> +
 S> +ifeq ($(BR2_PACKAGE_TI_GFX_ES3),y)
 S> +TI_GFX_OMAPES = 3.x
 S> +TI_GFX_PLATFORM = omap3
 S> +endif
 S> +ifeq ($(BR2_PACKAGE_TI_GFX_ES5),y)
 S> +TI_GFX_OMAPES = 5.x
 S> +TI_GFX_PLATFORM = omap3630 

Trailing spaces.

 S> +endif
 S> +ifeq ($(BR2_PACKAGE_TI_GFX_ES6),y)
 S> +TI_GFX_OMPAES = 6.x
 S> +TI_GFX_PLATFORM = ti81xx 

Trailing spaces.

 S> +endif
 S> +ifeq ($(BR2_PACKAGE_TI_GFX_ES8),y)
 S> +TI_GFX_OMAPES = 8.x
 S> +TI_GFX_PLATFORM = ti335x
 S> +endif
 S> +
 S> +ifeq ($(BR2_PACKAGE_TI_GFX_DEBUG),y)
 S> +TI_GFX_DEBUG_LIB = dbg
 S> +TI_GFX_DEBUG_KM = debug
 S> +else
 S> +TI_GFX_DEBUG_LIB = rel
 S> +TI_GFX_DEBUG_KM = release
 S> +endif
 S> +
 S> +TI_GFX_BIN_PATH = gfx_$(TI_GFX_DEBUG_LIB)_es$(TI_GFX_OMAPES)
 S> +
 S> +TI_GFX_KM_MAKE_OPTS = \
 S> +	$(LINUX_MAKE_FLAGS) \
 S> +	BUILD=$(TI_GFX_DEBUG_KM) \
 S> +	TI_PLATFORM=$(TI_GFX_PLATFORM) \
 S> +	OMAPES=$(TI_GFX_OMAPES) \
 S> +	SUPPORT_XORG=0 \
 S> +	KERNELDIR=$(LINUX_DIR)
 S> +
 S> +TI_GFX_DEMO_MAKE_OPTS = \
 S> +	PLATFORM=LinuxARMV7 \
 S> +	X11BUILD=0 \
 S> +	PLAT_CC="$(TARGET_CC)" \
 S> +	PLAT_CPP="$(TARGET_CXX)" \
 S> +	PLAT_AR="$(TARGET_AR)"
 S> +
 S> +# The only required binary is pvrsrvctl all others are optional
 S> +TI_GFX_BIN = pvrsrvctl
 S> +
 S> +ifeq ($(BR2_PACKAGE_TI_GFX_DEBUG),y)
 S> +TI_GFX_BIN += \
 S> +	eglinfo ews_server ews_server_es2 ews_test_gles1 ews_test_gles2 \
 S> +	ews_test_swrender gles1test1 gles2test1 pvr2d_test services_test \
 S> +	sgx_blit_test sgx_clipblit_test sgx_flip_test sgx_init_test \
 S> +	sgx_render_flip_test xeglinfo xgles1test1 xgles2test1 xmultiegltest
 S> +endif
 S> +
 S> +TI_GFX_LIBS = \
 S> +	libews libpvr2d libpvrEWS_WSEGL libpvrPVR2D_BLITWSEGL libpvrPVR2D_DRIWSEGL \
 S> +	libpvrPVR2D_FLIPWSEGL libpvrPVR2D_FRONTWSEGL libpvrPVR2D_LINUXFBWSEGL \
 S> +	libPVRScopeServices libsrv_init libsrv_um libusc pvr_drv
 S> +
 S> +TI_GFX_EGLIMAGE_LIBS = \
 S> +	libEGL libGLES_CM libGLESv2 libglslcompiler libIMGegl
 S> +
 S> +TI_GFX_DEMOS = ChameleonMan MagicLantern
 S> +TI_GFX_DEMOS_LOC = GFX_Linux_SDK/OGLES2/SDKPackage/Demos
 S> +TI_GFX_DEMOS_MAKE_LOC = OGLES2/Build/LinuxGeneric
 S> +TI_GFX_DEMOS_BIN_LOC = OGLES2/Build/LinuxARMV7/ReleaseRaw/
 S> +
 S> +TI_GFX_HDR_DIRS = OGLES2/EGL OGLES2/EWS OGLES2/GLES2 OGLES2/KHR \
 S> +	OGLES/GLES bufferclass_ti/ pvr2d/ wsegl/
 S> +
 S> +define TI_GFX_EXTRACT_CMDS 

Trailing spaces.

 S> +	$(RM) -rf $(TI_GFX_DIR)
 S> +	chmod +x $(DL_DIR)/$(TI_GFX_SOURCE)
 S> +	printf "Y\nY\n qY\n\n" | $(DL_DIR)/$(TI_GFX_SOURCE) \
 S> +		--prefix $(@D) \
 S> +		--mode console
 S> +endef
 S> +
 S> +define TI_GFX_BUILD_KM_CMDS
 S> +	$(MAKE) $(TI_GFX_KM_MAKE_OPTS) -C $(@D)/GFX_Linux_KM all
 S> +endef
 S> +
 S> +define TI_GFX_BUILD_DEMO_CMDS
 S> +	$(foreach demo, $(TI_GFX_DEMOS), \
 S> +		$(TARGET_MAKE_ENV) $(MAKE1) -C \
 S> +			$(@D)/$(TI_GFX_DEMOS_LOC)/$(demo)/$(TI_GFX_DEMOS_MAKE_LOC) \
 S> +			$(TI_GFX_DEMO_MAKE_OPTS) all
 S> +	)
 S> +endef

This should be inside a ifeq ($(BR2_PACKAGE_TI_GFX_DEMOS),y) conditional.


 S> +
 S> +define TI_GFX_BUILD_CMDS
 S> +	$(TI_GFX_BUILD_KM_CMDS)
 S> +	$(TI_GFX_BUILD_DEMO_CMDS)
 S> +endef
 S> +
 S> +# Install libs
 S> +# argument 1 is the location to install to (e.g. STAGING_DIR, TARGET_DIR)
 S> +define TI_GFX_INSTALL_LIBS
 S> +	$(foreach lib,$(TI_GFX_LIBS),
 S> +		$(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib).so \
 S> +			$(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION); \
 S> +		ln -sf $(lib).so.$(TI_GFX_SO_VERSION) \
 S> +			$(1)/usr/lib/$(lib).so
 S> +	)
 S> +	$(foreach lib,$(TI_GFX_EGLIMAGE_LIBS),
 S> +		$(if $(BR2_PACKAGE_TI_GFX_EGLIMAGE),
 S> +			$(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib)_eglimage.so \
 S> +				$(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION);
 S> +		,
 S> +			$(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib).so \ 

Trailing spaces.

 S> +				$(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION);
 S> +		)
 S> +		ln -sf $(lib).so.$(TI_GFX_SO_VERSION) \
 S> +			$(1)/usr/lib/$(lib).so
 S> +	)
 S> +endef
 S> +
 S> +define TI_GFX_INSTALL_STAGING_CMDS
 S> +	$(foreach incdir,$(TI_GFX_HDR_DIRS),
 S> +		$(INSTALL) -d $(STAGING_DIR)/usr/include/$(notdir $(incdir)); \
 S> +		$(INSTALL) -D -m 0644 $(@D)/include/$(incdir)/*.h \
 S> +			$(STAGING_DIR)/usr/include/$(notdir $(incdir))/
 S> +	)
 S> +	$(call TI_GFX_INSTALL_LIBS,$(STAGING_DIR))
 S> +	

Trailing spaces.

 S> +	$(INSTALL) -D -m 0644 package/ti-gfx/egl.pc $(STAGING_DIR)/usr/lib/pkgconfig/
 S> +	$(INSTALL) -D -m 0644 package/ti-gfx/glesv2.pc $(STAGING_DIR)/usr/lib/pkgconfig/
 S> +endef
 S> +
 S> +define TI_GFX_INSTALL_KM_CMDS
 S> +	$(MAKE) $(TI_GFX_KM_MAKE_OPTS) -C $(@D)/GFX_Linux_KM install
 S> +endef
 S> +
 S> +define TI_GFX_INSTALL_BINS_CMDS
 S> +	$(foreach bin,$(TI_GFX_BIN),
 S> +		$(INSTALL) -D -m 0755 $(@D)/$(TI_GFX_BIN_PATH)/$(bin) \
 S> +			$(TARGET_DIR)/usr/bin/$(bin)
 S> +	)
 S> +	$(if $(BR2_PACKAGE_TI_GFX_DEBUG),
 S> +		$(INSTALL) -D -m 0755 package/ti-gfx/esrev.sh \
 S> +			$(TARGET_DIR)/usr/bin/esrev

You could perhaps argue that a script like esrev fiddling around with
devmem should rather be installed into usr/sbin.
Spenser Gilliland July 15, 2013, 9:12 p.m. UTC | #5
Peter,

I'll get this fixed up immediately and get it back to you. Thanks for
taking the time to review it.

>>>>>> "S" == Spenser Gilliland <spenser@gillilanding.com> writes:
>
>  S> adds accelerated GPU support for the OMAP35xx, AM35xx, AM37xx, DM37xx,
>  S> AM387x, C6A814x, AM389x, C6A816x, and AM335x platforms.
>
> Nit: I think the C6Ax devices are more commonly referred to as DMx.

Will fix.

>
>  S> +++ b/package/ti-gfx/Config.in
>  S> @@ -0,0 +1,69 @@
>  S> +config BR2_PACKAGE_TI_GFX
>  S> +   bool "ti-gfx"
>  S> +   select BR2_PACKAGE_HAS_OPENGL_EGL
>  S> +   select BR2_PACKAGE_HAS_OPENGL_ES
>  S> +   select BR2_PACKAGE_HAS_POWERVR
>  S> +   depends on BR2_LINUX_KERNEL && BR2_TOOLCHAIN_USES_GLIBC && BR2_arm
>  S> +   help
>  S> +     Graphics libraries for TI boards.
>  S> +
>  S> +     http://downloads.ti.com/dsps/dsps_public_sw/gfxsdk/
>  S> +
>  S> +if BR2_PACKAGE_TI_GFX
>  S> +
>  S> +config BR2_PACKAGE_TI_GFX_DEBUG
>  S> +   bool "enable debug support"
>  S> +   help
>  S> +     Turns on debugging in the kernel module, install libraries built with
>  S> +     debugging enabled, installs various tests and installs esrev script.
>  S> +
>  S> +config BR2_PACKAGE_TI_GFX_DEMOS
>  S> +   bool "install demos"
>  S> +   default y
>  S> +   help
>  S> +     Install the OGLES2ChameleonMan and OGLES2MagicLantern demos
>  S> +
>  S> +config BR2_PACKAGE_TI_GFX_EGLIMAGE
>  S> +   bool "install eglimage version of libraries"
>  S> +   help
>  S> +     Installs OpenGL libaries which support the eglimage api.
>  S> +
>  S> +config BR2_PACKAGE_TI_GFX_HARD_FLOAT
>  S> +   bool "use hard float binaries"
>  S> +   help
>  S> +     Install hard float binaries (required if using a hard float toolchain)
>  S> +
>  S> +choice
>  S> +   prompt "Target"
>  S> +   default BR2_PACKAGE_TI_GFX_ES3
>  S> +   help
>  S> +     Select the SOC for which you would like to install drivers. Please
>
> Trailing space (here and elsewhere).

All trailing white space issues fixed.

>
>  S> diff --git a/package/ti-gfx/S80ti-gfx b/package/ti-gfx/S80ti-gfx
>  S> new file mode 100644
>  S> index 0000000..ee2250e
>  S> --- /dev/null
>  S> +++ b/package/ti-gfx/S80ti-gfx
>  S> @@ -0,0 +1,54 @@
>  S> +#!/bin/sh
>  S> +
>  S> +start() {
>  S> +   echo "ti-gfx: starting pvr driver"
>  S> +
>  S> +   BITSPERPIXEL="$(fbset | awk '/geom/ {print $6}')"
>  S> +   YRES="$(fbset | awk '/geom/ {print $3}')"
>  S> +   # Set RGBA ordering to something the drivers like
>  S> +   if [ "$BITSPERPIXEL" = "32" ] ; then
>  S> +           fbset -rgba 8/16,8/8,8/0,8/24
>  S> +   fi
>  S> +   # Try to enable triple buffering when there's enough VRAM
>  S> +   fbset -vyres $(( YRES*3 ))
>  S> +
>  S> +   modprobe omaplfb
>  S> +   modprobe bufferclass_ti
>
> Aren't you missing a modprobe of the pvr module itself?

Modprobing omaplfb will automatically load pvrsrvkm but I've added an
explicit modprobe pvrsrvkm just to avoid any confusion.

>  S> +
>  S> +   pvr_maj=$(awk '$2=="pvrsrvkm" { print $1; }' /proc/devices)
>  S> +   if [ -e /dev/pvrsrvkm ] ; then
>  S> +           rm -f /dev/pvrsrvkm
>  S> +   fi
>
> There's not really any reason to do the check as you are using rm -f
Will fix.
>
>  S> +
>  S> +   mknod /dev/pvrsrvkm c $pvr_maj 0
>  S> +   chmod 666 /dev/pvrsrvkm
>
> 666 seems like a security issue. As things run as root by default,
> perhaps we should just use 600?

It's installed with 666 permissions in most distros and by the default
install method.  However, It makes sense to lock this down to the root
user only or maybe a group. I'm going to lock it down to the video
group.

>  S> +
>  S> +   if ! /usr/bin/pvrsrvctl --start --no-module; then
>  S> +           echo "ti-gfx: unable to start server"
>  S> +   fi
>  S> +}
>
> Trailing spaces.
>
>  S> +
>  S> +stop() {
>  S> +   echo "ti-gfx: stopping pvr driver"
>  S> +
>  S> +   rmmod bufferclass_ti
>  S> +   rmmod omaplfb
>  S> +   rmmod pvrsrvkm
>  S> +}
>  S> +
>  S> +case "$1" in
>
> And here as well.
>
>  S> diff --git a/package/ti-gfx/esrev.sh b/package/ti-gfx/esrev.sh
>  S> new file mode 100644
>  S> index 0000000..bd8b64e
>  S> --- /dev/null
>  S> +++ b/package/ti-gfx/esrev.sh
>  S> @@ -0,0 +1,59 @@
>  S> +#!/bin/sh
>  S> +
>  S> +# Debug script to determine proper ES revision for the current board. The
>
> Trailing spaces.
>
>  S> +++ b/package/ti-gfx/ti-gfx.mk
>  S> @@ -0,0 +1,195 @@
>  S> +###############################################################################
>  S> +#
>  S> +# ti-gfx
>
> Trailing spaces
>
>  S> +#
>  S> +###############################################################################
>  S> +
>  S> +TI_GFX_VERSION = 4_09_00_01
>  S> +TI_GFX_SO_VERSION = 1.9.2188537
>  S> +
>  S> +ifeq ($(BR2_PACKAGE_TI_GFX_HARD_FLOAT),y)
>  S> +TI_GFX_SOURCE = Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_hardfp_minimal_demos.bin
>  S> +else
>  S> +TI_GFX_SOURCE = Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_minimal_demos.bin
>  S> +endif
>  S> +
>  S> +TI_GFX_SITE = http://downloads.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/$(TI_GFX_VERSION)/exports/
>  S> +TI_GFX_LICENSE = Technology / Software Publicly Available
>  S> +TI_GFX_LICENSE_FILES = TSPA.txt
>  S> +TI_GFX_INSTALL_STAGING = YES
>  S> +
>  S> +TI_GFX_DEPENDENCIES = linux
>  S> +
>  S> +ifeq ($(BR2_PACKAGE_TI_GFX_ES3),y)
>  S> +TI_GFX_OMAPES = 3.x
>  S> +TI_GFX_PLATFORM = omap3
>  S> +endif
>  S> +ifeq ($(BR2_PACKAGE_TI_GFX_ES5),y)
>  S> +TI_GFX_OMAPES = 5.x
>  S> +TI_GFX_PLATFORM = omap3630
>
> Trailing spaces.
>
>  S> +endif
>  S> +ifeq ($(BR2_PACKAGE_TI_GFX_ES6),y)
>  S> +TI_GFX_OMPAES = 6.x
>  S> +TI_GFX_PLATFORM = ti81xx
>
> Trailing spaces.
>
>  S> +endif
>  S> +ifeq ($(BR2_PACKAGE_TI_GFX_ES8),y)
>  S> +TI_GFX_OMAPES = 8.x
>  S> +TI_GFX_PLATFORM = ti335x
>  S> +endif
>  S> +
>  S> +ifeq ($(BR2_PACKAGE_TI_GFX_DEBUG),y)
>  S> +TI_GFX_DEBUG_LIB = dbg
>  S> +TI_GFX_DEBUG_KM = debug
>  S> +else
>  S> +TI_GFX_DEBUG_LIB = rel
>  S> +TI_GFX_DEBUG_KM = release
>  S> +endif
>  S> +
>  S> +TI_GFX_BIN_PATH = gfx_$(TI_GFX_DEBUG_LIB)_es$(TI_GFX_OMAPES)
>  S> +
>  S> +TI_GFX_KM_MAKE_OPTS = \
>  S> +   $(LINUX_MAKE_FLAGS) \
>  S> +   BUILD=$(TI_GFX_DEBUG_KM) \
>  S> +   TI_PLATFORM=$(TI_GFX_PLATFORM) \
>  S> +   OMAPES=$(TI_GFX_OMAPES) \
>  S> +   SUPPORT_XORG=0 \
>  S> +   KERNELDIR=$(LINUX_DIR)
>  S> +
>  S> +TI_GFX_DEMO_MAKE_OPTS = \
>  S> +   PLATFORM=LinuxARMV7 \
>  S> +   X11BUILD=0 \
>  S> +   PLAT_CC="$(TARGET_CC)" \
>  S> +   PLAT_CPP="$(TARGET_CXX)" \
>  S> +   PLAT_AR="$(TARGET_AR)"
>  S> +
>  S> +# The only required binary is pvrsrvctl all others are optional
>  S> +TI_GFX_BIN = pvrsrvctl
>  S> +
>  S> +ifeq ($(BR2_PACKAGE_TI_GFX_DEBUG),y)
>  S> +TI_GFX_BIN += \
>  S> +   eglinfo ews_server ews_server_es2 ews_test_gles1 ews_test_gles2 \
>  S> +   ews_test_swrender gles1test1 gles2test1 pvr2d_test services_test \
>  S> +   sgx_blit_test sgx_clipblit_test sgx_flip_test sgx_init_test \
>  S> +   sgx_render_flip_test xeglinfo xgles1test1 xgles2test1 xmultiegltest
>  S> +endif
>  S> +
>  S> +TI_GFX_LIBS = \
>  S> +   libews libpvr2d libpvrEWS_WSEGL libpvrPVR2D_BLITWSEGL libpvrPVR2D_DRIWSEGL \
>  S> +   libpvrPVR2D_FLIPWSEGL libpvrPVR2D_FRONTWSEGL libpvrPVR2D_LINUXFBWSEGL \
>  S> +   libPVRScopeServices libsrv_init libsrv_um libusc pvr_drv
>  S> +
>  S> +TI_GFX_EGLIMAGE_LIBS = \
>  S> +   libEGL libGLES_CM libGLESv2 libglslcompiler libIMGegl
>  S> +
>  S> +TI_GFX_DEMOS = ChameleonMan MagicLantern
>  S> +TI_GFX_DEMOS_LOC = GFX_Linux_SDK/OGLES2/SDKPackage/Demos
>  S> +TI_GFX_DEMOS_MAKE_LOC = OGLES2/Build/LinuxGeneric
>  S> +TI_GFX_DEMOS_BIN_LOC = OGLES2/Build/LinuxARMV7/ReleaseRaw/
>  S> +
>  S> +TI_GFX_HDR_DIRS = OGLES2/EGL OGLES2/EWS OGLES2/GLES2 OGLES2/KHR \
>  S> +   OGLES/GLES bufferclass_ti/ pvr2d/ wsegl/
>  S> +
>  S> +define TI_GFX_EXTRACT_CMDS
>
> Trailing spaces.
>
>  S> +   $(RM) -rf $(TI_GFX_DIR)
>  S> +   chmod +x $(DL_DIR)/$(TI_GFX_SOURCE)
>  S> +   printf "Y\nY\n qY\n\n" | $(DL_DIR)/$(TI_GFX_SOURCE) \
>  S> +           --prefix $(@D) \
>  S> +           --mode console
>  S> +endef
>  S> +
>  S> +define TI_GFX_BUILD_KM_CMDS
>  S> +   $(MAKE) $(TI_GFX_KM_MAKE_OPTS) -C $(@D)/GFX_Linux_KM all
>  S> +endef
>  S> +
>  S> +define TI_GFX_BUILD_DEMO_CMDS
>  S> +   $(foreach demo, $(TI_GFX_DEMOS), \
>  S> +           $(TARGET_MAKE_ENV) $(MAKE1) -C \
>  S> +                   $(@D)/$(TI_GFX_DEMOS_LOC)/$(demo)/$(TI_GFX_DEMOS_MAKE_LOC) \
>  S> +                   $(TI_GFX_DEMO_MAKE_OPTS) all
>  S> +   )
>  S> +endef
>
> This should be inside a ifeq ($(BR2_PACKAGE_TI_GFX_DEMOS),y) conditional.

Will fix.

>
>  S> +
>  S> +define TI_GFX_BUILD_CMDS
>  S> +   $(TI_GFX_BUILD_KM_CMDS)
>  S> +   $(TI_GFX_BUILD_DEMO_CMDS)
>  S> +endef
>  S> +
>  S> +# Install libs
>  S> +# argument 1 is the location to install to (e.g. STAGING_DIR, TARGET_DIR)
>  S> +define TI_GFX_INSTALL_LIBS
>  S> +   $(foreach lib,$(TI_GFX_LIBS),
>  S> +           $(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib).so \
>  S> +                   $(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION); \
>  S> +           ln -sf $(lib).so.$(TI_GFX_SO_VERSION) \
>  S> +                   $(1)/usr/lib/$(lib).so
>  S> +   )
>  S> +   $(foreach lib,$(TI_GFX_EGLIMAGE_LIBS),
>  S> +           $(if $(BR2_PACKAGE_TI_GFX_EGLIMAGE),
>  S> +                   $(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib)_eglimage.so \
>  S> +                           $(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION);
>  S> +           ,
>  S> +                   $(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib).so \
>
> Trailing spaces.
>
>  S> +                           $(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION);
>  S> +           )
>  S> +           ln -sf $(lib).so.$(TI_GFX_SO_VERSION) \
>  S> +                   $(1)/usr/lib/$(lib).so
>  S> +   )
>  S> +endef
>  S> +
>  S> +define TI_GFX_INSTALL_STAGING_CMDS
>  S> +   $(foreach incdir,$(TI_GFX_HDR_DIRS),
>  S> +           $(INSTALL) -d $(STAGING_DIR)/usr/include/$(notdir $(incdir)); \
>  S> +           $(INSTALL) -D -m 0644 $(@D)/include/$(incdir)/*.h \
>  S> +                   $(STAGING_DIR)/usr/include/$(notdir $(incdir))/
>  S> +   )
>  S> +   $(call TI_GFX_INSTALL_LIBS,$(STAGING_DIR))
>  S> +
>
> Trailing spaces.
>
>  S> +   $(INSTALL) -D -m 0644 package/ti-gfx/egl.pc $(STAGING_DIR)/usr/lib/pkgconfig/
>  S> +   $(INSTALL) -D -m 0644 package/ti-gfx/glesv2.pc $(STAGING_DIR)/usr/lib/pkgconfig/
>  S> +endef
>  S> +
>  S> +define TI_GFX_INSTALL_KM_CMDS
>  S> +   $(MAKE) $(TI_GFX_KM_MAKE_OPTS) -C $(@D)/GFX_Linux_KM install
>  S> +endef
>  S> +
>  S> +define TI_GFX_INSTALL_BINS_CMDS
>  S> +   $(foreach bin,$(TI_GFX_BIN),
>  S> +           $(INSTALL) -D -m 0755 $(@D)/$(TI_GFX_BIN_PATH)/$(bin) \
>  S> +                   $(TARGET_DIR)/usr/bin/$(bin)
>  S> +   )
>  S> +   $(if $(BR2_PACKAGE_TI_GFX_DEBUG),
>  S> +           $(INSTALL) -D -m 0755 package/ti-gfx/esrev.sh \
>  S> +                   $(TARGET_DIR)/usr/bin/esrev
>
> You could perhaps argue that a script like esrev fiddling around with
> devmem should rather be installed into usr/sbin.

Will fix.

Thanks,
Spenser



--
Spenser Gilliland
Computer Engineer
Doctoral Candidate
Peter Korsgaard July 15, 2013, 9:18 p.m. UTC | #6
>>>>> "Spenser" == Spenser Gilliland <spenser@gillilanding.com> writes:

 Spenser> Peter,
 Spenser> I'll get this fixed up immediately and get it back to you. Thanks for
 Spenser> taking the time to review it.

Great! Besides these minor issues I think this series is good to go.
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 6909142..35846cc 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -292,6 +292,7 @@  source "package/snowball-hdmiservice/Config.in"
 source "package/sredird/Config.in"
 source "package/statserial/Config.in"
 source "package/sysstat/Config.in"
+source "package/ti-gfx/Config.in"
 source "package/ti-utils/Config.in"
 source "package/uboot-tools/Config.in"
 source "package/udev/Config.in"
diff --git a/package/opengl/libegl/libegl.mk b/package/opengl/libegl/libegl.mk
index bd8040d..00e1f19 100644
--- a/package/opengl/libegl/libegl.mk
+++ b/package/opengl/libegl/libegl.mk
@@ -10,6 +10,10 @@  ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
 LIBEGL_DEPENDENCIES += rpi-userland
 endif
 
+ifeq ($(BR2_PACKAGE_TI_GFX),y)
+LIBEGL_DEPENDENCIES += ti-gfx
+endif
+
 ifeq ($(LIBEGL_DEPENDENCIES),)
 define LIBEGL_CONFIGURE_CMDS
 	echo "No libEGL implementation selected. Configuration error."
diff --git a/package/opengl/libgles/libgles.mk b/package/opengl/libgles/libgles.mk
index a0048a7..d2fe11b 100644
--- a/package/opengl/libgles/libgles.mk
+++ b/package/opengl/libgles/libgles.mk
@@ -10,6 +10,10 @@  ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
 LIBGLES_DEPENDENCIES += rpi-userland
 endif
 
+ifeq ($(BR2_PACKAGE_TI_GFX),y)
+LIBGLES_DEPENDENCIES += ti-gfx
+endif
+
 ifeq ($(LIBGLES_DEPENDENCIES),)
 define LIBGLES_CONFIGURE_CMDS
 	echo "No libGLES implementation selected. Configuration error."
diff --git a/package/ti-gfx/Config.in b/package/ti-gfx/Config.in
new file mode 100644
index 0000000..25a00af
--- /dev/null
+++ b/package/ti-gfx/Config.in
@@ -0,0 +1,69 @@ 
+config BR2_PACKAGE_TI_GFX
+	bool "ti-gfx"
+	select BR2_PACKAGE_HAS_OPENGL_EGL
+	select BR2_PACKAGE_HAS_OPENGL_ES
+	select BR2_PACKAGE_HAS_POWERVR
+	depends on BR2_LINUX_KERNEL && BR2_TOOLCHAIN_USES_GLIBC && BR2_arm
+	help
+	  Graphics libraries for TI boards.
+
+	  http://downloads.ti.com/dsps/dsps_public_sw/gfxsdk/
+
+if BR2_PACKAGE_TI_GFX
+
+config BR2_PACKAGE_TI_GFX_DEBUG
+	bool "enable debug support"
+	help
+	  Turns on debugging in the kernel module, install libraries built with
+	  debugging enabled, installs various tests and installs esrev script.
+
+config BR2_PACKAGE_TI_GFX_DEMOS
+	bool "install demos"
+	default y
+	help
+	  Install the OGLES2ChameleonMan and OGLES2MagicLantern demos
+
+config BR2_PACKAGE_TI_GFX_EGLIMAGE
+	bool "install eglimage version of libraries"
+	help
+	  Installs OpenGL libaries which support the eglimage api.
+
+config BR2_PACKAGE_TI_GFX_HARD_FLOAT
+	bool "use hard float binaries"
+	help
+	  Install hard float binaries (required if using a hard float toolchain)
+
+choice
+	prompt "Target"
+	default BR2_PACKAGE_TI_GFX_ES3
+	help
+	  Select the SOC for which you would like to install drivers. Please 
+	  use the chart at
+	  http://processors.wiki.ti.com/index.php/OMAP35x_Graphics_SDK_Getting_Started_Guide
+
+config BR2_PACKAGE_TI_GFX_ES3
+	bool "es3.x (OMAP35xx, AM35xx Rev 3.1+)"
+	help
+	 OMAP35xx, AM35xx Rev 3.1+ 
+
+config BR2_PACKAGE_TI_GFX_ES5
+	bool "es5.x (AM37xx, DM37xx)"
+	help
+	  AM37xx, DM37xx
+
+config BR2_PACKAGE_TI_GFX_ES6
+	bool "es6.x (AM387x, C6A814x, AM389x, C6A816x)"
+	help
+	  AM387x, C6A814x, AM389x, C6A816x
+
+config BR2_PACKAGE_TI_GFX_ES8
+	bool "es8.x (AM335x)"
+	help
+	  AM335x
+
+endchoice
+
+endif
+
+comment "ti-gfx requires an eglibc/glibc based toolchain and the linux kernel"
+	depends on !(BR2_LINUX_KERNEL && BR2_TOOLCHAIN_USES_GLIBC) && BR2_arm
diff --git a/package/ti-gfx/S80ti-gfx b/package/ti-gfx/S80ti-gfx
new file mode 100644
index 0000000..ee2250e
--- /dev/null
+++ b/package/ti-gfx/S80ti-gfx
@@ -0,0 +1,54 @@ 
+#!/bin/sh
+
+start() {
+	echo "ti-gfx: starting pvr driver"
+
+	BITSPERPIXEL="$(fbset | awk '/geom/ {print $6}')"
+	YRES="$(fbset | awk '/geom/ {print $3}')"
+	# Set RGBA ordering to something the drivers like
+	if [ "$BITSPERPIXEL" = "32" ] ; then
+		fbset -rgba 8/16,8/8,8/0,8/24
+	fi
+	# Try to enable triple buffering when there's enough VRAM
+	fbset -vyres $(( YRES*3 ))
+
+	modprobe omaplfb
+	modprobe bufferclass_ti
+
+	pvr_maj=$(awk '$2=="pvrsrvkm" { print $1; }' /proc/devices)
+	if [ -e /dev/pvrsrvkm ] ; then
+		rm -f /dev/pvrsrvkm
+	fi
+
+	mknod /dev/pvrsrvkm c $pvr_maj 0
+	chmod 666 /dev/pvrsrvkm
+
+	if ! /usr/bin/pvrsrvctl --start --no-module; then
+		echo "ti-gfx: unable to start server"
+	fi
+}	
+
+stop() {
+	echo "ti-gfx: stopping pvr driver"
+
+	rmmod bufferclass_ti
+	rmmod omaplfb
+	rmmod pvrsrvkm
+}
+
+case "$1" in 
+start)
+	start
+;;
+stop)
+	stop
+;;
+restart)
+	stop
+	start
+;;
+*)
+	echo "ti-gfx: Please use start, stop, or restart."
+	exit 1
+;;
+esac
diff --git a/package/ti-gfx/egl.pc b/package/ti-gfx/egl.pc
new file mode 100644
index 0000000..c06fed1
--- /dev/null
+++ b/package/ti-gfx/egl.pc
@@ -0,0 +1,12 @@ 
+prefix=/usr/
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: egl
+Description: TI Graphics SDK implementation of EGL
+Version: 1.9.2188537
+Requires:
+Libs: -L${libdir} -lEGL -lGLESv2 -lIMGegl
+Cflags: -I{includedir}/EGL/ -I${includedir}
+
diff --git a/package/ti-gfx/esrev.sh b/package/ti-gfx/esrev.sh
new file mode 100644
index 0000000..bd8b64e
--- /dev/null
+++ b/package/ti-gfx/esrev.sh
@@ -0,0 +1,59 @@ 
+#!/bin/sh
+
+# Debug script to determine proper ES revision for the current board. The 
+# pvrsrvkm module must be insmoded before attempting to get the es rev.
+
+machine_id() { # return the machine ID
+	awk 'BEGIN { FS=": " } /Hardware/ \
+		{ gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo
+}
+
+if [ "$(machine_id)" = "ti8168evm" ] ; then
+	CPUTYPE=TI816x
+elif [ "$(machine_id)" = "am335xevm" ] ; then
+	CPUTYPE=TI33XX
+else
+	CPUTYPE=$(devmem 0x4800244c | sed -e 's/0x00005C00/OMAP3503/' \
+	                                  -e 's/0x00001C00/OMAP3515/' \
+	                                  -e 's/0x00004C00/OMAP3525/' \
+	                                  -e 's/0x00000C00/OMAP3530/' \
+	                                  -e 's/0x00005E00/OMAP3503/' \
+	                                  -e 's/0x00001E00/OMAP3515/' \
+	                                  -e 's/0x00004E00/OMAP3525/' \
+	                                  -e 's/0x00000E00/OMAP3530/' \
+	                                  -e 's/0x00000CC0/OMAP3530/' )
+	if [[ "$(echo $CPUTYPE | grep OMAP)" == "" ]]; then
+		echo "Unable to determine CPU type"
+		exit 1
+	fi
+fi
+
+case $CPUTYPE in
+"OMAP3530")
+	devmem 0x48004B48 w 0x2
+	devmem 0x48004B10 w 0x1
+	devmem 0x48004B00 w 0x2
+
+	ES_REVISION="$(devmem 0x50000014 | sed -e s:0x00010205:5: \
+		-e s:0x00010201:3: -e s:0x00010003:2:)"
+	;;
+"TI33XX")
+	devmem 0x44e01104 w 0x0
+	devmem 0x44e00904 w 0x2
+
+	ES_REVISION="$(devmem 0x56000014 | sed -e s:0x00010205:8:)"
+	;;
+"TI816x")
+	devmem 0x48180F04 w 0x0
+	devmem 0x48180900 w 0x2
+	devmem 0x48180920 w 0x2
+
+	ES_REVISION="$(devmem2 0x56000014 | sed -e s:0x00010205:6: -e s:0x00010201:3: -e s:0x00010003:2: | tail -n1 | awk -F': ' '{print $2}')"
+	;;
+*)
+	echo Unable to determine SGX hardware
+	exit 2
+	;;
+esac
+
+echo $ES_REVISION
diff --git a/package/ti-gfx/glesv2.pc b/package/ti-gfx/glesv2.pc
new file mode 100644
index 0000000..e1505f2
--- /dev/null
+++ b/package/ti-gfx/glesv2.pc
@@ -0,0 +1,12 @@ 
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: glesv2
+Description: TI Graphics SDK implementation of OpenGL ESv2
+Version: 1.9.2188537
+Requires:
+Libs: -L${libdir} -lGLESv2 -lGLES_CM -lsrv_um -lusc -lEGL -lIMGegl
+Cflags: -I${includedir}/GLES2
+
diff --git a/package/ti-gfx/powervr.ini b/package/ti-gfx/powervr.ini
new file mode 100644
index 0000000..8d2d853
--- /dev/null
+++ b/package/ti-gfx/powervr.ini
@@ -0,0 +1,2 @@ 
+[default]
+WindowSystem=libpvrPVR2D_FRONTWSEGL.so
diff --git a/package/ti-gfx/ti-gfx-km_install_modules.patch b/package/ti-gfx/ti-gfx-km_install_modules.patch
new file mode 100644
index 0000000..2cf6e81
--- /dev/null
+++ b/package/ti-gfx/ti-gfx-km_install_modules.patch
@@ -0,0 +1,19 @@ 
+Patch to add modules_install target to the modules makefile.  This makes
+installation a little easier.
+
+Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
+----
+Index: ti-gfx-4_09_00_01/GFX_Linux_KM/Makefile
+===================================================================
+--- ti-gfx-4_09_00_01.orig/GFX_Linux_KM/Makefile	2013-03-07 11:00:11.000000000 -0600
++++ ti-gfx-4_09_00_01/GFX_Linux_KM/Makefile	2013-05-23 01:36:29.356676281 -0500
+@@ -479,6 +479,9 @@
+ all:
+ 	$(MAKE) -C $(KERNELDIR) M=`pwd` $*
+ 
++install:
++	$(MAKE) -C $(KERNELDIR) M=`pwd` modules_install
++
+ clean:
+ 	@find . -name "*.o" -exec rm -r {} \;
+ 	@find . -name "*.ko" -exec rm -r {} \;
diff --git a/package/ti-gfx/ti-gfx-newclkapi.patch b/package/ti-gfx/ti-gfx-newclkapi.patch
new file mode 100644
index 0000000..8f50c7e
--- /dev/null
+++ b/package/ti-gfx/ti-gfx-newclkapi.patch
@@ -0,0 +1,143 @@ 
+This patch adjusts the omap3630 portion of the powervr driver to use the new
+clk kernel api.
+
+Signed-off-by: Spenser Gilliland <spenser@gillilanding.com>
+----
+Index: ti-gfx-4_09_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c
+===================================================================
+--- ti-gfx-4_09_00_01.orig/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c	2013-06-28 13:44:06.352701522 -0500
++++ ti-gfx-4_09_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c	2013-06-28 13:45:12.364702727 -0500
+@@ -153,6 +153,49 @@
+ 	psTimingInfo->ui32ActivePowManLatencyms = SYS_SGX_ACTIVE_POWER_LATENCY_MS;
+ }
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
++int clk_disable_unprepare(struct clk *clk)
++{
++	return clk_disable(clk);
++}
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
++int clk_disable_unprepare(struct clk *clk)
++{
++	res = clk_disable(clk);
++	if (res < 0)
++		return res;
++
++	res = clk_unprepare(clk);
++	if (ret < 0)
++		return res;
++
++	return 0;
++}
++#endif
++
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)
++int clk_prepare_enable(struct clk *clk)
++{
++	return clk_enable(clk);
++}
++#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
++int clk_prepare_enable(struct clk *clk)
++{
++	res = clk_prepare(clk);
++	if (ret < 0)
++		return res;
++
++	res = clk_enable(clk);
++	if (res < 0) {
++		clk_unprepare(clk);
++		return res;
++	}
++
++	return 0;
++}
++#endif
++
+ PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData)
+ {
+ #if !defined(NO_HARDWARE)
+@@ -167,19 +210,19 @@
+ 
+ 	PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
+ 	
+-	res=clk_enable(psSysSpecData->psSGX_FCK);
++	res=clk_prepare_enable(psSysSpecData->psSGX_FCK);
+ 	if (res < 0)
+         {
+                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
+                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
+         }
+ 
+-	res=clk_enable(psSysSpecData->psSGX_ICK);
++	res=clk_prepare_enable(psSysSpecData->psSGX_ICK);
+         if (res < 0)
+         {
+                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX interface clock (%d)", res));
+ 
+-                clk_disable(psSysSpecData->psSGX_FCK);
++                clk_disable_unprepare(psSysSpecData->psSGX_FCK);
+                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
+         }
+ 
+@@ -233,7 +276,6 @@
+ 	return PVRSRV_OK;
+ }
+ 
+-
+ IMG_VOID DisableSGXClocks(SYS_DATA *psSysData)
+ {
+ #if !defined(NO_HARDWARE)
+@@ -246,9 +288,9 @@
+ 	
+ 	PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks"));
+ 	
+-	clk_disable(psSysSpecData->psSGX_FCK);
++	clk_disable_unprepare(psSysSpecData->psSGX_FCK);
+ 
+-	clk_disable(psSysSpecData->psSGX_ICK);
++	clk_disable_unprepare(psSysSpecData->psSGX_ICK);
+ 
+ //	SysDisableSGXInterrupts(psSysData);
+ 
+@@ -374,14 +416,14 @@
+ 	rate = clk_get_rate(psSysSpecData->psGPT11_FCK);
+ 	PVR_TRACE(("GPTIMER11 clock is %dMHz", HZ_TO_MHZ(rate)));
+ 
+-	res = clk_enable(psSysSpecData->psGPT11_FCK);
++	res = clk_prepare_enable(psSysSpecData->psGPT11_FCK);
+ 	if (res < 0)
+ 	{
+ 		PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 functional clock (%d)", res));
+ 		goto ExitError;
+ 	}
+ 
+-	res = clk_enable(psSysSpecData->psGPT11_ICK);
++	res = clk_prepare_enable(psSysSpecData->psGPT11_ICK);
+ 	if (res < 0)
+ 	{
+ 		PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 interface clock (%d)", res));
+@@ -444,9 +486,9 @@
+ 
+ ExitDisableGPT11ICK:
+ #if defined(PVR_OMAP3_TIMING_PRCM)
+-	clk_disable(psSysSpecData->psGPT11_ICK);
++	clk_disable_unprepare(psSysSpecData->psGPT11_ICK);
+ ExitDisableGPT11FCK:
+-	clk_disable(psSysSpecData->psGPT11_FCK);
++	clk_disable_unprepare(psSysSpecData->psGPT11_FCK);
+ ExitError:
+ #endif	
+ 	eError = PVRSRV_ERROR_CLOCK_REQUEST_FAILED;
+@@ -490,9 +532,9 @@
+ #endif
+ 
+ #if defined(PVR_OMAP3_TIMING_PRCM)
+-	clk_disable(psSysSpecData->psGPT11_ICK);
++	clk_disable_unprepare(psSysSpecData->psGPT11_ICK);
+ 
+-	clk_disable(psSysSpecData->psGPT11_FCK);
++	clk_disable_unprepare(psSysSpecData->psGPT11_FCK);
+ #endif	
+ }
+ #endif	
diff --git a/package/ti-gfx/ti-gfx.mk b/package/ti-gfx/ti-gfx.mk
new file mode 100644
index 0000000..89da699
--- /dev/null
+++ b/package/ti-gfx/ti-gfx.mk
@@ -0,0 +1,195 @@ 
+###############################################################################
+#
+# ti-gfx 
+#
+###############################################################################
+
+TI_GFX_VERSION = 4_09_00_01
+TI_GFX_SO_VERSION = 1.9.2188537
+
+ifeq ($(BR2_PACKAGE_TI_GFX_HARD_FLOAT),y)
+TI_GFX_SOURCE = Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_hardfp_minimal_demos.bin
+else
+TI_GFX_SOURCE = Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_minimal_demos.bin
+endif
+
+TI_GFX_SITE = http://downloads.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/$(TI_GFX_VERSION)/exports/
+TI_GFX_LICENSE = Technology / Software Publicly Available
+TI_GFX_LICENSE_FILES = TSPA.txt
+TI_GFX_INSTALL_STAGING = YES
+
+TI_GFX_DEPENDENCIES = linux
+
+ifeq ($(BR2_PACKAGE_TI_GFX_ES3),y)
+TI_GFX_OMAPES = 3.x
+TI_GFX_PLATFORM = omap3
+endif
+ifeq ($(BR2_PACKAGE_TI_GFX_ES5),y)
+TI_GFX_OMAPES = 5.x
+TI_GFX_PLATFORM = omap3630 
+endif
+ifeq ($(BR2_PACKAGE_TI_GFX_ES6),y)
+TI_GFX_OMPAES = 6.x
+TI_GFX_PLATFORM = ti81xx 
+endif
+ifeq ($(BR2_PACKAGE_TI_GFX_ES8),y)
+TI_GFX_OMAPES = 8.x
+TI_GFX_PLATFORM = ti335x
+endif
+
+ifeq ($(BR2_PACKAGE_TI_GFX_DEBUG),y)
+TI_GFX_DEBUG_LIB = dbg
+TI_GFX_DEBUG_KM = debug
+else
+TI_GFX_DEBUG_LIB = rel
+TI_GFX_DEBUG_KM = release
+endif
+
+TI_GFX_BIN_PATH = gfx_$(TI_GFX_DEBUG_LIB)_es$(TI_GFX_OMAPES)
+
+TI_GFX_KM_MAKE_OPTS = \
+	$(LINUX_MAKE_FLAGS) \
+	BUILD=$(TI_GFX_DEBUG_KM) \
+	TI_PLATFORM=$(TI_GFX_PLATFORM) \
+	OMAPES=$(TI_GFX_OMAPES) \
+	SUPPORT_XORG=0 \
+	KERNELDIR=$(LINUX_DIR)
+
+TI_GFX_DEMO_MAKE_OPTS = \
+	PLATFORM=LinuxARMV7 \
+	X11BUILD=0 \
+	PLAT_CC="$(TARGET_CC)" \
+	PLAT_CPP="$(TARGET_CXX)" \
+	PLAT_AR="$(TARGET_AR)"
+
+# The only required binary is pvrsrvctl all others are optional
+TI_GFX_BIN = pvrsrvctl
+
+ifeq ($(BR2_PACKAGE_TI_GFX_DEBUG),y)
+TI_GFX_BIN += \
+	eglinfo ews_server ews_server_es2 ews_test_gles1 ews_test_gles2 \
+	ews_test_swrender gles1test1 gles2test1 pvr2d_test services_test \
+	sgx_blit_test sgx_clipblit_test sgx_flip_test sgx_init_test \
+	sgx_render_flip_test xeglinfo xgles1test1 xgles2test1 xmultiegltest
+endif
+
+TI_GFX_LIBS = \
+	libews libpvr2d libpvrEWS_WSEGL libpvrPVR2D_BLITWSEGL libpvrPVR2D_DRIWSEGL \
+	libpvrPVR2D_FLIPWSEGL libpvrPVR2D_FRONTWSEGL libpvrPVR2D_LINUXFBWSEGL \
+	libPVRScopeServices libsrv_init libsrv_um libusc pvr_drv
+
+TI_GFX_EGLIMAGE_LIBS = \
+	libEGL libGLES_CM libGLESv2 libglslcompiler libIMGegl
+
+TI_GFX_DEMOS = ChameleonMan MagicLantern
+TI_GFX_DEMOS_LOC = GFX_Linux_SDK/OGLES2/SDKPackage/Demos
+TI_GFX_DEMOS_MAKE_LOC = OGLES2/Build/LinuxGeneric
+TI_GFX_DEMOS_BIN_LOC = OGLES2/Build/LinuxARMV7/ReleaseRaw/
+
+TI_GFX_HDR_DIRS = OGLES2/EGL OGLES2/EWS OGLES2/GLES2 OGLES2/KHR \
+	OGLES/GLES bufferclass_ti/ pvr2d/ wsegl/
+
+define TI_GFX_EXTRACT_CMDS 
+	$(RM) -rf $(TI_GFX_DIR)
+	chmod +x $(DL_DIR)/$(TI_GFX_SOURCE)
+	printf "Y\nY\n qY\n\n" | $(DL_DIR)/$(TI_GFX_SOURCE) \
+		--prefix $(@D) \
+		--mode console
+endef
+
+define TI_GFX_BUILD_KM_CMDS
+	$(MAKE) $(TI_GFX_KM_MAKE_OPTS) -C $(@D)/GFX_Linux_KM all
+endef
+
+define TI_GFX_BUILD_DEMO_CMDS
+	$(foreach demo, $(TI_GFX_DEMOS), \
+		$(TARGET_MAKE_ENV) $(MAKE1) -C \
+			$(@D)/$(TI_GFX_DEMOS_LOC)/$(demo)/$(TI_GFX_DEMOS_MAKE_LOC) \
+			$(TI_GFX_DEMO_MAKE_OPTS) all
+	)
+endef
+
+define TI_GFX_BUILD_CMDS
+	$(TI_GFX_BUILD_KM_CMDS)
+	$(TI_GFX_BUILD_DEMO_CMDS)
+endef
+
+# Install libs
+# argument 1 is the location to install to (e.g. STAGING_DIR, TARGET_DIR)
+define TI_GFX_INSTALL_LIBS
+	$(foreach lib,$(TI_GFX_LIBS),
+		$(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib).so \
+			$(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION); \
+		ln -sf $(lib).so.$(TI_GFX_SO_VERSION) \
+			$(1)/usr/lib/$(lib).so
+	)
+	$(foreach lib,$(TI_GFX_EGLIMAGE_LIBS),
+		$(if $(BR2_PACKAGE_TI_GFX_EGLIMAGE),
+			$(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib)_eglimage.so \
+				$(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION);
+		,
+			$(INSTALL) -D -m 0644 $(@D)/$(TI_GFX_BIN_PATH)/$(lib).so \ 
+				$(1)/usr/lib/$(lib).so.$(TI_GFX_SO_VERSION);
+		)
+		ln -sf $(lib).so.$(TI_GFX_SO_VERSION) \
+			$(1)/usr/lib/$(lib).so
+	)
+endef
+
+define TI_GFX_INSTALL_STAGING_CMDS
+	$(foreach incdir,$(TI_GFX_HDR_DIRS),
+		$(INSTALL) -d $(STAGING_DIR)/usr/include/$(notdir $(incdir)); \
+		$(INSTALL) -D -m 0644 $(@D)/include/$(incdir)/*.h \
+			$(STAGING_DIR)/usr/include/$(notdir $(incdir))/
+	)
+	$(call TI_GFX_INSTALL_LIBS,$(STAGING_DIR))
+	
+	$(INSTALL) -D -m 0644 package/ti-gfx/egl.pc $(STAGING_DIR)/usr/lib/pkgconfig/
+	$(INSTALL) -D -m 0644 package/ti-gfx/glesv2.pc $(STAGING_DIR)/usr/lib/pkgconfig/
+endef
+
+define TI_GFX_INSTALL_KM_CMDS
+	$(MAKE) $(TI_GFX_KM_MAKE_OPTS) -C $(@D)/GFX_Linux_KM install
+endef
+
+define TI_GFX_INSTALL_BINS_CMDS
+	$(foreach bin,$(TI_GFX_BIN),
+		$(INSTALL) -D -m 0755 $(@D)/$(TI_GFX_BIN_PATH)/$(bin) \
+			$(TARGET_DIR)/usr/bin/$(bin)
+	)
+	$(if $(BR2_PACKAGE_TI_GFX_DEBUG),
+		$(INSTALL) -D -m 0755 package/ti-gfx/esrev.sh \
+			$(TARGET_DIR)/usr/bin/esrev
+	)
+endef
+
+define TI_GFX_INSTALL_CONF_CMDS
+	# libs use the following file for configuration.
+	$(INSTALL) -D -m 0644 package/ti-gfx/powervr.ini \
+		$(TARGET_DIR)/etc/powervr.ini
+endef
+
+ifeq ($(BR2_PACKAGE_TI_GFX_DEMOS),y)
+define TI_GFX_INSTALL_DEMOS_CMDS
+	$(foreach demo,$(TI_GFX_DEMOS),
+		$(INSTALL) -D -m 0755 \
+		$(@D)/$(TI_GFX_DEMOS_LOC)/$(demo)/$(TI_GFX_DEMOS_BIN_LOC)/OGLES2$(demo) \
+		$(TARGET_DIR)/usr/bin/OGLES2$(demo)
+	)
+endef
+endif
+
+define TI_GFX_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 package/ti-gfx/S80ti-gfx \
+		$(TARGET_DIR)/etc/init.d/S80ti-gfx
+endef
+
+define TI_GFX_INSTALL_TARGET_CMDS
+	$(TI_GFX_INSTALL_KM_CMDS)
+	$(TI_GFX_INSTALL_BINS_CMDS)
+	$(call TI_GFX_INSTALL_LIBS,$(TARGET_DIR))
+	$(TI_GFX_INSTALL_CONF_CMDS)
+	$(TI_GFX_INSTALL_DEMOS_CMDS)
+endef
+
+$(eval $(generic-package))