diff mbox series

[v2,11/23] media: iris: Remove redundant buffer count check in stream off

Message ID 20250428-qcom-iris-hevc-vp9-v2-11-3a6013ecb8a5@quicinc.com
State Superseded
Headers show
Series Add support for HEVC and VP9 codecs in decoder | expand

Commit Message

Dikshita Agarwal April 28, 2025, 9:28 a.m. UTC
Currently, the stream off process checks the count of buffers in
v4l2_m2m_queues using v4l2_m2m_for_each_src_buf_safe and
v4l2_m2m_for_each_dst_buf_safe APIs. If the count is non-zero, it
returns an error. This check is redundant as the V4L2 framework already
handles buffer management internally.

Remove the unnecessary buffer count check in stream off, simplifying the
process and relying on V4L2's internal mechanisms for buffer management.

Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
---
 drivers/media/platform/qcom/iris/iris_vdec.c | 36 ----------------------------
 1 file changed, 36 deletions(-)

Comments

Vikash Garodia April 29, 2025, 10:24 a.m. UTC | #1
On 4/28/2025 2:58 PM, Dikshita Agarwal wrote:
> Currently, the stream off process checks the count of buffers in
> v4l2_m2m_queues using v4l2_m2m_for_each_src_buf_safe and
> v4l2_m2m_for_each_dst_buf_safe APIs. If the count is non-zero, it
> returns an error. This check is redundant as the V4L2 framework already
> handles buffer management internally.
> 
> Remove the unnecessary buffer count check in stream off, simplifying the
> process and relying on V4L2's internal mechanisms for buffer management.
> 
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---
>  drivers/media/platform/qcom/iris/iris_vdec.c | 36 ----------------------------
>  1 file changed, 36 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
> index d162cc9650f5..30a9969bc368 100644
> --- a/drivers/media/platform/qcom/iris/iris_vdec.c
> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c
> @@ -244,35 +244,6 @@ void iris_vdec_src_change(struct iris_inst *inst)
>  	v4l2_event_queue_fh(&inst->fh, &event);
>  }
>  
> -static int iris_vdec_get_num_queued_buffers(struct iris_inst *inst,
> -					    enum iris_buffer_type type)
> -{
> -	struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx;
> -	struct v4l2_m2m_buffer *buffer, *n;
> -	struct iris_buffer *buf;
> -	u32 count = 0;
> -
> -	switch (type) {
> -	case BUF_INPUT:
> -		v4l2_m2m_for_each_src_buf_safe(m2m_ctx, buffer, n) {
> -			buf = to_iris_buffer(&buffer->vb);
> -			if (!(buf->attr & BUF_ATTR_QUEUED))
> -				continue;
> -			count++;
> -		}
> -		return count;
> -	case BUF_OUTPUT:
> -		v4l2_m2m_for_each_dst_buf_safe(m2m_ctx, buffer, n) {
> -			buf = to_iris_buffer(&buffer->vb);
> -			if (!(buf->attr & BUF_ATTR_QUEUED))
> -				continue;
> -			count++;
> -		}
> -		return count;
> -	default:
> -		return count;
> -	}
> -}
>  
>  static void iris_vdec_flush_deferred_buffers(struct iris_inst *inst,
>  					     enum iris_buffer_type type)
> @@ -321,7 +292,6 @@ int iris_vdec_session_streamoff(struct iris_inst *inst, u32 plane)
>  {
>  	const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
>  	enum iris_buffer_type buffer_type;
> -	u32 count;
>  	int ret;
>  
>  	switch (plane) {
> @@ -339,12 +309,6 @@ int iris_vdec_session_streamoff(struct iris_inst *inst, u32 plane)
>  	if (ret)
>  		goto error;
>  
> -	count = iris_vdec_get_num_queued_buffers(inst, buffer_type);
> -	if (count) {
> -		ret = -EINVAL;
> -		goto error;
> -	}
> -
>  	ret = iris_inst_state_change_streamoff(inst, plane);
>  	if (ret)
>  		goto error;
> 

Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
index d162cc9650f5..30a9969bc368 100644
--- a/drivers/media/platform/qcom/iris/iris_vdec.c
+++ b/drivers/media/platform/qcom/iris/iris_vdec.c
@@ -244,35 +244,6 @@  void iris_vdec_src_change(struct iris_inst *inst)
 	v4l2_event_queue_fh(&inst->fh, &event);
 }
 
-static int iris_vdec_get_num_queued_buffers(struct iris_inst *inst,
-					    enum iris_buffer_type type)
-{
-	struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx;
-	struct v4l2_m2m_buffer *buffer, *n;
-	struct iris_buffer *buf;
-	u32 count = 0;
-
-	switch (type) {
-	case BUF_INPUT:
-		v4l2_m2m_for_each_src_buf_safe(m2m_ctx, buffer, n) {
-			buf = to_iris_buffer(&buffer->vb);
-			if (!(buf->attr & BUF_ATTR_QUEUED))
-				continue;
-			count++;
-		}
-		return count;
-	case BUF_OUTPUT:
-		v4l2_m2m_for_each_dst_buf_safe(m2m_ctx, buffer, n) {
-			buf = to_iris_buffer(&buffer->vb);
-			if (!(buf->attr & BUF_ATTR_QUEUED))
-				continue;
-			count++;
-		}
-		return count;
-	default:
-		return count;
-	}
-}
 
 static void iris_vdec_flush_deferred_buffers(struct iris_inst *inst,
 					     enum iris_buffer_type type)
@@ -321,7 +292,6 @@  int iris_vdec_session_streamoff(struct iris_inst *inst, u32 plane)
 {
 	const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
 	enum iris_buffer_type buffer_type;
-	u32 count;
 	int ret;
 
 	switch (plane) {
@@ -339,12 +309,6 @@  int iris_vdec_session_streamoff(struct iris_inst *inst, u32 plane)
 	if (ret)
 		goto error;
 
-	count = iris_vdec_get_num_queued_buffers(inst, buffer_type);
-	if (count) {
-		ret = -EINVAL;
-		goto error;
-	}
-
 	ret = iris_inst_state_change_streamoff(inst, plane);
 	if (ret)
 		goto error;