From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH] drm/i915: Check the minimum pitch for the user framebuffer Date: Wed, 11 Jun 2014 12:27:31 +0200 Message-ID: <20140611102731.GH5821@phenom.ffwll.local> References: <1402435353-9155-1-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 81E4789B3B for ; Wed, 11 Jun 2014 03:27:37 -0700 (PDT) Received: by mail-we0-f177.google.com with SMTP id u56so6495322wes.8 for ; Wed, 11 Jun 2014 03:27:36 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1402435353-9155-1-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Jun 10, 2014 at 10:22:33PM +0100, Chris Wilson wrote: > Compute the smallest pitch required for a linear framebuffer and assert > that the user has declared a pitch that meets that minimum requirement. > > Signed-off-by: Chris Wilson > --- > drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index cc62b140eb1c..ef34badbe69c 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -11808,6 +11808,8 @@ static int intel_framebuffer_init(struct drm_device *dev, > { > int aligned_height; > int pitch_limit; > + int depth; > + int bpp; > int ret; > > WARN_ON(!mutex_is_locked(&dev->struct_mutex)); > @@ -11823,6 +11825,15 @@ static int intel_framebuffer_init(struct drm_device *dev, > return -EINVAL; > } > > + drm_fb_get_bpp_depth(mode_cmd->pixel_format, &bpp, &depth); > + if (mode_cmd->pitches[0] < intel_framebuffer_pitch_for_width(mode_cmd->width, > + bpp)) { Won't this foul up universal planes? Iirc we have a minimal pitch of 128b somewhere, but cursors are happy with 64. Also not sure about overlays/planes. If this blows up I guess we need to patch up the setplane/cursor functions correctly. -Daniel > + DRM_DEBUG("pitch (%d) must be at least the linear stride (%d)\n", > + mode_cmd->pitches[0], > + intel_framebuffer_pitch_for_width(mode_cmd->width, bpp)); > + return -EINVAL; > + } > + > if (INTEL_INFO(dev)->gen >= 5 && !IS_VALLEYVIEW(dev)) { > pitch_limit = 32*1024; > } else if (INTEL_INFO(dev)->gen >= 4) { > -- > 2.0.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch