diff mbox

[RFC] ti-gfx: add new package

Message ID 1370636307-23089-1-git-send-email-spenser@gillilanding.com
State RFC
Headers show

Commit Message

Spenser Gilliland June 7, 2013, 8:18 p.m. UTC
This is WIP of adding the TI Graphics SDK to buildroot.

TODO:
   Install startup files for sgx core.
   Install khronos gles/egl/vg libraries.
   Create .pc files to simplfy additional packaging.
   Testing, lots of testing.

---
 package/Config.in                              |    1 +
 package/opengl/libegl/libegl.mk                |    4 +
 package/opengl/libgles/libgles.mk              |    4 +
 package/opengl/libopenvg/libopenvg.mk          |    4 +
 package/ti-gfx/Config.in                       |   54 ++++++++++++++++++
 package/ti-gfx/ti-gfx-km_install_modules.patch |   14 +++++
 package/ti-gfx/ti-gfx-newclkapi.patch          |   55 ++++++++++++++++++
 package/ti-gfx/ti-gfx.mk                       |   71 ++++++++++++++++++++++++
 8 files changed, 207 insertions(+), 0 deletions(-)
 create mode 100644 package/ti-gfx/Config.in
 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

Charles Krinke June 11, 2013, 5:58 p.m. UTC | #1
Dear Spenser:

I believe including a kernel compile with this patch is a problem for
several reasons.

The first is that the TI defconfig for AM3517_evm never made it into
the Linux kernel along with all the supporting changes, so the build
fails.

The second is that folks are using various versions of Graphics_SDK
from 4_05_xx through 4_09_xx. These same folks generally build the
Graphics_SDK once externally to buildroot to avoid carrying a 135MB
file in the dl/ directory. This doesnt make sense for buildroot for
two kernel .ko modules where 135MByte is larger then any other
package.

Perhaps you can consider making Graphics_SDK an external reference in
your patch to make things go more smoothly?

