backend/x11: implement a real rendering loop

Instead of using a timer, rely on X11 Present events and send a new
frame event when the parent compositor displays a new frame on screen.

The previous attempt at doing this [1] hit issues with EGLSurface, but
we don't use that anymore.

[1]: https://github.com/swaywm/wlroots/pull/1894
This commit is contained in:
Simon Ser 2020-12-13 14:12:02 +01:00
parent c5f239f411
commit c012d770f7
2 changed files with 13 additions and 27 deletions

View file

@ -26,8 +26,6 @@
#define XCB_EVENT_RESPONSE_TYPE_MASK 0x7f
#define X11_DEFAULT_REFRESH (60 * 1000) // 60 Hz
struct wlr_x11_backend;
struct wlr_x11_output {
@ -47,12 +45,10 @@ struct wlr_x11_output {
struct wlr_input_device touch_dev;
struct wl_list touchpoints; // wlr_x11_touchpoint::link
struct wl_event_source *frame_timer;
int frame_delay;
struct wl_list buffers; // wlr_x11_buffer::link
bool cursor_hidden;
uint64_t last_msc;
};
struct wlr_x11_touchpoint {