[PATCH] ui/gtk-egl: egl context needs to be unbound in the end of gd_egl_switch

Dongwon Kim posted 1 patch 1 year, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220928215805.4661-1-dongwon.kim@intel.com
Maintainers: Gerd Hoffmann <kraxel@redhat.com>
ui/gtk-egl.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] ui/gtk-egl: egl context needs to be unbound in the end of gd_egl_switch
Posted by Dongwon Kim 1 year, 7 months ago
A thread often fails to bind an egl context to itself after guest VM is
rebooted because the context is still owned by another thread. It is not
very clear what condition makes this happen but this can be prevented
by unbinding the context from the thread in the end of gd_egl_switch.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
 ui/gtk-egl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index b5bffbab25..35f917ceb1 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -195,6 +195,9 @@ void gd_egl_switch(DisplayChangeListener *dcl,
     if (resized) {
         gd_update_windowsize(vc);
     }
+
+    eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
+                   EGL_NO_CONTEXT);
 }
 
 QEMUGLContext gd_egl_create_context(DisplayGLCtx *dgc,
-- 
2.20.1
Re: [PATCH] ui/gtk-egl: egl context needs to be unbound in the end of gd_egl_switch
Posted by Gerd Hoffmann 1 year, 7 months ago
On Wed, Sep 28, 2022 at 02:58:05PM -0700, Dongwon Kim wrote:
> A thread often fails to bind an egl context to itself after guest VM is
> rebooted because the context is still owned by another thread. It is not
> very clear what condition makes this happen but this can be prevented
> by unbinding the context from the thread in the end of gd_egl_switch.

Added to queue,

thanks,
  Gerd