Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1498906 > unrolled thread

[PATCH 4/8] drm: mali-dp: Add pitch alignment check for planes

Started byBrian Starkey <brian.starkey@arm.com>
First post2016-10-11 16:30 +0200
Last post2016-10-11 16:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/8] drm: mali-dp: Add pitch alignment check for planes Brian Starkey <brian.starkey@arm.com> - 2016-10-11 16:30 +0200

#1498906 — [PATCH 4/8] drm: mali-dp: Add pitch alignment check for planes

FromBrian Starkey <brian.starkey@arm.com>
Date2016-10-11 16:30 +0200
Subject[PATCH 4/8] drm: mali-dp: Add pitch alignment check for planes
Message-ID<sr6e5-7Rm-5@gated-at.bofh.it>
Check that the framebuffer pitches are appropriately aligned when
checking planes.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
---
 drivers/gpu/drm/arm/malidp_planes.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 82c193e..f95e02d 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -86,17 +86,30 @@ static int malidp_de_plane_check(struct drm_plane *plane,
 {
 	struct malidp_plane *mp = to_malidp_plane(plane);
 	struct malidp_plane_state *ms = to_malidp_plane_state(state);
+	struct drm_framebuffer *fb;
+	int n_planes, i;
 	u8 format_id;
 	u32 src_w, src_h;
 
 	if (!state->crtc || !state->fb)
 		return 0;
 
+	fb = state->fb;
+
 	format_id = malidp_hw_get_format_id(&mp->hwdev->map, mp->layer->id,
-					    state->fb->pixel_format);
+					    fb->pixel_format);
 	if (format_id == MALIDP_INVALID_FORMAT_ID)
 		return -EINVAL;
 
+	n_planes = drm_format_num_planes(fb->pixel_format);
+	for (i = 0; i < n_planes; i++) {
+		if (!malidp_hw_pitch_valid(mp->hwdev, fb->pitches[i])) {
+			DRM_DEBUG_KMS("Invalid pitch %u for plane %d\n",
+				      fb->pitches[i], i);
+			return -EINVAL;
+		}
+	}
+
 	src_w = state->src_w >> 16;
 	src_h = state->src_h >> 16;
 
-- 
1.7.9.5

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web