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

Commit 8a67c913 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: Advertise extradata size in queue_setup()"

parents 04073ea3 ef857677
Loading
Loading
Loading
Loading
+30 −14
Original line number Diff line number Diff line
@@ -1111,9 +1111,23 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
	}
	hdev = inst->core->device;

	rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE);
	if (rc) {
		dprintk(VIDC_ERR, "Failed to open instance\n");
		return rc;
	}

	rc = msm_comm_try_get_bufreqs(inst);
	if (rc) {
		dprintk(VIDC_ERR,
				"Failed to get buffer requirements: %d\n", rc);
		return rc;
	}

	switch (q->type) {
	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
		*num_planes = 1;

		buff_req = get_buff_req_buffer(inst, HAL_BUFFER_OUTPUT);
		if (buff_req) {
			*num_buffers = buff_req->buffer_count_actual =
@@ -1141,9 +1155,18 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
		inst->fmts[CAPTURE_PORT]->num_planes = *num_planes;

		for (i = 0; i < *num_planes; i++) {
			int extra_idx = EXTRADATA_IDX(*num_planes);

			sizes[i] = inst->fmts[CAPTURE_PORT]->get_frame_size(
					i, inst->prop.height[CAPTURE_PORT],
					inst->prop.width[CAPTURE_PORT]);

			if (extra_idx && i == extra_idx &&
					extra_idx < VIDEO_MAX_PLANES) {
				buff_req_buffer = get_buff_req_buffer(inst,
						HAL_BUFFER_EXTRADATA_OUTPUT);
				sizes[i] = buff_req_buffer->buffer_size;
			}
		}

		property_id = HAL_PARAM_BUFFER_COUNT_ACTUAL;
@@ -1153,26 +1176,18 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
			property_id, &new_buf_count);
		break;
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
		rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE);
		if (rc) {
			dprintk(VIDC_ERR, "Failed to open instance\n");
			break;
		}
		rc = msm_comm_try_get_bufreqs(inst);
		if (rc) {
			dprintk(VIDC_ERR,
				"Failed to get buffer requirements: %d\n", rc);
			break;
		}
		*num_planes = 1;

		mutex_lock(&inst->lock);
		*num_buffers = inst->buff_req.buffer[0].buffer_count_actual =
			max(*num_buffers, inst->buff_req.buffer[0].
				buffer_count_actual);
		mutex_unlock(&inst->lock);

		property_id = HAL_PARAM_BUFFER_COUNT_ACTUAL;
		new_buf_count.buffer_type = HAL_BUFFER_INPUT;
		new_buf_count.buffer_count_actual = *num_buffers;

		ctrl = v4l2_ctrl_find(&inst->ctrl_handler,
			V4L2_CID_MPEG_VIDC_VIDEO_EXTRADATA);
		if (ctrl)
@@ -1180,6 +1195,7 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
		if (extradata == V4L2_MPEG_VIDC_EXTRADATA_INPUT_CROP)
			*num_planes = *num_planes + 1;
		inst->fmts[OUTPUT_PORT]->num_planes = *num_planes;

		rc = call_hfi_op(hdev, session_set_property, inst->session,
					property_id, &new_buf_count);
		dprintk(VIDC_DBG, "size = %d, alignment = %d, count = %d\n",
@@ -1189,15 +1205,15 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
		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);
		if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) {
			buff_req_buffer = get_buff_req_buffer(inst,
				HAL_BUFFER_EXTRADATA_INPUT);
			sizes[extra_idx] =
				buff_req_buffer ?
				buff_req_buffer->buffer_size : 0;
			sizes[extra_idx] = buff_req_buffer->buffer_size;
		}

		break;
	default:
		dprintk(VIDC_ERR, "Invalid q type = %d\n", q->type);