Skip to contentSkip to conversation

drm/i915: don't frob the vblank ts in finish_page_flip

PATCH In review Daniel Vetter 3 participants 3 messages Oct 2, 2012 – Oct 3, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: don't frob the vblank ts in finish_page_flip

Now that we correctly generate it, this hack is no longer required (and might actually paper over a serious bug).

pageflip timestamps are sanity check in the latest version of the flip-test in intel-gpu-tools.

v2: Also remove the gettimeofday(&now) which is no longer used. Noticed by Mario Kleiner.

---
 drivers/gpu/drm/i915/intel_display.c |   23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -22
index 57c1309..67912fe 100644
@@ -6181,15 +6181,13 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
 	struct intel_unpin_work *work;
 	struct drm_i915_gem_object *obj;
 	struct drm_pending_vblank_event *e;
-	struct timeval tnow, tvbl;
+	struct timeval tvbl;
 	unsigned long flags;
 
 	/* Ignore early vblank irqs */
 	if (intel_crtc == NULL)
 		return;
 
-	do_gettimeofday(&tnow);
-
 	spin_lock_irqsave(&dev->event_lock, flags);
 	work = intel_crtc->unpin_work;
 	if (work == NULL || !work->pending) {
@@ -6203,25 +6201,6 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
 		e = work->event;
 		e->event.sequence = drm_vblank_count_and_time(dev, intel_crtc->pipe, &tvbl);
 
-		/* Called before vblank count and timestamps have
-		 * been updated for the vblank interval of flip
-		 * completion? Need to increment vblank count and
-		 * add one videorefresh duration to returned timestamp
-		 * to account for this. We assume this happened if we
-		 * get called over 0.9 frame durations after the last
-		 * timestamped vblank.
-		 *
-		 * This calculation can not be used with vrefresh rates
-		 * below 5Hz (10Hz to be on the safe side) without
-		 * promoting to 64 integers.
-		 */
-		if (10 * (timeval_to_ns(&tnow) - timeval_to_ns(&tvbl)) >
-		    9 * crtc->framedur_ns) {
-			e->event.sequence++;
-			tvbl = ns_to_timeval(timeval_to_ns(&tvbl) +
-					     crtc->framedur_ns);
-		}
-
 		e->event.tv_sec = tvbl.tv_sec;
 		e->event.tv_usec = tvbl.tv_usec;
 
Signature · 1 line
1.7.10
Tested-by on v1 1/1
#1 lore raw
Quoted 10 lines · Daniel Vetter

Now that we correctly generate it, this hack is no longer required (and might actually paper over a serious bug).

pageflip timestamps are sanity check in the latest version of the flip-test in intel-gpu-tools.

v2: Also remove the gettimeofday(&now) which is no longer used. Noticed by Mario Kleiner.

Quoted 51 lines
---
 drivers/gpu/drm/i915/intel_display.c |   23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -22
index 57c1309..67912fe 100644
@@ -6181,15 +6181,13 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
 	struct intel_unpin_work *work;
 	struct drm_i915_gem_object *obj;
 	struct drm_pending_vblank_event *e;
-	struct timeval tnow, tvbl;
+	struct timeval tvbl;
 	unsigned long flags;
 
 	/* Ignore early vblank irqs */
 	if (intel_crtc == NULL)
 		return;
 
-	do_gettimeofday(&tnow);
-
 	spin_lock_irqsave(&dev->event_lock, flags);
 	work = intel_crtc->unpin_work;
 	if (work == NULL || !work->pending) {
@@ -6203,25 +6201,6 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
 		e = work->event;
 		e->event.sequence = drm_vblank_count_and_time(dev, intel_crtc->pipe, &tvbl);
 
-		/* Called before vblank count and timestamps have
-		 * been updated for the vblank interval of flip
-		 * completion? Need to increment vblank count and
-		 * add one videorefresh duration to returned timestamp
-		 * to account for this. We assume this happened if we
-		 * get called over 0.9 frame durations after the last
-		 * timestamped vblank.
-		 *
-		 * This calculation can not be used with vrefresh rates
-		 * below 5Hz (10Hz to be on the safe side) without
-		 * promoting to 64 integers.
-		 */
-		if (10 * (timeval_to_ns(&tnow) - timeval_to_ns(&tvbl)) >
-		    9 * crtc->framedur_ns) {
-			e->event.sequence++;
-			tvbl = ns_to_timeval(timeval_to_ns(&tvbl) +
-					     crtc->framedur_ns);
-		}
-
 		e->event.tv_sec = tvbl.tv_sec;
 		e->event.tv_usec = tvbl.tv_usec;
 
#2 lore raw
Quoted 7 lines · Imre Deak
Quoted 6 lines · Daniel Vetter

Now that we correctly generate it, this hack is no longer required (and might actually paper over a serious bug).

pageflip timestamps are sanity check in the latest version of the flip-test in intel-gpu-tools.

Quoted 6 lines
Quoted 4 lines

v2: Also remove the gettimeofday(&now) which is no longer used. Noticed by Mario Kleiner.

Ok, I've merged these two to -fixes, thanks for testing&review. -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch