[vlc-commits] gl: favor glx for vdpau chromas

Thomas Guillem git at videolan.org
Sat Sep 2 13:50:12 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jul 21 11:37:42 2017 +0200| [c26437784aedab329fe278129870fc173aa23b8c] | committer: Thomas Guillem

gl: favor glx for vdpau chromas

When using X11, favor glx instead of egl in order to use vdpau interop.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c26437784aedab329fe278129870fc173aa23b8c
---

 modules/video_output/opengl/display.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/opengl/display.c b/modules/video_output/opengl/display.c
index 063873372b..54d23c0d28 100644
--- a/modules/video_output/opengl/display.c
+++ b/modules/video_output/opengl/display.c
@@ -109,7 +109,33 @@ static int Open (vlc_object_t *obj)
         goto error;
     }
 
-    sys->gl = vlc_gl_Create (surface, API, "$" MODULE_VARNAME);
+    const char *gl_name = "$" MODULE_VARNAME;
+
+    /* VDPAU GL interop works only with GLX. Override the "gl" option to force
+     * it. */
+#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:
+            {
+                /* Force the option only if it was not previously set */
+                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;
 



More information about the vlc-commits mailing list