[Development] iMX6 EGLGS 2D (QtWidgets) painting acceleration

drwho drwho at infidigm.net
Wed Aug 29 14:51:36 CEST 2018


Hi Denis,

Most Qt widgets are not drawn using opengl but instead are rasterized.  
I was surprised when I first learned this as well.

"QPainter <http://doc.qt.io/qt-5/qpainter.html> provides API for drawing 
vector graphics, text and images onto different surfaces, or 
QPaintDevice <http://doc.qt.io/qt-5/qpaintdevice.html> instances, such 
as QImage <http://doc.qt.io/qt-5/qimage.html>, QOpenGLPaintDevice 
<http://doc.qt.io/qt-5/whatsnew50.html#qopenglpaintdevice>, QWidget 
<http://doc.qt.io/qt-5/qwidget.html>, and QPrinter 
<http://doc.qt.io/qt-5/qprinter.html>. The actual drawing happens in the 
QPaintDevice <http://doc.qt.io/qt-5/qpaintdevice.html>'s QPaintEngine 
<http://doc.qt.io/qt-5/qpaintengine.html>. The software rasterizer and 
the OpenGL (ES) 2.0 back-ends are the two most important QPaintEngine 
<http://doc.qt.io/qt-5/qpaintengine.html> implementations. *The raster 
paint engine is Qt’s software rasterizer, and is used when drawing on a 
QImage <http://doc.qt.io/qt-5/qimage.html> or QWidget 
<http://doc.qt.io/qt-5/qwidget.html>.* Its strength over the OpenGL 
paint engine is its high quality when antialiasing is enabled, and a 
complete feature set.”


On 29/08/18 06:21 AM, Denis Shienkov wrote:
> I even have created a simple test app, which re-fill the 1280x800 rect 
> every 50 msec with the 'red' and 'green' colors.
>
> [code]
> #include<QApplication>
> #include<QWidget>
> #include<QPaintEvent>
> #include<QPainter>
> classWidgetfinal:publicQWidget
> {
> public:
> explicitWidget(QWidget*parent=nullptr);
> private:
> voidpaintEvent(QPaintEvent*event)final;
> voidtimerEvent(QTimerEvent*event)final;
> };
> Widget::Widget(QWidget*parent)
> :QWidget(parent)
> {
> startTimer(50);
> }
> voidWidget::paintEvent(QPaintEvent*event)
> {
> QPainterp(this);
> staticbooltoggled=false;
> constautocolor=(toggled)?QColor(Qt::red):QColor(Qt::green);
> constautorect=event->rect();
> p.fillRect(rect,color);
> toggled=!toggled;
> }
> voidWidget::timerEvent(QTimerEvent*event)
> {
> Q_UNUSED(event);
> update();
> }
> intmain(intargc,char*argv[])
> {
> QApplicationapp(argc,argv);
> Widgetw;
> w.setMinimumSize(1280,800);
> w.show();
> returnapp.exec();
> }
> [/code]
>
> And then I see that the Desktop PC has the ~0% CPU load, but the iMX6 
> has ~50% CPU load. WTF?
>
> BR,
> Denis
>
>
>
> ср, 29 авг. 2018 г. в 12:39, Denis Shienkov <denis.shienkov at gmail.com 
> <mailto:denis.shienkov at gmail.com>>:
>
>     Hi all.
>
>     I have an Apalis iMX6 board with the Yocto's image with the
>     working 'eglfs' and 'linuxfb'  backends (without of X11 support).
>
>     I need to create a 'pure' QtWidgets application, where I need to
>     use a real-time plotting with the Qwt library (using the Qt Quick
>     is not an option, as there the QtCharts is not ready for usage) .
>
>     But, I'm sadly surprised that a 2D painting takes ~100% CPU
>     loading as with the 'eglfs' and as with 'linuxfb' backends. It is
>     not an acceptable, because, e.g. on Desktop Linux/Windows it takes
>     ~4-5% CPU loading.
>
>     Is any workarounds for this? Maybe I need to re-build the Yocto's
>     image to enable the X11 'xcb' support?
>
>     BR,
>     Denis
>
>
>
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20180829/50a72297/attachment.html>


More information about the Development mailing list