This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problems with Qt with OpenGL (SGX graphics acceleration)

Guru 10685 points
Other Parts Discussed in Thread: UKERNEL

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:

  1. Extract qt-everywhere-commercial-src-4.7.2.tar.gz.
  2. export TOOLCHAIN_INSTALL_ROOT=<Path to Code Sourcery toolchain>/arm-2009q1
  3. export PATH=$PATH:$TOOLCHAIN_INSTALL_ROOT/bin
  4. Download this file which contains the appropriate qmake.conf.
  5. Extract the .tar.gz file to "<Qt extraction directory>/mkspecs/qws/".
  6. Edit the file "<Qt extraction directory>/mkspecs/qws/linux-TIarmv7-ogles2-g++/qmake.conf" as follows:
    1. Change "SGX_SDK_ROOT" to be set as "<EZSDK>/component-sources/graphics-sdk_4.06.00.01".
    2. 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".
    3. 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"
    4. Change "QMAKE_LIBS" to be set as "$$QMAKE_LIBS_OPENGL_ES2" only. i.e. No touchscreen library.
    5. Replace any instances of "es5" with "es6".
  7. A patch must be applied to the Qt source.
    1. Download this patch.
    2. 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".
  8. Ensure that the full paths to some header files are included:
    1. "<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.
    2. "<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.
  9. 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

  • Do the pre-packaged binaries work on your system ?

  • Which ones are those?

    About 6 months ago I definitely had some pre-built binaries running fine on my system but I'm not sure where these were from as it was a while ago. I think I may have downloaded them from this post:  http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/p/132525/494540.aspx#494540

    I'm certain I didn't compile them myself.

    Ralph

  • Okay, breaking news. I have it working. Here is what I used:

    • Qt 4.7.1
    • Graphics SDK 4.06.00.01
    • Qmake.conf (originally from here):

    #w
    # qmake configuration for building with arm-linux-g++
    #

    include(../../common/g++.conf)
    include(../../common/linux.conf)
    include(../../common/qws.conf)

    #User specific Path - To Be edited by User
    QT_INSTALL_DIR          = /home/ralphc/qtdiy/qt-everywhere-opensource-src-4.7.1
    SGX_SDK_ROOT            = /home/ralphc/ezsdk/ti-ezsdk_dm816x-evm_5_03_01_15/component-sources/graphics-sdk_4.06.00.01_qws
    TSLIB_INCDIR            = /home/anand/ti/utils/tslib/include
    TSLIB_LIBDIR            = /home/anand/ti/utils/tslib

    # modifications to g++.conf
    QMAKE_CFLAGS_RELEASE    = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
    QMAKE_CXXFLAGS_RELEASE  = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
    QMAKE_CC                = arm-none-linux-gnueabi-gcc
    QMAKE_CXX               = arm-none-linux-gnueabi-g++
    QMAKE_LINK              = arm-none-linux-gnueabi-g++
    QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++

    # modifications to linux.conf
    QMAKE_AR                = arm-none-linux-gnueabi-ar cqs
    QMAKE_OBJCOPY           = arm-none-linux-gnueabi-objcopy
    QMAKE_STRIP             = arm-none-linux-gnueabi-strip

    #Do not edit beyond this

    QMAKE_INCDIR_OPENGL_ES2 = $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/Include/
    QMAKE_INCDIR_OPENGL_ES2 += $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES2/SDKPackage/Builds/OGLES2/LinuxOMAP3/Include/
    QMAKE_INCDIR_OPENGL_ES2 += $$SGX_SDK_ROOT/include
    QMAKE_INCDIR_OPENGL_ES2 += $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include/
    QMAKE_LIBDIR_OPENGL_ES2 = $$SGX_SDK_ROOT/gfx_dbg_es6.x/
    QMAKE_LIBS_OPENGL_ES2   = -lEGL -lGLESv2 -lGLES_CM -lIMGegl -lsrv_um -lusc

    QMAKE_INCDIR_OPENGL     += $$SGX_SDK_ROOT/GFX_Linux_SDK/OGLES/SDKPackage/Builds/OGLES/Include/
    QMAKE_LIBDIR_OPENGL     = $$SGX_SDK_ROOT/gfx_dbg_es6.x
    QMAKE_LIBDIR_OPENGL_QT  = $$SGX_SDK_ROOT/gfx_dbg_es6.x
    QMAKE_LIBS_OPENGL_ES1   = -lEGL -lGLES_CM -lIMGegl -lsrv_um -lusc

    QMAKE_INCDIR_OPENVG     = $$SGX_SDK_ROOT/GFX_Linux_SDK/OVG/SDKPackage/Builds/OVG/Include/
    QMAKE_LIBDIR_OPENVG     = $$SGX_SDK_ROOT/gfx_dbg_es6.x/
    QMAKE_LIBS_OPENVG       = -lEGL -lGLESv2 -lGLES_CM -lIMGegl -lsrv_um -lOpenVG -lOpenVGU

    QMAKE_INCDIR_EGL        = $$QMAKE_INCDIR_OPENGL_ES2
    QMAKE_INCDIR_EGL        += $$QT_INSTALL_DIR/src/3rdparty/powervr/wsegl2
    QMAKE_INCDIR_POWERVR    = $$QT_INSTALL_DIR/src/3rdparty/powervr/wsegl2
    QMAKE_LIBDIR_EGL        = $$QMAKE_LIBDIR_OPENGL_ES2
    QMAKE_LIBS_EGL          = -lEGL -lIMGegl -lsrv_um -lGLESv2 -lGLES_CM -lusc

    QMAKE_INCDIR += $$TSLIB_INCDIR
    QMAKE_INCDIR += $$QMAKE_INCDIR_OPENGL_ES2
    QMAKE_INCDIR += /home/ralphc/ezsdk/ti-ezsdk_dm816x-evm_5_03_01_15/component-sources/graphics-sdk_4.06.00.01_qws/include/OGLES
    QMAKE_INCDIR += /home/ralphc/qtdiy/qt-everywhere-commercial-src-4.7.1/src/3rdparty/powervr
    QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2
    QMAKE_LIBDIR += $$TSLIB_LIBDIR
    QMAKE_LIBS = $$QMAKE_LIBS_OPENGL_ES2 #-lts

    load(qt_config)

    • Environment variables on target:

    export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib

    export QT_QWS_FONTDIR=/lib/fonts

    export QT_PLUGIN_PATH=/plugins

    • Patch for QWS applied to Qt from here.
    • Configure command for Qt:

    ./configure -prefix /home/ralphc/qtdiy/install -embedded arm -platform qws/linux-x86_64-g++ -xplatform qws/linux-TIarmv7-ogles2-g++ -depths 16,24,32 -no-mmx -no-3dnow -no-sse -no-sse2 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl -no-gtkstyle -qt-mouse-pc -qt-mouse-linuxinput -plugin-mouse-pc -opengl es2 -openvg -qt-gfx-transformed -qt-gfx-linuxfb -qt-gfx-multiscreen -plugin-gfx-powervr -D QT_NO_QWS_CURSOR -D QT_QWS_CLIENTBLIT

    If I had to guess which bit made this work, I would say that adding in the extra include directories in qmake.conf (for QMAKE_INCDIR_OPENGL_ES2) and getting the configure command right did the trick. It's hard to believe that the configure command is that sensitive but there you go.

    Case closed... until Qt 4.8.

    Ralph

  • If the patch had been applied properly, the correct pvr2d.h would have been used. It appears you are having multiple copies of pvr2d.h (different versions) in your setup causing QWS libraries to incorrectly initialise egl.

    Qt4.8 is also validated. Note that instructions for qt4.8 are already at,

    https://github.com/prabindh/qt-configs

  • Hi,

    I'm able compile Qt.4.7.1 with opengl support without any error. But when i was trying to test the test app which is provided by Qt.

    I got this error:

    hellogl_es2: symbol lookup error: /lib_qt/libQtOpenGL.so.4: undefined symbol: _ZN11QEglContextC1Ev

    Please help me to resolve this issue.

    Thanks & Regards,

    Gowthaman.P

  • In general - you can use strace or similar tool to find which library is missing. Are you able to run other non-opengl examples ?

  • Hi Prabindh,

    Yes i'm able to run other than opegl example. 

    Regards,

    Gowthaman.P

  • Hi Prabindh,

    Now i'm able to run default opengl (OGLESCoverflow examples) but if i run Qt opengl examples getting below error

    Error:

    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Trolltech/QtEmbedded-4.7.1-arm/plugins/gfxdrivers/libqgfxpvregl.so"

    keys ("powervr")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Trolltech/QtEmbedded-4.7.1-arm/plugins/mousedrivers/libqlinuxtpmousedriver.so"
    keys ("LinuxTP")
    QFactoryLoader::QFactoryLoader() looking at "/usr/local/Trolltech/QtEmbedded-4.7.1-arm/plugins/mousedrivers/libqpcmousedriver.so"
    keys ("Auto", "IntelliMouse", "Microsoft", "MouseSystems", "MouseMan")
    QEglContext::createSurface(): Unable to create EGL surface, error = 0x3001

    I'm using graphics version as graphics-sdk_4.04.00.02 and Qt version as 4.7.1

    Please let me know what could be an issue.

    Note : I have attached a file for gfx_check.sh command output.

    1460.gfx_check.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    root@dm814x-evm:~# /etc/init.d/38xx-demo
    /dev/mem opened.
    Memory mapped at address 0x4042d000.
    Value at address 0x48180F04 (0x4042df04): 0x1
    Written 0x0; readback 0x0
    /dev/mem opened.
    Memory mapped at address 0x403f4000.
    Value at address 0x48180900 (0x403f4900): 0x1
    Written 0x2; readback 0x2
    /dev/mem opened.
    Memory mapped at address 0x4010e000.
    Value at address 0x48180920 (0x4010e920): 0x70000
    Written 0x2; readback 0x2
    0x10205
    release6.x
    SGX Revision is 125...
    installing 6.x SGX release user libraries
    Installing PowerVR Consumer/Embedded DDK 1.6.16.4117 on target
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regards,

    Gowthaman.P