drm/i915: Complain if we take too long under vblank evasion.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 28 Feb 2017 14:28:48 +0000 (15:28 +0100)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Mon, 6 Mar 2017 12:05:18 +0000 (13:05 +0100)
Instead of only complaining when we actually miss a vblank, always
complain if we take longer than 100 us. This will make it easier to
find cases where we potentially miss vblanks.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1488292128-14540-2-git-send-email-maarten.lankhorst@linux.intel.com
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[mlankhorst: Add commit message.]

drivers/gpu/drm/i915/intel_sprite.c

index 27e0752d157882089f3fc79c9a7505d80b8c873c..375ca91b308c9bf6c2b7c1c17180060fc76a2380 100644 (file)
@@ -65,6 +65,8 @@ int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
                            1000 * adjusted_mode->crtc_htotal);
 }
 
+#define VBLANK_EVASION_TIME_US 100
+
 /**
  * intel_pipe_update_start() - start update of a set of display registers
  * @crtc: the crtc of which the registers are going to be updated
@@ -92,7 +94,8 @@ void intel_pipe_update_start(struct intel_crtc *crtc)
                vblank_start = DIV_ROUND_UP(vblank_start, 2);
 
        /* FIXME needs to be calibrated sensibly */
-       min = vblank_start - intel_usecs_to_scanlines(adjusted_mode, 100);
+       min = vblank_start - intel_usecs_to_scanlines(adjusted_mode,
+                                                     VBLANK_EVASION_TIME_US);
        max = vblank_start - 1;
 
        local_irq_disable();
@@ -191,7 +194,12 @@ void intel_pipe_update_end(struct intel_crtc *crtc, struct intel_flip_work *work
                          ktime_us_delta(end_vbl_time, crtc->debug.start_vbl_time),
                          crtc->debug.min_vbl, crtc->debug.max_vbl,
                          crtc->debug.scanline_start, scanline_end);
-       }
+       } else if (ktime_us_delta(end_vbl_time, crtc->debug.start_vbl_time) >
+                  VBLANK_EVASION_TIME_US)
+               DRM_WARN("Atomic update on pipe (%c) took %lld us, max time under evasion is %u us\n",
+                        pipe_name(pipe),
+                        ktime_us_delta(end_vbl_time, crtc->debug.start_vbl_time),
+                        VBLANK_EVASION_TIME_US);
 }
 
 static void