SlideShare a Scribd company logo
Developing Qt applications on HawkBoard Prabindh Sundareson [email_address] July 2010
Agenda Qt Introduction Quick history, Licensing model Fundamental concepts Typical application software stack Qt application classes Qt Graphics View framework Signal/Slot mechanism Configuring and Building Qt Tools Qt Creator Introduction to XgxPerf – TI Graphics Toolkit Developing a Qt application in 2 minutes with XgxPerf (Demo) Qt Development – Tips for performance Qt vs Android vs Silverlight vs Flash Conclusion & QnA
Qt History Started as an offering from Trolltech Trolltech is now part of Nokia Qt framework is available in source form, with multiple support options Works on Linux framebuffer, WinCE, X, Windows, even on Android Continuously evolving, now at 4.7.x (Beta)
Qt Licensing Model Commercial LGPL v. 2.1 GPL v. 3 License Cost License fee charged No cost No cost Must provide source code for changes to Qt No, modifications can be closed Source code must be provided Source code must be provided Can create proprietary application Yes—no obligation to disclose source code Yes, if dynamically linked to Qt library No, application is subject to the GPL Support Yes, with valid maintenance agreement Not included, available separately Not included, available separately Charge for Runtimes Yes—in some instances* No, distribution is royalty free No, distribution is royalty free
The Qt Framework FB Cairo Qt API (Linux / WinCE) DirectFB Surface Managers X Window System/Mgrs Application Framework HW Device Tslib, Mouse GWES Input Device Manager Qt/e Qt/X XgxPerf GDI DDr a w Win32/ Windowing System
Typical Application Components Feedback to  User (GUI) Application Event  Handler(s) Application  Event Loop Environment Input Events Output  Changes Sensor User  Input Events Mouse/ts Ex. Increase speed by calling driver interface ioctl Qt
Qt - HawkBoard Qt relies on Linux frame buffer driver provided by HawkBoard linux package The frame buffer interface controls what resolutions are supported by Qt Maximum resolution supported on HawkBoard 640 x 480, 16 bpp Qt/embedded always outputs to full screen QWS is a simple window system for Qt/e Qt also works with X on Linux Touch screen, and Mouse/Keyboard supported
Qt Application Classes
Steps for Creating Qt based UI Build Qt for target, using provided Qt cross compile options Design the UI in Qt Designer Add necessary event handlers in CPP file Add necessary application level code Ex, Timers, Network stacks, Motor control, … Create .PRO project file Build, install to target Debug directly on target for peripheral accesses
Qt – App Development with GraphicsView #include “automation.h” void AutomationApp::Init() { … /* Create a new sample widget that shows a text within a information box – see  automation library in xgxperf */   pValveText1 = new InfoBoxClass(0,QRectF(260,290,20,20),&quot;1.1&quot;); /* Add the item to the Graphics scene and make it visible on screen – Note that the GraphicsView was already created for us by the framework in xgxperf */   m_scene->addItem(pValveText1); /* Add the item to a current list, for book-keeping during exit */   workItemList << pValveText1; … }
Basics of Qt - Widgets
Basics of Qt - Widgets Qt UI framework is based on widgets Widgets respond to UI events (key presses/mouse movements), and update their screen area Each widget has a parent, that affects its behaviour, and is embedded into it Can create “complex” shapes using masks See Automation Classes in Xgxperf Most Qt classes are derived from QWidget Ex, QGLWidget, QPushbutton … QPushButton * myButton = new QPushButton(…); myButton->doSomethingAPI(); Refer to online documentation at  http://doc.qt.nokia.com/4.6/qwidget.html Tip – Documentation is arranged using class names.
QGraphicsView Provides a “Canvas” for adding items (QGraphicsItems) The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene By default, QGraphicsView provides a regular QWidget for the viewport widget.  Can replace default by calling setViewport() with another widget type Provides a way to build an UI in an “actual” drawing canvas Ex, concept of “z-depth” of a QGraphicsItem
Qt - Signals/ Slots Signal / Slot mechanism provides a functionality similar to setting up “function pointers” Provides better type checking, amongst others Example Use-case: Perform blocking/ time consuming activities in separate thread Use paintEvent() to trigger/consume the result of actions happening in parallel (ex. Upload next video frame) How to communicate events ? Use SIGNAL/SLOT to communicate event completions Usage example for Signal/Slots: “ browserlib” app in xgxperf Found in /Xgxperf/browserlib/ browserlib.cpp
Using SIGNAL/SLOT Class myClass: public QThread { Q_OBJECT  /* Needed for signal/slot mechanism to work at runtime */ Public:  … signals:   void function1(const QImage &image, double scaleFactor); }; In thread code, emit function1(image, scaleFactor); In Main application, define the actual function:: void myWidget::mainWidgetFunction(const QImage &image, double scaleFactor){} … And connect the signal and slot: connect(&thread, SIGNAL(mainWidgetFunction(const QImage &, double)),  this, SLOT(function1(const QImage &, double)));
QPainter Low level painting API, for overriding default painting behaviour of widgets Handles Text and other Drawing primitives (very flexible API) Can perform operations that the Widget/other Class APIs do not expose (ex, create a circular window) Usage modes Subclass QWidget, and handle Paint event void paintEvent(QPaintEvent *event) QPainter can be accessed only within a paint event Usage example: “ automation” app in xgxperf
Qt – Classes for UI development Canvas QGraphicsView, QGraphicsScene Text QStaticText, QString, QGraphicsTextItem Icons QSvgWidget, QGraphicsSvgItem, QLabel Animations QPropertyAnimation 3D QGLWidget (not on Hawkbrd) Bitmap loading QPainter QPixmap, QImage
Setting up and building Qt Documented in detail for non-OpenEmbedded users at, http://processors.wiki.ti.com/index.php/Building_Qt Angstrom (OpenEmbedded based) distribution has Qt package for Hawkboard A configurable pre-built filesystem with Qt integrated, and kernel image for Hawkboard can be downloaded from  http://www.angstrom-distribution.org/narcissus/ Select “hawkboard” machine type from pull-down menu Select “Qt” – embedded or X11 based on desktop environment in addition application selection option
Debugging and Profiling Qt Applications Use Qt Creator, an integrated designer/debugger Latest version is 1.3 http://qt.nokia.com/downloads Needs GDB on Linux, and CDB for PC But usually much easier to just do  qDebug() << “printed from here”;  To get output on terminal and trace code flow Angstrom package provides oprofile to profile application code Use Xgxperf to benchmark at specific fps
Qt Creator Used to create a new form design Output saved as a .UI file (text format) This can be imported into the Qt application via Qt classes
Creating a Widget (old screenshot)
Using .UI files Qt Creator generates -> .UI file Steps to create application from .UI file: Add .ui file to project using .PRO entry Subclass Ui:: in application Ex, see “vslib” application in Xgxperf /xgxperf/vslib/vslib.cpp class VSApp : public ApplicationBase, private Ui::MainWindow Use “setupUi”   call directly –  setupUi(this);
Integrating .UI files TEMPLATE = lib SOURCES = vslib.cpp export.cpp HEADERS = ../applicationmanager/common/applicationbase.h vslib.h FORMS = mainwindow.ui RESOURCES = resource.qrc VSApp::VSApp(QWidget* parent, QRectF inSceneRect,  QGraphicsScene *scene,  void* data):  ApplicationBase(parent, inSceneRect,scene,data) { //Store the test data locally m_widgetTestInStruct = (TestTargetParamsStruct*)data;  currTimerCount = 0; setupUi( this);  } c lass VSApp : public ApplicationBase, private Ui::MainWindow Location - Xgxperf/vslib .pro .cpp .h
XgxPerf Xgxperf is a collection of ready made examples, and classes for different end use-cases Industrial automation, Medical, Automotive displays, 3D, Sewing Machine, Surveillance,.. Uses QGraphicsView Configurable input parameters for UI components Provides profile output for UI startup time and CPU load Additionally, includes “livemem”, an off-screen display plugin for Qt/e (writes Qt’s display rendering outputs to image file) Useful for analysing widget rendering performance independent of display driver performance And for remote debugging/ archival Additionally, includes “sgxperf”, a 3D benchmarking tool, for SGX based devices like the AM35x/37x families XgxPerf TI application note –  Will be available in TI website in September 2010 – TI Application Note #  SPRABF4 Draft version available at <  this link  > now External Wiki page on Xgxperf http://processors.wiki.ti.com/index.php/Xgxperf
XgxPerf Usage SVN access: svn checkout  http:// gforge.ti.com/svn/gleslayer Username = anonymous, password=  (blank) (or) Download and extract source tarball Non-OpenEmbedded users https://gforge.ti.com/gf/download/docmanfileversion/192/3696/xgxperf_1.1.0.tar.gz   (check SVN for latest) Update path of framework (ex. QTDIR =) in Rules.make Build - “make && make install” Open Embedded-users For Angstrom setup, use the recipes for Angstrom at https://gforge.ti.com/gf/download/docmanfileversion/195/3699/ti-xgxperf.tar   Build any image that provides Qt - X11 or Qt – Embedded package Choose the appropriate Xgxperf recipe: ti-xgxperf-qt-x11 for X11 build, or ti-xgxperf-qt-embedded. X11 build is shown below. Q^oe] sh oebb.sh bitbake ti-xgxperf-qt-x11 Q^oe] ls -l build/tmp-angstrom_2008_1/deploy/glibc/ipk/armv7a/ti-xgxperf-qt-x11_1.0.0.0-r0+svnr54.5_armv7a.ipk -rw-r--r-- 1 prabindh prabindh 4873428 2010-07-19 20:18 build/tmp-angstrom_2008_1/deploy/glibc/ipk/armv7a/ti-xgxperf-qt-x11_1.0.0.0-r0+svnr54.5_armv7a.ipk XgxPerf is now ready to use on local HW EVM ./xgxperf_app [–qws] <cookie> <fps> …
Pre-configured applications Test 0 - Industrial Automation blocks (Turbines, Boilers, Pipes, Text Info classes) Test 1 – Text + Pictures (PNG/VG/Colors) Test 2 – Involves GLWidget, needs powervr (not on HawkBoard) Test 3 – Webkit Browser Test 4 – Automotive Tacho Test 5 – Medical ECG Monitor Test 6 – Video Surveillance  camera feed Monitor Test 7 – Sewing Machine UI
XgxPerf Inputs Configurable GUI creation input parameters: Number/type of elements Size of elements Target FPS Text Pictures (PNG, SVG, Colour fills) Effects and animations 3D GL parameters Creates HTML/XML outputs with profile info
2 minute  Qt Application Development  [live demo] Create new Xgxperf subproject from template Add items Build project Use xgxperf_app to invoke “ ./xgxperf_app –qws <args>”
Qt Development Tips Do’s 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/ other bitmaps when animating, 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 Do not keep changing large background images Do not update all items. Update only when needed and in specific locations Avoid Animation in QGraphicsView especially for large images, use optimised classes
Qt vs Android vs Silverlight
Next Steps Download Qt (Nokia), Xgxperf (TI) toolkits Configure, build, extend applications using Xgxperf on HawkBoard Use xgxperf as starting point Integrate drivers/ real-time apps to Qt
Links Qt download ftp:// ftp.qt.nokia.com /qt/source/ Qt configure and build http:// processors.wiki.ti.com/index.php/Building_Qt TI XgxPerf at Gforge (OE recipes, tar.gz code, documentation, latest updates via SVN) https:// gforge.ti.com/gf/project/gleslayer / Qt Animation with Graphics View on 4.7 http://www.slideshare.net/qtbynokia/special-effects-with-qt-graphics-view TI Graphics Blog and updates http:// tigraphics.blogspot.com TI OMAP3 Graphics SDK (CortexA8/3D engine) http://processors.wiki.ti.com/index.php/OMAP35x_Graphics_SDK_Getting_Started_Guide Hawkboard web -  http:// www.HawkBoard.org Hawkboard discussions -  http:// groups.google.com/group/hawkboard TI opensource projects -  http:// designsomething.org / Beagleboard (CortexA8) -  http:// www.BeagleBoard.org
Q&A
THANK YOU

More Related Content

PDF
IEEE - Consumer Electronics Trends Opportunities (2015)
PDF
Technology, Innovation - A Perspective
PPTX
Machine learning meets embedded development
 
PDF
Visualizing the engineering project lifecycle - Unite Copenhagen
PDF
jyotsna-jha-02years
PDF
Provat_Biswas_CV
PPT
ARM Linux Embedded memory protection techniques
PPT
Qt Programming on TI Processors
IEEE - Consumer Electronics Trends Opportunities (2015)
Technology, Innovation - A Perspective
Machine learning meets embedded development
 
Visualizing the engineering project lifecycle - Unite Copenhagen
jyotsna-jha-02years
Provat_Biswas_CV
ARM Linux Embedded memory protection techniques
Qt Programming on TI Processors

Similar to Developing and Benchmarking Qt applications on Hawkboard with Xgxperf (20)

PDF
Necessitas - Qt on Android - from FSCONS 2011
PPT
Qt Technical Presentation
ODP
Cross Platform Qt
PPTX
Intro to gui, cross platform and qt
ODP
Qt 5 - C++ and Widgets
PPTX
Building Cross-Platform Apps using Qt and Qyoto
ODP
Qt Workshop
PPT
Qt S60 Technical Presentation Fn Stripped
PPT
Qt for S60
PPTX
Introduction to Qt
PDF
QtQuick Day 1
PDF
Meet Qt 6.0
 
PPTX
Qt for beginners part 1 overview and key concepts
 
PPT
cpp-2013 #18 Qt Part 2
PDF
下午3 intel fenghaitao_mee_go api and application development
PDF
Cutest technology of them all - Forum Nokia Qt Webinar December 2009
PDF
QT 프로그래밍 기초(basic of QT programming tutorial)
PDF
Qt Application Programming with C++ - Part 1
PDF
Optimizing Performance in Qt-Based Applications
Necessitas - Qt on Android - from FSCONS 2011
Qt Technical Presentation
Cross Platform Qt
Intro to gui, cross platform and qt
Qt 5 - C++ and Widgets
Building Cross-Platform Apps using Qt and Qyoto
Qt Workshop
Qt S60 Technical Presentation Fn Stripped
Qt for S60
Introduction to Qt
QtQuick Day 1
Meet Qt 6.0
 
Qt for beginners part 1 overview and key concepts
 
cpp-2013 #18 Qt Part 2
下午3 intel fenghaitao_mee_go api and application development
Cutest technology of them all - Forum Nokia Qt Webinar December 2009
QT 프로그래밍 기초(basic of QT programming tutorial)
Qt Application Programming with C++ - Part 1
Optimizing Performance in Qt-Based Applications
Ad

More from Prabindh Sundareson (20)

PDF
Synthetic Data and Graphics Techniques in Robotics
PDF
Work and Life
PPTX
GPU Algorithms and trends 2018
PPTX
Machine learning in the Indian Context - IEEE talk at SRM Institute
PDF
Students Hackathon - 2017
PPTX
ICCE Asia 2017 - Program Outline
PDF
Call for Papers - ICCE Asia 2017
PDF
Open Shading Language (OSL)
PPTX
GFX part 8 - Three.js introduction and usage
PPTX
GFX Part 7 - Introduction to Rendering Targets in OpenGL ES
PPTX
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
PPTX
GFX Part 5 - Introduction to Object Transformations in OpenGL ES
PPTX
GFX Part 4 - Introduction to Texturing in OpenGL ES
PPTX
GFX Part 3 - Vertices and interactions in OpenGL
PPTX
GFX Part 2 - Introduction to GPU Programming
PPTX
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
PPTX
John Carmack talk at SMU, April 2014 - Virtual Reality
PPTX
GFX2014 OpenGL ES Quiz
PPTX
Gfx2014 Graphics Workshop - Lab manual
PPTX
Render to Texture with Three.js
Synthetic Data and Graphics Techniques in Robotics
Work and Life
GPU Algorithms and trends 2018
Machine learning in the Indian Context - IEEE talk at SRM Institute
Students Hackathon - 2017
ICCE Asia 2017 - Program Outline
Call for Papers - ICCE Asia 2017
Open Shading Language (OSL)
GFX part 8 - Three.js introduction and usage
GFX Part 7 - Introduction to Rendering Targets in OpenGL ES
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 3 - Vertices and interactions in OpenGL
GFX Part 2 - Introduction to GPU Programming
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
John Carmack talk at SMU, April 2014 - Virtual Reality
GFX2014 OpenGL ES Quiz
Gfx2014 Graphics Workshop - Lab manual
Render to Texture with Three.js
Ad

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPT
Teaching material agriculture food technology
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
Chapter 3 Spatial Domain Image Processing.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Electronic commerce courselecture one. Pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Network Security Unit 5.pdf for BCA BBA.
Teaching material agriculture food technology
MYSQL Presentation for SQL database connectivity
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Programs and apps: productivity, graphics, security and other tools

Developing and Benchmarking Qt applications on Hawkboard with Xgxperf

  • 1. Developing Qt applications on HawkBoard Prabindh Sundareson [email_address] July 2010
  • 2. Agenda Qt Introduction Quick history, Licensing model Fundamental concepts Typical application software stack Qt application classes Qt Graphics View framework Signal/Slot mechanism Configuring and Building Qt Tools Qt Creator Introduction to XgxPerf – TI Graphics Toolkit Developing a Qt application in 2 minutes with XgxPerf (Demo) Qt Development – Tips for performance Qt vs Android vs Silverlight vs Flash Conclusion & QnA
  • 3. Qt History Started as an offering from Trolltech Trolltech is now part of Nokia Qt framework is available in source form, with multiple support options Works on Linux framebuffer, WinCE, X, Windows, even on Android Continuously evolving, now at 4.7.x (Beta)
  • 4. Qt Licensing Model Commercial LGPL v. 2.1 GPL v. 3 License Cost License fee charged No cost No cost Must provide source code for changes to Qt No, modifications can be closed Source code must be provided Source code must be provided Can create proprietary application Yes—no obligation to disclose source code Yes, if dynamically linked to Qt library No, application is subject to the GPL Support Yes, with valid maintenance agreement Not included, available separately Not included, available separately Charge for Runtimes Yes—in some instances* No, distribution is royalty free No, distribution is royalty free
  • 5. The Qt Framework FB Cairo Qt API (Linux / WinCE) DirectFB Surface Managers X Window System/Mgrs Application Framework HW Device Tslib, Mouse GWES Input Device Manager Qt/e Qt/X XgxPerf GDI DDr a w Win32/ Windowing System
  • 6. Typical Application Components Feedback to User (GUI) Application Event Handler(s) Application Event Loop Environment Input Events Output Changes Sensor User Input Events Mouse/ts Ex. Increase speed by calling driver interface ioctl Qt
  • 7. Qt - HawkBoard Qt relies on Linux frame buffer driver provided by HawkBoard linux package The frame buffer interface controls what resolutions are supported by Qt Maximum resolution supported on HawkBoard 640 x 480, 16 bpp Qt/embedded always outputs to full screen QWS is a simple window system for Qt/e Qt also works with X on Linux Touch screen, and Mouse/Keyboard supported
  • 9. Steps for Creating Qt based UI Build Qt for target, using provided Qt cross compile options Design the UI in Qt Designer Add necessary event handlers in CPP file Add necessary application level code Ex, Timers, Network stacks, Motor control, … Create .PRO project file Build, install to target Debug directly on target for peripheral accesses
  • 10. Qt – App Development with GraphicsView #include “automation.h” void AutomationApp::Init() { … /* Create a new sample widget that shows a text within a information box – see automation library in xgxperf */ pValveText1 = new InfoBoxClass(0,QRectF(260,290,20,20),&quot;1.1&quot;); /* Add the item to the Graphics scene and make it visible on screen – Note that the GraphicsView was already created for us by the framework in xgxperf */ m_scene->addItem(pValveText1); /* Add the item to a current list, for book-keeping during exit */ workItemList << pValveText1; … }
  • 11. Basics of Qt - Widgets
  • 12. Basics of Qt - Widgets Qt UI framework is based on widgets Widgets respond to UI events (key presses/mouse movements), and update their screen area Each widget has a parent, that affects its behaviour, and is embedded into it Can create “complex” shapes using masks See Automation Classes in Xgxperf Most Qt classes are derived from QWidget Ex, QGLWidget, QPushbutton … QPushButton * myButton = new QPushButton(…); myButton->doSomethingAPI(); Refer to online documentation at http://doc.qt.nokia.com/4.6/qwidget.html Tip – Documentation is arranged using class names.
  • 13. QGraphicsView Provides a “Canvas” for adding items (QGraphicsItems) The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene By default, QGraphicsView provides a regular QWidget for the viewport widget. Can replace default by calling setViewport() with another widget type Provides a way to build an UI in an “actual” drawing canvas Ex, concept of “z-depth” of a QGraphicsItem
  • 14. Qt - Signals/ Slots Signal / Slot mechanism provides a functionality similar to setting up “function pointers” Provides better type checking, amongst others Example Use-case: Perform blocking/ time consuming activities in separate thread Use paintEvent() to trigger/consume the result of actions happening in parallel (ex. Upload next video frame) How to communicate events ? Use SIGNAL/SLOT to communicate event completions Usage example for Signal/Slots: “ browserlib” app in xgxperf Found in /Xgxperf/browserlib/ browserlib.cpp
  • 15. Using SIGNAL/SLOT Class myClass: public QThread { Q_OBJECT /* Needed for signal/slot mechanism to work at runtime */ Public: … signals: void function1(const QImage &image, double scaleFactor); }; In thread code, emit function1(image, scaleFactor); In Main application, define the actual function:: void myWidget::mainWidgetFunction(const QImage &image, double scaleFactor){} … And connect the signal and slot: connect(&thread, SIGNAL(mainWidgetFunction(const QImage &, double)), this, SLOT(function1(const QImage &, double)));
  • 16. QPainter Low level painting API, for overriding default painting behaviour of widgets Handles Text and other Drawing primitives (very flexible API) Can perform operations that the Widget/other Class APIs do not expose (ex, create a circular window) Usage modes Subclass QWidget, and handle Paint event void paintEvent(QPaintEvent *event) QPainter can be accessed only within a paint event Usage example: “ automation” app in xgxperf
  • 17. Qt – Classes for UI development Canvas QGraphicsView, QGraphicsScene Text QStaticText, QString, QGraphicsTextItem Icons QSvgWidget, QGraphicsSvgItem, QLabel Animations QPropertyAnimation 3D QGLWidget (not on Hawkbrd) Bitmap loading QPainter QPixmap, QImage
  • 18. Setting up and building Qt Documented in detail for non-OpenEmbedded users at, http://processors.wiki.ti.com/index.php/Building_Qt Angstrom (OpenEmbedded based) distribution has Qt package for Hawkboard A configurable pre-built filesystem with Qt integrated, and kernel image for Hawkboard can be downloaded from http://www.angstrom-distribution.org/narcissus/ Select “hawkboard” machine type from pull-down menu Select “Qt” – embedded or X11 based on desktop environment in addition application selection option
  • 19. Debugging and Profiling Qt Applications Use Qt Creator, an integrated designer/debugger Latest version is 1.3 http://qt.nokia.com/downloads Needs GDB on Linux, and CDB for PC But usually much easier to just do qDebug() << “printed from here”; To get output on terminal and trace code flow Angstrom package provides oprofile to profile application code Use Xgxperf to benchmark at specific fps
  • 20. Qt Creator Used to create a new form design Output saved as a .UI file (text format) This can be imported into the Qt application via Qt classes
  • 21. Creating a Widget (old screenshot)
  • 22. Using .UI files Qt Creator generates -> .UI file Steps to create application from .UI file: Add .ui file to project using .PRO entry Subclass Ui:: in application Ex, see “vslib” application in Xgxperf /xgxperf/vslib/vslib.cpp class VSApp : public ApplicationBase, private Ui::MainWindow Use “setupUi” call directly – setupUi(this);
  • 23. Integrating .UI files TEMPLATE = lib SOURCES = vslib.cpp export.cpp HEADERS = ../applicationmanager/common/applicationbase.h vslib.h FORMS = mainwindow.ui RESOURCES = resource.qrc VSApp::VSApp(QWidget* parent, QRectF inSceneRect, QGraphicsScene *scene, void* data): ApplicationBase(parent, inSceneRect,scene,data) { //Store the test data locally m_widgetTestInStruct = (TestTargetParamsStruct*)data; currTimerCount = 0; setupUi( this); } c lass VSApp : public ApplicationBase, private Ui::MainWindow Location - Xgxperf/vslib .pro .cpp .h
  • 24. XgxPerf Xgxperf is a collection of ready made examples, and classes for different end use-cases Industrial automation, Medical, Automotive displays, 3D, Sewing Machine, Surveillance,.. Uses QGraphicsView Configurable input parameters for UI components Provides profile output for UI startup time and CPU load Additionally, includes “livemem”, an off-screen display plugin for Qt/e (writes Qt’s display rendering outputs to image file) Useful for analysing widget rendering performance independent of display driver performance And for remote debugging/ archival Additionally, includes “sgxperf”, a 3D benchmarking tool, for SGX based devices like the AM35x/37x families XgxPerf TI application note – Will be available in TI website in September 2010 – TI Application Note # SPRABF4 Draft version available at < this link > now External Wiki page on Xgxperf http://processors.wiki.ti.com/index.php/Xgxperf
  • 25. XgxPerf Usage SVN access: svn checkout http:// gforge.ti.com/svn/gleslayer Username = anonymous, password= (blank) (or) Download and extract source tarball Non-OpenEmbedded users https://gforge.ti.com/gf/download/docmanfileversion/192/3696/xgxperf_1.1.0.tar.gz (check SVN for latest) Update path of framework (ex. QTDIR =) in Rules.make Build - “make && make install” Open Embedded-users For Angstrom setup, use the recipes for Angstrom at https://gforge.ti.com/gf/download/docmanfileversion/195/3699/ti-xgxperf.tar Build any image that provides Qt - X11 or Qt – Embedded package Choose the appropriate Xgxperf recipe: ti-xgxperf-qt-x11 for X11 build, or ti-xgxperf-qt-embedded. X11 build is shown below. Q^oe] sh oebb.sh bitbake ti-xgxperf-qt-x11 Q^oe] ls -l build/tmp-angstrom_2008_1/deploy/glibc/ipk/armv7a/ti-xgxperf-qt-x11_1.0.0.0-r0+svnr54.5_armv7a.ipk -rw-r--r-- 1 prabindh prabindh 4873428 2010-07-19 20:18 build/tmp-angstrom_2008_1/deploy/glibc/ipk/armv7a/ti-xgxperf-qt-x11_1.0.0.0-r0+svnr54.5_armv7a.ipk XgxPerf is now ready to use on local HW EVM ./xgxperf_app [–qws] <cookie> <fps> …
  • 26. Pre-configured applications Test 0 - Industrial Automation blocks (Turbines, Boilers, Pipes, Text Info classes) Test 1 – Text + Pictures (PNG/VG/Colors) Test 2 – Involves GLWidget, needs powervr (not on HawkBoard) Test 3 – Webkit Browser Test 4 – Automotive Tacho Test 5 – Medical ECG Monitor Test 6 – Video Surveillance camera feed Monitor Test 7 – Sewing Machine UI
  • 27. XgxPerf Inputs Configurable GUI creation input parameters: Number/type of elements Size of elements Target FPS Text Pictures (PNG, SVG, Colour fills) Effects and animations 3D GL parameters Creates HTML/XML outputs with profile info
  • 28. 2 minute Qt Application Development [live demo] Create new Xgxperf subproject from template Add items Build project Use xgxperf_app to invoke “ ./xgxperf_app –qws <args>”
  • 29. Qt Development Tips Do’s 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/ other bitmaps when animating, 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 Do not keep changing large background images Do not update all items. Update only when needed and in specific locations Avoid Animation in QGraphicsView especially for large images, use optimised classes
  • 30. Qt vs Android vs Silverlight
  • 31. Next Steps Download Qt (Nokia), Xgxperf (TI) toolkits Configure, build, extend applications using Xgxperf on HawkBoard Use xgxperf as starting point Integrate drivers/ real-time apps to Qt
  • 32. Links Qt download ftp:// ftp.qt.nokia.com /qt/source/ Qt configure and build http:// processors.wiki.ti.com/index.php/Building_Qt TI XgxPerf at Gforge (OE recipes, tar.gz code, documentation, latest updates via SVN) https:// gforge.ti.com/gf/project/gleslayer / Qt Animation with Graphics View on 4.7 http://www.slideshare.net/qtbynokia/special-effects-with-qt-graphics-view TI Graphics Blog and updates http:// tigraphics.blogspot.com TI OMAP3 Graphics SDK (CortexA8/3D engine) http://processors.wiki.ti.com/index.php/OMAP35x_Graphics_SDK_Getting_Started_Guide Hawkboard web - http:// www.HawkBoard.org Hawkboard discussions - http:// groups.google.com/group/hawkboard TI opensource projects - http:// designsomething.org / Beagleboard (CortexA8) - http:// www.BeagleBoard.org
  • 33. Q&A