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

Commit f1f7ec23 authored by Justin Philip's avatar Justin Philip
Browse files

msm: mdss: Allow smp change during composition switch



The composition fallback mechanism might not ensure unsetting of
the pipe whose prepare call failed due to smp configuration change,
typically in the cases where change in composition requests same
pipe. This scenario is a deadlock where composition switch does
not happen, due to these pipe failures.

To handle such cases, for changed SMP request for a pipe doing
non backend composition, allow smp configuration to happen, so
that the composition could be successfully switched, thereby
preventing the deadlock.

Change-Id: I2d29ac6591671494abc7c4caf7c6c53f058d12f6
Signed-off-by: default avatarJustin Philip <jphili@codeaurora.org>
parent 8363bc8c
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ end:
}

static u32 mdss_mdp_smp_mmb_reserve(struct mdss_mdp_pipe_smp_map *smp_map,
	size_t n)
	size_t n, bool force_alloc)
{
	u32 i, mmb;
	u32 fixed_cnt = bitmap_weight(smp_map->fixed, SMP_MB_CNT);
@@ -93,7 +93,7 @@ static u32 mdss_mdp_smp_mmb_reserve(struct mdss_mdp_pipe_smp_map *smp_map,
	 * that calls for change in smp configuration (addition/removal
	 * of smp blocks), so that fallback solution happens.
	 */
	if (i != 0 && n != i) {
	if (i != 0 && n != i && !force_alloc) {
		pr_debug("Can't change mmb config, num_blks: %zu alloc: %d\n",
			n, i);
		return 0;
@@ -256,6 +256,7 @@ int mdss_mdp_smp_reserve(struct mdss_mdp_pipe *pipe)
	struct mdss_mdp_plane_sizes ps;
	int i;
	int rc = 0, rot_mode = 0, wb_mixer = 0;
	bool force_alloc = 0;
	u32 nlines, format, seg_w;
	u16 width;

@@ -342,6 +343,13 @@ int mdss_mdp_smp_reserve(struct mdss_mdp_pipe *pipe)
	if (pipe->mixer_left->type == MDSS_MDP_MIXER_TYPE_WRITEBACK)
		wb_mixer = 1;

	/*
	 * Don't want to allow SMP changes for backend composition pipes
	 * inorder to preserve SMPs as much as possible.
	 * On the contrary for non backend composition pipes we should
	 * allow SMP allocations to prevent composition failures.
	 */
	force_alloc = !(pipe->flags & MDP_BACKEND_COMPOSITION);
	mutex_lock(&mdss_mdp_smp_lock);
	for (i = (MAX_PLANES - 1); i >= ps.num_planes; i--) {
		if (bitmap_weight(pipe->smp_map[i].allocated, SMP_MB_CNT)) {
@@ -371,7 +379,7 @@ int mdss_mdp_smp_reserve(struct mdss_mdp_pipe *pipe)
		pr_debug("reserving %d mmb for pnum=%d plane=%d\n",
				num_blks, pipe->num, i);
		reserved = mdss_mdp_smp_mmb_reserve(&pipe->smp_map[i],
			num_blks);
			num_blks, force_alloc);
		if (reserved < num_blks)
			break;
	}