[vlc-commits] [Git][videolan/vlc][master] 2 commits: egl/wayland: add EGL version 1.5 support

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Tue May 31 19:21:37 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
167ad583 by Rémi Denis-Courmont at 2022-05-31T21:43:35+03:00
egl/wayland: add EGL version 1.5 support

- - - - -
9845fe4a by Rémi Denis-Courmont at 2022-05-31T21:43:35+03:00
egl/x11: add EGL version 1.5 support

- - - - -


1 changed file:

- modules/video_output/opengl/egl.c


Changes:

=====================================
modules/video_output/opengl/egl.c
=====================================
@@ -130,7 +130,6 @@ static void DestroySurface(vlc_gl_t *gl)
 static EGLSurface CreateSurface(vlc_gl_t *gl, EGLDisplay dpy, EGLConfig config,
                                 unsigned int width, unsigned int height)
 {
-# ifdef EGL_EXT_platform_base
     vlc_gl_sys_t *sys = gl->sys;
     EGLSurface surface;
 
@@ -138,16 +137,22 @@ static EGLSurface CreateSurface(vlc_gl_t *gl, EGLDisplay dpy, EGLConfig config,
     if (sys->window == NULL)
         return EGL_NO_SURFACE;
 
+# if defined(EGL_VERSION_1_5)
+    assert(CheckClientExt("EGL_KHR_platform_wayland"));
+    surface = eglCreatePlatformWindowSurface(dpy, config, sys->window, NULL);
+
+# elif defined(EGL_EXT_platform_base)
     assert(CheckClientExt("EGL_EXT_platform_wayland"));
     surface = createPlatformWindowSurfaceEXT(dpy, config, sys->window, NULL);
 
+# else
+    surface = EGL_NO_SURFACE;
+# endif
+
     if (surface == EGL_NO_SURFACE)
         wl_egl_window_destroy(sys->window);
 
     return surface;
-# else
-    return EGL_NO_SURFACE;
-# endif
 }
 
 static void ReleaseDisplay(vlc_gl_t *gl)
@@ -157,27 +162,37 @@ static void ReleaseDisplay(vlc_gl_t *gl)
 
 static EGLDisplay OpenDisplay(vlc_gl_t *gl)
 {
-# ifdef EGL_EXT_platform_wayland
     vlc_window_t *surface = gl->surface;
-    EGLint attrs[] = {
-        EGL_NONE, EGL_TRUE,
-        EGL_NONE
-    };
+    EGLint ref_attr = EGL_NONE;
 
-#  ifdef EGL_KHR_display_reference
+# ifdef EGL_KHR_display_reference
     if (CheckClientExt("EGL_KHR_display_reference"))
-        attrs[0] = EGL_TRACK_REFERENCES_KHR;
-#  endif
+        ref_attr = EGL_TRACK_REFERENCES_KHR;
+# endif
 
     if (surface->type != VLC_WINDOW_TYPE_WAYLAND)
         return EGL_NO_DISPLAY;
-    if (!CheckClientExt("EGL_EXT_platform_wayland"))
-        return EGL_NO_DISPLAY;
-    return getPlatformDisplayEXT(EGL_PLATFORM_WAYLAND_EXT, surface->display.wl,
-                                 attrs);
-# else
-    return EGL_NO_DISPLAY;
+
+# if defined(EGL_VERSION_1_5)
+#  ifdef EGL_KHR_platform_wayland
+    if (CheckClientExt("EGL_KHR_platform_wayland")) {
+        const EGLAttrib attrs[] = { ref_attr, EGL_TRUE, EGL_NONE };
+
+        return eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR,
+                                     surface->display.wl, attrs);
+    }
+#  endif
+
+# elif defined(EGL_EXT_platform_wayland)
+    if (CheckClientExt("EGL_EXT_platform_wayland")) {
+        const EGLint attrs[] = { ref_attr, EGL_TRUE, EGL_NONE };
+
+        return getPlatformDisplayEXT(EGL_PLATFORM_WAYLAND_EXT,
+                                     surface->display.wl, attrs);
+    }
+
 # endif
+    return EGL_NO_DISPLAY;
 }
 
 #elif defined(USE_PLATFORM_X11)
@@ -215,9 +230,14 @@ static EGLSurface CreateSurface(vlc_gl_t *gl, EGLDisplay dpy, EGLConfig config,
     XResizeWindow(sys->x11, win, width, height);
     XMapWindow(sys->x11, win);
 
-# ifdef EGL_EXT_platform_base
+# if defined(EGL_VERSION_1_5)
+    if (CheckClientExt("EGL_KHR_platform_x11"))
+        return eglCreatePlatformWindowSurface(dpy, config, &win, NULL);
+
+# elif defined(EGL_EXT_platform_base)
     if (CheckClientExt("EGL_EXT_platform_x11"))
         return createPlatformWindowSurfaceEXT(dpy, config, &win, NULL);
+
 # endif
     return eglCreateWindowSurface(dpy, config, win, NULL);
 }
@@ -249,7 +269,18 @@ static EGLDisplay OpenDisplay(vlc_gl_t *gl)
     EGLDisplay display;
     int snum = XScreenNumberOfScreen(wa.screen);
 
-# ifdef EGL_EXT_platform_x11
+# if defined(EGL_VERSION_1_5)
+#  ifdef EGL_KHR_paltform_x11
+    if (CheckClientExt("EGL_KHR_platform_x11")) {
+        const EGLAttrib attrs[] = {
+            EGL_PLATFORM_X11_SCREEN_KHR, snum,
+            EGL_NONE
+        };
+
+        display = getPlatformDisplayEXT(EGL_PLATFORM_X11_KHR, x11, attrs);
+    } else
+#  endif
+# elif defined(EGL_EXT_platform_x11)
     if (CheckClientExt("EGL_EXT_platform_x11")) {
         const EGLint attrs[] = {
             EGL_PLATFORM_X11_SCREEN_EXT, snum,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8ff0e6267b4f3b76e2526192a98af68fcd6aa953...9845fe4a2f543457dc183eb9af838da874974981

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8ff0e6267b4f3b76e2526192a98af68fcd6aa953...9845fe4a2f543457dc183eb9af838da874974981
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list