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

Commit 629ddd59 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: refine firmware cycle calculation"

parents c3befd3a 4ff490da
Loading
Loading
Loading
Loading
+21 −12
Original line number Diff line number Diff line
@@ -550,6 +550,7 @@ static unsigned long msm_vidc_calc_freq_ar50(struct msm_vidc_inst *inst,
	u32 filled_len)
{
	u64 freq = 0, vpp_cycles = 0, vsp_cycles = 0;
	u64 fw_cycles = 0, fw_vpp_cycles = 0;
	u32 vpp_cycles_per_mb;
	u32 mbs_per_second;
	struct msm_vidc_core *core = NULL;
@@ -572,12 +573,17 @@ static unsigned long msm_vidc_calc_freq_ar50(struct msm_vidc_inst *inst,
	 * between them.
	 */

	fw_cycles = fps * inst->core->resources.fw_cycles;
	fw_vpp_cycles = fps * inst->core->resources.fw_vpp_cycles;

	if (inst->session_type == MSM_VIDC_ENCODER) {
		vpp_cycles_per_mb = inst->flags & VIDC_LOW_POWER ?
			inst->clk_data.entry->low_power_cycles :
			inst->clk_data.entry->vpp_cycles;

		vpp_cycles = mbs_per_second * vpp_cycles_per_mb;
		/* 21 / 20 is minimum overhead factor */
		vpp_cycles += max(vpp_cycles / 20, fw_vpp_cycles);

		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;

@@ -585,6 +591,8 @@ static unsigned long msm_vidc_calc_freq_ar50(struct msm_vidc_inst *inst,
		vsp_cycles += (inst->clk_data.bitrate * 10) / 7;
	} else if (inst->session_type == MSM_VIDC_DECODER) {
		vpp_cycles = mbs_per_second * inst->clk_data.entry->vpp_cycles;
		/* 21 / 20 is minimum overhead factor */
		vpp_cycles += max(vpp_cycles / 20, fw_vpp_cycles);

		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;
		/* 10 / 7 is overhead factor */
@@ -596,6 +604,7 @@ static unsigned long msm_vidc_calc_freq_ar50(struct msm_vidc_inst *inst,
	}

	freq = max(vpp_cycles, vsp_cycles);
	freq = max(freq, fw_cycles);

	dprintk(VIDC_DBG, "Update DCVS Load\n");
	allowed_clks_tbl = core->resources.allowed_clks_tbl;
@@ -623,6 +632,7 @@ static unsigned long msm_vidc_calc_freq_iris1(struct msm_vidc_inst *inst,
	u32 filled_len)
{
	u64 vsp_cycles = 0, vpp_cycles = 0, fw_cycles = 0, freq = 0;
	u64 fw_vpp_cycles = 0;
	u32 vpp_cycles_per_mb;
	u32 mbs_per_second;
	struct msm_vidc_core *core = NULL;
@@ -646,15 +656,18 @@ static unsigned long msm_vidc_calc_freq_iris1(struct msm_vidc_inst *inst,
	 * between them.
	 */

	fw_cycles = fps * inst->core->resources.fw_cycles;
	fw_vpp_cycles = fps * inst->core->resources.fw_vpp_cycles;

	if (inst->session_type == MSM_VIDC_ENCODER) {
		vpp_cycles_per_mb = inst->flags & VIDC_LOW_POWER ?
			inst->clk_data.entry->low_power_cycles :
			inst->clk_data.entry->vpp_cycles;

		vpp_cycles = mbs_per_second * vpp_cycles_per_mb;
		/* 21 / 20 is overhead factor */
		vpp_cycles = (vpp_cycles * 21)/
				(inst->clk_data.work_route * 20);
		vpp_cycles = mbs_per_second * vpp_cycles_per_mb /
				inst->clk_data.work_route;
		/* 21 / 20 is minimum overhead factor */
		vpp_cycles += max(vpp_cycles / 20, fw_vpp_cycles);

		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;

@@ -668,21 +681,17 @@ static unsigned long msm_vidc_calc_freq_iris1(struct msm_vidc_inst *inst,
		vsp_cycles += ((u64)inst->clk_data.bitrate * vsp_factor_num) /
				vsp_factor_den;

		fw_cycles = fps * inst->core->resources.fw_cycles;

	} else if (inst->session_type == MSM_VIDC_DECODER) {
		vpp_cycles = mbs_per_second * inst->clk_data.entry->vpp_cycles;
		/* 21 / 20 is overhead factor */
		vpp_cycles = (vpp_cycles * 21)/
				(inst->clk_data.work_route * 20);
		vpp_cycles = mbs_per_second * inst->clk_data.entry->vpp_cycles /
				inst->clk_data.work_route;
		/* 21 / 20 is minimum overhead factor */
		vpp_cycles += max(vpp_cycles / 20, fw_vpp_cycles);

		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;

		/* vsp perf is about 0.5 bits/cycle */
		vsp_cycles += ((fps * filled_len * 8) * 10) / 5;

		fw_cycles = fps * inst->core->resources.fw_cycles;

	} else {
		dprintk(VIDC_ERR, "Unknown session type = %s\n", __func__);
		return msm_vidc_max_freq(inst->core);
+3 −4
Original line number Diff line number Diff line
@@ -437,8 +437,8 @@ static unsigned long __calculate_decoder(struct vidc_bus_vote_data *d,

	bitrate = __lut(width, height, fps)->bitrate;

	bins_to_bit_factor = d->work_mode == HFI_WORKMODE_1 ?
		FP_INT(0) : FP_INT(4);
	bins_to_bit_factor = FP_INT(4);

	vsp_write_factor = bins_to_bit_factor;
	vsp_read_factor = bins_to_bit_factor + FP_INT(2);

@@ -675,8 +675,7 @@ static unsigned long __calculate_encoder(struct vidc_bus_vote_data *d,

	work_mode_1 = d->work_mode == HFI_WORKMODE_1;
	low_power = d->power_mode == VIDC_POWER_LOW;
	bins_to_bit_factor = work_mode_1 ?
		FP_INT(0) : FP_INT(4);
	bins_to_bit_factor = FP_INT(4);

	if (d->use_sys_cache) {
		llc_ref_chroma_cache_enabled = true;
+12 −0
Original line number Diff line number Diff line
@@ -231,6 +231,10 @@ static struct msm_vidc_common_data kona_common_data[] = {
		.key = "qcom,fw-cycles",
		.value = 760000,
	},
	{
		.key = "qcom,fw-vpp-cycles",
		.value = 166667,
	},
};

static struct msm_vidc_common_data sm6150_common_data[] = {
@@ -286,6 +290,10 @@ static struct msm_vidc_common_data sm6150_common_data[] = {
		.key = "qcom,fw-cycles",
		.value = 733003,
	},
	{
		.key = "qcom,fw-vpp-cycles",
		.value = 225975,
	},
};

static struct msm_vidc_common_data sm8150_common_data[] = {
@@ -365,6 +373,10 @@ static struct msm_vidc_common_data sm8150_common_data[] = {
		.key = "qcom,fw-cycles",
		.value = 760000,
	},
	{
		.key = "qcom,fw-vpp-cycles",
		.value = 166667,
	},
};

static struct msm_vidc_common_data sdm845_common_data[] = {
+2 −0
Original line number Diff line number Diff line
@@ -821,6 +821,8 @@ int read_platform_resources_from_drv_data(
			"qcom,dcvs");
	res->fw_cycles = find_key_value(platform_data,
			"qcom,fw-cycles");
	res->fw_vpp_cycles = find_key_value(platform_data,
			"qcom,fw-vpp-cycles");

	res->csc_coeff_data = &platform_data->csc_data;

+1 −0
Original line number Diff line number Diff line
@@ -201,6 +201,7 @@ struct msm_vidc_platform_resources {
	struct msm_vidc_mem_cdsp mem_cdsp;
	uint32_t vpu_ver;
	uint32_t fw_cycles;
	uint32_t fw_vpp_cycles;
	struct msm_vidc_ubwc_config_data *ubwc_config;
};