I need to display a raw image in a QT widget. I'm running X11 on a framebuffer, so OpenGL is not available.
Both the image and the framebuffer are in the same format - RGB565, but I can change it to any other format if needed. I don't need blending or scaling. I just need to display pixels as is.
I'm using QPainter::drawImage, but it converts QImage to QPixmap and this conversion seems to be very slow. Also it is backed by Xrender and I think there is unnecessary overhead required to support blending in Xrender which I don't really need
Is there any better way? If it is not available in QT, I can use Xlib or any other library or protocol. I can modify the driver, X server or anything else.
did you try to use XPutImage? (or XShmPutImage if you going to transfer image more then once from client and have MIT-SHM extension available) Also look at video4linux webcam sample viewer.c, but they convert 565 to 16 or 24 bit depth before sending. For your setup it should be possible to send image without conversion
It may be worth setting the QT_GRAPHICSSYSTEM
environment variable. I was having issues with the X11 renderer becoming very, very slow. On setting QT_GRAPHICSSYSTEM = 'raster'
, the QT rendering bypasses the X11 rendering engine, which can (as in my experience) be significantly more efficient. Other valid values for QT_GRAPHICSSYSTEM
are 'native'
and 'opengl'
, but 'raster'
worked for me. I'll be interested to see how you got on.