Message ID | 20240209164825.166800-2-jacopo.mondi@ideasonboard.com (mailing list archive) |
---|---|
State | Superseded |
Headers |
Received: from sy.mirrors.kernel.org ([147.75.48.161]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <linux-media+bounces-4887-patchwork=linuxtv.org@vger.kernel.org>) id 1rYU6O-0002Rc-17 for patchwork@linuxtv.org; Fri, 09 Feb 2024 16:51:49 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 53615B28D34 for <patchwork@linuxtv.org>; Fri, 9 Feb 2024 16:51:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 627267EEEF; Fri, 9 Feb 2024 16:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="th9YduPC" X-Original-To: linux-media@vger.kernel.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D0A07691B for <linux-media@vger.kernel.org>; Fri, 9 Feb 2024 16:48:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707497331; cv=none; b=VdE+Lwh8wNWpM3KbDl/TsQ6hH7KZkKQ1A2u4PYScJ5mfQaPe60WRZd6YlHCVVMRW2V8Skoet+XdgkudS6hqJMoJhPcLfCZH694QTJbiwXOTWkosqwuUkd7rhi0kaFouLLI7NIClLj80gEehUNB7S8k087ZKtkJPmwq4Wt9k/J8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707497331; c=relaxed/simple; bh=ZGU1VA9GBaD+RhQlH+sll9LBO9QBQ0ojmgtgWRLM5zg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nyKp/VvuWRozAnC8xgDMuUz8/Q7MwZojOGthe6+BOBwF2CMnXgdXg/n8V1aDqNOdYbX/ESONU53MDHpxXwmvPAeCXWtlgRWZ5dJMNl7wa/DVn+eBKYkOMjisi7/DhMmvsBNpMJaGBxIxE6cWxdmQpGLzhhVM6ku5qRXuh0NiXEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=th9YduPC; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from localhost.localdomain (unknown [IPv6:2001:b07:5d2e:52c9:cc1e:e404:491f:e6ea]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D5BDCD01; Fri, 9 Feb 2024 17:47:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1707497240; bh=ZGU1VA9GBaD+RhQlH+sll9LBO9QBQ0ojmgtgWRLM5zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=th9YduPC72ScDIdHI0U7aP5vuJJSQ6dENbuDrwIhb16r4r8v/7T291MmTi6se0WF8 GUz1ywPflX7ZbS6B8NEcVaXMTaj6uAAoN6l21DYdNQ5w8tZWEkVXq8UomfBlR+Dll4 Ogc+KDFB5kcVx/3ZgqYA7uqL/Zf4vJRpigd6dLSs= From: Jacopo Mondi <jacopo.mondi@ideasonboard.com> To: Linux Media Mailing List <linux-media@vger.kernel.org> Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>, David Plowman <david.plowman@raspberrypi.com>, Naushir Patuck <naush@raspberrypi.com>, Nick Hollinghurst <nick.hollinghurst@raspberrypi.org>, Dave Stevenson <dave.stevenson@raspberrypi.com>, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Kieran Bingham <kieran.bingham@ideasonboard.com>, Sakari Ailus <sakari.ailus@iki.fi>, Hans Verkuil <hverkuil-cisco@xs4all.nl>, Mauro Carvalho Chehab <mchehab@kernel.org> Subject: [PATCH 1/8] media: Add a pixel format for MIPI packed 12bit luma only. Date: Fri, 9 Feb 2024 17:48:16 +0100 Message-ID: <20240209164825.166800-2-jacopo.mondi@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240209164825.166800-1-jacopo.mondi@ideasonboard.com> References: <20240209164825.166800-1-jacopo.mondi@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: <linux-media.vger.kernel.org> List-Subscribe: <mailto:linux-media+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-media+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-LSpam-Score: -3.0 (---) X-LSpam-Report: No, score=-3.0 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DMARC_MISSING=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,RCVD_IN_DNSWL_MED=-2.3,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no |
Series |
media: raspberrypi: Add support for PiSP Back End
|
|
Commit Message
Jacopo Mondi
Feb. 9, 2024, 4:48 p.m. UTC
From: Dave Stevenson <dave.stevenson@raspberrypi.com> This is the format used by monochrome 12bit image sensors. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> --- .../userspace-api/media/v4l/pixfmt-y12p.rst | 38 +++++++++++++++++++ .../userspace-api/media/v4l/yuv-formats.rst | 1 + drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 4 files changed, 41 insertions(+) create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst
Comments
Le vendredi 09 février 2024 à 17:48 +0100, Jacopo Mondi a écrit : > From: Dave Stevenson <dave.stevenson@raspberrypi.com> > > This is the format used by monochrome 12bit image sensors. > > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > --- > .../userspace-api/media/v4l/pixfmt-y12p.rst | 38 +++++++++++++++++++ > .../userspace-api/media/v4l/yuv-formats.rst | 1 + > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 1 + > 4 files changed, 41 insertions(+) > create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > new file mode 100644 > index 000000000000..b2eb4a72724d > --- /dev/null > +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > @@ -0,0 +1,38 @@ > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later > + > +.. _V4L2-PIX-FMT-Y12P: > + > +****************************** > +V4L2_PIX_FMT_Y12P ('Y12P') > +****************************** > + > +Grey-scale image as a MIPI RAW12 packed array > + > + > +Description > +=========== > + > +This is a packed grey-scale image format with a depth of 12 bits per > +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes > +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 > +least significants bits of each pixel, in the same order. This is an interesting arrangement, which make me feel that Y12P is perhaps bit too generic ? Perhaps something like: V4L2_PIX_FMT_Y12_MIPI That being said, I don't mind if you reserve the nice and short name for the first occurrence of such format in 20 years (it might equally be the last). Will they do the same for Y10, by storing 4 bytes of higher 8bit of 4 pixels, and packing the remaining lower 2 bits packed in the fif bytes ? Cause for this one, we'd have confusion, since CODEC usually just place all the bits in order over 5 bytes here (which have its own issues of course). > + > +**Byte Order.** > +Each cell is one byte. > + > +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}| > + > + > +.. flat-table:: > + :header-rows: 0 > + :stub-columns: 0 > + :widths: 2 1 1 1 > + > + > + - - start + 0: > + - Y'\ :sub:`00high` > + - Y'\ :sub:`01high` > + - Y'\ :sub:`01low`\ (bits 7--4) > + > + Y'\ :sub:`00low`\ (bits 3--0) > + > diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst > index 24b34cdfa6fe..7c9ccfdd94cd 100644 > --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst > +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst > @@ -267,6 +267,7 @@ image. > pixfmt-packed-yuv > pixfmt-yuv-planar > pixfmt-yuv-luma > + pixfmt-y12p > pixfmt-y8i > pixfmt-y12i > pixfmt-uv8 > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 33076af4dfdb..483498c55899 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1311,6 +1311,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; > case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; > case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; > + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break; > case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; > case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; > case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index a8015e5e7fa4..11ebf9b22ccb 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -598,6 +598,7 @@ struct v4l2_pix_format { > /* Grey bit-packed formats */ > #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ > #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ > +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ > #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ > > /* Palette formats */
Hi Nicolas On Fri, 9 Feb 2024 at 17:53, Nicolas Dufresne <nicolas@ndufresne.ca> wrote: > > Le vendredi 09 février 2024 à 17:48 +0100, Jacopo Mondi a écrit : > > From: Dave Stevenson <dave.stevenson@raspberrypi.com> > > > > This is the format used by monochrome 12bit image sensors. > > > > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > --- > > .../userspace-api/media/v4l/pixfmt-y12p.rst | 38 +++++++++++++++++++ > > .../userspace-api/media/v4l/yuv-formats.rst | 1 + > > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > > include/uapi/linux/videodev2.h | 1 + > > 4 files changed, 41 insertions(+) > > create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > new file mode 100644 > > index 000000000000..b2eb4a72724d > > --- /dev/null > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > @@ -0,0 +1,38 @@ > > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later > > + > > +.. _V4L2-PIX-FMT-Y12P: > > + > > +****************************** > > +V4L2_PIX_FMT_Y12P ('Y12P') > > +****************************** > > + > > +Grey-scale image as a MIPI RAW12 packed array > > + > > + > > +Description > > +=========== > > + > > +This is a packed grey-scale image format with a depth of 12 bits per > > +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes > > +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 > > +least significants bits of each pixel, in the same order. > > This is an interesting arrangement, which make me feel that Y12P is perhaps bit > too generic ? Perhaps something like: > > V4L2_PIX_FMT_Y12_MIPI > > That being said, I don't mind if you reserve the nice and short name for the > first occurrence of such format in 20 years (it might equally be the last). Will > they do the same for Y10, by storing 4 bytes of higher 8bit of 4 pixels, and > packing the remaining lower 2 bits packed in the fif bytes ? Cause for this one, > we'd have confusion, since CODEC usually just place all the bits in order over 5 > bytes here (which have its own issues of course). We already have V4L2_PIX_FMT_Y10P defined for the MIPI packing for 10bit luma-only. https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-yuv-luma.html This is only extending the definitions for the other bit depths using the same pattern. Adding the P is also the same pattern as for the Bayer formats - V4L2_PIX_FMT_SRGGB10 for the 10bit unpacked to 16bit, and V4L2_PIX_FMT_SRGGB10P for the MIPI packed variant. I'm not inventing anything new here :) Dave > > + > > +**Byte Order.** > > +Each cell is one byte. > > + > > +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}| > > + > > + > > +.. flat-table:: > > + :header-rows: 0 > > + :stub-columns: 0 > > + :widths: 2 1 1 1 > > + > > + > > + - - start + 0: > > + - Y'\ :sub:`00high` > > + - Y'\ :sub:`01high` > > + - Y'\ :sub:`01low`\ (bits 7--4) > > + > > + Y'\ :sub:`00low`\ (bits 3--0) > > + > > diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst > > index 24b34cdfa6fe..7c9ccfdd94cd 100644 > > --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst > > +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst > > @@ -267,6 +267,7 @@ image. > > pixfmt-packed-yuv > > pixfmt-yuv-planar > > pixfmt-yuv-luma > > + pixfmt-y12p > > pixfmt-y8i > > pixfmt-y12i > > pixfmt-uv8 > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > > index 33076af4dfdb..483498c55899 100644 > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > > @@ -1311,6 +1311,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > > case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; > > case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; > > case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; > > + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break; > > case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; > > case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; > > case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > > index a8015e5e7fa4..11ebf9b22ccb 100644 > > --- a/include/uapi/linux/videodev2.h > > +++ b/include/uapi/linux/videodev2.h > > @@ -598,6 +598,7 @@ struct v4l2_pix_format { > > /* Grey bit-packed formats */ > > #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ > > #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ > > +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ > > #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ > > > > /* Palette formats */ >
Le vendredi 09 février 2024 à 19:28 +0000, Dave Stevenson a écrit : > Hi Nicolas > > On Fri, 9 Feb 2024 at 17:53, Nicolas Dufresne <nicolas@ndufresne.ca> wrote: > > > > Le vendredi 09 février 2024 à 17:48 +0100, Jacopo Mondi a écrit : > > > From: Dave Stevenson <dave.stevenson@raspberrypi.com> > > > > > > This is the format used by monochrome 12bit image sensors. > > > > > > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > > --- > > > .../userspace-api/media/v4l/pixfmt-y12p.rst | 38 +++++++++++++++++++ > > > .../userspace-api/media/v4l/yuv-formats.rst | 1 + > > > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > > > include/uapi/linux/videodev2.h | 1 + > > > 4 files changed, 41 insertions(+) > > > create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > > > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > new file mode 100644 > > > index 000000000000..b2eb4a72724d > > > --- /dev/null > > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > @@ -0,0 +1,38 @@ > > > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later > > > + > > > +.. _V4L2-PIX-FMT-Y12P: > > > + > > > +****************************** > > > +V4L2_PIX_FMT_Y12P ('Y12P') > > > +****************************** > > > + > > > +Grey-scale image as a MIPI RAW12 packed array > > > + > > > + > > > +Description > > > +=========== > > > + > > > +This is a packed grey-scale image format with a depth of 12 bits per > > > +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes > > > +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 > > > +least significants bits of each pixel, in the same order. > > > > This is an interesting arrangement, which make me feel that Y12P is perhaps bit > > too generic ? Perhaps something like: > > > > V4L2_PIX_FMT_Y12_MIPI > > > > That being said, I don't mind if you reserve the nice and short name for the > > first occurrence of such format in 20 years (it might equally be the last). Will > > they do the same for Y10, by storing 4 bytes of higher 8bit of 4 pixels, and > > packing the remaining lower 2 bits packed in the fif bytes ? Cause for this one, > > we'd have confusion, since CODEC usually just place all the bits in order over 5 > > bytes here (which have its own issues of course). > > We already have V4L2_PIX_FMT_Y10P defined for the MIPI packing for > 10bit luma-only. > https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-yuv-luma.html > > This is only extending the definitions for the other bit depths using > the same pattern. > > Adding the P is also the same pattern as for the Bayer formats - > V4L2_PIX_FMT_SRGGB10 for the 10bit unpacked to 16bit, and > V4L2_PIX_FMT_SRGGB10P for the MIPI packed variant. > > I'm not inventing anything new here :) A bit sad, but what can we do, I keep missing patches ;-P Nicolas > > Dave > > > > + > > > +**Byte Order.** > > > +Each cell is one byte. > > > + > > > +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}| > > > + > > > + > > > +.. flat-table:: > > > + :header-rows: 0 > > > + :stub-columns: 0 > > > + :widths: 2 1 1 1 > > > + > > > + > > > + - - start + 0: > > > + - Y'\ :sub:`00high` > > > + - Y'\ :sub:`01high` > > > + - Y'\ :sub:`01low`\ (bits 7--4) > > > + > > > + Y'\ :sub:`00low`\ (bits 3--0) > > > + > > > diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > index 24b34cdfa6fe..7c9ccfdd94cd 100644 > > > --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > @@ -267,6 +267,7 @@ image. > > > pixfmt-packed-yuv > > > pixfmt-yuv-planar > > > pixfmt-yuv-luma > > > + pixfmt-y12p > > > pixfmt-y8i > > > pixfmt-y12i > > > pixfmt-uv8 > > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > > > index 33076af4dfdb..483498c55899 100644 > > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > > > @@ -1311,6 +1311,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > > > case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; > > > case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; > > > case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; > > > + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break; > > > case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; > > > case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; > > > case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; > > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > > > index a8015e5e7fa4..11ebf9b22ccb 100644 > > > --- a/include/uapi/linux/videodev2.h > > > +++ b/include/uapi/linux/videodev2.h > > > @@ -598,6 +598,7 @@ struct v4l2_pix_format { > > > /* Grey bit-packed formats */ > > > #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ > > > #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ > > > +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ > > > #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ > > > > > > /* Palette formats */ > >
On Fri, 9 Feb 2024 at 21:15, Nicolas Dufresne <nicolas@ndufresne.ca> wrote: > > Le vendredi 09 février 2024 à 19:28 +0000, Dave Stevenson a écrit : > > Hi Nicolas > > > > On Fri, 9 Feb 2024 at 17:53, Nicolas Dufresne <nicolas@ndufresne.ca> wrote: > > > > > > Le vendredi 09 février 2024 à 17:48 +0100, Jacopo Mondi a écrit : > > > > From: Dave Stevenson <dave.stevenson@raspberrypi.com> > > > > > > > > This is the format used by monochrome 12bit image sensors. > > > > > > > > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > > > --- > > > > .../userspace-api/media/v4l/pixfmt-y12p.rst | 38 +++++++++++++++++++ > > > > .../userspace-api/media/v4l/yuv-formats.rst | 1 + > > > > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > > > > include/uapi/linux/videodev2.h | 1 + > > > > 4 files changed, 41 insertions(+) > > > > create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > > > > > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > > new file mode 100644 > > > > index 000000000000..b2eb4a72724d > > > > --- /dev/null > > > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > > @@ -0,0 +1,38 @@ > > > > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later > > > > + > > > > +.. _V4L2-PIX-FMT-Y12P: > > > > + > > > > +****************************** > > > > +V4L2_PIX_FMT_Y12P ('Y12P') > > > > +****************************** > > > > + > > > > +Grey-scale image as a MIPI RAW12 packed array > > > > + > > > > + > > > > +Description > > > > +=========== > > > > + > > > > +This is a packed grey-scale image format with a depth of 12 bits per > > > > +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes > > > > +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 > > > > +least significants bits of each pixel, in the same order. > > > > > > This is an interesting arrangement, which make me feel that Y12P is perhaps bit > > > too generic ? Perhaps something like: > > > > > > V4L2_PIX_FMT_Y12_MIPI > > > > > > That being said, I don't mind if you reserve the nice and short name for the > > > first occurrence of such format in 20 years (it might equally be the last). Will > > > they do the same for Y10, by storing 4 bytes of higher 8bit of 4 pixels, and > > > packing the remaining lower 2 bits packed in the fif bytes ? Cause for this one, > > > we'd have confusion, since CODEC usually just place all the bits in order over 5 > > > bytes here (which have its own issues of course). > > > > We already have V4L2_PIX_FMT_Y10P defined for the MIPI packing for > > 10bit luma-only. > > https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-yuv-luma.html > > > > This is only extending the definitions for the other bit depths using > > the same pattern. > > > > Adding the P is also the same pattern as for the Bayer formats - > > V4L2_PIX_FMT_SRGGB10 for the 10bit unpacked to 16bit, and > > V4L2_PIX_FMT_SRGGB10P for the MIPI packed variant. > > > > I'm not inventing anything new here :) > > A bit sad, but what can we do, I keep missing patches ;-P Not recently though. V4L2_PIX_FMT_Y10P was added in July 2018. [1] The use of V4L2_PIX_FMT_Sxxxx10P for Bayer format MIPI 10 bit packing was added in Dec 2014 [2] Dave [1] 6e15bec49f36 media: v4l: Add new 10-bit packed grayscale format [2] 4353e36ee84d [media] v4l: Add packed Bayer raw10 pixel formats > Nicolas > > > > > Dave > > > > > > + > > > > +**Byte Order.** > > > > +Each cell is one byte. > > > > + > > > > +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}| > > > > + > > > > + > > > > +.. flat-table:: > > > > + :header-rows: 0 > > > > + :stub-columns: 0 > > > > + :widths: 2 1 1 1 > > > > + > > > > + > > > > + - - start + 0: > > > > + - Y'\ :sub:`00high` > > > > + - Y'\ :sub:`01high` > > > > + - Y'\ :sub:`01low`\ (bits 7--4) > > > > + > > > > + Y'\ :sub:`00low`\ (bits 3--0) > > > > + > > > > diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > > index 24b34cdfa6fe..7c9ccfdd94cd 100644 > > > > --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > > +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > > @@ -267,6 +267,7 @@ image. > > > > pixfmt-packed-yuv > > > > pixfmt-yuv-planar > > > > pixfmt-yuv-luma > > > > + pixfmt-y12p > > > > pixfmt-y8i > > > > pixfmt-y12i > > > > pixfmt-uv8 > > > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > > > > index 33076af4dfdb..483498c55899 100644 > > > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > > > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > > > > @@ -1311,6 +1311,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > > > > case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; > > > > case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; > > > > case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; > > > > + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break; > > > > case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; > > > > case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; > > > > case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; > > > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > > > > index a8015e5e7fa4..11ebf9b22ccb 100644 > > > > --- a/include/uapi/linux/videodev2.h > > > > +++ b/include/uapi/linux/videodev2.h > > > > @@ -598,6 +598,7 @@ struct v4l2_pix_format { > > > > /* Grey bit-packed formats */ > > > > #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ > > > > #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ > > > > +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ > > > > #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ > > > > > > > > /* Palette formats */ > > > >
Hi Jacopo, On Fri, Feb 09, 2024 at 05:48:16PM +0100, Jacopo Mondi wrote: > From: Dave Stevenson <dave.stevenson@raspberrypi.com> > > This is the format used by monochrome 12bit image sensors. > > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > --- > .../userspace-api/media/v4l/pixfmt-y12p.rst | 38 +++++++++++++++++++ > .../userspace-api/media/v4l/yuv-formats.rst | 1 + > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 1 + > 4 files changed, 41 insertions(+) > create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > new file mode 100644 > index 000000000000..b2eb4a72724d > --- /dev/null > +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > @@ -0,0 +1,38 @@ > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later > + > +.. _V4L2-PIX-FMT-Y12P: > + > +****************************** > +V4L2_PIX_FMT_Y12P ('Y12P') > +****************************** You have extra asterisks here. > + > +Grey-scale image as a MIPI RAW12 packed array I think you may mention it aligns with MIPI CSI-2 but the same packing may be used elsewhere, it's fairly trivial. The similar Bayer format definitions don't mention this. > + > + > +Description > +=========== > + > +This is a packed grey-scale image format with a depth of 12 bits per > +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes > +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 > +least significants bits of each pixel, in the same order. > + > +**Byte Order.** > +Each cell is one byte. > + > +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}| > + > + > +.. flat-table:: > + :header-rows: 0 > + :stub-columns: 0 > + :widths: 2 1 1 1 > + > + > + - - start + 0: > + - Y'\ :sub:`00high` > + - Y'\ :sub:`01high` > + - Y'\ :sub:`01low`\ (bits 7--4) > + Is the newline here intentional? > + Y'\ :sub:`00low`\ (bits 3--0) > + > diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst > index 24b34cdfa6fe..7c9ccfdd94cd 100644 > --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst > +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst > @@ -267,6 +267,7 @@ image. > pixfmt-packed-yuv > pixfmt-yuv-planar > pixfmt-yuv-luma > + pixfmt-y12p > pixfmt-y8i > pixfmt-y12i > pixfmt-uv8 > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 33076af4dfdb..483498c55899 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1311,6 +1311,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; > case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; > case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; > + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break; > case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; > case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; > case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index a8015e5e7fa4..11ebf9b22ccb 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -598,6 +598,7 @@ struct v4l2_pix_format { > /* Grey bit-packed formats */ > #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ > #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ > +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ > #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ > > /* Palette formats */
Hello On Mon, Feb 12, 2024 at 11:58:32AM +0000, Dave Stevenson wrote: > On Fri, 9 Feb 2024 at 21:15, Nicolas Dufresne <nicolas@ndufresne.ca> wrote: > > > > Le vendredi 09 février 2024 à 19:28 +0000, Dave Stevenson a écrit : > > > Hi Nicolas > > > > > > On Fri, 9 Feb 2024 at 17:53, Nicolas Dufresne <nicolas@ndufresne.ca> wrote: > > > > > > > > Le vendredi 09 février 2024 à 17:48 +0100, Jacopo Mondi a écrit : > > > > > From: Dave Stevenson <dave.stevenson@raspberrypi.com> > > > > > > > > > > This is the format used by monochrome 12bit image sensors. > > > > > > > > > > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> > > > > > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > > > > --- > > > > > .../userspace-api/media/v4l/pixfmt-y12p.rst | 38 +++++++++++++++++++ > > > > > .../userspace-api/media/v4l/yuv-formats.rst | 1 + > > > > > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > > > > > include/uapi/linux/videodev2.h | 1 + > > > > > 4 files changed, 41 insertions(+) > > > > > create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > > > > > > > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > > > new file mode 100644 > > > > > index 000000000000..b2eb4a72724d > > > > > --- /dev/null > > > > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst > > > > > @@ -0,0 +1,38 @@ > > > > > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later > > > > > + > > > > > +.. _V4L2-PIX-FMT-Y12P: > > > > > + > > > > > +****************************** > > > > > +V4L2_PIX_FMT_Y12P ('Y12P') > > > > > +****************************** > > > > > + > > > > > +Grey-scale image as a MIPI RAW12 packed array > > > > > + > > > > > + > > > > > +Description > > > > > +=========== > > > > > + > > > > > +This is a packed grey-scale image format with a depth of 12 bits per > > > > > +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes > > > > > +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 > > > > > +least significants bits of each pixel, in the same order. > > > > > > > > This is an interesting arrangement, which make me feel that Y12P is perhaps bit > > > > too generic ? Perhaps something like: > > > > > > > > V4L2_PIX_FMT_Y12_MIPI > > > > > > > > That being said, I don't mind if you reserve the nice and short name for the > > > > first occurrence of such format in 20 years (it might equally be the last). Will > > > > they do the same for Y10, by storing 4 bytes of higher 8bit of 4 pixels, and > > > > packing the remaining lower 2 bits packed in the fif bytes ? Cause for this one, > > > > we'd have confusion, since CODEC usually just place all the bits in order over 5 > > > > bytes here (which have its own issues of course). > > > > > > We already have V4L2_PIX_FMT_Y10P defined for the MIPI packing for > > > 10bit luma-only. > > > https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/pixfmt-yuv-luma.html > > > > > > This is only extending the definitions for the other bit depths using > > > the same pattern. > > > I now wonder why creating two new files instead of adding Y12P and Y14P to the table of luma-only formats we have in the above mentioned file. In the notes at the bottom of the page we can indeed report that the P variants of the Y10 Y12 and Y14 formats are packed according to the MIPI CSI-2 specification, even if, as Dave said, this is a pretty standard convention for the educated readers of the v4l2 spec. In facts, this is what has been done already for the existing luma formats in: af4f45057695 ("media: doc: pixfmt-yuv: Move all luma-only YUV formats to common file") So I guess it's correct to keep expanding the existing file instead of adding new ones. Sorry for not having realized it earlier. > > > Adding the P is also the same pattern as for the Bayer formats - > > > V4L2_PIX_FMT_SRGGB10 for the 10bit unpacked to 16bit, and > > > V4L2_PIX_FMT_SRGGB10P for the MIPI packed variant. > > > > > > I'm not inventing anything new here :) > > > > A bit sad, but what can we do, I keep missing patches ;-P > > Not recently though. > > V4L2_PIX_FMT_Y10P was added in July 2018. [1] > The use of V4L2_PIX_FMT_Sxxxx10P for Bayer format MIPI 10 bit packing > was added in Dec 2014 [2] > > Dave > > [1] 6e15bec49f36 media: v4l: Add new 10-bit packed grayscale format > [2] 4353e36ee84d [media] v4l: Add packed Bayer raw10 pixel formats > > > Nicolas > > > > > > > > Dave > > > > > > > > + > > > > > +**Byte Order.** > > > > > +Each cell is one byte. > > > > > + > > > > > +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}| > > > > > + > > > > > + > > > > > +.. flat-table:: > > > > > + :header-rows: 0 > > > > > + :stub-columns: 0 > > > > > + :widths: 2 1 1 1 > > > > > + > > > > > + > > > > > + - - start + 0: > > > > > + - Y'\ :sub:`00high` > > > > > + - Y'\ :sub:`01high` > > > > > + - Y'\ :sub:`01low`\ (bits 7--4) > > > > > + > > > > > + Y'\ :sub:`00low`\ (bits 3--0) > > > > > + > > > > > diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > > > index 24b34cdfa6fe..7c9ccfdd94cd 100644 > > > > > --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > > > +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst > > > > > @@ -267,6 +267,7 @@ image. > > > > > pixfmt-packed-yuv > > > > > pixfmt-yuv-planar > > > > > pixfmt-yuv-luma > > > > > + pixfmt-y12p > > > > > pixfmt-y8i > > > > > pixfmt-y12i > > > > > pixfmt-uv8 > > > > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > > > > > index 33076af4dfdb..483498c55899 100644 > > > > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > > > > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > > > > > @@ -1311,6 +1311,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > > > > > case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; > > > > > case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; > > > > > case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; > > > > > + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break; > > > > > case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; > > > > > case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; > > > > > case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; > > > > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > > > > > index a8015e5e7fa4..11ebf9b22ccb 100644 > > > > > --- a/include/uapi/linux/videodev2.h > > > > > +++ b/include/uapi/linux/videodev2.h > > > > > @@ -598,6 +598,7 @@ struct v4l2_pix_format { > > > > > /* Grey bit-packed formats */ > > > > > #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ > > > > > #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ > > > > > +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ > > > > > #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ > > > > > > > > > > /* Palette formats */ > > > > > >
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst new file mode 100644 index 000000000000..b2eb4a72724d --- /dev/null +++ b/Documentation/userspace-api/media/v4l/pixfmt-y12p.rst @@ -0,0 +1,38 @@ +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later + +.. _V4L2-PIX-FMT-Y12P: + +****************************** +V4L2_PIX_FMT_Y12P ('Y12P') +****************************** + +Grey-scale image as a MIPI RAW12 packed array + + +Description +=========== + +This is a packed grey-scale image format with a depth of 12 bits per +pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes +contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 +least significants bits of each pixel, in the same order. + +**Byte Order.** +Each cell is one byte. + +.. tabularcolumns:: |p{2.2cm}|p{1.2cm}|p{1.2cm}|p{3.1cm}| + + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 2 1 1 1 + + + - - start + 0: + - Y'\ :sub:`00high` + - Y'\ :sub:`01high` + - Y'\ :sub:`01low`\ (bits 7--4) + + Y'\ :sub:`00low`\ (bits 3--0) + diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst index 24b34cdfa6fe..7c9ccfdd94cd 100644 --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst @@ -267,6 +267,7 @@ image. pixfmt-packed-yuv pixfmt-yuv-planar pixfmt-yuv-luma + pixfmt-y12p pixfmt-y8i pixfmt-y12i pixfmt-uv8 diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 33076af4dfdb..483498c55899 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1311,6 +1311,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_Y16_BE: descr = "16-bit Greyscale BE"; break; case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break; case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break; + case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break; case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break; case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break; case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index a8015e5e7fa4..11ebf9b22ccb 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -598,6 +598,7 @@ struct v4l2_pix_format { /* Grey bit-packed formats */ #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */ +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */ #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */ /* Palette formats */