Qt5 on TI platforms - Introduction

Introduction:

This short post covers the background of Qt5, architectural details, configuring for eglfs with TI SGX Graphics drivers, building, and known issues.

For Xcb builds, refer to the next post -

http://gpupowered.org/node/10

5.1 version (Alpha, Beta1) information is available at,

http://gpupowered.org/node/21

For Final Qt5 (Dec 2012) release update, refer to

http://gpupowered.org/node/16

For final Qt5 Webkit2 build, refer to

http://www.gpupowered.org/node/15

Qt5 Architecture:

http://labs.qt.nokia.com/wp-content/uploads/2011/05/Qt5.pdf

Qt5 and C++, moving from Qt4:

http://www.gpupowered.org/node/23

Qt5 differences with Qt4:

Qt4 (Qt-embedded) exposed the capabilities of HW in 2 ways - HW that can accelerate rendering of widget surfaces (QPainter operations), and HW that can accelerate screen updates (of QScreen). So if for example an OpenGLES engine was used to accelerate screen display operations (using for example -display powervr), the same engine could not be used for accelerating rendering operations. So essentially, 3D and 2D acceleration mechanisms could not co-exist.

Qt5 tries to eliminate this gap. With the platform plugin approach - the HW "platform" is expected to provide OpenGL ES2, and any other additional HW acceleration on top of that as part of the platform. In essence - with GLES2 - every screen update in Qt5 happens via an OpenGL ES texturing operation, rather than any other means. In addition to this fundamental change, Qt5 brings in another major programming model update - that of QML, Qt3D etc.

A key thing specific to our (SGX based) platforms - With the elimination of the display plugin, Qt5 no longer uses or supports blits via pvr2d or wsegl, and instead directly uses the egl (or window) capabilities exposed by the GL driver. This eliminates immediately a large portion of pvr2d/wsegl version related issues that cropped up in earlier Qt versions.
(ex patch for Qt4 in below link is not needed anymore)
https://github.com/prabindh/qt-configs/blob/master/qt4.8/001_wsegl2.patch

The below platform plugins are available in the Qt5 Alpha package. Only "eglfs" and "minimal" are built by default in qtbase.

cocoa eglfs linuxfb minimal openvglite platforms.pro qvfb windows
directfb kms openkode openwfd qnx xcb

Qt5 Alpha source package overview:

Qt5 contains the absolute minimum required functionality - in "qtbase" folder. All other additional components (including Qt3D) are split into separate folders. Below is the folder structure of Qt5 (Alpha package)

<>$ ls
build qtdeclarative qt.pro qtwayland
build.dependencies qtdoc qtquick1 qtwebkit
configure qtgraphicaleffects qtscript qtwebkit-examples-and-demos
configure.bat qtimageformats qtsensors qtwebkit.pri
gnuwin32 qtjsbackend qtsvg qtxmlpatterns
qt3d qtlocation qtsystems README
qtbase qtmultimedia qttools

Pre-requisites for Qt5 build:

- Qt5 alpha source package
http://releases.qt-project.org/qt5.0/alpha/

- TI Graphics SDK (4.05 or later)
http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsd...
http://processors.wiki.ti.com/index.php/AM35x-OMAP35x_Graphics_SDK_Getti...
- Recent filesystem (GCC 4.5 or later)
- ARM cross Toolchain (GCC 4.5 or later), example from below:
http://people.linaro.org/~michaelh/incoming/binaries/

Configuring Qt5:

Configuring Qt5 is fairly easy - and can be done without messing with creating new mkspecs, if the below are met:

- a linaro toolchain (linux-arm-gnueabi-)
- sgxconfiguro is used (package config for TI Graphics SDK - egl and x11)
https://github.com/prabindh/sgxconfiguro
- force-pkg-config is used

If this does not seem clear, the older tried-and-tested-method of specifying all possible (and needed) paths in the qmake.conf as below will also work :

https://github.com/prabindh/qt-configs/tree/master/qt5.0_mar2012

The below method adopts the first approach and uses the standard Qt5 supplied linux-arm-gnueabi-g++ mkspec without change

$cd qtbase
$export PATH=/opt/linaro/gcc-linaro-arm-linux-gnueabi-2012.03-20120326_linux/bin:/home/prabindh/work1/arm-qt5-tar/qt-everywhere-opensource-src-5.0.0/qtbase/bin:
$export PKG_CONFIG=./x86-cross-ubuntu-pkg-config
$./configure -prefix /home1/prabu/qt5_install -release -make libs -xplatform linux-arm-gnueabi-g++ -opengl es2 -confirm-license -opensource -no-xcb -no-wayland -force-pkg-config -make examples -make demos -verbose

From the logs, configure should have detected the below functionality - key are NEON, OpenGL, and EGLFS support

