drivers/media/platform/qcom/iris/iris_common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
Improve the condition used to determine when input internal buffers need
to be reconfigured during streamon on the capture port. Previously, the
check relied on the INPUT_PAUSE sub-state, which was also being set
during seek operations. This led to input buffers being queued multiple
times to the firmware, causing session errors due to duplicate buffer
submissions.
This change introduces a more accurate check using the FIRST_IPSC and
DRC sub-states to ensure that input buffer reconfiguration is triggered
only during resolution change scenarios, such as streamoff/on on the
capture port. This avoids duplicate buffer queuing during seek
operations.
Fixes: c1f8b2cc72ec ("media: iris: handle streamoff/on from client in dynamic resolution change")
Reported-by: Val Packett <val@packett.cool>
Closes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4700
Signed-off-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
---
Changes in v2:
- Removed spurious space and addressed other comments (Nicolas)
- Remove the unnecessary initializations (Self)
- Link to v1: https://lore.kernel.org/r/20251103-iris-seek-fix-v1-1-6db5f5e17722@oss.qualcomm.com
---
drivers/media/platform/qcom/iris/iris_common.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/iris/iris_common.c b/drivers/media/platform/qcom/iris/iris_common.c
index 9fc663bdaf3fc989fe1273b4d4280a87f68de85d..ee377131c8419c434c85ec8e4321db39bbdecda0 100644
--- a/drivers/media/platform/qcom/iris/iris_common.c
+++ b/drivers/media/platform/qcom/iris/iris_common.c
@@ -91,12 +91,13 @@ int iris_process_streamon_input(struct iris_inst *inst)
int iris_process_streamon_output(struct iris_inst *inst)
{
const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
- bool drain_active = false, drc_active = false;
enum iris_inst_sub_state clear_sub_state = 0;
int ret = 0;
iris_scale_power(inst);
+ first_ipsc = inst->sub_state & IRIS_INST_SUB_FIRST_IPSC;
+
drain_active = inst->sub_state & IRIS_INST_SUB_DRAIN &&
inst->sub_state & IRIS_INST_SUB_DRAIN_LAST;
@@ -108,7 +109,8 @@ int iris_process_streamon_output(struct iris_inst *inst)
else if (drain_active)
clear_sub_state = IRIS_INST_SUB_DRAIN | IRIS_INST_SUB_DRAIN_LAST;
- if (inst->domain == DECODER && inst->sub_state & IRIS_INST_SUB_INPUT_PAUSE) {
+ /* Input internal buffer reconfiguration required in case of resolution change */
+ if (first_ipsc || drc_active) {
ret = iris_alloc_and_queue_input_int_bufs(inst);
if (ret)
return ret;
---
base-commit: 163917839c0eea3bdfe3620f27f617a55fd76302
change-id: 20251103-iris-seek-fix-7a25af22fa52
Best regards,
--
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Hi Dikshita,
kernel test robot noticed the following build errors:
[auto build test ERROR on 163917839c0eea3bdfe3620f27f617a55fd76302]
url: https://github.com/intel-lab-lkp/linux/commits/Dikshita-Agarwal/media-iris-Refine-internal-buffer-reconfiguration-logic-for-resolution-change/20251104-131307
base: 163917839c0eea3bdfe3620f27f617a55fd76302
patch link: https://lore.kernel.org/r/20251104-iris-seek-fix-v2-1-c9dace39b43d%40oss.qualcomm.com
patch subject: [PATCH v2] media: iris: Refine internal buffer reconfiguration logic for resolution change
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20251105/202511050842.FTUh6ym8-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251105/202511050842.FTUh6ym8-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511050842.FTUh6ym8-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
>> drivers/media/platform/qcom/iris/iris_common.c:99:2: error: use of undeclared identifier 'first_ipsc'
99 | first_ipsc = inst->sub_state & IRIS_INST_SUB_FIRST_IPSC;
| ^
>> drivers/media/platform/qcom/iris/iris_common.c:101:2: error: use of undeclared identifier 'drain_active'
101 | drain_active = inst->sub_state & IRIS_INST_SUB_DRAIN &&
| ^
>> drivers/media/platform/qcom/iris/iris_common.c:104:2: error: use of undeclared identifier 'drc_active'
104 | drc_active = inst->sub_state & IRIS_INST_SUB_DRC &&
| ^
drivers/media/platform/qcom/iris/iris_common.c:107:6: error: use of undeclared identifier 'drc_active'
107 | if (drc_active)
| ^
drivers/media/platform/qcom/iris/iris_common.c:109:11: error: use of undeclared identifier 'drain_active'; did you mean 'swait_active'?
109 | else if (drain_active)
| ^~~~~~~~~~~~
| swait_active
include/linux/swait.h:121:19: note: 'swait_active' declared here
121 | static inline int swait_active(struct swait_queue_head *wq)
| ^
drivers/media/platform/qcom/iris/iris_common.c:113:6: error: use of undeclared identifier 'first_ipsc'
113 | if (first_ipsc || drc_active) {
| ^
drivers/media/platform/qcom/iris/iris_common.c:113:20: error: use of undeclared identifier 'drc_active'
113 | if (first_ipsc || drc_active) {
| ^
drivers/media/platform/qcom/iris/iris_common.c:127:8: error: use of undeclared identifier 'drain_active'; did you mean 'swait_active'?
127 | if (!drain_active)
| ^~~~~~~~~~~~
| swait_active
include/linux/swait.h:121:19: note: 'swait_active' declared here
121 | static inline int swait_active(struct swait_queue_head *wq)
| ^
>> drivers/media/platform/qcom/iris/iris_common.c:127:8: warning: address of function 'swait_active' will always evaluate to 'true' [-Wpointer-bool-conversion]
127 | if (!drain_active)
| ~^~~~~~~~~~~~
drivers/media/platform/qcom/iris/iris_common.c:127:8: note: prefix with the address-of operator to silence this warning
127 | if (!drain_active)
| ^
| &
1 warning and 8 errors generated.
vim +/first_ipsc +99 drivers/media/platform/qcom/iris/iris_common.c
90
91 int iris_process_streamon_output(struct iris_inst *inst)
92 {
93 const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
94 enum iris_inst_sub_state clear_sub_state = 0;
95 int ret = 0;
96
97 iris_scale_power(inst);
98
> 99 first_ipsc = inst->sub_state & IRIS_INST_SUB_FIRST_IPSC;
100
> 101 drain_active = inst->sub_state & IRIS_INST_SUB_DRAIN &&
102 inst->sub_state & IRIS_INST_SUB_DRAIN_LAST;
103
> 104 drc_active = inst->sub_state & IRIS_INST_SUB_DRC &&
105 inst->sub_state & IRIS_INST_SUB_DRC_LAST;
106
107 if (drc_active)
108 clear_sub_state = IRIS_INST_SUB_DRC | IRIS_INST_SUB_DRC_LAST;
109 else if (drain_active)
110 clear_sub_state = IRIS_INST_SUB_DRAIN | IRIS_INST_SUB_DRAIN_LAST;
111
112 /* Input internal buffer reconfiguration required in case of resolution change */
113 if (first_ipsc || drc_active) {
114 ret = iris_alloc_and_queue_input_int_bufs(inst);
115 if (ret)
116 return ret;
117 ret = iris_set_stage(inst, STAGE);
118 if (ret)
119 return ret;
120 ret = iris_set_pipe(inst, PIPE);
121 if (ret)
122 return ret;
123 }
124
125 if (inst->state == IRIS_INST_INPUT_STREAMING &&
126 inst->sub_state & IRIS_INST_SUB_INPUT_PAUSE) {
> 127 if (!drain_active)
128 ret = hfi_ops->session_resume_drc(inst,
129 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
130 else if (hfi_ops->session_resume_drain)
131 ret = hfi_ops->session_resume_drain(inst,
132 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
133 if (ret)
134 return ret;
135 clear_sub_state |= IRIS_INST_SUB_INPUT_PAUSE;
136 }
137
138 if (inst->sub_state & IRIS_INST_SUB_FIRST_IPSC)
139 clear_sub_state |= IRIS_INST_SUB_FIRST_IPSC;
140
141 ret = hfi_ops->session_start(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
142 if (ret)
143 return ret;
144
145 if (inst->sub_state & IRIS_INST_SUB_OUTPUT_PAUSE)
146 clear_sub_state |= IRIS_INST_SUB_OUTPUT_PAUSE;
147
148 ret = iris_inst_state_change_streamon(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
149 if (ret)
150 return ret;
151
152 inst->last_buffer_dequeued = false;
153
154 return iris_inst_change_sub_state(inst, clear_sub_state, 0);
155 }
156
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
On Tue, Nov 04, 2025 at 10:41:05AM +0530, Dikshita Agarwal wrote:
> Improve the condition used to determine when input internal buffers need
> to be reconfigured during streamon on the capture port. Previously, the
> check relied on the INPUT_PAUSE sub-state, which was also being set
> during seek operations. This led to input buffers being queued multiple
> times to the firmware, causing session errors due to duplicate buffer
> submissions.
>
> This change introduces a more accurate check using the FIRST_IPSC and
> DRC sub-states to ensure that input buffer reconfiguration is triggered
> only during resolution change scenarios, such as streamoff/on on the
> capture port. This avoids duplicate buffer queuing during seek
> operations.
>
> Fixes: c1f8b2cc72ec ("media: iris: handle streamoff/on from client in dynamic resolution change")
> Reported-by: Val Packett <val@packett.cool>
> Closes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4700
> Signed-off-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
> ---
> Changes in v2:
> - Removed spurious space and addressed other comments (Nicolas)
> - Remove the unnecessary initializations (Self)
> - Link to v1: https://lore.kernel.org/r/20251103-iris-seek-fix-v1-1-6db5f5e17722@oss.qualcomm.com
> ---
> drivers/media/platform/qcom/iris/iris_common.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_common.c b/drivers/media/platform/qcom/iris/iris_common.c
> index 9fc663bdaf3fc989fe1273b4d4280a87f68de85d..ee377131c8419c434c85ec8e4321db39bbdecda0 100644
> --- a/drivers/media/platform/qcom/iris/iris_common.c
> +++ b/drivers/media/platform/qcom/iris/iris_common.c
> @@ -91,12 +91,13 @@ int iris_process_streamon_input(struct iris_inst *inst)
> int iris_process_streamon_output(struct iris_inst *inst)
> {
> const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> - bool drain_active = false, drc_active = false;
> enum iris_inst_sub_state clear_sub_state = 0;
> int ret = 0;
>
> iris_scale_power(inst);
>
> + first_ipsc = inst->sub_state & IRIS_INST_SUB_FIRST_IPSC;
> +
> drain_active = inst->sub_state & IRIS_INST_SUB_DRAIN &&
> inst->sub_state & IRIS_INST_SUB_DRAIN_LAST;
>
> @@ -108,7 +109,8 @@ int iris_process_streamon_output(struct iris_inst *inst)
> else if (drain_active)
> clear_sub_state = IRIS_INST_SUB_DRAIN | IRIS_INST_SUB_DRAIN_LAST;
>
> - if (inst->domain == DECODER && inst->sub_state & IRIS_INST_SUB_INPUT_PAUSE) {
> + /* Input internal buffer reconfiguration required in case of resolution change */
> + if (first_ipsc || drc_active) {
> ret = iris_alloc_and_queue_input_int_bufs(inst);
> if (ret)
> return ret;
After this line comes manual writing of STAGE and PIPE. Could you please
point out where is the driver updating the resolution in the firmware?
And if it does, why do we need to write STAGE and PIPE again?
>
> ---
> base-commit: 163917839c0eea3bdfe3620f27f617a55fd76302
> change-id: 20251103-iris-seek-fix-7a25af22fa52
>
> Best regards,
> --
> Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
>
--
With best wishes
Dmitry
On 11/4/25 2:11 AM, Dikshita Agarwal wrote:
> [..]
> --- a/drivers/media/platform/qcom/iris/iris_common.c
> +++ b/drivers/media/platform/qcom/iris/iris_common.c
> @@ -91,12 +91,13 @@ int iris_process_streamon_input(struct iris_inst *inst)
> int iris_process_streamon_output(struct iris_inst *inst)
> {
> const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> - bool drain_active = false, drc_active = false;
> enum iris_inst_sub_state clear_sub_state = 0;
> int ret = 0;
>
> [..]
Somehow, you have lost the + edited line that declares the bools.. Hence
the CI failure reported for v1, and the kernel test robot message from
just a couple minutes ago.
But with `bool first_ipsc = false, drain_active = false, drc_active =
false;` filled in,
Tested-by: Val Packett <val@packett.cool>
finally the decoder is actually usable \o/
~val
On 11/5/2025 5:20 AM, Val Packett wrote:
>
> On 11/4/25 2:11 AM, Dikshita Agarwal wrote:
>> [..]
>> --- a/drivers/media/platform/qcom/iris/iris_common.c
>> +++ b/drivers/media/platform/qcom/iris/iris_common.c
>> @@ -91,12 +91,13 @@ int iris_process_streamon_input(struct iris_inst *inst)
>> int iris_process_streamon_output(struct iris_inst *inst)
>> {
>> const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
>> - bool drain_active = false, drc_active = false;
>> enum iris_inst_sub_state clear_sub_state = 0;
>> int ret = 0;
>>
>> [..]
>
> Somehow, you have lost the + edited line that declares the bools.. Hence
> the CI failure reported for v1, and the kernel test robot message from just
> a couple minutes ago.
Yes, I realized the mistake and have posted v3 with the fix. However, I
missed to add your tested-by, apologies for the same.
Could you please review v3 and add the tag again.
Thanks,
Dikshita
>
> But with `bool first_ipsc = false, drain_active = false, drc_active =
> false;` filled in,
>
> Tested-by: Val Packett <val@packett.cool>
>
> finally the decoder is actually usable \o/
>
> ~val
>
Hi Dikshita,
kernel test robot noticed the following build errors:
[auto build test ERROR on 163917839c0eea3bdfe3620f27f617a55fd76302]
url: https://github.com/intel-lab-lkp/linux/commits/Dikshita-Agarwal/media-iris-Refine-internal-buffer-reconfiguration-logic-for-resolution-change/20251104-131307
base: 163917839c0eea3bdfe3620f27f617a55fd76302
patch link: https://lore.kernel.org/r/20251104-iris-seek-fix-v2-1-c9dace39b43d%40oss.qualcomm.com
patch subject: [PATCH v2] media: iris: Refine internal buffer reconfiguration logic for resolution change
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20251105/202511050737.07EKKlnk-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251105/202511050737.07EKKlnk-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202511050737.07EKKlnk-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/media/platform/qcom/iris/iris_common.c: In function 'iris_process_streamon_output':
>> drivers/media/platform/qcom/iris/iris_common.c:99:9: error: 'first_ipsc' undeclared (first use in this function)
99 | first_ipsc = inst->sub_state & IRIS_INST_SUB_FIRST_IPSC;
| ^~~~~~~~~~
drivers/media/platform/qcom/iris/iris_common.c:99:9: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/media/platform/qcom/iris/iris_common.c:101:9: error: 'drain_active' undeclared (first use in this function); did you mean 'swait_active'?
101 | drain_active = inst->sub_state & IRIS_INST_SUB_DRAIN &&
| ^~~~~~~~~~~~
| swait_active
>> drivers/media/platform/qcom/iris/iris_common.c:104:9: error: 'drc_active' undeclared (first use in this function); did you mean 'PG_active'?
104 | drc_active = inst->sub_state & IRIS_INST_SUB_DRC &&
| ^~~~~~~~~~
| PG_active
vim +/first_ipsc +99 drivers/media/platform/qcom/iris/iris_common.c
90
91 int iris_process_streamon_output(struct iris_inst *inst)
92 {
93 const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
94 enum iris_inst_sub_state clear_sub_state = 0;
95 int ret = 0;
96
97 iris_scale_power(inst);
98
> 99 first_ipsc = inst->sub_state & IRIS_INST_SUB_FIRST_IPSC;
100
> 101 drain_active = inst->sub_state & IRIS_INST_SUB_DRAIN &&
102 inst->sub_state & IRIS_INST_SUB_DRAIN_LAST;
103
> 104 drc_active = inst->sub_state & IRIS_INST_SUB_DRC &&
105 inst->sub_state & IRIS_INST_SUB_DRC_LAST;
106
107 if (drc_active)
108 clear_sub_state = IRIS_INST_SUB_DRC | IRIS_INST_SUB_DRC_LAST;
109 else if (drain_active)
110 clear_sub_state = IRIS_INST_SUB_DRAIN | IRIS_INST_SUB_DRAIN_LAST;
111
112 /* Input internal buffer reconfiguration required in case of resolution change */
113 if (first_ipsc || drc_active) {
114 ret = iris_alloc_and_queue_input_int_bufs(inst);
115 if (ret)
116 return ret;
117 ret = iris_set_stage(inst, STAGE);
118 if (ret)
119 return ret;
120 ret = iris_set_pipe(inst, PIPE);
121 if (ret)
122 return ret;
123 }
124
125 if (inst->state == IRIS_INST_INPUT_STREAMING &&
126 inst->sub_state & IRIS_INST_SUB_INPUT_PAUSE) {
127 if (!drain_active)
128 ret = hfi_ops->session_resume_drc(inst,
129 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
130 else if (hfi_ops->session_resume_drain)
131 ret = hfi_ops->session_resume_drain(inst,
132 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
133 if (ret)
134 return ret;
135 clear_sub_state |= IRIS_INST_SUB_INPUT_PAUSE;
136 }
137
138 if (inst->sub_state & IRIS_INST_SUB_FIRST_IPSC)
139 clear_sub_state |= IRIS_INST_SUB_FIRST_IPSC;
140
141 ret = hfi_ops->session_start(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
142 if (ret)
143 return ret;
144
145 if (inst->sub_state & IRIS_INST_SUB_OUTPUT_PAUSE)
146 clear_sub_state |= IRIS_INST_SUB_OUTPUT_PAUSE;
147
148 ret = iris_inst_state_change_streamon(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
149 if (ret)
150 return ret;
151
152 inst->last_buffer_dequeued = false;
153
154 return iris_inst_change_sub_state(inst, clear_sub_state, 0);
155 }
156
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2025 Red Hat, Inc.