public inbox for dri-devel@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 00/12] irq vblank handling rework
Date: Wed, 21 May 2014 11:58:02 +0300	[thread overview]
Message-ID: <20140521085802.GN27580@intel.com> (raw)
In-Reply-To: <20140521083559.GI24095@phenom.ffwll.local>

On Wed, May 21, 2014 at 10:35:59AM +0200, Daniel Vetter wrote:
> On Wed, May 21, 2014 at 11:26:55AM +0300, Ville Syrjälä wrote:
> > For everything but the reset_vblank_counter() thing:
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > And another caveat: I only glanced at the crtc_helper stuff. It looks
> > sane but I didn't go reading through the drivers to figure out if they
> > would fall over or work.
> 
> Oh, the rfc was really just that. I don't have any plans to burn my hands
> trying to merge those patches ;-) Especially since interest from non-i915
> hackers seems to be low.
> 
> > About the reset_vblank_counter(), I think we might still need it to keep
> > the counter sane when the power well goes off. But I think we have
> > other problems on that front esp. with suspend to disk. There the counter
> > should definitely get reset on all platforms, so we migth apply any kind
> > of diff to the user visible value. The fix would likely be to skip the
> > diff adjustment when resuming.
> > 
> > I tried to take a quick look at that yesterday but there was something
> > really fishy happening as the code didn't seem to observe the wraparound
> > at all, even though I confirmed w/ intel_reg_read that it definitely
> > did appear to wrap. I'll take another look at it today.
> > 
> > Another idea might be to rip out the diff adjustment altogether. That
> > should just mean that the user visible counter wouldn't advance at all
> > between drm_vblank_off() and drm_vblank_on(). But that might actually
> > be the sane thing to do. Maybe we should just do a +1 there to make
> > sure we don't report the same value before and after modeset. It should
> > fix both the suspend problems and the power well problem.
> 
> Hm, like I've mentioned yesterday on irc the tests I have actually pass,
> at least if I throw your sanitize_crtc patch on top. vblank frame counter
> values monotonically increase across suspend/resume, runtime pm and
> anything else I manged to throw at it. And the limit in the test is 100
> frames later, but I've only observed a few tens at most.
> 
> So I think the code as-is actually works. Whether intentional or not is
> still under dispute though ;-)
> 
> The real problem I have with the hsw counter reset is that the same issue
> should affect _any_ platform where we support runtime pm. Like snb or byt.
> But the code isn't there. Also if we have such a bug then it will also
> affect hibernate and suspend to disk. Which means that this should be done
> in drm_crtc_vblank_off/on, not in the guts of some random platforms
> runtime pm code.
> 
> So in my opinion the hsw vblank_count reset code needs to go anyway
> because:
> - Either it isn't need any more (and we have the tests for this now) and
>   it's just cargo-culted duct-tape.
> - Or we need, but then it's in the wrong spot.
> 
> Given that can you reconsider that patch please?

Yeah. So as discussed on irc I think the right fix would be to sample
the current counter in drm_vblank_on(), stick it into
dev->vblank[crtc].last, but skip the diff adjustment to the user visible
counter (maybe just +1 to make sure we never report the same value on
both sides of a modeset). That should cover both the suspend case and the
power well case. I can go and experiment with this a bit...

