Get currently bound GL context when creating new GL context and restore it after the creation for consistency with behavior expected by virglrenderer that assumes context-creation doesn't switch context.
Signed-off-by: Dmitry Osipenko <[email protected]> --- ui/spice-display.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index 28399f8a8174..c26c935456ff 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -1033,9 +1033,17 @@ static void spice_gl_switch(DisplayChangeListener *dcl, static QEMUGLContext qemu_spice_gl_create_context(DisplayGLCtx *dgc, QEMUGLParams *params) { + QEMUGLContext ctx, current_context = eglGetCurrentContext(); + eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, qemu_egl_rn_ctx); - return qemu_egl_create_context(dgc, params); + + ctx = qemu_egl_create_context(dgc, params); + + eglMakeCurrent(qemu_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, + current_context); + + return ctx; } static void qemu_spice_gl_scanout_disable(DisplayChangeListener *dcl) -- 2.52.0
