libgles-omap3: split es2+3 and es5, combine different versions
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 12 Oct 2014 14:29:10 +0000 (17:29 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 12 Oct 2014 14:29:10 +0000 (17:29 +0300)
4.03.00.02 was reported to be one of the best drivers for 1GHz/DM3730
pandoras while 4.00.00.01 is the last one that works on CC/OMAP3530 ES2,
so split the recipe and use different version for each.
Also update the init script to cope with this.

recipes/powervr-drivers/files/99-bufferclass.rules [moved from recipes/powervr-drivers/libgles-omap3/99-bufferclass.rules with 100% similarity]
recipes/powervr-drivers/files/cputype [moved from recipes/powervr-drivers/libgles-omap3/cputype with 100% similarity]
recipes/powervr-drivers/files/rc.pvr [moved from recipes/powervr-drivers/libgles-omap3/rc.pvr with 73% similarity]
recipes/powervr-drivers/files/sample.desktop [moved from recipes/powervr-drivers/libgles-omap3/sample.desktop with 100% similarity]
recipes/powervr-drivers/libgles-omap3-dm3730_4.03.00.02.bb [new file with mode: 0644]
recipes/powervr-drivers/libgles-omap3-es23_4.00.00.01.bb [new file with mode: 0644]
recipes/powervr-drivers/libgles-omap3.inc

similarity index 73%
rename from recipes/powervr-drivers/libgles-omap3/rc.pvr
rename to recipes/powervr-drivers/files/rc.pvr
index 91404c9..6c12159 100755 (executable)
@@ -4,7 +4,44 @@ PATH=$PATH:/usr/sbin
 BITSPERPIXEL="$(fbset | grep geom | awk '{print $6}')"
 YRES="$(fbset | grep geom | awk '{print $3}')"
 
-CPUTYPE="$(cputype)"
+unload_driver()
+{
+       rmmod bufferclass_ti 2>/dev/null
+       rmmod omaplfb 2>/dev/null
+       rmmod pvrsrvkm 2>/dev/null
+}
+
+load_driver()
+{
+       if test -f /etc/powervr-kmodver; then
+               version=`cat /etc/powervr-kmodver`
+       fi
+       insmod /lib/modules/$(uname -r)/kernel/drivers/gpu/pvr/$version/pvrsrvkm.ko
+       insmod /lib/modules/$(uname -r)/kernel/drivers/gpu/pvr/$version/omaplfb.ko
+       bc_ko="/lib/modules/$(uname -r)/kernel/drivers/gpu/pvr/$version/bufferclass_ti.ko"
+       if test -f "$bc_ko"; then
+               insmod $bc_ko
+       fi
+
+       if ! lsmod | grep -q pvrsrvkm; then
+               echo pvrsrvkm failed to load
+               exit 1
+       fi
+}
+
+# $1 - full pathname, like /usr/lib/ES5.0/libGLESv2.so.1.4.14.2616
+install_lib()
+{
+       base=`basename $1`
+       baseso=`echo $base | sed -e 's:\(lib.*.so\).*:\1:'`
+       rm /usr/lib/${baseso}*
+       cp -a $1 /usr/lib/
+
+       cd /usr/lib
+       ln -fs $base ${baseso}
+       ln -fs $base ${baseso}.1
+       cd $OLDPWD
+}
 
 if [ "$1" = "" ]; then
        echo PVR-INIT: Please use start, stop, or restart.
@@ -13,9 +50,7 @@ fi
 
 if [ "$1" = "stop" -o  "$1" = "restart" ]; then
        echo Stopping PVR
-       rmmod bufferclass_ti 2>/dev/null
-       rmmod omaplfb 2>/dev/null
-       rmmod pvrsrvkm 2>/dev/null
+       unload_driver
 fi
 
 if [ "$1" = "stop" ]; then
@@ -32,20 +67,7 @@ fbset -vyres $(expr $YRES \* 3)
 
        echo Starting PVR
 
-       if test -f /etc/powervr-kmodver; then
-               version=`cat /etc/powervr-kmodver`
-       fi
-       insmod /lib/modules/$(uname -r)/kernel/drivers/gpu/pvr/$version/pvrsrvkm.ko
-       insmod /lib/modules/$(uname -r)/kernel/drivers/gpu/pvr/$version/omaplfb.ko
-       bc_ko="/lib/modules/$(uname -r)/kernel/drivers/gpu/pvr/$version/bufferclass_ti.ko"
-       if test -f "$bc_ko"; then
-               insmod $bc_ko
-       fi
-
-       if ! lsmod | grep -q pvrsrvkm; then
-               echo pvrsrvkm failed to load
-               exit 1
-       fi
+       load_driver
 
        #pvr_maj=`grep "pvrsrvkm$" /proc/devices | cut -b1,2,3`
         #bc_maj=`grep "bc" /proc/devices | cut -b1,2,3`
@@ -71,12 +93,23 @@ fbset -vyres $(expr $YRES \* 3)
        devmem2 0x48004B48 w 0x3 > /dev/null
 
        if [ "${ES_REVISION}" != "${SAVED_ESREVISION}" ] ; then
+               sdkver=`echo /usr/lib/ES${ES_REVISION}.0/libGLESv2.so.1.* | sed -e 's:.*lib.*.so.\(.*\).*:\1:'`
                echo -n "Starting SGX fixup for"
-               echo " ES${ES_REVISION}.x"
-               cp -a /usr/lib/ES${ES_REVISION}.0/* /usr/lib
+               echo " ES${ES_REVISION}.x (${sdkver})"
+               for lib in /usr/lib/ES${ES_REVISION}.0/*.so*; do
+                       install_lib $lib
+               done
                cp -a /usr/bin/ES${ES_REVISION}.0/* /usr/bin    
                echo "${ES_REVISION}" > /etc/powervr-esrev
                sync
+               touch /etc/powervr-kmodver
+               oldkmod=`cat /etc/powervr-kmodver`
+               if [ "${sdkver}" != "${oldkmod}" ]; then
+                       echo "Switching driver to ${sdkver}"
+                       echo "${sdkver}" > /etc/powervr-kmodver
+                       unload_driver
+                       load_driver
+               fi
        fi
        if test -x /usr/bin/pvrsrvinit; then
                /usr/bin/pvrsrvinit
diff --git a/recipes/powervr-drivers/libgles-omap3-dm3730_4.03.00.02.bb b/recipes/powervr-drivers/libgles-omap3-dm3730_4.03.00.02.bb
new file mode 100644 (file)
index 0000000..8b07b29
--- /dev/null
@@ -0,0 +1,72 @@
+DESCRIPTION = "libGLES for the dm3730"
+LICENCE = "proprietary-binary"
+
+COMPATIBLE_MACHINE = "omap3-pandora"
+
+DEPENDS = "virtual/libx11 libxau libxdmcp"
+
+ES5LOCATION = "${S}/gfx_rel_es5.x"
+
+# Logic to unpack installjammer file
+TI_BIN_UNPK_CMDS="Y: qY:workdir:Y"
+require ../ti/ti-eula-unpack.inc
+
+do_configure() {
+       # Attempt to fix up the worst offenders for file permissions
+       for i in $(find ${S} -name "*.h") $(find ${S} -name "*.c") $(find ${S} -name "Make*") ; do
+               chmod 0644 $i
+       done 
+
+       for sofile in $(find ${S} -name "lib*Open*.so") $(find ${S} -name "lib*srv*.so") $(find ${S} -name "lib*gl*.so") $(find ${S} -name "libpvr*.so") $(find ${S} -name "lib*GL*.so"); do
+               if [ ! -e "${sofile}.${IMGPV}" ] ; then
+                       mv $sofile ${sofile}.${IMGPV}
+               fi
+       done
+
+       # Due to recursive make PLAT_* isn't always passed down correctly, so use sed to fix those
+       for mak in $(find ${S} -name "*.mak") ; do
+               sed -i -e s:arm-none-linux-gnueabi-:${TARGET_PREFIX}:g $mak
+       done
+
+       # clear out old stuff
+       find Binaries/ | xargs rm -f || true
+}
+
+# Force in GNU_HASH and paths to libs
+TARGET_CC_ARCH += " ${TARGET_LINK_HASH_STYLE} -Wl,-rpath-link,${BINLOCATION} -L${BINLOCATION}"
+
+do_compile() {
+}
+
+do_install () {
+       install -d ${D}${libdir}/ES5.0
+       install -d ${D}${bindir}/ES5.0
+
+       cp -pPR ${ES5LOCATION}/lib*${IMGPV} ${D}${libdir}/ES5.0/
+       cp ${ES5LOCATION}/pvr* ${D}${bindir}/ES5.0/
+}
+
+FILES_${PN} = "${libdir}/ES*/* ${bindir}/ES*/*"
+FILES_${PN}-dbg = "${libdir}/ES*/.debug ${bindir}/ES*/.debug"
+
+# The libs need the kernel-modules
+RRECOMMENDS_${PN} = "omap3-sgx-modules"
+
+INSANE_SKIP_${PN} = True
+
+PR = "r0"
+
+SGXPV = "4_03_00_02"
+IMGPV = "1.6.16.3977"
+BINFILE := "Graphics_SDK_setuplinux_${SGXPV}.bin"
+
+# upgrade path
+RCONFLICTS = "libgles-omap3"
+RREPLACES = "libgles-omap3"
+
+SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/${SGXPV}/exports/Graphics_SDK_setuplinux_${SGXPV}.bin"
+
+SRC_URI[md5sum] = "ff8c1f2b8e4cb42f4ced6a613b081ada"
+SRC_URI[sha256sum] = "cdb0bd3964e107733d632aa8224e0537b05c1ffac34befc036423458c8d75255"
+
+S = "${WORKDIR}/Graphics_SDK_${SGXPV}"
diff --git a/recipes/powervr-drivers/libgles-omap3-es23_4.00.00.01.bb b/recipes/powervr-drivers/libgles-omap3-es23_4.00.00.01.bb
new file mode 100644 (file)
index 0000000..fcc7385
--- /dev/null
@@ -0,0 +1,32 @@
+BINLOCATION = "${S}/gfx_rel_es3.x"
+
+ES2LOCATION = "${S}/gfx_rel_es2.x"
+ES3LOCATION = "${S}/gfx_rel_es3.x"
+ES5LOCATION = "none"
+
+require libgles-omap3.inc
+
+PR = "r0"
+
+SGXPV = "4_00_00_01"
+IMGPV = "1.4.14.2616"
+BINFILE := "Graphics_SDK_setuplinux_${SGXPV}.bin"
+
+# upgrade path
+RCONFLICTS = "libgles-omap3"
+RREPLACES = "libgles-omap3"
+
+# init script needs this to be in place
+RDEPENDS_${PN} += "libgles-omap3-dm3730"
+
+SRC_URI = "http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/${SGXPV}/exports/Graphics_SDK_setuplinux_${SGXPV}.bin \
+                   file://cputype \
+                   file://rc.pvr \
+                   file://sample.desktop \
+                   file://99-bufferclass.rules  \
+"
+
+SRC_URI[md5sum] = "a027002dcd7164df467b1a315788d5fd"
+SRC_URI[sha256sum] = "62383d15e33adf9349afba063b0f2405a15aa6c4b0b5579b0abdf81db7580df7"
+
+S = "${WORKDIR}/Graphics_SDK_${SGXPV}"
index 4b7705d..b0f8441 100644 (file)
@@ -135,7 +135,7 @@ do_install () {
 
        install -m 0755 ${BINLOCATION}/*_test ${D}${bindir}/
        install -m 0755 ${BINLOCATION}/gl* ${D}${bindir}/
-       install -m 0755 ${BINLOCATION}/p[dv]* ${D}${bindir}/
+       install -m 0755 ${BINLOCATION}/pvr* ${D}${bindir}/
        install -m 0755 ${BINLOCATION}/xgles1test1 ${D}${bindir}/
 
        install -m 0755 ${BINLOCATION}/freedesktop/kdrive/usr/X11R6_SGX/bin/Xsgx ${D}${bindir}/|| true
@@ -171,14 +171,14 @@ do_install () {
 
 
        cp -pPR ${ES2LOCATION}/lib*${IMGPV} ${D}${libdir}/ES2.0/
-       cp ${ES2LOCATION}/p[dv]* ${D}${bindir}/ES2.0/
+       cp ${ES2LOCATION}/pvr* ${D}${bindir}/ES2.0/
 
        cp -pPR ${D}${libdir}/lib*${IMGPV} ${D}${libdir}/ES3.0/
-       cp ${D}${bindir}/p[dv]* ${D}${bindir}/ES3.0
+       cp ${D}${bindir}/pvr* ${D}${bindir}/ES3.0
 
        if [ -e ${ES5LOCATION} ] ; then 
                cp -pPR ${ES5LOCATION}/lib*${IMGPV} ${D}${libdir}/ES5.0/
-               cp ${ES5LOCATION}/p[dv]* ${D}${bindir}/ES5.0/
+               cp ${ES5LOCATION}/pvr* ${D}${bindir}/ES5.0/
        fi
 
        install -d ${D}${prefix}/share/applications