Important: Please read the Qt Code of Conduct -

Why QRasterPaintEngine is called in an QOpenGLWidget?

  • Hi all,

    Thank you for reading this post! Recently I am working on an old code base. The app runs on X11 with a remote server. The function is to render a series of images repeatedly (1..N-1..N..1..). The class is very efficient to render a series of images on X11 + Mesa3D/LLVMPipe (20fps).

    Later, I added a new QOpenGLWidget with similar functionality. But the maximum fps is only 60% of the original. In the beginning, I thought it is because images in the new widget has higher resolution. But after launching a perf on Linux, I found out that 20% of the time is spent on qt_memfill32. Another 10% is spent on memcpy.

    In comparison, the original code will barely trigger qt_memfill32 and memcpy. I am confused about what's the mechanism behind this. I read the official article Qt Graphics and Performance - An Overview. The old QOpenGLWidget doesn't apply any of the flags to directly render to screen.

    Hope anyone can help me!


    P.S. the stack for the new QOpenGLWidget:

    #0  in qt_memfill32(unsigned int*, unsigned int, int)
    #1  qt_rectfill_argb32(QRasterBuffer*, int, int, int, int, QRgba64 const&)
    #2  fillRect_normalized(QRect const&, QSpanData*, QRasterPaintEnginePrivate*)
    #3  QRasterPaintEngine::fillRect(QRectF const&, QSpanData*)
    #4  QPainter::fillRect(QRect const&, QBrush const&)
    #5  QWidgetPrivate::paintBackground(QPainter*, QRegion const&, int) const ()
    #6  QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) ()
    #7  QWidgetBackingStore::doSync() ()
    #8  QWidgetBackingStore::sync() ()
    #9  QWidgetPrivate::syncBackingStore() ()
    #10 QWidget::event(QEvent*) ()
    #11 QMainWindow::event(QEvent*) ()

Log in to reply