smithay icon indicating copy to clipboard operation
smithay copied to clipboard

Better data flow documentation

Open DemiMarie opened this issue 4 years ago • 2 comments

The data flow of Smithay is highly non-obvious. I was trying to understand how one would get a WlBuffer to render. It turns out that one obtains a WlBuffer from a BufferAssignment, which is in turn part of SurfaceAttributes. A SurfaceAttributes can be obtained from SurfaceData::data_map, which is part of the SurfaceData struct passed to the with_surface_tree_upward callbacks. Similarly, I had to figure out where the event loop happens (in Anvil, it turns out), and how to run it (create an instance of calloop::EventLoop manually). All of this took me about an hour to figure out, mostly by git grep -w on the source code.

This could definitely benefit from improved documentation. In addition, having a clear tutorial on how to make a really simple compositor would be nice. Anvil is over 5,000 lines of code, so it is a bit too big to be an example, especially for those (like me!) who mostly want a barebones compositor they can plug their own input and drawing backends into.

DemiMarie avatar Jul 15 '21 08:07 DemiMarie

Yes that is fair. So far the code in our examples folder code was focused on the backend side of things. A simple compositor - likely only supporting the most barebones of protocols to render common apps - is a good idea.

Drakulix avatar Jul 15 '21 09:07 Drakulix

This could definitely benefit from improved documentation. In addition, having a clear tutorial on how to make a really simple compositor would be nice.

Yes, absolutely, that is the longer-term plan of what the Smithay book ought to be. However it has not been in the focus lastly, as we were more focusing on actually getting everything to work. :sweat_smile:

elinorbgr avatar Jul 15 '21 10:07 elinorbgr