From db45d5215a7a58d874206ae985f5debde2cbb097 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 2 Dec 2022 15:32:22 +0000 Subject: [PATCH] GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue Closes #4499, #5387, and #5170 See merge request GNOME/gtk!5285 (cherry picked from commit a9c9678e1f617755368f16424a03ae1f2d2ced4e) Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/4499 Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/5170 Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/5387 Origin: upstream, 4.8.3, commit:b17ccd13e6ecc401bf9108d84ec089a62aae67c0 Gbp-Pq: Name GLX-Add-extra-glXMakeContextCurrent-call-to-work-around-a.patch --- gdk/x11/gdkglcontext-glx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gdk/x11/gdkglcontext-glx.c b/gdk/x11/gdkglcontext-glx.c index 42f9d0c286..6a8d978c94 100644 --- a/gdk/x11/gdkglcontext-glx.c +++ b/gdk/x11/gdkglcontext-glx.c @@ -232,6 +232,12 @@ gdk_x11_gl_context_glx_make_current (GdkGLContext *context, "Making GLX context %p current to drawable %lu", context, (unsigned long) drawable); + /* Work around a glitch, see + * https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5281 + */ + if (glXGetCurrentContext () != self->glx_context) + glXMakeContextCurrent (dpy, None, None, NULL); + if (!glXMakeContextCurrent (dpy, drawable, drawable, self->glx_context)) return FALSE; -- 2.30.2