Don't change bound GL context when creating new GL context for consistency with behavior expected by virglrenderer that assumes context-creation doesn't switch context. eglCreateContext() doesn't require GL context to be bound when it's invoked. Update qemu_egl_create_context() to spawn GL sub-contexts from a common parent GL context instead of a currently-bound context.
Signed-off-by: Dmitry Osipenko <[email protected]> --- ui/dbus.c | 2 -- ui/egl-context.c | 3 +-- ui/egl-headless.c | 2 -- ui/gtk-egl.c | 4 ---- ui/spice-display.c | 2 -- 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/ui/dbus.c b/ui/dbus.c index 905ee6fea71b..750a064e3fbf 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -47,8 +47,6 @@ static DBusDisplay *dbus_display; static QEMUGLContext dbus_create_context(DisplayGLCtx *dgc, QEMUGLParams *params) { - eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, - qemu_egl_rn_ctx); return qemu_egl_create_context(dgc, params); } diff --git a/ui/egl-context.c b/ui/egl-context.c index aed3e3ba1f3f..f9a998768beb 100644 --- a/ui/egl-context.c +++ b/ui/egl-context.c @@ -19,8 +19,7 @@ QEMUGLContext qemu_egl_create_context(DisplayGLCtx *dgc, }; bool gles = (qemu_egl_mode == DISPLAY_GL_MODE_ES); - ctx = eglCreateContext(qemu_egl_display, qemu_egl_config, - eglGetCurrentContext(), + ctx = eglCreateContext(qemu_egl_display, qemu_egl_config, qemu_egl_rn_ctx, gles ? ctx_att_gles : ctx_att_core); return ctx; } diff --git a/ui/egl-headless.c b/ui/egl-headless.c index 1f6b845500dd..19955792ac95 100644 --- a/ui/egl-headless.c +++ b/ui/egl-headless.c @@ -42,8 +42,6 @@ static void egl_gfx_switch(DisplayChangeListener *dcl, static QEMUGLContext egl_create_context(DisplayGLCtx *dgc, QEMUGLParams *params) { - eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, - qemu_egl_rn_ctx); return qemu_egl_create_context(dgc, params); } diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 0dbb429958e5..6b3519419039 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -217,10 +217,6 @@ void gd_egl_switch(DisplayChangeListener *dcl, QEMUGLContext gd_egl_create_context(DisplayGLCtx *dgc, QEMUGLParams *params) { - VirtualConsole *vc = container_of(dgc, VirtualConsole, gfx.dgc); - - eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, - vc->gfx.esurface, vc->gfx.ectx); return qemu_egl_create_context(dgc, params); } diff --git a/ui/spice-display.c b/ui/spice-display.c index 28399f8a8174..ae0f771c2a38 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -1033,8 +1033,6 @@ static void spice_gl_switch(DisplayChangeListener *dcl, static QEMUGLContext qemu_spice_gl_create_context(DisplayGLCtx *dgc, QEMUGLParams *params) { - eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, - qemu_egl_rn_ctx); return qemu_egl_create_context(dgc, params); } -- 2.52.0
