linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com
Cc: dafna.hirschfeld@collabora.com, helen.koike@collabora.com,
	ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com,
	dafna3@gmail.com, sakari.ailus@linux.intel.com,
	linux-rockchip@lists.infradead.org, mchehab@kernel.org,
	tfiga@chromium.org, skhan@linuxfoundation.org,
	p.zabel@pengutronix.de
Subject: [RFC v4 8/8] media: v4l2: add support for the CSC API for hsv_enc on mediabus
Date: Fri,  5 Jun 2020 19:26:25 +0200	[thread overview]
Message-ID: <20200605172625.19777-9-dafna.hirschfeld@collabora.com> (raw)
In-Reply-To: <20200605172625.19777-1-dafna.hirschfeld@collabora.com>

Add the flag V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC that drivers
can set when enumerating the supported mediabus formats
on subdevices to indicate that the userspace can ask to
set the 'hsv_enc'. The patch also replaces the 'ycbcr_enc'
field in 'struct v4l2_mbus_framefmt' with a union that
includes 'hsv_enc'

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 .../media/v4l/subdev-formats.rst              | 22 +++++++++++++++++--
 include/uapi/linux/v4l2-mediabus.h            |  8 ++++++-
 include/uapi/linux/v4l2-subdev.h              |  1 +
 3 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/Documentation/userspace-api/media/v4l/subdev-formats.rst b/Documentation/userspace-api/media/v4l/subdev-formats.rst
index 75eb7f8bb4c5..d06d1ac95452 100644
--- a/Documentation/userspace-api/media/v4l/subdev-formats.rst
+++ b/Documentation/userspace-api/media/v4l/subdev-formats.rst
@@ -44,6 +44,8 @@ Media Bus Formats
       - Image colorspace, from enum
 	:c:type:`v4l2_colorspace`. See
 	:ref:`colorspaces` for details.
+    * - union {
+      - (anonymous)
     * - __u16
       - ``ycbcr_enc``
       - Y'CbCr encoding, from enum :c:type:`v4l2_ycbcr_encoding`.
@@ -59,7 +61,23 @@ Media Bus Formats
 	V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC in the corresponding struct
 	:c:type:`v4l2_subdev_mbus_code_enum` during enumeration.
 	See :ref:`v4l2-subdev-mbus-code-flags`
-
+    * - __u16
+      - ``hsv_enc``
+      - HSV encoding, from enum :c:type:`v4l2_hsv_encoding`.
+        This information supplements the ``colorspace`` and must be set by
+	the driver for capture streams and by the application for output
+	streams, see :ref:`colorspaces`. If the application sets the
+	flag ``V4L2_MBUS_FRAMEFMT_SET_CSC`` then the application can set
+	this field for a capture stream to request a specific HSV encoding
+	for the media bus data. If the driver cannot handle requested
+	conversion, it will return another supported encoding.
+	This field is ignored for Y'CbCr media bus formats. The driver indicates
+	that hsv_enc conversion is supported by setting the flag
+	V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC in the corresponding struct
+	:c:type:`v4l2_subdev_mbus_code_enum` during enumeration.
+	See :ref:`v4l2-subdev-mbus-code-flags`
+    * - }
+      -
     * - __u16
       - ``quantization``
       - Quantization range, from enum :c:type:`v4l2_quantization`.
@@ -103,7 +121,7 @@ Media Bus Formats
       - Set by the application. It is only used for capture and is
 	ignored for output streams. If set, then request the subdevice to do
 	colorspace conversion from the received colorspace to the requested
