[{"id":30655,"web_url":"https://patchwork.libcamera.org/comment/30655/","msgid":"<20240807095201.GF21319@pendragon.ideasonboard.com>","date":"2024-08-07T09:52:01","subject":"Re: [PATCH v1 1/2] libcamera: formats: Adding Support for Y12P","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Aug 07, 2024 at 10:34:48AM +0100, Naushir Patuck wrote:\n> From: will whang <will@willwhang.com>\n> \n> Add support for the 12-bit Mono (V4L2_PIX_FMT_Y12P) format.\n> This format is used by the IMX585 mono sensor.\n\nThe patch looks fine, but the commit message needs a rework. I think you\ncan just say the format is supported by the Unicam driver, and is\ntherefore useful in libcamera for RAW12 monochrome sensors.\n\n> Signed-off-by: will whang <will@willwhang.com>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/libcamera/bayer_format.cpp     |  2 ++\n>  src/libcamera/formats.cpp          | 10 ++++++++++\n>  src/libcamera/formats.yaml         |  3 +++\n>  src/libcamera/v4l2_pixelformat.cpp |  2 ++\n>  4 files changed, 17 insertions(+)\n> \n> diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> index 014f716d28f7..c2120d1c16d7 100644\n> --- a/src/libcamera/bayer_format.cpp\n> +++ b/src/libcamera/bayer_format.cpp\n> @@ -184,6 +184,8 @@ const std::map<BayerFormat, Formats, BayerFormatComparator> bayerToFormat{\n>  \t\t{ formats::R10_CSI2P, V4L2PixelFormat(V4L2_PIX_FMT_Y10P) } },\n>  \t{ { BayerFormat::MONO, 12, BayerFormat::Packing::None },\n>  \t\t{ formats::R12, V4L2PixelFormat(V4L2_PIX_FMT_Y12) } },\n> +\t{ { BayerFormat::MONO, 12, BayerFormat::Packing::CSI2 },\n> +\t\t{ formats::R12_CSI2P, V4L2PixelFormat(V4L2_PIX_FMT_Y12P) } },\n>  \t{ { BayerFormat::MONO, 16, BayerFormat::Packing::None },\n>  \t\t{ formats::R16, V4L2PixelFormat(V4L2_PIX_FMT_Y16) } },\n>  \t{ { BayerFormat::MONO, 16, BayerFormat::Packing::PISP1 },\n> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> index cf41f2c261ed..f338fc373f33 100644\n> --- a/src/libcamera/formats.cpp\n> +++ b/src/libcamera/formats.cpp\n> @@ -527,6 +527,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n>  \t\t.pixelsPerGroup = 4,\n>  \t\t.planes = {{ { 5, 1 }, { 0, 0 }, { 0, 0 } }},\n>  \t} },\n> +\t{ formats::R12_CSI2P, {\n> +\t\t.name = \"R12_CSI2P\",\n> +\t\t.format = formats::R12_CSI2P,\n> +\t\t.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_Y12P), },\n> +\t\t.bitsPerPixel = 12,\n> +\t\t.colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> +\t\t.packed = true,\n> +\t\t.pixelsPerGroup = 2,\n> +\t\t.planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }},\n> +\t} },\n>  \t{ formats::R12, {\n>  \t\t.name = \"R12\",\n>  \t\t.format = formats::R12,\n> diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml\n> index fe027a7cce70..2d54d391ca01 100644\n> --- a/src/libcamera/formats.yaml\n> +++ b/src/libcamera/formats.yaml\n> @@ -138,6 +138,9 @@ formats:\n>    - R10_CSI2P:\n>        fourcc: DRM_FORMAT_R10\n>        mod: MIPI_FORMAT_MOD_CSI2_PACKED\n> +  - R12_CSI2P:\n> +      fourcc: DRM_FORMAT_R12\n> +      mod: MIPI_FORMAT_MOD_CSI2_PACKED\n>  \n>    - SRGGB10_CSI2P:\n>        fourcc: DRM_FORMAT_SRGGB10\n> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\n> index 70568335b266..eb9ac2224fd1 100644\n> --- a/src/libcamera/v4l2_pixelformat.cpp\n> +++ b/src/libcamera/v4l2_pixelformat.cpp\n> @@ -139,6 +139,8 @@ const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{\n>  \t\t{ formats::R10_CSI2P, \"10-bit Greyscale Packed\" } },\n>  \t{ V4L2PixelFormat(V4L2_PIX_FMT_Y12),\n>  \t\t{ formats::R12, \"12-bit Greyscale\" } },\n> +\t{ V4L2PixelFormat(V4L2_PIX_FMT_Y12P),\n> +\t\t{ formats::R12_CSI2P, \"12-bit Greyscale Packed\" } },\n>  \t{ V4L2PixelFormat(V4L2_PIX_FMT_Y16),\n>  \t\t{ formats::R16, \"16-bit Greyscale\" } },\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 828EABE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Aug 2024 09:52:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7D11863393;\n\tWed,  7 Aug 2024 11:52:26 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 15A3461946\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Aug 2024 11:52:25 +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 20F642EC;\n\tWed,  7 Aug 2024 11:51:32 +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=\"fBMJPR1v\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723024292;\n\tbh=9/3ftg49R7xd4n+bmcASMLYJI0BN1eZOk/K1AlE1mkc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fBMJPR1vscYoAk49lhgOcDwUAuf/dv8TV9VE+ddx0kF8+eu3FJpkyny4ifPb3MZTB\n\to7qdv5MHbdrdVDpMJMlzMTDEE+wwmzNOSjmkZ4aYlXzhQBEQ0LR524yFMOgTUMyMKb\n\twwDzjO3ES1DF0jMjIlx49Tda9/i9HRgd0ZI/tGDw=","Date":"Wed, 7 Aug 2024 12:52:01 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org, will whang <will@willwhang.com>","Subject":"Re: [PATCH v1 1/2] libcamera: formats: Adding Support for Y12P","Message-ID":"<20240807095201.GF21319@pendragon.ideasonboard.com>","References":"<20240807093449.1926-1-naush@raspberrypi.com>\n\t<20240807093449.1926-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240807093449.1926-2-naush@raspberrypi.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":30656,"web_url":"https://patchwork.libcamera.org/comment/30656/","msgid":"<CAEmqJPpUMkf=imWPOLOJUv3vR6Ba4YqxJo03g-J+C7HUACgHrA@mail.gmail.com>","date":"2024-08-07T09:55:51","subject":"Re: [PATCH v1 1/2] libcamera: formats: Adding Support for Y12P","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"content":"On Wed, 7 Aug 2024 at 10:52, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> On Wed, Aug 07, 2024 at 10:34:48AM +0100, Naushir Patuck wrote:\n> > From: will whang <will@willwhang.com>\n> >\n> > Add support for the 12-bit Mono (V4L2_PIX_FMT_Y12P) format.\n> > This format is used by the IMX585 mono sensor.\n>\n> The patch looks fine, but the commit message needs a rework. I think you\n> can just say the format is supported by the Unicam driver, and is\n> therefore useful in libcamera for RAW12 monochrome sensors.\n\nSorry, I only saw your comment on the previous patch set after I hit send-email.\n\nHappy to change this. I can post another patch, or make the change\nwhen applying if there are no other issues raised.\n\nNaush\n\n\n>\n> > Signed-off-by: will whang <will@willwhang.com>\n> > Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> > ---\n> >  src/libcamera/bayer_format.cpp     |  2 ++\n> >  src/libcamera/formats.cpp          | 10 ++++++++++\n> >  src/libcamera/formats.yaml         |  3 +++\n> >  src/libcamera/v4l2_pixelformat.cpp |  2 ++\n> >  4 files changed, 17 insertions(+)\n> >\n> > diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\n> > index 014f716d28f7..c2120d1c16d7 100644\n> > --- a/src/libcamera/bayer_format.cpp\n> > +++ b/src/libcamera/bayer_format.cpp\n> > @@ -184,6 +184,8 @@ const std::map<BayerFormat, Formats, BayerFormatComparator> bayerToFormat{\n> >               { formats::R10_CSI2P, V4L2PixelFormat(V4L2_PIX_FMT_Y10P) } },\n> >       { { BayerFormat::MONO, 12, BayerFormat::Packing::None },\n> >               { formats::R12, V4L2PixelFormat(V4L2_PIX_FMT_Y12) } },\n> > +     { { BayerFormat::MONO, 12, BayerFormat::Packing::CSI2 },\n> > +             { formats::R12_CSI2P, V4L2PixelFormat(V4L2_PIX_FMT_Y12P) } },\n> >       { { BayerFormat::MONO, 16, BayerFormat::Packing::None },\n> >               { formats::R16, V4L2PixelFormat(V4L2_PIX_FMT_Y16) } },\n> >       { { BayerFormat::MONO, 16, BayerFormat::Packing::PISP1 },\n> > diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp\n> > index cf41f2c261ed..f338fc373f33 100644\n> > --- a/src/libcamera/formats.cpp\n> > +++ b/src/libcamera/formats.cpp\n> > @@ -527,6 +527,16 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{\n> >               .pixelsPerGroup = 4,\n> >               .planes = {{ { 5, 1 }, { 0, 0 }, { 0, 0 } }},\n> >       } },\n> > +     { formats::R12_CSI2P, {\n> > +             .name = \"R12_CSI2P\",\n> > +             .format = formats::R12_CSI2P,\n> > +             .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_Y12P), },\n> > +             .bitsPerPixel = 12,\n> > +             .colourEncoding = PixelFormatInfo::ColourEncodingYUV,\n> > +             .packed = true,\n> > +             .pixelsPerGroup = 2,\n> > +             .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }},\n> > +     } },\n> >       { formats::R12, {\n> >               .name = \"R12\",\n> >               .format = formats::R12,\n> > diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml\n> > index fe027a7cce70..2d54d391ca01 100644\n> > --- a/src/libcamera/formats.yaml\n> > +++ b/src/libcamera/formats.yaml\n> > @@ -138,6 +138,9 @@ formats:\n> >    - R10_CSI2P:\n> >        fourcc: DRM_FORMAT_R10\n> >        mod: MIPI_FORMAT_MOD_CSI2_PACKED\n> > +  - R12_CSI2P:\n> > +      fourcc: DRM_FORMAT_R12\n> > +      mod: MIPI_FORMAT_MOD_CSI2_PACKED\n> >\n> >    - SRGGB10_CSI2P:\n> >        fourcc: DRM_FORMAT_SRGGB10\n> > diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\n> > index 70568335b266..eb9ac2224fd1 100644\n> > --- a/src/libcamera/v4l2_pixelformat.cpp\n> > +++ b/src/libcamera/v4l2_pixelformat.cpp\n> > @@ -139,6 +139,8 @@ const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{\n> >               { formats::R10_CSI2P, \"10-bit Greyscale Packed\" } },\n> >       { V4L2PixelFormat(V4L2_PIX_FMT_Y12),\n> >               { formats::R12, \"12-bit Greyscale\" } },\n> > +     { V4L2PixelFormat(V4L2_PIX_FMT_Y12P),\n> > +             { formats::R12_CSI2P, \"12-bit Greyscale Packed\" } },\n> >       { V4L2PixelFormat(V4L2_PIX_FMT_Y16),\n> >               { formats::R16, \"16-bit Greyscale\" } },\n> >\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 A0D52C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Aug 2024 09:56:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A74AC63394;\n\tWed,  7 Aug 2024 11:56:30 +0200 (CEST)","from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com\n\t[IPv6:2607:f8b0:4864:20::112b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1ADD463382\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Aug 2024 11:56:28 +0200 (CEST)","by mail-yw1-x112b.google.com with SMTP id\n\t00721157ae682-690404fd27eso13616657b3.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 07 Aug 2024 02:56:28 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"VkyuLfMU\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1723024587; x=1723629387;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=c7Mwi9cj3ydyIm49U7eJygTk9LyyVGKnD/fZwr/Qqbw=;\n\tb=VkyuLfMUl1RcXwmvyNAyF00zgyC9EudaAt8w+UyIi9R0powkBpePD6RCqebqFuxs+R\n\t6WTqNY2z791Bc2L8jANn4QkWzsewHeR8n9AZDBlPnnL9QNSbiUmmfpWTa+WcRk0SVk0/\n\tTM0khVwfvIpeg5YMDwLfN1JC+Nl5jhVnz7pGnWQ5mJOvwwWMeAtJLPwkpv9gSmrDFLKK\n\tMdrNOfBRIvLsjMHnNO2VYhr/mFstL3W+Fz+QI7q5pK67hOe5BQTCf4OiMM6y++Nz/xBd\n\tgyX4pPmaDtIP7DAgT6yIq6UgQXmVZBtsft+yUl2acjmsYhWLNDijd6LPxW/Jj3AZOquR\n\tTSGw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1723024587; x=1723629387;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=c7Mwi9cj3ydyIm49U7eJygTk9LyyVGKnD/fZwr/Qqbw=;\n\tb=qdNdaducmSW6XPl3IYpP9VSSX/fzrMSh6iOkBgESanHV/hUIYtO4gbBrpAFdYClzzK\n\t6OL0dgZNpkyHqpup5NO9qFCKQIQwzw5pSzNk2oTlLS7sFnyF/bwZiq+sl1kt+Flyn1P1\n\tv11nS2ovsYvFcVUU/4oqGHjX/lWibfX6w8xmheopg2tjskaMs5GxvsDP0nkFFGMoBHRp\n\tTs1HXonB+KU1xlroGjimLf9jsWDvLIOpmzIFchsefVeCm19ubNVKoITLsY/CPzcqtE9D\n\tyBqEX1ketBVaRCs1Nmv5Jh42e3J1STr+LX1v0zac7zLeviU1fJHu9e1+wj/vNwV1a2ac\n\tu1xw==","X-Gm-Message-State":"AOJu0YyV057g47ifutonmnjqLCfIfYI4FHbKnbqy88NsO1q4R76ODfDe\n\t2iGTtp1FrPywltPZmIT8ycSHB/soAyn2qJaqNiV+imcWpVKVRV2YH5vnu/jSrAg3GJUM/CzMv/A\n\t64Fcf8mmpRJIVyr6p8QU9OC/tDhL7Q3C27RPMekIIiafBU4mn","X-Google-Smtp-Source":"AGHT+IFOmGLZIbAFuzKwF6nS9SLv0AwrGpxalCVG59uZOD7mWKIcomEmTy7yzzsv2i+/gjqDOEMYxfQcSk8qRxp3ePY=","X-Received":"by 2002:a05:690c:2910:b0:632:77ca:dafd with SMTP id\n\t00721157ae682-6994e688610mr13797967b3.10.1723024586826;\n\tWed, 07 Aug 2024 02:56:26 -0700 (PDT)","MIME-Version":"1.0","References":"<20240807093449.1926-1-naush@raspberrypi.com>\n\t<20240807093449.1926-2-naush@raspberrypi.com>\n\t<20240807095201.GF21319@pendragon.ideasonboard.com>","In-Reply-To":"<20240807095201.GF21319@pendragon.ideasonboard.com>","From":"Naushir Patuck <naush@raspberrypi.com>","Date":"Wed, 7 Aug 2024 10:55:51 +0100","Message-ID":"<CAEmqJPpUMkf=imWPOLOJUv3vR6Ba4YqxJo03g-J+C7HUACgHrA@mail.gmail.com>","Subject":"Re: [PATCH v1 1/2] libcamera: formats: Adding Support for Y12P","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, will whang <will@willwhang.com>","Content-Type":"text/plain; charset=\"UTF-8\"","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>"}}]