All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: intel-gfx@lists.freedesktop.org, Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH 2/2] drm/i915: repin bound framebuffers on resume
Date: Wed, 12 Jun 2013 23:41:08 +0100	[thread overview]
Message-ID: <20130612224108.GH32648@cantiga.alporthouse.com> (raw)
In-Reply-To: <20130612150651.428903ce@jbarnes-desktop>

On Wed, Jun 12, 2013 at 03:06:51PM -0700, Jesse Barnes wrote:
> On Wed, 12 Jun 2013 00:48:25 +0100
> Chris Wilson <chris@chris-wilson.co.uk> wrote:
> 
> > On Tue, Jun 11, 2013 at 04:01:21PM -0700, Stéphane Marchesin wrote:
> > > 
> > > On Tue, Jun 11, 2013 at 3:57 PM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > > > On Tue, Jun 11, 2013 at 03:49:27PM -0700, Stéphane Marchesin wrote:
> > > >> During suspend all fences are reset, including their pin_count which
> > > >> is reset to 0. However a framebuffer can be bound across
> > > >> suspend/resume, which means that when the buffer is unbound after
> > > >> resume, the pin count for the buffer will be negative. Since the
> > > >> fence pin count is now negative when available and zero when in use,
> > > >> the buffer's fence will get recycled when the fence is in use which
> > > >> is the opposite of what we want. The visible effect is that since the
> > > >> fence is recycled the tiling mode goes away while the buffer is being
> > > >> displayed and we get lines/screens of garbage.
> > > >>
> > > >> To fix this, we repin the fences for all bound fbs on resume, which
> > > >> ensures the pin count is right.
> > > >
> > > > Yikes. So why do we not just keep the fences alive during suspend (not
> > > > touching their pin_count), and then just iterate over the list of fences
> > > > rewriting the register as required upon resume? That would seem less
> > > > error prone than trying to reconstruct the lost pin_count.
> > > 
> > > I suspect they'd need to be saved/restored at the hw level as well,
> > > which AFAICS isn't happening today...
> > 
> > Ugh, I introduced this bug 30 months ago - saved by the VT switch on
> > resume. But we can restore the fences from dev_priv->fence_regs...
> > Actually we have a very similar problem after a GPU reset where we
> > should restore fences for pinned objects (i.e. the scanout). The patch
> > to fix both looks fairly straightforward.
> 
> To be clear, this only affects gen3 right?  For gen4+ we don't need the
> fences for scanout since we have a bit in the plane control...

True, you will only get scanout corruption from lack of a fence on gen2/3.
FBC will also be more broken than before.
 
> Or are we failing to fault on a previously mapped scanout too?  If so,
> we'd need to cover more than just scanout here.

They all get faulted in again, and all will grab a fence again. Only
scanouts pinned at the time of resume will believe that they hold an
additional reference to the fence, and so unpin it once too often. If we
do that enough times, we will starve ourselves of fences. And a gen3
scanout runs the risk of losing its fence at any time.

So the impact is far less severe than it appears at first glance. Unless
I've missed something.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

  reply	other threads:[~2013-06-12 22:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 22:49 [PATCH 1/2] drm/i915: tune the RC6 threshold for stability Stéphane Marchesin
2013-06-11 22:49 ` [PATCH 2/2] drm/i915: repin bound framebuffers on resume Stéphane Marchesin
2013-06-11 22:57   ` Chris Wilson
2013-06-11 23:01     ` Stéphane Marchesin
2013-06-11 23:48       ` Chris Wilson
2013-06-12  9:15         ` [PATCH] drm/i915: Restore fences after resume and GPU resets Chris Wilson
2013-06-12 20:51           ` Daniel Vetter
2013-06-12 22:06         ` [PATCH 2/2] drm/i915: repin bound framebuffers on resume Jesse Barnes
2013-06-12 22:41           ` Chris Wilson [this message]
2013-06-14 19:12           ` Stéphane Marchesin
2013-06-14 19:21             ` Daniel Vetter
2013-06-12  9:41 ` [PATCH 1/2] drm/i915: tune the RC6 threshold for stability Chris Wilson
2013-06-14 19:13   ` Stéphane Marchesin
2013-06-14 19:32     ` Daniel Vetter
2013-06-20  0:43       ` Stéphane Marchesin

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=20130612224108.GH32648@cantiga.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jbarnes@virtuousgeek.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.