瀏覽代碼

video: driver: add support to set colorspace for enc

- Set enc colorspace info to firmware via
  HFI_PROP_SIGNAL_COLOR_INFO property.
- Fix dec colorspace payload packaging.

Change-Id: Ib7ef2395a4f98f6497bbb200770a8612410eb8f5
Signed-off-by: Akshata Sahukar <[email protected]>
Akshata Sahukar 4 年之前
父節點
當前提交
3ad2fda959
共有 4 個文件被更改,包括 227 次插入29 次删除
  1. 7 0
      driver/platform/waipio/src/msm_vidc_waipio.c
  2. 1 0
      driver/vidc/inc/msm_vidc_internal.h
  3. 80 14
      driver/vidc/src/msm_vdec.c
  4. 139 15
      driver/vidc/src/msm_venc.c

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

@@ -374,6 +374,13 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
 		HFI_PROP_BLUR_RESOLUTION,
 		CAP_FLAG_ROOT | CAP_FLAG_OUTPUT_PORT},
 
+	{CSC, ENC, CODECS_ALL,
+		V4L2_MPEG_MSM_VIDC_DISABLE,
+		V4L2_MPEG_MSM_VIDC_ENABLE,
+		1, V4L2_MPEG_MSM_VIDC_DISABLE,
+		0,
+		HFI_PROP_CSC},
+
 	/* Needed for control initialization. TODO */
 	/* {CSC_CUSTOM_MATRIX, ENC, CODECS_ALL,
 		V4L2_MPEG_MSM_VIDC_DISABLE,

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

@@ -281,6 +281,7 @@ enum msm_vidc_inst_capability_type {
 	GOP_CLOSURE,
 	BLUR_TYPES,
 	BLUR_RESOLUTION,
+	CSC,
 	CSC_CUSTOM_MATRIX,
 	HEIC,
 	LOWLATENCY_MODE,

+ 80 - 14
driver/vidc/src/msm_vdec.c

@@ -312,26 +312,54 @@ static int msm_vdec_set_colorspace(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
-	u32 colorspace, xfer_func, ycbcr_enc, color_info;
+	u32 primaries, matrix_coeff, transfer_char;
+	u32 full_range = 0;
+	u32 colour_description_present_flag = 0;
+	u32 video_signal_type_present_flag = 0, color_info = 0;
+	/* Unspecified video format */
+	u32 video_format = 5;
 
 	if (port != INPUT_PORT && port != OUTPUT_PORT) {
 		i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
 		return -EINVAL;
 	}
 
-	colorspace = inst->fmts[OUTPUT_PORT].fmt.pix_mp.colorspace;
-	xfer_func = inst->fmts[OUTPUT_PORT].fmt.pix_mp.xfer_func;
-	ycbcr_enc = inst->fmts[OUTPUT_PORT].fmt.pix_mp.ycbcr_enc;
+	if (inst->codec != MSM_VIDC_H264 && inst->codec != MSM_VIDC_HEVC)
+		return 0;
+
+	primaries = inst->fmts[port].fmt.pix_mp.colorspace;
+	matrix_coeff = inst->fmts[port].fmt.pix_mp.ycbcr_enc;
+	transfer_char = inst->fmts[port].fmt.pix_mp.xfer_func;
+
+	if (primaries != V4L2_COLORSPACE_DEFAULT ||
+	    transfer_char != V4L2_XFER_FUNC_DEFAULT ||
+	    matrix_coeff != V4L2_YCBCR_ENC_DEFAULT) {
+		colour_description_present_flag = 1;
+		video_signal_type_present_flag = 1;
+	}
+
+	if (inst->fmts[port].fmt.pix_mp.quantization !=
+	    V4L2_QUANTIZATION_DEFAULT) {
+		video_signal_type_present_flag = 1;
+		full_range = inst->fmts[port].fmt.pix_mp.quantization ==
+			V4L2_QUANTIZATION_FULL_RANGE ? 1 : 0;
+	}
+
+	color_info = (matrix_coeff & 0xFF) |
+		((transfer_char << 8) & 0xFF00) |
+		((primaries << 16) & 0xFF0000) |
+		((colour_description_present_flag << 24) & 0x1000000) |
+		((full_range << 25) & 0x2000000) |
+		((video_format << 26) & 0x1C000000) |
+		((video_signal_type_present_flag << 29) & 0x20000000);
 
-	color_info = ((ycbcr_enc << 16) & 0xFF0000) |
-		((xfer_func << 8) & 0xFF00) | (colorspace & 0xFF);
 	inst->subcr_params[port].color_info = color_info;
