output: rename impl->rollback to rollback_render

The output backend API is now mostly state-less thanks to the atomic
hooks (commit and test). There is one exception though: attach_render.
This function makes the rendering context current. However sometimes the
compositor might decide not to render after attach_render (e.g. when
there's nothing new to render to the back buffer). Thus
wlr_output_rollback has been introduced to revert the pending state.

Because the output backend API is mostly state-less, the only thing
wlr_output_impl.rollback needs to do is revert the current rendering
context. Rename the function to rollback_render to make this clear. Add
a check in the common wlr_output code to only call rollback_render when
attach_buffer has been previously called.

On the long term, we'll be able to remove attach_render and
rollback_render together.
This commit is contained in:
Simon Ser 2020-06-19 15:49:55 +02:00 committed by Drew DeVault
parent 58df3eda9f
commit bf93d2e67c
6 changed files with 18 additions and 17 deletions

View file

@ -140,13 +140,12 @@ static bool output_commit(struct wlr_output *wlr_output) {
return true;
}
static void output_rollback(struct wlr_output *wlr_output) {
static void output_rollback_render(struct wlr_output *wlr_output) {
struct wlr_headless_output *output =
headless_output_from_output(wlr_output);
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
wlr_egl_unset_current(output->backend->egl);
}
assert(wlr_egl_is_current(output->backend->egl));
glBindFramebuffer(GL_FRAMEBUFFER, 0);
wlr_egl_unset_current(output->backend->egl);
}
static void output_destroy(struct wlr_output *wlr_output) {
@ -162,7 +161,7 @@ static const struct wlr_output_impl output_impl = {
.destroy = output_destroy,
.attach_render = output_attach_render,
.commit = output_commit,
.rollback = output_rollback,
.rollback_render = output_rollback_render,
};
bool wlr_output_is_headless(struct wlr_output *wlr_output) {