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 🙂

4 thoughts on “First steps with Wayland

  1. What build environment did you use? Did you use a VM and on what distro did you base your work?
    I’d like to have a play with Wayland but would rather code than mess around with a build-environment.

    Like

  2. I hope Wayland becomes the de-facto standard in the near future for Linux and other platforms as well.

    Like

  3. sorry for my english .how to get local ip by gio?thanks~~~~~
    this is my code,it work on windows well ,but didn’t get realy ip on ubuntu .
    #include
    int main(gint argc,gchar *argv[]){
    g_type_init();
    GResolver* solver=g_resolver_get_default();
    GList *list=g_resolver_lookup_by_name(solver,g_get_host_name(),NULL,NULL);
    g_printf(“%s\n”, g_inet_address_to_string(g_list_first(list)->data));
    g_printf(“%s\n”, g_inet_address_to_string(g_list_last(list)->data));
    return 1;
    }

    Like

Leave a comment