First steps with Wayland

I've been getting my head around wayland for the past few weeks as I am trying to understand its architecture and what can be done with it. After reading a bit about it I grabbed the source code and compile it, coming up with a moduleset and a jhbuildrc for wayland that you can find in jhbuild.

Wayland seems very interesting, specially from the perspective of having a clean codebase and architecture to work with unlike X.org. The main advantage is that the compositor acts as the display server, allowing it to be aware of the input events and avoiding round trips between processes.

The hardest thing to understand is that wayland itself is just a protocol to implement basic clients and compositors it has zero dependencies apart from FFI. It does not specify what rendering mechanism to use. Most people seem to believe that Wayland requires OpenGL/EGL and that is actually not true, that requirement is only true if you target the only wayland compositor available at the moment which is living in the wayland-demos repository.

This means that the even though  Gtk+ and Qt both have experimental wayland backends, they will not necessarily work with every single wayland compositor out there, and more backends may be needed for different compositors.

The other interesting bit about wayland is that the protocol is extensible, you may write your own protocol extension for specific use cases. Again, this means that the client side code has to be specific to the compositor. (I need to figure out if it's possible to negotiate which protocols are available in a given display server).

To start my journey I had to read a bit about EGL and GL, coming from a high level/clutter/cairo/mostly 2D wonderland it was an interesting read and I'm starting to pick the basic concepts around it.

After some concepts were able to land in my head I went ahead and wrote a simple client using cairo-gl that I am proposing for inclusion in wayland-demos. It is probably one of the simplest wayland clients available, I hope you find it useful.

I'm planning to learn a bit more about compositors in the coming weeks, will share my learnings as I move forward. Stay tuned.

P.S. I'd like to thank for answering all my stupid questions. I wish there were more FOSS maintainers like him 🙂

Advertisements