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

Commit 67ec0584 authored by Ingrid Gallardo's avatar Ingrid Gallardo
Browse files

msm: mdss: use compression ratio factors passed by user space



Use the compression ratio factors shared by user space
to reduce the bandwidth calculations and vote for the
reduced throughput when compressed formats
are used.
Before this change kernel estimated the compression
ratio factors to reduce the bandwidth in the compressed
formats, after this change user space will set the
compression factors and kernel will use those for
bandwidth calculations.

Change-Id: I00fc0b9f526e7ff400740d48f42f6404737eae32
Signed-off-by: default avatarIngrid Gallardo <ingridg@codeaurora.org>
parent 1996fe6e
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -521,6 +521,9 @@ struct mdss_mdp_pipe {
	struct mdss_mdp_format_params *src_fmt;
	struct mdss_mdp_format_params *src_fmt;
	struct mdss_mdp_plane_sizes src_planes;
	struct mdss_mdp_plane_sizes src_planes;


	/* compression ratio from the source format */
	struct mult_factor comp_ratio;

	u8 mixer_stage;
	u8 mixer_stage;
	u8 is_fg;
	u8 is_fg;
	u8 alpha;
	u8 alpha;
@@ -1027,8 +1030,8 @@ void mdss_mdp_ctl_notifier_unregister(struct mdss_mdp_ctl *ctl,
	struct notifier_block *notifier);
	struct notifier_block *notifier);
u32 mdss_mdp_ctl_perf_get_transaction_status(struct mdss_mdp_ctl *ctl);
u32 mdss_mdp_ctl_perf_get_transaction_status(struct mdss_mdp_ctl *ctl);
u32 mdss_apply_overhead_factors(u32 quota, bool is_nrt,
u32 mdss_apply_overhead_factors(u32 quota, bool is_nrt,
	bool is_rot_read, struct mdss_mdp_format_params *fmt);
	bool is_rot_read, struct mdss_mdp_format_params *fmt,

	struct mult_factor *comp_ratio);


int mdss_mdp_scan_pipes(void);
int mdss_mdp_scan_pipes(void);


+24 −21
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ static inline u64 apply_fudge_factor(u64 val,
}
}


static inline u64 apply_inverse_fudge_factor(u64 val,
static inline u64 apply_inverse_fudge_factor(u64 val,
	struct mdss_fudge_factor *factor)
	struct mult_factor *factor)
{
{
	return fudge_factor(val, factor->denom, factor->numer);
	return fudge_factor(val, factor->denom, factor->numer);
}
}
@@ -543,22 +543,19 @@ static u32 get_pipe_mdp_clk_rate(struct mdss_mdp_pipe *pipe,
	return rate;
	return rate;
}
}


static inline bool validate_comp_ratio(struct mult_factor *factor)
{
	return factor->numer && factor->denom;
}

