OSDN Git Service

drm/vblank: Restoring vblank counts after device PM events.
authorDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Sat, 3 Feb 2018 05:13:01 +0000 (21:13 -0800)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 15 Feb 2018 19:50:14 +0000 (11:50 -0800)
commitd0bb96b4be69feea97f16de5306c35e280658931
tree3c9016ad4c3087d2bba13f4c783b43b15c54eb36
parent68036b08b91bc491ccc308f902616a570a49227c
drm/vblank: Restoring vblank counts after device PM events.

The HW frame counter can get reset if device enters a low power state after
vblank interrupts were disabled. This messes up any following vblank count
update as a negative diff (huge unsigned diff) is calculated from the HW
frame counter change. We cannot ignore negative diffs altogther as there
could be legitimate wrap arounds. So, allow drivers to update vblank->count
with missed vblanks for the time interrupts were disabled. This is similar
to _crtc_vblank_on() except that vblanks interrupts are not enabled at the
end as this function is expected to be called from the driver
_enable_vblank() vfunc.

v2: drm_crtc_vblank_restore should take crtc as arg. (Chris)
    Add docs and sprinkle some asserts.

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180203051302.9974-9-dhinakaran.pandiyan@intel.com
drivers/gpu/drm/drm_vblank.c
include/drm/drm_vblank.h