Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d815666f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Keep video formats instance specific"

parents 308f9549 8450caad
Loading
Loading
Loading
Loading
+32 −27
Original line number Diff line number Diff line
@@ -677,7 +677,7 @@ static int is_ctrl_valid_for_codec(struct msm_vidc_inst *inst,
	int rc = 0;
	switch (ctrl->id) {
	case V4L2_CID_MPEG_VIDC_VIDEO_MVC_BUFFER_LAYOUT:
		if (inst->fmts[OUTPUT_PORT]->fourcc != V4L2_PIX_FMT_H264_MVC) {
		if (inst->fmts[OUTPUT_PORT].fourcc != V4L2_PIX_FMT_H264_MVC) {
			dprintk(VIDC_ERR, "Control %#x only valid for MVC\n",
					ctrl->id);
			rc = -ENOTSUPP;
@@ -685,7 +685,7 @@ static int is_ctrl_valid_for_codec(struct msm_vidc_inst *inst,
		}
		break;
	case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
		if (inst->fmts[OUTPUT_PORT]->fourcc == V4L2_PIX_FMT_H264_MVC &&
		if (inst->fmts[OUTPUT_PORT].fourcc == V4L2_PIX_FMT_H264_MVC &&
			ctrl->val != V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH) {
			dprintk(VIDC_ERR,
					"Profile %#x not supported for MVC\n",
@@ -695,7 +695,7 @@ static int is_ctrl_valid_for_codec(struct msm_vidc_inst *inst,
		}
		break;
	case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
		if (inst->fmts[OUTPUT_PORT]->fourcc == V4L2_PIX_FMT_H264_MVC &&
		if (inst->fmts[OUTPUT_PORT].fourcc == V4L2_PIX_FMT_H264_MVC &&
			ctrl->val >= V4L2_MPEG_VIDEO_H264_LEVEL_5_2) {
			dprintk(VIDC_ERR, "Level %#x not supported for MVC\n",
					ctrl->val);
@@ -906,10 +906,10 @@ int msm_vdec_prepare_buf(struct msm_vidc_inst *inst,
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
		break;
	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
		if (b->length != inst->fmts[CAPTURE_PORT]->num_planes) {
		if (b->length != inst->fmts[CAPTURE_PORT].num_planes) {
			dprintk(VIDC_ERR,
			"Planes mismatch: needed: %d, allocated: %d\n",
			inst->fmts[CAPTURE_PORT]->num_planes,
			inst->fmts[CAPTURE_PORT].num_planes,
			b->length);
			rc = -EINVAL;
			break;
@@ -985,10 +985,10 @@ int msm_vdec_release_buf(struct msm_vidc_inst *inst,
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
		break;
	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
		if (b->length != inst->fmts[CAPTURE_PORT]->num_planes) {
		if (b->length != inst->fmts[CAPTURE_PORT].num_planes) {
			dprintk(VIDC_ERR,
			"Planes mismatch: needed: %d, to release: %d\n",
			inst->fmts[CAPTURE_PORT]->num_planes, b->length);
			inst->fmts[CAPTURE_PORT].num_planes, b->length);
			rc = -EINVAL;
			break;
		}
@@ -1109,9 +1109,9 @@ int msm_vdec_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)

	hdev = inst->core->device;
	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
		fmt = inst->fmts[CAPTURE_PORT];
		fmt = &inst->fmts[CAPTURE_PORT];
	else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
		fmt = inst->fmts[OUTPUT_PORT];
		fmt = &inst->fmts[OUTPUT_PORT];
	else
		return -ENOTSUPP;

@@ -1259,11 +1259,12 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			rc = -EINVAL;
			goto err_invalid_fmt;
		}
		memcpy(&inst->fmts[fmt->type], fmt,
						sizeof(struct msm_vidc_format));

		inst->prop.width[CAPTURE_PORT] = f->fmt.pix_mp.width;
		inst->prop.height[CAPTURE_PORT] = f->fmt.pix_mp.height;

		inst->fmts[fmt->type] = fmt;
		if (msm_comm_get_stream_output_mode(inst) ==
			HAL_VIDEO_DECODER_SECONDARY) {
			frame_sz.buffer_type = HAL_BUFFER_OUTPUT2;
@@ -1283,10 +1284,10 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
		}

		f->fmt.pix_mp.plane_fmt[0].sizeimage =
			get_output_frame_size(inst, fmt,
			get_output_frame_size(inst, &inst->fmts[fmt->type],
			f->fmt.pix_mp.height, f->fmt.pix_mp.width, 0);

		extra_idx = EXTRADATA_IDX(fmt->num_planes);
		extra_idx = EXTRADATA_IDX(inst->fmts[fmt->type].num_planes);
		if (extra_idx && extra_idx < VIDEO_MAX_PLANES) {
			f->fmt.pix_mp.plane_fmt[extra_idx].sizeimage =
				VENUS_EXTRADATA_SIZE(
@@ -1294,8 +1295,8 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
					inst->prop.width[CAPTURE_PORT]);
		}

		f->fmt.pix_mp.num_planes = fmt->num_planes;
		for (i = 0; i < fmt->num_planes; ++i) {
		f->fmt.pix_mp.num_planes = inst->fmts[fmt->type].num_planes;
		for (i = 0; i < inst->fmts[fmt->type].num_planes; ++i) {
			inst->bufq[CAPTURE_PORT].vb2_bufq.plane_sizes[i] =
				f->fmt.pix_mp.plane_fmt[i].sizeimage;
		}
@@ -1314,6 +1315,8 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			rc = -EINVAL;
			goto err_invalid_fmt;
		}
		memcpy(&inst->fmts[fmt->type], fmt,
						sizeof(struct msm_vidc_format));

		rc = msm_comm_try_state(inst, MSM_VIDC_CORE_INIT_DONE);
		if (rc) {
@@ -1321,17 +1324,16 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			goto err_invalid_fmt;
		}

		if (!(get_hal_codec(fmt->fourcc) &
		if (!(get_hal_codec(inst->fmts[fmt->type].fourcc) &
			inst->core->dec_codec_supported)) {
			dprintk(VIDC_ERR,
				"Codec(%#x) is not present in the supported codecs list(%#x)\n",
				get_hal_codec(fmt->fourcc),
				get_hal_codec(inst->fmts[fmt->type].fourcc),
				inst->core->dec_codec_supported);
			rc = -EINVAL;
			goto err_invalid_fmt;
		}

		inst->fmts[fmt->type] = fmt;
		rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE);
		if (rc) {
			dprintk(VIDC_ERR, "Failed to open instance\n");
@@ -1354,14 +1356,15 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			frame_sz.height);
		msm_comm_try_set_prop(inst, HAL_PARAM_FRAME_SIZE, &frame_sz);

		max_input_size = get_frame_size(inst, fmt, f->type, 0);
		max_input_size = get_frame_size(inst,
					&inst->fmts[fmt->type], f->type, 0);
		if (f->fmt.pix_mp.plane_fmt[0].sizeimage > max_input_size ||
			!f->fmt.pix_mp.plane_fmt[0].sizeimage) {
			f->fmt.pix_mp.plane_fmt[0].sizeimage = max_input_size;
		}

		f->fmt.pix_mp.num_planes = fmt->num_planes;
		for (i = 0; i < fmt->num_planes; ++i) {
		f->fmt.pix_mp.num_planes = inst->fmts[fmt->type].num_planes;
		for (i = 0; i < inst->fmts[fmt->type].num_planes; ++i) {
			inst->bufq[OUTPUT_PORT].vb2_bufq.plane_sizes[i] =
				f->fmt.pix_mp.plane_fmt[i].sizeimage;
		}
@@ -1476,20 +1479,20 @@ static int msm_vdec_queue_setup(struct vb2_queue *q,

	switch (q->type) {
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
		*num_planes = inst->fmts[OUTPUT_PORT]->num_planes;
		*num_planes = inst->fmts[OUTPUT_PORT].num_planes;
		if (*num_buffers < MIN_NUM_OUTPUT_BUFFERS ||
				*num_buffers > MAX_NUM_OUTPUT_BUFFERS)
			*num_buffers = MIN_NUM_OUTPUT_BUFFERS;
		for (i = 0; i < *num_planes; i++) {
			sizes[i] = get_frame_size(inst,
					inst->fmts[OUTPUT_PORT], q->type, i);
					&inst->fmts[OUTPUT_PORT], q->type, i);
		}
		rc = set_actual_buffer_count(inst, *num_buffers,
			HAL_BUFFER_INPUT);
		break;
	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
		dprintk(VIDC_DBG, "Getting bufreqs on capture plane\n");
		*num_planes = inst->fmts[CAPTURE_PORT]->num_planes;
		*num_planes = inst->fmts[CAPTURE_PORT].num_planes;
		rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE);
		if (rc) {
			dprintk(VIDC_ERR, "Failed to open instance\n");
@@ -1574,7 +1577,7 @@ static int msm_vdec_queue_setup(struct vb2_queue *q,
		}

		extra_idx =
			EXTRADATA_IDX(inst->fmts[CAPTURE_PORT]->num_planes);
			EXTRADATA_IDX(inst->fmts[CAPTURE_PORT].num_planes);
		if (extra_idx && extra_idx < VIDEO_MAX_PLANES) {
			sizes[extra_idx] =
				VENUS_EXTRADATA_SIZE(
@@ -1675,7 +1678,7 @@ static inline int start_streaming(struct msm_vidc_inst *inst)
	unsigned int buffer_size;
	struct msm_vidc_format *fmt = NULL;

	fmt = inst->fmts[CAPTURE_PORT];
	fmt = &inst->fmts[CAPTURE_PORT];
	buffer_size = get_output_frame_size(inst, fmt,
		inst->prop.height[CAPTURE_PORT],
		inst->prop.width[CAPTURE_PORT], 0);
@@ -1897,8 +1900,6 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
		dprintk(VIDC_ERR, "Invalid input = %pK\n", inst);
		return -EINVAL;
	}
	inst->fmts[OUTPUT_PORT] = &vdec_formats[2];
	inst->fmts[CAPTURE_PORT] = &vdec_formats[0];
	inst->prop.height[CAPTURE_PORT] = DEFAULT_HEIGHT;
	inst->prop.width[CAPTURE_PORT] = DEFAULT_WIDTH;
	inst->prop.height[OUTPUT_PORT] = DEFAULT_HEIGHT;
@@ -1914,6 +1915,10 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
	inst->buffer_mode_set[OUTPUT_PORT] = HAL_BUFFER_MODE_STATIC;
	inst->buffer_mode_set[CAPTURE_PORT] = HAL_BUFFER_MODE_STATIC;
	inst->prop.fps = DEFAULT_FPS;
	memcpy(&inst->fmts[OUTPUT_PORT], &vdec_formats[2],
						sizeof(struct msm_vidc_format));
	memcpy(&inst->fmts[CAPTURE_PORT], &vdec_formats[0],
						sizeof(struct msm_vidc_format));
	return rc;
}

+33 −30
Original line number Diff line number Diff line
@@ -1523,7 +1523,7 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
		default:
			break;
		}
		inst->fmts[CAPTURE_PORT]->num_planes = *num_planes;
		inst->fmts[CAPTURE_PORT].num_planes = *num_planes;

		for (i = 0; i < *num_planes; i++) {
			int extra_idx = EXTRADATA_IDX(*num_planes);
@@ -1598,7 +1598,8 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
				break;
			}

		inst->fmts[OUTPUT_PORT]->num_planes = *num_planes;
		inst->fmts[OUTPUT_PORT].num_planes = *num_planes;

		rc = call_hfi_op(hdev, session_set_property, inst->session,
					property_id, &new_buf_count);
		if (rc)
@@ -1608,12 +1609,12 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
				inst->buff_req.buffer[0].buffer_size,
				inst->buff_req.buffer[0].buffer_alignment,
				inst->buff_req.buffer[0].buffer_count_actual);
		sizes[0] = inst->fmts[OUTPUT_PORT]->get_frame_size(
		sizes[0] = inst->fmts[OUTPUT_PORT].get_frame_size(
				0, inst->prop.height[OUTPUT_PORT],
				inst->prop.width[OUTPUT_PORT]);

		extra_idx =
			EXTRADATA_IDX(inst->fmts[OUTPUT_PORT]->num_planes);
			EXTRADATA_IDX(inst->fmts[OUTPUT_PORT].num_planes);
		if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) {
			buff_req_buffer = get_buff_req_buffer(inst,
				HAL_BUFFER_EXTRADATA_INPUT);
@@ -1648,7 +1649,7 @@ static int msm_venc_toggle_hier_p(struct msm_vidc_inst *inst, int layers)
		return -EINVAL;
	}

	if (inst->fmts[CAPTURE_PORT]->fourcc != V4L2_PIX_FMT_VP8)
	if (inst->fmts[CAPTURE_PORT].fourcc != V4L2_PIX_FMT_VP8)
		return 0;

	num_enh_layers = layers ? : 0;
@@ -2165,7 +2166,7 @@ static int msm_venc_validate_qp_value(struct msm_vidc_inst *inst,
	__rc; \
})

	switch (inst->fmts[CAPTURE_PORT]->fourcc) {
	switch (inst->fmts[CAPTURE_PORT].fourcc) {
	case V4L2_PIX_FMT_VP8:
		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_VP8_MAX_QP);
		max = temp_ctrl->maximum;
@@ -2246,10 +2247,10 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)

	switch (ctrl->id) {
	case V4L2_CID_MPEG_VIDC_VIDEO_IDR_PERIOD:
		if (inst->fmts[CAPTURE_PORT]->fourcc != V4L2_PIX_FMT_H264 &&
			inst->fmts[CAPTURE_PORT]->fourcc !=
		if (inst->fmts[CAPTURE_PORT].fourcc != V4L2_PIX_FMT_H264 &&
			inst->fmts[CAPTURE_PORT].fourcc !=
				V4L2_PIX_FMT_H264_NO_SC &&
			inst->fmts[CAPTURE_PORT]->fourcc !=
			inst->fmts[CAPTURE_PORT].fourcc !=
				V4L2_PIX_FMT_HEVC) {
			dprintk(VIDC_ERR,
				"Control %#x only valid for H264 and HEVC\n",
@@ -2747,8 +2748,8 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		break;
	case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_DELIVERY_MODE: {
		bool codec_avc =
			inst->fmts[CAPTURE_PORT]->fourcc == V4L2_PIX_FMT_H264 ||
			inst->fmts[CAPTURE_PORT]->fourcc ==
			inst->fmts[CAPTURE_PORT].fourcc == V4L2_PIX_FMT_H264 ||
			inst->fmts[CAPTURE_PORT].fourcc ==
							V4L2_PIX_FMT_H264_NO_SC;

		temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE);
@@ -2774,8 +2775,8 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		cir_mbs = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_CIR_MBS);

		is_cont_intra_supported =
		(inst->fmts[CAPTURE_PORT]->fourcc == V4L2_PIX_FMT_H264) ||
		(inst->fmts[CAPTURE_PORT]->fourcc == V4L2_PIX_FMT_HEVC);
		(inst->fmts[CAPTURE_PORT].fourcc == V4L2_PIX_FMT_H264) ||
		(inst->fmts[CAPTURE_PORT].fourcc == V4L2_PIX_FMT_HEVC);

		if (is_cont_intra_supported) {
			if (ctrl->val != HAL_INTRA_REFRESH_NONE)
@@ -3144,7 +3145,7 @@ static int try_set_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
			ctrl->val == V4L2_MPEG_VIDC_VIDEO_PERF_POWER_SAVE);
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_HIER_B_NUM_LAYERS:
		if (inst->fmts[CAPTURE_PORT]->fourcc != V4L2_PIX_FMT_HEVC) {
		if (inst->fmts[CAPTURE_PORT].fourcc != V4L2_PIX_FMT_HEVC) {
			dprintk(VIDC_ERR, "Hier B supported for HEVC only\n");
			rc = -ENOTSUPP;
			break;
@@ -3576,8 +3577,6 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
		dprintk(VIDC_ERR, "Invalid input = %pK\n", inst);
		return -EINVAL;
	}
	inst->fmts[CAPTURE_PORT] = &venc_formats[4];
	inst->fmts[OUTPUT_PORT] = &venc_formats[0];
	inst->prop.height[CAPTURE_PORT] = DEFAULT_HEIGHT;
	inst->prop.width[CAPTURE_PORT] = DEFAULT_WIDTH;
	inst->prop.height[OUTPUT_PORT] = DEFAULT_HEIGHT;
@@ -3594,6 +3593,10 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
	inst->buffer_mode_set[CAPTURE_PORT] = HAL_BUFFER_MODE_STATIC;
	inst->prop.fps = DEFAULT_FPS;
	inst->capability.pixelprocess_capabilities = 0;
	memcpy(&inst->fmts[CAPTURE_PORT], &venc_formats[4],
						sizeof(struct msm_vidc_format));
	memcpy(&inst->fmts[OUTPUT_PORT], &venc_formats[0],
						sizeof(struct msm_vidc_format));
	return rc;
}

@@ -3715,8 +3718,8 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			rc = -EINVAL;
			goto exit;
		}

		inst->fmts[fmt->type] = fmt;
		memcpy(&inst->fmts[fmt->type], fmt,
						sizeof(struct msm_vidc_format));

		rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE);
		if (rc) {
@@ -3768,7 +3771,8 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			rc = -EINVAL;
			goto exit;
		}
		inst->fmts[fmt->type] = fmt;
		memcpy(&inst->fmts[fmt->type], fmt,
						sizeof(struct msm_vidc_format));

		msm_comm_set_color_format(inst, HAL_BUFFER_INPUT, fmt->fourcc);
	} else {
@@ -3778,7 +3782,7 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
		goto exit;
	}

	f->fmt.pix_mp.num_planes = fmt->num_planes;
	f->fmt.pix_mp.num_planes = inst->fmts[fmt->type].num_planes;

	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
		struct hal_frame_size frame_sz = {0};
@@ -3809,12 +3813,12 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
		struct hal_buffer_requirements *bufreq = NULL;
		int extra_idx = 0;

		for (i = 0; i < fmt->num_planes; ++i) {
		for (i = 0; i < inst->fmts[fmt->type].num_planes; ++i) {
			f->fmt.pix_mp.plane_fmt[i].sizeimage =
				fmt->get_frame_size(i,
				inst->fmts[fmt->type].get_frame_size(i,
				f->fmt.pix_mp.height, f->fmt.pix_mp.width);
		}
		extra_idx = EXTRADATA_IDX(fmt->num_planes);
		extra_idx = EXTRADATA_IDX(inst->fmts[fmt->type].num_planes);
		if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) {
			bufreq = get_buff_req_buffer(inst,
					HAL_BUFFER_EXTRADATA_INPUT);
@@ -3849,11 +3853,11 @@ int msm_venc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
	}

	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
		fmt = inst->fmts[CAPTURE_PORT];
		fmt = &inst->fmts[CAPTURE_PORT];
		height = inst->prop.height[CAPTURE_PORT];
		width = inst->prop.width[CAPTURE_PORT];
	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
		fmt = inst->fmts[OUTPUT_PORT];
		fmt = &inst->fmts[OUTPUT_PORT];
		height = inst->prop.height[OUTPUT_PORT];
		width = inst->prop.width[OUTPUT_PORT];
	} else {
@@ -3900,7 +3904,6 @@ int msm_venc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
				f->fmt.pix_mp.plane_fmt[i].sizeimage;
		}
	}

	return rc;
}

@@ -3956,10 +3959,10 @@ int msm_venc_prepare_buf(struct msm_vidc_inst *inst,
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
		break;
	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
		if (b->length != inst->fmts[CAPTURE_PORT]->num_planes) {
		if (b->length != inst->fmts[CAPTURE_PORT].num_planes) {
			dprintk(VIDC_ERR,
				"Planes mismatch: needed: %d, allocated: %d\n",
				inst->fmts[CAPTURE_PORT]->num_planes,
				inst->fmts[CAPTURE_PORT].num_planes,
				b->length);
			rc = -EINVAL;
			break;
@@ -4027,10 +4030,10 @@ int msm_venc_release_buf(struct msm_vidc_inst *inst,
		break;
	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: {
		if (b->length !=
			inst->fmts[CAPTURE_PORT]->num_planes) {
			inst->fmts[CAPTURE_PORT].num_planes) {
			dprintk(VIDC_ERR,
					"Planes mismatch: needed: %d, to release: %d\n",
					inst->fmts[CAPTURE_PORT]->num_planes,
					inst->fmts[CAPTURE_PORT].num_planes,
					b->length);
			rc = -EINVAL;
			break;
+2 −2
Original line number Diff line number Diff line
@@ -688,7 +688,7 @@ static bool valid_v4l2_buffer(struct v4l2_buffer *b,
								MAX_PORT_NUM;

	return port != MAX_PORT_NUM &&
		inst->fmts[port]->num_planes == b->length;
		inst->fmts[port].num_planes == b->length;
}

int msm_vidc_prepare_buf(void *instance, struct v4l2_buffer *b)
@@ -863,7 +863,7 @@ int msm_vidc_qbuf(void *instance, struct v4l2_buffer *b)
		dprintk(VIDC_DBG, "Queueing device address = %pa\n",
				&binfo->device_addr[i]);

		if (inst->fmts[OUTPUT_PORT]->fourcc ==
		if (inst->fmts[OUTPUT_PORT].fourcc ==
			V4L2_PIX_FMT_HEVC_HYBRID && binfo->handle[i] &&
			b->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
			rc = msm_comm_smem_cache_operations(inst,
+13 −13
Original line number Diff line number Diff line
@@ -525,12 +525,12 @@ static int msm_comm_vote_bus(struct msm_vidc_core *core)
		struct v4l2_control ctrl;

		codec = inst->session_type == MSM_VIDC_DECODER ?
			inst->fmts[OUTPUT_PORT]->fourcc :
			inst->fmts[CAPTURE_PORT]->fourcc;
			inst->fmts[OUTPUT_PORT].fourcc :
			inst->fmts[CAPTURE_PORT].fourcc;

		yuv = inst->session_type == MSM_VIDC_DECODER ?
			inst->fmts[CAPTURE_PORT]->fourcc :
			inst->fmts[OUTPUT_PORT]->fourcc;
			inst->fmts[CAPTURE_PORT].fourcc :
			inst->fmts[OUTPUT_PORT].fourcc;

		vote_data[i].domain = get_hal_domain(inst->session_type);
		vote_data[i].codec = get_hal_codec(codec);
@@ -1002,8 +1002,8 @@ static void handle_session_init_done(enum hal_command_response cmd, void *data)
	core = inst->core;
	hdev = inst->core->device;
	codec = inst->session_type == MSM_VIDC_DECODER ?
			inst->fmts[OUTPUT_PORT]->fourcc :
			inst->fmts[CAPTURE_PORT]->fourcc;
			inst->fmts[OUTPUT_PORT].fourcc :
			inst->fmts[CAPTURE_PORT].fourcc;

	/* check if capabilities are available for this session */
	for (i = 0; i < VIDC_MAX_SESSIONS; i++) {
@@ -1214,7 +1214,7 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
			"V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT due to bit-depth change\n");
	}

	if (inst->fmts[CAPTURE_PORT]->fourcc == V4L2_PIX_FMT_NV12 &&
	if (inst->fmts[CAPTURE_PORT].fourcc == V4L2_PIX_FMT_NV12 &&
		inst->pic_struct != event_notify->pic_struct) {
		inst->pic_struct = event_notify->pic_struct;
		event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
@@ -2012,7 +2012,7 @@ static void handle_fbd(enum hal_command_response cmd, void *data)
			ns_to_timeval(time_usec * NSEC_PER_USEC);
		vb->v4l2_buf.flags = 0;
		extra_idx =
			EXTRADATA_IDX(inst->fmts[CAPTURE_PORT]->num_planes);
			EXTRADATA_IDX(inst->fmts[CAPTURE_PORT].num_planes);
		if (extra_idx && extra_idx < VIDEO_MAX_PLANES) {
			vb->v4l2_planes[extra_idx].m.userptr =
				(unsigned long)fill_buf_done->extra_data_buffer;
@@ -2240,8 +2240,8 @@ int msm_comm_scale_clocks_load(struct msm_vidc_core *core,
	list_for_each_entry(inst, &core->instances, list) {

		codec = inst->session_type == MSM_VIDC_DECODER ?
			inst->fmts[OUTPUT_PORT]->fourcc :
			inst->fmts[CAPTURE_PORT]->fourcc;
			inst->fmts[OUTPUT_PORT].fourcc :
			inst->fmts[CAPTURE_PORT].fourcc;

		if (msm_comm_turbo_session(inst))
			clk_scale_data.power_mode[num_sessions] =
@@ -2649,9 +2649,9 @@ static int msm_comm_session_init(int flipped_state,
		goto exit;
	}
	if (inst->session_type == MSM_VIDC_DECODER) {
		fourcc = inst->fmts[OUTPUT_PORT]->fourcc;
		fourcc = inst->fmts[OUTPUT_PORT].fourcc;
	} else if (inst->session_type == MSM_VIDC_ENCODER) {
		fourcc = inst->fmts[CAPTURE_PORT]->fourcc;
		fourcc = inst->fmts[CAPTURE_PORT].fourcc;
	} else {
		dprintk(VIDC_ERR, "Invalid session\n");
		return -EINVAL;
@@ -3538,7 +3538,7 @@ static void populate_frame_data(struct vidc_frame_data *data,
		data->buffer_type = msm_comm_get_hal_output_buffer(inst);
	}

	extra_idx = EXTRADATA_IDX(inst->fmts[port]->num_planes);
	extra_idx = EXTRADATA_IDX(inst->fmts[port].num_planes);
	if (extra_idx && extra_idx < VIDEO_MAX_PLANES &&
			vb->v4l2_planes[extra_idx].m.userptr) {
		data->extradata_addr = vb->v4l2_planes[extra_idx].m.userptr;
+4 −4
Original line number Diff line number Diff line
@@ -235,8 +235,8 @@ void msm_dcvs_init_load(struct msm_vidc_inst *inst)
	}

	fourcc = inst->session_type == MSM_VIDC_DECODER ?
				inst->fmts[OUTPUT_PORT]->fourcc :
				inst->fmts[CAPTURE_PORT]->fourcc;
				inst->fmts[OUTPUT_PORT].fourcc :
				inst->fmts[CAPTURE_PORT].fourcc;

	for (i = 0; i < num_rows; i++) {
		bool matches = msm_dcvs_check_codec_supported(
@@ -553,7 +553,7 @@ static bool msm_dcvs_enc_check(struct msm_vidc_inst *inst)

	is_codec_supported =
		msm_dcvs_check_codec_supported(
				inst->fmts[CAPTURE_PORT]->fourcc,
				inst->fmts[CAPTURE_PORT].fourcc,
				inst->dcvs.supported_codecs,
				inst->session_type);

@@ -613,7 +613,7 @@ static bool msm_dcvs_check_supported(struct msm_vidc_inst *inst)
			res->dcvs_limit[inst->session_type].fps;
		is_codec_supported =
			msm_dcvs_check_codec_supported(
					inst->fmts[OUTPUT_PORT]->fourcc,
					inst->fmts[OUTPUT_PORT].fourcc,
					inst->dcvs.supported_codecs,
					inst->session_type);
		if (!is_codec_supported ||
Loading