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

Denis Shienkov denis.shienkov at gmail.com
Wed Aug 29 15:43:40 CEST 2018


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

So, there are no way to improve an acceleration and to minimize the CPU
loading?

PS: I tried to mix the OpenGL widgets with usual widgets, but the 'eglfs'
says that it is impossible to mix it. This is some sort of hopeless
situation. (((

BR,
Denis

ср, 29 авг. 2018 г. в 15:51, drwho <drwho at infidigm.net>:

> 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>
> <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>
> <http://doc.qt.io/qt-5/qpaintdevice.html> instances, such as QImage
> <http://doc.qt.io/qt-5/qimage.html> <http://doc.qt.io/qt-5/qimage.html>,
> QOpenGLPaintDevice
> <http://doc.qt.io/qt-5/whatsnew50.html#qopenglpaintdevice>
> <http://doc.qt.io/qt-5/whatsnew50.html#qopenglpaintdevice>, QWidget
> <http://doc.qt.io/qt-5/qwidget.html> <http://doc.qt.io/qt-5/qwidget.html>,
> and QPrinter <http://doc.qt.io/qt-5/qprinter.html>
> <http://doc.qt.io/qt-5/qprinter.html>. The actual drawing happens in the
> QPaintDevice <http://doc.qt.io/qt-5/qpaintdevice.html>
> <http://doc.qt.io/qt-5/qpaintdevice.html>'s QPaintEngine
> <http://doc.qt.io/qt-5/qpaintengine.html>
> <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>
> <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>
> <http://doc.qt.io/qt-5/qimage.html> or QWidget
> <http://doc.qt.io/qt-5/qwidget.html> <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>
>
>  class Widget final : public QWidget
>
> {
>
> public:
>
>     explicit Widget(QWidget *parent = nullptr);
>
> private:
>
>     void paintEvent(QPaintEvent *event) final;
>
>     void timerEvent(QTimerEvent *event) final;
>
> };
>
>  Widget::Widget(QWidget *parent)
>
>     : QWidget(parent)
>
> {
>
>     startTimer(50);
>
> }
>
>  void Widget::paintEvent(QPaintEvent *event)
>
> {
>
>     QPainter p(this);
>
>     static bool toggled = false;
>
>     const auto color = (toggled) ? QColor(Qt::red) : QColor(Qt::green);
>
>     const auto rect = event->rect();
>
>     p.fillRect(rect, color);
>
>     toggled = !toggled;
>
> }
>
>  void Widget::timerEvent(QTimerEvent *event)
>
> {
>
>     Q_UNUSED(event);
>
>     update();
>
> }
>
>  int main(int argc, char *argv[])
>
> {
>
>     QApplication app(argc, argv);
>
>     Widget w;
>
>     w.setMinimumSize(1280, 800);
>
>     w.show();
>
>     return app.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>:
>
>> 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 listDevelopment at qt-project.orghttp://lists.qt-project.org/mailman/listinfo/development
>
>
> _______________________________________________
> 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/394c977b/attachment.html>


More information about the Development mailing list