Browse Source

video: driver: add default hdr and rap frame support

For decoder FW should not assume any default sequence header.
Decodering should start only after FW receives first sequence
header. Also, decoding starts only after discovery of random
access point frame. RAP frame means IDR for AVC, IDR/CRA/BLA
for HEVC, I frame for VP9 and MPEG2.

Change-Id: Ie12b8140f6b63e57c52a9c96cb1250f4958a42c6
Signed-off-by: Darshana Patil <[email protected]>
Darshana Patil 4 năm trước cách đây
mục cha
commit
d4a802bba5

+ 20 - 0
driver/platform/waipio/src/msm_vidc_waipio.c

@@ -998,6 +998,26 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
 	{BITSTREAM_SIZE_OVERWRITE, DEC, CODECS_ALL, 0, INT_MAX, 1, 0,
 		V4L2_CID_MPEG_VIDC_MIN_BITSTREAM_SIZE_OVERWRITE},
 
+	{THUMBNAIL_MODE, DEC, CODECS_ALL,
+		V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
+		1, V4L2_MPEG_MSM_VIDC_DISABLE,
+		0,
+		HFI_PROP_THUMBNAIL_MODE},
+
+	{DEFAULT_HEADER, DEC, CODECS_ALL,
+		V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
+		1, V4L2_MPEG_MSM_VIDC_DISABLE,
+		0,
+		HFI_PROP_DEC_DEFAULT_HEADER},
+
+	{RAP_FRAME, DEC, CODECS_ALL,
+		V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
+		1, V4L2_MPEG_MSM_VIDC_ENABLE,
+		0,
+		HFI_PROP_DEC_START_FROM_RAP_FRAME,
+		CAP_FLAG_INPUT_PORT,
+		{THUMBNAIL_MODE}},
+
 	{META_LTR_MARK_USE, ENC, CODECS_ALL,
 		V4L2_MPEG_MSM_VIDC_DISABLE, V4L2_MPEG_MSM_VIDC_ENABLE,
 		1, V4L2_MPEG_MSM_VIDC_DISABLE,

+ 3 - 0
driver/vidc/inc/msm_vidc_internal.h

@@ -345,6 +345,9 @@ enum msm_vidc_inst_capability_type {
 	BIT_DEPTH,
 	CODEC_CONFIG,
 	BITSTREAM_SIZE_OVERWRITE,
+	THUMBNAIL_MODE,
+	DEFAULT_HEADER,
+	RAP_FRAME,
 	META_LTR_MARK_USE,
 	META_DPB_MISR,
 	META_OPB_MISR,

+ 59 - 0
driver/vidc/src/msm_vdec.c

@@ -550,6 +550,56 @@ static int msm_vdec_set_secure_mode(struct msm_vidc_inst *inst,
 	return rc;
 }
 
+static int msm_vdec_set_default_header(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 default_header = false;
+
+	if (port != INPUT_PORT) {
+		i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
+		return -EINVAL;
+	}
+
+	default_header = inst->capabilities->cap[DEFAULT_HEADER].value;
+	i_vpr_h(inst, "%s: default header: %d", __func__, default_header);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_DEC_DEFAULT_HEADER,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_U32,
+			&default_header,
+			sizeof(u32));
+	if (rc)
+		i_vpr_e(inst, "%s: set property failed\n", __func__);
+	return rc;
+}
+
+static int msm_vdec_set_rap_frame(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 rap_frame = true;
+
+	if (port != INPUT_PORT) {
+		i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
+		return -EINVAL;
+	}
+
+	rap_frame = inst->capabilities->cap[RAP_FRAME].value;
+	i_vpr_h(inst, "%s: start from rap frame: %d", __func__, rap_frame);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_DEC_START_FROM_RAP_FRAME,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_U32,
+			&rap_frame,
+			sizeof(u32));
+	if (rc)
+		i_vpr_e(inst, "%s: set property failed\n", __func__);
+	return rc;
+}
+
 static int msm_vdec_set_thumbnail_mode(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
@@ -561,6 +611,7 @@ static int msm_vdec_set_thumbnail_mode(struct msm_vidc_inst *inst,
 		return -EINVAL;
 	}
 
+	thumbnail_mode = inst->capabilities->cap[THUMBNAIL_MODE].value;
 	i_vpr_h(inst, "%s: thumbnail mode: %d", __func__, thumbnail_mode);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_THUMBNAIL_MODE,
@@ -675,6 +726,14 @@ static int msm_vdec_set_input_properties(struct msm_vidc_inst *inst)
 	if (rc)
 		return rc;
 
+	rc = msm_vdec_set_default_header(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
+	rc = msm_vdec_set_rap_frame(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
 	rc = msm_vdec_set_realtime(inst, INPUT_PORT);
 	if (rc)
 		return rc;