mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vikash Garodia <quic_vgarodia@quicinc.com>
To: Dikshita Agarwal <quic_dikshita@quicinc.com>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Stefan Schmidt <stefan.schmidt@linaro.org>,
	Vedang Nagar <quic_vnagar@quicinc.com>,
	"Hans Verkuil" <hverkuil@kernel.org>
Cc: <linux-media@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Renjiang Han <quic_renjiang@quicinc.com>,
	Wangao Wang <quic_wangaow@quicinc.com>
Subject: Re: [PATCH v3 08/26] media: iris: Simplify session stop logic by relying on vb2 checks
Date: Mon, 25 Aug 2025 11:17:17 +0530	[thread overview]
Message-ID: <7cc32935-e9d4-a250-29d8-6a873ac21540@quicinc.com> (raw)
In-Reply-To: <20250820-iris-video-encoder-v3-8-80ab0ba58b3d@quicinc.com>


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@quicinc.com>
> ---
>  .../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@quicinc.com>

  reply	other threads:[~2025-08-25  5:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20  9:07 [PATCH v3 00/26] Enable H.264/H.265 encoder support and fixes in iris driver common code Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 01/26] media: iris: Fix buffer count reporting in internal buffer check Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 02/26] media: iris: Report unreleased PERSIST buffers on session close Dikshita Agarwal
2025-08-21  8:03   ` Bryan O'Donoghue
2025-08-20  9:07 ` [PATCH v3 03/26] media: iris: Fix memory leak by freeing untracked persist buffer Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 04/26] media: iris: Fix port streaming handling Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 05/26] media: iris: Allow substate transition to load resources during output streaming Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 06/26] media: iris: Always destroy internal buffers on firmware release response Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 07/26] media: iris: Update vbuf flags before v4l2_m2m_buf_done Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 08/26] media: iris: Simplify session stop logic by relying on vb2 checks Dikshita Agarwal
2025-08-25  5:47   ` Vikash Garodia [this message]
2025-08-20  9:07 ` [PATCH v3 09/26] media: iris: Allow stop on firmware only if start was issued Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 10/26] media: iris: Send dummy buffer address for all codecs during drain Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 11/26] media: iris: Fix missing LAST flag handling " Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 12/26] media: iris: Fix format check for CAPTURE plane in try_fmt Dikshita Agarwal
2025-08-25  5:49   ` Vikash Garodia
2025-08-20  9:07 ` [PATCH v3 13/26] media: iris: Add support for video encoder device Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 14/26] media: iris: Initialize and deinitialize encoder instance structure Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 15/26] media: iris: Add support for ENUM_FMT, S/G/TRY_FMT encoder Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 16/26] media: iris: Add support for ENUM_FRAMESIZES/FRAMEINTERVALS for encoder Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 17/26] media: iris: Add support for VIDIOC_QUERYCAP for encoder video device Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 18/26] media: iris: Add encoder support for V4L2 event subscription Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 19/26] media: iris: Add support for G/S_SELECTION for encoder video device Dikshita Agarwal
2025-08-20  9:07 ` [PATCH v3 20/26] media: iris: Add support for G/S_PARM " Dikshita Agarwal
2025-08-25  5:56   ` Vikash Garodia
2025-08-20  9:07 ` [PATCH v3 21/26] media: iris: Add platform-specific capabilities " Dikshita Agarwal
2025-08-20  9:08 ` [PATCH v3 22/26] media: iris: Add V4L2 streaming support " Dikshita Agarwal
2025-08-25  6:06   ` Vikash Garodia
2025-08-20  9:08 ` [PATCH v3 23/26] media: iris: Set platform capabilities to firmware " Dikshita Agarwal
2025-08-25  6:09   ` Vikash Garodia
2025-08-20  9:08 ` [PATCH v3 24/26] media: iris: Allocate and queue internal buffers " Dikshita Agarwal
2025-08-25  6:15   ` Vikash Garodia
2025-08-20  9:08 ` [PATCH v3 25/26] media: iris: Add support for buffer management ioctls for encoder device Dikshita Agarwal
2025-08-25  6:20   ` Vikash Garodia
2025-08-20  9:08 ` [PATCH v3 26/26] media: iris: Add support for drain sequence in encoder video device Dikshita Agarwal
2025-08-25  6:22   ` Vikash Garodia
2025-08-20 14:59 ` [PATCH v3 00/26] Enable H.264/H.265 encoder support and fixes in iris driver common code Neil Armstrong
2025-08-21  7:21   ` Dikshita Agarwal
2025-08-21  7:56     ` Vikash Garodia
2025-08-21  8:44       ` Neil Armstrong
2025-08-21 10:24         ` Vikash Garodia
2025-08-21 12:58     ` Neil Armstrong
2025-08-22  7:02       ` Dikshita Agarwal
2025-08-22  8:17         ` Neil Armstrong
2025-08-22 10:09           ` Vikash Garodia
2025-08-22 11:08             ` Neil Armstrong
2025-08-25  4:15               ` Dikshita Agarwal
2025-08-25  5:43               ` Vikash Garodia
2025-08-22 11:29 ` Neil Armstrong
2025-08-25  6:29   ` Vikash Garodia

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=7cc32935-e9d4-a250-29d8-6a873ac21540@quicinc.com \
    --to=quic_vgarodia@quicinc.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=bryan.odonoghue@linaro.org \
    --cc=hverkuil@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=quic_dikshita@quicinc.com \
    --cc=quic_renjiang@quicinc.com \
    --cc=quic_vnagar@quicinc.com \
    --cc=quic_wangaow@quicinc.com \
    --cc=stefan.schmidt@linaro.org \
    /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®