Re: [PATCH v3 08/26] media: iris: Simplify session stop logic by relying on vb2 checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/20/2025 2:37 PM, Dikshita Agarwal wrote:
> Remove earlier complex conditional checks in the non-streaming path that
> attempted to verify if stop was called on a plane that was previously
> started. These explicit checks are redundant, as vb2 already ensures
> that stop is only called on ports that have been started, maintaining
> correct buffer state management.
> 
> Fixes: 11712ce70f8e ("media: iris: implement vb2 streaming ops")
> Signed-off-by: Dikshita Agarwal <quic_dikshita@xxxxxxxxxxx>
> ---
>  .../platform/qcom/iris/iris_hfi_gen1_command.c     | 42 ++++++++++------------
>  1 file changed, 19 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> index 5fc30d54af4dc34616cfd08813940aa0b7044a20..3e41c8cb620ebe51636a4cc5202909bb043ed4ab 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c
> @@ -184,11 +184,25 @@ static int iris_hfi_gen1_session_stop(struct iris_inst *inst, u32 plane)
>  	u32 flush_type = 0;
>  	int ret = 0;
>  
> -	if ((V4L2_TYPE_IS_OUTPUT(plane) &&
> -	     inst->state == IRIS_INST_INPUT_STREAMING) ||
> -	    (V4L2_TYPE_IS_CAPTURE(plane) &&
> -	     inst->state == IRIS_INST_OUTPUT_STREAMING) ||
> -	    inst->state == IRIS_INST_ERROR) {
> +	if (inst->state == IRIS_INST_STREAMING) {
> +		if (V4L2_TYPE_IS_OUTPUT(plane))
> +			flush_type = HFI_FLUSH_ALL;
> +		else if (V4L2_TYPE_IS_CAPTURE(plane))
> +			flush_type = HFI_FLUSH_OUTPUT;
> +
> +		reinit_completion(&inst->flush_completion);
> +
> +		flush_pkt.shdr.hdr.size = sizeof(struct hfi_session_flush_pkt);
> +		flush_pkt.shdr.hdr.pkt_type = HFI_CMD_SESSION_FLUSH;
> +		flush_pkt.shdr.session_id = inst->session_id;
> +		flush_pkt.flush_type = flush_type;
> +
> +		ret = iris_hfi_queue_cmd_write(core, &flush_pkt, flush_pkt.shdr.hdr.size);
> +		if (!ret) {
> +			inst->flush_responses_pending++;
> +			ret = iris_wait_for_session_response(inst, true);
> +		}
> +	} else {
>  		reinit_completion(&inst->completion);
>  		iris_hfi_gen1_packet_session_cmd(inst, &pkt, HFI_CMD_SESSION_STOP);
>  		ret = iris_hfi_queue_cmd_write(core, &pkt, pkt.shdr.hdr.size);
> @@ -207,24 +221,6 @@ static int iris_hfi_gen1_session_stop(struct iris_inst *inst, u32 plane)
>  					 VB2_BUF_STATE_ERROR);
>  		iris_helper_buffers_done(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
>  					 VB2_BUF_STATE_ERROR);
> -	} else if (inst->state == IRIS_INST_STREAMING) {
> -		if (V4L2_TYPE_IS_OUTPUT(plane))
> -			flush_type = HFI_FLUSH_ALL;
> -		else if (V4L2_TYPE_IS_CAPTURE(plane))
> -			flush_type = HFI_FLUSH_OUTPUT;
> -
> -		reinit_completion(&inst->flush_completion);
> -
> -		flush_pkt.shdr.hdr.size = sizeof(struct hfi_session_flush_pkt);
> -		flush_pkt.shdr.hdr.pkt_type = HFI_CMD_SESSION_FLUSH;
> -		flush_pkt.shdr.session_id = inst->session_id;
> -		flush_pkt.flush_type = flush_type;
> -
> -		ret = iris_hfi_queue_cmd_write(core, &flush_pkt, flush_pkt.shdr.hdr.size);
> -		if (!ret) {
> -			inst->flush_responses_pending++;
> -			ret = iris_wait_for_session_response(inst, true);
> -		}
>  	}
>  
>  	return ret;
> 

Looks much simplified now.

Reviewed-by: Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux