From 6b5a6414676dd60aed16f51f4a7d785b69ece4f4 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@openembedded.org>
Date: Mon, 16 Nov 2009 11:45:21 +0100
Subject: [PATCH] libgles-omap, omap3-sgx-modules: add SDK 3.01.00.01/1.4.14.2514 release

---
 .../libgles-omap3-3.01.00.01/rc.pvr                |   58 ++++++++++++++++++++
 .../powervr-drivers/libgles-omap3_3.01.00.01.bb    |   30 ++++++++++
 .../omap3-sgx-modules_1.4.14.2514.bb               |   33 +++++++++++
 3 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100755 recipes/powervr-drivers/libgles-omap3-3.01.00.01/rc.pvr
 create mode 100644 recipes/powervr-drivers/libgles-omap3_3.01.00.01.bb
 create mode 100644 recipes/powervr-drivers/omap3-sgx-modules_1.4.14.2514.bb

diff --git a/recipes/powervr-drivers/libgles-omap3-3.01.00.01/rc.pvr b/recipes/powervr-drivers/libgles-omap3-3.01.00.01/rc.pvr
new file mode 100755
index 0000000..1b3c274
--- /dev/null
+++ b/recipes/powervr-drivers/libgles-omap3-3.01.00.01/rc.pvr
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+CPUTYPE="$(cputype)"
+
+if [ "$1" = "" ]; then
+	echo PVR-INIT: Please use start, stop, or restart.
+	exit 1
+fi
+
+if [ "$1" = "stop" -o  "$1" = "restart" ]; then
+	echo Stopping PVR
+	#rmmod bc_example
+	rmmod omaplfb 2>/dev/null
+	rmmod pvrsrvkm 2>/dev/null
+fi
+
+if [ "$1" = "stop" ]; then
+	exit 0
+fi
+
+if [ $CPUTYPE = "OMAP3530" ]; then
+	echo Starting PVR
+	insmod $(busybox find /lib/modules/$(uname -r) -name "pvrsrvkm.ko")
+	#modprobe bc_example
+	modprobe omaplfb
+
+	pvr_maj=`grep "pvrsrvkm$" /proc/devices | cut -b1,2,3`
+
+	if [ -e /dev/pvrsrvkm ] ; then 
+		rm -f /dev/pvrsrvkm
+	fi
+
+	mknod /dev/pvrsrvkm c $pvr_maj 0 
+	chmod 666 /dev/pvrsrvkm
+
+	touch /etc/powervr-esrev
+
+	SAVED_ESREVISION="$(cat /etc/powervr-esrev)"
+	ES_REVISION="$(cat /proc/cpuinfo | grep "CPU revision" | awk -F: '{print $2}')"
+
+	if [ "${ES_REVISION}" != "${SAVED_ESREVISION}" ] ; then
+		echo -n "Starting SGX fixup for"
+		if [ "${ES_REVISION}" = " 3" ] ; then
+			echo " ES3.x"
+			cp -a /usr/lib/ES3.0/* /usr/lib
+			cp -a /usr/bin/ES3.0/* /usr/bin	
+		else
+			echo "ES 2.x"
+			cp -a /usr/lib/ES2.0/* /usr/lib
+			cp -a /usr/bin/ES2.0/* /usr/bin	
+		fi
+		echo "${ES_REVISION}" > /etc/powervr-esrev
+	fi
+	/usr/bin/pvrsrvinit
+else
+	echo No SGX hardware, not starting PVR
+fi
+
diff --git a/recipes/powervr-drivers/libgles-omap3_3.01.00.01.bb b/recipes/powervr-drivers/libgles-omap3_3.01.00.01.bb
new file mode 100644
index 0000000..8d2d81e
--- /dev/null
+++ b/recipes/powervr-drivers/libgles-omap3_3.01.00.01.bb
@@ -0,0 +1,30 @@
+BINLOCATION = "${S}/gfx_rel_omap35x_es3.x"
+
+require libgles-omap3.inc
+
+DEFAULT_PREFERENCE = "-1"
+# download required binary distribution from:
+# http://software-dl.ti.com/dsps/forms/export.html?prod_no=/OMAP35x_Graphics_SDK_setuplinux_3_01_00_01.bin
+
+SGXPV = "3_01_00_01"
+IMGPV = "1.4.14.2514"
+BINFILE := "OMAP35x_Graphics_SDK_setuplinux_${SGXPV}.bin"
+
+# The ES2.x and ES3.x CPUs have different SGX hardware, so we need to install 2 sets of userspace
+do_install_append() {
+	install -d ${D}${libdir}/ES3.0
+	install -d ${D}${libdir}/ES2.0
+	install -d ${D}${bindir}/ES3.0
+	install -d ${D}${bindir}/ES2.0
+
+	cp ${S}/gfx_rel_omap35x_es2.x/lib* ${D}${libdir}/ES2.0/
+	cp ${S}/gfx_rel_omap35x_es2.x/p[dv]* ${D}${bindir}/ES2.0/
+
+	cp ${D}${libdir}/lib*${IMGPV} ${D}${libdir}/ES3.0/
+	cp ${D}${bindir}/p[dv]* ${D}${bindir}/ES3.0
+}
+
+# Quality control is really poor on these SDKs, so hack around the latest madness:
+FILES_${PN} += "${libdir}/*.so "
+FILES_${PN}-dev = "${includedir}"
+
diff --git a/recipes/powervr-drivers/omap3-sgx-modules_1.4.14.2514.bb b/recipes/powervr-drivers/omap3-sgx-modules_1.4.14.2514.bb
new file mode 100644
index 0000000..e854731
--- /dev/null
+++ b/recipes/powervr-drivers/omap3-sgx-modules_1.4.14.2514.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = "Kernel drivers for the PowerVR SGX chipset found in the omap3 SoCs"
+LICENSE = "GPLv2"
+
+DEFAULT_PREFERENCE = "-1"
+
+require ../ti/ti-dspbios.inc
+
+# download required binary distribution from:
+# http://software-dl.ti.com/dsps/forms/export.html?prod_no=/OMAP35x_Graphics_SDK_setuplinux_3_01_00_01.bin
+
+SGXPV = "3_01_00_01"
+IMGPV = "1.4.14.2514"
+BINFILE := "OMAP35x_Graphics_SDK_setuplinux_${SGXPV}.bin"
+
+SRC_URI = "file://OMAP35x_Graphics_SDK_setuplinux_${SGXPV}.bin"
+
+S = "${WORKDIR}/OMAP35x_Graphics_SDK_${SGXPV}/GFX_Linux_KM"
+
+inherit module
+
+PVRBUILD = "release"
+
+INHIBIT_PACKAGE_STRIP = "1"
+
+MAKE_TARGETS = " BUILD=${PVRBUILD}"
+
+do_install() {
+	mkdir -p ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/gpu/pvr
+	cp ${S}/pvrsrvkm.ko \
+	   ${S}/services4/3rdparty/dc_omap3430_linux/omaplfb.ko  \
+	   ${S}/services4/3rdparty/bufferclass_ti/bufferclass_ti.ko \
+	   ${D}/lib/modules/${KERNEL_VERSION}/kernel/drivers/gpu/pvr
+}
-- 
1.6.2.4

