[FFmpeg-devel] [PATCH] kmsgrab: fix build error when use old libdrm

Mark Thompson sw at jkqxz.net
Thu Sep 14 11:12:50 EEST 2017


On 14/09/17 01:34, Jun Zhao wrote:
> From 8c7ddfcabf686f213aa59544d90055d20bdac0f7 Mon Sep 17 00:00:00 2001
> From: Jun Zhao <jun.zhao at intel.com>
> Date: Wed, 13 Sep 2017 20:21:38 -0400
> Subject: [PATCH] kmsgrab: fix build error when use old libdrm
> 
> DRM_FORMAT_R16 adding from libdrm 2.4.82, fix the build error
> when libdrm < 2.4.82.
> 
> Signed-off-by: Jun Zhao <jun.zhao at intel.com>
> ---
>  libavdevice/kmsgrab.c       | 2 ++
>  libavutil/hwcontext_vaapi.c | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavdevice/kmsgrab.c b/libavdevice/kmsgrab.c
> index d0b9cf5001..49eb44f6f2 100644
> --- a/libavdevice/kmsgrab.c
> +++ b/libavdevice/kmsgrab.c
> @@ -203,7 +203,9 @@ static const struct {
>      uint32_t drm_format;
>  } kmsgrab_formats[] = {
>      { AV_PIX_FMT_GRAY8,    DRM_FORMAT_R8       },
> +#ifdef DRM_FORMAT_R16
>      { AV_PIX_FMT_GRAY16LE, DRM_FORMAT_R16      },
> +#endif
>      { AV_PIX_FMT_RGB24,    DRM_FORMAT_RGB888   },
>      { AV_PIX_FMT_BGR24,    DRM_FORMAT_BGR888   },
>      { AV_PIX_FMT_0RGB,     DRM_FORMAT_XRGB8888 },
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 2cc6f26715..837b79da11 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -920,7 +920,7 @@ static const struct {
>  } vaapi_drm_format_map[] = {
>      DRM_MAP(NV12, 2, DRM_FORMAT_R8,  DRM_FORMAT_RG88),
>      DRM_MAP(NV12, 1, DRM_FORMAT_NV12),
> -#ifdef VA_FOURCC_P010
> +#if defined(VA_FOURCC_P010) && defined(DRM_FORMAT_R16)
>      DRM_MAP(P010, 2, DRM_FORMAT_R16, DRM_FORMAT_RG1616),
>  #endif
>      DRM_MAP(BGRA, 1, DRM_FORMAT_BGRA8888),
> -- 
> 2.11.0
> 

Hmm, yeah.  Thanks for noticing this - let me think about it a bit further, I imagine there are more cases than just this one.  (It isn't autodetected so nothing is directly broken.)

- Mark


More information about the ffmpeg-devel mailing list