Re: [PATCH v4 4/6] media: qcom: iris: Add hierarchical coding support for encoder

From: Wangao Wang

Date: Thu Feb 05 2026 - 21:42:29 EST




On 2026/1/29 19:37, Vikash Garodia wrote:
+
+    if (inst->codec == V4L2_PIX_FMT_HEVC)
+        max_bitrate = CABAC_MAX_BITRATE;
+
+    if (entropy_mode == V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC)
+        max_bitrate = CABAC_MAX_BITRATE;
+    else
+        max_bitrate = CAVLC_MAX_BITRATE;

check this logic, for hevc, its reassiging


This is a bug and will be fixed in v5.

+int iris_set_layer_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;
+    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 layer_enable = inst->fw_caps[LAYER_ENABLE].value;
+    u32 layer_count = inst->fw_caps[cap_id].value;
+    u32 hfi_id, ret;
+
+    if (!layer_enable || !layer_count)
+        return -EINVAL;
+
+    inst->hfi_layer_count = layer_count;

does it include base layer as well ? It does for gen2, so keep the uniformity.


This API is designed for Gen1. The description below is taken from the HFI definition.

The parameter ( N enh layers ) conveyed through this property specifies the number of enhancement layers to be encoded.
N: base layer + N enhancement layers

Layer ids: 0 for base layer, 1 for 1st enh layer and so on.

+    {
+        .cap_id = LAYER_TYPE_H264,
+        .min = V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B,
+        .max = V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P,
+        .step_or_mask = BIT(V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B) |
+                BIT(V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P),
+        .value = V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P,
+        .hfi_id = HFI_PROP_LAYER_ENCODING_TYPE,
+        .flags = CAP_FLAG_OUTPUT_PORT | CAP_FLAG_MENU,

no setter for h264 ?


will be added in v5.

+    {
+        .cap_id = LAYER5_BITRATE_HEVC,
+        .min = 1,
+        .max = BITRATE_MAX,
+        .step_or_mask = 1,
+        .value = BITRATE_DEFAULT,
+        .hfi_id = HFI_PROP_BITRATE_LAYER5,

HFI_PROP_BITRATE_LAYER6 ?


This is a bug and will be fixed in v5.

--
Best Regards,
Wangao