-	i_vpr_h(inst, "%s: color info: %d", __func__, color_info);
+	i_vpr_h(inst, "%s: color info: %#x\n", __func__, color_info);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_SIGNAL_COLOR_INFO,
 			HFI_HOST_FLAGS_NONE,
 			get_hfi_port(inst, port),
-			HFI_PAYLOAD_U32,
+			HFI_PAYLOAD_32_PACKED,
 			&color_info,
 			sizeof(u32));
 	if (rc)
@@ -1197,6 +1225,10 @@ static int msm_vdec_update_properties(struct msm_vidc_inst *inst)
 	struct msm_vidc_subscription_params subsc_params;
 	struct msm_vidc_core *core;
 	u32 width, height;
+	u32 primaries, matrix_coeff, transfer_char;
+	u32 full_range = 0, video_format = 0;
+	u32 colour_description_present_flag = 0;
+	u32 video_signal_type_present_flag = 0;
 
 	if (!inst || !inst->core) {
 		d_vpr_e("%s: invalid params\n", __func__);
@@ -1227,12 +1259,42 @@ static int msm_vdec_update_properties(struct msm_vidc_inst *inst)
 		call_session_op(core, buffer_size, inst, MSM_VIDC_BUF_OUTPUT);
 	//inst->buffers.output.size = inst->fmts[OUTPUT_PORT].fmt.pix_mp.plane_fmt[0].sizeimage;
 
-	inst->fmts[OUTPUT_PORT].fmt.pix_mp.colorspace =
-		(subsc_params.color_info & 0xFF0000) >> 16;
-	inst->fmts[OUTPUT_PORT].fmt.pix_mp.xfer_func =
-		(subsc_params.color_info & 0xFF00) >> 8;
-	inst->fmts[OUTPUT_PORT].fmt.pix_mp.ycbcr_enc =
-		subsc_params.color_info & 0xFF;
+	matrix_coeff = subsc_params.color_info & 0xFF;
+	transfer_char = (subsc_params.color_info & 0xFF00) >> 8;
+	primaries = (subsc_params.color_info & 0xFF0000) >> 16;
+	colour_description_present_flag =
+		(subsc_params.color_info & 0x1000000) >> 24;
+	full_range = (subsc_params.color_info & 0x2000000) >> 25;
+	video_signal_type_present_flag =
+		(subsc_params.color_info & 0x20000000) >> 29;
+
+	inst->fmts[OUTPUT_PORT].fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT;
+	inst->fmts[OUTPUT_PORT].fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
+	inst->fmts[OUTPUT_PORT].fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
+	inst->fmts[OUTPUT_PORT].fmt.pix_mp.quantization = V4L2_QUANTIZATION_DEFAULT;
+
+	if (video_signal_type_present_flag) {
+		video_format = (subsc_params.color_info & 0x1C000000) >> 26;
+		inst->fmts[OUTPUT_PORT].fmt.pix_mp.quantization =
+			full_range ?
+			V4L2_QUANTIZATION_FULL_RANGE :
+			V4L2_QUANTIZATION_LIM_RANGE;
+		if (colour_description_present_flag) {
+			inst->fmts[OUTPUT_PORT].fmt.pix_mp.colorspace =
+				primaries;
+			inst->fmts[OUTPUT_PORT].fmt.pix_mp.xfer_func =
+				transfer_char;
+			inst->fmts[OUTPUT_PORT].fmt.pix_mp.ycbcr_enc =
+				matrix_coeff;
+		} else {
+			i_vpr_h(inst,
+				"%s: color description flag is not present\n",
+				__func__);
+		}
+	} else {
+		i_vpr_h(inst, "%s: video_signal type is not present\n",
+			__func__);
+	}
 
 	inst->buffers.output.min_count = subsc_params.fw_min_count;
 
@@ -2156,6 +2218,10 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
 	f->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width;
 	f->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
 		buffer_size, inst, MSM_VIDC_BUF_OUTPUT);
