public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Check the minimum pitch for the user framebuffer
Date: Wed, 11 Jun 2014 13:45:25 +0300	[thread overview]
Message-ID: <20140611104525.GK27580@intel.com> (raw)
In-Reply-To: <1402435353-9155-1-git-send-email-chris@chris-wilson.co.uk>

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 <chris@chris-wilson.co.uk>
> ---
>  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)) {
> +		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;
> +	}

How come framebuffer_check() in drm_crtc.c didn't catch this?

> +
>  	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

-- 
Ville Syrjälä
Intel OTC

  parent reply	other threads:[~2014-06-11 10:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 21:22 [PATCH] drm/i915: Check the minimum pitch for the user framebuffer Chris Wilson
2014-06-11 10:27 ` Daniel Vetter
2014-06-11 10:45 ` Ville Syrjälä [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-06-11 11:40 [PATCH] drm/i915: Make the physical object coherent with GTT Ville Syrjälä
2014-06-11 11:55 ` [PATCH] drm/i915: Check the minimum pitch for the user framebuffer Chris Wilson
2014-06-11 12:00   ` Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140611104525.GK27580@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox