From: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
To: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bod@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
Neil Armstrong <neil.armstrong@linaro.org>
Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Gourav Kumar <gouravk@qti.qualcomm.com>
Subject: Re: [PATCH 2/2] media: iris: disable time-delta-based rate control for VBR
Date: Tue, 7 Jul 2026 14:39:16 +0530 [thread overview]
Message-ID: <77aca547-1afd-494d-a2ec-35ba9b4d37f5@oss.qualcomm.com> (raw)
In-Reply-To: <20260707-qc10c_fix_and_disable_time_delta_based_rc-v1-2-33fa130bc535@oss.qualcomm.com>
On 7/7/2026 12:05 PM, Vishnu Reddy wrote:
> From: Gourav Kumar <gouravk@qti.qualcomm.com>
>
> The iris encoder driver was not sending
> HFI_PROP_TIME_DELTA_BASED_RATE_CONTROL to the firmware during encoder
> initialization. Without this property, the firmware defaults to
> time-delta-based rate control (enabled), which calculates the output
> bitrate from actual frame timing rather than following the configured
> bitrate target.
>
> This caused variable bitrate (VBR) encoding to produce ~5x configured
> bitrate. For example, with video_bitrate=896000 (896 Kbps), the output
> is ~4.4 Mbps instead of the expected ~896 Kbps.
>
> Time-delta-based rate control is designed for variable frame rate (VFR)
> scenarios where the encoder adapts to actual frame timing. However, when
> an application explicitly configures a bitrate target, the firmware must
> follow that target regardless of frame timing.
>
same here, we can drop the new empty lines
> Fix this by adding the TIME_DELTA_BASED_RC capability with a default value
> of 0 (disabled) and sending HFI_PROP_TIME_DELTA_BASED_RATE_CONTROL = 0 to
> the firmware during stream-on, allowing the firmware to use the configured
> bitrate as the target.
>
> Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
> Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
> ---
> drivers/media/platform/qcom/iris/iris_ctrls.c | 19 +++++++++++++++++++
> drivers/media/platform/qcom/iris/iris_ctrls.h | 1 +
> drivers/media/platform/qcom/iris/iris_hfi_gen2.c | 10 ++++++++++
> .../media/platform/qcom/iris/iris_hfi_gen2_defines.h | 1 +
> .../media/platform/qcom/iris/iris_platform_common.h | 1 +
> 5 files changed, 32 insertions(+)
>
> diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.c b/drivers/media/platform/qcom/iris/iris_ctrls.c
> index 10e33b8a73f6..f6136e655b98 100644
> --- a/drivers/media/platform/qcom/iris/iris_ctrls.c
> +++ b/drivers/media/platform/qcom/iris/iris_ctrls.c
> @@ -1477,6 +1477,25 @@ int iris_set_layer_bitrate(struct iris_inst *inst, enum platform_inst_fw_cap_typ
> &bitrate, sizeof(u32));
> }
>
> +int iris_set_time_delta_based_rc(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> +{
> + const struct iris_hfi_session_ops *hfi_ops = inst->hfi_session_ops;
> + u32 hfi_id = inst->fw_caps[cap_id].hfi_id;
> + u32 value = inst->fw_caps[cap_id].value;
> +
> + /*
> + * Disable time-delta-based rate control (value = 0).
> + * This overrides the firmware's default (enabled), ensuring the
> + * firmware uses the configured bitrate target rather than calculating
> + * bitrate from frame timing.
> + */
> + return hfi_ops->session_set_property(inst, hfi_id,
> + HFI_HOST_FLAGS_NONE,
> + iris_get_port_info(inst, cap_id),
> + HFI_PAYLOAD_U32,
> + &value, sizeof(u32));
> +}
> +
> int iris_set_properties(struct iris_inst *inst, u32 plane)
> {
> const struct iris_hfi_session_ops *hfi_ops = inst->hfi_session_ops;
> diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.h b/drivers/media/platform/qcom/iris/iris_ctrls.h
> index 3c462ec9190b..10e046722ad3 100644
> --- a/drivers/media/platform/qcom/iris/iris_ctrls.h
> +++ b/drivers/media/platform/qcom/iris/iris_ctrls.h
> @@ -47,6 +47,7 @@ int iris_set_layer_type(struct iris_inst *inst, enum platform_inst_fw_cap_type c
> int iris_set_layer_count_gen1(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
> int iris_set_layer_count_gen2(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
> int iris_set_layer_bitrate(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
> +int iris_set_time_delta_based_rc(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
> int iris_set_properties(struct iris_inst *inst, u32 plane);
>
> #endif
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2.c
> index acc0ed8adda1..d119ad599c31 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2.c
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2.c
> @@ -416,6 +416,16 @@ static const struct platform_inst_fw_cap inst_fw_cap_sm8550_enc[] = {
targets other than the one using inst_fw_cap_sm8550_enc ?
> .flags = CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU,
> .set = iris_set_bitrate_mode_gen2,
> },
> + {
> + .cap_id = TIME_DELTA_BASED_RC,
> + .min = 0,
> + .max = 1,
> + .step_or_mask = 1,
> + .value = 0,
> + .hfi_id = HFI_PROP_TIME_DELTA_BASED_RATE_CONTROL,
> + .flags = CAP_FLAG_OUTPUT_PORT,
> + .set = iris_set_time_delta_based_rc,
> + },
> {
> .cap_id = FRAME_SKIP_MODE,
> .min = V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED,
> diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h b/drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h
> index 776b21cd11b2..8766d9e49611 100644
> --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h
> +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h
> @@ -67,6 +67,7 @@ enum hfi_rate_control {
> };
>
> #define HFI_PROP_RATE_CONTROL 0x0300012a
> +#define HFI_PROP_TIME_DELTA_BASED_RATE_CONTROL 0x0300012b
> #define HFI_PROP_QP_PACKED 0x0300012e
> #define HFI_PROP_MIN_QP_PACKED 0x0300012f
> #define HFI_PROP_MAX_QP_PACKED 0x03000130
> diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h
> index c9256f2323dc..99dc6d5c72ba 100644
> --- a/drivers/media/platform/qcom/iris/iris_platform_common.h
> +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h
> @@ -183,6 +183,7 @@ enum platform_inst_fw_cap_type {
> LAYER3_BITRATE_HEVC,
> LAYER4_BITRATE_HEVC,
> LAYER5_BITRATE_HEVC,
> + TIME_DELTA_BASED_RC,
> INST_FW_CAP_MAX,
> };
>
>
Regards,
Vikash
next prev parent reply other threads:[~2026-07-07 9:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 6:35 [PATCH 0/2] media: iris: fix QC10C format handling and disable time-delta-based rate control Vishnu Reddy
2026-07-07 6:35 ` [PATCH 1/2] media: iris: avoid bit depth validation for capture formats Vishnu Reddy
2026-07-07 8:53 ` Vikash Garodia
2026-07-07 17:00 ` Vishnu Reddy
2026-07-07 6:35 ` [PATCH 2/2] media: iris: disable time-delta-based rate control for VBR Vishnu Reddy
2026-07-07 9:09 ` Vikash Garodia [this message]
2026-07-07 16:59 ` Vishnu Reddy
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=77aca547-1afd-494d-a2ec-35ba9b4d37f5@oss.qualcomm.com \
--to=vikash.garodia@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=bod@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=busanna.reddy@oss.qualcomm.com \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=gouravk@qti.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=neil.armstrong@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®