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 12:26:34 +0530 [thread overview]
Message-ID: <17b48dc5-9808-db54-323e-40cb5bbf9b12@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(-)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.c b/drivers/media/platform/qcom/iris/iris_ctrls.c
> index cdf38c285b9133f20bdb9bc3dd0f5e916d3ed7f8..33e104142a5bb51c952550fa45e81b3bdc723ac2 100644
> --- a/drivers/media/platform/qcom/iris/iris_ctrls.c
> +++ b/drivers/media/platform/qcom/iris/iris_ctrls.c
> @@ -108,6 +108,12 @@ static enum platform_inst_fw_cap_type iris_get_cap_id(u32 id)
> return IR_TYPE;
> case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD:
> return IR_PERIOD;
> + case V4L2_CID_MPEG_VIDEO_LTR_COUNT:
> + return LTR_COUNT;
> + case V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES:
> + return USE_LTR;
> + case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX:
> + return MARK_LTR;
> default:
> return INST_FW_CAP_MAX;
> }
> @@ -205,6 +211,12 @@ static u32 iris_get_v4l2_id(enum platform_inst_fw_cap_type cap_id)
> return V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD_TYPE;
> case IR_PERIOD:
> return V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD;
> + case LTR_COUNT:
> + return V4L2_CID_MPEG_VIDEO_LTR_COUNT;
> + case USE_LTR:
> + return V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES;
> + case MARK_LTR:
> + return V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX;
> default:
> return 0;
> }
> @@ -1022,6 +1034,120 @@ int iris_set_ir_period_gen2(struct iris_inst *inst, enum platform_inst_fw_cap_ty
> &ir_period, sizeof(u32));
> }
>
> +int iris_set_ltr_count_gen1(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> + const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> + u32 ltr_count = inst->fw_caps[cap_id].value;
> + u32 hfi_id = inst->fw_caps[cap_id].hfi_id;
> + struct hfi_ltr_mode ltr_mode;
> +
> + if (!ltr_count)
> + return -EINVAL;
> +
> + ltr_mode.count = ltr_count;
> + ltr_mode.mode = HFI_LTR_MODE_MANUAL;
> + ltr_mode.trust_mode = 1;
> +
> + return hfi_ops->session_set_property(inst, hfi_id,
> + HFI_HOST_FLAGS_NONE,
> + iris_get_port_info(inst, cap_id),
> + HFI_PAYLOAD_STRUCTURE,
> + <r_mode, sizeof(ltr_mode));
> +}
> +
> +int iris_set_use_ltr(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> + const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> + struct vb2_queue *sq = v4l2_m2m_get_src_vq(inst->m2m_ctx);
> + struct vb2_queue *dq = v4l2_m2m_get_dst_vq(inst->m2m_ctx);
> + u32 ltr_count = inst->fw_caps[LTR_COUNT].value;
> + u32 hfi_id = inst->fw_caps[cap_id].hfi_id;
> + struct hfi_ltr_use ltr_use;
> +
> + if (!vb2_is_streaming(sq) && !vb2_is_streaming(dq))
> + return -EINVAL;
RC check not required here?
> +
> + if (!ltr_count)
> + return -EINVAL;
> +
> + ltr_use.ref_ltr = inst->fw_caps[cap_id].value;
> + ltr_use.use_constrnt = true;
> + ltr_use.frames = 0;
> +
> + return hfi_ops->session_set_property(inst, hfi_id,
> + HFI_HOST_FLAGS_NONE,
> + iris_get_port_info(inst, cap_id),
> + HFI_PAYLOAD_STRUCTURE,
> + <r_use, sizeof(ltr_use));
> +}
> +
> +int iris_set_mark_ltr(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> + const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> + struct vb2_queue *sq = v4l2_m2m_get_src_vq(inst->m2m_ctx);
> + struct vb2_queue *dq = v4l2_m2m_get_dst_vq(inst->m2m_ctx);
> + u32 ltr_count = inst->fw_caps[LTR_COUNT].value;
> + u32 hfi_id = inst->fw_caps[cap_id].hfi_id;
> + struct hfi_ltr_mark ltr_mark;
> +
> + if (!vb2_is_streaming(sq) && !vb2_is_streaming(dq))
> + return -EINVAL;
> +
> + if (!ltr_count)
> + return -EINVAL;
> +
RC check not required here?
> + ltr_mark.mark_frame = inst->fw_caps[cap_id].value;
> +
> + return hfi_ops->session_set_property(inst, hfi_id,
> + HFI_HOST_FLAGS_NONE,
> + iris_get_port_info(inst, cap_id),
> + HFI_PAYLOAD_STRUCTURE,
> + <r_mark, sizeof(ltr_mark));
> +}
> +
> +int iris_set_ltr_count_gen2(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> + const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> + u32 ltr_count = inst->fw_caps[cap_id].value;
> + u32 hfi_id = inst->fw_caps[cap_id].hfi_id;
> +
> + if (!ltr_count)
> + return -EINVAL;
> +
> + if (inst->hfi_rc_type == HFI_RATE_CONTROL_VBR_VFR ||
> + inst->hfi_rc_type == HFI_RATE_CONTROL_VBR_CFR ||
> + inst->hfi_rc_type == HFI_RATE_CONTROL_CQ)
> + return -EINVAL;
> +
> + return hfi_ops->session_set_property(inst, hfi_id,
> + HFI_HOST_FLAGS_NONE,
> + iris_get_port_info(inst, cap_id),
> + HFI_PAYLOAD_U32,
> + <r_count, sizeof(u32));
> +}
> +
> +int iris_set_use_and_mark_ltr(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> + const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
> + u32 ltr_count = inst->fw_caps[LTR_COUNT].value;
> + u32 hfi_val = inst->fw_caps[cap_id].value;
> + u32 hfi_id = inst->fw_caps[cap_id].hfi_id;
> +
> + if (!ltr_count || hfi_val == INVALID_DEFAULT_MARK_OR_USE_LTR)
> + return -EINVAL;
> +
> + if (inst->hfi_rc_type == HFI_RATE_CONTROL_VBR_VFR ||
> + inst->hfi_rc_type == HFI_RATE_CONTROL_VBR_CFR ||
> + inst->hfi_rc_type == HFI_RATE_CONTROL_CQ)
> + return -EINVAL;
> +
Streaming check is not required here?
Thanks,
Dikshita
> + return hfi_ops->session_set_property(inst, hfi_id,
> + HFI_HOST_FLAGS_NONE,
> + iris_get_port_info(inst, cap_id),
> + HFI_PAYLOAD_U32,
> + &hfi_val, sizeof(u32));
> +}
> +
next prev parent reply other threads:[~2025-12-03 6:56 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
2025-12-03 6:56 ` Dikshita Agarwal [this message]
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=17b48dc5-9808-db54-323e-40cb5bbf9b12@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.