On 6/7/13, Spenser Gilliland <spenser@gillilanding.com> wrote:
> This is WIP of adding the TI Graphics SDK to buildroot.
>
> TODO:
>    Install startup files for sgx core.
>    Install khronos gles/egl/vg libraries.
>    Create .pc files to simplfy additional packaging.
>    Testing, lots of testing.
>
> ---
>  package/Config.in                              |    1 +
>  package/opengl/libegl/libegl.mk                |    4 +
>  package/opengl/libgles/libgles.mk              |    4 +
>  package/opengl/libopenvg/libopenvg.mk          |    4 +
>  package/ti-gfx/Config.in                       |   54 ++++++++++++++++++
>  package/ti-gfx/ti-gfx-km_install_modules.patch |   14 +++++
>  package/ti-gfx/ti-gfx-newclkapi.patch          |   55 ++++++++++++++++++
>  package/ti-gfx/ti-gfx.mk                       |   71
> ++++++++++++++++++++++++
>  8 files changed, 207 insertions(+), 0 deletions(-)
>  create mode 100644 package/ti-gfx/Config.in
>  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
>
> diff --git a/package/Config.in b/package/Config.in
> index ce82e99..8c40b56 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -290,6 +290,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/opengl/libopenvg/libopenvg.mk
> b/package/opengl/libopenvg/libopenvg.mk
> index 03f59ba..118ae7f 100644
> --- a/package/opengl/libopenvg/libopenvg.mk
> +++ b/package/opengl/libopenvg/libopenvg.mk
> @@ -10,6 +10,10 @@ ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
>  LIBOPENVG_DEPENDENCIES += rpi-userland
>  endif
>
> +ifeq ($(BR2_PACKAGE_TI_GFX),y)
> +LIBOPENVG_DEPENDENCIES += ti-gfx
> +endif
> +
>  ifeq ($(LIBOPENVG_DEPENDENCIES),)
>  define LIBOPENVG_CONFIGURE_CMDS
>  	echo "No libOpenVG implementation selected. Configuration error."
> diff --git a/package/ti-gfx/Config.in b/package/ti-gfx/Config.in
> new file mode 100644
> index 0000000..c3ac984
> --- /dev/null
> +++ b/package/ti-gfx/Config.in
> @@ -0,0 +1,54 @@
> +config BR2_PACKAGE_TI_GFX
> +	bool "ti-gfx"
> +	select BR2_LINUX_KERNEL
> +	select BR2_PACKAGE_DEVMEM2
> +	select BR2_PACKAGE_HAS_OPENGL_EGL
> +	select BR2_PACKAGE_HAS_OPENGL_ES
> +	depends on BR2_TOOLCHAIN_EXTERNAL_GLIBC || BR2_TOOLCHAIN_CTNG_eglibc ||
> BR2_TOOLCHAIN_CTNG_glibc
> +	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
> +	  Turn on debugging in kernel module and install libraries built with
> +	  debugging enabled
> +
> +choice
> +	prompt "Target"
> +	default BR2_PACKAGE_TI_GFX_OMAP3
> +	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"
> +	help
> +	 OMAP35xx, AM35xx Rev 3.1+
> +
> +config BR2_PACKAGE_TI_GFX_ES5
> +	bool "es5.x"
> +	help
> +	  AM37xx, DM37xx
> +
> +config BR2_PACKAGE_TI_GFX_ES6
> +	bool "es6.x"
> +	help
> +	  AM387x, C6A814x, AM389x, C6A816x
> +
> +config BR2_PACKAGE_TI_GFX_ES8
> +	bool "es8.x"
> +	help
> +	  AM335x
> +
> +endchoice
> +
> +endif
> +
> +comment "requires an external eglibc/glibc based toolchain"
> +	depends on !(BR2_TOOLCHAIN_EXTERNAL_GLIBC || BR2_TOOLCHAIN_CTNG_eglibc ||
> BR2_TOOLCHAIN_CTNG_glibc)
> 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..63bfd19
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx-km_install_modules.patch
> @@ -0,0 +1,14 @@
> +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..b35ac31
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx-newclkapi.patch
> @@ -0,0 +1,55 @@
> +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-03-04
> 08:41:35.000000000 -0600
> ++++
> ti-gfx-4_09_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c	2013-06-05
> 12:00:08.778605221 -0500
> +@@ -166,11 +166,27 @@
> + 	}
> +
> + 	PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
> +-	
> ++   res=clk_prepare(psSysSpecData->psSGX_FCK);
> ++	if (res < 0)
> ++        {
> ++                PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable
> SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> ++                return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> ++        }
> ++
> + 	res=clk_enable(psSysSpecData->psSGX_FCK);
> + 	if (res < 0)
> +         {
> +                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable
> SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> ++                return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> ++        }
> ++
> ++	res=clk_prepare(psSysSpecData->psSGX_ICK);
> ++	if(res < 0)
> ++        {
> ++                PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable
> SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> +                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> +         }
> +
> +@@ -178,8 +194,9 @@
> +         if (res < 0)
> +         {
> +                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable
> SGX interface clock (%d)", res));
> +-
> ++                clk_unprepare(psSysSpecData->psSGX_ICK);
> +                 clk_disable(psSysSpecData->psSGX_FCK);
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> +                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> +         }
> +
> +@@ -247,8 +264,9 @@
> + 	PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks"));
> + 	
> + 	clk_disable(psSysSpecData->psSGX_FCK);
> +-
> ++	clk_unprepare(psSysSpecData->psSGX_FCK);
> + 	clk_disable(psSysSpecData->psSGX_ICK);
> ++	clk_unprepare(psSysSpecData->psSGX_ICK);
> +
> + //	SysDisableSGXInterrupts(psSysData);
> +
> diff --git a/package/ti-gfx/ti-gfx.mk b/package/ti-gfx/ti-gfx.mk
> new file mode 100644
> index 0000000..154c792
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx.mk
> @@ -0,0 +1,71 @@
> +###############################################################################
> +#
> +# ti-gfx
> +#
> +###############################################################################
> +
> +TI_GFX_VERSION = 4_09_00_01
> +TI_GFX_SOURCE =
> Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_minimal_demos.bin
> +TI_GFX_SITE =
> http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/$(TI_GFX_VERSION)/exports/
> +TI_GFX_LICENSE = TSPA
> +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
> +
> +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 $(TI_GFX_DIR) \
> +		--mode console
> +endef
> +
> +define TI_GFX_CONFIGURE_CMDS
> +	echo "no configure required binary only package"
> +endef
> +
> +TI_GFX_MAKE_CMD = cd $(TI_GFX_SRCDIR)/GFX_Linux_KM && \
> +		$(MAKE) $(LINUX_MAKE_FLAGS) \
> +			BUILD=$(BR2_PACKAGE_TI_GFX_DEBUG) \
> +			TI_PLATFORM=$(TI_GFX_PLATFORM) \
> +			OMAPES=$(TI_GFX_OMAPES) \
> +			SUPPORT_XORG=0 \
> +			KERNELDIR=$(LINUX_DIR)
> +
> +define TI_GFX_BUILD_CMDS
> +	( $(TI_GFX_MAKE_CMD) clean && \
> +	  $(TI_GFX_MAKE_CMD) all )
> +endef
> +
> +define TI_GFX_INSTALL_STAGING_CMDS
> +	
> +endef
> +
> +define TI_GFX_INSTALL_TARGET_CMDS
> +	( $(TI_GFX_MAKE_CMD) install ) || \
> +		echo "Your kernel configuration must include FB_DA8XX"
> +endef
> +
> +define TI_GFX_CLEAN_CMDS
> +	( $(TI_GFX_MAKE_CMD) clean )
> +endef
> +
> +$(eval $(generic-package))
> --
> 1.7.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
Spenser Gilliland June 12, 2013, 5:33 p.m. UTC | #2
Charles,


> I believe including a kernel compile with this patch is a problem for
> several reasons.

There is no kernel compile in this patch.   Only the sgx kernel modules are
built.  The make KERNELDIR=path/to/sgx/dir modules only builds the modules
in the current directory.

> The first is that the TI defconfig for AM3517_evm never made it into
> the Linux kernel along with all the supporting changes, so the build
> fails.

You can use any kernel you would like and are not bound to mainline
kernels.  If the ti kernel has the needed patches, you may use it.  The
only requirement is that the kernel is specified in the kernel
configuration section.

> The second is that folks are using various versions of Graphics_SDK
> from 4_05_xx through 4_09_xx. These same folks generally build the
> Graphics_SDK once externally to buildroot to avoid carrying a 135MB
> file in the dl/ directory. This doesnt make sense for buildroot for
> two kernel .ko modules where 135MByte is larger then any other
> package.

