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

Commit 860c5af2 authored by Shubhashree Dhar's avatar Shubhashree Dhar
Browse files

drm/msm/sde: validate plane ROI to be within layer mixer boundary



Add check in sde display for plane destination rectangle
so that it falls within the range of layer mixer out size.

Change-Id: I51108c1f88e6e6f89cb0ac4df886bd5daad42221
Signed-off-by: default avatarShubhashree Dhar <dhar@codeaurora.org>
parent 7b2ef2bf
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -5234,7 +5234,7 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc,
	struct drm_plane *plane;
	struct drm_display_mode *mode;

	int cnt = 0, rc = 0, mixer_width, i, z_pos;
	int cnt = 0, rc = 0, mixer_width, i, z_pos, mixer_height;

	struct sde_multirect_plane_states *multirect_plane = NULL;
	int multirect_count = 0;
@@ -5300,6 +5300,7 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc,
	drm_connector_list_iter_end(&conn_iter);

	mixer_width = sde_crtc_get_mixer_width(sde_crtc, cstate, mode);
	mixer_height = sde_crtc_get_mixer_height(sde_crtc, cstate, mode);

	_sde_crtc_setup_is_ppsplit(state);
	_sde_crtc_setup_lm_bounds(crtc, state);
@@ -5364,6 +5365,15 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc,

		cnt++;

		if ((pstate->crtc_h > mixer_height)
				|| (pstate->crtc_w > mixer_width)) {
			SDE_ERROR("plane w/h:%x*%x more than mixer w/h:%x*%x\n",
					pstate->crtc_w, pstate->crtc_h,
					mixer_width, mixer_height);
			rc = -E2BIG;
			goto end;
		}

		if (CHECK_LAYER_BOUNDS(pstate->crtc_y, pstate->crtc_h,
				mode->vdisplay) ||
		    CHECK_LAYER_BOUNDS(pstate->crtc_x, pstate->crtc_w,