qt: add X11 video compositor
qt: add X11 video compositor
The composition use the following mechanism:
-
The interface is rendered in an OpenGL FBO
-
The video is attached to a X11 surface that is rendered offscreen using X11 Composite extension, this surface is binded to an OpenGL buffer using GLX or EGL extensions
-
Both surfaces are rendered inside the real window using a simple OpenGL program.
FAQ:
-
why not using xrender:
- This mostly works, but it conflicts with QWindow implementation, as qt still issue some X11 commands on resize. So we end up with resizing issues with some compositors (see #25627 (comment 259065)).
-
why not use Composite for both the video and the interface surface ?
- yes, that works too, I have a branch with that x11-4, it just feels it was a bit convoluted to pass by x11 to get a OpenGL buffer back while I can already have one from an FBO
-
what about EGL?-
Qt has two xcb backends; GLX and EGL, it uses GLX as default. EGL has a similar extension to bind X11 surfaces to opengl texture so this should be doable pretty much the same way. We may add the support for it in a later MR.The main issue is detecting whether we're using EGL or GLX backend so far I haven't found a reliable way to do this. we can extract some informations from Qt QPA but those requires the use of private headers which we don't use on linux at the moment.
-
-
why not rendering the video within QML render pass using beforeRendering ?
- I think that would probably works, we could render the interface directly without having to render it to an FBO first but I was a bit reluctant about spamming render request to Qml scenegraph.
fixes: #25627 (closed), #22155 (closed)