diff options
author | Simon Ser <contact@emersion.fr> | 2019-04-22 12:42:37 +0300 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-04-23 14:34:30 -0600 |
commit | 23e37e7b1d8004fb5361c147239d2e628efbd5e8 (patch) | |
tree | cca1f5be5b7b0c750e7ec104c500ce1311d89d19 /examples | |
parent | 56ceed38bffcc741b5a80741d0207101905370ae (diff) |
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
Diffstat (limited to 'examples')
-rw-r--r-- | examples/fullscreen-shell.c | 4 | ||||
-rw-r--r-- | examples/multi-pointer.c | 4 | ||||
-rw-r--r-- | examples/output-layout.c | 4 | ||||
-rw-r--r-- | examples/pointer.c | 4 | ||||
-rw-r--r-- | examples/rotation.c | 4 | ||||
-rw-r--r-- | examples/simple.c | 4 | ||||
-rw-r--r-- | examples/tablet.c | 4 | ||||
-rw-r--r-- | examples/touch.c | 4 |
8 files changed, 16 insertions, 16 deletions
diff --git a/examples/fullscreen-shell.c b/examples/fullscreen-shell.c index 7f2c9c2b..e9e64ce1 100644 --- a/examples/fullscreen-shell.c +++ b/examples/fullscreen-shell.c @@ -89,7 +89,7 @@ static void output_handle_frame(struct wl_listener *listener, void *data) { int width, height; wlr_output_effective_resolution(output->wlr_output, &width, &height); - if (!wlr_output_make_current(output->wlr_output, NULL)) { + if (!wlr_output_attach_render(output->wlr_output, NULL)) { return; } @@ -108,7 +108,7 @@ static void output_handle_frame(struct wl_listener *listener, void *data) { } wlr_renderer_end(renderer); - wlr_output_swap_buffers(output->wlr_output, NULL, NULL); + wlr_output_commit(output->wlr_output); } static void output_set_surface(struct fullscreen_output *output, diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c index a007f712..44cf26d5 100644 --- a/examples/multi-pointer.c +++ b/examples/multi-pointer.c @@ -94,14 +94,14 @@ void output_frame_notify(struct wl_listener *listener, void *data) { struct sample_state *sample = output->sample; struct wlr_output *wlr_output = output->output; - wlr_output_make_current(wlr_output, NULL); + wlr_output_attach_render(wlr_output, NULL); glClearColor(sample->clear_color[0], sample->clear_color[1], sample->clear_color[2], sample->clear_color[3]); glClear(GL_COLOR_BUFFER_BIT); wlr_output_render_software_cursors(wlr_output, NULL); - wlr_output_swap_buffers(wlr_output, NULL, NULL); + wlr_output_commit(wlr_output); } static void handle_cursor_motion(struct wl_listener *listener, void *data) { 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, diff --git a/examples/pointer.c b/examples/pointer.c index c7140d97..cf4b122d 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -98,11 +98,11 @@ void output_frame_notify(struct wl_listener *listener, void *data) { struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); assert(renderer); - wlr_output_make_current(wlr_output, NULL); + wlr_output_attach_render(wlr_output, NULL); wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); wlr_renderer_clear(renderer, state->clear_color); wlr_output_render_software_cursors(wlr_output, NULL); - wlr_output_swap_buffers(wlr_output, NULL, NULL); + wlr_output_commit(wlr_output); wlr_renderer_end(renderer); } diff --git a/examples/rotation.c b/examples/rotation.c index 7cf5727b..cfcd001b 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -60,7 +60,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { int32_t width, height; wlr_output_effective_resolution(wlr_output, &width, &height); - 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}); @@ -72,7 +72,7 @@ static 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); long ms = (now.tv_sec - sample->last_frame.tv_sec) * 1000 + (now.tv_nsec - sample->last_frame.tv_nsec) / 1000000; diff --git a/examples/simple.c b/examples/simple.c index e1c10906..27eb6c20 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -56,12 +56,12 @@ void output_frame_notify(struct wl_listener *listener, void *data) { sample->dec = inc; } - wlr_output_make_current(sample_output->output, NULL); + wlr_output_attach_render(sample_output->output, NULL); glClearColor(sample->color[0], sample->color[1], sample->color[2], 1.0); glClear(GL_COLOR_BUFFER_BIT); - wlr_output_swap_buffers(sample_output->output, NULL, NULL); + wlr_output_commit(sample_output->output); sample->last_frame = now; } diff --git a/examples/tablet.c b/examples/tablet.c index fad30d52..6df28586 100644 --- a/examples/tablet.c +++ b/examples/tablet.c @@ -86,7 +86,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { int32_t width, height; wlr_output_effective_resolution(wlr_output, &width, &height); - 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}); @@ -129,7 +129,7 @@ static 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); sample->last_frame = now; } diff --git a/examples/touch.c b/examples/touch.c index 9ed20a28..4ca9b993 100644 --- a/examples/touch.c +++ b/examples/touch.c @@ -73,7 +73,7 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { int32_t width, height; wlr_output_effective_resolution(wlr_output, &width, &height); - 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}); @@ -89,7 +89,7 @@ static 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); sample->last_frame = now; } |