All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mehdi Djait <mehdi.djait@linux.intel.com>
To: Faizel K B <faizel.kb@gmail.com>
Cc: Michael Riesch <michael.riesch@collabora.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-media@vger.kernel.org,  linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org,
	libcamera-devel@lists.libcamera.org,
	 Robert Mader <robert.mader@collabora.com>
Subject: Re: [PATCH 1/2] media: rockchip: rkcif: Filter enumerated formats by media bus code
Date: Mon, 9 Nov 2026 13:27:34 +0100	[thread overview]
Message-ID: <avG782VCMTWTNax0@mdjait-mobl> (raw)
In-Reply-To: <20261105232310.385463-2-faizel.kb@gmail.com>

Hello,

On Thu, Nov 05, 2026 at 04:23:09PM -0700, Faizel K B wrote:
> VIDIOC_ENUM_FMT ignores the mbus_code field and returns all formats,
> although the video devices set V4L2_CAP_IO_MC. Return only the formats
> that match the requested media bus code.
> 
> Otherwise userspace can pick a pixel format that doesn't match the
> media bus format, and then interprets the captured data in the wrong
> format.
> 
> Signed-off-by: Faizel K B <faizel.kb@gmail.com>
> ---
>  .../media/platform/rockchip/rkcif/rkcif-stream.c  | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> index 3130d420ad55..f2a24832a8cf 100644
> --- a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> +++ b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> @@ -395,13 +395,20 @@ static int rkcif_stream_enum_formats(struct file *file, void *priv,
>  				     struct v4l2_fmtdesc *f)
>  {
>  	struct rkcif_stream *stream = video_drvdata(file);
> +	unsigned int i, n = 0;
>  
> -	if (f->index >= stream->out_fmts_num)
> -		return -EINVAL;
> +	for (i = 0; i < stream->out_fmts_num; i++) {
> +		if (f->mbus_code &&
> +		    stream->out_fmts[i].mbus_code != f->mbus_code)

what about dvp capture. The dvp_out_fmts[] does not have the mbus_code
set.

> +			continue;

--
Kind Regards
Mehdi Djait

WARNING: multiple messages have this Message-ID (diff)
From: Mehdi Djait <mehdi.djait@linux.intel.com>
To: Faizel K B <faizel.kb@gmail.com>
Cc: Michael Riesch <michael.riesch@collabora.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-media@vger.kernel.org,  linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org,
	libcamera-devel@lists.libcamera.org,
	 Robert Mader <robert.mader@collabora.com>
Subject: Re: [PATCH 1/2] media: rockchip: rkcif: Filter enumerated formats by media bus code
Date: Mon, 9 Nov 2026 13:27:34 +0100	[thread overview]
Message-ID: <avG782VCMTWTNax0@mdjait-mobl> (raw)
In-Reply-To: <20261105232310.385463-2-faizel.kb@gmail.com>

Hello,

On Thu, Nov 05, 2026 at 04:23:09PM -0700, Faizel K B wrote:
> VIDIOC_ENUM_FMT ignores the mbus_code field and returns all formats,
> although the video devices set V4L2_CAP_IO_MC. Return only the formats
> that match the requested media bus code.
> 
> Otherwise userspace can pick a pixel format that doesn't match the
> media bus format, and then interprets the captured data in the wrong
> format.
> 
> Signed-off-by: Faizel K B <faizel.kb@gmail.com>
> ---
>  .../media/platform/rockchip/rkcif/rkcif-stream.c  | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> index 3130d420ad55..f2a24832a8cf 100644
> --- a/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> +++ b/drivers/media/platform/rockchip/rkcif/rkcif-stream.c
> @@ -395,13 +395,20 @@ static int rkcif_stream_enum_formats(struct file *file, void *priv,
>  				     struct v4l2_fmtdesc *f)
>  {
>  	struct rkcif_stream *stream = video_drvdata(file);
> +	unsigned int i, n = 0;
>  
> -	if (f->index >= stream->out_fmts_num)
> -		return -EINVAL;
> +	for (i = 0; i < stream->out_fmts_num; i++) {
> +		if (f->mbus_code &&
> +		    stream->out_fmts[i].mbus_code != f->mbus_code)

what about dvp capture. The dvp_out_fmts[] does not have the mbus_code
set.

> +			continue;

--
Kind Regards
Mehdi Djait

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2026-11-09 12:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 23:23 [PATCH 0/2] media: rockchip: rkcif: ENUM_FMT and bytesperline fixes Faizel K B
2026-11-05 23:23 ` Faizel K B
2026-11-05 23:23 ` [PATCH 1/2] media: rockchip: rkcif: Filter enumerated formats by media bus code Faizel K B
2026-11-05 23:23   ` Faizel K B
2026-11-09 12:27   ` Mehdi Djait [this message]
2026-11-09 12:27     ` Mehdi Djait
2026-11-09 19:54     ` Faizel K B
2026-11-09 19:54       ` Faizel K B
2026-11-11  9:55       ` Michael Riesch
2026-11-11  9:55         ` Michael Riesch
2026-11-05 23:23 ` [PATCH 2/2] media: rockchip: rkcif: Honour the requested bytesperline on MIPI Faizel K B
2026-11-05 23:23   ` Faizel K B
2026-11-11  9:46   ` Michael Riesch
2026-11-11  9:46     ` Michael Riesch
2026-11-12  6:20     ` Faizel K B
2026-11-12  6:20       ` Faizel K B

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=avG782VCMTWTNax0@mdjait-mobl \
    --to=mehdi.djait@linux.intel.com \
    --cc=faizel.kb@gmail.com \
    --cc=heiko@sntech.de \
    --cc=libcamera-devel@lists.libcamera.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=michael.riesch@collabora.com \
    --cc=robert.mader@collabora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.