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

Commit c606ed1d authored by Vishnuvardhan Prodduturi's avatar Vishnuvardhan Prodduturi Committed by Ingrid Gallardo
Browse files

msm: mdss: handoff programmable fetch from bootloader to kernel



During transition from bootloader to kernel, make sure programmable
fetch trigger enable status is properly transitioned so that prefill BW
can be effectively calculated.

Change-Id: I30d2827b1b8158799601050560ec41e338855790
Signed-off-by: default avatarVishnuvardhan Prodduturi <vproddut@codeaurora.org>
Signed-off-by: default avatarIngrid Gallardo <ingridg@codeaurora.org>
parent df3f9b21
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ struct mdss_mdp_ctl {
	void *priv_data;
	void *intf_ctx[2];
	u32 wb_type;
	bool prg_fet;
	u32 prg_fet;
	bool force_ctl_start;
};

+1 −2
Original line number Diff line number Diff line
@@ -865,8 +865,7 @@ static u32 mdss_mdp_get_vbp_factor(struct mdss_mdp_ctl *ctl)
	fps = mdss_panel_get_framerate(pinfo);
	v_total = mdss_panel_get_vtotal(pinfo);
	vbp = pinfo->lcdc.v_back_porch + pinfo->lcdc.v_pulse_width;
	if (ctl->prg_fet)
		vbp += mdss_mdp_max_fetch_lines(pinfo);
	vbp += ctl->prg_fet;

	vbp_fac = (vbp) ? fps * v_total / vbp : 0;
	pr_debug("vbp_fac=%d vbp=%d v_total=%d\n", vbp_fac, vbp, v_total);
+25 −4
Original line number Diff line number Diff line
@@ -1156,7 +1156,7 @@ static void mdss_mdp_fetch_start_config(struct mdss_mdp_video_ctx *ctx,

	if (!mdss_mdp_fetch_programable(ctl)) {
		pr_debug("programmable fetch is not needed/supported\n");
		ctl->prg_fet = false;
		ctl->prg_fet = 0;
		return;
	}

@@ -1166,20 +1166,39 @@ static void mdss_mdp_fetch_start_config(struct mdss_mdp_video_ctx *ctx,
	 */
	v_total = mdss_panel_get_vtotal(pinfo);
	h_total = mdss_panel_get_htotal(pinfo, true);
	fetch_start = (v_total - mdss_mdp_max_fetch_lines(pinfo)) * h_total + 1;
	ctl->prg_fet = pinfo->lcdc.v_front_porch;
	if (ctl->prg_fet > MDSS_MDP_MAX_FETCH)
		ctl->prg_fet = MDSS_MDP_MAX_FETCH;
	fetch_start = (v_total - ctl->prg_fet) * h_total + 1;
	fetch_enable = BIT(31);

	if (pinfo->dynamic_fps && (pinfo->dfps_update ==
			DFPS_IMMEDIATE_CLK_UPDATE_MODE))
		fetch_enable |= BIT(23);

	ctl->prg_fet = true;

	pr_debug("ctl:%d, fetch start=%d\n", ctl->num, fetch_start);
	mdp_video_write(ctx, MDSS_MDP_REG_INTF_PROG_FETCH_START, fetch_start);
	mdp_video_write(ctx, MDSS_MDP_REG_INTF_CONFIG, fetch_enable);
}

static void mdss_mdp_handoff_programmable_fetch(struct mdss_mdp_ctl *ctl,
	struct mdss_mdp_video_ctx *ctx)
{
	u32 fetch_start_handoff, v_total_handoff, h_total_handoff;
	ctl->prg_fet = 0;
	if (mdp_video_read(ctx, MDSS_MDP_REG_INTF_CONFIG) & BIT(31)) {
		fetch_start_handoff = mdp_video_read(ctx,
			MDSS_MDP_REG_INTF_PROG_FETCH_START);
		h_total_handoff = mdp_video_read(ctx,
			MDSS_MDP_REG_INTF_HSYNC_CTL) >> 16;
		v_total_handoff = mdp_video_read(ctx,
			MDSS_MDP_REG_INTF_VSYNC_PERIOD_F0)/h_total_handoff;
		ctl->prg_fet = v_total_handoff -
			((fetch_start_handoff - 1)/h_total_handoff);
		pr_debug("programmable fetch lines %d\n", ctl->prg_fet);
	}
}

static int mdss_mdp_video_ctx_setup(struct mdss_mdp_ctl *ctl,
		struct mdss_mdp_video_ctx *ctx, struct mdss_panel_info *pinfo)
{
@@ -1246,6 +1265,8 @@ static int mdss_mdp_video_ctx_setup(struct mdss_mdp_ctl *ctl,
			return -EINVAL;
		}
		mdss_mdp_fetch_start_config(ctx, ctl);
	} else {
		mdss_mdp_handoff_programmable_fetch(ctl, ctx);
	}

	mdp_video_write(ctx, MDSS_MDP_REG_INTF_PANEL_FORMAT, ctl->dst_format);
+0 −27
Original line number Diff line number Diff line
@@ -645,33 +645,6 @@ static inline int mdss_panel_get_htotal(struct mdss_panel_info *pinfo, bool
		pinfo->lcdc.h_pulse_width;
}

/**
 * mdss_mdp_max_fetch_lines: - Number of fetch lines in vertical front porch
 * @pinfo:	Pointer to panel info containing all panel information
 *
 * Returns the number of fetch lines in vertical front porch at which mdp
 * can start fetching the next frame.
 *
 * In some cases, vertical front porch is too high. In such cases limit
 * the mdp fetch lines  as the last 12 lines of vertical front porch.
 */
static inline int mdss_mdp_max_fetch_lines(struct mdss_panel_info *pinfo)
{
	int fetch_lines;
	int v_total, vfp_start;

	v_total = mdss_panel_get_vtotal(pinfo);
	vfp_start = (pinfo->lcdc.v_back_porch + pinfo->lcdc.v_pulse_width +
			pinfo->yres);

	fetch_lines = v_total - vfp_start;

	if (fetch_lines > MDSS_MDP_MAX_FETCH)
		fetch_lines = MDSS_MDP_MAX_FETCH;

	return fetch_lines;
}

int mdss_register_panel(struct platform_device *pdev,
	struct mdss_panel_data *pdata);