linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Dikshita Agarwal <quic_dikshita@quicinc.com>,
	Vikash Garodia <quic_vgarodia@quicinc.com>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>,
	Stefan Schmidt <stefan.schmidt@linaro.org>,
	Vedang Nagar <quic_vnagar@quicinc.com>
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 v2 10/24] media: iris: Fix missing LAST flag handling during drain
Date: Sat, 16 Aug 2025 12:17:04 +0100	[thread overview]
Message-ID: <af97c3e4-3541-418c-a0f1-ea86d2968a3c@linaro.org> (raw)
In-Reply-To: <20250813-iris-video-encoder-v2-10-c725ff673078@quicinc.com>

On 13/08/2025 10:38, Dikshita Agarwal wrote:
> Improve drain handling by ensuring the LAST flag is attached to final
> capture buffer when drain response is received from the firmware.
> 
> Previously, the driver failed to attach the V4L2_BUF_FLAG_LAST flag when
> a drain response was received from the firmware, relying on userspace to
> mark the next queued buffer as LAST. This update fixes the issue by
> checking the pending drain status, attaching the LAST flag to the
> capture buffer received from the firmware (with EOS attached), and
> returning it to the V4L2 layer correctly.
> 
> Fixes: d09100763bed ("media: iris: add support for drain sequence")
> Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>
> Tested-by: Vikash Garodia <quic_vgarodia@quicinc.com> # X1E80100
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---
>   drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c | 4 +---
>   drivers/media/platform/qcom/iris/iris_state.c             | 2 +-
>   drivers/media/platform/qcom/iris/iris_state.h             | 1 +
>   3 files changed, 3 insertions(+), 4 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 8d1ce8a19a45ebb2b29457e0fef7d72c1c0d9785..2a96458833835422d30c9386d15cc1e4fb226e3d 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_response.c
> @@ -416,8 +416,6 @@ static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet)
>   			inst->flush_responses_pending++;
>   
>   		iris_inst_sub_state_change_drain_last(inst);
> -
> -		return;
>   	}
>   
>   	if (iris_split_mode_enabled(inst) && pkt->stream_id == 0) {
> @@ -462,7 +460,7 @@ static void iris_hfi_gen1_session_ftb_done(struct iris_inst *inst, void *packet)
>   		timestamp_us = (timestamp_us << 32) | timestamp_lo;
>   	} else {
>   		if (pkt->stream_id == 1 && !inst->last_buffer_dequeued) {
> -			if (iris_drc_pending(inst)) {
> +			if (iris_drc_pending(inst) || iris_drain_pending(inst)) {
>   				flags |= V4L2_BUF_FLAG_LAST;
>   				inst->last_buffer_dequeued = true;
>   			}
> diff --git a/drivers/media/platform/qcom/iris/iris_state.c b/drivers/media/platform/qcom/iris/iris_state.c
> index a21238d2818f9606871953bd0bee25382cca0474..d1dc1a863da0b0b1af60974e9ed2ef68ea225cdd 100644
> --- a/drivers/media/platform/qcom/iris/iris_state.c
> +++ b/drivers/media/platform/qcom/iris/iris_state.c
> @@ -252,7 +252,7 @@ bool iris_drc_pending(struct iris_inst *inst)
>   		inst->sub_state & IRIS_INST_SUB_DRC_LAST;
>   }
>   
> -static inline bool iris_drain_pending(struct iris_inst *inst)
> +bool iris_drain_pending(struct iris_inst *inst)
>   {
>   	return inst->sub_state & IRIS_INST_SUB_DRAIN &&
>   		inst->sub_state & IRIS_INST_SUB_DRAIN_LAST;
> diff --git a/drivers/media/platform/qcom/iris/iris_state.h b/drivers/media/platform/qcom/iris/iris_state.h
> index e718386dbe0402417f408d8fc696a33e5c7f23b3..b09fa54cf17eeee0c9ae254588964ad959c82c80 100644
> --- a/drivers/media/platform/qcom/iris/iris_state.h
> +++ b/drivers/media/platform/qcom/iris/iris_state.h
> @@ -141,5 +141,6 @@ int iris_inst_sub_state_change_drc_last(struct iris_inst *inst);
>   int iris_inst_sub_state_change_pause(struct iris_inst *inst, u32 plane);
>   bool iris_allow_cmd(struct iris_inst *inst, u32 cmd);
>   bool iris_drc_pending(struct iris_inst *inst);
> +bool iris_drain_pending(struct iris_inst *inst);
>   
>   #endif
> 
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

  reply	other threads:[~2025-08-16 11:17 UTC|newest]

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

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=af97c3e4-3541-418c-a0f1-ea86d2968a3c@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=abhinav.kumar@linux.dev \
    --cc=hverkuil@xs4all.nl \
    --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_vgarodia@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;
as well as URLs for NNTP newsgroup(s).