From: Dongwon Kim <[email protected]> When an old EGL context is destroyed, its associated OpenGL textures and framebuffer resource IDs are already implicitly freed by the driver. However, the cached IDs and geometry attributes stored within the egl_fb structures remain stale and invalid for the new context.
Call egl_fb_destroy() on the guest, cursor, and window framebuffers in gd_egl_refresh() to safely clear these stale fields back to zero before they are re-initialized under the new current context. Cc: Marc-André Lureau <[email protected]> Cc: Philippe Mathieu-Daudé <[email protected]> Cc: Daniel P. Berrangé <[email protected]> Signed-off-by: Dongwon Kim <[email protected]> --- ui/gtk-egl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 7c5c9b2428..fd14b391ed 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -163,6 +163,12 @@ void gd_egl_refresh(DisplayChangeListener *dcl) surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds); } #ifdef CONFIG_GBM + + /* resetting old ids to 0 for new egl context */ + egl_fb_destroy(&vc->gfx.guest_fb); + egl_fb_destroy(&vc->gfx.cursor_fb); + egl_fb_destroy(&vc->gfx.win_fb); + if (vc->gfx.guest_fb.dmabuf) { egl_dmabuf_release_texture(vc->gfx.guest_fb.dmabuf); gd_egl_scanout_dmabuf(dcl, vc->gfx.guest_fb.dmabuf); -- 2.43.0
