From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: raoxu <raoxu@uniontech.com>
Cc: mchehab@kernel.org, hverkuil+cisco@kernel.org,
laurent.pinchart@ideasonboard.com,
jacopo.mondi@ideasonboard.com, kees@kernel.org,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: m2m-deinterlace: fix default capture field
Date: Tue, 11 Aug 2026 12:12:21 +0200 [thread overview]
Message-ID: <anr1DLTi2UUdWWZ0@zed> (raw)
In-Reply-To: <2F5126811A6B9396+20260811015222.3467910-1-raoxu@uniontech.com>
Hi Xu Rao
On Tue, Aug 11, 2026 at 09:52:22AM +0800, raoxu wrote:
> From: Xu Rao <raoxu@uniontech.com>
>
> queue_init() initializes default formats for both the source and capture
> queues. It first sets the source field to V4L2_FIELD_SEQ_TB, but then
> stores the capture default, V4L2_FIELD_INTERLACED_TB, in the source queue
> again while initializing the capture queue.
>
> This overwrites the valid source default and leaves the capture field at
> its zero-initialized value, V4L2_FIELD_ANY. vidioc_streamon() accepts
> only V4L2_FIELD_SEQ_TB or V4L2_FIELD_SEQ_BT on the source queue, and
> requires the capture queue to use a compatible interlaced or NONE field.
> Userspace that relies on the default formats can therefore get -EINVAL
> when starting streaming.
>
> Initialize the capture field instead. The bug is usually hidden because
> mem2mem applications commonly call S_FMT on both queues before streaming;
> the TRY_FMT paths normalize the fields and S_FMT overwrites q_data[].field.
>
> Fixes: 8f0755c06b90 ("[media] media: Add mem2mem deinterlacing driver")
Missing
Cc: stable@vger.kernel.org
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
> ---
> drivers/media/platform/m2m-deinterlace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c
> index 1d0e70eaea3d..9dcc4bd6cbdd 100644
> --- a/drivers/media/platform/m2m-deinterlace.c
> +++ b/drivers/media/platform/m2m-deinterlace.c
> @@ -822,7 +822,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
> q_data[V4L2_M2M_DST].width = 640;
> q_data[V4L2_M2M_DST].height = 480;
> q_data[V4L2_M2M_DST].sizeimage = (640 * 480 * 3) / 2;
> - q_data[V4L2_M2M_SRC].field = V4L2_FIELD_INTERLACED_TB;
> + q_data[V4L2_M2M_DST].field = V4L2_FIELD_INTERLACED_TB;
Looks like a bug indeed. As you said, set_fmt re-initializes the field
to V4L2_FIELD_INTERLACED_TB so it should be harmless, but there are no
reasons not to fix the initialization.
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
>
> return vb2_queue_init(dst_vq);
> }
> --
> 2.50.1
>
prev parent reply other threads:[~2026-08-11 10:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 1:52 [PATCH] media: m2m-deinterlace: fix default capture field raoxu
2026-08-11 10:12 ` Jacopo Mondi [this message]
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=anr1DLTi2UUdWWZ0@zed \
--to=jacopo.mondi@ideasonboard.com \
--cc=hverkuil+cisco@kernel.org \
--cc=kees@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=raoxu@uniontech.com \
/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