static u32 apply_comp_ratio_factor(u32 quota,
static u32 apply_comp_ratio_factor(u32 quota,
	struct mdss_mdp_format_params *fmt,
	struct mdss_mdp_format_params *fmt,
	bool is_nrt)
	struct mult_factor *factor)
{
{
	struct mdss_fudge_factor *factor;
	struct mdss_mdp_format_params_ubwc *ubwc_fmt;

	if (mdss_mdp_is_ubwc_format(fmt)) {
		ubwc_fmt = container_of(fmt, struct mdss_mdp_format_params_ubwc,
			mdp_format);

		if (is_nrt)
			factor = &ubwc_fmt->comp_ratio_nrt;
		else
			factor = &ubwc_fmt->comp_ratio_rt;


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


@@ -567,7 +564,8 @@ static u32 apply_comp_ratio_factor(u32 quota,


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


@@ -587,7 +585,8 @@ static u32 apply_overhead_factors(u32 quota,
	} else {
	} else {
		/* add ~3% (0.03125) of overhead */
		/* add ~3% (0.03125) of overhead */
		overhead_quota = quota / 32;
		overhead_quota = quota / 32;
		overhead_quota += apply_comp_ratio_factor(quota, fmt, is_nrt);
		overhead_quota += apply_comp_ratio_factor(quota, fmt,
			comp_ratio);
	}
	}


	return overhead_quota;
	return overhead_quota;
@@ -608,7 +607,8 @@ static u32 mdss_mdp_get_rotator_fps(struct mdss_mdp_pipe *pipe)
}
}


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


@@ -618,7 +618,7 @@ u32 mdss_apply_overhead_factors(u32 quota, bool is_nrt,
	if (test_bit(MDSS_QOS_OVERHEAD_FACTOR,
	if (test_bit(MDSS_QOS_OVERHEAD_FACTOR,
			mdata->mdss_qos_map)) {
			mdata->mdss_qos_map)) {
		quota = apply_overhead_factors(quota,
		quota = apply_overhead_factors(quota,
			is_nrt, is_rot_read, fmt);
			is_nrt, is_rot_read, fmt, comp_ratio);
	}
	}
	return quota;
	return quota;
}
}
@@ -732,7 +732,8 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
				mdata->mdss_qos_map)) {
				mdata->mdss_qos_map)) {
			/* rotator read */
			/* rotator read */
			quota = apply_overhead_factors(quota,
			quota = apply_overhead_factors(quota,
				true, true, pipe->src_fmt);
				true, true, pipe->src_fmt,
				&pipe->comp_ratio);
			/*
			/*
			 * rotator write: here we are using src_fmt since
			 * rotator write: here we are using src_fmt since
			 * current implementation only supports calculate
			 * current implementation only supports calculate
@@ -743,7 +744,8 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
			 * calculation as per current support.
			 * calculation as per current support.
			 */
			 */
			quota += apply_overhead_factors(quota,
			quota += apply_overhead_factors(quota,
				true, false, pipe->src_fmt);
				true, false, pipe->src_fmt,
				&pipe->comp_ratio);
		} else {
		} else {
			quota *= 2; /* bus read + write */
			quota *= 2; /* bus read + write */
		}
		}
@@ -757,7 +759,8 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
				mdata->mdss_qos_map))
				mdata->mdss_qos_map))
			quota = apply_overhead_factors(quota,
			quota = apply_overhead_factors(quota,
				mdss_mdp_is_nrt_ctl_path(mixer->ctl),
				mdss_mdp_is_nrt_ctl_path(mixer->ctl),
				false, pipe->src_fmt);
				false, pipe->src_fmt,
				&pipe->comp_ratio);
	}
	}


	perf->bw_overlap = quota;
	perf->bw_overlap = quota;
@@ -882,7 +885,7 @@ static void mdss_mdp_perf_calc_mixer(struct mdss_mdp_mixer *mixer,
					mdata->mdss_qos_map))
					mdata->mdss_qos_map))
				perf->bw_writeback = apply_overhead_factors(
				perf->bw_writeback = apply_overhead_factors(
					perf->bw_writeback,
					perf->bw_writeback,
					true, false, fmt);
					true, false, fmt, &pipe->comp_ratio);
		/* for command mode, run as fast as the link allows us */
		/* for command mode, run as fast as the link allows us */
		} else if (pinfo->type == MIPI_CMD_PANEL) {
		} else if (pinfo->type == MIPI_CMD_PANEL) {
			u32 dsi_pclk_rate = pinfo->mipi.dsi_pclk_rate;
			u32 dsi_pclk_rate = pinfo->mipi.dsi_pclk_rate;
+2 −0
Original line number Original line Diff line number Diff line
@@ -364,6 +364,8 @@ static int __configure_pipe_params(struct msm_fb_data_type *mfd,
		goto end;
		goto end;
	}
	}


	pipe->comp_ratio = layer->buffer.comp_ratio;

	if (mfd->panel_orientation)
	if (mfd->panel_orientation)
		layer->flags ^= mfd->panel_orientation;
		layer->flags ^= mfd->panel_orientation;


+2 −2
Original line number Original line Diff line number Diff line
@@ -1007,9 +1007,9 @@ static int mdss_rotator_calc_perf(struct mdss_rot_perf *perf)
		write_bw *= out_fmt->bpp;
		write_bw *= out_fmt->bpp;


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


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