Building Qt with OpenGL ES accelerated by SGX

From Texas Instruments Wiki
Jump to: navigation, search


Content is no longer maintained and is being kept for reference only!



Please note that this page is under construction and subject to change. Please wait following this wiki until this page is finalized and this message is removed.

This page is a part of wiki article "Building Qt" wiki page. Do not start using this page directly.

About

This page is made with a motivation to guide the users of TI Processors to build Qt Embedded SDK with OpenGL ES 1.x/2.x (3D Graphics) support accelerated by the SGX - 3D Graphics Hardware present on the TI chip.

  • To Build Qt Embedded without OpenGL ES support, please follow the procedure at this link
  • Please refer to this page for an overview of using QtQuick feature introduced in Qt 4.7


Versions Tested

  • PSP-SDK: 03.00.01.06
  • GFX SDK: 3.01.00.06


Prerequisites

Useful Links

 Please refer to this link


PSP Linux Kernel

The latest PSP Linux Kernel should be compiled and tested on the EVM.

Test: The EVM board boots up and loads the filesystem without any problem


Graphics SDK

  • It should be compiled against the kernel being used on the target EVM
  • The compiled libraries should be installed in the filesystem to be used on EVM
  • We will call the directory path in which Graphics SDK on host system is installed as $SGX_SDK_ ROOT
  • We will need to export the $SGX_SDK_ ROOT in qmake.conf  (please refer "Step 2" of Building Qt with OpenGL ES below)

Test: The 3D Graphics Demo located on your target filesystem (/opt/gfxsdkdemos/ogles/) like OGLESChameleonMan, OGLESEvilSkull, OGLESCoverflow etc should run without any errors


File System

The user will need to have a copy of the filesystem to be used on target installed on the host machine. The copy of the filesystem on the host machines should have the Graphics SDK libraries installed in it.

  • We will call the directory path in which the filesystem is installed on host system as $FILESYSTEM_INSTALL_ROOT

Test: The EVM board boots up and loads the filesystem without any problems. No problem in running the 3D Graphics Demo as mentioned above in Graphics SDK - Test.


Tslib

Source Download - http://prdownload.berlios.de/tslib/tslib-1.0.tar.bz2

About:

Tslib is an abstraction layer for touchscreen panel events, as well as a filter stack for the manipulation of those events. It was created by Russell King, of arm.linux.org.uk. Tslib is generally used on embedded devices to provide a common user space interface to touchscreen functionality.

  • This is optional
  • We will call the directory path in which the above package is installed on host system as $TSLIB_INSTALL_DIR
  • You will need to export the host system's directory path of tslib.h and libts.so respectively in TSLIB_INCDIR and TSLIB_LIBDIR in qmake.conf. (please refer "Step 2" of Building Qt with OpenGL ES below)
  • You will also need to append "qt-mouse-tslib" in the configure of the Qt Embedded (mentioned in Step 3 of Building Qt with OpenGL ES)

Tslib files paths:

tslib.h: $TSLIB_INSTALL_DIR/tslib-1.0/src

libts.so: $FILESYSTEM_INSTALL_ROOT/usr/lib/

  • you will need to create a softlink of libts-1.0.so.0 as libts.so as follows:
Host $ cd $FILESYSTEM_INSTALL_ROOT

Host $ cd usr/lib

Host $ ln -s libts-1.0.so.0 libts.so 



Qt Embedded Source

The user will need to download the latest Qt embedded source code on his host machine which is being used to build Qt.

  • We will call the directory path in which the Qt embedded source is installed on host system as $QT_INSTALL_DIR


PATH

  • Please export the codesourcery toolchain version cs2009q1 or higher in your path
Host $ export TOOLCHAIN_INSTALL_ROOT=/path/to/toolchain_install_root

Host $ export PATH=$PATH:$TOOLCHAIN_INSTALL_ROOT/bin

