Skip to contentSkip to conversation

Linux Media vimc update for 6.20-rc1

GIT PULL Shuah Khan 2 participants 4 messages Jan 8 – Jan 14 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Shuah Khan

author maintainer
#0 lore raw

Hi Mauro,

Please pull the vimc next update for Linux 6.20-rc1.

Adds
RGB/YUV input entity implementation support for V4L2_FIELD_ALTERNATE in vimc-sensor support for multiple RGB formats in vimc-debayer support custom bytesperline values in vimc-capture document RGB/YUV input entity

diff is attached.

thanks,
-- Shuah

----------------------------------------------------------------

The following changes since commit 8f0b4cce4481fb22653697cced8d0d04027cb1e8:

Linux 6.19-rc1 (2025-12-14 16:05:07 +1200)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-vimc-6.20-rc1

for you to fetch changes up to c3a017646b770b76f0f08c96aa74fbc4404ef674:

docs: media: vimc: document RGB/YUV input entity (2025-12-15 12:43:25 -0700)

----------------------------------------------------------------
linux-vimc-6.20-rc1

Adds
RGB/YUV input entity implementation support for V4L2_FIELD_ALTERNATE in vimc-sensor support for multiple RGB formats in vimc-debayer support custom bytesperline values in vimc-capture document RGB/YUV input entity

----------------------------------------------------------------
Pavan Bobba (5):
media: vimc: add RGB/YUV input entity implementation
media: vimc: add support for V4L2_FIELD_ALTERNATE in vimc-sensor
media: vimc: debayer: add support for multiple RGB formats
media: vimc: capture: support custom bytesperline values
docs: media: vimc: document RGB/YUV input entity

 Documentation/admin-guide/media/vimc.rst       |  39 +++--
 drivers/media/test-drivers/vimc/Makefile       |   3 +-
 drivers/media/test-drivers/vimc/vimc-capture.c |  15 +-
 drivers/media/test-drivers/vimc/vimc-common.h  |   1 +
 drivers/media/test-drivers/vimc/vimc-core.c    |   3 +-
 drivers/media/test-drivers/vimc/vimc-debayer.c | 113 ++++++++++---
 drivers/media/test-drivers/vimc/vimc-input.c   | 210 +++++++++++++++++++++++++
 drivers/media/test-drivers/vimc/vimc-sensor.c  |   9 +-
 8 files changed, 352 insertions(+), 41 deletions(-)
 create mode 100644 drivers/media/test-drivers/vimc/vimc-input.c

----------------------------------------------------------------

Documentation/admin-guide/media/vimc.rst +30 -9
index 29d843a8ddb1..a1b7de769e23 100644
@@ -4,7 +4,7 @@ The Virtual Media Controller Driver (vimc)
 ==========================================
 
 The vimc driver emulates complex video hardware using the V4L2 API and the Media
-API. It has a capture device and three subdevices: sensor, debayer and scaler.
+API. It has a capture device and three subdevices: sensor, debayer, scaler and RGB/YUV input entity.
 
 Topology
 --------
@@ -29,17 +29,28 @@ configuration on each linked subdevice to stream frames through the pipeline.
 If the configuration doesn't match, the stream will fail. The ``v4l-utils``
 package is a bundle of user-space applications, that comes with ``media-ctl`` and
 ``v4l2-ctl`` that can be used to configure the vimc configuration. This sequence
-of commands fits for the default topology:
+-of commands fits for the default topology:
 
 .. code-block:: bash
 
