From 23e37e7b1d8004fb5361c147239d2e628efbd5e8 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 22 Apr 2019 12:42:37 +0300 Subject: output: refactor frame submission API This is necessary for direct scan-out and other upcoming features. This patch changes the output API to look like the wl_surface API. Outputs now have some double-buffered state: the frame to be submitted (currently only wlr_renderer frames are supported) and the damaged region. To attach a pending frame, use wlr_output_attach_render. To set the pending damaged region, use wlr_output_set_damage. To submit the pending state, call wlr_output_commit. This will submit the pending frame to the backend. To migrate from the old API to the new one: - Replace wlr_output_make_current calls by wlr_output_attach_render - Replace wlr_output_swap_buffers calls by wlr_output_set_damage and wlr_output_commit --- tinywl/tinywl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tinywl') diff --git a/tinywl/tinywl.c b/tinywl/tinywl.c index 16c1f85c..ca5cdc91 100644 --- a/tinywl/tinywl.c +++ b/tinywl/tinywl.c @@ -591,8 +591,8 @@ static void output_frame(struct wl_listener *listener, void *data) { struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); - /* wlr_output_make_current makes the OpenGL context current. */ - if (!wlr_output_make_current(output->wlr_output, NULL)) { + /* wlr_output_attach_render makes the OpenGL context current. */ + if (!wlr_output_attach_render(output->wlr_output, NULL)) { return; } /* The "effective" resolution can change if you rotate your outputs. */ @@ -635,7 +635,7 @@ static void output_frame(struct wl_listener *listener, void *data) { /* Conclude rendering and swap the buffers, showing the final frame * on-screen. */ wlr_renderer_end(renderer); - wlr_output_swap_buffers(output->wlr_output, NULL, NULL); + wlr_output_commit(output->wlr_output); } static void server_new_output(struct wl_listener *listener, void *data) { -- cgit v1.2.3