I can't get 3D acceleration working in the Qt examples using the latest graphics SDK (4.06.00.01) for QWS (i.e. not X.org). I have been _trying_ to follow the massively out of date instructions at http://processors.wiki.ti.com/index.php/Building_Qt_with_OpenGL_ES_accelerated_by_SGX to the best of my skill.
Here is what I do and what happens:
- Extract qt-everywhere-commercial-src-4.7.2.tar.gz.
- export TOOLCHAIN_INSTALL_ROOT=<Path to Code Sourcery toolchain>/arm-2009q1
- export PATH=$PATH:$TOOLCHAIN_INSTALL_ROOT/bin
- Download this file which contains the appropriate qmake.conf.
- Extract the .tar.gz file to "<Qt extraction directory>/mkspecs/qws/".
- Edit the file "<Qt extraction directory>/mkspecs/qws/linux-TIarmv7-ogles2-g++/qmake.conf" as follows:
- Change "SGX_SDK_ROOT" to be set as "<EZSDK>/component-sources/graphics-sdk_4.06.00.01".
- Change "QMAKE_INCDIR_OPENGL_ES2 += $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/LinuxOMAP3/Include/" to "QMAKE_INCDIR_OPENGL_ES2 += $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/LinuxARMV7/lib".
- Change "QMAKE_LIBS_OPENGL_ES2" to be set as "-lEGL -lGLESv2 -lGLES_CM -lIMGegl -lsrv_um $$SGX_SDK_ROOT/gfx_dbg_es6.x/libusc.so"
- Change "QMAKE_LIBS" to be set as "$$QMAKE_LIBS_OPENGL_ES2" only. i.e. No touchscreen library.
- Replace any instances of "es5" with "es6".
- A patch must be applied to the Qt source.
- Download this patch.
- Applying the patch involves copying over new versions of "wsegl.h" and "pvr2d.h" in "<Qt extraction directory>/src/3rdparty/powervr/" and altering "<Qt extraction directory>/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c".
- Ensure that the full paths to some header files are included:
- "<Qt extraction directory>/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h" needs "/home/ralphc/qtdiy/qt-everywhere-commercial-src-4.7.2/src/3rdparty/powervr/pvr2d.h" specifying.
- "<Qt extraction directory>/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c" needs "/home/ralphc/ezsdk/ti-ezsdk_dm816x-evm_5_03_01_15/component-sources/graphics-sdk_4.06.00.01_qws/include/OGLES/GLES/egltypes.h" specifying.
- Change to the Qt extraction directory and run the configure command (assuming 64 bit host):
./configure -prefix <my installation target directory> -embedded arm -platform qws/linux-x86_64-g++
-xplatform qws/linux-TIarmv7-sgx-g++ -depths 16,24,32 -qt-freetype -no-mmx -no-3dnow -no-sse
-no-sse2 -no-sse3 -no-sse4.1 -no-sse4.2 -no-ssse3 -no-avx -no-cups -qt-mouse-pc -no-mouse-tslib
-qt-mouse-linuxinput -plugin-mouse-pc -little-endian -commercial -opengl es2 -openvg -qt-gfx-transformed
-qt-gfx-linuxfb -qt-gfx-multiscreen -plugin-gfx-powervr -D QT_NO_QWS_CURSOR -D QT_QWS_CLIENTBLIT
10. make -j 4
11. make install
12. On the target I run
/usr/local/share/ti/ti-media-controller-utils/load-hd-firmware.sh start
/etc/init.d/pvr-init
/etc/init.d/rc.pvr start
export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
export QT_QWS_FONTDIR=/lib/fonts
export QT_PLUGIN_PATH=/plugins
In case you wondered, here is what pvr-init does (it is a clone of 38xx-demo without the installation part):
RM_SGX_RSTCTRL=0x48180F04
CM_SGX_CLKSTCTRL=0x48180900
CM_SGX_SGX_CLKCTRL=0x48180920
devmem2 $RM_SGX_RSTCTRL w 0x0 # Bring SGX out of reset
devmem2 $CM_SGX_CLKSTCTRL w 0x2 # Enable the SGX clocks
devmem2 $CM_SGX_SGX_CLKCTRL w 0x2 # Bring SGX out of idle
# while((RD_MEM_32(CM_SGX_SGX_CLKCTRL)) != 0x00040002); //Wait for SGX to come out of idle
#sleep 2
devmem2 0x56000014 > /etc/init.d/sgxrevision.txt
13. Finally I run the application: with "/examples/opengl/hellogl_es2/hellogl_es2 -qws -display powervr". I had to relocate my libusc.so because of the changes I made to the qmake.conf.
# /examples/opengl/hellogl_es2/hellogl_es2 -qws -display powervr
PVR: Hint: Setting WindowSystem to libpvrQWSWSEGL.so
PVR:(Warning): PVRSRVMetricsTimeNow: not implemented [120, /pvr_metrics.c]
PVR:
PVR: Memory Stats
PVR: ------------
PVR:
PVR: High Water Mark = 4116 bytes
PVR:
PVR: 4116 bytes still allocated in 1 allocations
PVR:
PVR: 1 - 41PVR_K:(Error): PVRSRVCreateDCSwapChainKM: Failed to create 3rd party SwapChain [1123, home/ralphc/ezsdk/ti-ezsdk_dm816x-evm_5_03_01_15/component-sources/graphi
cs-sdk_4.06.00.01_qws/GFX_Linux_KM/services4/srvkm/common/deviceclass.c]
16 bytes at 0x55590 - eurasiacon/imgegl/tls.c:49
PVR:
PVR:(Warning): PVR2DEnumerateDevices: display device name too long, truncating [161, /pvr2dinit.c]
PVR:
PVR: Memory Stats
PVR: ------------
PVR:
PVR: High Water Mark = 4116 bytes
PVR:
PVR: 4116 bytes still allocated in 1 allocations
PVR:
PVR: 1 - 4116 bytes at 0x55590 - eurasiacon/imgegl/tls.c:49
PVR:
PVR:(Error): PVRSRVCreateDCSwapChain: Error - 3 returned [520, /bridged_pvr_dc_glue.c]
PVR:(Error): PVR2DCreateFlipChain: can't create flipchain [221, /pvr2dflip.c]
PVR:(Warning): InitContext: ignoring buffer type CBUF_TYPE_PDS_VERT_SECONDARY_PREGEN_BUFFER [778, /eglglue.c]
PVR:(Warning): Running StartUpMemSpeedTest. High memory watermark will be ruined. Disable using apphint EnableMemorySpeedTest [57, /metrics.c]
PVR: Bytes : 512 1024 2048 4096 8192 16384 32768 65536 131072
PVR: ---------------|-------|-------|-------|-------|-------|-------|-------|-------|
PVR: H -> VB: 160.01 0.00 640.04 1280.08 853.39 1024.06 1024.06 975.30 975.30
PVR: H -> H: 0.00 0.00 0.00 640.04 1280.08 1024.06 1024.06 975.30 1024.06
QEglContext::createSurface(): Unable to create EGL surface, error = 0x3001
PVR:
PVR: Texture allocation HWM = 8 bytes
PVR:(Warning): HW Recovery stats: Host: 0 uKernel: 0 [148, /sgxrender_context.c]
PVR:
PVR: Memory Stats
PVR: ------------
PVR:
PVR: High Water Mark = 2139345 bytes
PVR:
PVR: 4116 bytes still allocated in 1 allocations
PVR:
PVR: 1 - 4116 bytes at 0x55590 - eurasiacon/imgegl/tls.c:49
PVR:
PVR:
It just gives me a window with a green rectangle in.
Here is my gfx_check output:
# /gfx_check.sh
WSEGL settings
[default]
#WindowSystem=libpvrPVR2D_FRONTWSEGL.so
#WindowSystem=libpvrPVR2D_FLIPWSEGL.so
WindowSystem=libpvrQWSWSEGL.so
------
ARM CPU information
Processor : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 986.31
Features : swp half thumb fastmult vfp edsp neon vfpv3
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc08
CPU revision : 2
Hardware : ti8168evm
Revision : 0000
Serial : 0000000000000000
------
SGX driver information
Version sgxddk 17 1.7@783851 (debug) /home/ralphc/ezsdk/ti-ezsdk_dm816x-evm_5_03_01_15/component-sources/graphics-sdk_4.06.00.01_qws/GFX_Linux_KM
System Version String: SGX revision = 1.2.5
------
Framebuffer settings
------
Rotation settings
0
------
Kernel Module information
Module Size Used by Not tainted
omaplfb 10181 0
pvrsrvkm 397414 1 omaplfb
ti81xxhdmi 14668 0
ti81xxfb 20741 1
vpss 67003 3 omaplfb,ti81xxhdmi,ti81xxfb
syslink 1067008 0
------
Boot settings
console=ttyO2,115200n8 mem=364M mem=324M@0x9F900000 earlyprintk notifyk.vpssm3_sva=0xBF900000 vram=50M ti816xfb.vram=0:16M,1:16M,2:6M ip=dhcp vmalloc=500M root=/dev/nfs nfsr
oot=172.20.1.27:/home/ralphc/rootfs noinitrd
------
Linux Kernel version
Linux buildroot 2.6.37+ #1 PREEMPT Mon Mar 12 13:25:16 GMT 2012 armv7l GNU/Linux
I do _not_ want to use TI's pre-packaged "out of the box" binaries. I want to be able to build Qt myself and build the graphics drivers myself. This is necessary for the company strategy. I can run qt demos without acceleration as well as 3d-only demos with acceleration.
Please can someone help.
Thanks very much,
Ralph