It has to be downloaded anyways and as long as you don't distclean often;
it will only be downloaded once.  It may make sense to provide an option to
select which version of the gfx sdk but there's no need if they maintain
backwards compatibility.

> Perhaps you can consider making Graphics_SDK an external reference in
> your patch to make things go more smoothly?

IMHO. This would complicate the process.   The method presented would allow
people with no ti-gfx experience to quickly get up and running.

Thanks,

Spenser
Charles Krinke June 12, 2013, 5:55 p.m. UTC | #3
Unfortunately, the patch triggers a kernel build. The current issue is
a defconfig for this kernel compile. For am AM3517, one would expect
to use AM3517_evm_defconfig which does not exist in the mainline
kernel, so the rootfs cannot be built with the patch.

Perhaps some words on *how* make it get past errors might help use
this patch, sir?


On 6/12/13, Spenser Gilliland <spenser@gillilanding.com> wrote:
> Charles,
>
>
>> I believe including a kernel compile with this patch is a problem for
>> several reasons.
>
> There is no kernel compile in this patch.   Only the sgx kernel modules are
> built.  The make KERNELDIR=path/to/sgx/dir modules only builds the modules
> in the current directory.
>
>> The first is that the TI defconfig for AM3517_evm never made it into
>> the Linux kernel along with all the supporting changes, so the build
>> fails.
>
> You can use any kernel you would like and are not bound to mainline
> kernels.  If the ti kernel has the needed patches, you may use it.  The
> only requirement is that the kernel is specified in the kernel
> configuration section.
>
>> The second is that folks are using various versions of Graphics_SDK
>> from 4_05_xx through 4_09_xx. These same folks generally build the
>> Graphics_SDK once externally to buildroot to avoid carrying a 135MB
>> file in the dl/ directory. This doesnt make sense for buildroot for
>> two kernel .ko modules where 135MByte is larger then any other
>> package.
>
> It has to be downloaded anyways and as long as you don't distclean often;
> it will only be downloaded once.  It may make sense to provide an option to
> select which version of the gfx sdk but there's no need if they maintain
> backwards compatibility.
>
>> Perhaps you can consider making Graphics_SDK an external reference in
>> your patch to make things go more smoothly?
>
> IMHO. This would complicate the process.   The method presented would allow
> people with no ti-gfx experience to quickly get up and running.
>
> Thanks,
>
> Spenser
>
Spenser Gilliland June 12, 2013, 6:37 p.m. UTC | #4
On Wed, Jun 12, 2013 at 12:55 PM, Charles Krinke
<charles.krinke@gmail.com> wrote:
> Unfortunately, the patch triggers a kernel build. The current issue is
> a defconfig for this kernel compile. For am AM3517, one would expect
> to use AM3517_evm_defconfig which does not exist in the mainline
> kernel, so the rootfs cannot be built with the patch.
>
> Perhaps some words on *how* make it get past errors might help use
> this patch, sir?
>
>
> On 6/12/13, Spenser Gilliland <spenser@gillilanding.com> wrote:
>> Charles,
>>
>>
>>> I believe including a kernel compile with this patch is a problem for
>>> several reasons.
>>
>> There is no kernel compile in this patch.   Only the sgx kernel modules are
>> built.  The make KERNELDIR=path/to/sgx/dir modules only builds the modules
>> in the current directory.
>>
>>> The first is that the TI defconfig for AM3517_evm never made it into
>>> the Linux kernel along with all the supporting changes, so the build
>>> fails.
>>
>> You can use any kernel you would like and are not bound to mainline
>> kernels.  If the ti kernel has the needed patches, you may use it.  The
>> only requirement is that the kernel is specified in the kernel
>> configuration section.
>>
>>> The second is that folks are using various versions of Graphics_SDK
>>> from 4_05_xx through 4_09_xx. These same folks generally build the
>>> Graphics_SDK once externally to buildroot to avoid carrying a 135MB
>>> file in the dl/ directory. This doesnt make sense for buildroot for
>>> two kernel .ko modules where 135MByte is larger then any other
>>> package.
>>
>> It has to be downloaded anyways and as long as you don't distclean often;
>> it will only be downloaded once.  It may make sense to provide an option to
>> select which version of the gfx sdk but there's no need if they maintain
>> backwards compatibility.
>>
>>> Perhaps you can consider making Graphics_SDK an external reference in
>>> your patch to make things go more smoothly?
>>
>> IMHO. This would complicate the process.   The method presented would allow
>> people with no ti-gfx experience to quickly get up and running.
>>
>> Thanks,
>>
>> Spenser
>>
>
>
> --
> Charles Krinke

Charles,

In mainline I believe AM35xx is covered by the omap2plus defconfig but
I'm not completely certain. You can also use a custom kernel location
with
LINUX_OVERRIDE_SRCDIR=/path/to/your/kernel/tree or If you obtained it
from git or a tarball, please tell me the source of your kernel and I
can help you setup the BR2_LINUX_KERNEL sections.

Thanks,
Spenser

--
Spenser Gilliland
Computer Engineer
Doctoral Candidate
Arnout Vandecappelle June 13, 2013, 4:49 p.m. UTC | #5
Hi Spenser,

