NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Qt Tips

From Texas Instruments Wiki
Jump to: navigation, search

A collection of tips & tricks for using Qt on embedded systems. They are usually tested on a TI SoC such as AM35/AM37x, DM816x, etc.

Enabling SGX PowerVR Acceleration[edit]

SGX PowerVR OpenGLES acceleration for Qt is available as a plugin graphics driver in Qt. This needs to be enabled both during Qt configuration and Qt application execution. The EZSDK 5.03 released in 4Q11 has out of box support for OpenGLES acceleration in Qt.

If you are using an older SDK release, please refer to Building Qt with OpenGLES acceleration wiki page for building Qt with OpenGLES.

Configuring the SGX PowerVR to recognize QWS EGL
[edit]

The default WindowSystem for SGX is set to front mode or flip mode. To enable OpenGLES acceleration for a specific Qt application, add the exact binary name to /etc/powervr.ini as follows:

# cat >> /etc/powervr.ini << _EOF

[hellogl_es2]
WindowSystem=libpvrQWSWSEGL.so.1

[animatedtiles]
WindowSystem=libpvrQWSWSEGL.so.1
_EOF

Runing Qt applications with OpenGLES acceleration
[edit]

To verify Qt is indeed accelerated by OpenGLES, run the hellogl_es2 application on the target.

# cd /usr/bin/qtopia/examples/opengl/hellogl_es2

# ./hellogl_es2 -qws -display powervr

If the application runs correctly, you should see both a 3D Qt logo rendered by SGX via OpenGLES over which 2D bubbles are painted by the Raster Paint Engine.

This acceleration is applicable not only for QGLWidget based applications. Other Qt applications using QWidgets can also be accelerated by adding "-display powervr" while launching as follows:

# cd /usr/bin/qtopia/examples/animation/animatedtiles

# ./animatedtiles -qws -display powervr

Note:

  1. The acceleration is not applicable for all 2D painting paths. It' applies mainly to blending and blitting as implemented in PVR2D interface
  2. The acceleration has been verified only when one Qt application is running at a time. QWS client-server scenarios have not been verified

Using Multiple Displays
[edit]

High end SoCs support multiple display connectivity options such as HDMI, component, composite. In addition, each interface could have multiple instances. With such devices, it would be possible to connect multiple TVs and drive them individually.

Qt-embedded uses /dev/fb0 as the default framebuffer. To redirect the output to a different display with framebuffer /dev/fb1, do the following:

# ./deform -qws -display LinuxFb:/dev/fb1

You can associate one Qt application per display and run them separately as follows:

# ./affine -qws -display LinuxFb:/dev/fb0 &
# ./deform -qws -display LinuxFb:/dev/fb1

The Qt Window System supports a Multi Screen driver - QMultiScreen. With this driver, you can display the same output on both the TVs. The command below runs the deform demo and writes the same image onto both the framebuffers.

# ./deform -qws -display "Multi: LinuxFb:/dev/fb0 LinuxFb:/dev/fb1"

The examples above could be extended for multiple displays.

Using Virtual Display[edit]

This requires that Qt was configured with the option '-plugin-gfx-vnc'. Now start any Qt application as follows:

#./deform -qws -display "VNC"

Then connect a remote VNCviewer to your target (of course you need to know the IP address of the target in that case).

You may also use the default display and VNC at the same time:

#./deform -qws -display "VNC:LinuxFb"

Alternatively you can set the display using an environment variable before starting Qt.

#export QWS_DISPLAY="VNC" 
#export QWS_SIZE="1920x1080"

And yes, you can get real big displays on OMAP3 that way...

Touchscreen Support[edit]

If you have a screen supporting touch you need to follow below steps to make this available to your Qt applications.

Make sure you have Tslib installed to your platform. This will provide basic touchscreen support for a couple of devices. We have tested with the TSC2046 that is used on the TI/Mistral OMAP3 EVM for example.

Add dependencies to your mkspec gmake.conf accordingly:

#modifications to include ts-lib
QMAKE_INCDIR           += /home/omap3/hd/workdir/filesys/usr/share/include
QMAKE_LIBDIR           += /home/omap3/hd/workdir/filesys/lib 

Run Qt configure again with option 'qt-mouse-tslib' (touch as primary mouse device) or '--plugin-mouse-tslib' (touch as optional mouse device). Now recompile Qt base libs.

Finally you need to modify your target environment with the following variables (path and device names are examples):

QWS_MOUSE_PROTO='Tslib:/dev/input/event1'
TSLIB_CALIBFILE='/etc/pointercal'
TSLIB_CONFFILE='/etc/ts.conf'
TSLIB_CONSOLEDEVICE='none'
TSLIB_FBDEVICE='/dev/fb0'
TSLIB_PLUGINDIR='/lib/ts'
TSLIB_TSDEVICE='/dev/input/event1'

You may have to call 'ts_calibrate' once to get your touch screen calibrated. Redo this if you change the rotation or screen size configuration.

QWT[edit]

QWT (http://qwt.sourceforge.net/) is a useful extension to Qt. To avoid linker issues use the define QWT_DLL when linking a QWT DLL.

Using an USB Keyboard[edit]

If you find that an USB Keyboard is not being detected by QT, then you will need to export QWS_KEYBOARD to point to the input devnode. E.g if the USB Keyboard shows up on /dev/input/event1, then run the following

target $ export QWS_KEYBOARD="USB:/dev/input/event1"
target $ ./<your-qt-application>

Performance Tips[edit]

Do’s[edit]

  • Use QStaticText for mostly static text items (50% performance impact compared to QText !!) - needs Qt 4.7
  • Analyse widget “rendering” performance separately from “screen blitting” performance using “livemem” plugin
  • Pre-render large VG images to a bitmap - use optimised class QSvgNativeItem till issue is resolved (reduces CPU load by ~30%)
  • Ensure CPU load for UI operations is < 25-40 %

Don’t’s[edit]

  • Do not keep changing large background images
  • If using QGraphicsView, do not update all items. Update only when needed and in specific locations
  • Avoid Animation in QGraphicsView especially for large images, use optimised classes

References[edit]

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

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Qt Tips here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Qt Tips here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Qt Tips here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Qt Tips here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Qt Tips here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Qt Tips here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Qt Tips here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Qt Tips here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Qt Tips here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity