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

Commit 23b6b3a6 authored by Jeykumar Sankaran's avatar Jeykumar Sankaran
Browse files

mdp: mdss: Tune bandwidth and clock based on ROI



Calculate bandwidth and MDP clock requirement considering
the ROI submitted for a frame. When doing partial frame update
for smart panels, the data actually fetched for a pipe is not
always the full resolution of the buffer programmed. Use the
ROI passed to find out the region of fetching and calculate the
bandwidth and clock values accordingly.

Change-Id: I01f24f8fd9a42a2c4d705b8eb0a7658e79884175
Signed-off-by: default avatarJeykumar Sankaran <jsanka@codeaurora.org>
parent 8f583bb6
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -530,7 +530,7 @@ int mdss_mdp_ctl_start(struct mdss_mdp_ctl *ctl);
int mdss_mdp_ctl_stop(struct mdss_mdp_ctl *ctl);
int mdss_mdp_ctl_intf_event(struct mdss_mdp_ctl *ctl, int event, void *arg);
int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
		struct mdss_mdp_perf_params *perf);
	struct mdss_mdp_perf_params *perf, struct mdss_mdp_img_rect *roi);
int mdss_mdp_ctl_notify(struct mdss_mdp_ctl *ctl, int event);
void mdss_mdp_ctl_notifier_register(struct mdss_mdp_ctl *ctl,
	struct notifier_block *notifier);
@@ -639,6 +639,10 @@ int mdss_mdp_calc_phase_step(u32 src, u32 dst, u32 *out_phase);
void mdss_mdp_intersect_rect(struct mdss_mdp_img_rect *res_rect,
	const struct mdss_mdp_img_rect *dst_rect,
	const struct mdss_mdp_img_rect *sci_rect);
void mdss_mdp_crop_rect(struct mdss_mdp_img_rect *src_rect,
	struct mdss_mdp_img_rect *dst_rect,
	const struct mdss_mdp_img_rect *sci_rect);


int mdss_mdp_wb_kickoff(struct msm_fb_data_type *mfd);
int mdss_mdp_wb_ioctl_handler(struct msm_fb_data_type *mfd, u32 cmd, void *arg);
+16 −8
Original line number Diff line number Diff line
@@ -189,16 +189,20 @@ static int mdss_mdp_ctl_perf_commit(struct mdss_data_type *mdata, u32 flags)
 * (MDP clock requirement) based on frame size and scaling requirements.
 */
int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
		struct mdss_mdp_perf_params *perf)
	struct mdss_mdp_perf_params *perf, struct mdss_mdp_img_rect *roi)
{
	struct mdss_mdp_mixer *mixer;
	int fps = DEFAULT_FRAME_RATE;
	u32 quota, rate, v_total, src_h;
	struct mdss_mdp_img_rect src, dst;

	if (!pipe || !perf || !pipe->mixer)
		return -EINVAL;

	mixer = pipe->mixer;
	dst = pipe->dst;
	src = pipe->src;

	if (mixer->rotator_mode) {
		v_total = pipe->flags & MDP_ROT_90 ? pipe->dst.w : pipe->dst.h;
	} else if (mixer->type == MDSS_MDP_MIXER_TYPE_INTF) {
@@ -211,14 +215,17 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
		v_total = mixer->height;
	}

	if (roi)
		mdss_mdp_crop_rect(&src, &dst, roi);

	/*
	 * when doing vertical decimation lines will be skipped, hence there is
	 * no need to account for these lines in MDP clock or request bus
	 * bandwidth to fetch them.
	 */
	src_h = pipe->src.h >> pipe->vert_deci;
	src_h = src.h >> pipe->vert_deci;

	quota = fps * pipe->src.w * src_h;
	quota = fps * src.w * src_h;
	if (pipe->src_fmt->chroma_sample == MDSS_MDP_CHROMA_420)
		/*
		 * with decimation, chroma is not downsampled, this means we
@@ -231,9 +238,9 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
	else
		quota *= pipe->src_fmt->bpp;

	rate = pipe->dst.w;
	if (src_h > pipe->dst.h)
		rate = (rate * src_h) / pipe->dst.h;
	rate = dst.w;
	if (src_h > dst.h)
		rate = (rate * src_h) / dst.h;

	rate *= v_total * fps;
	if (mixer->rotator_mode) {
@@ -241,8 +248,9 @@ int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
		quota *= 2; /* bus read + write */
		perf->ib_quota = quota;
	} else {
		perf->ib_quota = (quota / pipe->dst.h) * v_total;
		perf->ib_quota = (quota / dst.h) * v_total;
	}

	perf->ab_quota = quota;
	perf->mdp_clk_rate = rate;

@@ -296,7 +304,7 @@ static void mdss_mdp_perf_mixer_update(struct mdss_mdp_mixer *mixer,
		if (pipe == NULL)
			continue;

		if (mdss_mdp_perf_calc_pipe(pipe, &perf))
		if (mdss_mdp_perf_calc_pipe(pipe, &perf, &mixer->roi))
			continue;

		ab_total += perf.ab_quota >> MDSS_MDP_BUS_FACTOR_SHIFT;
+1 −1
Original line number Diff line number Diff line
@@ -256,7 +256,7 @@ static int __mdp_pipe_tune_perf(struct mdss_mdp_pipe *pipe)
	int rc;

	for (;;) {
		rc = mdss_mdp_perf_calc_pipe(pipe, &perf);
		rc = mdss_mdp_perf_calc_pipe(pipe, &perf, NULL);

		if (!rc && (perf.mdp_clk_rate <= mdata->max_mdp_clk_rate))
			break;
+1 −19
Original line number Diff line number Diff line
@@ -671,25 +671,7 @@ error:
	return rc;
}

void mdss_mdp_crop_rect(struct mdss_mdp_img_rect *src_rect,
	struct mdss_mdp_img_rect *dst_rect,
	const struct mdss_mdp_img_rect *sci_rect)
{
	struct mdss_mdp_img_rect res;
	mdss_mdp_intersect_rect(&res, dst_rect, sci_rect);

	if (res.w && res.h) {
		if ((res.w != dst_rect->w) || (res.h != dst_rect->h)) {
			src_rect->x = src_rect->x + (res.x - dst_rect->x);
			src_rect->y = src_rect->y + (res.y - dst_rect->y);
			src_rect->w = res.w;
			src_rect->h = res.h;
		}
		*dst_rect = (struct mdss_mdp_img_rect)
			{(res.x - sci_rect->x), (res.y - sci_rect->y),
			res.w, res.h};
	}
}

static int mdss_mdp_image_setup(struct mdss_mdp_pipe *pipe,
					struct mdss_mdp_data *data)
+21 −0
Original line number Diff line number Diff line
@@ -258,6 +258,27 @@ void mdss_mdp_intersect_rect(struct mdss_mdp_img_rect *res_rect,
	else
		*res_rect = (struct mdss_mdp_img_rect){l, t, (r-l), (b-t)};
}

void mdss_mdp_crop_rect(struct mdss_mdp_img_rect *src_rect,
	struct mdss_mdp_img_rect *dst_rect,
	const struct mdss_mdp_img_rect *sci_rect)
{
	struct mdss_mdp_img_rect res;
	mdss_mdp_intersect_rect(&res, dst_rect, sci_rect);

	if (res.w && res.h) {
		if ((res.w != dst_rect->w) || (res.h != dst_rect->h)) {
			src_rect->x = src_rect->x + (res.x - dst_rect->x);
			src_rect->y = src_rect->y + (res.y - dst_rect->y);
			src_rect->w = res.w;
			src_rect->h = res.h;
		}
		*dst_rect = (struct mdss_mdp_img_rect)
			{(res.x - sci_rect->x), (res.y - sci_rect->y),
			res.w, res.h};
	}
}

int mdss_mdp_get_rau_strides(u32 w, u32 h,
			       struct mdss_mdp_format_params *fmt,
			       struct mdss_mdp_plane_sizes *ps)