Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752782AbcJKO05 (ORCPT ); Tue, 11 Oct 2016 10:26:57 -0400 Received: from foss.arm.com ([217.140.101.70]:34590 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752071AbcJKO0z (ORCPT ); Tue, 11 Oct 2016 10:26:55 -0400 From: Brian Starkey To: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, liviu.dudau@arm.com Subject: [PATCH 4/8] drm: mali-dp: Add pitch alignment check for planes Date: Tue, 11 Oct 2016 15:26:05 +0100 Message-Id: <1476195969-23655-4-git-send-email-brian.starkey@arm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1476195969-23655-1-git-send-email-brian.starkey@arm.com> References: <1476195969-23655-1-git-send-email-brian.starkey@arm.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1344 Lines: 46 Check that the framebuffer pitches are appropriately aligned when checking planes. Signed-off-by: Brian Starkey --- 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