On 07/06/13 22:18, Spenser Gilliland wrote:
> This is WIP of adding the TI Graphics SDK to buildroot.
>
> TODO:
>     Install startup files for sgx core.
>     Install khronos gles/egl/vg libraries.
>     Create .pc files to simplfy additional packaging.
>     Testing, lots of testing.
>
> ---
>   package/Config.in                              |    1 +
>   package/opengl/libegl/libegl.mk                |    4 +
>   package/opengl/libgles/libgles.mk              |    4 +
>   package/opengl/libopenvg/libopenvg.mk          |    4 +
>   package/ti-gfx/Config.in                       |   54 ++++++++++++++++++
>   package/ti-gfx/ti-gfx-km_install_modules.patch |   14 +++++
>   package/ti-gfx/ti-gfx-newclkapi.patch          |   55 ++++++++++++++++++
>   package/ti-gfx/ti-gfx.mk                       |   71 ++++++++++++++++++++++++
>   8 files changed, 207 insertions(+), 0 deletions(-)
>   create mode 100644 package/ti-gfx/Config.in
>   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
>
> diff --git a/package/Config.in b/package/Config.in
> index ce82e99..8c40b56 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -290,6 +290,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"

  Don't we usually put this kind of stuff under Libraries / Graphics?

>   source "package/ti-utils/Config.in"
>   source "package/uboot-tools/Config.in"
>   source "package/udev/Config.in"
[snip]
> diff --git a/package/ti-gfx/Config.in b/package/ti-gfx/Config.in
> new file mode 100644
> index 0000000..c3ac984
> --- /dev/null
> +++ b/package/ti-gfx/Config.in
> @@ -0,0 +1,54 @@
> +config BR2_PACKAGE_TI_GFX
> +	bool "ti-gfx"
> +	select BR2_LINUX_KERNEL
> +	select BR2_PACKAGE_DEVMEM2

  Why is this needed?

> +	select BR2_PACKAGE_HAS_OPENGL_EGL
> +	select BR2_PACKAGE_HAS_OPENGL_ES
> +	depends on BR2_TOOLCHAIN_EXTERNAL_GLIBC || BR2_TOOLCHAIN_CTNG_eglibc || BR2_TOOLCHAIN_CTNG_glibc
> +	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
> +	  Turn on debugging in kernel module and install libraries built with
> +	  debugging enabled
> +
> +choice
> +	prompt "Target"
> +	default BR2_PACKAGE_TI_GFX_OMAP3

  I guess you mean _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"
> +	help
> +	 OMAP35xx, AM35xx Rev 3.1+
> +
> +config BR2_PACKAGE_TI_GFX_ES5
> +	bool "es5.x"
> +	help
> +	  AM37xx, DM37xx
> +
> +config BR2_PACKAGE_TI_GFX_ES6
> +	bool "es6.x"
> +	help
> +	  AM387x, C6A814x, AM389x, C6A816x
> +
> +config BR2_PACKAGE_TI_GFX_ES8
> +	bool "es8.x"
> +	help
> +	  AM335x
> +
> +endchoice
> +
> +endif
> +
> +comment "requires an external eglibc/glibc based toolchain"
  You must say that ti-gfx requires it, because the config option is not 
visible when there's no glibc.

> +	depends on !(BR2_TOOLCHAIN_EXTERNAL_GLIBC || BR2_TOOLCHAIN_CTNG_eglibc || BR2_TOOLCHAIN_CTNG_glibc)

  We really should refactor this into a single symbol...


> 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..63bfd19
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx-km_install_modules.patch
> @@ -0,0 +1,14 @@
> +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
> ++

  Actually, instead of patching the Makefile, you could just run the 
kernel make command directly from buildroot's .mk file. I think there are 
a few module packages that do that.

> + 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..b35ac31
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx-newclkapi.patch
> @@ -0,0 +1,55 @@

  This patch is missing an explanation and a SoB.

> +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-03-04 08:41:35.000000000 -0600
> ++++ ti-gfx-4_09_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c	2013-06-05 12:00:08.778605221 -0500
> +@@ -166,11 +166,27 @@
> + 	}
> +
> + 	PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
> +-	
> ++   res=clk_prepare(psSysSpecData->psSGX_FCK);
> ++	if (res < 0)
> ++        {
> ++                PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> ++                return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> ++        }
> ++
> + 	res=clk_enable(psSysSpecData->psSGX_FCK);
> + 	if (res < 0)
> +         {
> +                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> ++                return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> ++        }
> ++
> ++	res=clk_prepare(psSysSpecData->psSGX_ICK);
> ++	if(res < 0)
> ++        {
> ++                PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> +                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> +         }
> +
> +@@ -178,8 +194,9 @@
> +         if (res < 0)
> +         {
> +                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX interface clock (%d)", res));
> +-
> ++                clk_unprepare(psSysSpecData->psSGX_ICK);
> +                 clk_disable(psSysSpecData->psSGX_FCK);
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> +                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> +         }
> +
> +@@ -247,8 +264,9 @@
> + 	PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks"));
> + 	
> + 	clk_disable(psSysSpecData->psSGX_FCK);
> +-
> ++	clk_unprepare(psSysSpecData->psSGX_FCK);
> + 	clk_disable(psSysSpecData->psSGX_ICK);
> ++	clk_unprepare(psSysSpecData->psSGX_ICK);
> +
> + //	SysDisableSGXInterrupts(psSysData);
> +
> diff --git a/package/ti-gfx/ti-gfx.mk b/package/ti-gfx/ti-gfx.mk
> new file mode 100644
> index 0000000..154c792
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx.mk
> @@ -0,0 +1,71 @@
> +###############################################################################
> +#
> +# ti-gfx
> +#
> +###############################################################################
> +
> +TI_GFX_VERSION = 4_09_00_01
> +TI_GFX_SOURCE = Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_minimal_demos.bin
> +TI_GFX_SITE = http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/$(TI_GFX_VERSION)/exports/
> +TI_GFX_LICENSE = TSPA

  This is not one of the well-known licenses, so should be expanded to 
