From: Mario Kleiner Date: Sat, 13 Sep 2014 16:25:54 +0000 (+0200) Subject: drm: Don't update vblank timestamp when the counter didn't change X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=da8f43962bd323813f7215b00b5da48ad766b9b2;p=openwrt%2Fstaging%2Fblogic.git drm: Don't update vblank timestamp when the counter didn't change If we already have a timestamp for the current vblank counter, don't update it with a new timestmap. Small errors can creep in between two timestamp queries for the same vblank count, which could be confusing to userspace when it queries the timestamp for the same vblank sequence number twice. This problem gets exposed when the vblank disable timer is not used (or is set to expire quickly) and thus we can get multiple vblank disable<->enable transition during the same frame which would all attempt to update the timestamp with the latest estimate. Testcase: igt/kms_flip/flip-vs-expired-vblank Signed-off-by: Ville Syrjälä Reviewed-by: Mario Kleiner v2:Mario: Trivial rebase on top of current drm-next (13-Sep-2014) Signed-off-by: Mario Kleiner Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 80ff94ada75e..e73cbdaa18df 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -126,6 +126,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc) DRM_DEBUG("updating vblank count on crtc %d, missed %d\n", crtc, diff); + if (diff == 0) + return; + /* Reinitialize corresponding vblank timestamp if high-precision query * available. Skip this step if query unsupported or failed. Will * reinitialize delayed at next vblank interrupt in that case.