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
This commit is contained in:
Simon Ser 2019-04-22 12:42:37 +03:00 committed by Drew DeVault
parent 56ceed38bf
commit 23e37e7b1d
12 changed files with 115 additions and 74 deletions

View file

@ -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);
}