[v4l-utils,v5,3/4] v4l2-ctl: subdev: Add support for the CSC API in the subdevices
diff mbox series

Message ID 20200703180239.25841-4-dafna.hirschfeld@collabora.com
State New
Headers show
Series
  • v4l2-ctl: add support to the CSC API
Related show

Commit Message

Dafna Hirschfeld July 3, 2020, 6:02 p.m. UTC
The CSC API allows userspace to configure the colorspace,
quantization, (ycbcr/hsv)_enc and xfer_func fields when
setting the formats, so those fields are not read only
in userspace. This patch adds support for this API in
subevices.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
index c0f36eab..c6ec21a9 100644
--- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
@@ -424,14 +424,22 @@  void subdev_set(cv4l_fd &_fd)
 				fmt.format.code = ffmt.code;
 			if (set_fmt & FmtField)
 				fmt.format.field = ffmt.field;
-			if (set_fmt & FmtColorspace)
+			if (set_fmt & FmtColorspace) {
 				fmt.format.colorspace = ffmt.colorspace;
-			if (set_fmt & FmtXferFunc)
+				fmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;
+			}
+			if (set_fmt & FmtXferFunc) {
 				fmt.format.xfer_func = ffmt.xfer_func;
-			if (set_fmt & FmtYCbCr)
+				fmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;
+			}
+			if (set_fmt & FmtYCbCr) {
 				fmt.format.ycbcr_enc = ffmt.ycbcr_enc;
-			if (set_fmt & FmtQuantization)
+				fmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;
+			}
+			if (set_fmt & FmtQuantization) {
 				fmt.format.quantization = ffmt.quantization;
+				fmt.format.flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;
+			}
 
 			if (options[OptSetSubDevFormat])
 				printf("Note: --set-subdev-fmt is only for testing.\n"