diff mbox

[6/8] drm/i915: Allow up to 32KB stride on SKL+ "sprites"

Message ID 20171222192231.17981-7-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Dec. 22, 2017, 7:22 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

SKL+ "sprites" no longer have 16KB max stride limit that earlier
platforms had. Bump up the limit to 32KB.

Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Daniel Stone <daniels@collabora.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Jan. 10, 2018, 1:03 p.m. UTC | #1
On Fri, Dec 22, 2017 at 09:22:29PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> SKL+ "sprites" no longer have 16KB max stride limit that earlier
> platforms had. Bump up the limit to 32KB.
> 
> Cc: Ben Widawsky <ben@bwidawsk.net>
> Cc: Jason Ekstrand <jason@jlekstrand.net>
> Cc: Daniel Stone <daniels@collabora.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_sprite.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index cb06acff283d..94188488db05 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -865,6 +865,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
>  	struct drm_rect *src = &state->base.src;
>  	struct drm_rect *dst = &state->base.dst;
>  	const struct drm_rect *clip = &state->clip;
> +	int max_stride = INTEL_GEN(dev_priv) >= 9 ? 32768 : 16384;
>  	int hscale, vscale;
>  	int max_scale, min_scale;
>  	bool can_scale;
> @@ -885,7 +886,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
>  	}
>  
>  	/* FIXME check all gen limits */
> -	if (fb->width < 3 || fb->height < 3 || fb->pitches[0] > 16384) {
> +	if (fb->width < 3 || fb->height < 3 || fb->pitches[0] > max_stride) {
>  		DRM_DEBUG_KMS("Unsuitable framebuffer for plane\n");
>  		return -EINVAL;

Since pre-gen9 sprites are special, and since we're already validating the
overall sprite limits in intel_fb_pitch_limit I'd push this into a new if
condition like

	if (gen < 9 && pichtes[0] > KB(16)) {
  		DRM_DEBUG_KMS("Invalid stride\n");
  		return -EINVAL;
	}

With or without that bikeshed:

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Ville Syrjälä Jan. 17, 2018, 8:18 p.m. UTC | #2
On Wed, Jan 10, 2018 at 02:03:21PM +0100, Daniel Vetter wrote:
> On Fri, Dec 22, 2017 at 09:22:29PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > SKL+ "sprites" no longer have 16KB max stride limit that earlier
> > platforms had. Bump up the limit to 32KB.
> > 
> > Cc: Ben Widawsky <ben@bwidawsk.net>
> > Cc: Jason Ekstrand <jason@jlekstrand.net>
> > Cc: Daniel Stone <daniels@collabora.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_sprite.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> > index cb06acff283d..94188488db05 100644
> > --- a/drivers/gpu/drm/i915/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/intel_sprite.c
> > @@ -865,6 +865,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
> >  	struct drm_rect *src = &state->base.src;
> >  	struct drm_rect *dst = &state->base.dst;
> >  	const struct drm_rect *clip = &state->clip;
> > +	int max_stride = INTEL_GEN(dev_priv) >= 9 ? 32768 : 16384;
> >  	int hscale, vscale;
> >  	int max_scale, min_scale;
> >  	bool can_scale;
> > @@ -885,7 +886,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
> >  	}
> >  
> >  	/* FIXME check all gen limits */
> > -	if (fb->width < 3 || fb->height < 3 || fb->pitches[0] > 16384) {
> > +	if (fb->width < 3 || fb->height < 3 || fb->pitches[0] > max_stride) {
> >  		DRM_DEBUG_KMS("Unsuitable framebuffer for plane\n");
> >  		return -EINVAL;
> 
> Since pre-gen9 sprites are special, and since we're already validating the
> overall sprite limits in intel_fb_pitch_limit I'd push this into a new if
> condition like
> 
> 	if (gen < 9 && pichtes[0] > KB(16)) {
>   		DRM_DEBUG_KMS("Invalid stride\n");
>   		return -EINVAL;
> 	}

I think we'll want to clean up this mess by moving a lot of these
checks into platform specific code. We're also missing a bunch of
checks we should be doing (eg. cdclk vs. scaling limits on ilk-ivb).

> 
> With or without that bikeshed:
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index cb06acff283d..94188488db05 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -865,6 +865,7 @@  intel_check_sprite_plane(struct intel_plane *plane,
 	struct drm_rect *src = &state->base.src;
 	struct drm_rect *dst = &state->base.dst;
 	const struct drm_rect *clip = &state->clip;
+	int max_stride = INTEL_GEN(dev_priv) >= 9 ? 32768 : 16384;
 	int hscale, vscale;
 	int max_scale, min_scale;
 	bool can_scale;
@@ -885,7 +886,7 @@  intel_check_sprite_plane(struct intel_plane *plane,
 	}
 
 	/* FIXME check all gen limits */
-	if (fb->width < 3 || fb->height < 3 || fb->pitches[0] > 16384) {
+	if (fb->width < 3 || fb->height < 3 || fb->pitches[0] > max_stride) {
 		DRM_DEBUG_KMS("Unsuitable framebuffer for plane\n");
 		return -EINVAL;
 	}