From: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
To: Wangao Wang <wangao.wang@oss.qualcomm.com>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bod@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: quic_qiweil@quicinc.com,
Renjiang Han <renjiang.han@oss.qualcomm.com>,
linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] media: qcom: iris: Add Long-Term Reference support for encoder
Date: Wed, 3 Dec 2025 11:59:06 +0530 [thread overview]
Message-ID: <4ee90f4d-757e-7382-e03d-7e43e7b4ee65@oss.qualcomm.com> (raw)
In-Reply-To: <20251127-batch2_iris_encoder_enhancements-v1-2-5ea78e2de2ae@oss.qualcomm.com>
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@oss.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)
>
next prev parent reply other threads:[~2025-12-03 6:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 7:44 [PATCH 0/4] media: qcom: iris: encoder feature enhancements batch2 Wangao Wang
2025-11-27 7:44 ` [PATCH 1/4] media: qcom: iris: Add intra refresh support for gen1 encoder Wangao Wang
2025-11-27 10:35 ` Bryan O'Donoghue
2025-12-02 6:35 ` Wangao Wang
2025-12-03 4:28 ` Dikshita Agarwal
2025-12-04 2:21 ` Wangao Wang
2025-11-27 7:44 ` [PATCH 2/4] media: qcom: iris: Add Long-Term Reference support for encoder Wangao Wang
2025-11-27 10:41 ` Bryan O'Donoghue
2025-12-02 6:38 ` Wangao Wang
2025-12-03 6:29 ` Dikshita Agarwal [this message]
2025-12-03 6:56 ` Dikshita Agarwal
2025-11-27 7:44 ` [PATCH 3/4] media: qcom: iris: Add B frames " Wangao Wang
2025-11-27 10:43 ` Bryan O'Donoghue
2025-12-02 6:46 ` Wangao Wang
2025-12-03 6:55 ` Dikshita Agarwal
2025-11-27 7:44 ` [PATCH 4/4] media: qcom: iris: Add hierarchical coding " Wangao Wang
2025-11-27 10:50 ` Bryan O'Donoghue
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=4ee90f4d-757e-7382-e03d-7e43e7b4ee65@oss.qualcomm.com \
--to=dikshita.agarwal@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=bod@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_qiweil@quicinc.com \
--cc=renjiang.han@oss.qualcomm.com \
--cc=vikash.garodia@oss.qualcomm.com \
--cc=wangao.wang@oss.qualcomm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.