OSDN Git Service

drm/i915: Fix vblank timestamp/frame counter jumps on gen2
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 29 Nov 2017 15:37:30 +0000 (17:37 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 1 Dec 2017 15:05:15 +0000 (17:05 +0200)
commit8fedd64dabc86d0f31a0d1e152be3aa23c323553
treeb46e4e66a393122fe55ba3ca6f06b94fb4b8d431
parent5816d9cbc0a0fbf232fe297cefcb85361a3cde90
drm/i915: Fix vblank timestamp/frame counter jumps on gen2

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@vger.kernel.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Fixes: b7792d8b54cc ("drm/i915: Wait for pipe to start before sampling vblank timestamps on gen2")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171129153732.3612-1-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/intel_display.c