From: Robert Mader Date: Fri, 8 Nov 2024 11:38:09 +0000 (+0100) Subject: v4l2codecs: format: Add V4L2_PIX_FMT_NC12 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b275f63b13185ea815c96d184326c8281c876a6c;p=platform%2Fupstream%2Fgstreamer.git v4l2codecs: format: Add V4L2_PIX_FMT_NC12 Which is used by the Raspberry Pi 4 and 5 for 8-bit HEVC. Adding it here in order to show-case how the V4L2<->DRM translation is supposed to work. Part-of: --- diff --git a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c index 55ad6c198c..382a0bd807 100644 --- a/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c +++ b/subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2format.c @@ -24,6 +24,10 @@ #define GST_CAT_DEFAULT gstv4l2codecs_debug GST_DEBUG_CATEGORY_EXTERN (gstv4l2codecs_debug); +#ifndef V4L2_PIX_FMT_NC12 +#define V4L2_PIX_FMT_NC12 v4l2_fourcc('N', 'C', '1', '2') /* Y/CbCr 4:2:0 (128b cols) */ +#endif + typedef struct { guint32 v4l2_pix_fmt; @@ -45,6 +49,7 @@ static const GstV4l2FormatDesc gst_v4l2_descriptions[] = { {V4L2_PIX_FMT_SUNXI_TILED_NV12, GST_VIDEO_FORMAT_NV12_32L32, DRM_FORMAT_INVALID, DRM_FORMAT_MOD_INVALID, 0}, {V4L2_PIX_FMT_YUV420M, GST_VIDEO_FORMAT_I420, DRM_FORMAT_INVALID, DRM_FORMAT_MOD_INVALID, 0}, {V4L2_PIX_FMT_YUYV, GST_VIDEO_FORMAT_YUY2, DRM_FORMAT_INVALID, DRM_FORMAT_MOD_INVALID, 0}, + {V4L2_PIX_FMT_NC12, GST_VIDEO_FORMAT_UNKNOWN, DRM_FORMAT_NV12, DRM_FORMAT_MOD_BROADCOM_SAND128, 2}, }; /* *INDENT-ON* */ #define GST_V4L2_FORMAT_DESC_COUNT (G_N_ELEMENTS (gst_v4l2_descriptions)) @@ -193,6 +198,14 @@ gst_v4l2_format_to_dma_drm_info (struct v4l2_format *fmt, n_planes = 1; } + if (drm_fourcc == DRM_FORMAT_NV12 + && drm_mod == DRM_FORMAT_MOD_BROADCOM_SAND128) { + out_drm_info->vinfo.offset[1] = pix_mp->height * 128; + out_drm_info->vinfo.stride[0] = pix_mp->plane_fmt[0].bytesperline; + out_drm_info->vinfo.stride[1] = pix_mp->plane_fmt[0].bytesperline; + return TRUE; + } + /* * When single allocation formats are used for planar formats we need to * extrapolate the per-plane stride. Do this check once to prevent