]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: iris: use fallback size when S_FMT is called without width/height
authorVal Packett <val@packett.cool>
Thu, 25 Dec 2025 23:09:10 +0000 (20:09 -0300)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:21:09 +0000 (07:21 -0500)
[ Upstream commit 4980721cb97d6c47700ab61a048ac8819cfeec87 ]

According to 4.5.1.5 of the M2M stateful decoder UAPI documentation,
providing the width and the height to S_FMT is "required only if it
cannot be parsed from the stream", otherwise they can be left as 0
and the S_FMT implementation is expected to return a valid placeholder
resolution that would let REQBUFS succeed.

iris was missing the fallback, so clients like rpi-ffmpeg wouldn't work.
Fix by adding an explicit fallback to defaults.

Fixes: b530b95de22c ("media: iris: implement s_fmt, g_fmt and try_fmt ioctls")
Link: https://github.com/jc-kynesim/rpi-ffmpeg/issues/103
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Val Packett <val@packett.cool>
Cc: stable@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/qcom/iris/iris_vdec.c

index ae13c3e1b426bfd81a7b46dc6c3ff5eb5c4860cb..c9f9c16cf08464446cfdc36b3e0166e3d1e5ed80 100644 (file)
@@ -196,6 +196,14 @@ int iris_vdec_s_fmt(struct iris_inst *inst, struct v4l2_format *f)
        if (vb2_is_busy(q))
                return -EBUSY;
 
+       /* Width and height are optional, so fall back to a valid placeholder
+        * resolution until the real one is decoded from the bitstream.
+        */
+       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) {