-        media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
-        media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
-        media-ctl -d platform:vimc -V '"Scaler":0[fmt:RGB888_1X24/640x480]'
-        media-ctl -d platform:vimc -V '"Scaler":0[crop:(100,50)/400x150]'
-        media-ctl -d platform:vimc -V '"Scaler":1[fmt:RGB888_1X24/300x700]'
-        v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=300,height=700
-        v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81
+        media-ctl -d platform:vimc.0 -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]'
+        media-ctl -d platform:vimc.0 -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]'
+        media-ctl -d platform:vimc.0 -V '"Scaler":0[fmt:RGB888_1X24/640x480]'
+        media-ctl -d platform:vimc.0 -V '"Scaler":0[crop:(100,50)/400x150]'
+        media-ctl -d platform:vimc.0 -V '"Scaler":1[fmt:RGB888_1X24/300x700]'
+        v4l2-ctl -z platform:vimc.0 -d "RGB/YUV Capture" -v width=300,height=700
+        v4l2-ctl -z platform:vimc.0 -d "Raw Capture 0" -v pixelformat=BA81
+
+The following commands switch the scaler input to the RGB/YUV entity and request
+ARGB output with a padded capture stride.
+
+.. code-block:: bash
+
+        media-ctl -d platform:vimc.0 -V '"RGB/YUV Input":0[fmt:RGB888_1X24/640x480]'
+        media-ctl -d platform:vimc.0 -V '"Scaler":0[fmt:RGB888_1X24/640x480]'
+        media-ctl -d platform:vimc.0 -V '"Scaler":1[fmt:ARGB8888_1X32/640x480]'
+        v4l2-ctl -z platform:vimc.0 -d "RGB/YUV Capture" \
+                -v pixelformat=RGB3,width=640,height=480,bytesperline=4096
 
 Subdevices
 ----------
@@ -53,6 +64,16 @@ vimc-sensor:
 
 	* 1 Pad source
 
+vimc-input:
+    Simulates an RGB/YUV frame source for pipelines that start after a real
+    debayer stage. It exposes a single source pad that initially advertises
+    ``MEDIA_BUS_FMT_RGB888_1X24`` and accepts the usual width/height updates via
+    ``media-ctl``, which is useful for software-driven frame injection
+    experiments.
+    Exposes:
+
+    * 1 Pad source
+
 vimc-lens:
 	Ancillary lens for a sensor. Supports auto focus control. Linked to
 	a vimc-sensor using an ancillary link. The lens supports FOCUS_ABSOLUTE
drivers/media/test-drivers/vimc/Makefile +2 -1
index 9b9631562473..7e1fdb2f2a78 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 vimc-y := vimc-core.o vimc-common.o vimc-streamer.o vimc-capture.o \
-		vimc-debayer.o vimc-scaler.o vimc-sensor.o vimc-lens.o
+		vimc-debayer.o vimc-scaler.o vimc-sensor.o vimc-lens.o \
+		vimc-input.o
 
 obj-$(CONFIG_VIDEO_VIMC) += vimc.o
 
