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

Commit daf2bd0c authored by Ingrid Gallardo's avatar Ingrid Gallardo Committed by Gerrit - the friendly Code Review server
Browse files

msm: mdss: add bandwidth check per pipe



Add check to verify that the bandwidth of a pipe does not exceed
the threshold per pipe. The check happens during the overlay setup
and if the pipe exceed the limit, the driver will try to decimate to
reduce the bandwidth; but even if after decimation the limit is
exceeded, it will fail the configuration.

Change-Id: I7ad3654126a503e41540fca250276d564aecccdd
Signed-off-by: default avatarIngrid Gallardo <ingridg@codeaurora.org>
parent 54967700
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -318,6 +318,9 @@ Fudge Factors: Fudge factors are used to boost demand for
				applied in scenarios where panel interface can
				be more tolerant to memory latency such as
				command mode panels.
- qcom,max-bandwidth-per-pipe-kbps: This value indicates the max bandwidth in KB
				that a single pipe can support without underflow.

Optional subnodes:
Child nodes representing the frame buffer virtual devices.

+1 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ struct mdss_data_type {
	struct msm_bus_scale_pdata *bus_scale_table;
	u32 max_bw_low;
	u32 max_bw_high;
	u32 max_bw_per_pipe;

	struct mdss_fudge_factor ab_factor;
	struct mdss_fudge_factor ib_factor;
+5 −0
Original line number Diff line number Diff line
@@ -2341,6 +2341,11 @@ static int mdss_mdp_parse_dt_misc(struct platform_device *pdev)
	if (rc)
		pr_debug("max bandwidth (high) property not specified\n");

	rc = of_property_read_u32(pdev->dev.of_node,
		"qcom,max-bandwidth-per-pipe-kbps", &mdata->max_bw_per_pipe);
	if (rc)
		pr_debug("max bandwidth (per pipe) property not specified\n");

	return 0;
}

+2 −0
Original line number Diff line number Diff line
@@ -577,6 +577,8 @@ int mdss_mdp_ctl_intf_event(struct mdss_mdp_ctl *ctl, int event, void *arg);
int mdss_mdp_perf_bw_check(struct mdss_mdp_ctl *ctl,
		struct mdss_mdp_pipe **left_plist, int left_cnt,
		struct mdss_mdp_pipe **right_plist, int right_cnt);
int mdss_mdp_perf_bw_check_pipe(struct mdss_mdp_perf_params *perf,
		struct mdss_mdp_pipe *pipe);
int mdss_mdp_perf_calc_pipe(struct mdss_mdp_pipe *pipe,
	struct mdss_mdp_perf_params *perf, struct mdss_mdp_img_rect *roi,
	bool apply_fudge);
+33 −0
Original line number Diff line number Diff line
@@ -679,6 +679,39 @@ int mdss_mdp_perf_bw_check(struct mdss_mdp_ctl *ctl,
	return 0;
}

int mdss_mdp_perf_bw_check_pipe(struct mdss_mdp_perf_params *perf,
		struct mdss_mdp_pipe *pipe)
{
	struct mdss_data_type *mdata = pipe->mixer->ctl->mdata;
	struct mdss_mdp_ctl *ctl = pipe->mixer->ctl;
	u32 vbp_fac, threshold;
	u64 prefill_bw, pipe_bw;

	/* we only need bandwidth check on real-time clients (interfaces) */
	if (ctl->intf_type == MDSS_MDP_NO_INTF)
		return 0;

	vbp_fac = mdss_mdp_get_vbp_factor_max(ctl);
	prefill_bw = perf->prefill_bytes * vbp_fac;
	pipe_bw = max(prefill_bw, perf->bw_overlap);
	pr_debug("prefill=%llu, vbp_fac=%u, overlap=%llu\n",
			prefill_bw, vbp_fac, perf->bw_overlap);

	/* convert bandwidth to kb */
	pipe_bw = DIV_ROUND_UP_ULL(pipe_bw, 1000);

	threshold = mdata->max_bw_per_pipe;
	pr_debug("bw=%llu threshold=%u\n", pipe_bw, threshold);

	if (threshold && pipe_bw > threshold) {
		pr_debug("pipe exceeds bandwidth: %llukb > %ukb\n", pipe_bw,
				threshold);
		return -E2BIG;
	}

	return 0;
}

static void mdss_mdp_perf_calc_ctl(struct mdss_mdp_ctl *ctl,
		struct mdss_mdp_perf_params *perf)
{
Loading