I have tried to give a brief overview over the QtCompositor architecture once before [1] but I want to revisit the subject.
One of the nice things about Qt 5 is that there it takes very little to port Qt to new graphics stacks. If there is a way to paint with Qt into a "graphics buffer" and then get this buffer to screen, then this is all it takes to get a basic Qt port up and running. The minimal and minimalegl QPA plugins are good examples for how to either get a "very" basic raster based stack or an OpenGL based stack up and running. Obviously the QtWidget stack corresponds well to the raster based graphic stack, while QtQuick2 uses OpenGL. Neither of these two plugins requires a windowing system. This is actually something which is crucial to stress. Qt 5 DOES NOT NEED A WINDOWING SYSTEM!
So why do you need a windowing system? Often there is actually not a need for a windowing system. The other day I made a xbmc box at home. For this box I don't need a windowing system. I just need to be able to get the screen resources and handle input in some way or the other, so that the xbmc application can show video. I'm not going to run any other GUI application on this box, so just giving all the screen resources to XBMC is ok.
However, sometimes you need to be able to have control the screen resources.
This doesn't need to be because you want to have two applications on the screen at the same time, but maybe you need a superior process that can override what is being sent to screen. Maybe in a full screen application setup you still need to be able to interrupt with some full screen notification.
But lets backtrack. Qt 5 works perfectly WITHOUT a windowing system! That's amazing. We have actually spent alot of time to figuring out how to make these abstractions so that Qt will work perfectly without a windowing system. We have separated out the input handling since this doesn't necessary need to be coupled with the graphics bit. We have made sure that it will work with as little functionality as possible. We added an interface for page-flipping buffers to screen.
All of these interfaces are also interfaces that are needed when you want to create a compositor that will target more than one graphics stack and more than one input system. The interfaces are there to make it possible and easy to port Qt to new windowing systems, but it just happens to be a perfect fit for creating new windowing systems.
There is also an added bonus that the backends will be developed/maintained by many developers. Not only developers that are making a Windowing system, but developers targeting single on screen applications.
Say you have used to QtCompositor api to develop your compositor. When you developed the compositor, you typically will use the xcb backend, since its very nice to have a window manager when you develop, so you can look up documentation, search the web etc. Then when you want to run your compositor as your main windowing system, you can run it with the kms backend, openwfd etc etc.
This takes care of the output, but what about the input? There are several available input plugins for QPA. So you can start it with evdevkeyboard and evdevmouse if its a more traditional desktop.
So what if the plugin for your HW does not exist? Then you have to do some work! But the upside is that the interfaces are very clearly defined*. It is EASY to target a new graphics stack, and it is EASY to target a new input system.
So lets backtrack again. Qt 5 doesn't require a window system. Wow, thats awsome. One of the side effects of this is that it is ideal to use the interfaceses developed to make Qt 5 window system agnostic to implement a windowing system.
QtCompositor sits on top of libwayland-server, implementing the boilerplate code that a compositor would need. By boilerplate code I mean code that every compositor needs. However, I don't mean trivial code. The buffer queuing and direct rendering schemes are not trivial. Making client surfaces to QML items is neither trivial, but using the items is. Handling all of the input in the correct way, is not difficult, but its code that is common for most compositors.
Also, often for some applications areas, you want to have additional protocol extensions (ie. not part of the Wayland core protocol). This is made very easy with the QtWayland module.
I strongly recommend people how need to create their own Wayland compositor to have a look at the QtWayland module. I believe its a "hidden" gem with loads of potential.
* Qt platform abstraction does not guarantee source or binary compatibility between Qt versions. However, it should be regarded as a stable api. Considering the amount of work it would require to change all the plugins that uses the apis.
One of the nice things about Qt 5 is that there it takes very little to port Qt to new graphics stacks. If there is a way to paint with Qt into a "graphics buffer" and then get this buffer to screen, then this is all it takes to get a basic Qt port up and running. The minimal and minimalegl QPA plugins are good examples for how to either get a "very" basic raster based stack or an OpenGL based stack up and running. Obviously the QtWidget stack corresponds well to the raster based graphic stack, while QtQuick2 uses OpenGL. Neither of these two plugins requires a windowing system. This is actually something which is crucial to stress. Qt 5 DOES NOT NEED A WINDOWING SYSTEM!
So why do you need a windowing system? Often there is actually not a need for a windowing system. The other day I made a xbmc box at home. For this box I don't need a windowing system. I just need to be able to get the screen resources and handle input in some way or the other, so that the xbmc application can show video. I'm not going to run any other GUI application on this box, so just giving all the screen resources to XBMC is ok.
However, sometimes you need to be able to have control the screen resources.
This doesn't need to be because you want to have two applications on the screen at the same time, but maybe you need a superior process that can override what is being sent to screen. Maybe in a full screen application setup you still need to be able to interrupt with some full screen notification.
But lets backtrack. Qt 5 works perfectly WITHOUT a windowing system! That's amazing. We have actually spent alot of time to figuring out how to make these abstractions so that Qt will work perfectly without a windowing system. We have separated out the input handling since this doesn't necessary need to be coupled with the graphics bit. We have made sure that it will work with as little functionality as possible. We added an interface for page-flipping buffers to screen.
All of these interfaces are also interfaces that are needed when you want to create a compositor that will target more than one graphics stack and more than one input system. The interfaces are there to make it possible and easy to port Qt to new windowing systems, but it just happens to be a perfect fit for creating new windowing systems.
There is also an added bonus that the backends will be developed/maintained by many developers. Not only developers that are making a Windowing system, but developers targeting single on screen applications.
Say you have used to QtCompositor api to develop your compositor. When you developed the compositor, you typically will use the xcb backend, since its very nice to have a window manager when you develop, so you can look up documentation, search the web etc. Then when you want to run your compositor as your main windowing system, you can run it with the kms backend, openwfd etc etc.
This takes care of the output, but what about the input? There are several available input plugins for QPA. So you can start it with evdevkeyboard and evdevmouse if its a more traditional desktop.
So what if the plugin for your HW does not exist? Then you have to do some work! But the upside is that the interfaces are very clearly defined*. It is EASY to target a new graphics stack, and it is EASY to target a new input system.
So lets backtrack again. Qt 5 doesn't require a window system. Wow, thats awsome. One of the side effects of this is that it is ideal to use the interfaceses developed to make Qt 5 window system agnostic to implement a windowing system.
QtCompositor sits on top of libwayland-server, implementing the boilerplate code that a compositor would need. By boilerplate code I mean code that every compositor needs. However, I don't mean trivial code. The buffer queuing and direct rendering schemes are not trivial. Making client surfaces to QML items is neither trivial, but using the items is. Handling all of the input in the correct way, is not difficult, but its code that is common for most compositors.
Also, often for some applications areas, you want to have additional protocol extensions (ie. not part of the Wayland core protocol). This is made very easy with the QtWayland module.
I strongly recommend people how need to create their own Wayland compositor to have a look at the QtWayland module. I believe its a "hidden" gem with loads of potential.
* Qt platform abstraction does not guarantee source or binary compatibility between Qt versions. However, it should be regarded as a stable api. Considering the amount of work it would require to change all the plugins that uses the apis.