Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 02/12] drm/i915/fbc: Use the correct plane stride
Date: Mon, 4 May 2020 17:33:56 +0300	[thread overview]
Message-ID: <20200504143356.GB6112@intel.com> (raw)
In-Reply-To: <20200502001613.GK188376@mdroper-desk1.amr.corp.intel.com>

On Fri, May 01, 2020 at 05:16:13PM -0700, Matt Roper wrote:
> On Wed, Apr 29, 2020 at 06:29:21PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Consult the actual plane stride instead of the fb stride. The two
> > will disagree when we remap the gtt. The plane stride is what the
> > hw will be fed so that's what we should look at for the FBC
> > retrictions/cfb allocation.
> > 
> > Since we no longer require a fence we are going to attempt using
> > FBC with remapping, and so we should look at correct stride.
> > 
> > With 90/270 degree rotation the plane stride is stored in units
> > of pixels, so we need to conver it to bytes for the purposes
> > of calculating the cfb stride. Not entirely sure if this matches
> > the hw behaviour though. Need to reverse engineer that at some
> > point...
> > 
> > We also need to reorder the pixel format check vs. stride check
> > to avoid triggering a spurious WARN(stride & 63) with cpp==1 and
> > plane stride==32.
> > 
> > v2: Try to deal with rotated stride and related WARN
> > 
> > Cc: José Roberto de Souza <jose.souza@intel.com>
> > Fixes: 691f7ba58d52 ("drm/i915/display/fbc: Make fences a nice-to-have for GEN9+")
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_fbc.c | 16 ++++++++++------
> >  1 file changed, 10 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c
> > index 7194f9bc62c5..7f2b2382b813 100644
> > --- a/drivers/gpu/drm/i915/display/intel_fbc.c
> > +++ b/drivers/gpu/drm/i915/display/intel_fbc.c
> > @@ -707,9 +707,13 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
> >  	cache->plane.pixel_blend_mode = plane_state->hw.pixel_blend_mode;
> >  
> >  	cache->fb.format = fb->format;
> > -	cache->fb.stride = fb->pitches[0];
> >  	cache->fb.modifier = fb->modifier;
> >  
> > +	/* FIXME is this correct? */
> > +	cache->fb.stride = plane_state->color_plane[0].stride;
> 
> We still have a comment in intel_fbc_calculate_cfb_size() that indicates
> that we need to use the framebuffer stride instead of the plane stride
> (explicitly added in commit 850bfaab7120a).

That's not really what it's saying. full buffer stride == plane stride,
vs. active area == plane width

> The bspec (page 49227) uses
> terminology "Stride of plane uncompressed surface" which sounds like
> framebuffer size to me; I'm not sure if switching it to the plane's size
> will cause problems if the plane is only scanning out a subregion of the
> framebuffer?

There is no framebuffer stride as far as the hardware is concerned.
There is only plane width and plane stride.

> 
> If it really is safe to use the plane size instead of the framebuffer
> size, then I think we at least need to remove or change that comment
> too.
> 
> 
> Matt
> 
> > +	if (drm_rotation_90_or_270(plane_state->hw.rotation))
> > +		cache->fb.stride *= fb->format->cpp[0];
> > +
> >  	drm_WARN_ON(&dev_priv->drm, plane_state->flags & PLANE_HAS_FENCE &&
> >  		    !plane_state->vma->fence);
> >  
> > @@ -804,6 +808,11 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
> >  		return false;
> >  	}
> >  
> > +	if (!pixel_format_is_valid(dev_priv, cache->fb.format->format)) {
> > +		fbc->no_fbc_reason = "pixel format is invalid";
> > +		return false;
> > +	}
> > +
> >  	if (!rotation_is_valid(dev_priv, cache->fb.format->format,
> >  			       cache->plane.rotation)) {
> >  		fbc->no_fbc_reason = "rotation unsupported";
> > @@ -820,11 +829,6 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
> >  		return false;
> >  	}
> >  
> > -	if (!pixel_format_is_valid(dev_priv, cache->fb.format->format)) {
> > -		fbc->no_fbc_reason = "pixel format is invalid";
> > -		return false;
> > -	}
> > -
> >  	if (cache->plane.pixel_blend_mode != DRM_MODE_BLEND_PIXEL_NONE &&
> >  	    cache->fb.format->has_alpha) {
> >  		fbc->no_fbc_reason = "per-pixel alpha blending is incompatible with FBC";
> > -- 
> > 2.24.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Matt Roper
> Graphics Software Engineer
> VTT-OSGC Platform Enablement
> Intel Corporation
> (916) 356-2795

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-05-04 14:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 10:10 [Intel-gfx] [PATCH 00/12] drm/i915: FBC fixes Ville Syrjala
2020-04-29 10:10 ` [Intel-gfx] [PATCH 01/12] drm/i915/fbc: Require linear fb stride to be multiple of 512 bytes on gen9/glk Ville Syrjala
2020-05-01  1:03   ` Matt Roper
2020-04-29 10:10 ` [Intel-gfx] [PATCH 02/12] drm/i915/fbc: Use the correct plane stride Ville Syrjala
2020-04-29 15:29   ` [Intel-gfx] [PATCH v2 " Ville Syrjala
2020-05-02  0:16     ` Matt Roper
2020-05-04 14:33       ` Ville Syrjälä [this message]
2020-04-29 10:10 ` [Intel-gfx] [PATCH 03/12] drm/i915/fbc: Fix fence_y_offset handling Ville Syrjala
2020-05-02  0:33   ` Matt Roper
2020-04-29 10:10 ` [Intel-gfx] [PATCH 04/12] drm/i915/fbc: Fix nuke for pre-snb platforms Ville Syrjala
2020-05-02  1:18   ` Matt Roper
2020-05-04 15:02     ` Ville Syrjälä
2020-04-29 10:10 ` [Intel-gfx] [PATCH 05/12] drm/i915/fbc: Enable fbc on i865 Ville Syrjala
2020-04-29 10:10 ` [Intel-gfx] [PATCH 06/12] drm/i915/fbc: Don't clear busy_bits for origin==GTT Ville Syrjala
2020-06-25  1:04   ` Souza, Jose
2020-04-29 10:10 ` [Intel-gfx] [PATCH 07/12] drm/i915/fbc: Allow FBC to recompress after a 3D workload on i85x/i865 Ville Syrjala
2020-04-29 10:10 ` [Intel-gfx] [PATCH 08/12] drm/i915/fbc: Parametrize FBC_CONTROL Ville Syrjala
2020-06-25  0:41   ` Souza, Jose
2020-04-29 10:10 ` [Intel-gfx] [PATCH 09/12] drm/i915/fbc: Store the fbc1 compression interval in the params Ville Syrjala
2020-06-25  0:47   ` Souza, Jose
2020-04-29 10:10 ` [Intel-gfx] [PATCH 10/12] drm/i915/fbc: Reduce fbc1 compression interval to 1 second Ville Syrjala
2020-06-25  0:49   ` Souza, Jose
2020-04-29 10:10 ` [Intel-gfx] [PATCH 11/12] drm/i915: Fix g4x fbc watermark enable Ville Syrjala
2020-06-25  1:04   ` Souza, Jose
2020-04-29 10:10 ` [Intel-gfx] [PATCH 12/12] drm/i915: Suppress spurious underruns on gen2 Ville Syrjala
2020-06-25  0:59   ` Souza, Jose
2020-04-29 11:04 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: FBC fixes Patchwork
2020-04-29 13:44 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-04-29 17:27 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: FBC fixes (rev2) Patchwork
2020-04-29 23:22 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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=20200504143356.GB6112@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    /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