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

Commit f5679e84 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: Fix buffer count related issues"

parents 743e7c10 f4b1582c
Loading
Loading
Loading
Loading
+30 −38
Original line number Diff line number Diff line
@@ -709,8 +709,8 @@ static int msm_vidc_queue_setup(struct vb2_queue *q,
			sizes[i] = inst->bufq[OUTPUT_PORT].plane_sizes[i];

		bufreq->buffer_count_actual = *num_buffers;
		rc = set_buffer_count(inst, bufreq->buffer_count_actual,
			*num_buffers, HAL_BUFFER_INPUT);
		rc = set_buffer_count(inst, bufreq->buffer_count_min_host,
			bufreq->buffer_count_min_host, HAL_BUFFER_INPUT);
		}

		break;
@@ -743,8 +743,8 @@ static int msm_vidc_queue_setup(struct vb2_queue *q,
			sizes[i] = inst->bufq[CAPTURE_PORT].plane_sizes[i];

		bufreq->buffer_count_actual = *num_buffers;
		rc = set_buffer_count(inst, bufreq->buffer_count_actual,
			*num_buffers, buffer_type);
		rc = set_buffer_count(inst, bufreq->buffer_count_min_host,
			bufreq->buffer_count_min_host, buffer_type);
		}
		break;
	default:
@@ -1234,29 +1234,6 @@ static int msm_vidc_op_s_ctrl(struct v4l2_ctrl *ctrl)
	return rc;
}

static int set_actual_buffer_count(struct msm_vidc_inst *inst,
	int count, enum hal_buffer type)
{
	int rc = 0;
	struct hfi_device *hdev;
	struct hal_buffer_count_actual buf_count;

	hdev = inst->core->device;

	buf_count.buffer_type = type;
	buf_count.buffer_count_min_host = count;
	buf_count.buffer_count_actual = count;
	rc = call_hfi_op(hdev, session_set_property,
		inst->session, HAL_PARAM_BUFFER_COUNT_ACTUAL,
		&buf_count);
	if (rc)
		dprintk(VIDC_ERR,
			"Failed to set actual count %d for buffer type %d\n",
			count, type);
	return rc;
}


static int msm_vidc_get_count(struct msm_vidc_inst *inst,
	struct v4l2_ctrl *ctrl)
{
@@ -1281,13 +1258,20 @@ static int msm_vidc_get_count(struct msm_vidc_inst *inst,
				"Buffer count Host changed from %d to %d\n",
					bufreq->buffer_count_min_host,
					ctrl->val);
			bufreq->buffer_count_min_host = ctrl->val;
			bufreq->buffer_count_actual =
			bufreq->buffer_count_min =
			bufreq->buffer_count_min_host =
				ctrl->val;
		} else {
			ctrl->val = bufreq->buffer_count_min_host;
		}
		rc = set_actual_buffer_count(inst,
		rc = set_buffer_count(inst,
			bufreq->buffer_count_min_host,
			bufreq->buffer_count_actual,
			HAL_BUFFER_INPUT);

		msm_vidc_update_host_buff_counts(inst);
		ctrl->val = bufreq->buffer_count_min_host;
		return rc;

	} else if (ctrl->id == V4L2_CID_MIN_BUFFERS_FOR_CAPTURE) {
@@ -1308,31 +1292,37 @@ static int msm_vidc_get_count(struct msm_vidc_inst *inst,
				return 0;
		}


		if (inst->in_reconfig) {
			ctrl->val = bufreq->buffer_count_min;
		}
		if (inst->session_type == MSM_VIDC_DECODER &&
				!inst->in_reconfig &&
			inst->state < MSM_VIDC_LOAD_RESOURCES_DONE) {
			dprintk(VIDC_DBG,
				"Clients updates Buffer count from %d to %d\n",
				bufreq->buffer_count_min_host, ctrl->val);
			bufreq->buffer_count_min_host = ctrl->val;
			bufreq->buffer_count_actual =
			bufreq->buffer_count_min =
			bufreq->buffer_count_min_host =
				ctrl->val;
		}
		if (ctrl->val > bufreq->buffer_count_min_host) {
			dprintk(VIDC_DBG,
				"Buffer count Host changed from %d to %d\n",
				bufreq->buffer_count_min_host,
				ctrl->val);
			bufreq->buffer_count_min_host = ctrl->val;
			bufreq->buffer_count_actual =
			bufreq->buffer_count_min =
			bufreq->buffer_count_min_host =
				ctrl->val;
		} else {
			ctrl->val = bufreq->buffer_count_min_host;
		}
		rc = set_actual_buffer_count(inst,
		rc = set_buffer_count(inst,
			bufreq->buffer_count_min_host,
			bufreq->buffer_count_actual,
			HAL_BUFFER_OUTPUT);

		msm_vidc_update_host_buff_counts(inst);
		ctrl->val = bufreq->buffer_count_min_host;

		return rc;
	}
	return -EINVAL;
@@ -1378,6 +1368,8 @@ static int try_get_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		break;

	case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
		if (inst->in_reconfig)
			msm_vidc_update_host_buff_counts(inst);
		buffer_type = msm_comm_get_hal_output_buffer(inst);
		bufreq = get_buff_req_buffer(inst,
			buffer_type);
+3 −6
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@
#define L_MODE V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY

#define MAX_SUPPORTED_INSTANCES 16
static int msm_vidc_update_host_buff_counts(struct msm_vidc_inst *inst);

const char *const mpeg_video_vidc_extradata[] = {
	"Extradata none",
@@ -1605,10 +1604,8 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
			return;
		}
		bufreq->buffer_count_min = event_notify->capture_buf_count;

	}

	msm_vidc_update_host_buff_counts(inst);
	mutex_unlock(&inst->lock);

	if (event == V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT) {
@@ -4045,7 +4042,7 @@ int msm_comm_qbuf(struct msm_vidc_inst *inst, struct msm_vidc_buffer *mbuf)
	return rc;
}

static int msm_vidc_update_host_buff_counts(struct msm_vidc_inst *inst)
int msm_vidc_update_host_buff_counts(struct msm_vidc_inst *inst)
{
	int extra_buffers;
	struct hal_buffer_requirements *bufreq;
@@ -4144,7 +4141,7 @@ int msm_comm_try_get_bufreqs(struct msm_vidc_inst *inst)
				req.buffer_count_min, req.buffer_size);
		}
	}

	if (inst->session_type == MSM_VIDC_ENCODER)
		rc = msm_vidc_update_host_buff_counts(inst);

	dprintk(VIDC_DBG, "Buffer requirements host adjusted:\n");
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ int msm_comm_release_output_buffers(struct msm_vidc_inst *inst,
void msm_comm_validate_output_buffers(struct msm_vidc_inst *inst);
int msm_comm_force_cleanup(struct msm_vidc_inst *inst);
int msm_comm_suspend(int core_id);
int msm_vidc_update_host_buff_counts(struct msm_vidc_inst *inst);
enum hal_extradata_id msm_comm_get_hal_extradata_index(
	enum v4l2_mpeg_vidc_extradata index);
struct hal_buffer_requirements *get_buff_req_buffer(