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.

PowerVR accelerated Qt applications under X11

Guru 10685 points

Is there a guide on how to build Qt for use under X11? I would like my OpenGL/OpenVG enabled Qt applications to run with graphics acceleration under X11. The powervr plugin in Qt seems to be intimately linked to QWS.

I don't want to use QWS because there is a licence fee associated with using it and if I use X11 instead of QWS I will save money on every DM8168 I deploy.

Look forward to hearing from someone.

Thanks,

Ralph

  • Refer to the Quick Installation and User Guide referred from below home page for the Graphics SDK,

    http://processors.wiki.ti.com/index.php/AM35x-OMAP35x_Graphics_SDK_Getting_Started_Guide

    Where did license fee for QWS for "open source license" come from ? Or is a commercial license being used ? Or do you want to use proprietary modifications ?

    http://blog.qt.nokia.com/2009/11/30/qt-making-the-right-licensing-decision/

  • Hi Prabindh,

    We are using Qt commercial.

    I have already followed the guide at the link you provided and have got 3D graphics working but not 3D-accelerated Qt applications (like hellogl_es2 demo) running under that X11 environment.When I run hellogl_es the display changes from X11 to QWS before displaying the Qt application under QWS.

    In addition, I want to be able to use my own self-compiled version of X11. I believe the X11 provided in the graphics SDK is a pre-compiled one that TI originally obtained from Imagination Technologies who design the SGX PowerVR core. It's easy enough for me to build X11 and Qt applications but how do I make the bridge across to running Qt OpenGL applications natively under X11?

    Thanks,

    Ralph

  • Well, if you compile Qt/embedded (-embedded) and run it under X11, exactly that will happen. You need to build Qt with x11 support natively. This is non-trivial, and recommend looking at Angstrom distribution or Ubuntu.

    For using Xorg accelerated drivers, have you referred below link,

    http://processors.wiki.ti.com/index.php/SGXDbg#WindowSystem

    >> libpvrPVR2D_DRIWSEGL.so (for integration with X11/DRI/DRM drivers only)

  • If I run ./configure --help in the Qt directory there is no "-embedded" option.

    I spotted the library for DRI under X11 but then how would I tell X11 to use libpvrPVR2D_DRIWSEGL.so?

    I am using Buildroot to build Qt under X11.

    Thanks,
    Ralph

  • All this is documented below (Working under Xorg).

    http://processors.wiki.ti.com/index.php/Graphics_SDK_Quick_installation_and_user_guide

  • Maybe the OE powervr tree link will help me build Qt embedded for X with SGX drivers. I'll have a look.

  • I had a look at the OpenEmbedded powervr tree but can't see how that will help build Qt for X11. I've read that "Graphics SDK Quick Installation" page several times but I'm not very enlightened by it.

    I might be simplifying things but I see what I need to do as "simple" as getting the qmake.conf right and the configure command  line right. At the moment I have this (note that there is no "-embedded" switch as I believe this will cause Qt to be built for QWS which is not what we want):

    ./configure -prefix /home/ralphc/qtdiy/install -platform linux-g++-64 -xplatform shark -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

    where the shark qmake.conf is this:

    #
    # qmake configuration for building with arm-none-linux-gnueabi-g++
    #

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

    #Below 4 lines added by Ralph.
    QMAKE_INCDIR_X11        = /home/ralphc/ezsdk/ti-ezsdk_dm816x-evm_5_03_01_15/component-sources/graphics-sdk_4.06.00.01_x11/targetfs/XSGX/include
    QMAKE_LIBDIR_X11        = /home/ralphc/ezsdk/ti-ezsdk_dm816x-evm_5_03_01_15/component-sources/graphics-sdk_4.06.00.01_x11/targetfs/XSGX/lib
    QMAKE_LIBS_X11          = -lXext -lX11 -lm
    QMAKE_LIBS_X11SM        = -lSM -lICE

    # modifications to g++.conf
    QMAKE_CFLAGS_RELEASE    = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp          # added by Ralph
    QMAKE_CXXFLAGS_RELEASE    = -O3 -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp       # added by Ralph
    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

    #Rest of file copied from QWS version.
    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 += $$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_x11/include/OGLES
    QMAKE_INCDIR += /home/ralphc/qtdiy/qt-everywhere-commercial-src-4.7.2_x11/src/3rdparty/powervr
    QMAKE_LIBDIR += $$QMAKE_LIBDIR_OPENGL_ES2
    QMAKE_LIBS = $$QMAKE_LIBS_OPENGL_ES2

    load(qt_config)

    Unfortunately when I run the configure command it just errors out saying this (I only print the last few lines):

    /home/ralphc/qtdiy/qt-everywhere-commercial-src-4.7.2_x11/mkspecs/features/uic.prf:107: Using OS scope before setting MAKEFILE_GENERATOR
    MAKEFILE_GENERATOR variable not set as a result of parsing : /home/ralphc/qtdiy/qt-everywhere-commercial-src-4.7.2_x11/config.tests/x11/xlib/xlib.pro. Possibly qmake was not able to find files included using "include(..)" - enable qmake debugging to investigate more.
    Basic XLib functionality test failed!
     You might need to modify the include and library search paths by editing
     QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/ralphc/qtdiy/qt-everywhere-commercial-src-4.7.2_x11/mkspecs/shark.

    Any ideas how I can fix this? I am pointing to the correct directory so not sure why it isn't working.

    Ralph

  • This is a non-trivial task. As recommended  earlier, try using Angstrom build, or Ubuntu. Both are buildable from sources, and there are good forums available.

  • I have got a bit further along; X is built but I need to build the Mesa library which contains DRI as well.

    Looking at <EZSDK>/component-sources/graphics-sdk_4.06.00.01_x11/targetfs/xorg_source/mesa/configs/current you can see the output of the configure command that TI used to build the Mesa-related part of the XSGX folder.

    Do you know what actual precise command was used to create this file?

    There are lots of references to "Prathap" so perhaps Prathap Srinivas can help out here?

    Hope to hear back soon,

    Ralph

  • Hi Ralph,

    As already suggested, its better to try with angstrom.

    Anyways, for your query on the command used for configure, i am giving you the snippets from makefile we use -

    ./configure \
                            --prefix=$(XORG_PREFIX) --with-expat=$(abspath $(XORG_OUT)) \
                            $(MODULE_CONFIGURE_FLAGS) && \

    MODULE_CONFIGURE_FLAGS := \
     --disable-glw --disable-gallium --disable-egl --with-driver=dri \
     --with-dri-drivers=swrast

    CROSS_TRIPLE := $(patsubst %-,%,$(CROSS_COMPILE))

    MODULE_CROSS_TRIPLE := $(CROSS_TRIPLE)

    ifneq ($(MODULE_CROSS_TRIPLE),)
    MODULE_CONFIGURE_FLAGS += --host=$(MODULE_CROSS_TRIPLE) --target=$(MODULE_CROSS_TRIPLE)
    MODULE_CONFIGURE_FLAGS += --build=$(shell $(patsubst @%,%,$(HOST_CC)) -dumpmachine)
    endif

    Thanks,

    Prathap.

  • Thanks Prathap. It's good to confirm that I had the right line. I'll verify answers once I'm complete.

    We are using Buildroot as our standard build system so unfortunately Angstrom is not an option. Are you saying that the information on building accelerated X is in Angstrom?


    Ralph

  • The Mesa provided in the graphics SDK has been patched slightly from its original version of 7.8.2. The changes are:

    dri_interface.h:

    // PVR ----------------------------------------
    typedef struct __DRItexBufferExtensionRecPvr    __DRItexBufferExtensionPvr;
    typedef struct __DRI2makeUnCurrentExtensionRecPvr    __DRI2makeUnCurrentExtensionPvr;
    // PVR ----------------------------------------


    // PVR + PVR BTT RGB/A FIX  ---------------------------------------
    #define __DRI_TEX_BUFFER_PVR "DRI_TexBufferPvr"
    #define __DRI_TEX_BUFFER_PVR_VERSION 3
    struct __DRItexBufferExtensionRecPvr {
        __DRIextension base;

        /**
         * Method to release base texture image of contents of a
         * __DRIdrawable.
         *
         * For GLX_EXT_texture_from_pixmap with AIGLX.
         */
        void (*releaseTexBuffer)(__DRIcontext *pDRICtx,
                 GLint target,
                 GLint format,
                 __DRIdrawable *pDraw);
    };

    #define __DRI2_MAKE_UN_CURRENT_PVR "DRI2_MakeUnCurrent"
    #define    __DRI2_MAKE_UN_CURRENT_PVR_VERSION 1
    struct __DRI2makeUnCurrentExtensionRecPvr {
        __DRIextension base;

        /**
         * For PVR OpenGL, the current context for a thread must be
         * made uncurrent before another context is made current.
         */
        void (*makeUnCurrent)(__DRIcontext *pDRICtx);
    };
    // PVR ---------------------------------------

    glxclient.h:

    #ifdef    __DRI2_MAKE_UN_CURRENT_PVR
        void (*makeUnCurrentPvr)(__GLXDRIcontext * context);
    #endif

    // PVR ----------------------------------------
    #ifdef __DRI_TEX_BUFFER_PVR
       const __DRItexBufferExtensionPvr *texBufferPvr;
    #endif

    #ifdef    __DRI2_MAKE_UN_CURRENT_PVR
        const __DRI2makeUnCurrentExtensionPvr *makeUnCurrentPvr;
    #endif
    // PVR ----------------------------------------

    My questions are:

    1) Do I need to concern myself with these changes made by TI or can I just use any version of Mesa that goes with X.org server 1.9.0? (The version the prorpietary pvr_drv.so module was built against)

    2) (Added question to original post). Your configure line disables EGL in Mesa yet you specify how to connect EGL to the X11 server in /etc/powervr.ini by using a line including "libpvrPVR2D_DRIWSEGL.so". Why is there this contradiction about apparently using EGL yet not using it at the same time? I'm really confused.

    Thanks,

    Ralph

  • Hi Ralph,

    You would have got some answers from the other (below) thread by now.

    http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/180387.aspx

    More details on Xorg acceleration can be found in sgxdbg page -

    http://processors.wiki.ti.com/index.php/SGXDbg#Integration_with_DRI.2FDRM_.28Xorg.29

    Also you would have seen Nick's update on other thread & also customer in below link have got their X apps with SGX acceleration working. The sgxdbg page also clearly shows the graphics SDK demos like ChameleonMan built & running with X , accelerated with SGX showing the PVRTune data/logs & cpu loading.

    http://e2e.ti.com/support/embedded/linux/f/354/t/133800.aspx

    I am also attaching the ftp instructions

    The ftp pickup directory 'xaroofoo' was created on 04/19/2012 12:45:01.
    The files from the dropoff area have been moved to the pickup directory and are available for 7 days.
    
    To retrieve the files from the pickup directory:
    
      1. Open an ftp session to ftppickup.ti.com.
             ftp ftppickup.ti.com
    
      2. Login with the userid 'pickup'.
             Name: pickup
    
      3. Enter the password.
             Password: piurh!
    
      4. Change directories to the pickup directory.
             ftp> cd /pub/share/xaroofoo
    
         Note: If you are using a graphical ftp client, you will not 
               see the hidden pickup directory name xaroofoo appear 
               in the file list.  You will need to use a manual 
               'Change Directory' or 'CD' command to change into the 
               dropoff directory.
    
      5. Set the file transfer mode to ascii or binary as necessary.
             ftp> bin
    
      6. Transfer the file.
             ftp> get <file>
    
      7. End the ftp session.
             ftp> quit
    
    The files can also be retrieved with the url:
    
      ftp://pickup@ftppickup.ti.com/pub/share/xaroofoo
    
    List of files in the pickup directory 'xaroofoo':
    Graphics_SDK_setuplinux_4_06_00_02_BinOnly.bin
    
    to download the alpha 04.06.00.02 release. This has the Xorg source tarball with the patches used for reference if required. The tarball is placed under targetfs/xorg_source directory of the graphics SDK.

    Thanks,

    Prathap.