diff mbox series

utils: media-ctl: Set V4L2_MBUS_FRAMEFMT_SET_CSC flag to set colorspace

Message ID 20250408161051.10472-1-laurent.pinchart@ideasonboard.com
State New
Headers show
Series utils: media-ctl: Set V4L2_MBUS_FRAMEFMT_SET_CSC flag to set colorspace | expand

Commit Message

Laurent Pinchart April 8, 2025, 4:10 p.m. UTC
From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

When setting colorspace fields on a source pad, the V4L2 subdev API
requires setting the V4L2_MBUS_FRAMEFMT_SET_CSC flag. This is missing
in libv4l2subdev, resulting in colorspace fields being ignored for
source pad. Fix it by setting the flag.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 utils/media-ctl/libv4l2subdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)


base-commit: 4f4815bd2f4c97ef6b293d1b7b306f14caebf2ef

Comments

Sakari Ailus April 10, 2025, 3:02 p.m. UTC | #1
On Tue, Apr 08, 2025 at 07:10:51PM +0300, Laurent Pinchart wrote:
> From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> 
> When setting colorspace fields on a source pad, the V4L2 subdev API
> requires setting the V4L2_MBUS_FRAMEFMT_SET_CSC flag. This is missing
> in libv4l2subdev, resulting in colorspace fields being ignored for
> source pad. Fix it by setting the flag.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
diff mbox series

Patch

diff --git a/utils/media-ctl/libv4l2subdev.c b/utils/media-ctl/libv4l2subdev.c
index 2f6b1c948a07..f8f2bdecf910 100644
--- a/utils/media-ctl/libv4l2subdev.c
+++ b/utils/media-ctl/libv4l2subdev.c
@@ -829,6 +829,8 @@  static struct media_pad *v4l2_subdev_parse_pad_format(
 			}
 
 			format->colorspace = colorspace;
+			if (pad->flags & MEDIA_PAD_FL_SOURCE)
+				format->flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;
 
 			p = end;
 			continue;
@@ -857,6 +859,8 @@  static struct media_pad *v4l2_subdev_parse_pad_format(
 			}
 
 			format->xfer_func = xfer_func;
+			if (pad->flags & MEDIA_PAD_FL_SOURCE)
+				format->flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;
 
 			p = end;
 			continue;
@@ -885,6 +889,8 @@  static struct media_pad *v4l2_subdev_parse_pad_format(
 			}
 
 			format->ycbcr_enc = ycbcr_enc;
+			if (pad->flags & MEDIA_PAD_FL_SOURCE)
+				format->flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;
 
 			p = end;
 			continue;
@@ -913,6 +919,8 @@  static struct media_pad *v4l2_subdev_parse_pad_format(
 			}
 
 			format->quantization = quantization;
+			if (pad->flags & MEDIA_PAD_FL_SOURCE)
+				format->flags |= V4L2_MBUS_FRAMEFMT_SET_CSC;
 
 			p = end;
 			continue;