Quoting Ville Syrjala (2017-11-29 15:37:30) > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Previously I was under the impression that the scanline counter > reads 0 when the pipe is off. Turns out that's not correct, and > instead the scanline counter simply stops when the pipe stops, and > it retains it's last value until the pipe starts up again, at which > point the scanline counter jumps to vblank start. > > These jumps can cause the timestamp to jump backwards by one frame. > Since we use the timestamps to guesstimage also the frame counter > value on gen2, that would cause the frame counter to also jump > backwards, which leads to a massice difference from the previous value. > The end result is that flips/vblank events don't appear to complete as > they're stuck waiting for the frame counter to catch up to that massive > difference. > > Fix the problem properly by actually making sure the scanline counter > has started to move before we assume that it's safe to enable vblank > processing. > > v2: Less pointless duplication in the code (Chris) > > Cc: stable@xxxxxxxxxxxxxxx > Cc: Daniel Vetter <daniel.vetter@xxxxxxxx> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> #v1 > Fixes: b7792d8b54cc ("drm/i915: Wait for pipe to start before sampling vblank timestamps on gen2") > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> -Chris