From 09a8d2db05bff0526140187f68c39e68b706543f Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 11 Apr 2020 03:11:35 +0900 Subject: [PATCH] kmssink: Add support for P010 and P016 formats Support high bit-depth YUV formats Part-of: --- sys/kms/gstkmsallocator.c | 4 ++++ sys/kms/gstkmsutils.c | 10 ++++++++++ sys/kms/meson.build | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/kms/gstkmsallocator.c b/sys/kms/gstkmsallocator.c index 916326b..2ae22fc 100644 --- a/sys/kms/gstkmsallocator.c +++ b/sys/kms/gstkmsallocator.c @@ -151,6 +151,10 @@ extrapolate_stride (const GstVideoFormatInfo * finfo, gint plane, gint stride) case GST_VIDEO_FORMAT_NV16: case GST_VIDEO_FORMAT_NV61: case GST_VIDEO_FORMAT_NV24: + case GST_VIDEO_FORMAT_P010_10LE: + case GST_VIDEO_FORMAT_P010_10BE: + case GST_VIDEO_FORMAT_P016_LE: + case GST_VIDEO_FORMAT_P016_BE: estride = (plane == 0 ? 1 : 2) * GST_VIDEO_FORMAT_INFO_SCALE_WIDTH (finfo, plane, stride); break; diff --git a/sys/kms/gstkmsutils.c b/sys/kms/gstkmsutils.c index 90311f3..1dd19ee 100644 --- a/sys/kms/gstkmsutils.c +++ b/sys/kms/gstkmsutils.c @@ -49,6 +49,8 @@ static const struct DEF_FMT (XBGR8888, RGBx), DEF_FMT (BGR888, RGB), DEF_FMT (RGB888, BGR), + DEF_FMT (P010, P010_10LE), + DEF_FMT (P016, P016_LE), #else DEF_FMT (ARGB8888, ARGB), DEF_FMT (XRGB8888, xRGB), @@ -56,6 +58,8 @@ static const struct DEF_FMT (XBGR8888, xBGR), DEF_FMT (RGB888, RGB), DEF_FMT (BGR888, BGR), + DEF_FMT (P010, P010_10BE), + DEF_FMT (P016, P016_BE), #endif DEF_FMT (UYVY, UYVY), DEF_FMT (YUYV, YUY2), @@ -111,9 +115,13 @@ gst_drm_bpp_from_drm (guint32 drmfmt) case DRM_FORMAT_NV16: bpp = 8; break; + case DRM_FORMAT_P010: + bpp = 10; + break; case DRM_FORMAT_UYVY: case DRM_FORMAT_YUYV: case DRM_FORMAT_YVYU: + case DRM_FORMAT_P016: bpp = 16; break; case DRM_FORMAT_BGR888: @@ -139,6 +147,8 @@ gst_drm_height_from_drm (guint32 drmfmt, guint32 height) case DRM_FORMAT_YUV422: case DRM_FORMAT_NV12: case DRM_FORMAT_NV21: + case DRM_FORMAT_P010: + case DRM_FORMAT_P016: ret = height * 3 / 2; break; case DRM_FORMAT_NV16: diff --git a/sys/kms/meson.build b/sys/kms/meson.build index 0223f28..20298b6 100644 --- a/sys/kms/meson.build +++ b/sys/kms/meson.build @@ -9,7 +9,7 @@ if host_system != 'linux' subdir_done() endif -libdrm_dep = dependency('libdrm', version : '>= 2.4.55', +libdrm_dep = dependency('libdrm', version : '>= 2.4.98', required : get_option('kms'), fallback: ['libdrm', 'ext_libdrm']) if libdrm_dep.found() -- 2.7.4