All of lore.kernel.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: Detect invalid scanout pitches
Date: Mon, 24 Jun 2013 18:05:22 +0300	[thread overview]
Message-ID: <20130624150522.GL5004@intel.com> (raw)
In-Reply-To: <1371744860-20264-1-git-send-email-chris@chris-wilson.co.uk>

On Thu, Jun 20, 2013 at 05:14:20PM +0100, Chris Wilson wrote:
> Report back the user error of attempting to setup a CRTC with an invalid
> framebuffer pitch. This is trickier than it should be as on gen4, there
> is a restriction that tiled surfaces must have a stride less than 16k -
> which is less than the largest supported CRTC size.
> 
> v2: Fix the limits for gen3
> v3: Move check into intel_framebuffer_init() and fix VLV limits. (vsyrjala)
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=65099
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++++++++----
>  1 file changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 03a5ed0..ed84c57 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9223,6 +9223,7 @@ int intel_framebuffer_init(struct drm_device *dev,
>  			   struct drm_mode_fb_cmd2 *mode_cmd,
>  			   struct drm_i915_gem_object *obj)
>  {
> +	int pitch_limit;
>  	int ret;
>  
>  	if (obj->tiling_mode == I915_TILING_Y) {
> @@ -9236,10 +9237,26 @@ int intel_framebuffer_init(struct drm_device *dev,
>  		return -EINVAL;
>  	}
>  
> -	/* FIXME <= Gen4 stride limits are bit unclear */
> -	if (mode_cmd->pitches[0] > 32768) {
> -		DRM_DEBUG("pitch (%d) must be at less than 32768\n",
> -			  mode_cmd->pitches[0]);
> +	if (INTEL_INFO(dev)->gen > 4 && !IS_VALLEYVIEW(dev)) {

I believe Daniel wants to use >= for such gen checks, and I tend to
agree that it would make things a bit easier to parse.

> +		pitch_limit = 32*1024;
> +	} else if (INTEL_INFO(dev)->gen > 3) {
> +		if (obj->tiling_mode)
> +			pitch_limit = 16*1024;
> +		else
> +			pitch_limit = 32*1024;
> +	} else if (INTEL_INFO(dev)->gen > 2) {
> +		if (obj->tiling_mode)
> +			pitch_limit = 8*1024;
> +		else
> +			pitch_limit = 16*1024;
> +	} else
> +		/* XXX DSPC is limited to 4k tiled */
> +		pitch_limit = 8*1024;
> +
> +	if (mode_cmd->pitches[0] > pitch_limit) {
> +		DRM_DEBUG("%s pitch (%d) must be at less than %d\n",
> +			  obj->tiling_mode ? "tiled" : "linear",
> +			  mode_cmd->pitches[0], pitch_limit);
>  		return -EINVAL;
>  	}
>  
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2013-06-24 15:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 16:14 [PATCH] drm/i915: Detect invalid scanout pitches Chris Wilson
2013-06-24 15:05 ` Ville Syrjälä [this message]
2013-06-25 16:26   ` Chris Wilson
2013-06-25 16:29     ` Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2013-06-19 15:20 Chris Wilson
2013-06-19 15:50 ` Chris Wilson
2013-06-20  8:17   ` Ville Syrjälä
2013-06-20  9:14     ` Chris Wilson
2013-06-20 10:29       ` Ville Syrjälä
2013-06-20 12:27         ` Chris Wilson
2013-06-20 12:44           ` Ville Syrjälä
2013-06-20 13:54             ` Chris Wilson
2013-06-20 10:34       ` Ville Syrjälä

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=20130624150522.GL5004@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.