[{"id":31298,"web_url":"https://patchwork.libcamera.org/comment/31298/","msgid":"<20240923091734.GB8227@pendragon.ideasonboard.com>","date":"2024-09-23T09:17:34","subject":"Re: [PATCH 1/1] libcamera: Add formats introduced by MTK platform","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Harvey and Han-Lin,\n\nThank you for the patch.\n\nOn Mon, Sep 23, 2024 at 09:08:53AM +0000, Harvey Yang wrote:\n> From: Han-Lin Chen <hanlinchen@chromium.org>\n> \n> The patch adds the following formats.\n> \n>   - GREY\n>   - SBGGR10_MTISP\n>   - SGBRG10_MTISP\n>   - SGRBG10_MTISP\n>   - SRGGB10_MTISP\n>   - NV12_10P_MTISP\n>   - NV12_12P_MTISP\n>   - MTFP_MTISP\n>   - MTFA_MTISP\n>   - MTFF_MTISP\n>   - MTFD_MTISP\n>   - MTFS_MTISP\n>   - MTFR_MTISP\n>   - MTSR_MTISP\n>   - WARP2P_MTISP\n>   - Y8_MTISP\n>   - Y16_MTISP\n>   - Y32_MTISP\n> \n> Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n> Co-developed-by: Xing Gu <xinggu@chromium.org>\n> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n> ---\n>  include/linux/drm_fourcc.h |  26 +++++\n>  include/linux/videodev2.h  |  22 ++++\n>  src/libcamera/formats.cpp  | 203 +++++++++++++++++++++++++++++++++++++\n>  src/libcamera/formats.yaml |  38 +++++++\n>  4 files changed, 289 insertions(+)\n> \n> diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h\n> index db679877..ca00a3c7 100644\n> --- a/include/linux/drm_fourcc.h\n> +++ b/include/linux/drm_fourcc.h\n> @@ -466,6 +466,32 @@ extern \"C\" {\n>  #define DRM_FORMAT_SGBRG16\tfourcc_code('G', 'B', '1', '6')\n>  #define DRM_FORMAT_SBGGR16\tfourcc_code('B', 'Y', 'R', '2')\n>  \n> +/* MTK extention */\n> +\n> +#define DRM_FORMAT_MTISP_SBGGR10 fourcc_code('M', 'B', 'B', 'A')\n> +#define DRM_FORMAT_MTISP_SGBRG10 fourcc_code('M', 'B', 'G', 'A')\n> +#define DRM_FORMAT_MTISP_SGRBG10 fourcc_code('M', 'B', 'g', 'A')\n> +#define DRM_FORMAT_MTISP_SRGGB10 fourcc_code('M', 'B', 'R', 'A')\n\nHave you considered using modifiers to describe the MTK ISP packing\ninstead of adding 4CCs ?\n\n> +\n> +#define DRM_FORMAT_MTISP_NV12_10P fourcc_code('1', '2', 'A', 'P')\n> +#define DRM_FORMAT_MTISP_NV12_12P fourcc_code('1', '2', 'C', 'P')\n> +\n> +#define DRM_FORMAT_GREY fourcc_code('G', 'R', 'E', 'Y')\n\nI don't think this one is needed, R8 should fit the purpose.\n\n> +\n> +#define DRM_FORMAT_MTISP_PARAMS fourcc_code('M', 'T', 'f', 'p')\n> +#define DRM_FORMAT_MTISP_3A fourcc_code('M', 'T', 'f', 'a')\n> +#define DRM_FORMAT_MTISP_AF fourcc_code('M', 'T', 'f', 'f')\n> +\n> +#define DRM_FORMAT_MTISP_DESC fourcc_code('M', 'T', 'f', 'd')\n> +#define DRM_FORMAT_MTISP_SD fourcc_code('M', 'T', 'f', 's')\n> +#define DRM_FORMAT_MTISP_DESC_NORM fourcc_code('M', 'T', 'f', 'r')\n> +#define DRM_FORMAT_MTISP_SDNORM fourcc_code('M', 'T', 's', 'r')\n> +\n> +#define DRM_FORMAT_MTISP_WARP2P fourcc_code('M', 'W', '2', 'P')\n> +#define DRM_FORMAT_MTISP_Y8 fourcc_code('M', 'T', '0', '8')\n> +#define DRM_FORMAT_MTISP_Y16 fourcc_code('M', 'T', '1', '6')\n> +#define DRM_FORMAT_MTISP_Y32 fourcc_code('M', 'T', '3', '2')\n\nAll these formats, along with the V4L2 formats, need to be submitted to\nthe Linux kernel for review before we can merge them in libcamera.\n\n> +\n>  /*\n>   * Format Modifiers:\n>   *\n> diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\n> index 3829c0b6..2cee0b86 100644\n> --- a/include/linux/videodev2.h\n> +++ b/include/linux/videodev2.h\n> @@ -789,6 +789,28 @@ struct v4l2_pix_format {\n>  #define V4L2_PIX_FMT_IPU3_SGRBG10\tv4l2_fourcc('i', 'p', '3', 'G') /* IPU3 packed 10-bit GRBG bayer */\n>  #define V4L2_PIX_FMT_IPU3_SRGGB10\tv4l2_fourcc('i', 'p', '3', 'r') /* IPU3 packed 10-bit RGGB bayer */\n>  \n> +#define V4L2_PIX_FMT_MTISP_SBGGR10 v4l2_fourcc('M', 'B', 'B', 'A')\n> +#define V4L2_PIX_FMT_MTISP_SGBRG10 v4l2_fourcc('M', 'B', 'G', 'A')\n> +#define V4L2_PIX_FMT_MTISP_SGRBG10 v4l2_fourcc('M', 'B', 'g', 'A')\n> +#define V4L2_PIX_FMT_MTISP_SRGGB10 v4l2_fourcc('M', 'B', 'R', 'A')\n> +\n> +#define V4L2_PIX_FMT_MTISP_NV12_10P v4l2_fourcc('1', '2', 'A', 'P') /* Y/CbCr 4:2:0 10 bits packed */\n> +#define V4L2_PIX_FMT_MTISP_NV12_12P v4l2_fourcc('1', '2', 'C', 'P') /* Y/CbCr 4:2:0 12 bits packed */\n> +\n> +#define V4L2_META_FMT_MTISP_PARAMS v4l2_fourcc('M', 'T', 'f', 'p')\n> +#define V4L2_META_FMT_MTISP_3A v4l2_fourcc('M', 'T', 'f', 'a')\n> +#define V4L2_META_FMT_MTISP_AF v4l2_fourcc('M', 'T', 'f', 'f')\n> +\n> +#define V4L2_META_FMT_MTISP_DESC v4l2_fourcc('M', 'T', 'f', 'd')\n> +#define V4L2_META_FMT_MTISP_SD v4l2_fourcc('M', 'T', 'f', 's')\n> +#define V4L2_META_FMT_MTISP_DESCNORM v4l2_fourcc('M', 'T', 'f', 'r')\n> +#define V4L2_META_FMT_MTISP_SDNORM v4l2_fourcc('M', 'T', 's', 'r')\n> +\n> +#define V4L2_PIX_FMT_WARP2P v4l2_fourcc('M', 'W', '2', 'P')\n> +#define V4L2_PIX_FMT_MTISP_Y8 v4l2_fourcc('M', 'T', '0', '8')\n> +#define V4L2_PIX_FMT_MTISP_Y16 v4l2_fourcc('M', 'T', '1', '6')\n> +#define V4L2_PIX_FMT_MTISP_Y32 v4l2_fourcc('M', 'T', '3', '2')\n> +\n>  /* Raspberry Pi PiSP compressed formats. */\n>  #define V4L2_PIX_FMT_PISP_COMP1_RGGB\tv4l2_fourcc('P', 'C', '1', 'R') /* PiSP 8-bit mode 1 compressed RGGB bayer */\n>  #define V4L2_PIX_FMT_PISP_COMP1_GRBG\tv4l2_fourcc('P', 'C', '1', 'G') /* PiSP 8-bit mode 1 compressed GRBG bayer */\n> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> index dbefb094..53ce4e7d 100644\n> --- a/src/libcamera/formats.cpp\n> +++ b/src/libcamera/formats.cpp\n> @@ -506,6 +506,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t\t.pixelsPerGroup = 1,\n>  \t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n>  \t} },\n> +\t{ formats::GREY, {\n> +\t\t.name = \"GREY\",\n> +\t\t.format = formats::R8,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_GREY), },\n> +\t\t.bitsPerPixel = 8,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n>  \t{ formats::R10, {\n>  \t\t.name = \"R10\",\n>  \t\t.format = formats::R10,\n> @@ -969,6 +979,199 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t\t.pixelsPerGroup = 2,\n>  \t\t.planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},\n>  \t} },\n> +\t{ formats::SBGGR10_MTISP, {\n> +\t\t.name = \"SBGGR10_MTISP\",\n> +\t\t.format = formats::SBGGR10_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SBGGR10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::SGBRG10_MTISP, {\n> +\t\t.name = \"SGBRG10_MTISP\",\n> +\t\t.format = formats::SGBRG10_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SGBRG10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::SGRBG10_MTISP, {\n> +\t\t.name = \"SGRBG10_MTISP\",\n> +\t\t.format = formats::SGRBG10_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SGRBG10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::SRGGB10_MTISP, {\n> +\t\t.name = \"SRGGB10_MTISP\",\n> +\t\t.format = formats::SRGGB10_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SRGGB10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::NV12_10P_MTISP, {\n> +\t\t.name = \"NV12_10P_MTISP\",\n> +\t\t.format = formats::NV12_10P_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_NV12_10P), },\n> +\t\t.bitsPerPixel = 15,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 80, 2 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::NV12_12P_MTISP, {\n> +\t\t.name = \"NV12_12P_MTISP\",\n> +\t\t.format = formats::NV12_12P_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_NV12_12P), },\n> +\t\t.bitsPerPixel = 12,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 96, 1 }, { 96, 2 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFP_MTISP, {\n> +\t\t.name = \"MTFP_MTISP\",\n> +\t\t.format = formats::MTFP_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_PARAMS),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFA_MTISP, {\n> +\t\t.name = \"MTFA_MTISP\",\n> +\t\t.format = formats::MTFA_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_3A),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFF_MTISP, {\n> +\t\t.name = \"MTFF_MTISP\",\n> +\t\t.format = formats::MTFF_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_AF),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFD_MTISP, {\n> +\t\t.name = \"MTFD_MTISP\",\n> +\t\t.format = formats::MTFD_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_DESC),\n> +\t\t},\n> +\t\t.bitsPerPixel = 8,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 8,\n> +\t\t.planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFS_MTISP, {\n> +\t\t.name = \"MTFS_MTISP\",\n> +\t\t.format = formats::MTFS_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_SD),\n> +\t\t},\n> +\t\t.bitsPerPixel = 8,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 8,\n> +\t\t.planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFR_MTISP, {\n> +\t\t.name = \"MTFR_MTISP\",\n> +\t\t.format = formats::MTFR_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_DESCNORM),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTSR_MTISP, {\n> +\t\t.name = \"MTSR_MTISP\",\n> +\t\t.format = formats::MTSR_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_SDNORM),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::WARP2P_MTISP, {\n> +\t\t.name = \"WARP2P_MTISP\",\n> +\t\t.format = formats::WARP2P_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_PIX_FMT_WARP2P),\n> +\t\t},\n> +\t\t.bitsPerPixel = 32,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 2,\n> +\t\t.planes = {{ { 8, 1 }, { 8, 1 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::Y8_MTISP, {\n> +\t\t.name = \"Y8_MTISP\",\n> +\t\t.format = formats::Y8_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y8),\n> +\t\t},\n> +\t\t.bitsPerPixel = 8,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::Y16_MTISP, {\n> +\t\t.name = \"Y16_MTISP\",\n> +\t\t.format = formats::Y16_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y16),\n> +\t\t},\n> +\t\t.bitsPerPixel = 16,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::Y32_MTISP, {\n> +\t\t.name = \"Y32_MTISP\",\n> +\t\t.format = formats::Y32_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y32),\n> +\t\t},\n> +\t\t.bitsPerPixel = 32,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\n>  \t/* Compressed formats. */\n>  \t{ formats::MJPEG, {\n>  \t\t.name = \"MJPEG\",\n> diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml\n> index 2d54d391..8c72d706 100644\n> --- a/src/libcamera/formats.yaml\n> +++ b/src/libcamera/formats.yaml\n> @@ -209,4 +209,42 @@ formats:\n>    - MONO_PISP_COMP1:\n>        fourcc: DRM_FORMAT_R16\n>        mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n> +\n> +  - GREY:\n> +      fourcc: DRM_FORMAT_GREY\n> +  - SBGGR10_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SBGGR10\n> +  - SGBRG10_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SGBRG10\n> +  - SGRBG10_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SGRBG10\n> +  - SRGGB10_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SRGGB10\n> +  - NV12_10P_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_NV12_10P\n> +  - NV12_12P_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_NV12_12P\n> +  - MTFP_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_PARAMS\n> +  - MTFA_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_3A\n> +  - MTFF_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_AF\n> +  - MTFD_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_DESC\n> +  - MTFS_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SD\n> +  - MTFR_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_DESC_NORM\n> +  - MTSR_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SDNORM\n> +  - WARP2P_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_WARP2P\n> +  - Y8_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_Y8\n> +  - Y16_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_Y16\n> +  - Y32_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_Y32\n> +\n>  ...","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 89F8CC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Sep 2024 09:18:10 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 643F46350D;\n\tMon, 23 Sep 2024 11:18:09 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 24FF16037E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Sep 2024 11:18:07 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 89C27670;\n\tMon, 23 Sep 2024 11:16:40 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ZjNQnTfk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727083000;\n\tbh=2oeq8Z8zjmebfd3JrCtvHhnwv73Sa0fYVqvJaNAgJ6M=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ZjNQnTfk+7FtbOfRS51wu+KiUShm7Ed+DDu8ojJUYiKSTzVvX90Mo3pVPx3zfckJ3\n\tJlEXPqwlMTD86DZuaQNwiMYKj1fiTqDzbpEz+XcTWgZbojYe7Y/z8xJLrPNQFUP8gW\n\tq475AV8E1z+7kPKC8fseO1Wdd1NiJPiVPyAwf7KY=","Date":"Mon, 23 Sep 2024 12:17:34 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Harvey Yang <chenghaoyang@chromium.org>","Cc":"libcamera-devel@lists.libcamera.org,\n\tHan-Lin Chen <hanlinchen@chromium.org>, Xing Gu <xinggu@chromium.org>","Subject":"Re: [PATCH 1/1] libcamera: Add formats introduced by MTK platform","Message-ID":"<20240923091734.GB8227@pendragon.ideasonboard.com>","References":"<20240923091133.3328208-1-chenghaoyang@google.com>\n\t<20240923091133.3328208-2-chenghaoyang@google.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240923091133.3328208-2-chenghaoyang@google.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":31317,"web_url":"https://patchwork.libcamera.org/comment/31317/","msgid":"<d671c87b48b5edfa5ce0082be0956dc62d99f342.camel@ndufresne.ca>","date":"2024-09-23T18:21:23","subject":"Re: [PATCH 1/1] libcamera: Add formats introduced by MTK platform","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Hi,\n\nLe lundi 23 septembre 2024 à 09:08 +0000, Harvey Yang a écrit :\n> From: Han-Lin Chen <hanlinchen@chromium.org>\n> \n> The patch adds the following formats.\n> \n>   - GREY\n>   - SBGGR10_MTISP\n>   - SGBRG10_MTISP\n>   - SGRBG10_MTISP\n>   - SRGGB10_MTISP\n>   - NV12_10P_MTISP\n>   - NV12_12P_MTISP\n>   - MTFP_MTISP\n>   - MTFA_MTISP\n>   - MTFF_MTISP\n>   - MTFD_MTISP\n>   - MTFS_MTISP\n>   - MTFR_MTISP\n>   - MTSR_MTISP\n>   - WARP2P_MTISP\n>   - Y8_MTISP\n>   - Y16_MTISP\n>   - Y32_MTISP\n> \n> Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n> Co-developed-by: Xing Gu <xinggu@chromium.org>\n> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n> ---\n>  include/linux/drm_fourcc.h |  26 +++++\n>  include/linux/videodev2.h  |  22 ++++\n>  src/libcamera/formats.cpp  | 203 +++++++++++++++++++++++++++++++++++++\n>  src/libcamera/formats.yaml |  38 +++++++\n>  4 files changed, 289 insertions(+)\n> \n> diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h\n> index db679877..ca00a3c7 100644\n> --- a/include/linux/drm_fourcc.h\n> +++ b/include/linux/drm_fourcc.h\n> @@ -466,6 +466,32 @@ extern \"C\" {\n>  #define DRM_FORMAT_SGBRG16\tfourcc_code('G', 'B', '1', '6')\n>  #define DRM_FORMAT_SBGGR16\tfourcc_code('B', 'Y', 'R', '2')\n>  \n> +/* MTK extention */\n> +\n> +#define DRM_FORMAT_MTISP_SBGGR10 fourcc_code('M', 'B', 'B', 'A')\n> +#define DRM_FORMAT_MTISP_SGBRG10 fourcc_code('M', 'B', 'G', 'A')\n> +#define DRM_FORMAT_MTISP_SGRBG10 fourcc_code('M', 'B', 'g', 'A')\n> +#define DRM_FORMAT_MTISP_SRGGB10 fourcc_code('M', 'B', 'R', 'A')\n> +\n> +#define DRM_FORMAT_MTISP_NV12_10P fourcc_code('1', '2', 'A', 'P')\n> +#define DRM_FORMAT_MTISP_NV12_12P fourcc_code('1', '2', 'C', 'P')\n\nJust to share my own mistake in other project, the 12 in NV12 means 12bits per\npixels. With the logic, packed 10bit with 4:2:0 subsampling would be NV15, and\n12bit would be NV18. I'm not staying NV notation scale very well, since you can\nmake up some clash easily, but this was 20 years ago the logic, and matching\nNV12 and 10bit makes little a sense (sorry GStreamer project, I try and do\nbetter next time).\n\nNote that if this is effectively NV15 with Meditek tiling (Y 16x32 | 16x16\nCbCr), then modifier it should be.\n\nNicolas\n\np.s. when upstreaming formats, never try to hide what they are, your patch will\nalways be rejected upstream. Split them up, document what they truly are. In\ngeneral, appart from compression, everything else should be clear with no\nambiguity. The reason is simple, vendors actually share some formats without\nactually knowing.\n\n> +\n> +#define DRM_FORMAT_GREY fourcc_code('G', 'R', 'E', 'Y')\n> +\n> +#define DRM_FORMAT_MTISP_PARAMS fourcc_code('M', 'T', 'f', 'p')\n> +#define DRM_FORMAT_MTISP_3A fourcc_code('M', 'T', 'f', 'a')\n> +#define DRM_FORMAT_MTISP_AF fourcc_code('M', 'T', 'f', 'f')\n> +\n> +#define DRM_FORMAT_MTISP_DESC fourcc_code('M', 'T', 'f', 'd')\n> +#define DRM_FORMAT_MTISP_SD fourcc_code('M', 'T', 'f', 's')\n> +#define DRM_FORMAT_MTISP_DESC_NORM fourcc_code('M', 'T', 'f', 'r')\n> +#define DRM_FORMAT_MTISP_SDNORM fourcc_code('M', 'T', 's', 'r')\n> +\n> +#define DRM_FORMAT_MTISP_WARP2P fourcc_code('M', 'W', '2', 'P')\n> +#define DRM_FORMAT_MTISP_Y8 fourcc_code('M', 'T', '0', '8')\n> +#define DRM_FORMAT_MTISP_Y16 fourcc_code('M', 'T', '1', '6')\n> +#define DRM_FORMAT_MTISP_Y32 fourcc_code('M', 'T', '3', '2')\n> +\n>  /*\n>   * Format Modifiers:\n>   *\n> diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\n> index 3829c0b6..2cee0b86 100644\n> --- a/include/linux/videodev2.h\n> +++ b/include/linux/videodev2.h\n> @@ -789,6 +789,28 @@ struct v4l2_pix_format {\n>  #define V4L2_PIX_FMT_IPU3_SGRBG10\tv4l2_fourcc('i', 'p', '3', 'G') /* IPU3 packed 10-bit GRBG bayer */\n>  #define V4L2_PIX_FMT_IPU3_SRGGB10\tv4l2_fourcc('i', 'p', '3', 'r') /* IPU3 packed 10-bit RGGB bayer */\n>  \n> +#define V4L2_PIX_FMT_MTISP_SBGGR10 v4l2_fourcc('M', 'B', 'B', 'A')\n> +#define V4L2_PIX_FMT_MTISP_SGBRG10 v4l2_fourcc('M', 'B', 'G', 'A')\n> +#define V4L2_PIX_FMT_MTISP_SGRBG10 v4l2_fourcc('M', 'B', 'g', 'A')\n> +#define V4L2_PIX_FMT_MTISP_SRGGB10 v4l2_fourcc('M', 'B', 'R', 'A')\n> +\n> +#define V4L2_PIX_FMT_MTISP_NV12_10P v4l2_fourcc('1', '2', 'A', 'P') /* Y/CbCr 4:2:0 10 bits packed */\n> +#define V4L2_PIX_FMT_MTISP_NV12_12P v4l2_fourcc('1', '2', 'C', 'P') /* Y/CbCr 4:2:0 12 bits packed */\n> +\n> +#define V4L2_META_FMT_MTISP_PARAMS v4l2_fourcc('M', 'T', 'f', 'p')\n> +#define V4L2_META_FMT_MTISP_3A v4l2_fourcc('M', 'T', 'f', 'a')\n> +#define V4L2_META_FMT_MTISP_AF v4l2_fourcc('M', 'T', 'f', 'f')\n> +\n> +#define V4L2_META_FMT_MTISP_DESC v4l2_fourcc('M', 'T', 'f', 'd')\n> +#define V4L2_META_FMT_MTISP_SD v4l2_fourcc('M', 'T', 'f', 's')\n> +#define V4L2_META_FMT_MTISP_DESCNORM v4l2_fourcc('M', 'T', 'f', 'r')\n> +#define V4L2_META_FMT_MTISP_SDNORM v4l2_fourcc('M', 'T', 's', 'r')\n> +\n> +#define V4L2_PIX_FMT_WARP2P v4l2_fourcc('M', 'W', '2', 'P')\n> +#define V4L2_PIX_FMT_MTISP_Y8 v4l2_fourcc('M', 'T', '0', '8')\n> +#define V4L2_PIX_FMT_MTISP_Y16 v4l2_fourcc('M', 'T', '1', '6')\n> +#define V4L2_PIX_FMT_MTISP_Y32 v4l2_fourcc('M', 'T', '3', '2')\n> +\n>  /* Raspberry Pi PiSP compressed formats. */\n>  #define V4L2_PIX_FMT_PISP_COMP1_RGGB\tv4l2_fourcc('P', 'C', '1', 'R') /* PiSP 8-bit mode 1 compressed RGGB bayer */\n>  #define V4L2_PIX_FMT_PISP_COMP1_GRBG\tv4l2_fourcc('P', 'C', '1', 'G') /* PiSP 8-bit mode 1 compressed GRBG bayer */\n> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> index dbefb094..53ce4e7d 100644\n> --- a/src/libcamera/formats.cpp\n> +++ b/src/libcamera/formats.cpp\n> @@ -506,6 +506,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t\t.pixelsPerGroup = 1,\n>  \t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n>  \t} },\n> +\t{ formats::GREY, {\n> +\t\t.name = \"GREY\",\n> +\t\t.format = formats::R8,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_GREY), },\n> +\t\t.bitsPerPixel = 8,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n>  \t{ formats::R10, {\n>  \t\t.name = \"R10\",\n>  \t\t.format = formats::R10,\n> @@ -969,6 +979,199 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t\t.pixelsPerGroup = 2,\n>  \t\t.planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},\n>  \t} },\n> +\t{ formats::SBGGR10_MTISP, {\n> +\t\t.name = \"SBGGR10_MTISP\",\n> +\t\t.format = formats::SBGGR10_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SBGGR10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::SGBRG10_MTISP, {\n> +\t\t.name = \"SGBRG10_MTISP\",\n> +\t\t.format = formats::SGBRG10_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SGBRG10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::SGRBG10_MTISP, {\n> +\t\t.name = \"SGRBG10_MTISP\",\n> +\t\t.format = formats::SGRBG10_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SGRBG10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::SRGGB10_MTISP, {\n> +\t\t.name = \"SRGGB10_MTISP\",\n> +\t\t.format = formats::SRGGB10_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SRGGB10), },\n> +\t\t.bitsPerPixel = 10,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::NV12_10P_MTISP, {\n> +\t\t.name = \"NV12_10P_MTISP\",\n> +\t\t.format = formats::NV12_10P_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_NV12_10P), },\n> +\t\t.bitsPerPixel = 15,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 80, 1 }, { 80, 2 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::NV12_12P_MTISP, {\n> +\t\t.name = \"NV12_12P_MTISP\",\n> +\t\t.format = formats::NV12_12P_MTISP,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_NV12_12P), },\n> +\t\t.bitsPerPixel = 12,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 64,\n> +\t\t.planes = {{ { 96, 1 }, { 96, 2 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFP_MTISP, {\n> +\t\t.name = \"MTFP_MTISP\",\n> +\t\t.format = formats::MTFP_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_PARAMS),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFA_MTISP, {\n> +\t\t.name = \"MTFA_MTISP\",\n> +\t\t.format = formats::MTFA_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_3A),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFF_MTISP, {\n> +\t\t.name = \"MTFF_MTISP\",\n> +\t\t.format = formats::MTFF_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_AF),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFD_MTISP, {\n> +\t\t.name = \"MTFD_MTISP\",\n> +\t\t.format = formats::MTFD_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_DESC),\n> +\t\t},\n> +\t\t.bitsPerPixel = 8,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 8,\n> +\t\t.planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFS_MTISP, {\n> +\t\t.name = \"MTFS_MTISP\",\n> +\t\t.format = formats::MTFS_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_SD),\n> +\t\t},\n> +\t\t.bitsPerPixel = 8,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 8,\n> +\t\t.planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTFR_MTISP, {\n> +\t\t.name = \"MTFR_MTISP\",\n> +\t\t.format = formats::MTFR_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_DESCNORM),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::MTSR_MTISP, {\n> +\t\t.name = \"MTSR_MTISP\",\n> +\t\t.format = formats::MTSR_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_META_FMT_MTISP_SDNORM),\n> +\t\t},\n> +\t\t.bitsPerPixel = 0,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::WARP2P_MTISP, {\n> +\t\t.name = \"WARP2P_MTISP\",\n> +\t\t.format = formats::WARP2P_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_PIX_FMT_WARP2P),\n> +\t\t},\n> +\t\t.bitsPerPixel = 32,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 2,\n> +\t\t.planes = {{ { 8, 1 }, { 8, 1 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::Y8_MTISP, {\n> +\t\t.name = \"Y8_MTISP\",\n> +\t\t.format = formats::Y8_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y8),\n> +\t\t},\n> +\t\t.bitsPerPixel = 8,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::Y16_MTISP, {\n> +\t\t.name = \"Y16_MTISP\",\n> +\t\t.format = formats::Y16_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y16),\n> +\t\t},\n> +\t\t.bitsPerPixel = 16,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\t{ formats::Y32_MTISP, {\n> +\t\t.name = \"Y32_MTISP\",\n> +\t\t.format = formats::Y32_MTISP,\n> +\t\t.v4l2Formats = {\n> +\t\t\tV4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y32),\n> +\t\t},\n> +\t\t.bitsPerPixel = 32,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = false,\n> +\t\t.pixelsPerGroup = 1,\n> +\t\t.planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n> +\n>  \t/* Compressed formats. */\n>  \t{ formats::MJPEG, {\n>  \t\t.name = \"MJPEG\",\n> diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml\n> index 2d54d391..8c72d706 100644\n> --- a/src/libcamera/formats.yaml\n> +++ b/src/libcamera/formats.yaml\n> @@ -209,4 +209,42 @@ formats:\n>    - MONO_PISP_COMP1:\n>        fourcc: DRM_FORMAT_R16\n>        mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n> +\n> +  - GREY:\n> +      fourcc: DRM_FORMAT_GREY\n> +  - SBGGR10_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SBGGR10\n> +  - SGBRG10_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SGBRG10\n> +  - SGRBG10_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SGRBG10\n> +  - SRGGB10_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SRGGB10\n> +  - NV12_10P_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_NV12_10P\n> +  - NV12_12P_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_NV12_12P\n> +  - MTFP_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_PARAMS\n> +  - MTFA_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_3A\n> +  - MTFF_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_AF\n> +  - MTFD_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_DESC\n> +  - MTFS_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SD\n> +  - MTFR_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_DESC_NORM\n> +  - MTSR_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_SDNORM\n> +  - WARP2P_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_WARP2P\n> +  - Y8_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_Y8\n> +  - Y16_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_Y16\n> +  - Y32_MTISP:\n> +      fourcc: DRM_FORMAT_MTISP_Y32\n> +\n>  ...","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4B8F1C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Sep 2024 18:21:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CAA336350B;\n\tMon, 23 Sep 2024 20:21:27 +0200 (CEST)","from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com\n\t[IPv6:2607:f8b0:4864:20::c30])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D5C266037E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Sep 2024 20:21:25 +0200 (CEST)","by mail-oo1-xc30.google.com with SMTP id\n\t006d021491bc7-5d5f24d9df8so2190372eaf.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Sep 2024 11:21:25 -0700 (PDT)","from nicolas-tpx395.lan ([2606:6d00:15:862e::580])\n\tby smtp.gmail.com with ESMTPSA id\n\taf79cd13be357-7acb08085e0sm508723485a.32.2024.09.23.11.21.23\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Sep 2024 11:21:24 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=ndufresne-ca.20230601.gappssmtp.com\n\theader.i=@ndufresne-ca.20230601.gappssmtp.com\n\theader.b=\"3bOdRWsc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1727115684;\n\tx=1727720484; darn=lists.libcamera.org; \n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=0CRIkORJa/e9mVBW7Emo516w1Cez7wyb62hUKxPkgAY=;\n\tb=3bOdRWscelWZAN1rzuKShEOlifVikfT2WHoOG7QNldbRBKR+P4LteFVgKC/mc0+2Q2\n\t28rmy2YMvWGA1QV7HIPOReFFmVYdO/rZqJSmIP9InoW1eWhX1zbMzekdkmvaUDhRp+Uq\n\thrdNm2WZPR2ODtofD0yQ3rAL1BLW8UxOz3q5prcBGxl9ScHMsAIJcYiutLr7dSx9a2EA\n\t4hAzKUgtJjCfPaCuIEIi1hdeMjoXIx9i7+d58SMUQ9YUg9w/o3aQF2Pfi+imVi+wopma\n\tHRBzobjJUGYkGgPT0lS3hw/cx7Nndrb8J7ewY0B8sIDJtLtt+IfsixgZqurpy0K0ZHIu\n\tL0Eg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1727115684; x=1727720484;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=0CRIkORJa/e9mVBW7Emo516w1Cez7wyb62hUKxPkgAY=;\n\tb=ol5hPZ+716aCM98WK0z8RGIsplLYqTEG/qM9VArEFd+eqCavhjGrREo34DXy31BRXp\n\tyKLjI7FLFLZHIy4soS6Yh/kujK/sEQMfYyy8dPJGoPC4aoEF7DZc0IPsPW3By697mLTN\n\t/X8LUykJSsPdJ1boX+dK6CCmqS/fCi1wpprX9sChZLZHqlqxzblbP2olNHvGQ7gV9obk\n\tLoU9DntzXXX/NqiMRcSDbFl8lZjNgJLo4n+YOha1fzNF0a4WD2lptzM23T6sjEhTbq4/\n\tHCqsCfYYIqNh6ITAFY3uUVuDtUJFfSroMXJAMr6ZWQZdvOD36t83zug6LS4g+1c5SX6G\n\tfqSA==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCU0D+WNhMoZQlg1iPJQVQZ0ocEbVntgZx7+iPWH80y0b8ySZ9jz7gjUyDtMIgGlEyZXZHs8MGZ0FfaLu98bHk4=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YwjAh3FP39TqxHfbJGbQiJ8ODJ8eOMI6lC6SovOxGKbhzokKw5V\n\t+72hx0hCA+2Mg2nyw39y69kP88JoVxcn9oqjf7bPf4sTDH/5+OH2qu6IljQHiwk=","X-Google-Smtp-Source":"AGHT+IGW+TltaQTbeLnGv1HX+tWCBcQpBDyKXJ0H0K1ysHn+2yOKJACxLqGM1y+0q9o5tdz6kbs+sg==","X-Received":"by 2002:a05:6871:82a:b0:24f:d178:d48d with SMTP id\n\t586e51a60fabf-2803a784e5dmr7777293fac.31.1727115684458; \n\tMon, 23 Sep 2024 11:21:24 -0700 (PDT)","Message-ID":"<d671c87b48b5edfa5ce0082be0956dc62d99f342.camel@ndufresne.ca>","Subject":"Re: [PATCH 1/1] libcamera: Add formats introduced by MTK platform","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"Harvey Yang <chenghaoyang@chromium.org>, \n\tlibcamera-devel@lists.libcamera.org","Cc":"Han-Lin Chen <hanlinchen@chromium.org>, Xing Gu <xinggu@chromium.org>","Date":"Mon, 23 Sep 2024 14:21:23 -0400","In-Reply-To":"<20240923091133.3328208-2-chenghaoyang@google.com>","References":"<20240923091133.3328208-1-chenghaoyang@google.com>\n\t<20240923091133.3328208-2-chenghaoyang@google.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.52.4 (3.52.4-1.fc40) ","MIME-Version":"1.0","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":31463,"web_url":"https://patchwork.libcamera.org/comment/31463/","msgid":"<CAEB1ahucD4Z=x9tzakTX8XsEY88WiYbZy7zgvxdsz5TMa=JZxg@mail.gmail.com>","date":"2024-09-30T09:10:51","subject":"Re: [PATCH 1/1] libcamera: Add formats introduced by MTK platform","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"content":"Thanks Laurent and Nicolas for the comments.\n\nLet's revisit this when the formats are submitted in Linux Kernel.\nSeems that we need to wait for a couple of months, as there are\nother works ahead...\n\nBR,\nHarvey\n\nOn Tue, Sep 24, 2024 at 2:21 AM Nicolas Dufresne <nicolas@ndufresne.ca> wrote:\n>\n> Hi,\n>\n> Le lundi 23 septembre 2024 à 09:08 +0000, Harvey Yang a écrit :\n> > From: Han-Lin Chen <hanlinchen@chromium.org>\n> >\n> > The patch adds the following formats.\n> >\n> >   - GREY\n> >   - SBGGR10_MTISP\n> >   - SGBRG10_MTISP\n> >   - SGRBG10_MTISP\n> >   - SRGGB10_MTISP\n> >   - NV12_10P_MTISP\n> >   - NV12_12P_MTISP\n> >   - MTFP_MTISP\n> >   - MTFA_MTISP\n> >   - MTFF_MTISP\n> >   - MTFD_MTISP\n> >   - MTFS_MTISP\n> >   - MTFR_MTISP\n> >   - MTSR_MTISP\n> >   - WARP2P_MTISP\n> >   - Y8_MTISP\n> >   - Y16_MTISP\n> >   - Y32_MTISP\n> >\n> > Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>\n> > Co-developed-by: Xing Gu <xinggu@chromium.org>\n> > Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n> > ---\n> >  include/linux/drm_fourcc.h |  26 +++++\n> >  include/linux/videodev2.h  |  22 ++++\n> >  src/libcamera/formats.cpp  | 203 +++++++++++++++++++++++++++++++++++++\n> >  src/libcamera/formats.yaml |  38 +++++++\n> >  4 files changed, 289 insertions(+)\n> >\n> > diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h\n> > index db679877..ca00a3c7 100644\n> > --- a/include/linux/drm_fourcc.h\n> > +++ b/include/linux/drm_fourcc.h\n> > @@ -466,6 +466,32 @@ extern \"C\" {\n> >  #define DRM_FORMAT_SGBRG16   fourcc_code('G', 'B', '1', '6')\n> >  #define DRM_FORMAT_SBGGR16   fourcc_code('B', 'Y', 'R', '2')\n> >\n> > +/* MTK extention */\n> > +\n> > +#define DRM_FORMAT_MTISP_SBGGR10 fourcc_code('M', 'B', 'B', 'A')\n> > +#define DRM_FORMAT_MTISP_SGBRG10 fourcc_code('M', 'B', 'G', 'A')\n> > +#define DRM_FORMAT_MTISP_SGRBG10 fourcc_code('M', 'B', 'g', 'A')\n> > +#define DRM_FORMAT_MTISP_SRGGB10 fourcc_code('M', 'B', 'R', 'A')\n> > +\n> > +#define DRM_FORMAT_MTISP_NV12_10P fourcc_code('1', '2', 'A', 'P')\n> > +#define DRM_FORMAT_MTISP_NV12_12P fourcc_code('1', '2', 'C', 'P')\n>\n> Just to share my own mistake in other project, the 12 in NV12 means 12bits per\n> pixels. With the logic, packed 10bit with 4:2:0 subsampling would be NV15, and\n> 12bit would be NV18. I'm not staying NV notation scale very well, since you can\n> make up some clash easily, but this was 20 years ago the logic, and matching\n> NV12 and 10bit makes little a sense (sorry GStreamer project, I try and do\n> better next time).\n>\n> Note that if this is effectively NV15 with Meditek tiling (Y 16x32 | 16x16\n> CbCr), then modifier it should be.\n>\n> Nicolas\n>\n> p.s. when upstreaming formats, never try to hide what they are, your patch will\n> always be rejected upstream. Split them up, document what they truly are. In\n> general, appart from compression, everything else should be clear with no\n> ambiguity. The reason is simple, vendors actually share some formats without\n> actually knowing.\n>\n> > +\n> > +#define DRM_FORMAT_GREY fourcc_code('G', 'R', 'E', 'Y')\n> > +\n> > +#define DRM_FORMAT_MTISP_PARAMS fourcc_code('M', 'T', 'f', 'p')\n> > +#define DRM_FORMAT_MTISP_3A fourcc_code('M', 'T', 'f', 'a')\n> > +#define DRM_FORMAT_MTISP_AF fourcc_code('M', 'T', 'f', 'f')\n> > +\n> > +#define DRM_FORMAT_MTISP_DESC fourcc_code('M', 'T', 'f', 'd')\n> > +#define DRM_FORMAT_MTISP_SD fourcc_code('M', 'T', 'f', 's')\n> > +#define DRM_FORMAT_MTISP_DESC_NORM fourcc_code('M', 'T', 'f', 'r')\n> > +#define DRM_FORMAT_MTISP_SDNORM fourcc_code('M', 'T', 's', 'r')\n> > +\n> > +#define DRM_FORMAT_MTISP_WARP2P fourcc_code('M', 'W', '2', 'P')\n> > +#define DRM_FORMAT_MTISP_Y8 fourcc_code('M', 'T', '0', '8')\n> > +#define DRM_FORMAT_MTISP_Y16 fourcc_code('M', 'T', '1', '6')\n> > +#define DRM_FORMAT_MTISP_Y32 fourcc_code('M', 'T', '3', '2')\n> > +\n> >  /*\n> >   * Format Modifiers:\n> >   *\n> > diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h\n> > index 3829c0b6..2cee0b86 100644\n> > --- a/include/linux/videodev2.h\n> > +++ b/include/linux/videodev2.h\n> > @@ -789,6 +789,28 @@ struct v4l2_pix_format {\n> >  #define V4L2_PIX_FMT_IPU3_SGRBG10    v4l2_fourcc('i', 'p', '3', 'G') /* IPU3 packed 10-bit GRBG bayer */\n> >  #define V4L2_PIX_FMT_IPU3_SRGGB10    v4l2_fourcc('i', 'p', '3', 'r') /* IPU3 packed 10-bit RGGB bayer */\n> >\n> > +#define V4L2_PIX_FMT_MTISP_SBGGR10 v4l2_fourcc('M', 'B', 'B', 'A')\n> > +#define V4L2_PIX_FMT_MTISP_SGBRG10 v4l2_fourcc('M', 'B', 'G', 'A')\n> > +#define V4L2_PIX_FMT_MTISP_SGRBG10 v4l2_fourcc('M', 'B', 'g', 'A')\n> > +#define V4L2_PIX_FMT_MTISP_SRGGB10 v4l2_fourcc('M', 'B', 'R', 'A')\n> > +\n> > +#define V4L2_PIX_FMT_MTISP_NV12_10P v4l2_fourcc('1', '2', 'A', 'P') /* Y/CbCr 4:2:0 10 bits packed */\n> > +#define V4L2_PIX_FMT_MTISP_NV12_12P v4l2_fourcc('1', '2', 'C', 'P') /* Y/CbCr 4:2:0 12 bits packed */\n> > +\n> > +#define V4L2_META_FMT_MTISP_PARAMS v4l2_fourcc('M', 'T', 'f', 'p')\n> > +#define V4L2_META_FMT_MTISP_3A v4l2_fourcc('M', 'T', 'f', 'a')\n> > +#define V4L2_META_FMT_MTISP_AF v4l2_fourcc('M', 'T', 'f', 'f')\n> > +\n> > +#define V4L2_META_FMT_MTISP_DESC v4l2_fourcc('M', 'T', 'f', 'd')\n> > +#define V4L2_META_FMT_MTISP_SD v4l2_fourcc('M', 'T', 'f', 's')\n> > +#define V4L2_META_FMT_MTISP_DESCNORM v4l2_fourcc('M', 'T', 'f', 'r')\n> > +#define V4L2_META_FMT_MTISP_SDNORM v4l2_fourcc('M', 'T', 's', 'r')\n> > +\n> > +#define V4L2_PIX_FMT_WARP2P v4l2_fourcc('M', 'W', '2', 'P')\n> > +#define V4L2_PIX_FMT_MTISP_Y8 v4l2_fourcc('M', 'T', '0', '8')\n> > +#define V4L2_PIX_FMT_MTISP_Y16 v4l2_fourcc('M', 'T', '1', '6')\n> > +#define V4L2_PIX_FMT_MTISP_Y32 v4l2_fourcc('M', 'T', '3', '2')\n> > +\n> >  /* Raspberry Pi PiSP compressed formats. */\n> >  #define V4L2_PIX_FMT_PISP_COMP1_RGGB v4l2_fourcc('P', 'C', '1', 'R') /* PiSP 8-bit mode 1 compressed RGGB bayer */\n> >  #define V4L2_PIX_FMT_PISP_COMP1_GRBG v4l2_fourcc('P', 'C', '1', 'G') /* PiSP 8-bit mode 1 compressed GRBG bayer */\n> > diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> > index dbefb094..53ce4e7d 100644\n> > --- a/src/libcamera/formats.cpp\n> > +++ b/src/libcamera/formats.cpp\n> > @@ -506,6 +506,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n> >               .pixelsPerGroup = 1,\n> >               .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> >       } },\n> > +     { formats::GREY, {\n> > +             .name = \"GREY\",\n> > +             .format = formats::R8,\n> > +             .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_GREY), },\n> > +             .bitsPerPixel = 8,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> >       { formats::R10, {\n> >               .name = \"R10\",\n> >               .format = formats::R10,\n> > @@ -969,6 +979,199 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n> >               .pixelsPerGroup = 2,\n> >               .planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},\n> >       } },\n> > +     { formats::SBGGR10_MTISP, {\n> > +             .name = \"SBGGR10_MTISP\",\n> > +             .format = formats::SBGGR10_MTISP,\n> > +             .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SBGGR10), },\n> > +             .bitsPerPixel = 10,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> > +             .packed = true,\n> > +             .pixelsPerGroup = 64,\n> > +             .planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::SGBRG10_MTISP, {\n> > +             .name = \"SGBRG10_MTISP\",\n> > +             .format = formats::SGBRG10_MTISP,\n> > +             .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SGBRG10), },\n> > +             .bitsPerPixel = 10,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> > +             .packed = true,\n> > +             .pixelsPerGroup = 64,\n> > +             .planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::SGRBG10_MTISP, {\n> > +             .name = \"SGRBG10_MTISP\",\n> > +             .format = formats::SGRBG10_MTISP,\n> > +             .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SGRBG10), },\n> > +             .bitsPerPixel = 10,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> > +             .packed = true,\n> > +             .pixelsPerGroup = 64,\n> > +             .planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::SRGGB10_MTISP, {\n> > +             .name = \"SRGGB10_MTISP\",\n> > +             .format = formats::SRGGB10_MTISP,\n> > +             .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_SRGGB10), },\n> > +             .bitsPerPixel = 10,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingRAW,\n> > +             .packed = true,\n> > +             .pixelsPerGroup = 64,\n> > +             .planes = {{ { 80, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::NV12_10P_MTISP, {\n> > +             .name = \"NV12_10P_MTISP\",\n> > +             .format = formats::NV12_10P_MTISP,\n> > +             .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_NV12_10P), },\n> > +             .bitsPerPixel = 15,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = true,\n> > +             .pixelsPerGroup = 64,\n> > +             .planes = {{ { 80, 1 }, { 80, 2 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::NV12_12P_MTISP, {\n> > +             .name = \"NV12_12P_MTISP\",\n> > +             .format = formats::NV12_12P_MTISP,\n> > +             .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_MTISP_NV12_12P), },\n> > +             .bitsPerPixel = 12,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = true,\n> > +             .pixelsPerGroup = 64,\n> > +             .planes = {{ { 96, 1 }, { 96, 2 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::MTFP_MTISP, {\n> > +             .name = \"MTFP_MTISP\",\n> > +             .format = formats::MTFP_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_META_FMT_MTISP_PARAMS),\n> > +             },\n> > +             .bitsPerPixel = 0,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::MTFA_MTISP, {\n> > +             .name = \"MTFA_MTISP\",\n> > +             .format = formats::MTFA_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_META_FMT_MTISP_3A),\n> > +             },\n> > +             .bitsPerPixel = 0,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::MTFF_MTISP, {\n> > +             .name = \"MTFF_MTISP\",\n> > +             .format = formats::MTFF_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_META_FMT_MTISP_AF),\n> > +             },\n> > +             .bitsPerPixel = 0,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::MTFD_MTISP, {\n> > +             .name = \"MTFD_MTISP\",\n> > +             .format = formats::MTFD_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_META_FMT_MTISP_DESC),\n> > +             },\n> > +             .bitsPerPixel = 8,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 8,\n> > +             .planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::MTFS_MTISP, {\n> > +             .name = \"MTFS_MTISP\",\n> > +             .format = formats::MTFS_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_META_FMT_MTISP_SD),\n> > +             },\n> > +             .bitsPerPixel = 8,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 8,\n> > +             .planes = {{ { 8, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::MTFR_MTISP, {\n> > +             .name = \"MTFR_MTISP\",\n> > +             .format = formats::MTFR_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_META_FMT_MTISP_DESCNORM),\n> > +             },\n> > +             .bitsPerPixel = 0,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::MTSR_MTISP, {\n> > +             .name = \"MTSR_MTISP\",\n> > +             .format = formats::MTSR_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_META_FMT_MTISP_SDNORM),\n> > +             },\n> > +             .bitsPerPixel = 0,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::WARP2P_MTISP, {\n> > +             .name = \"WARP2P_MTISP\",\n> > +             .format = formats::WARP2P_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_PIX_FMT_WARP2P),\n> > +             },\n> > +             .bitsPerPixel = 32,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 2,\n> > +             .planes = {{ { 8, 1 }, { 8, 1 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::Y8_MTISP, {\n> > +             .name = \"Y8_MTISP\",\n> > +             .format = formats::Y8_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y8),\n> > +             },\n> > +             .bitsPerPixel = 8,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::Y16_MTISP, {\n> > +             .name = \"Y16_MTISP\",\n> > +             .format = formats::Y16_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y16),\n> > +             },\n> > +             .bitsPerPixel = 16,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +     { formats::Y32_MTISP, {\n> > +             .name = \"Y32_MTISP\",\n> > +             .format = formats::Y32_MTISP,\n> > +             .v4l2Formats = {\n> > +                     V4L2PixelFormat(V4L2_PIX_FMT_MTISP_Y32),\n> > +             },\n> > +             .bitsPerPixel = 32,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = false,\n> > +             .pixelsPerGroup = 1,\n> > +             .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> > +\n> >       /* Compressed formats. */\n> >       { formats::MJPEG, {\n> >               .name = \"MJPEG\",\n> > diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml\n> > index 2d54d391..8c72d706 100644\n> > --- a/src/libcamera/formats.yaml\n> > +++ b/src/libcamera/formats.yaml\n> > @@ -209,4 +209,42 @@ formats:\n> >    - MONO_PISP_COMP1:\n> >        fourcc: DRM_FORMAT_R16\n> >        mod: PISP_FORMAT_MOD_COMPRESS_MODE1\n> > +\n> > +  - GREY:\n> > +      fourcc: DRM_FORMAT_GREY\n> > +  - SBGGR10_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_SBGGR10\n> > +  - SGBRG10_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_SGBRG10\n> > +  - SGRBG10_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_SGRBG10\n> > +  - SRGGB10_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_SRGGB10\n> > +  - NV12_10P_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_NV12_10P\n> > +  - NV12_12P_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_NV12_12P\n> > +  - MTFP_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_PARAMS\n> > +  - MTFA_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_3A\n> > +  - MTFF_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_AF\n> > +  - MTFD_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_DESC\n> > +  - MTFS_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_SD\n> > +  - MTFR_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_DESC_NORM\n> > +  - MTSR_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_SDNORM\n> > +  - WARP2P_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_WARP2P\n> > +  - Y8_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_Y8\n> > +  - Y16_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_Y16\n> > +  - Y32_MTISP:\n> > +      fourcc: DRM_FORMAT_MTISP_Y32\n> > +\n> >  ...\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0114AC3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Sep 2024 09:11:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 942CF6350F;\n\tMon, 30 Sep 2024 11:11:06 +0200 (CEST)","from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com\n\t[IPv6:2a00:1450:4864:20::22a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 16E5363500\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Sep 2024 11:11:04 +0200 (CEST)","by mail-lj1-x22a.google.com with SMTP id\n\t38308e7fff4ca-2fa10e64805so29484071fa.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Sep 2024 02:11:04 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"eK0u7qiT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1727687463; x=1728292263;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=zlmb7zwW3cF1fPzoDMKNq59fG8vO+1aSuhNAZOXFzD0=;\n\tb=eK0u7qiT8bmiF2/ZOgbs9lbIPIEkp/Lg6pyqcBLV90jkfGFaYdWesR5afymTEOaRJ1\n\tLsGW8JcER+7YCOt8+vJUMZJoISqAhwayn7xhHL2ok0TDQ76tzah9n2TRXeGmTctevxMx\n\tvrFMSVKpQBab+67fUG6PY51iMoSEuBAwynDt8=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1727687463; x=1728292263;\n\th=content-transfer-encoding:cc:to:subject:message-id:date:from\n\t:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=zlmb7zwW3cF1fPzoDMKNq59fG8vO+1aSuhNAZOXFzD0=;\n\tb=GjLvEe3KzhddpyFsEKp2vy6TWcRYts0db+FIOgnzBZDy48pZf12wgklSFpinFX6wYa\n\t8+Vzj2K7QnYI10/mMhzigLN/RlgOaWLbHkd7g5fWQOnhP8jV00A8/xwb2CqiPkdKrdpR\n\ta/q8vY9dIGn+w4lKYT74A5hhvkXdqMoNubHQvC/pw8+9YPlHyFCWUMHVjDL4vVNr5/6B\n\tE8V7cXivuSWrfTeoA5h4HTi+Gg3+mPxE6tufpETVhArVH73nugH20DjXh5GkxHbiGFZe\n\tiy3LPzHsFQhECIsE5cdQ9sZb4KWT1KhuIZ3dIQyZwneLoKaV6Rh5FgwevgAoWdvWBbQe\n\taotg==","X-Gm-Message-State":"AOJu0YziS1ob6S0uqnBoqhoZjoWeQqqhHFYGRURB20Al8sj4YCoJqiQC\n\t0nVqE1r2JYYk8fg7fBdI3KVmxpQmQuW5X3QqFR+M62cU71EmsUsqXyHbdgzMYcpB+9NEfMtVcoK\n\tR20j/ViqmMP7WfHBOTG13JhzeOzZXTzTijmOD","X-Google-Smtp-Source":"AGHT+IFlj117II9Hj7HSuY+82kJon/jICejr6YYAe6e9/qHh/m0+0erZ1ch70uLAFmjv9msS3FGPodHCvdD/NzaoTRA=","X-Received":"by 2002:a2e:b8d5:0:b0:2f7:544a:28af with SMTP id\n\t38308e7fff4ca-2f9d3e44c97mr55482531fa.14.1727687463122;\n\tMon, 30 Sep 2024 02:11:03 -0700 (PDT)","MIME-Version":"1.0","References":"<20240923091133.3328208-1-chenghaoyang@google.com>\n\t<20240923091133.3328208-2-chenghaoyang@google.com>\n\t<d671c87b48b5edfa5ce0082be0956dc62d99f342.camel@ndufresne.ca>","In-Reply-To":"<d671c87b48b5edfa5ce0082be0956dc62d99f342.camel@ndufresne.ca>","From":"Cheng-Hao Yang <chenghaoyang@chromium.org>","Date":"Mon, 30 Sep 2024 17:10:51 +0800","Message-ID":"<CAEB1ahucD4Z=x9tzakTX8XsEY88WiYbZy7zgvxdsz5TMa=JZxg@mail.gmail.com>","Subject":"Re: [PATCH 1/1] libcamera: Add formats introduced by MTK platform","To":"Nicolas Dufresne <nicolas@ndufresne.ca>","Cc":"libcamera-devel@lists.libcamera.org, \n\tHan-Lin Chen <hanlinchen@chromium.org>, Xing Gu <xinggu@chromium.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]