All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zanoni, Paulo R" <paulo.r.zanoni@intel.com>
To: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/i915: fix FBC buffer size checks
Date: Thu, 1 Oct 2015 18:04:00 +0000	[thread overview]
Message-ID: <1443722639.2442.22.camel@intel.com> (raw)
In-Reply-To: <20151001122210.GF26517@intel.com>

Em Qui, 2015-10-01 às 15:22 +0300, Ville Syrjälä escreveu:
> On Wed, Sep 30, 2015 at 05:05:45PM -0300, Paulo Zanoni wrote:
> > According to my experiments (and later confirmation from the
> > hardware
> > developers), the maximum sizes mentioned in the specification
> > delimit
> > how far in the buffer the hardware tracking can go. And the
> > hardware
> > calculates the size based on the plane address we provide - and the
> > provided plane address might not be the real x:0,y:0 point due to
> > the
> > compute_page_offset() function.
> > 
> > On platforms that do the x/y offset adjustment trick it will be
> > really
> > hard to reproduce a bug, but on the current SKL we can reproduce
> > the
> > bug with igt/kms_frontbuffer_tracking/fbc-farfromfence. With this
> > patch, we'll go from "CRC assertion failure" to "FBC unexpectedly
> > disabled", which is still a failure on the test suite but is not a
> > perceived user bug - you will just not save as much power as you
> > could
> > if FBC is disabled.
> > 
> > v2, rewrite patch after clarification from the Hadware guys:
> >   - Rename function so it's clear what the check is for.
> >   - Use the new intel_fbc_get_plane_source_sizes() function in
> > order
> >     to get the proper sizes as seen by FBC.
> > 
> > Testcase: igt/kms_frontbuffer_tracking/fbc-farfromfence (SKL)
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_fbc.c | 19 ++++++++++++++-----
> >  1 file changed, 14 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_fbc.c
> > b/drivers/gpu/drm/i915/intel_fbc.c
> > index d53f73f..313ef91 100644
> > --- a/drivers/gpu/drm/i915/intel_fbc.c
> > +++ b/drivers/gpu/drm/i915/intel_fbc.c
> > @@ -805,10 +805,16 @@ static bool pixel_format_is_valid(struct
> > drm_framebuffer *fb)
> >  	}
> >  }
> >  
> > -static bool pipe_size_is_valid(struct intel_crtc *crtc)
> > +/*
> > + * For some reason, the hardware tracking starts looking at
> > whatever we
> > + * programmed as the display plane base address register. It does
> > not look at
> > + * the X and Y offset registers. That's why we look at the crtc
> > ->adjusted{x,y}
> > + * variables instead of just looking at the pipe size.
> 
> "plane size" or something

I guess we can say "pipe/plane size" because we're not looking at any
of these.

> 
> > + */
> > +static bool intel_fbc_hw_tracking_covers_screen(struct intel_crtc
> > *crtc)
> >  {
> >  	struct drm_i915_private *dev_priv = crtc->base.dev
> > ->dev_private;
> > -	unsigned int max_w, max_h;
> > +	unsigned int used_w, used_h, max_w, max_h;
> >  
> >  	if (INTEL_INFO(dev_priv)->gen >= 8 ||
> > IS_HASWELL(dev_priv)) {
> >  		max_w = 4096;
> > @@ -821,8 +827,11 @@ static bool pipe_size_is_valid(struct
> > intel_crtc *crtc)
> >  		max_h = 1536;
> >  	}
> >  
> > -	return crtc->config->pipe_src_w <= max_w &&
> > -	       crtc->config->pipe_src_h <= max_h;
> > +	intel_fbc_get_plane_source_sizes(crtc, &used_w, &used_h);
> > +	used_w += crtc->adjusted_x;
> > +	used_h += crtc->adjusted_y;
> > +
> > +	return used_w <= max_w && used_h <= max_h;
> 
> Makes sense. Not sure used_ is the best prefix. Maybe effective_ ?
> But I
> don't mind if you think used_ is better.

I agree used_ is not very good. I changed my mind a few times on these
names already.

> 
> So with the comment fixed a bit this is
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> You know, we could avoid these issues if we stopped using hw gtt
> tracking too. And then we could use FBC without a fence, and hence
> wouldn't need X-tiling. IIRC that's now allowed on SKL+.

The problem with stopping the GTT tracking is that then we'd have to
completely disable FBC when GTT mmaps are being used, just like we do
for PSR. I didn't stop to check how common this is or how much power
we'd stop saving if we actually did this. Maybe I should at some point.

The other plan is to make our code support FBC both with and without
GTT tracking (so we can disable just the tracking when we conclude it
won't work). Maybe we can implement this for Kernel 5.23 :)

Thanks for the reviews. I'll send the updated versions soon.

> 
> >  }
> >  
> >  /**
> > @@ -899,7 +908,7 @@ static void __intel_fbc_update(struct
> > drm_i915_private *dev_priv)
> >  		goto out_disable;
> >  	}
> >  
> > -	if (!pipe_size_is_valid(intel_crtc)) {
> > +	if (!intel_fbc_hw_tracking_covers_screen(intel_crtc)) {
> >  		set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE);
> >  		goto out_disable;
> >  	}
> > -- 
> > 2.5.3
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-10-01 18:07 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 15:52 [PATCH 0/7] FBC again: stolen + SKL fixes Paulo Zanoni
2015-09-23 15:52 ` [PATCH 1/7] drm/i915: fix CFB size calculation Paulo Zanoni
2015-09-23 16:58   ` Chris Wilson
2015-09-24 17:07   ` Ville Syrjälä
2015-09-23 15:52 ` [PATCH 2/7] drm/i915: don't use the first stolen page on Broadwell Paulo Zanoni
2015-09-23 16:55   ` Chris Wilson
2015-09-28  8:51     ` Daniel Vetter
2015-09-23 15:52 ` [PATCH 3/7] drm/i915: don't allocate fbcon from stolen memory if it's too big Paulo Zanoni
2015-09-23 16:54   ` Chris Wilson
2015-09-28  8:54     ` Daniel Vetter
2015-09-28  9:09       ` Chris Wilson
2015-09-29 14:26         ` Daniel Vetter
2015-10-08 20:19   ` Jesse Barnes
2015-10-09  7:34     ` Daniel Vetter
2015-09-23 15:52 ` [PATCH 4/7] drm/i915: export size_is_valid() from __intel_fbc_update() Paulo Zanoni
2015-09-23 17:09   ` Chris Wilson
2015-09-28  8:59     ` Daniel Vetter
2015-09-28 12:47       ` Ville Syrjälä
2015-09-28 13:13         ` Paulo Zanoni
2015-09-28 13:38           ` Ville Syrjälä
2015-09-28 13:32         ` Daniel Vetter
2015-09-23 15:52 ` [PATCH 5/7] drm/i915: fix FBC buffer size checks Paulo Zanoni
2015-09-23 16:59   ` Chris Wilson
2015-09-30 20:10     ` Zanoni, Paulo R
2015-09-23 15:52 ` [PATCH 6/7] drm/i915: use compute_page_offset() on SKL too Paulo Zanoni
2015-09-23 17:03   ` Chris Wilson
2015-09-24  9:55     ` Tvrtko Ursulin
2015-09-24 10:16       ` Chris Wilson
2015-09-24 17:10   ` Ville Syrjälä
2015-10-12 18:19     ` Hindman, Gavin
2015-10-12 21:01       ` Ville Syrjälä
2015-09-23 15:52 ` [PATCH 7/7] drm/i915: extract fbc_supported() Paulo Zanoni
2015-09-23 17:01   ` Chris Wilson
2015-09-28  8:57     ` Daniel Vetter
2015-09-30 20:05 ` [PATCH 1/3] drm/i915: remove pre-atomic check from SKL update_primary_plane Paulo Zanoni
2015-09-30 20:05   ` [PATCH 2/3] drm/i915: fix CFB size calculation Paulo Zanoni
2015-10-01 12:14     ` Ville Syrjälä
2015-10-01 12:23       ` Ville Syrjälä
2015-10-01 17:47         ` Zanoni, Paulo R
2015-10-01 18:11           ` Ville Syrjälä
2015-10-01 22:54             ` Zanoni, Paulo R
2015-10-01 22:55               ` Paulo Zanoni
2015-10-08 21:29                 ` Ville Syrjälä
2015-09-30 20:05   ` [PATCH 3/3] drm/i915: fix FBC buffer size checks Paulo Zanoni
2015-10-01 12:22     ` Ville Syrjälä
2015-10-01 18:04       ` Zanoni, Paulo R [this message]
2015-10-01 22:57         ` Paulo Zanoni
2015-10-09  7:36           ` Daniel Vetter
2015-10-01 12:07   ` [PATCH 1/3] drm/i915: remove pre-atomic check from SKL update_primary_plane 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=1443722639.2442.22.camel@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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 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.