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 --- examples/output-layout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/output-layout.c') diff --git a/examples/output-layout.c b/examples/output-layout.c index 440b3188..5e406af0 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -115,7 +115,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) { struct wlr_output *wlr_output = output->output; - wlr_output_make_current(wlr_output, NULL); + wlr_output_attach_render(wlr_output, NULL); wlr_renderer_begin(sample->renderer, wlr_output->width, wlr_output->height); wlr_renderer_clear(sample->renderer, (float[]){0.25f, 0.25f, 0.25f, 1}); @@ -137,7 +137,7 @@ void output_frame_notify(struct wl_listener *listener, void *data) { } wlr_renderer_end(sample->renderer); - wlr_output_swap_buffers(wlr_output, NULL, NULL); + wlr_output_commit(wlr_output); } static void update_velocities(struct sample_state *sample, -- cgit v1.2.3