Test: Execute the commands below and confirm that "g++" being used is from the gcc of the host machine and "arm-none-linux-gnueabi-g++" being used matches the recommeded code sourcery toolchain version from the GFX-SDK guide for the GFX-SDK being used.

Host $ g++ --version

Host $ arm-none-linux-gnueabi-g++ --version
 

Note: For any problems in any of the prerequisites above. Please refer to Useful links above or post your questions on e2e.ti.com


Building Qt with OpenGL ES

You can follow these steps to build Qt with OpenGL ES support for any ARM Cortex-A8 based TI Processor.

Step 1:

It is assumed that you have satisfied all the prerequisites as mentioned above.


Step 2:

    - This tarball has the qmake.conf needed to configure Qt Embedded with OpenGL ES accelerated by SGX

    - The parent folder is named as linux-TIarmv7-sgx-g++ and this name will be used in configure below for "-xplatform"

  • Copy it to $QT_INSTALL_DIR/mkspecs/qws/
Host $ cp linux-TIarmv7-sgx-g++.tar.gz $QT_INSTALL_DIR/mkspecs/qws/
  • untar it in same directory:
Host $ cd $QT_INSTALL_DIR/mkspecs/qws/
Host $ tar xzvf linux-TIarmv7-sgx-g++.tar.gz
  • Modify the following variables in qmake.conf under $QT_INSTALL_DIR/mkspecs/qws/linux-TIarmv7-sgx-g++/qmake.conf
SGX_SDK_ROOT = /directory/path/to/Graphics/SDK/on/host

Optional: For touchscreen support in Qt Embedded using tslib library (Note: You will need to fulfull the tslib pre-requisites as mentioned above)

TSLIB_INCDIR = $TSLIB_INSTALL_DIR/tslib-1.0/src

TSLIB_LIBDIR = $FILESYSTEM_INSTALL_ROOT/usr/lib/


(Refer to Glossary and/or prerequisites above for more information on setting these variables)


Step 3:

  • If you are using Graphics SDK 4.04.00.02+, copy the WSEGL2 patch  to Qt directory on host and apply the patch
Host $ cd $QT_INSTALL_DIR


Host $ patch -p1 < 0001-wsegl2-support.patch

Step 4:

  • The command below will list all the configure feature options available in Qt. You can configure the features supported in Qt Embedded depending on your Application's requirement
Host $ cd $QT_INSTALL_DIR

Host $ ./configure --help 


  • Sample Configure for Qt embedded:
Host $ ./configure -prefix <QT_SDK_INSTALL_DIR> -embedded arm -platform qws/linux-x86-g++ -xplatform qws/linux-TIarmv7-sgx-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-linuxtp 
-qt-mouse-linuxinput -plugin-mouse-linuxtp -plugin-mouse-pc -fast -opengl es2 -qt-gfx-transformed -qt-gfx-vnc -qt-gfx-linuxfb -qt-gfx-multiscreen 
-qt-mouse-tslib -plugin-gfx-powervr -D QT_NO_QWS_CURSOR -D QT_QWS_CLIENTBLIT 

Note:

  • "-prefix" option in the configure above points to the path where you want to install the Qt SDK on target
  • "-platform qws/linux-x86-g++ in configure above assumes your host machine CPU to be of 32-bit. For 64-bit, use "-platform qws/linux-x86_64-g++"
  • -xplatform qws/linux-TIarmv7-sgx-g++ is the folder path of qmake.conf to be used to configure Qt Embedded relative to "$QT_INSTALL_DIR/mkspecs/"
  • "-opengl es2" configure Qt Embedded with OpenGL ES 2.x option please use "opengl es1" to configure Qt Embedded with OpenGL ES 1.x option. Only one option can enabled at a time.
  • Optional: If you don't need touchscreen support,  remove "-qt-mouse-tslib" from the configure command above. In addition, remove "-lts" from the qmake.conf. You will need to satisfy the pre-requisties mentioned above to enable touchscreen support.


Step 5:

Host $ make

