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

Commit 11714fe8 authored by Deva Ramasubramanian's avatar Deva Ramasubramanian
Browse files

msm: vidc: Provide the correct buffer count to client



If DCVS is active, we add extra output buffers and update the firmware
accordingly.  However we don't update the client with the extra buffer
count.  This commit updates the client accordingly.

In addition, this patch acts as a workaround for a firmware bug (will be
fixed independently), where the firmware refuses to start unless it owns
all the output buffers.  Since the firmware buffer count > client buffer
count, client will never actually provide all the buffers required for
the firmware to start.

Change-Id: Ie9b022e37d0654a761f7c7a95a8180b7fda0e418
Signed-off-by: default avatarDeva Ramasubramanian <dramasub@codeaurora.org>
parent e6123cce
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1337,8 +1337,14 @@ static int msm_venc_queue_setup(struct vb2_queue *q,

		buff_req = get_buff_req_buffer(inst, HAL_BUFFER_OUTPUT);
		if (buff_req) {
			*num_buffers = buff_req->buffer_count_actual =
			max(*num_buffers, buff_req->buffer_count_min);
			/*
			 * Pretend as if the FW itself is asking for additional
			 * buffers, which are required for DCVS
			 */
			unsigned int min_req_buffers =
				buff_req->buffer_count_min +
				msm_dcvs_get_extra_buff_count(inst);
			*num_buffers = max(*num_buffers, min_req_buffers);
		}

		if (*num_buffers < MIN_NUM_CAPTURE_BUFFERS ||
@@ -1398,12 +1404,8 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
		property_id = HAL_PARAM_BUFFER_COUNT_ACTUAL;
		new_buf_count.buffer_type = HAL_BUFFER_OUTPUT;
		new_buf_count.buffer_count_actual = *num_buffers;
		new_buf_count.buffer_count_actual +=
				msm_dcvs_get_extra_buff_count(inst);
		rc = call_hfi_op(hdev, session_set_property, inst->session,
			property_id, &new_buf_count);
		if (!rc)
			msm_dcvs_set_buff_req_handled(inst);

		break;
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+3 −22
Original line number Diff line number Diff line
@@ -542,8 +542,7 @@ static bool msm_dcvs_check_supported(struct msm_vidc_inst *inst)
	} else if (instance_count == 1 &&
			inst->session_type == MSM_VIDC_ENCODER &&
			!msm_comm_turbo_session(inst)) {
		if (!msm_dcvs_enc_check(inst) ||
			!inst->dcvs.is_additional_buff_added)
		if (!msm_dcvs_enc_check(inst))
			return false;
	} else {
		/*
@@ -591,10 +590,8 @@ int msm_dcvs_get_extra_buff_count(struct msm_vidc_inst *inst)
	}

	if (inst->session_type == MSM_VIDC_ENCODER) {
		if (msm_dcvs_enc_check(inst)) {
			if (!inst->dcvs.is_additional_buff_added)
		if (msm_dcvs_enc_check(inst))
			extra_buffer = DCVS_ENC_EXTRA_OUTPUT_BUFFERS;
		}
	} else if (inst->session_type == MSM_VIDC_DECODER) {
		if (msm_dcvs_check_supported(inst))
			extra_buffer = DCVS_DEC_EXTRA_OUTPUT_BUFFERS;
@@ -602,22 +599,6 @@ int msm_dcvs_get_extra_buff_count(struct msm_vidc_inst *inst)
	return extra_buffer;
}

void msm_dcvs_set_buff_req_handled(struct msm_vidc_inst *inst)
{
	if (!inst) {
		dprintk(VIDC_ERR, "%s Invalid args\n", __func__);
		return;
	}

	if (inst->session_type == MSM_VIDC_ENCODER) {
		if (msm_dcvs_enc_check(inst)) {
			if (!inst->dcvs.is_additional_buff_added)
				inst->dcvs.is_additional_buff_added = true;
				dprintk(VIDC_PROF,
					"ENC_DCVS: additional o/p buffer added");
		}
	}
}

void msm_dcvs_enc_set_power_save_mode(struct msm_vidc_inst *inst,
					bool is_power_save_mode)
+0 −1
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ void msm_dcvs_init_load(struct msm_vidc_inst *inst);
void msm_dcvs_monitor_buffer(struct msm_vidc_inst *inst);
void msm_dcvs_check_and_scale_clocks(struct msm_vidc_inst *inst, bool is_etb);
int  msm_dcvs_get_extra_buff_count(struct msm_vidc_inst *inst);
void msm_dcvs_set_buff_req_handled(struct msm_vidc_inst *inst);
void msm_dcvs_enc_set_power_save_mode(struct msm_vidc_inst *inst,
		bool is_power_save_mode);
#endif
+0 −1
Original line number Diff line number Diff line
@@ -200,7 +200,6 @@ struct dcvs_stats {
	bool is_clock_scaled;
	int etb_counter;
	bool is_power_save_mode;
	bool is_additional_buff_added;
};

struct profile_data {