+	f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT;
+	f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
+	f->fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
+	f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_DEFAULT;
 	inst->buffers.output.min_count = call_session_op(core,
 		min_count, inst, MSM_VIDC_BUF_OUTPUT);
 	inst->buffers.output.extra_count = call_session_op(core,

+ 139 - 15
driver/vidc/src/msm_venc.c

@@ -22,12 +22,14 @@ u32 msm_venc_input_set_prop[] = {
 	HFI_PROP_RAW_RESOLUTION,
 	HFI_PROP_LINEAR_STRIDE_SCANLINE,
 	HFI_PROP_BUFFER_HOST_MAX_COUNT,
+	HFI_PROP_SIGNAL_COLOR_INFO,
 };
 
 u32 msm_venc_output_set_prop[] = {
 	HFI_PROP_BITSTREAM_RESOLUTION,
 	HFI_PROP_CROP_OFFSETS,
 	HFI_PROP_BUFFER_HOST_MAX_COUNT,
+	HFI_PROP_CSC,
 };
 
 u32 msm_venc_input_subscribe_for_properties[] = {
@@ -262,6 +264,104 @@ static int msm_venc_set_host_max_buf_count(struct msm_vidc_inst *inst,
 	return 0;
 }
 
+static int msm_venc_set_colorspace(struct msm_vidc_inst* inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 primaries, matrix_coeff, transfer_char;
+	u32 full_range = 0;
+	u32 colour_description_present_flag = 0;
+	u32 video_signal_type_present_flag = 0, payload = 0;
+	/* Unspecified video format */
+	u32 video_format = 5;
+
+	if (port != INPUT_PORT) {
+		i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
+		return -EINVAL;
+	}
+
+	primaries = inst->fmts[port].fmt.pix_mp.colorspace;
+	matrix_coeff = inst->fmts[port].fmt.pix_mp.ycbcr_enc;
+	transfer_char = inst->fmts[port].fmt.pix_mp.xfer_func;
+
+	if (primaries != V4L2_COLORSPACE_DEFAULT ||
+	    transfer_char != V4L2_XFER_FUNC_DEFAULT ||
+	    matrix_coeff != V4L2_YCBCR_ENC_DEFAULT) {
+		colour_description_present_flag = 1;
+		video_signal_type_present_flag = 1;
+	}
+
+	if (inst->fmts[port].fmt.pix_mp.quantization !=
+	    V4L2_QUANTIZATION_DEFAULT) {
+		video_signal_type_present_flag = 1;
+		full_range = inst->fmts[port].fmt.pix_mp.quantization ==
+			V4L2_QUANTIZATION_FULL_RANGE ? 1 : 0;
+	}
+
+	payload = (matrix_coeff & 0xFF) |
+		((transfer_char << 8) & 0xFF00) |
+		((primaries << 16) & 0xFF0000) |
+		((colour_description_present_flag << 24) & 0x1000000) |
+		((full_range << 25) & 0x2000000) |
+		((video_format << 26) & 0x1C000000) |
+		((video_signal_type_present_flag << 29) & 0x20000000);
+	i_vpr_h(inst, "%s: color info: %#x\n", __func__, payload);
+	rc = venus_hfi_session_property(inst,
+		HFI_PROP_SIGNAL_COLOR_INFO,
+		HFI_HOST_FLAGS_NONE,
+		get_hfi_port(inst, port),
+		HFI_PAYLOAD_32_PACKED,
+		&payload,
+		sizeof(u32));
+	if (rc)
+		return rc;
+	return 0;
+}
+
+static bool msm_venc_csc_required(struct msm_vidc_inst* inst)
+{
+	struct v4l2_format *in_fmt = &inst->fmts[INPUT_PORT];
+	struct v4l2_format *out_fmt = &inst->fmts[OUTPUT_PORT];
+
+	/* video hardware supports conversion to REC709 CSC only */
+	if (in_fmt->fmt.pix_mp.colorspace != out_fmt->fmt.pix_mp.colorspace &&
+	    out_fmt->fmt.pix_mp.colorspace == V4L2_COLORSPACE_REC709)
+		return true;
+
+	return false;
+}
+
+static int msm_venc_set_csc(struct msm_vidc_inst* inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 csc = 0;
+
+	if (port != OUTPUT_PORT) {
+		i_vpr_e(inst, "%s: invalid port %d\n", __func__, port);
+		return -EINVAL;
+	}
+
+	if (msm_venc_csc_required(inst))
+		inst->capabilities->cap[CSC].value = 1;
+	else
+		inst->capabilities->cap[CSC].value = 0;
+
+	csc = inst->capabilities->cap[CSC].value;
+	i_vpr_h(inst, "%s: csc: %u\n", __func__, csc);
+	rc = venus_hfi_session_property(inst,
+		HFI_PROP_CSC,
+		HFI_HOST_FLAGS_NONE,
+		get_hfi_port(inst, port),
+		HFI_PAYLOAD_U32,
+		&csc,
+		sizeof(u32));
+	if (rc)
+		return rc;
+
+	return 0;
+}
+
 static int msm_venc_set_stage(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
@@ -351,11 +451,11 @@ static int msm_venc_set_input_properties(struct msm_vidc_inst *inst)
 	int rc = 0;
 	int i = 0;
 
-	d_vpr_h("%s()\n", __func__);
 	if (!inst) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
+	i_vpr_h(inst, "%s()\n", __func__);
 
 	for (i = 0; i < ARRAY_SIZE(msm_venc_input_set_prop);
 	     i++) {
@@ -372,6 +472,9 @@ static int msm_venc_set_input_properties(struct msm_vidc_inst *inst)
 		case HFI_PROP_BUFFER_HOST_MAX_COUNT:
 			rc = msm_venc_set_host_max_buf_count(inst, INPUT_PORT);
 			break;
+		case HFI_PROP_SIGNAL_COLOR_INFO:
+			rc = msm_venc_set_colorspace(inst, INPUT_PORT);
+			break;
 		default:
 			d_vpr_e("%s: unknown property %#x\n", __func__,
 				msm_venc_input_set_prop[i]);
@@ -392,11 +495,11 @@ static int msm_venc_set_output_properties(struct msm_vidc_inst *inst)
 	int rc = 0;
 	int i = 0;
 
-	d_vpr_h("%s()\n", __func__);
 	if (!inst) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
+	i_vpr_h(inst, "%s()\n", __func__);
 
 	for (i = 0; i < ARRAY_SIZE(msm_venc_output_set_prop);
 	     i++) {
@@ -410,6 +513,9 @@ static int msm_venc_set_output_properties(struct msm_vidc_inst *inst)
 		case HFI_PROP_BUFFER_HOST_MAX_COUNT:
 			rc = msm_venc_set_host_max_buf_count(inst, OUTPUT_PORT);
 			break;
+		case HFI_PROP_CSC:
+			rc = msm_venc_set_csc(inst, OUTPUT_PORT);
+			break;
 		default:
 			d_vpr_e("%s: unknown property %#x\n", __func__,
 				msm_venc_output_set_prop[i]);
@@ -429,11 +535,11 @@ static int msm_venc_set_internal_properties(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	d_vpr_h("%s()\n", __func__);
 	if (!inst) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
+	i_vpr_h(inst, "%s()\n", __func__);
 
 	//TODO: set HFI_PORT_NONE properties at master port streamon.
 	rc = msm_venc_set_stage(inst);
@@ -481,7 +587,6 @@ static int msm_venc_create_input_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 /* TODO: VPSS
-	d_vpr_h("%s()\n", __func__);
 	if (!inst || !inst->core) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
@@ -499,7 +604,6 @@ static int msm_venc_queue_input_internal_buffers(struct msm_vidc_inst *inst)
 	int rc = 0;
 
 /* TODO: VPSS
-	d_vpr_h("%s()\n", __func__);
 	if (!inst || !inst->core) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
@@ -567,7 +671,6 @@ static int msm_venc_create_output_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	d_vpr_h("%s()\n", __func__);
 	if (!inst || !inst->core) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
@@ -596,7 +699,6 @@ static int msm_venc_queue_output_internal_buffers(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	d_vpr_h("%s()\n", __func__);
 	if (!inst || !inst->core) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
@@ -635,7 +737,7 @@ static int msm_venc_property_subscription(struct msm_vidc_inst *inst,
 		return -EINVAL;
 	}
 	core = inst->core;
-	d_vpr_h("%s()\n", __func__);
+	i_vpr_h(inst, "%s()\n", __func__);
 
 	payload[0] = HFI_MODE_PROPERTY;
 	if (port == INPUT_PORT) {
@@ -685,7 +787,7 @@ static int msm_venc_metadata_delivery(struct msm_vidc_inst *inst,
 		return -EINVAL;
 	}
 	core = inst->core;
-	d_vpr_h("%s()\n", __func__);
+	i_vpr_h(inst, "%s()\n", __func__);
 
 	capability = inst->capabilities;
 	payload[0] = HFI_MODE_METADATA;
@@ -697,6 +799,7 @@ static int msm_venc_metadata_delivery(struct msm_vidc_inst *inst,
 		}
 	};
 
+	// TODO: remove below check later
 	if (!count)
 		return 0;
 
@@ -732,7 +835,7 @@ static int msm_venc_metadata_subscription(struct msm_vidc_inst *inst,
 		return -EINVAL;
 	}
 	core = inst->core;
-	d_vpr_h("%s()\n", __func__);
+	i_vpr_h(inst, "%s()\n", __func__);
 
 	capability = inst->capabilities;
 	payload[0] = HFI_MODE_METADATA;
@@ -744,6 +847,7 @@ static int msm_venc_metadata_subscription(struct msm_vidc_inst *inst,
 		}
 	};
 
+	// TODO: remove below check later
 	if (!count)
 		return 0;
 
@@ -761,7 +865,7 @@ int msm_venc_streamoff_input(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
+	if (!inst || !inst->core || !inst->capabilities) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -777,7 +881,7 @@ int msm_venc_streamon_input(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
+	if (!inst || !inst->core || !inst->capabilities) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -903,7 +1007,7 @@ int msm_venc_streamoff_output(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
+	if (!inst || !inst->core || !inst->capabilities) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -919,7 +1023,7 @@ int msm_venc_streamon_output(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
-	if (!inst || !inst->core) {
+	if (!inst || !inst->core || !inst->capabilities) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -987,7 +1091,7 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
 	struct msm_vidc_core *core;
 	u32 codec_align;
 
-	if (!inst || !inst->core) {
+	if (!inst || !inst->core || !inst->capabilities) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
@@ -1008,6 +1112,10 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
 		fmt->fmt.pix_mp.width;
 	fmt->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
 		buffer_size, inst, MSM_VIDC_BUF_INPUT);
+	fmt->fmt.pix_mp.colorspace = f->fmt.pix_mp.colorspace;
+	fmt->fmt.pix_mp.xfer_func = f->fmt.pix_mp.xfer_func;
+	fmt->fmt.pix_mp.ycbcr_enc = f->fmt.pix_mp.ycbcr_enc;
+	fmt->fmt.pix_mp.quantization = f->fmt.pix_mp.quantization;
 	inst->buffers.input.min_count = call_session_op(core,
 		min_count, inst, MSM_VIDC_BUF_INPUT);
 	inst->buffers.input.extra_count = call_session_op(core,
@@ -1147,6 +1255,14 @@ static int msm_venc_s_fmt_output(struct msm_vidc_inst *inst, struct v4l2_format
 	fmt->fmt.pix_mp.plane_fmt[0].bytesperline = 0;
 	fmt->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
 		buffer_size, inst, MSM_VIDC_BUF_OUTPUT);
+	/* video hw supports conversion to V4L2_COLORSPACE_REC709 only */
+	if (f->fmt.pix_mp.colorspace != V4L2_COLORSPACE_DEFAULT &&
+	    f->fmt.pix_mp.colorspace != V4L2_COLORSPACE_REC709)
+		f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT;
+	fmt->fmt.pix_mp.colorspace = f->fmt.pix_mp.colorspace;
+	fmt->fmt.pix_mp.xfer_func = f->fmt.pix_mp.xfer_func;
+	fmt->fmt.pix_mp.ycbcr_enc = f->fmt.pix_mp.ycbcr_enc;
+	fmt->fmt.pix_mp.quantization = f->fmt.pix_mp.quantization;
 	inst->buffers.output.min_count = call_session_op(core,
 		min_count, inst, MSM_VIDC_BUF_OUTPUT);
 	inst->buffers.output.extra_count = call_session_op(core,
@@ -1630,6 +1746,10 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
 	f->fmt.pix_mp.plane_fmt[0].bytesperline = 0;
 	f->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
 		buffer_size, inst, MSM_VIDC_BUF_OUTPUT);
+	f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT;
+	f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
+	f->fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
+	f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_DEFAULT;
 	inst->buffers.output.min_count = call_session_op(core,
 		min_count, inst, MSM_VIDC_BUF_OUTPUT);
 	inst->buffers.output.extra_count = call_session_op(core,
@@ -1665,6 +1785,10 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
 	f->fmt.pix_mp.plane_fmt[0].bytesperline = f->fmt.pix_mp.width;
 	f->fmt.pix_mp.plane_fmt[0].sizeimage = call_session_op(core,
 		buffer_size, inst, MSM_VIDC_BUF_INPUT);
+	f->fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT;
+	f->fmt.pix_mp.xfer_func = V4L2_XFER_FUNC_DEFAULT;
+	f->fmt.pix_mp.ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
+	f->fmt.pix_mp.quantization = V4L2_QUANTIZATION_DEFAULT;
 	inst->buffers.input.min_count = call_session_op(core,
 		min_count, inst, MSM_VIDC_BUF_INPUT);
 	inst->buffers.input.extra_count = call_session_op(core,