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

Commit 6dfb6127 authored by Maheshwar Ajja's avatar Maheshwar Ajja
Browse files

msm: vidc: Consider operating rate in load calculations



Include operating rate in fps (frames per second) which
will be used to derive load and bandwidth calculations
to resolve HFR (high frame rate) usecases.

Change-Id: I1e4b15dc2e73ef88c7ba76a9c28483d1f52dd388
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent 2cbcc095
Loading
Loading
Loading
Loading
+23 −11
Original line number Diff line number Diff line
@@ -100,6 +100,19 @@ int msm_vidc_get_mbs_per_frame(struct msm_vidc_inst *inst)
	return NUM_MBS_PER_FRAME(height, width);
}

static int msm_vidc_get_fps(struct msm_vidc_inst *inst)
{
	int fps;

	if ((inst->clk_data.operating_rate >> 16) > inst->prop.fps)
		fps = (inst->clk_data.operating_rate >> 16) ?
			(inst->clk_data.operating_rate >> 16) : 1;
	else
		fps = inst->prop.fps;

	return fps;
}

void update_recon_stats(struct msm_vidc_inst *inst,
	struct recon_stats_type *recon_stats)
{
@@ -284,12 +297,7 @@ int msm_comm_vote_bus(struct msm_vidc_core *core)
			msm_comm_g_ctrl_for_id(inst,
				V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES) != 0;

		if (inst->clk_data.operating_rate)
			vote_data[i].fps =
				(inst->clk_data.operating_rate >> 16) ?
				inst->clk_data.operating_rate >> 16 : 1;
		else
			vote_data[i].fps = inst->prop.fps;
		vote_data[i].fps = msm_vidc_get_fps(inst);

		vote_data[i].power_mode = 0;
		if (msm_vidc_clock_voting || is_turbo ||
@@ -609,7 +617,7 @@ static unsigned long msm_vidc_calc_freq_ar50(struct msm_vidc_inst *inst,
	struct msm_vidc_core *core = NULL;
	int i = 0;
	struct allowed_clock_rates_table *allowed_clks_tbl = NULL;
	u64 rate = 0;
	u64 rate = 0, fps;
	struct clock_data *dcvs = NULL;

	core = inst->core;
@@ -618,6 +626,8 @@ static unsigned long msm_vidc_calc_freq_ar50(struct msm_vidc_inst *inst,
	mbs_per_second = msm_comm_get_inst_load_per_core(inst,
		LOAD_CALC_NO_QUIRKS);

	fps = msm_vidc_get_fps(inst);

	/*
	 * Calculate vpp, vsp cycles separately for encoder and decoder.
	 * Even though, most part is common now, in future it may change
@@ -640,7 +650,7 @@ static unsigned long msm_vidc_calc_freq_ar50(struct msm_vidc_inst *inst,

		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;
		/* 10 / 7 is overhead factor */
		vsp_cycles += ((inst->prop.fps * filled_len * 8) * 10) / 7;
		vsp_cycles += ((fps * filled_len * 8) * 10) / 7;

	} else {
		dprintk(VIDC_ERR, "Unknown session type = %s\n", __func__);
@@ -681,7 +691,7 @@ static unsigned long msm_vidc_calc_freq(struct msm_vidc_inst *inst,
	struct msm_vidc_core *core = NULL;
	int i = 0;
	struct allowed_clock_rates_table *allowed_clks_tbl = NULL;
	u64 rate = 0;
	u64 rate = 0, fps;
	struct clock_data *dcvs = NULL;
	u32 operating_rate, vsp_factor_num = 10, vsp_factor_den = 7;

@@ -691,6 +701,8 @@ static unsigned long msm_vidc_calc_freq(struct msm_vidc_inst *inst,
	mbs_per_second = msm_comm_get_inst_load_per_core(inst,
		LOAD_CALC_NO_QUIRKS);

	fps = msm_vidc_get_fps(inst);

	/*
	 * Calculate vpp, vsp cycles separately for encoder and decoder.
	 * Even though, most part is common now, in future it may change
@@ -726,7 +738,7 @@ static unsigned long msm_vidc_calc_freq(struct msm_vidc_inst *inst,
		vsp_cycles = mbs_per_second * inst->clk_data.entry->vsp_cycles;

		/* 10 / 7 is overhead factor */
		vsp_cycles += ((inst->prop.fps * filled_len * 8) * 10) / 7;
		vsp_cycles += ((fps * filled_len * 8) * 10) / 7;

	} else {
		dprintk(VIDC_ERR, "Unknown session type = %s\n", __func__);
@@ -1373,7 +1385,7 @@ static inline int msm_vidc_power_save_mode_enable(struct msm_vidc_inst *inst,
	}
	mbs_per_frame = msm_vidc_get_mbs_per_frame(inst);
	if (mbs_per_frame > inst->core->resources.max_hq_mbs_per_frame ||
		inst->prop.fps > inst->core->resources.max_hq_fps) {
		msm_vidc_get_fps(inst) > inst->core->resources.max_hq_fps) {
		enable = true;
	}

+5 −10
Original line number Diff line number Diff line
@@ -733,18 +733,13 @@ static int msm_comm_get_mbs_per_sec(struct msm_vidc_inst *inst)
	capture_port_mbs = NUM_MBS_PER_FRAME(inst->prop.width[CAPTURE_PORT],
		inst->prop.height[CAPTURE_PORT]);

	if (inst->clk_data.operating_rate) {
	if ((inst->clk_data.operating_rate >> 16) > inst->prop.fps)
		fps = (inst->clk_data.operating_rate >> 16) ?
			inst->clk_data.operating_rate >> 16 : 1;
		/*
		 * Check if operating rate is less than fps.
		 * If Yes, then use fps to scale clocks
		 */
		fps = fps > inst->prop.fps ? fps : inst->prop.fps;
	else
		fps = inst->prop.fps;

	return max(output_port_mbs, capture_port_mbs) * fps;
	} else {
		return max(output_port_mbs, capture_port_mbs) * inst->prop.fps;
	}
}

int msm_comm_get_inst_load(struct msm_vidc_inst *inst,