The wayland project

It was a good will.

5 years ago, I read a blog about the future of linux desktop, I was using a window manager called Awesome (one of my friend introduced it to me, I was enchanted by how he opened two terminals side-by-side, one for coding and one for compiling). A voice about next generation desktop was just raised in the linux community , a group of hackers demod the weston project, where you can rotate the application windows. They also pointed out the existing problems in the x server architecture(basically it is too old, let us just replace it). It is cumbersome, too many components, easily dead after package upgrade.


X did not die, it lives well even now. It did not stop me from starting a wayland window manager project though, it was only 3000 lines in the DWM (I still use it in my laptop) project, how hard can it be? Then I looked into the wayland protocol and the only wayland client programming tutorial available online(except those examples from weston itself). It did not seemed that hard, altough I did not understand very much about how wayland double buffer works, what does the wl_callback. The client side programming seemed a bit complicated than SDL or Qt, but it was doable to write simple applications. But how do we create a wayland server? Could it be just 3000 lines as well(yeah actually it may be if I am really smart, it is 6000 lines now)? The first problem I had was mode-setting, I did waste enormous time writing the drm code. It seemed will take forever. I did not know what it meant for a wayland server and what I need to code for it.

Spolier alert, It really takes very much for wayland compositor than a X window manager. Anyway, by the time I was familiared with libdrm code, some one started trying to write the wayland compositor library, (I am not sure the exact time, maybe there was a gap while I did nothing because of the lacking of compositor libraries) there was one that you can open a wayland server then have a small cursor on it, and that was it. Then there was swc, the video looks really nice, very responsive. It was designed to create simple compositors. It can work as well on Nvidia GPUs (nvidia only has wayland support from last year I think, they do not give a shit about libdrm, when they finally supported libdrm, they came with a different solution). it is now completed deprecated, I think the developer stopped development even before I knew how to work with it. It was easy to start a wayland compositor, but afterwards, it did not have any documents about how to manage the windows.

Then after a few monthes, a appealing project called wlc started gaining attentions on github. I still rememeber the architecture, the first design was creating a structure and let user writes the callback to inject into it, they even have default ones if you do not want to implement the specific part. My first trial on wayland compositor was based on that. Another famous i3 compatible weston compositor called sway emerged from it. It worked but inadiquately, it seemed to be always laggy and consumed too much resources that I did not know how, sway still has these performance and resources consuming problems.

Yes, I forgot to mention my project name. it is called taiwins, while I was satisfied working on the wayland server without the need to start from libdrm. I somehow made it a C++ project when I was note competent with it, without STL, because I thought template brings too large binaries and compositor has to be as light as possible. It was dumb idea, it could save a lot of time if I did not need to write containers like vector and hash tables. Anyway, without template and stand libraries, cplusplus are truly horrible, I cannot take bit of advantages from the power of cplusplus. Maybe just helping me learning cplusplus. That was the story ends in 2017.

Then when weston-3 released, the game changed a bit, for the first time, weston developers realized that it may be a better idea to make weston a library rather than just showing off what wayland can do. KDE starts to port their KWin to wayland, Gnome started a long time ago with mutter but finally usable, Fedora 26, I think, was the first linux distribution that came with wayland support. At the same time, wlc library stoped the development as well, the author mentioned that he had no time maintaining it so sway moved to its wlroot library. At that time, I switched to use libweston for the performance and likelihood of maintainance. Again, from the scratch this time, purely in C. Since I dislike the idea using a crippled cplusplus in a project.

comments powered by Disqus