mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] media: iris: fix QC10C format handling and disable time-delta-based rate control
@ 2026-07-07  6:35 Vishnu Reddy
  2026-07-07  6:35 ` [PATCH 1/2] media: iris: avoid bit depth validation for capture formats Vishnu Reddy
  2026-07-07  6:35 ` [PATCH 2/2] media: iris: disable time-delta-based rate control for VBR Vishnu Reddy
  0 siblings, 2 replies; 7+ messages in thread
From: Vishnu Reddy @ 2026-07-07  6:35 UTC (permalink / raw)
  To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab, Dmitry Baryshkov,
	Neil Armstrong
  Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel,
	Vishnu Reddy, stable, Gourav Kumar

The first patch fixes QC10C format requests being silently replaced
by P010, because the bit depth was checked before the firmware had
reported it.

The second patch disables time-delta-based rate control for VBR
encoding, so the firmware follows the configured bitrate target.

Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
---
Gourav Kumar (1):
      media: iris: disable time-delta-based rate control for VBR

Vishnu Reddy (1):
      media: iris: avoid bit depth validation for capture formats

 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 +
 drivers/media/platform/qcom/iris/iris_vdec.c          | 10 ----------
 6 files changed, 32 insertions(+), 10 deletions(-)
---
base-commit: 8e9685d3c41c35dd1b37df70d854137abcb2fbac
change-id: 20260707-qc10c_fix_and_disable_time_delta_based_rc-4d6172b395b1

Best regards,
--  
Vishnu Reddy <busanna.reddy@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] media: iris: avoid bit depth validation for capture formats
  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 ` Vishnu Reddy
  2026-07-07  8:53   ` Vikash Garodia
  2026-07-07  6:35 ` [PATCH 2/2] media: iris: disable time-delta-based rate control for VBR Vishnu Reddy
  1 sibling, 1 reply; 7+ messages in thread
From: Vishnu Reddy @ 2026-07-07  6:35 UTC (permalink / raw)
  To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab, Dmitry Baryshkov,
	Neil Armstrong
  Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel,
	Vishnu Reddy, stable

When validating a capture format, check_format() compares the requested
pixel format against inst->fw_caps[BIT_DEPTH]. However, the bit depth
capability is not available at this stage and it contains the default
value of BIT_DEPTH_8. The actual bit depth is updated later after the
firmware reports stream capabilities through read_input_subcr_params().
Because of this, a valid QC10C format request is rejected during the
initial format negotiation. The driver then falls back to the default
capture format (NV12) and stores it as capture format.

Later, when the firmware reports that the stream is 10-bit, the driver
sees NV12 as the selected capture format and switches to the default
10-bit format (P010). As a result, the original QC10C format requested
by userspace is lost and QC10C decoding cannot work correctly.

The bit depth information is not reliable during the initial format
setup, so it should not be used to validate capture formats. Remove
the bit-depth checks from check_format() and only verify that the
requested pixel format is supported. This allows the format requested
by userspace is handled correctly.

Fixes: 20c3ef4c7cae ("media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats")
Cc: stable@vger.kernel.org
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
---
 drivers/media/platform/qcom/iris/iris_vdec.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
index 9e228b70420e..7f89e745a4b1 100644
--- a/drivers/media/platform/qcom/iris/iris_vdec.c
+++ b/drivers/media/platform/qcom/iris/iris_vdec.c
@@ -95,16 +95,6 @@ static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type)
 	if (i == size)
 		return false;
 
-	if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
-		if (iris_fmt_is_8bit(pixfmt) &&
-		    inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_10)
-			return false;
-
-		if (iris_fmt_is_10bit(pixfmt) &&
-		    inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10)
-			return false;
-	}
-
 	return true;
 }
 

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] media: iris: disable time-delta-based rate control for VBR
  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  6:35 ` Vishnu Reddy
  2026-07-07  9:09   ` Vikash Garodia
  1 sibling, 1 reply; 7+ messages in thread
From: Vishnu Reddy @ 2026-07-07  6:35 UTC (permalink / raw)
  To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab, Dmitry Baryshkov,
	Neil Armstrong
  Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel,
	Vishnu Reddy, Gourav Kumar

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.

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[] = {
 		.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,
 };
 

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] media: iris: avoid bit depth validation for capture formats
  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
  0 siblings, 1 reply; 7+ messages in thread
From: Vikash Garodia @ 2026-07-07  8:53 UTC (permalink / raw)
  To: Vishnu Reddy, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab, Dmitry Baryshkov,
	Neil Armstrong
  Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel, stable



On 7/7/2026 12:05 PM, Vishnu Reddy wrote:
> When validating a capture format, check_format() compares the requested
> pixel format against inst->fw_caps[BIT_DEPTH]. However, the bit depth
> capability is not available at this stage and it contains the default
> value of BIT_DEPTH_8. The actual bit depth is updated later after the
> firmware reports stream capabilities through read_input_subcr_params().
> Because of this, a valid QC10C format request is rejected during the

client request

> initial format negotiation. The driver then falls back to the default
> capture format (NV12) and stores it as capture format.
> 

No new line

> Later, when the firmware reports that the stream is 10-bit, the driver
> sees NV12 as the selected capture format and switches to the default
> 10-bit format (P010). As a result, the original QC10C format requested
> by userspace is lost and QC10C decoding cannot work correctly.
> 

No new line.

> The bit depth information is not reliable during the initial format
> setup, so it should not be used to validate capture formats. Remove
> the bit-depth checks from check_format() and only verify that the
> requested pixel format is supported. This allows the format requested
> by userspace is handled correctly.
> 
> Fixes: 20c3ef4c7cae ("media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
> ---
>   drivers/media/platform/qcom/iris/iris_vdec.c | 10 ----------
>   1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c
> index 9e228b70420e..7f89e745a4b1 100644
> --- a/drivers/media/platform/qcom/iris/iris_vdec.c
> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c
> @@ -95,16 +95,6 @@ static bool check_format(struct iris_inst *inst, u32 pixfmt, u32 type)
>   	if (i == size)
>   		return false;
>   
> -	if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
> -		if (iris_fmt_is_8bit(pixfmt) &&
> -		    inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_10)
> -			return false;
> -
> -		if (iris_fmt_is_10bit(pixfmt) &&
> -		    inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10)
> -			return false;
> -	}
> -
>   	return true;
>   }
>   
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] media: iris: disable time-delta-based rate control for VBR
  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
  2026-07-07 16:59     ` Vishnu Reddy
  0 siblings, 1 reply; 7+ messages in thread
From: Vikash Garodia @ 2026-07-07  9:09 UTC (permalink / raw)
  To: Vishnu Reddy, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab, Dmitry Baryshkov,
	Neil Armstrong
  Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel,
	Gourav Kumar


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] media: iris: disable time-delta-based rate control for VBR
  2026-07-07  9:09   ` Vikash Garodia
@ 2026-07-07 16:59     ` Vishnu Reddy
  0 siblings, 0 replies; 7+ messages in thread
From: Vishnu Reddy @ 2026-07-07 16:59 UTC (permalink / raw)
  To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab, Dmitry Baryshkov,
	Neil Armstrong
  Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel,
	Gourav Kumar


On 7/7/2026 2:39 PM, Vikash Garodia wrote:
>
> 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
>

Ack.

>> 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 ?
>

Currently, all HFI gen2 platforms are using this caps only and
this property is not applicable for HFI gen1.

Regards,
Vishnu Reddy.

>
>>           .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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] media: iris: avoid bit depth validation for capture formats
  2026-07-07  8:53   ` Vikash Garodia
@ 2026-07-07 17:00     ` Vishnu Reddy
  0 siblings, 0 replies; 7+ messages in thread
From: Vishnu Reddy @ 2026-07-07 17:00 UTC (permalink / raw)
  To: Vikash Garodia, Dikshita Agarwal, Abhinav Kumar,
	Bryan O'Donoghue, Mauro Carvalho Chehab, Dmitry Baryshkov,
	Neil Armstrong
  Cc: Bryan O'Donoghue, linux-media, linux-arm-msm, linux-kernel, stable


On 7/7/2026 2:23 PM, Vikash Garodia wrote:
>
>
> On 7/7/2026 12:05 PM, Vishnu Reddy wrote:
>> When validating a capture format, check_format() compares the requested
>> pixel format against inst->fw_caps[BIT_DEPTH]. However, the bit depth
>> capability is not available at this stage and it contains the default
>> value of BIT_DEPTH_8. The actual bit depth is updated later after the
>> firmware reports stream capabilities through read_input_subcr_params().
>> Because of this, a valid QC10C format request is rejected during the
>
> client request
>

Ack.

>> initial format negotiation. The driver then falls back to the default
>> capture format (NV12) and stores it as capture format.
>>
>
> No new line
>

Ack.

>> Later, when the firmware reports that the stream is 10-bit, the driver
>> sees NV12 as the selected capture format and switches to the default
>> 10-bit format (P010). As a result, the original QC10C format requested
>> by userspace is lost and QC10C decoding cannot work correctly.
>>
>
> No new line.
>

Ack.

>> The bit depth information is not reliable during the initial format
>> setup, so it should not be used to validate capture formats. Remove
>> the bit-depth checks from check_format() and only verify that the
>> requested pixel format is supported. This allows the format requested
>> by userspace is handled correctly.
>>
>> Fixes: 20c3ef4c7cae ("media: qcom: iris: vdec: update find_format to handle
>> 8bit and 10bit formats")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
>> ---
>>   drivers/media/platform/qcom/iris/iris_vdec.c | 10 ----------
>>   1 file changed, 10 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c
>> b/drivers/media/platform/qcom/iris/iris_vdec.c
>> index 9e228b70420e..7f89e745a4b1 100644
>> --- a/drivers/media/platform/qcom/iris/iris_vdec.c
>> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c
>> @@ -95,16 +95,6 @@ static bool check_format(struct iris_inst *inst, u32
>> pixfmt, u32 type)
>>       if (i == size)
>>           return false;
>>   -    if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
>> -        if (iris_fmt_is_8bit(pixfmt) &&
>> -            inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_10)
>> -            return false;
>> -
>> -        if (iris_fmt_is_10bit(pixfmt) &&
>> -            inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10)
>> -            return false;
>> -    }
>> -
>>       return true;
>>   }
>>  
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-07-07 17:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2026-07-07 16:59     ` Vishnu Reddy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox