[vlc-commits] [Git][videolan/vlc][master] 2 commits: egl: Fix restoring of context after buffer swap.

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu May 7 08:21:36 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
7937d61c by Jeffrey Knockel at 2026-05-07T07:57:26+00:00
egl: Fix restoring of context after buffer swap.

Previously the order of the draw and read surfaces were wrong and the
EGL display was not restored.

- - - - -
336ea3d0 by Jeffrey Knockel at 2026-05-07T07:57:26+00:00
egl: Use EGL constants instead of NULL

- - - - -


1 changed file:

- modules/video_output/opengl/egl.c


Changes:

=====================================
modules/video_output/opengl/egl.c
=====================================
@@ -223,7 +223,7 @@ static void Resize (vlc_gl_t *gl, unsigned width, unsigned height)
         if (old_display != EGL_NO_DISPLAY)
             eglMakeCurrent(old_display, old_draw, old_read, old_ctx);
         else
-            eglMakeCurrent(sys->display, NULL, NULL, NULL);
+            eglMakeCurrent(sys->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
     }
     if (LastKnownRequestProcessed(sys->x11) - init_serial < resize_serial - init_serial)
         XSync(sys->x11, False);
@@ -586,13 +586,17 @@ static void SwapBuffers (vlc_gl_t *gl)
 
     if (!sys->is_current)
     {
+        EGLDisplay previous_display = eglGetCurrentDisplay();
         EGLSurface s_read = eglGetCurrentSurface(EGL_READ);
         EGLSurface s_draw = eglGetCurrentSurface(EGL_DRAW);
         EGLContext previous_context = eglGetCurrentContext();
 
         eglMakeCurrent(sys->display, sys->surface, sys->surface, sys->context);
         eglSwapBuffers (sys->display, sys->surface);
-        eglMakeCurrent(sys->display, s_read, s_draw, previous_context);
+        if (previous_display != EGL_NO_DISPLAY)
+            eglMakeCurrent(previous_display, s_draw, s_read, previous_context);
+        else
+            eglMakeCurrent(sys->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
     }
     else
         eglSwapBuffers (sys->display, sys->surface);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7a879728bd90cf577d0f688acc0465e70280ee05...336ea3d08d807f693654526f2ff962165dcb5e98

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7a879728bd90cf577d0f688acc0465e70280ee05...336ea3d08d807f693654526f2ff962165dcb5e98
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list