return USE_LTR;
case V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX:
return MARK_LTR;
+ case V4L2_CID_MPEG_VIDEO_B_FRAMES:
+ return B_FRAME;
default:
return INST_FW_CAP_MAX;
}
return V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES;
case MARK_LTR:
return V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX;
+ case B_FRAME:
+ return V4L2_CID_MPEG_VIDEO_B_FRAMES;
default:
return 0;
}
&hfi_val, sizeof(u32));
}
+int iris_set_intra_period(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 gop_size = inst->fw_caps[GOP_SIZE].value;
+ u32 b_frame = inst->fw_caps[B_FRAME].value;
+ u32 hfi_id = inst->fw_caps[cap_id].hfi_id;
+ struct hfi_intra_period intra_period;
+
+ if (!gop_size || b_frame >= gop_size)
+ return -EINVAL;
+
+ /*
+ * intra_period represents the length of a GOP, which includes both P-frames
+ * and B-frames. The counts of P-frames and B-frames within a GOP must be
+ * communicated to the firmware.
+ */
+ intra_period.pframes = (gop_size - 1) / (b_frame + 1);
+ intra_period.bframes = b_frame;
+
+ return hfi_ops->session_set_property(inst, hfi_id,
+ HFI_HOST_FLAGS_NONE,
+ iris_get_port_info(inst, cap_id),
+ HFI_PAYLOAD_STRUCTURE,
+ &intra_period, sizeof(intra_period));
+}
+
int iris_set_properties(struct iris_inst *inst, u32 plane)
{
const struct iris_hfi_session_ops *hfi_ops = inst->hfi_session_ops;
int iris_set_use_ltr(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
int iris_set_mark_ltr(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
int iris_set_use_and_mark_ltr(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
+int iris_set_intra_period(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id);
int iris_set_properties(struct iris_inst *inst, u32 plane);
#endif
.flags = CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
.set = iris_set_mark_ltr,
},
+ {
+ .cap_id = B_FRAME,
+ .min = 0,
+ .max = 3,
+ .step_or_mask = 1,
+ .value = 0,
+ .flags = CAP_FLAG_OUTPUT_PORT,
+ },
+ {
+ .cap_id = INTRA_PERIOD,
+ .min = 0,
+ .max = 1,
+ .step_or_mask = 1,
+ .value = 0,
+ .hfi_id = HFI_PROPERTY_CONFIG_VENC_INTRA_PERIOD,
+ .flags = CAP_FLAG_OUTPUT_PORT,
+ .set = iris_set_intra_period,
+ },
};
static const u32 sm8250_vdec_input_config_param_default[] = {
packet->shdr.hdr.size += sizeof(u32) + sizeof(*ltr_mark);
break;
}
+ case HFI_PROPERTY_CONFIG_VENC_INTRA_PERIOD: {
+ struct hfi_intra_period *in = pdata, *intra_period = prop_data;
+
+ intra_period->pframes = in->pframes;
+ intra_period->bframes = in->bframes;
+ packet->shdr.hdr.size += sizeof(u32) + sizeof(*intra_period);
+ break;
+ }
default:
return -EINVAL;
}
#define HFI_PROPERTY_PARAM_VENC_LTRMODE 0x200501c
#define HFI_PROPERTY_PARAM_VENC_MAX_NUM_B_FRAMES 0x2005020
#define HFI_PROPERTY_CONFIG_VENC_TARGET_BITRATE 0x2006001
+#define HFI_PROPERTY_CONFIG_VENC_INTRA_PERIOD 0x2006003
#define HFI_PROPERTY_CONFIG_VENC_MARKLTRFRAME 0x2006009
#define HFI_PROPERTY_CONFIG_VENC_USELTRFRAME 0x200600a
#define HFI_PROPERTY_CONFIG_VENC_SYNC_FRAME_SEQUENCE_HEADER 0x2006008
u32 mark_frame;
};
+struct hfi_max_num_b_frames {
+ u32 max_num_b_frames;
+};
+
+struct hfi_intra_period {
+ u32 pframes;
+ u32 bframes;
+};
+
struct hfi_event_data {
u32 error;
u32 height;
.flags = CAP_FLAG_INPUT_PORT | CAP_FLAG_DYNAMIC_ALLOWED,
.set = iris_set_use_and_mark_ltr,
},
+ {
+ .cap_id = B_FRAME,
+ .min = 0,
+ .max = 1,
+ .step_or_mask = 1,
+ .value = 0,
+ .hfi_id = HFI_PROP_MAX_B_FRAMES,
+ .flags = CAP_FLAG_OUTPUT_PORT,
+ .set = iris_set_u32,
+ },
};
static const u32 sm8550_vdec_input_config_params_default[] = {
LTR_COUNT,
USE_LTR,
MARK_LTR,
+ B_FRAME,
+ INTRA_PERIOD,
INST_FW_CAP_MAX,
};
static inline u32 hfi_buffer_get_recon_count(struct iris_inst *inst)
{
+ u32 bframe_count, ltr_count;
u32 num_ref = 1;
- u32 ltr_count;
+ bframe_count = inst->fw_caps[B_FRAME].value;
ltr_count = inst->fw_caps[LTR_COUNT].value;
+ if (bframe_count)
+ num_ref = 2;
+
if (ltr_count)
num_ref = num_ref + ltr_count;