"Texas Instruments Software Piracy Agreement" or whatever it stands for.

> +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

  Personally I prefer to do "case statements" like this in the Config.in, 
but it's a minor thing.

> +
> +define TI_GFX_EXTRACT_CMDS
> +	$(RM) -rf $(TI_GFX_DIR)

  We normally don't do that. Is it needed (i.e. does it fail if you don't 
and the source was already extracted before)?

  Also, use $(@D) instead of $(TI_GFX_DIR).

> +	chmod +x $(DL_DIR)/$(TI_GFX_SOURCE)
> +	printf "Y\nY\n qY\n\n" | $(DL_DIR)/$(TI_GFX_SOURCE) \
> +		--prefix $(TI_GFX_DIR) \
> +		--mode console
> +endef
> +
> +define TI_GFX_CONFIGURE_CMDS
> +	echo "no configure required binary only package"

  Just don't define it then.

> +endef
> +
> +TI_GFX_MAKE_CMD = cd $(TI_GFX_SRCDIR)/GFX_Linux_KM && \
> +		$(MAKE) $(LINUX_MAKE_FLAGS) \
> +			BUILD=$(BR2_PACKAGE_TI_GFX_DEBUG) \
> +			TI_PLATFORM=$(TI_GFX_PLATFORM) \
> +			OMAPES=$(TI_GFX_OMAPES) \
> +			SUPPORT_XORG=0 \
> +			KERNELDIR=$(LINUX_DIR)

  We normally only set the make flags, e.g.

TI_GFX_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
	...

and the build commands become

	$(MAKE) -C $(@D) $(TI_GFX_MAKE_OPTS) all

> +
> +define TI_GFX_BUILD_CMDS
> +	( $(TI_GFX_MAKE_CMD) clean && \

  Is the clean really needed? We normally don't.

  Also don't connect commands with && unless they really need to be 
executed in the same sub-shell.

> +	  $(TI_GFX_MAKE_CMD) all )
> +endef
> +
> +define TI_GFX_INSTALL_STAGING_CMDS
> +	

  If you have nothing to install than you shouldn't install to staging :-)

> +endef
> +
> +define TI_GFX_INSTALL_TARGET_CMDS
> +	( $(TI_GFX_MAKE_CMD) install ) || \

  Don't you need to pass TARGET_DIR anywhere?

> +		echo "Your kernel configuration must include FB_DA8XX"

  I think that should be checked by observing the kernel's .config in the 
CONFIGURE_CMDS.

  Ideally, it would be enabled automatically but I don't think we can do 
that at the moment.

> +endef
> +
> +define TI_GFX_CLEAN_CMDS
> +	( $(TI_GFX_MAKE_CMD) clean )
> +endef

  Clean is going to be deprecated so you don't need to add it. But I 
guess you're using it a lot now...

> +
> +$(eval $(generic-package))
>
Sundareson, Prabindh June 14, 2013, 2:20 a.m. UTC | #6
In case it helps the discussion,


1. TSPA stands for "Technology / Software Publicly Available"

>> > +TI_GFX_LICENSE = TSPA
>>  This is not one of the well-known licenses, so should be expanded to ...



2. devmem2 is used for querying the version of the SGX core at runtime to do the right initialization

> +	select BR2_PACKAGE_DEVMEM2
>>  Why is this needed?


regards,
Prabu



-----Original Message-----
From: buildroot-bounces@busybox.net [mailto:buildroot-bounces@busybox.net] On Behalf Of Arnout Vandecappelle
Sent: Thursday, June 13, 2013 10:20 PM
To: Spenser Gilliland
Cc: buildroot@busybox.net
Subject: Re: [Buildroot] [RFC] ti-gfx: add new package

  Hi Spenser,

On 07/06/13 22:18, Spenser Gilliland wrote:
> This is WIP of adding the TI Graphics SDK to buildroot.
>
> TODO:
>     Install startup files for sgx core.
>     Install khronos gles/egl/vg libraries.
>     Create .pc files to simplfy additional packaging.
>     Testing, lots of testing.
>
> ---
>   package/Config.in                              |    1 +
>   package/opengl/libegl/libegl.mk                |    4 +
>   package/opengl/libgles/libgles.mk              |    4 +
>   package/opengl/libopenvg/libopenvg.mk          |    4 +
>   package/ti-gfx/Config.in                       |   54 ++++++++++++++++++
>   package/ti-gfx/ti-gfx-km_install_modules.patch |   14 +++++
>   package/ti-gfx/ti-gfx-newclkapi.patch          |   55 ++++++++++++++++++
>   package/ti-gfx/ti-gfx.mk                       |   71 ++++++++++++++++++++++++
>   8 files changed, 207 insertions(+), 0 deletions(-)
>   create mode 100644 package/ti-gfx/Config.in
>   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
>
> diff --git a/package/Config.in b/package/Config.in index 
> ce82e99..8c40b56 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -290,6 +290,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"

  Don't we usually put this kind of stuff under Libraries / Graphics?

>   source "package/ti-utils/Config.in"
>   source "package/uboot-tools/Config.in"
>   source "package/udev/Config.in"
[snip]
> diff --git a/package/ti-gfx/Config.in b/package/ti-gfx/Config.in new 
> file mode 100644 index 0000000..c3ac984
> --- /dev/null
> +++ b/package/ti-gfx/Config.in
> @@ -0,0 +1,54 @@
> +config BR2_PACKAGE_TI_GFX
> +	bool "ti-gfx"
> +	select BR2_LINUX_KERNEL
> +	select BR2_PACKAGE_DEVMEM2

  Why is this needed?

> +	select BR2_PACKAGE_HAS_OPENGL_EGL
> +	select BR2_PACKAGE_HAS_OPENGL_ES
> +	depends on BR2_TOOLCHAIN_EXTERNAL_GLIBC || BR2_TOOLCHAIN_CTNG_eglibc || BR2_TOOLCHAIN_CTNG_glibc
> +	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
> +	  Turn on debugging in kernel module and install libraries built with
> +	  debugging enabled
> +
> +choice
> +	prompt "Target"
> +	default BR2_PACKAGE_TI_GFX_OMAP3

  I guess you mean _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"
> +	help
> +	 OMAP35xx, AM35xx Rev 3.1+
> +
> +config BR2_PACKAGE_TI_GFX_ES5
> +	bool "es5.x"
> +	help
> +	  AM37xx, DM37xx
> +
> +config BR2_PACKAGE_TI_GFX_ES6
> +	bool "es6.x"
> +	help
> +	  AM387x, C6A814x, AM389x, C6A816x
> +
> +config BR2_PACKAGE_TI_GFX_ES8
> +	bool "es8.x"
> +	help
> +	  AM335x
> +
> +endchoice
> +
> +endif
> +
> +comment "requires an external eglibc/glibc based toolchain"
  You must say that ti-gfx requires it, because the config option is not visible when there's no glibc.

> +	depends on !(BR2_TOOLCHAIN_EXTERNAL_GLIBC || 
> +BR2_TOOLCHAIN_CTNG_eglibc || BR2_TOOLCHAIN_CTNG_glibc)

  We really should refactor this into a single symbol...


> 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..63bfd19
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx-km_install_modules.patch
> @@ -0,0 +1,14 @@
> +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
> ++

  Actually, instead of patching the Makefile, you could just run the kernel make command directly from buildroot's .mk file. I think there are a few module packages that do that.

> + 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..b35ac31
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx-newclkapi.patch
> @@ -0,0 +1,55 @@

  This patch is missing an explanation and a SoB.

> +Index: 
> +ti-gfx-4_09_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_lin
> +ux.c 
> +===================================================================
> +--- ti-gfx-4_09_00_01.orig/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c	2013-03-04 08:41:35.000000000 -0600
> ++++ ti-gfx-4_09_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c	2013-06-05 12:00:08.778605221 -0500
> +@@ -166,11 +166,27 @@
> + 	}
> +
> + 	PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
> +-	
> ++   res=clk_prepare(psSysSpecData->psSGX_FCK);
> ++	if (res < 0)
> ++        {
> ++                PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> ++                return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> ++        }
> ++
> + 	res=clk_enable(psSysSpecData->psSGX_FCK);
> + 	if (res < 0)
> +         {
> +                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't 
> + enable SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> ++                return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> ++        }
> ++
> ++	res=clk_prepare(psSysSpecData->psSGX_ICK);
> ++	if(res < 0)
> ++        {
> ++                PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> +                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> +         }
> +
> +@@ -178,8 +194,9 @@
> +         if (res < 0)
> +         {
> +                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't 
> +enable SGX interface clock (%d)", res));
> +-
> ++                clk_unprepare(psSysSpecData->psSGX_ICK);
> +                 clk_disable(psSysSpecData->psSGX_FCK);
> ++                clk_unprepare(psSysSpecData->psSGX_FCK);
> +                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
> +         }
> +
> +@@ -247,8 +264,9 @@
> + 	PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX 
> +Clocks"));
> + 	
> + 	clk_disable(psSysSpecData->psSGX_FCK);
> +-
> ++	clk_unprepare(psSysSpecData->psSGX_FCK);
> + 	clk_disable(psSysSpecData->psSGX_ICK);
> ++	clk_unprepare(psSysSpecData->psSGX_ICK);
> +
> + //	SysDisableSGXInterrupts(psSysData);
> +
> diff --git a/package/ti-gfx/ti-gfx.mk b/package/ti-gfx/ti-gfx.mk new 
> file mode 100644 index 0000000..154c792
> --- /dev/null
> +++ b/package/ti-gfx/ti-gfx.mk
> @@ -0,0 +1,71 @@
> +#####################################################################
> +##########
> +#
> +# ti-gfx
> +#
> +#####################################################################
> +##########
> +
> +TI_GFX_VERSION = 4_09_00_01
> +TI_GFX_SOURCE = 
> +Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_minimal_demos.bin
> +TI_GFX_SITE = 
> +http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gf
> +xsdk/$(TI_GFX_VERSION)/exports/
> +TI_GFX_LICENSE = TSPA

  This is not one of the well-known licenses, so should be expanded to "Texas Instruments Software Piracy Agreement" or whatever it stands for.

> +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

  Personally I prefer to do "case statements" like this in the Config.in, but it's a minor thing.

> +
> +define TI_GFX_EXTRACT_CMDS
> +	$(RM) -rf $(TI_GFX_DIR)

  We normally don't do that. Is it needed (i.e. does it fail if you don't and the source was already extracted before)?

  Also, use $(@D) instead of $(TI_GFX_DIR).

> +	chmod +x $(DL_DIR)/$(TI_GFX_SOURCE)
> +	printf "Y\nY\n qY\n\n" | $(DL_DIR)/$(TI_GFX_SOURCE) \
> +		--prefix $(TI_GFX_DIR) \
> +		--mode console
> +endef
> +
> +define TI_GFX_CONFIGURE_CMDS
> +	echo "no configure required binary only package"

  Just don't define it then.

> +endef
> +
> +TI_GFX_MAKE_CMD = cd $(TI_GFX_SRCDIR)/GFX_Linux_KM && \
> +		$(MAKE) $(LINUX_MAKE_FLAGS) \
> +			BUILD=$(BR2_PACKAGE_TI_GFX_DEBUG) \
> +			TI_PLATFORM=$(TI_GFX_PLATFORM) \
> +			OMAPES=$(TI_GFX_OMAPES) \
> +			SUPPORT_XORG=0 \
> +			KERNELDIR=$(LINUX_DIR)

  We normally only set the make flags, e.g.

TI_GFX_MAKE_OPTS = $(LINUX_MAKE_FLAGS) \
	...

and the build commands become

	$(MAKE) -C $(@D) $(TI_GFX_MAKE_OPTS) all

> +
> +define TI_GFX_BUILD_CMDS
> +	( $(TI_GFX_MAKE_CMD) clean && \

  Is the clean really needed? We normally don't.

  Also don't connect commands with && unless they really need to be executed in the same sub-shell.

> +	  $(TI_GFX_MAKE_CMD) all )
> +endef
> +
> +define TI_GFX_INSTALL_STAGING_CMDS
> +	

  If you have nothing to install than you shouldn't install to staging :-)

> +endef
> +
> +define TI_GFX_INSTALL_TARGET_CMDS
> +	( $(TI_GFX_MAKE_CMD) install ) || \

  Don't you need to pass TARGET_DIR anywhere?

> +		echo "Your kernel configuration must include FB_DA8XX"

  I think that should be checked by observing the kernel's .config in the CONFIGURE_CMDS.

  Ideally, it would be enabled automatically but I don't think we can do that at the moment.

> +endef
> +
> +define TI_GFX_CLEAN_CMDS
> +	( $(TI_GFX_MAKE_CMD) clean )
> +endef

  Clean is going to be deprecated so you don't need to add it. But I guess you're using it a lot now...

> +
> +$(eval $(generic-package))
>
Thomas Petazzoni June 15, 2013, 4:33 p.m. UTC | #7
Dear Sundareson, Prabindh,

On Fri, 14 Jun 2013 02:20:12 +0000, Sundareson, Prabindh wrote:

> 2. devmem2 is used for querying the version of the SGX core at runtime to do the right initialization
> 
> > +	select BR2_PACKAGE_DEVMEM2
> >>  Why is this needed?

So in this case, there should be a comment "# Runtime dependency" right
before the "select BR2_PACKAGE_DEVMEM2".

Best regards,

Thomas
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index ce82e99..8c40b56 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -290,6 +290,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/opengl/libopenvg/libopenvg.mk b/package/opengl/libopenvg/libopenvg.mk
index 03f59ba..118ae7f 100644
--- a/package/opengl/libopenvg/libopenvg.mk
+++ b/package/opengl/libopenvg/libopenvg.mk
@@ -10,6 +10,10 @@  ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
 LIBOPENVG_DEPENDENCIES += rpi-userland
 endif
 
+ifeq ($(BR2_PACKAGE_TI_GFX),y)
+LIBOPENVG_DEPENDENCIES += ti-gfx
+endif
+
 ifeq ($(LIBOPENVG_DEPENDENCIES),)
 define LIBOPENVG_CONFIGURE_CMDS
 	echo "No libOpenVG implementation selected. Configuration error."