drivers/media/test-drivers/vimc/vimc-capture.c +13 -2
index 7f6124025fc9..7164ec51eb80 100644
@@ -85,6 +85,7 @@ static int vimc_capture_try_fmt_vid_cap(struct file *file, void *priv,
 {
 	struct v4l2_pix_format *format = &f->fmt.pix;
 	const struct vimc_pix_map *vpix;
+	u32 min_bpl, max_bpl;
 
 	format->width = clamp_t(u32, format->width, VIMC_FRAME_MIN_WIDTH,
 				VIMC_FRAME_MAX_WIDTH) & ~1;
@@ -97,8 +98,18 @@ static int vimc_capture_try_fmt_vid_cap(struct file *file, void *priv,
 		format->pixelformat = fmt_default.pixelformat;
 		vpix = vimc_pix_map_by_pixelformat(format->pixelformat);
 	}
-	/* TODO: Add support for custom bytesperline values */
-	format->bytesperline = format->width * vpix->bpp;
+
+	/* Calculate the minimum supported bytesperline value */
+	min_bpl = format->width * vpix->bpp;
+	/* Calculate the maximum supported bytesperline value */
+	max_bpl = VIMC_FRAME_MAX_WIDTH * vpix->bpp;
+
+	/* Clamp bytesperline to the valid range */
+	if (format->bytesperline > max_bpl)
+		format->bytesperline = max_bpl;
+	if (format->bytesperline < min_bpl)
+		format->bytesperline = min_bpl;
+
 	format->sizeimage = format->bytesperline * format->height;
 
 	if (format->field == V4L2_FIELD_ANY)
drivers/media/test-drivers/vimc/vimc-common.h +1 -0
index 7a45a2117748..6c94b1635fa8 100644
@@ -172,6 +172,7 @@ extern const struct vimc_ent_type vimc_debayer_type;
 extern const struct vimc_ent_type vimc_scaler_type;
 extern const struct vimc_ent_type vimc_capture_type;
 extern const struct vimc_ent_type vimc_lens_type;
+extern const struct vimc_ent_type vimc_input_type;
 
 /**
  * vimc_pix_map_by_index - get vimc_pix_map struct by its index
drivers/media/test-drivers/vimc/vimc-core.c +1 -2
index f632c77e52f5..2f6846facb23 100644
@@ -107,9 +107,8 @@ static const struct vimc_ent_config ent_config[] = {
 		.type = &vimc_capture_type
 	},
 	[RGB_YUV_INPUT] = {
-		/* TODO: change this to vimc-input when it is implemented */
 		.name = "RGB/YUV Input",
-		.type = &vimc_sensor_type
+		.type = &vimc_input_type
 	},
 	[SCALER] = {
 		.name = "Scaler",
drivers/media/test-drivers/vimc/vimc-debayer.c +90 -23

157 lines not on this page · raw message

drivers/media/test-drivers/vimc/vimc-input.c new file +210 -0

210 lines not on this page · raw message

drivers/media/test-drivers/vimc/vimc-sensor.c +5 -4
index 027767777763..900c3f329f1c 100644
@@ -105,8 +105,10 @@ static void vimc_sensor_tpg_s_format(struct vimc_sensor_device *vsensor,
 	tpg_s_bytesperline(&vsensor->tpg, 0, format->width * vpix->bpp);
 	tpg_s_buf_height(&vsensor->tpg, format->height);
 	tpg_s_fourcc(&vsensor->tpg, vpix->pixelformat);
-	/* TODO: add support for V4L2_FIELD_ALTERNATE */
-	tpg_s_field(&vsensor->tpg, format->field, false);
+	if (format->field == V4L2_FIELD_ALTERNATE)
+		tpg_s_field(&vsensor->tpg, V4L2_FIELD_TOP, true);
+	else
+		tpg_s_field(&vsensor->tpg, format->field, false);
 	tpg_s_colorspace(&vsensor->tpg, format->colorspace);
 	tpg_s_ycbcr_enc(&vsensor->tpg, format->ycbcr_enc);
 	tpg_s_quantization(&vsensor->tpg, format->quantization);
@@ -127,8 +129,7 @@ static void vimc_sensor_adjust_fmt(struct v4l2_mbus_framefmt *fmt)
 	fmt->height = clamp_t(u32, fmt->height, VIMC_FRAME_MIN_HEIGHT,
 			      VIMC_FRAME_MAX_HEIGHT) & ~1;
 
-	/* TODO: add support for V4L2_FIELD_ALTERNATE */
-	if (fmt->field == V4L2_FIELD_ANY || fmt->field == V4L2_FIELD_ALTERNATE)
+	if (fmt->field == V4L2_FIELD_ANY)
 		fmt->field = fmt_default.field;
 
 	vimc_colorimetry_clamp(fmt);
author maintainer
#2 lore raw
In reply to a message not in the archive
Quoted 13 lines · Patchwork Integration

Dear Shuah Khan:

Thanks for your patches! Unfortunately the Media CI robot detected some issues:

# Test virtme32:test-virtme
Final Summary: 1412, Succeeded: 1384, Failed: 28, Warnings: 0 Errors Found!

# Test virtme64:test-virtme
Final Summary: 1388, Succeeded: 1360, Failed: 28, Warnings: 0 Errors Found!

Quoted 8 lines

# Test media-patchstyle:./0001-Linux-Media-vimc-update-for-6.20-rc1.patch media style
ERROR: ./0001-Linux-Media-vimc-update-for-6.20-rc1.patch: Missing author Shuah Khan <[email protected]> Signed-off-by
WARNING: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 500 lines checked

ERROR: Fails one or more mandatory checkpatch tests
ERROR: 9ea34411540210db961bca65857fa0c27278276b: Missing 'media:' prefix in Subject

One of the patches is documentation patch -is that warning here?

docs: media: vimc: document RGB/YUV input entity

Quoted 3 lines

# Test checkpatch:./0001-Linux-Media-vimc-update-for-6.20-rc1.patch checkpatch
WARNING: Missing commit description - Add an appropriate one

The tag has the description - this is routine pull request. Is there something different that needs to be done for media pull requests?

thanks,
-- Shuah

#3 lore raw
In reply to Shuah Khan

Hi Shuah, Pavan,

Quoted 4 lines · Shuah Khan

Hi Mauro,

Please pull the vimc next update for Linux 6.20-rc1.

Quoted 8 lines

Adds
RGB/YUV input entity implementation support for V4L2_FIELD_ALTERNATE in vimc-sensor support for multiple RGB formats in vimc-debayer support custom bytesperline values in vimc-capture document RGB/YUV input entity

diff is attached.

Unfortunately these vimc changes cause regressions in the vimc test-media test.

This test is run in our CI to catch regressions, so it must always pass.

The test is in the v4l-utils git repository (https://git.linuxtv.org/v4l-utils.git/)
in the contrib/test directory. It's run as: 'sudo ./test-media vimc'.

It could be that these changes require changes in the vimc test itself. In that case I need a patch for test-media fixing this. However, looking at the failures I think that at least some of the issues are caused by these patches.

Since this series adds a new entity, I think that test-media needs to be patched anyway with a new test that tests this new entity as well.

Running the test-media vimc test results in:

Summary:

Total for vimc device /dev/media4: 8, Succeeded: 8, Failed: 0, Warnings: 0 Total for vimc device /dev/video13: 60, Succeeded: 49, Failed: 11, Warnings: 0 Total for vimc device /dev/video14: 60, Succeeded: 60, Failed: 0, Warnings: 0 Total for vimc device /dev/video15: 60, Succeeded: 49, Failed: 11, Warnings: 0 Total for vimc device /dev/v4l-subdev0: 54, Succeeded: 54, Failed: 0, Warnings: 0 Total for vimc device /dev/v4l-subdev1: 54, Succeeded: 54, Failed: 0, Warnings: 0 Total for vimc device /dev/v4l-subdev2: 61, Succeeded: 59, Failed: 2, Warnings: 0 Total for vimc device /dev/v4l-subdev3: 61, Succeeded: 59, Failed: 2, Warnings: 0 Total for vimc device /dev/v4l-subdev4: 54, Succeeded: 52, Failed: 2, Warnings: 0 Total for vimc device /dev/v4l-subdev5: 61, Succeeded: 61, Failed: 0, Warnings: 0 Total for vimc device /dev/v4l-subdev6: 47, Succeeded: 47, Failed: 0, Warnings: 0 Total for vimc device /dev/v4l-subdev7: 47, Succeeded: 47, Failed: 0, Warnings: 0 Grand Total for vimc device /dev/media4: 627, Succeeded: 599, Failed: 28, Warnings: 0

So I'm dropping this PR.

Regards,

Hans

Quoted 48 lines

thanks,
-- Shuah

----------------------------------------------------------------

The following changes since commit 8f0b4cce4481fb22653697cced8d0d04027cb1e8:

   Linux 6.19-rc1 (2025-12-14 16:05:07 +1200)

are available in the Git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-vimc-6.20-rc1

for you to fetch changes up to c3a017646b770b76f0f08c96aa74fbc4404ef674:

docs: media: vimc: document RGB/YUV input entity (2025-12-15 12:43:25 -0700)

----------------------------------------------------------------
linux-vimc-6.20-rc1

Adds
RGB/YUV input entity implementation support for V4L2_FIELD_ALTERNATE in vimc-sensor support for multiple RGB formats in vimc-debayer support custom bytesperline values in vimc-capture document RGB/YUV input entity

----------------------------------------------------------------
Pavan Bobba (5):
media: vimc: add RGB/YUV input entity implementation
media: vimc: add support for V4L2_FIELD_ALTERNATE in vimc-sensor
media: vimc: debayer: add support for multiple RGB formats
media: vimc: capture: support custom bytesperline values
docs: media: vimc: document RGB/YUV input entity

  Documentation/admin-guide/media/vimc.rst       |  39 +++--
  drivers/media/test-drivers/vimc/Makefile       |   3 +-
  drivers/media/test-drivers/vimc/vimc-capture.c |  15 +-
  drivers/media/test-drivers/vimc/vimc-common.h  |   1 +
  drivers/media/test-drivers/vimc/vimc-core.c    |   3 +-
  drivers/media/test-drivers/vimc/vimc-debayer.c | 113 ++++++++++---
  drivers/media/test-drivers/vimc/vimc-input.c   | 210 +++++++++++++++++++++++++
  drivers/media/test-drivers/vimc/vimc-sensor.c  |   9 +-
  8 files changed, 352 insertions(+), 41 deletions(-)

create mode 100644 drivers/media/test-drivers/vimc/vimc-input.c

----------------------------------------------------------------

author maintainer
#4 lore raw
Quoted 23 lines · Hans Verkuil

Hi Shuah, Pavan,

Quoted 4 lines · Shuah Khan

Hi Mauro,

Please pull the vimc next update for Linux 6.20-rc1.

Quoted 8 lines

Adds
RGB/YUV input entity implementation support for V4L2_FIELD_ALTERNATE in vimc-sensor support for multiple RGB formats in vimc-debayer support custom bytesperline values in vimc-capture document RGB/YUV input entity

diff is attached.

Unfortunately these vimc changes cause regressions in the vimc test-media test.

This test is run in our CI to catch regressions, so it must always pass.

The test is in the v4l-utils git repository (https://git.linuxtv.org/v4l-utils.git/)
in the contrib/test directory. It's run as: 'sudo ./test-media vimc'.

Quoted 7 lines

It could be that these changes require changes in the vimc test itself. In that case I need a patch for test-media fixing this. However, looking at the failures I think that at least some of the issues are caused by these patches.

Since this series adds a new entity, I think that test-media needs to be patched anyway with a new test that tests this new entity as well.

Thank you Hans.

Pavan, please address the problems in the patch series.

Quoted 19 lines

Running the test-media vimc test results in:

Summary:

Total for vimc device /dev/media4: 8, Succeeded: 8, Failed: 0, Warnings: 0 Total for vimc device /dev/video13: 60, Succeeded: 49, Failed: 11, Warnings: 0 Total for vimc device /dev/video14: 60, Succeeded: 60, Failed: 0, Warnings: 0 Total for vimc device /dev/video15: 60, Succeeded: 49, Failed: 11, Warnings: 0 Total for vimc device /dev/v4l-subdev0: 54, Succeeded: 54, Failed: 0, Warnings: 0 Total for vimc device /dev/v4l-subdev1: 54, Succeeded: 54, Failed: 0, Warnings: 0 Total for vimc device /dev/v4l-subdev2: 61, Succeeded: 59, Failed: 2, Warnings: 0 Total for vimc device /dev/v4l-subdev3: 61, Succeeded: 59, Failed: 2, Warnings: 0 Total for vimc device /dev/v4l-subdev4: 54, Succeeded: 52, Failed: 2, Warnings: 0 Total for vimc device /dev/v4l-subdev5: 61, Succeeded: 61, Failed: 0, Warnings: 0 Total for vimc device /dev/v4l-subdev6: 47, Succeeded: 47, Failed: 0, Warnings: 0 Total for vimc device /dev/v4l-subdev7: 47, Succeeded: 47, Failed: 0, Warnings: 0 Grand Total for vimc device /dev/media4: 627, Succeeded: 599, Failed: 28, Warnings: 0

Quoted 2 lines

So I'm dropping this PR.

Makes sense.

thanks,
-- Shuah