-	colorspace values. If colorimetry field (``ycbcr_enc`` or
+	colorspace values. If colorimetry field (``ycbcr_enc``, ``hsv_enc`` or
 	``quantization``) is set to 0, then that colorimetry setting will remain
 	unchanged from what was received. So to change the quantization, only the
 	``quantization`` field shall be set to non-zero values
diff --git a/include/uapi/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h
index 0f916278137a..9c4a10d21a49 100644
--- a/include/uapi/linux/v4l2-mediabus.h
+++ b/include/uapi/linux/v4l2-mediabus.h
@@ -26,6 +26,7 @@
  * @field:	used interlacing type (from enum v4l2_field)
  * @colorspace:	colorspace of the data (from enum v4l2_colorspace)
  * @ycbcr_enc:	YCbCr encoding of the data (from enum v4l2_ycbcr_encoding)
+ * @hsv_enc:	HSV encoding of the data (from enum v4l2_hsv_encoding)
  * @quantization: quantization of the data (from enum v4l2_quantization)
  * @xfer_func:  transfer function of the data (from enum v4l2_xfer_func)
  */
@@ -35,7 +36,12 @@ struct v4l2_mbus_framefmt {
 	__u32			code;
 	__u32			field;
 	__u32			colorspace;
-	__u16			ycbcr_enc;
+	union {
+		/* enum v4l2_ycbcr_encoding */
+		__u16			ycbcr_enc;
+		/* enum v4l2_hsv_encoding */
+		__u16			hsv_enc;
+	};
 	__u16			quantization;
 	__u16			xfer_func;
 	__u16			flags;
diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index 972e64d8b54e..685f920de5c7 100644
--- a/include/uapi/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -66,6 +66,7 @@ struct v4l2_subdev_crop {
 };
 
 #define V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC	0x00000001
+#define V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC	0x00000001
 #define V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION	0x00000002
 /**
  * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
-- 
2.17.1


  parent reply	other threads:[~2020-06-05 17:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05 17:26 [RFC v4 0/8] v4l2: add support for colorspace conversion API (CSC) for video capture and subdevices Dafna Hirschfeld
2020-06-05 17:26 ` [RFC v4 1/8] media: staging: rkisp1: rsz: supported formats are the isp's src formats, not sink formats Dafna Hirschfeld
2020-06-08 11:33   ` Hans Verkuil
2020-06-05 17:26 ` [RFC v4 2/8] media: staging: rkisp1: rsz: set default format if the given format is not RKISP1_DIR_SRC Dafna Hirschfeld
2020-06-08 11:31   ` Hans Verkuil
2020-06-05 17:26 ` [RFC v4 3/8] media: Documentation: v4l: move table of v4l2_pix_format(_mplane) flags to pixfmt-v4l2.rst Dafna Hirschfeld
2020-06-25 23:29   ` Helen Koike
2020-06-05 17:26 ` [RFC v4 4/8] v4l2: add support for colorspace conversion API (CSC) for video capture and subdevices Dafna Hirschfeld
2020-06-08 10:00   ` Hans Verkuil
2020-06-26 12:22     ` Philipp Zabel
2020-06-30 15:23       ` Dafna Hirschfeld
2020-07-01 13:21         ` Philipp Zabel
2020-06-25 23:29   ` Helen Koike
2020-06-26  7:13     ` Hans Verkuil
2020-06-30 16:36     ` Dafna Hirschfeld
2020-06-05 17:26 ` [RFC v4 5/8] media: staging: rkisp1: allow quantization conversion from userspace for isp source pad Dafna Hirschfeld
2020-06-06  7:28   ` Dafna Hirschfeld
2020-06-25 23:52   ` Helen Koike
2020-06-26  7:07     ` Dafna Hirschfeld
2020-06-05 17:26 ` [RFC v4 6/8] media: staging: rkisp1: validate quantization matching in link_validate callbacks Dafna Hirschfeld
2020-06-05 17:26 ` [RFC v4 7/8] media: vivid: Add support to the CSC API Dafna Hirschfeld
2020-06-08 10:10   ` Hans Verkuil
2020-06-08 16:34     ` Dafna Hirschfeld
2020-06-09 11:51       ` Hans Verkuil
2020-06-05 17:26 ` Dafna Hirschfeld [this message]
2020-06-26 12:24   ` [RFC v4 8/8] media: v4l2: add support for the CSC API for hsv_enc on mediabus Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200605172625.19777-9-dafna.hirschfeld@collabora.com \
    --to=dafna.hirschfeld@collabora.com \
    --cc=dafna3@gmail.com \
    --cc=ezequiel@collabora.com \
    --cc=helen.koike@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=sakari.ailus@linux.intel.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).