qt: platform supported composition integration
Old merge request: !2413 (closed)
The intention is to make use of QWindow
in order to embed the video window. It seems that Qt "wayland", "windows", and "cocoa" platform plugins support child window stacking with transparency. I tried with "xcb" platform plugin, but it simply did not work. I'm not sure if it is about X11 support, or simply because "xcb" plugin / QXCBWindow has no support for such a thing.
I also controversially made this to have high priority compared to the already existing integration support. I'm not sure if this can be accepted, but I'm also willing to lower the priority of this. I did this considering the following advantages:
- Qt Widgets and Qt Quick are two different world, one operates with
QWidget
and the other withQWindow
. The current integrations are mixing them, and I'm not convinced if this is a good idea. The only good way of doing that must be usingQQuickWidget
to embed Qt Quick View inside a widget, but it has many disadvantages itself.QWindow
is a simple wrapper of the platform window unlikeQWidget
, which is a Qt specific thing and is not as lightweight asQWindow
. - The current compositor integrations are full of quirks. This is probably because many Qt stuff are private, and QPA (Qt Platform Abstraction) interface are not really exposed to the application. This makes maintenance very hard.
- The current compositor integrations have broken threaded rendering. Qt Quick shines when threaded rendering is enabled.
::render()
needs to run in a dedicated render thread, but what I see is that it is not done with the current integrations, probably due to synchronization issues. - The current compositor integrations require usage of direct OpenGL. That is, if software backend or any other backend is used instead, the application does not work. On the other hand, with this approach, any backend is supported. This is especially important for future proofing because Qt 6 only supports Qt RHI, as well as makes us enable Qt RHI on Qt 5.14 or 5.15. Vulkan or DirectX 12 through Qt RHI must theoretically perform better compared to OpenGL.
Disadvantages:
- Can we rely on system compositor's latency?
- Something I'm missing? Why this approach was not used before?
Example screenshots from Wayland (Windows, and Cocoa needs to be tested):
TODO: Hide Quick View when there is nothing to show, to eliminate blending.