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

Commit 4a5bd78f authored by Alan Kwong's avatar Alan Kwong
Browse files

drm/msm/sde: validate framebuffer layout during prepare_fb



Current plane driver calculates framebuffer layout during
atomic commit. If framebuffer layout does not match expected
criteria, source pipe configuration will stay in last
configured value. This will cause smmu fault if the last
configured buffer is unmapped on next commit cycle.

Add layout validation to prepare_fb such that if layout
does not match expected criteria, it will abort current
atomic cycle.

Change-Id: I3f290d07f3fc215aac7627de6a9df7b3f7c89953
Signed-off-by: default avatarAlan Kwong <akwong@codeaurora.org>
parent 4416159a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2479,6 +2479,7 @@ static int sde_plane_prepare_fb(struct drm_plane *plane,
	struct drm_framebuffer *fb = new_state->fb;
	struct sde_plane *psde = to_sde_plane(plane);
	struct sde_plane_rot_state *new_rstate;
	struct sde_hw_fmt_layout layout;
	int ret;

	if (!new_state->fb)
@@ -2500,6 +2501,14 @@ static int sde_plane_prepare_fb(struct drm_plane *plane,
		return ret;
	}

	/* validate framebuffer layout before commit */
	ret = sde_format_populate_layout(new_rstate->mmu_id,
			new_rstate->out_fb, &layout);
	if (ret) {
		SDE_ERROR_PLANE(psde, "failed to get format layout, %d\n", ret);
		return ret;
	}

	return 0;
}