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

Commit 9424e4bc authored by Ashray Kulkarni's avatar Ashray Kulkarni Committed by Deva Ramasubramanian
Browse files

msm: vidc: remove adding of extra input buffers for encoder



When power save mode for 4K recording is enabled, driver adds two
extra input buffers to enable DCVS. This change removes the addition
of extra buffers as camera adds them now.

Change-Id: I6b7a789cd146f1441ceaeb2b3ede178e2be94d5f
Signed-off-by: default avatarAshray Kulkarni <ashrayk@codeaurora.org>
parent fd854d74
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -1299,11 +1299,11 @@ static int msm_venc_queue_setup(struct vb2_queue *q,
		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, false);
				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, false);
			msm_dcvs_set_buff_req_handled(inst);

		break;
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
@@ -1324,12 +1324,10 @@ 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;
		new_buf_count.buffer_count_actual +=
			msm_dcvs_get_extra_buff_count(inst, true);
		rc = call_hfi_op(hdev, session_set_property, inst->session,
					property_id, &new_buf_count);
		if (!rc)
			msm_dcvs_set_buff_req_handled(inst, true);
		if (rc)
			dprintk(VIDC_ERR, "failed to set count to fw\n");

		dprintk(VIDC_DBG, "size = %d, alignment = %d, count = %d\n",
				inst->buff_req.buffer[0].buffer_size,
+5 −18
Original line number Diff line number Diff line
@@ -557,8 +557,7 @@ static int msm_dcvs_check_supported(struct msm_vidc_inst *inst)
	return rc;
}

int msm_dcvs_get_extra_buff_count(struct msm_vidc_inst *inst,
					bool is_input_buff)
int msm_dcvs_get_extra_buff_count(struct msm_vidc_inst *inst)
{
	int extra_buffer = 0;

@@ -569,18 +568,14 @@ 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 (is_input_buff && !inst->dcvs.is_input_buff_added)
				extra_buffer = DCVS_ENC_EXTRA_INPUT_BUFFERS;
			else if (!is_input_buff &&
					!inst->dcvs.is_output_buff_added)
			if (!inst->dcvs.is_additional_buff_added)
				extra_buffer = DCVS_ENC_EXTRA_OUTPUT_BUFFERS;
		}
	}
	return extra_buffer;
}

void msm_dcvs_set_buff_req_handled(struct msm_vidc_inst *inst,
					bool is_input_buff)
void msm_dcvs_set_buff_req_handled(struct msm_vidc_inst *inst)
{
	if (!inst) {
		dprintk(VIDC_ERR, "%s Invalid args\n", __func__);
@@ -589,18 +584,10 @@ void msm_dcvs_set_buff_req_handled(struct msm_vidc_inst *inst,

	if (inst->session_type == MSM_VIDC_ENCODER) {
		if (msm_dcvs_enc_check(inst)) {
			if (is_input_buff && !inst->dcvs.is_input_buff_added)
				inst->dcvs.is_input_buff_added = true;
			else if (!is_input_buff &&
					!inst->dcvs.is_output_buff_added)
				inst->dcvs.is_output_buff_added = true;

			if (inst->dcvs.is_input_buff_added &&
				inst->dcvs.is_output_buff_added) {
			if (!inst->dcvs.is_additional_buff_added)
				inst->dcvs.is_additional_buff_added = true;
				dprintk(VIDC_PROF,
					"ENC_DCVS: additional i/p o/p buffer added");
			}
					"ENC_DCVS: additional o/p buffer added");
		}
	}
}
+3 −7
Original line number Diff line number Diff line
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -21,8 +21,6 @@
#define DCVS_ENC_LOW_THR 4
/* High threshold for encoder dcvs */
#define DCVS_ENC_HIGH_THR 9
/* extra i/p buffers in case of encoder dcvs */
#define DCVS_ENC_EXTRA_INPUT_BUFFERS 2
/* extra o/p buffers in case of encoder dcvs */
#define DCVS_ENC_EXTRA_OUTPUT_BUFFERS 2
/* Default threshold to reduce the core frequency */
@@ -41,10 +39,8 @@ void msm_dcvs_init_load(struct msm_vidc_inst *inst);
bool msm_dcvs_enc_check(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,
		bool is_input_buff);
void msm_dcvs_set_buff_req_handled(struct msm_vidc_inst *inst,
		bool is_input_buff);
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 −2
Original line number Diff line number Diff line
@@ -201,8 +201,6 @@ struct dcvs_stats {
	bool is_clock_scaled;
	int etb_counter;
	bool is_power_save_mode;
	bool is_output_buff_added;
	bool is_input_buff_added;
	bool is_additional_buff_added;
};