I initially just wanted to use ratatui to build a tui. Although it’s very intuitive, I realized, that I can’t take a Rect and use it as a surface without going through odd hoops like calling directly into wayland compositor and managing resize manually.
So, I want this to be an example of an idea that I have. What if we borrow heavily from the wayland protocol, and modify it to work with terminal emulators? That way, I could essentially define a Rect which I would be responsible for (client), while the emulator (server) could grab my resource id and composite it, without the roundtrip required today.
So, as far as I could learn, right now, if you want to render anything to the screen of a terminal emulator, you have to render an image using an offscreen target, grab the pixel data, pass it through the kitty image protocol and then the terminal emulator sends it to the gpu for final on screen render. Which is great, but that many roundtrips looks very inefficient to me. And I suspect (I should really profile this), it’s not going to have great framerates, for anything 3d.
So, the approach in more detail would be something like:
- client creates egl context.
- sends what part of the window it wants to render over
- server acknowledges
- now the same damage, commit protocol as wayland to update renders
The hard part would be to figure out how to share resource ids between processes without the roundtrip