Debug .................. no
QtDBus module .......... no
QtConcurrent code ...... yes
QtGui module ........... yes
QtWidgets module ....... yes
JavaScriptCore JIT ..... To be decided by JavaScriptCore
Declarative debugging ...yes
STL support ............ yes
PCH support ............ yes
iWMMXt support ......... no
NEON support ........... yes
IPv6 ifname support .... yes
getaddrinfo support .... yes
getifaddrs support ..... yes
Accessibility .......... yes
NIS support ............ yes
CUPS support ........... no
Iconv support .......... yes
Glib support ........... yes
GStreamer support ...... no
PulseAudio support ..... no
Large File support ..... yes
GIF support ............ plugin
JPEG support ........... plugin (qt)
PNG support ............ yes (qt)
zlib support ........... yes
Session management ..... auto
libudev support ........ no
OpenGL support ......... yes (OpenGL ES 2.x)
OpenVG support ......... no
XShape support ......... auto
XVideo support ......... auto
XSync support .......... auto
Xinerama support ....... runtime
Xcursor support ........ runtime
Xfixes support ......... runtime
Xrandr support ......... runtime
Xi support ............. runtime
MIT-SHM support ........ auto
FontConfig support ..... auto
XKB Support ............ auto
immodule support ....... yes
GTK theme support ...... auto
SQLite support ......... plugin (qt)
OpenSSL support ........ no
Alsa support ........... no
libICU support ......... no
PCRE support ........... qt
Xcb support ............ no
Xrender support ........ no
EGLFS support .......... yes

After configure, make && make install are to be done. This is important, as qmake needs to be in the install path.

Note: QtWebkit requires ICU support to be present. Refer QtWebkit build page mentioned earlier in the post.

Steps to build Qt3D :

To build Qt3D, in addition to qtbase also need to build the below:

qtjsbackend (has v8)
qtdeclarative
qt3d

To build the above, enter the directory, then perform (assuming qmake is in the path as specified earlier)
$ qmake && make && make install

Checking the build output:

As a result of the build, the QtCore libraries, QtGui etc are all built. Also, the "eglfs" and "minimal" platform plugins are built by default. Note that "eglfs" draws onscreen using egl, while "minimal" draws to an offscreen pixmap image.

Example precompiled binary of Qt5:

A set of binaries built from above approach is provided below. To use this in the target filesystem, copy the below archive into /home1/prabu/ (Qt expects the same path while executing). Any filesystem with a recent enough libc (from >= gcc4.5) should be sufficient.

https://gforge.ti.com/gf/download/docmanfileversion/296/5515/qt5_install...

Screen captures of live demos on 3730:

Pictures and videos are posted at,

Flickr link http://www.flickr.com/photos/71344617@N02/sets/72157629396050260/

Executing demos on target:

After installing the above build on to target, there are several changes from the point of view of Qt4 users, for getting the demos to work.

1) Configure resolution of the screen for Qt

If screen resolution is 16 bpp (RGB565)
export QT_QPA_EGLFS_DEPTH=16

edit:
If screen resolution is 24 bpp (RGB888)
export QT_QPA_EGLFS_DEPTH=24

If this step is not performed, any application running on eglfs platform will abort, with a message as below:

"Initialized display 1 4
Cant find EGLConfig, returning null config
Could not create the egl surface: error = 0x3005"
Abort

2) Ensure SGX drivers are installed, and standard GLES2 3D demos are functional without Qt

3) There is no need anymore to set /etc/powervr.ini to QWS library (no such library exists in Qt5) making it simpler to run. Qt5 works with both FRONT and FLIP modes (as of Qt5 Alpha) with "eglfs".

4) Running QML demos:

QMLScene can be used to run QML demos, with a command similar to below:
/bin/qmlscene examples/qtdeclarative/qtquick/animation/pathanimation/pathanimation.qml -platform eglfs

5) Running standalone demos:

Standalone qt5 demos (including qt3d demos, as well as classic qtbase demos like animatedtiles) can be invoked as below for eglfs platform plugin

-platform eglfs

Note that applications using eglfs platform will not have any window decorations and will show full screen only.

Tslib support:

Apply this patch - https://github.com/prabindh/qt-configs/blob/master/qt5_1.0_Feb13/tslib.p... - refer to http://tigraphics.blogspot.in/2013/03/correct-tslib-operation-with-qt5-o... for correct usage.

tslib (or other input plugins) is NOT built by default, need to do below steps (ensure tslib.h is present in standard /usr/include folders)

cd qtbase/src/plugins/generic/tslib
make && make install

The above step will generate and install "libqlinuxinputplugin.so" into plugins folder which will be detected by Qt5. The tslib plugin is invoked as below:

-platform eglfs -plugin Tslib

For other input devices (udev based), evdev* projects need to be built, and are present in the qtbase/src/plugins/generic/ folder.

Cursor support:

With above configuration with eglfs, cursor will not be shown on screen. TODO.

Screen Rotation support:

TODO

CPU Loading:

With pageflick qt3d demo, CPU loading is < 10% on 3730 for VGA LCD screen, with eglfs

With flickr3d qt3d demo, CPU loading is upto 50% on 3730 for VGA LCD screen, with eglfs

Notes:

- Qt5 documentation for the APIs still need to be updated. All Qt5 docs ex, below are misleading (they point to Qtembedded docs)
http://doc.qt.nokia.com/qt5/qt-embedded-pointer.html

Below are some of the messages appearing on serial terminal (yet to be debugged further)

"Could not create context for swap behavior 2"

"Old plugin format found in lib /home1/prabu/qt5_install/imports/Qt3D/libqthreed..."

"QObject::connect: Cannot connect (null)::beforeRendering() to Viewport::object"

"QOpenGLBuffer::map(): pending implementation"

"No option to clear stereo buffers"

========
Prabindh Sundareson, 2012