render/egl: introduce wlr_egl_unset_current

This function can be called after wlr_egl_make_current to cleanup the
EGL context. This avoids having lingering EGL contexts that make things
work by chance.

Closes: https://github.com/swaywm/wlroots/issues/2197
This commit is contained in:
Simon Ser 2020-05-19 11:54:59 +02:00 committed by Drew DeVault
parent 781ed1ff02
commit 1edc42157b
8 changed files with 62 additions and 29 deletions

View file

@ -300,7 +300,7 @@ static bool output_commit(struct wlr_output *wlr_output) {
}
}
wlr_egl_make_current(&output->backend->egl, EGL_NO_SURFACE, NULL);
wlr_egl_unset_current(&output->backend->egl);
return true;
}
@ -308,7 +308,7 @@ static bool output_commit(struct wlr_output *wlr_output) {
static void output_rollback(struct wlr_output *wlr_output) {
struct wlr_wl_output *output =
get_wl_output_from_output(wlr_output);
wlr_egl_make_current(&output->backend->egl, EGL_NO_SURFACE, NULL);
wlr_egl_unset_current(&output->backend->egl);
}
static bool output_set_cursor(struct wlr_output *wlr_output,
@ -377,6 +377,7 @@ static bool output_set_cursor(struct wlr_output *wlr_output,
wlr_egl_swap_buffers(&backend->egl, egl_surface, NULL);
wlr_egl_destroy_surface(&backend->egl, egl_surface);
wlr_egl_unset_current(&backend->egl);
} else {
wl_surface_attach(surface, NULL, 0, 0);
wl_surface_commit(surface);
@ -583,6 +584,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) {
NULL)) {
goto error;
}
wlr_egl_unset_current(&output->backend->egl);
wl_list_insert(&backend->outputs, &output->link);
wlr_output_update_enabled(wlr_output, true);