在没有OpenGL的情况下,在X11上显示图像的最快方法是什么?
我需要在 QT 小部件中显示原始图像。我在帧缓冲区上运行 X11,因此 OpenGL 不可用。
图像和帧缓冲区都采用相同的格式 - RGB565,但如果需要,我可以将其更改为任何其他格式。我不需要混合或缩放。我只需要按原样显示像素。
我正在使用 QPainter::drawImage,但它将 QImage 转换为 QPixmap 并且这种转换似乎非常慢。它还由 Xrender 支持,我认为支持 Xrender 中的混合需要不必要的开销,而我并不真正需要
有没有更好的方法?如果它在 QT 中不可用,我可以使用 Xlib 或任何其他库或协议。我可以修改驱动程序、X 服务器或其他任何东西。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试使用XPutImage? (或者 XShmPutImage 如果您要从客户端多次传输图像并拥有 MIT-SHM另请参阅 video4linux 网络摄像头示例browser.c,但它们在发送之前将 565 转换为 16 或 24 位深度。对于您的设置,应该可以发送图像而不进行转换
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
可能值得设置
QT_GRAPHICSSYSTEM
环境变量。我遇到了 X11 渲染器变得非常非常慢的问题。设置QT_GRAPHICSSYSTEM = 'raster'
时,QT 渲染会绕过 X11 渲染引擎,这(根据我的经验)可以显着提高效率。QT_GRAPHICSSYSTEM
的其他有效值是'native'
和'opengl'
,但'raster'
对我有用。我很有兴趣看看你过得怎么样。It may be worth setting the
QT_GRAPHICSSYSTEM
environment variable. I was having issues with the X11 renderer becoming very, very slow. On settingQT_GRAPHICSSYSTEM = 'raster'
, the QT rendering bypasses the X11 rendering engine, which can (as in my experience) be significantly more efficient. Other valid values forQT_GRAPHICSSYSTEM
are'native'
and'opengl'
, but'raster'
worked for me. I'll be interested to see how you got on.