[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ee90f4d-757e-7382-e03d-7e43e7b4ee65@oss.qualcomm.com>
Date: Wed, 3 Dec 2025 11:59:06 +0530
From: Dikshita Agarwal <dikshita.agarwal@....qualcomm.com>
To: Wangao Wang <wangao.wang@....qualcomm.com>,
Vikash Garodia <vikash.garodia@....qualcomm.com>,
Abhinav Kumar <abhinav.kumar@...ux.dev>,
Bryan O'Donoghue <bod@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: quic_qiweil@...cinc.com, Renjiang Han <renjiang.han@....qualcomm.com>,
linux-media@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] media: qcom: iris: Add Long-Term Reference support
for encoder
On 11/27/2025 1:14 PM, Wangao Wang wrote:
> Add Long-Term Reference(LTR) frame support for both gen1 and gen2
> encoders by enabling the following V4L2 controls:
> V4L2_CID_MPEG_VIDEO_LTR_COUNT
> V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES
> V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX
>
> Key changes:
> Added LTR capability IDs and V4L2 controls.
> Implemented handlers for LTR count, use, and mark (gen1/gen2).
> Defined new HFI properties and structures for LTR.
> Updated platform capability tables and buffer size calculations.
>
> Signed-off-by: Wangao Wang <wangao.wang@....qualcomm.com>
> ---
> drivers/media/platform/qcom/iris/iris_ctrls.c | 126 +++++++++++++++++++++
> drivers/media/platform/qcom/iris/iris_ctrls.h | 5 +
> .../platform/qcom/iris/iris_hfi_gen1_command.c | 25 ++++
> .../platform/qcom/iris/iris_hfi_gen1_defines.h | 24 ++++
> .../platform/qcom/iris/iris_hfi_gen2_defines.h | 3 +
> .../platform/qcom/iris/iris_platform_common.h | 6 +
> .../media/platform/qcom/iris/iris_platform_gen1.c | 30 +++++
> .../media/platform/qcom/iris/iris_platform_gen2.c | 30 +++++
> drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 33 ++++--
> 9 files changed, 270 insertions(+), 12 deletions(-)
>
> static struct platform_inst_caps platform_inst_cap_sm8550 = {
> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
> index 1e54ace966c74956208d88f06837b97b1fd48e17..8139fefe40fe179ff7862bbca879ce94c71c1f89 100644
> --- a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
> +++ b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c
> @@ -668,6 +668,19 @@ static u32 iris_vpu_enc_bin_size(struct iris_inst *inst)
> num_vpp_pipes, inst->hfi_rc_type);
> }
>
> +static inline u32 hfi_buffer_get_recon_count(struct iris_inst *inst)
> +{
> + u32 num_ref = 1;
> + u32 ltr_count;
> +
> + ltr_count = inst->fw_caps[LTR_COUNT].value;
> +
> + if (ltr_count)
> + num_ref = num_ref + ltr_count;
> +
> + return num_ref + 1;
> +}
Here you are always returning num_ref+1 which might break
iris_vpu_enc_scratch2_size calculation since you are using this as common
API for calculating ref buffers. Please recheck.
> +
> static inline
> u32 hfi_buffer_comv_enc(u32 frame_width, u32 frame_height, u32 lcu_size,
> u32 num_recon, u32 standard)
> @@ -693,17 +706,14 @@ static u32 iris_vpu_enc_comv_size(struct iris_inst *inst)
> {
> u32 height = iris_vpu_enc_get_bitstream_height(inst);
> u32 width = iris_vpu_enc_get_bitstream_width(inst);
> - u32 num_recon = 1;
> - u32 lcu_size = 16;
> + u32 num_recon = hfi_buffer_get_recon_count(inst);
> + u32 standard, lcu_size;
>
> - if (inst->codec == V4L2_PIX_FMT_HEVC) {
> - lcu_size = 32;
> - return hfi_buffer_comv_enc(width, height, lcu_size,
> - num_recon + 1, HFI_CODEC_ENCODE_HEVC);
> - }
> + standard = (inst->codec == V4L2_PIX_FMT_HEVC) ?
> + HFI_CODEC_ENCODE_HEVC : HFI_CODEC_ENCODE_AVC;
> + lcu_size = (inst->codec == V4L2_PIX_FMT_HEVC) ? 32 : 16;
these code optimization is not in the scope of this change. pls have in a
spearate patch if needed.
Thanks,
Dikshita
>
> - return hfi_buffer_comv_enc(width, height, lcu_size,
> - num_recon + 1, HFI_CODEC_ENCODE_AVC);
> + return hfi_buffer_comv_enc(width, height, lcu_size, num_recon, standard);
> }
>
> static inline
> @@ -1402,10 +1412,9 @@ static u32 iris_vpu_enc_scratch2_size(struct iris_inst *inst)
> {
> u32 frame_height = iris_vpu_enc_get_bitstream_height(inst);
> u32 frame_width = iris_vpu_enc_get_bitstream_width(inst);
> - u32 num_ref = 1;
> + u32 num_ref = hfi_buffer_get_recon_count(inst);
>
> - return hfi_buffer_scratch2_enc(frame_width, frame_height, num_ref,
> - false);
> + return hfi_buffer_scratch2_enc(frame_width, frame_height, num_ref, false);
> }
>
> static u32 iris_vpu_enc_vpss_size(struct iris_inst *inst)
>
Powered by blists - more mailing lists