aboutsummaryrefslogtreecommitdiff
path: root/ui/gtk-egl.c
diff options
context:
space:
mode:
authorDongwon Kim <dongwon.kim@intel.com>2023-06-28 12:15:04 -0700
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-07-17 15:20:56 +0400
commit83b4b236ed54dab35f1b821ee2b6f3101c45c8cc (patch)
tree52fbb7ff1df6df9ff53ab0c20493c8ce33f6f512 /ui/gtk-egl.c
parentd921fea338c1059a27ce7b75309d7a2e485f710b (diff)
ui/gtk: Make sure the right EGL context is currently bound
Observed a wrong context is bound when changing the scanout mode. To prevent problem, it is needed to make sure to bind the right context in gtk_egl_set_scanout_mode/gtk_gl_area_set_scanout_mode as well as unbind one in the end of gd_egl_update/gd_gl_area_update. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Vivek Kasireddy <vivek.kasireddy@intel.com> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20230628191504.17185-1-dongwon.kim@intel.com>
Diffstat (limited to 'ui/gtk-egl.c')
-rw-r--r--ui/gtk-egl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index d59b8cd7d7..42db1bb6cf 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -32,6 +32,8 @@ static void gtk_egl_set_scanout_mode(VirtualConsole *vc, bool scanout)
vc->gfx.scanout_mode = scanout;
if (!vc->gfx.scanout_mode) {
+ eglMakeCurrent(qemu_egl_display, vc->gfx.esurface,
+ vc->gfx.esurface, vc->gfx.ectx);
egl_fb_destroy(&vc->gfx.guest_fb);
if (vc->gfx.surface) {
surface_gl_destroy_texture(vc->gfx.gls, vc->gfx.ds);
@@ -135,6 +137,8 @@ void gd_egl_update(DisplayChangeListener *dcl,
vc->gfx.esurface, vc->gfx.ectx);
surface_gl_update_texture(vc->gfx.gls, vc->gfx.ds, x, y, w, h);
vc->gfx.glupdates++;
+ eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE,
+ EGL_NO_SURFACE, EGL_NO_CONTEXT);
}
void gd_egl_refresh(DisplayChangeListener *dcl)