From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bod@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil+cisco@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 01/13] media: iris: apply the capture buffer minimum in queue_setup
Date: Fri, 04 Dec 2026 20:24:42 +0200 [thread overview]
Message-ID: <20261204-iris-vp8-v2-1-462f9b48d246@oss.qualcomm.com> (raw)
In-Reply-To: <20261204-iris-vp8-v2-0-462f9b48d246@oss.qualcomm.com>
Decoding a small VP8 stream with FFmpeg fails with -ENOMEM from the
first VIDIOC_REQBUFS on the capture queue. The sequence change handler
sets min_reqbufs_allocation on the capture queue from the firmware's
buffer count, but it runs from the HFI response path without the queue
lock. When the event arrives while REQBUFS is in progress, vb2 sizes the
request with the old minimum and then checks the allocation against the
new, larger one, and fails.
Leave min_reqbufs_allocation alone and raise the requested count to the
firmware minimum in queue_setup instead, which runs with the instance
lock held, the same lock the sequence change handler holds while it
updates that minimum.
Fixes: 84e17adae3e3 ("media: iris: add support for dynamic resolution change")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c | 3 ---
drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c | 3 ---
drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++++
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c
index ffa98139f0eb..a1167ce524ff 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c
@@ -32,7 +32,6 @@ static void iris_hfi_gen1_read_changed_params(struct iris_inst *inst,
struct hfi_bit_depth *pixel_depth;
struct hfi_pic_struct *pic_struct;
struct hfi_framesize *frame_sz;
- struct vb2_queue *dst_q;
struct v4l2_ctrl *ctrl;
u32 full_range, ptype;
@@ -162,8 +161,6 @@ static void iris_hfi_gen1_read_changed_params(struct iris_inst *inst,
if (ctrl)
v4l2_ctrl_s_ctrl(ctrl, inst->buffers[BUF_OUTPUT].min_count);
- dst_q = v4l2_m2m_get_dst_vq(inst->m2m_ctx);
- dst_q->min_reqbufs_allocation = inst->buffers[BUF_OUTPUT].min_count;
if (event.bit_depth || !event.pic_struct) {
dev_err(core->dev, "unsupported content, bit depth: %x, pic_struct = %x\n",
diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c
index f0782c4b1e6e..69d5f0639fae 100644
--- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c
+++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_response.c
@@ -532,7 +532,6 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst)
u32 video_signal_type_present_flag;
struct iris_core *core = inst->core;
u32 full_range, width, height;
- struct vb2_queue *dst_q;
struct v4l2_ctrl *ctrl;
subsc_params = inst_hfi_gen2->src_subcr_params;
@@ -660,8 +659,6 @@ static void iris_hfi_gen2_read_input_subcr_params(struct iris_inst *inst)
if (ctrl)
v4l2_ctrl_s_ctrl(ctrl, inst->buffers[BUF_OUTPUT].min_count);
- dst_q = v4l2_m2m_get_dst_vq(inst->m2m_ctx);
- dst_q->min_reqbufs_allocation = inst->buffers[BUF_OUTPUT].min_count;
}
static int iris_hfi_gen2_handle_src_change(struct iris_inst *inst,
diff --git a/drivers/media/platform/qcom/iris/iris_vb2.c b/drivers/media/platform/qcom/iris/iris_vb2.c
index 8faf709c26c1..2d5052782975 100644
--- a/drivers/media/platform/qcom/iris/iris_vb2.c
+++ b/drivers/media/platform/qcom/iris/iris_vb2.c
@@ -145,6 +145,10 @@ int iris_vb2_queue_setup(struct vb2_queue *q,
goto unlock;
}
+ if (inst->domain == DECODER && !V4L2_TYPE_IS_OUTPUT(q->type))
+ *num_buffers = clamp(*num_buffers, inst->buffers[BUF_OUTPUT].min_count,
+ q->max_num_buffers);
+
*num_planes = 1;
sizes[0] = f->fmt.pix_mp.plane_fmt[0].sizeimage;
--
2.47.3
next prev parent reply other threads:[~2026-12-04 18:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 18:24 [PATCH v2 00/13] media: iris: enable VP8, MPEG1/MPEG2 and interlaced MPEG2 support Dmitry Baryshkov
2026-12-04 18:24 ` Dmitry Baryshkov [this message]
2026-12-04 18:24 ` [PATCH v2 02/13] media: iris: translate Gen1 profile/level to HFI enumerants Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 03/13] media: iris: default the Gen1 encoder level to a usable value Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 04/13] media: iris: size QC08C buffers to fit field-coded pictures Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 05/13] media: iris: split Gen2 firmware data for vpu2-generation SoCs Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 06/13] media: iris: move the decode format list into the firmware data Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 07/13] media: iris: support read-only controls Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 08/13] media: iris: add VP8 decode support on Gen1 firmware Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 09/13] media: iris: add MPEG1 and MPEG2 " Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 10/13] media: iris: support interlaced MPEG2 content Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 11/13] media: iris: move the encode format list into the firmware data Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 12/13] media: iris: accept gen1 encoder output at a non-zero offset Dmitry Baryshkov
2026-12-04 18:24 ` [PATCH v2 13/13] media: iris: add VP8 encode support on Gen1 firmware Dmitry Baryshkov
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=20261204-iris-vp8-v2-1-462f9b48d246@oss.qualcomm.com \
--to=dmitry.baryshkov@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=bod@kernel.org \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=hverkuil+cisco@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=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
all inboxes | Powered by JetHome®