Host $ make install 
  • A parallel build with make can be invoked using the -j flag e.g "make -j 8"
  • Installs the Qt SDK at the location $QT_SDK_INSTALL_DIR defined in -prefix


Step 6:

Copy the Qt SDK library to the Target Filesystem


Running the Qt Application

  • To run Qt examples & demos, you will need to copy/install the Qt SDK libraries to the target filesystem and bring up the Target EVM
  • For the commands below, I have installed my Qt SDK libraries to the path: /opt/qt-embedded on my Target Filesystem
Target # export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib:/opt/qt-embedded/lib
  • If you need to enable the LCD touch screen then refer the steps below:
Target # export TSLIB_TSDEVICE=/dev/input/touchscreen0
Target # export QWS_MOUSE_PROTO=Tslib:/dev/input/touchscreen0

  • Before running OpenGL-based Qt apps on OMAP35x, you must create a powervr.ini file. To do this, execute the following commands on the running target:
cat > /etc/powervr.ini << _EOF
[default]
WindowSystem=libpvrQWSWSEGL.so
_EOF
  • Running a demo:
Target # cd /opt/qt-embedded/examples/opengl
Target # cd textures
Target # ./textures -qws -display powervr

You can see the output either on the lcd or dvi output depending on how you configured your target board to output. For more info on that please refer http://processors.wiki.ti.com/index.php?title=Building_Qt#Setting_up_Target_before_Qt_Build


Compiling your Qt Applications

  • Export the toolchain as mentioned in "PATH" under prerequisites above
  • Export the "qmake" found under $QT_SDK_INSTALL_DIR/bin/qmake
Host $ export PATH= $PATH:$QT_SDK_INSTALL_DIR/bin/qmake
  • cd /path/to/Qt/Application/source
Host $ qmake -project
Host $ qmake -spec qws/linux-TIarmv7-g++ (Please see the Note below)
Host $ make

Note: 

- The value for -spec is the folder path of qmake.conf relative to "$QT_INSTALL_DIR/mkspecs/" used to configure Qt Embedded. The value is same as the one used for "-xplatform" in the configure above.

e.g. In the case above, if the qmake.conf is present at "$QT_INSTALL_DIR/mkspecs/qws/linux-TIarmv7-g++" then the variable used will be "-spec qws/linux-TIarmv7-g++"

  • Copy the application executable to the Target EVM's filesystem
  • Run the application as mentioned above

Back to Main Page


Glossary/Acronyms

  • The following variables are used in the wiki article. You will need to substitute the actual directory paths of respective variables as explained below while building Qt instead of the "$VARIABLE"


Host Machine Workstation to be used to build/compile Qt
SGX_SDK_ ROOT (Host ) Directory Path of Graphics SDK
FILESYSTEM_INSTALL_ROOT (Host) Directory Path of copy of Target Filesystem
TSLIB_INSTALL_DIR (Host) Directory Path of the Tslib src package
TSLIB_INCDIR (Host) Directory Path of tslib.h:

$TSLIB_INSTALL_DIR/tslib-1.0/src

TSLIB_LIBDIR (Host) Directory path of libts.so:

FILESYSTEM_INSTALL_ROOT/usr/lib/

QT_INSTALL_DIR (Host) Directory Path of Qt Embedded source
TOOLCHAIN_INSTALL_ROOT (Host) Directory Path of code sourcery toolchain

Qt SDK 

It is generated off the compile/build of Qt Embedded source. This generated SDK will be used to develop & build the Qt Applications. You will need to copy the libraries from this Qt SDK to the Target filesystem to run the Qt Applications
QT_SDK_INSTALL_DIR (Host) Directory Path where Qt SDK will be installed by "make install"
Target EVM EVM consisting of the TI chip for which the Qt SDK & the Qt Application was compiled


Command prompts in this guide

Commands are preceded by prompts that indicate the environment where the command is to be typed. For example:

host $
Indicates command to be typed into the shell window of the host Linux workstation.
target #
Indicates commands to be typed into the Linux shell in the terminal window connected to the EVM board's serial port.