Linux Media Controller development
 help / color / mirror / Atom feed
From: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
To: Val Packett <val@packett.cool>,
	Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Bryan O'Donoghue <bod@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@kernel.org>,
	Stefan Schmidt <stefan.schmidt@linaro.org>,
	Vedang Nagar <quic_vnagar@quicinc.com>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: iris: set default size when S_FMT is called with zero size
Date: Tue, 28 Oct 2025 17:27:22 +0530	[thread overview]
Message-ID: <34097d61-ce31-0ea9-bb89-7b91162a0c71@oss.qualcomm.com> (raw)
In-Reply-To: <20251012235330.20897-1-val@packett.cool>



On 10/13/2025 5:20 AM, Val Packett wrote:
> According to 4.5.1.5 of the M2M stateful decoder UAPI documentation,
> providing the width and the height is "required only if it cannot be
> parsed from the stream", otherwise zero can be passed.
> 
> The iris driver would only set the state fields to DEFAULT_WIDTH/HEIGHT
> once upon init, but they would get overwritten with zeroes from one S_FMT
> call and the next S_FMT call would already see zeroes in place of the
> defaults. For clients that used that sequence and did not pass a size,
> such as rpi-ffmpeg, this would then result in REQBUFS failing due to
> the zero size remembered in the state.
> 
> Fix by explicitly falling back to the defaults in S_FMT.
> 
> Fixes: b530b95de22c ("media: iris: implement s_fmt, g_fmt and try_fmt ioctls")
> Link: https://github.com/jc-kynesim/rpi-ffmpeg/issues/103
> Signed-off-by: Val Packett <val@packett.cool>
> ---
> Somehow Venus didn't have this issue and didn't explicitly handle this..

In venus driver, try_fmt is clamping the resolution between min and max
supported which might be handling this case.

> 
> I'm not familiar with this code so if there's a better way to comply
> with the UAPI requirements by just not even getting to overwrite the
> state with the provided 0 size, I could not figure it out.
> 
> Still, let's get this fixed one way or another.
> 
> Thanks,
> ~val
> ---
>  drivers/media/platform/qcom/iris/iris_vdec.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
> index ae13c3e1b426..6be09d82e24d 100644
> --- a/drivers/media/platform/qcom/iris/iris_vdec.c
> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c
> @@ -196,6 +196,11 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f)
>  	if (vb2_is_busy(q))
>  		return -EBUSY;
>  

Can you pls add a small comment here.

with that,

Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>

> +	if (f->fmt.pix_mp.width == 0 && f->fmt.pix_mp.height == 0) {
> +		f->fmt.pix_mp.width = DEFAULT_WIDTH;
> +		f->fmt.pix_mp.height = DEFAULT_HEIGHT;
> +	}
> +
>  	iris_vdec_try_fmt(inst, f);
>  
>  	switch (f->type) {


  reply	other threads:[~2025-10-28 11:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <PAqEcmCHEfU40aJzxWzZEpPQfxYCXUAQ9a9lLgcqz47gzKU5z_bOvdOBleE7B3AIZ13bFrkW2ndB0eMgy2TQdw==@protonmail.internalid>
2025-10-12 23:50 ` [PATCH] media: iris: set default size when S_FMT is called with zero size Val Packett
2025-10-28 11:57   ` Dikshita Agarwal [this message]
2025-10-28 13:19   ` Bryan O'Donoghue
2025-12-25 22:53     ` Val Packett

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=34097d61-ce31-0ea9-bb89-7b91162a0c71@oss.qualcomm.com \
    --to=dikshita.agarwal@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=bod@kernel.org \
    --cc=hverkuil@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=quic_vnagar@quicinc.com \
    --cc=stefan.schmidt@linaro.org \
    --cc=val@packett.cool \
    --cc=vikash.garodia@oss.qualcomm.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