diff --git a/package/ti-gfx/Config.in b/package/ti-gfx/Config.in
new file mode 100644
index 0000000..c3ac984
--- /dev/null
+++ b/package/ti-gfx/Config.in
@@ -0,0 +1,54 @@ 
+config BR2_PACKAGE_TI_GFX
+	bool "ti-gfx"
+	select BR2_LINUX_KERNEL
+	select BR2_PACKAGE_DEVMEM2
+	select BR2_PACKAGE_HAS_OPENGL_EGL
+	select BR2_PACKAGE_HAS_OPENGL_ES
+	depends on BR2_TOOLCHAIN_EXTERNAL_GLIBC || BR2_TOOLCHAIN_CTNG_eglibc || BR2_TOOLCHAIN_CTNG_glibc
+	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
+	  Turn on debugging in kernel module and install libraries built with
+	  debugging enabled
+
+choice
+	prompt "Target"
+	default BR2_PACKAGE_TI_GFX_OMAP3
+	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"
+	help
+	 OMAP35xx, AM35xx Rev 3.1+ 
+
+config BR2_PACKAGE_TI_GFX_ES5
+	bool "es5.x"
+	help
+	  AM37xx, DM37xx
+
+config BR2_PACKAGE_TI_GFX_ES6
+	bool "es6.x"
+	help
+	  AM387x, C6A814x, AM389x, C6A816x
+
+config BR2_PACKAGE_TI_GFX_ES8
+	bool "es8.x"
+	help
+	  AM335x
+
+endchoice
+
+endif
+
+comment "requires an external eglibc/glibc based toolchain"
+	depends on !(BR2_TOOLCHAIN_EXTERNAL_GLIBC || BR2_TOOLCHAIN_CTNG_eglibc || BR2_TOOLCHAIN_CTNG_glibc)
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..63bfd19
--- /dev/null
+++ b/package/ti-gfx/ti-gfx-km_install_modules.patch
@@ -0,0 +1,14 @@ 
+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..b35ac31
--- /dev/null
+++ b/package/ti-gfx/ti-gfx-newclkapi.patch
@@ -0,0 +1,55 @@ 
+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-03-04 08:41:35.000000000 -0600
++++ ti-gfx-4_09_00_01/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c	2013-06-05 12:00:08.778605221 -0500
+@@ -166,11 +166,27 @@
+ 	}
+ 
+ 	PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
+-	
++   res=clk_prepare(psSysSpecData->psSGX_FCK);
++	if (res < 0)
++        {
++                PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
++                clk_unprepare(psSysSpecData->psSGX_FCK);
++                return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
++        }
++
+ 	res=clk_enable(psSysSpecData->psSGX_FCK);
+ 	if (res < 0)
+         {
+                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
++                clk_unprepare(psSysSpecData->psSGX_FCK);
++                return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
++        }
++
++	res=clk_prepare(psSysSpecData->psSGX_ICK);
++	if(res < 0)
++        {
++                PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
++                clk_unprepare(psSysSpecData->psSGX_FCK);
+                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
+         }
+ 
+@@ -178,8 +194,9 @@
+         if (res < 0)
+         {
+                 PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX interface clock (%d)", res));
+-
++                clk_unprepare(psSysSpecData->psSGX_ICK);
+                 clk_disable(psSysSpecData->psSGX_FCK);
++                clk_unprepare(psSysSpecData->psSGX_FCK);
+                 return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
+         }
+ 
+@@ -247,8 +264,9 @@
+ 	PVR_DPF((PVR_DBG_MESSAGE, "DisableSGXClocks: Disabling SGX Clocks"));
+ 	
+ 	clk_disable(psSysSpecData->psSGX_FCK);
+-
++	clk_unprepare(psSysSpecData->psSGX_FCK);
+ 	clk_disable(psSysSpecData->psSGX_ICK);
++	clk_unprepare(psSysSpecData->psSGX_ICK);
+ 
+ //	SysDisableSGXInterrupts(psSysData);
+ 
diff --git a/package/ti-gfx/ti-gfx.mk b/package/ti-gfx/ti-gfx.mk
new file mode 100644
index 0000000..154c792
--- /dev/null
+++ b/package/ti-gfx/ti-gfx.mk
@@ -0,0 +1,71 @@ 
+###############################################################################
+#
+# ti-gfx 
+#
+###############################################################################
+
+TI_GFX_VERSION = 4_09_00_01
+TI_GFX_SOURCE = Graphics_SDK_setuplinux_$(TI_GFX_VERSION)_minimal_demos.bin
+TI_GFX_SITE = http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/$(TI_GFX_VERSION)/exports/
+TI_GFX_LICENSE = TSPA
+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
+
+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 $(TI_GFX_DIR) \
+		--mode console
+endef
+
+define TI_GFX_CONFIGURE_CMDS
+	echo "no configure required binary only package"
+endef
+
+TI_GFX_MAKE_CMD = cd $(TI_GFX_SRCDIR)/GFX_Linux_KM && \
+		$(MAKE) $(LINUX_MAKE_FLAGS) \
+			BUILD=$(BR2_PACKAGE_TI_GFX_DEBUG) \
+			TI_PLATFORM=$(TI_GFX_PLATFORM) \
+			OMAPES=$(TI_GFX_OMAPES) \
+			SUPPORT_XORG=0 \
+			KERNELDIR=$(LINUX_DIR)
+
+define TI_GFX_BUILD_CMDS
+	( $(TI_GFX_MAKE_CMD) clean && \
+	  $(TI_GFX_MAKE_CMD) all )
+endef
+
+define TI_GFX_INSTALL_STAGING_CMDS
+	
+endef
+
+define TI_GFX_INSTALL_TARGET_CMDS
+	( $(TI_GFX_MAKE_CMD) install ) || \
+		echo "Your kernel configuration must include FB_DA8XX"
+endef
+
+define TI_GFX_CLEAN_CMDS
+	( $(TI_GFX_MAKE_CMD) clean )
+endef
+
+$(eval $(generic-package))