[oe-commits] Steve Sakoman : libgles-omap3: detect cpu type and don' t load modules if no SGX hardware

git version control git at git.openembedded.org
Thu Sep 3 08:34:20 UTC 2009


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 94c2e1f513e1571e56f3729d1439d71eb4d7148b
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=94c2e1f513e1571e56f3729d1439d71eb4d7148b

Author: Steve Sakoman <steve at sakoman.com>
Date:   Wed Sep  2 22:34:51 2009 -0700

libgles-omap3: detect cpu type and don't load modules if no SGX hardware

---

 recipes/powervr-drivers/libgles-omap3.inc     |    5 +++
 recipes/powervr-drivers/libgles-omap3/cputype |    5 +++
 recipes/powervr-drivers/libgles-omap3/rc.pvr  |   36 ++++++++++++++----------
 3 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/recipes/powervr-drivers/libgles-omap3.inc b/recipes/powervr-drivers/libgles-omap3.inc
index d7f655d..c66309e 100644
--- a/recipes/powervr-drivers/libgles-omap3.inc
+++ b/recipes/powervr-drivers/libgles-omap3.inc
@@ -1,6 +1,8 @@
 DESCRIPTION = "libGLES for the omap3"
 LICENCE = "proprietary-binary"
 
+RDEPENDS_${PN} += "devmem2"
+
 #HACK! These are binaries, so we can't guarantee that LDFLAGS match :(
 INSANE_SKIP_${PN} = True
 INSANE_SKIP_${PN}-tests = True
@@ -25,6 +27,7 @@ PROVIDES += "virtual/egl"
 # voila!
 
 SRC_URI = "file://OMAP35x_Graphics_SDK_setuplinux_${SGXPV}.bin \
+           file://cputype \
            file://rc.pvr \
            file://chameleonman.desktop \
            file://evilskull.desktop \
@@ -83,6 +86,8 @@ do_install () {
 	cp -pP ${BINLOCATION}/*.so* ${D}${libdir}
 
 	install -d ${D}${bindir}/
+	install -m 0755 ${WORKDIR}/cputype ${D}${bindir}/
+
 	cp -pP ${BINLOCATION}/*_test ${D}${bindir}/
 	cp -pP ${BINLOCATION}/gl2info ${D}${bindir}/
 	cp -pP ${BINLOCATION}/gles1test1 ${D}${bindir}/
diff --git a/recipes/powervr-drivers/libgles-omap3/cputype b/recipes/powervr-drivers/libgles-omap3/cputype
new file mode 100755
index 0000000..31fc89b
--- /dev/null
+++ b/recipes/powervr-drivers/libgles-omap3/cputype
@@ -0,0 +1,5 @@
+#!/bin/sh
+devmem2 0x4800244c | \
+grep 'Value at address' | \
+sed -e 's/.*): //' | \
+sed -e 's/0x5C00/OMAP3503/' -e 's/0x1C00/OMAP3515/' -e 's/0x4C00/OMAP3525/' -e 's/0x0C00/OMAP3530/'
diff --git a/recipes/powervr-drivers/libgles-omap3/rc.pvr b/recipes/powervr-drivers/libgles-omap3/rc.pvr
index 244f480..20b5167 100755
--- a/recipes/powervr-drivers/libgles-omap3/rc.pvr
+++ b/recipes/powervr-drivers/libgles-omap3/rc.pvr
@@ -1,24 +1,30 @@
 #!/bin/sh
 
-#rmmod bc_example
-rmmod omaplfb
-rmmod pvrsrvkm
+CPUTYPE="$(cputype)"
 
-insmod $(busybox find /lib/modules/$(uname -r) -name "pvrsrvkm.ko")
-#modprobe bc_example
-modprobe omaplfb
+if ( $CPUTYPE == "OMAP3530"); then
 
-pvr_maj=`grep "pvrsrvkm$" /proc/devices | cut -b1,2,3`
+	rmmod omaplfb
+	rmmod pvrsrvkm
 
-if [ -e /dev/pvrsrvkm ] ; then 
-	rm -f /dev/pvrsrvkm
-fi
+	insmod $(busybox find /lib/modules/$(uname -r) -name "pvrsrvkm.ko")
+
+	modprobe omaplfb
+
+	pvr_maj=`grep "pvrsrvkm$" /proc/devices | cut -b1,2,3`
 
-mknod /dev/pvrsrvkm c $pvr_maj 0 
-chmod 666 /dev/pvrsrvkm
+	if [ -e /dev/pvrsrvkm ] ; then 
+		rm -f /dev/pvrsrvkm
+	fi
 
-/usr/bin/pvrsrvinit
+	mknod /dev/pvrsrvkm c $pvr_maj 0 
+	chmod 666 /dev/pvrsrvkm
 
-# Set SGX to full speed
-devmem2 0x48004b40 w 0
+	/usr/bin/pvrsrvinit
+
+	# Set SGX to full speed
+	devmem2 0x48004b40 w 0
+else
+	echo No SGX hardware, not starting pvrsinit
+fi
 





More information about the Openembedded-commits mailing list