mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
backend/drm: unset current surface before importing
drm_fb_import_wlr may need to change the current EGL context. For instance by calling drm_fb_clear, which calls wlr_buffer_unlock, which may destroy a buffer if the cursor swapchain size has changed, which calls gles2's destroy_buffer, which calls glDeleteFramebuffers. Closes: https://github.com/swaywm/wlroots/issues/2479
This commit is contained in:
parent
c9760569ae
commit
e69bbfd0d6
1 changed files with 7 additions and 4 deletions
|
@ -322,12 +322,15 @@ void drm_fb_clear(struct wlr_drm_fb *fb) {
|
||||||
bool drm_fb_lock_surface(struct wlr_drm_fb *fb, struct wlr_drm_surface *surf) {
|
bool drm_fb_lock_surface(struct wlr_drm_fb *fb, struct wlr_drm_surface *surf) {
|
||||||
assert(surf->back_buffer != NULL);
|
assert(surf->back_buffer != NULL);
|
||||||
|
|
||||||
if (!drm_fb_import_wlr(fb, surf->renderer, surf->back_buffer, NULL)) {
|
struct wlr_buffer *buffer = wlr_buffer_lock(surf->back_buffer);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Unset the current EGL context ASAP, because other operations may require
|
||||||
|
// making another context current.
|
||||||
drm_surface_unset_current(surf);
|
drm_surface_unset_current(surf);
|
||||||
return true;
|
|
||||||
|
bool ok = drm_fb_import_wlr(fb, surf->renderer, buffer, NULL);
|
||||||
|
wlr_buffer_unlock(buffer);
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool drm_fb_import_wlr(struct wlr_drm_fb *fb, struct wlr_drm_renderer *renderer,
|
bool drm_fb_import_wlr(struct wlr_drm_fb *fb, struct wlr_drm_renderer *renderer,
|
||||||
|
|
Loading…
Reference in a new issue