aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>2018-02-03 00:13:02 -0500
committerRodrigo Vivi <rodrigo.vivi@intel.com>2018-02-15 14:50:22 -0500
commit2e8bf223d8f51ffe98f7bc11522939e62ab79a55 (patch)
tree6f9c820a130e1db40432f59e7bc00fe4aafcfe6c
parentd0bb96b4be69feea97f16de5306c35e280658931 (diff)
drm/i915: Estimate and update missed vblanks.
The frame counter may have got reset between disabling and enabling vblank interrupts due to DMC putting the hardware to DC5/6 states if PSR was active. The frame counter could also have stalled if PSR was active in case there was no DMC. The frame counter resetting has a user visible impact of screen freezes. Make use of drm_vblank_restore() to compute missed vblanks for the duration in which vblank interrupts were disabled and update the vblank counter with this value as diff. There's no need to check if PSR was actually active in the interrupt disabled duration, so simplify the check to a feature check. Enabling vblank interrupts wakes up the hardware from DC5/6 and prevents it from going back again as long as the there are pending interrupts. So, we don't have to explicity disallow DC5/6 after enabling vblank interrupts to keep the counter running. This change is not applicable to CHV, as enabling interrupts does not prevent the hardware from activating PSR. v2: Added comments(Rodrigo) and rewrote commit message. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> 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-10-dhinakaran.pandiyan@intel.com
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index b886bd459acc..7617826b7705 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -2951,6 +2951,12 @@ static int ironlake_enable_vblank(struct drm_device *dev, unsigned int pipe)
2951 ilk_enable_display_irq(dev_priv, bit); 2951 ilk_enable_display_irq(dev_priv, bit);
2952 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); 2952 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
2953 2953
2954 /* Even though there is no DMC, frame counter can get stuck when
2955 * PSR is active as no frames are generated.
2956 */
2957 if (HAS_PSR(dev_priv))
2958 drm_vblank_restore(dev, pipe);
2959
2954 return 0; 2960 return 0;
2955} 2961}
2956 2962
@@ -2963,6 +2969,12 @@ static int gen8_enable_vblank(struct drm_device *dev, unsigned int pipe)
2963 bdw_enable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK); 2969 bdw_enable_pipe_irq(dev_priv, pipe, GEN8_PIPE_VBLANK);
2964 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); 2970 spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
2965 2971
2972 /* Even if there is no DMC, frame counter can get stuck when
2973 * PSR is active as no frames are generated, so check only for PSR.
2974 */
2975 if (HAS_PSR(dev_priv))
2976 drm_vblank_restore(dev, pipe);
2977
2966 return 0; 2978 return 0;
2967} 2979}
2968 2980