[vlc-devel] [PATCH] vaapi-drm: try the render node before the card node

Rémi Denis-Courmont remi at remlab.net
Fri Nov 25 20:59:44 CET 2016


Le perjantaina 25. marraskuuta 2016, 16.13.20 EET Mathieu Velten a écrit :
> This patch make it work with Wayland on Fedora 25.
> ---
>  modules/codec/avcodec/vaapi.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c
> index 8671139..03faf20 100644
> --- a/modules/codec/avcodec/vaapi.c
> +++ b/modules/codec/avcodec/vaapi.c
> @@ -356,14 +356,24 @@ static int Create( vlc_va_t *va, AVCodecContext *ctx,
> enum PixelFormat pix_fmt, sys->hw_ctx.display =
> vaGetDisplay(sys->p_display_x11);
>  #endif
>  #ifdef VLC_VA_BACKEND_DRM
> -    sys->drm_fd = vlc_open("/dev/dri/card0", O_RDWR);
> -    if( sys->drm_fd == -1 )
> -    {
> -        msg_Err( va, "Could not access rendering device: %m" );
> -        goto error;
> -    }
> +    static const char *drm_device_paths[] = {
> +        "/dev/dri/renderD128",
> +        "/dev/dri/card0",
> +        NULL
> +    };

Missing const.

> +
> +    for (int i = 0; drm_device_paths[i]; i++) {

Could use ARRAY_SIZE.

> +        sys->drm_fd = vlc_open(drm_device_paths[i], O_RDWR);
> +        if (sys->drm_fd < 0)
> +            continue;
> 
> -    sys->hw_ctx.display = vaGetDisplayDRM(sys->drm_fd);
> +        sys->hw_ctx.display = vaGetDisplayDRM(sys->drm_fd);
> +        if (sys->hw_ctx.display)
> +            break;
> +
> +        vlc_close(sys->drm_fd);
> +        sys->drm_fd = -1;
> +    }
>  #endif
>      if (sys->hw_ctx.display == NULL)
>      {


-- 
Rémi Denis-Courmont
https://www.remlab.net/



More information about the vlc-devel mailing list