Add support for frame present protocols
Namely XPresent and https://wayland.app/protocols/presentation-time. This allows to measure how long did it take between start of frame rendering and when frame is actually appears on screen(presented).
Hello,
Another one to support the request.
My motivation is that usually I do not have that much CPU time spent on rendering. And I used to have all things, events namely, in one place. Think about select/poll/epoll, or what is even better, FreeBSD's kqueue mechanism. The addition of XPresent extension event will allow to have event based interactive loop that have all grouped together, maybe even in one process w/o using threads. I can elaborate more on the case, but for now let me just present my prototype loop with XPresent.
while(1) {
wait_for_events(); /* notice that no polling used */
switch(ev) {
case network:
...
case perifery:
...
case PresentIdleNotify: /* the particular pixmap is ready to be reused. */
...
case PresentCompleteNotify: /* typically VSYNC is complete. here I will start thinking about producing a new frame. */
...
}
/* NB: no sleep, or whatsoever. loop will wait for OS events, reducing my laptop power usage. */
}
BTW, I have spare time to support this topic, committing my efforts to it. What will be a way to start my work on it? Maybe someone already did some PR on the topic?