So I agree that the current code isn't the way things should be done.
And since I now have an idea how it should be done, I'm fine with
ripping the current thing out. So you can add:
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-05-21  8:58 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 18:51 [PATCH 00/12] irq vblank handling rework Daniel Vetter
2014-05-14 18:51 ` [PATCH 01/12] drm: Use correct spinlock flavor in drm_vblank_get() Daniel Vetter
2014-05-21 11:08   ` Thierry Reding
2014-05-14 18:51 ` [PATCH 02/12] drm: Make the vblank disable timer per-crtc Daniel Vetter
2014-05-21 11:17   ` Thierry Reding
2014-05-21 12:10     ` Daniel Vetter
2014-05-14 18:51 ` [PATCH 03/12] drm: Make blocking vblank wait return when the vblank interrupts get disabled Daniel Vetter
2014-05-21 11:20   ` Thierry Reding
2014-05-21 11:24     ` Thierry Reding
2014-05-14 18:51 ` [PATCH 04/12] drm: Add drm_vblank_on() Daniel Vetter
2014-05-14 18:55   ` Daniel Vetter
2014-05-21 11:32   ` Thierry Reding
2014-05-21 12:15     ` Daniel Vetter
2014-05-14 18:51 ` [PATCH 05/12] drm/i915: Remove drm_vblank_pre/post_modeset calls Daniel Vetter
2014-05-21 11:40   ` Thierry Reding
2014-05-14 18:51 ` [PATCH 06/12] drm/doc: Discourage usage of MODESET_CTL ioctl Daniel Vetter
2014-05-15  4:27   ` Michel Dänzer
2014-05-15 13:00   ` [PATCH] " Daniel Vetter
2014-05-15 20:36     ` Laurent Pinchart
2014-05-14 18:51 ` [PATCH 07/12] drm/irq: kerneldoc polish Daniel Vetter
2014-05-15  4:44   ` Michel Dänzer
2014-05-15  9:55     ` Daniel Vetter
2014-05-15  7:21   ` Thierry Reding
2014-05-15 13:00   ` [PATCH] " Daniel Vetter
2014-05-14 18:51 ` [PATCH 08/12] drm/irq: Add kms-native crtc interface functions Daniel Vetter
2014-05-15  7:34   ` Thierry Reding
2014-05-15 10:10     ` Daniel Vetter
2014-05-15 10:42       ` Thierry Reding
2014-05-15 11:11         ` Daniel Vetter
2014-05-15 13:34   ` [PATCH 1/2] " Daniel Vetter
2014-05-15 13:34     ` [PATCH 2/2] drm/i915: Use new kms-native vblank functions Daniel Vetter
2014-05-14 18:51 ` [PATCH 09/12] drm/i915: rip our vblank reset hacks for runtime PM Daniel Vetter
2014-05-20 12:03   ` [Intel-gfx] " Ville Syrjälä
2014-05-20 13:38     ` Daniel Vetter
2014-05-20 14:03       ` Ville Syrjälä
2014-05-20 14:20         ` Daniel Vetter
2014-05-20 15:17           ` Daniel Vetter
2014-05-21 12:49     ` Thierry Reding
2014-05-14 18:51 ` [PATCH 09/12] drm/irq: Lack of interrupt support in drm_vblank_on|off Daniel Vetter
2014-05-21 12:49   ` Thierry Reding
2014-05-14 18:51 ` [PATCH 10/12] drm/i915: Accurately initialize fifo underrun state on gmch platforms Daniel Vetter
2014-05-14 18:51 ` [PATCH 10/12] drm/i915: rip our vblank reset hacks for runtime PM Daniel Vetter
2014-05-14 18:51 ` [PATCH 11/12] drm/i915: Accurately initialize fifo underrun state on gmch platforms Daniel Vetter
2014-05-14 19:39   ` Imre Deak
2014-05-14 18:51 ` [PATCH 11/12] [RFC] drm/irq: More robustness in drm_vblank_on|off Daniel Vetter
2014-05-21 12:53   ` Thierry Reding
2014-05-21 13:11     ` Daniel Vetter
2014-05-14 18:51 ` [PATCH 12/12] [RFC] drm/crtc-helper: Enforce sane vblank counter semantics Daniel Vetter
2014-05-21  8:26 ` [PATCH 00/12] irq vblank handling rework Ville Syrjälä
2014-05-21  8:35   ` Daniel Vetter
2014-05-21  8:58     ` Ville Syrjälä [this message]
2014-05-21 12:55     ` Thierry Reding

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=20140521085802.GN27580@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox