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

Rémi Denis-Courmont remi at remlab.net
Sun Jul 23 19:26:47 CEST 2017


Le perjantaina 21. heinäkuuta 2017, 11.47.14 EEST Thomas Guillem a écrit :
> 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;
> +        }
> +    }

Overriding the module preference is a terrible idea. Sooner or later, somebody 
will assume the variable works, but it won't. E.g. if LibVLC gained callbacks 
for custom GL context.

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list