提交 855d30b4 编写于 作者: D Daniel Vetter

drm: Only update final vblank count when precise ts is available

Drivers without a hardware vblank counter simply can't account for the
vblanks that happened while the vblank interrupt was off. To check
this grab a vblank timestamp and if the result is dubious follow the
normal save-and-disable logic.

Drivers should prevent this by setting vblank_disable_allowed = false,
but since running vblank interrupts constantly is not good for power
consumption most drivers lie. Testing for precise vblank timestamps is
the next best thing we can check for.
Suggested-by: NMario Kleiner <mario.kleiner.de@gmail.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: NMario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
上级 ab8905f1
...@@ -148,8 +148,15 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc) ...@@ -148,8 +148,15 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
* has been ticking all along until this time. This makes the * has been ticking all along until this time. This makes the
* count account for the entire time between drm_vblank_on() and * count account for the entire time between drm_vblank_on() and
* drm_vblank_off(). * drm_vblank_off().
*
* But only do this if precise vblank timestamps are available.
* Otherwise we might read a totally bogus timestamp since drivers
* lacking precise timestamp support rely upon sampling the system clock
* at vblank interrupt time. Which obviously won't work out well if the
* vblank interrupt is disabled.
*/ */
if (!vblank->enabled) { if (!vblank->enabled &&
drm_get_last_vbltimestamp(dev, crtc, &tvblank, 0) > 0) {
drm_update_vblank_count(dev, crtc); drm_update_vblank_count(dev, crtc);
spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
return; return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册