[vlc-devel] [PATCH] gl: favor glx for vdpau chromas

Thomas Guillem thomas at gllm.fr
Fri Jul 21 11:47:14 CEST 2017


When using X11, favor glx instead of egl in order to use vdpau interop.
---
 modules/video_output/opengl/display.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 63376f1cd8..0e3b5e39e7 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -103,7 +103,30 @@ static int Open (vlc_object_t *obj)
         goto error;
     }
 
-    sys->gl = vlc_gl_Create (surface, API, "$" MODULE_VARNAME);
+    const char *gl_name = "$" MODULE_VARNAME;
+#ifndef USE_OPENGL_ES2
+    if (surface->type == VOUT_WINDOW_TYPE_XID)
+    {
+        switch (vd->fmt.i_chroma)
+        {
+            case VLC_CODEC_VDPAU_VIDEO_444:
+            case VLC_CODEC_VDPAU_VIDEO_422:
+            case VLC_CODEC_VDPAU_VIDEO_420:
+            {
+                /* VDPAU GL interop works only with glx for now. */
+                char *str = var_InheritString(surface, MODULE_VARNAME);
+                if (str == NULL)
+                    gl_name = "glx";
+                free(str);
+                break;
+            }
+            default:
+                break;
+        }
+    }
+#endif
+
+    sys->gl = vlc_gl_Create (surface, API, gl_name);
     if (sys->gl == NULL)
         goto error;
 
-- 
2.11.0



More information about the vlc-devel mailing list