From: Pavan Bobba <opensource206@gmail.com>
To: skhan@linuxfoundation.org, kieran.bingham@ideasonboard.com,
mchehab@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
Pavan Bobba <opensource206@gmail.com>
Subject: [PATCH 2/5] media: vimc: add support for V4L2_FIELD_ALTERNATE in vimc-sensor
Date: Thu, 20 Nov 2025 14:19:23 +0530 [thread overview]
Message-ID: <20251120084926.18620-3-opensource206@gmail.com> (raw)
In-Reply-To: <20251120084926.18620-1-opensource206@gmail.com>
The vimc sensor currently ignores V4L2_FIELD_ALTERNATE and always
configures the test pattern generator (TPG) with a progressive field.
This patch adds basic handling for the ALTERNATE field type.
When userspace requests V4L2_FIELD_ALTERNATE, the TPG is configured
to output alternating top and bottom fields by calling tpg_s_field()
with the interlaced flag set. For all other field types, existing
progressive behaviour is preserved.
This change allows the vimc-sensor subdevice to correctly reflect
the requested field type in its reported format, enabling basic
testing of interlaced-field negotiation in the media pipeline.
Other vimc entities (debayer, scaler, capture) still treat all
streams as progressive, so streaming with ALTERNATE may not yet
succeed.
Signed-off-by: Pavan Bobba <opensource206@gmail.com>
---
drivers/media/test-drivers/vimc/vimc-sensor.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/media/test-drivers/vimc/vimc-sensor.c b/drivers/media/test-drivers/vimc/vimc-sensor.c
index 027767777763..900c3f329f1c 100644
--- a/drivers/media/test-drivers/vimc/vimc-sensor.c
+++ b/drivers/media/test-drivers/vimc/vimc-sensor.c
@@ -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);
--
2.43.0
next prev parent reply other threads:[~2025-11-20 8:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 8:49 [PATCH 0/5] media: vimc: add RGB/YUV input entity and improve pipeline support Pavan Bobba
2025-11-20 8:49 ` [PATCH 1/5] media: vimc: add RGB/YUV input entity implementation Pavan Bobba
2025-11-20 8:49 ` Pavan Bobba [this message]
2025-11-20 8:49 ` [PATCH 3/5] media: vimc: debayer: add support for multiple RGB formats Pavan Bobba
2025-11-20 8:49 ` [PATCH 4/5] media: vimc: capture: support custom bytesperline values Pavan Bobba
2025-11-20 8:49 ` [PATCH 5/5] docs: media: vimc: document RGB/YUV input entity Pavan Bobba
2025-11-20 16:38 ` [PATCH 0/5] media: vimc: add RGB/YUV input entity and improve pipeline support Shuah Khan
2025-11-28 3:11 ` opensource india
2025-12-09 5:04 ` opensource india
2025-12-15 19:10 ` Shuah Khan
2025-12-15 19:45 ` Shuah Khan
2025-12-16 2:57 ` opensource india
2025-12-29 16:04 ` opensource india
2025-12-31 20:43 ` Shuah Khan
2026-01-01 1:11 ` opensource india
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=20251120084926.18620-3-opensource206@gmail.com \
--to=opensource206@gmail.com \
--cc=kieran.bingham@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=skhan@linuxfoundation.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).