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/dbus.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ui/dbus.c b/ui/dbus.c index 905ee6fea71b..81a4310082a2 100644 --- a/ui/dbus.c +++ b/ui/dbus.c @@ -47,9 +47,17 @@ static DBusDisplay *dbus_display; static QEMUGLContext dbus_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 bool -- 2.52.0
