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

Commit 2a2d99af authored by Ujwal Patel's avatar Ujwal Patel
Browse files

msm: mdss: modify BW overhead and compression ratio related logic



As per the new qos strategy, overhead fudge factors are not needed and
thus remove related logic. Also as per the new qos implementation,
user-space program is responsible to passing on compression ratio when
they setup the pipeline. So cleanup current driver logic which makes
decision based on data path.

Change-Id: I3d4f7ab3749b5b8595ea322a0b5b25ba3187b660
Signed-off-by: default avatarUjwal Patel <ujwalp@codeaurora.org>
parent 4f7a708f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1038,9 +1038,8 @@ void mdss_mdp_ctl_notifier_register(struct mdss_mdp_ctl *ctl,
void mdss_mdp_ctl_notifier_unregister(struct mdss_mdp_ctl *ctl,
	struct notifier_block *notifier);
u32 mdss_mdp_ctl_perf_get_transaction_status(struct mdss_mdp_ctl *ctl);
u32 mdss_apply_overhead_factors(u32 quota, bool is_nrt,
	bool is_rot_read, struct mdss_mdp_format_params *fmt,
	struct mult_factor *comp_ratio);
u32 apply_comp_ratio_factor(u32 quota, struct mdss_mdp_format_params *fmt,
	struct mult_factor *factor);

int mdss_mdp_scan_pipes(void);

+17 −63
Original line number Diff line number Diff line
@@ -549,50 +549,24 @@ static inline bool validate_comp_ratio(struct mult_factor *factor)
	return factor->numer && factor->denom;
}

static u32 apply_comp_ratio_factor(u32 quota,
u32 apply_comp_ratio_factor(u32 quota,
	struct mdss_mdp_format_params *fmt,
	struct mult_factor *factor)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();

	if (!mdata || test_bit(MDSS_QOS_OVERHEAD_FACTOR,
		      mdata->mdss_qos_map))
		return quota;

	/* apply compression ratio, only for compressed formats */
	if (mdss_mdp_is_ubwc_format(fmt) &&
			validate_comp_ratio(factor)) {
	    validate_comp_ratio(factor))
		quota = apply_inverse_fudge_factor(quota , factor);
	}

	return quota;
}

static u32 apply_overhead_factors(u32 quota,
	bool is_nrt, bool is_rot_read,
	struct mdss_mdp_format_params *fmt,
	struct mult_factor *comp_ratio)
{
	u32 overhead_quota;

	if (!fmt) {
		pr_debug("fmt is null, skip overhead factor\n");
		return quota;
	}

	/* rotator read + YUV linear format */
	if (is_nrt && is_rot_read && fmt->is_yuv &&
			mdss_mdp_is_linear_format(fmt)) {
		/*
		* overhead and compression ratio factors are 1,
		* so overhead_quota = quota + quota
		*/
		overhead_quota = quota * 2;
	} else {
		/* add ~3% (0.03125) of overhead */
		overhead_quota = quota / 32;
		overhead_quota += apply_comp_ratio_factor(quota, fmt,
			comp_ratio);
	}

	return overhead_quota;
};

static u32 mdss_mdp_get_rotator_fps(struct mdss_mdp_pipe *pipe)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();
@@ -607,23 +581,6 @@ static u32 mdss_mdp_get_rotator_fps(struct mdss_mdp_pipe *pipe)
	return fps;
}

u32 mdss_apply_overhead_factors(u32 quota, bool is_nrt,
	bool is_rot_read, struct mdss_mdp_format_params *fmt,
	struct mult_factor *comp_ratio)
{
	struct mdss_data_type *mdata = mdss_mdp_get_mdata();

	if (!mdata)
		return quota;

	if (test_bit(MDSS_QOS_OVERHEAD_FACTOR,
			mdata->mdss_qos_map)) {
		quota = apply_overhead_factors(quota,
			is_nrt, is_rot_read, fmt, comp_ratio);
	}
	return quota;
}

u64 mdss_mdp_perf_calc_simplified_prefill(struct mdss_mdp_pipe *pipe,
	u32 v_total, u32 fps, struct mdss_mdp_ctl *ctl)
{
@@ -785,9 +742,8 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
		if (test_bit(MDSS_QOS_OVERHEAD_FACTOR,
				mdata->mdss_qos_map)) {
			/* rotator read */
			quota = apply_overhead_factors(quota,
				true, true, pipe->src_fmt,
				&pipe->comp_ratio);
			quota = apply_comp_ratio_factor(quota,
				pipe->src_fmt, &pipe->comp_ratio);
			/*
			 * rotator write: here we are using src_fmt since
			 * current implementation only supports calculate
@@ -797,9 +753,8 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
			 * calculate the bandwidth, but leaving this
			 * calculation as per current support.
			 */
			quota += apply_overhead_factors(quota,
				true, false, pipe->src_fmt,
				&pipe->comp_ratio);
			quota += apply_comp_ratio_factor(quota,
				pipe->src_fmt, &pipe->comp_ratio);
		} else {
			quota *= 2; /* bus read + write */
		}
@@ -811,10 +766,8 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,

		if (test_bit(MDSS_QOS_OVERHEAD_FACTOR,
				mdata->mdss_qos_map))
			quota = apply_overhead_factors(quota,
				mdss_mdp_is_nrt_ctl_path(mixer->ctl),
				false, pipe->src_fmt,
				&pipe->comp_ratio);
			quota = apply_comp_ratio_factor(quota,
				pipe->src_fmt, &pipe->comp_ratio);
	}

	perf->bw_overlap = quota;
@@ -945,9 +898,10 @@ static void mdss_mdp_perf_calc_mixer(struct mdss_mdp_mixer *mixer,

			if (test_bit(MDSS_QOS_OVERHEAD_FACTOR,
					mdata->mdss_qos_map))
				perf->bw_writeback = apply_overhead_factors(
					perf->bw_writeback, true, false, fmt,
				perf->bw_writeback = apply_comp_ratio_factor(
						perf->bw_writeback, fmt,
						&mixer->ctl->dst_comp_ratio);

		} else if (pinfo->type == MIPI_CMD_PANEL) {
			/* for cmd mode, run as fast as the link allows us */
			u32 dsi_pclk_rate = pinfo->mipi.dsi_pclk_rate;
+4 −4
Original line number Diff line number Diff line
@@ -1006,10 +1006,10 @@ static int mdss_rotator_calc_perf(struct mdss_rot_perf *perf)
	else
		write_bw *= out_fmt->bpp;

	read_bw = mdss_apply_overhead_factors(read_bw,
		true, true, in_fmt, &config->input.comp_ratio);
	write_bw = mdss_apply_overhead_factors(write_bw,
		true, false, out_fmt, &config->output.comp_ratio);
	read_bw = apply_comp_ratio_factor(read_bw, in_fmt,
			&config->input.comp_ratio);
	write_bw = apply_comp_ratio_factor(write_bw, out_fmt,
			&config->output.comp_ratio);

	perf->bw = read_bw + write_bw;
	return 0;