drm/i915: Use new frontbuffer bits to increase pll clock
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 18 Jun 2014 11:59:13 +0000 (13:59 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 19 Jun 2014 16:13:40 +0000 (18:13 +0200)
The downclocking checks a few more things, so not that simple to
convert. Also, this should get unified with the drrs handling and also
use the locking of that. Otoh the drrs locking is about as hapzardous
as no locking, at least on first sight.

For easier conversion ditch the upclocking on unload - we'll turn off
everything anyway.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_display.c

index 264de5b040b12a8a185369d5c8f4b1f4b4e09192..17e90b371dbee97ff58d0022923d4a8089d6c6ad 100644 (file)
@@ -1612,6 +1612,8 @@ struct drm_i915_gem_object_ops {
        (1 << (2 +(INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
 #define INTEL_FRONTBUFFER_OVERLAY(pipe) \
        (1 << (3 +(INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))))
+#define INTEL_FRONTBUFFER_ALL_MASK(pipe) \
+       (0xf << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))
 
 struct drm_i915_gem_object {
        struct drm_gem_object base;
index ae24829f799f6b6f91fbb9784f0128b58eb90d2b..9a3fa90660f4e8adcacedf4107563ff164ce6e99 100644 (file)
@@ -76,7 +76,8 @@ static const uint32_t intel_cursor_formats[] = {
 #define DIV_ROUND_CLOSEST_ULL(ll, d)   \
 ({ unsigned long long _tmp = (ll)+(d)/2; do_div(_tmp, d); _tmp; })
 
-static void intel_increase_pllclock(struct drm_crtc *crtc);
+static void intel_increase_pllclock(struct drm_device *dev,
+                                   enum pipe pipe);
 static void intel_crtc_update_cursor(struct drm_crtc *crtc, bool on);
 
 static void i9xx_crtc_clock_get(struct intel_crtc *crtc,
@@ -2585,7 +2586,7 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
 
        if (dev_priv->display.disable_fbc)
                dev_priv->display.disable_fbc(dev);
-       intel_increase_pllclock(crtc);
+       intel_increase_pllclock(dev, to_intel_crtc(crtc)->pipe);
 
        dev_priv->display.update_primary_plane(crtc, fb, x, y);
 
@@ -8721,12 +8722,10 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
        return mode;
 }
 
-static void intel_increase_pllclock(struct drm_crtc *crtc)
+static void intel_increase_pllclock(struct drm_device *dev,
+                                   enum pipe pipe)
 {
-       struct drm_device *dev = crtc->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-       int pipe = intel_crtc->pipe;
        int dpll_reg = DPLL(pipe);
        int dpll;
 
@@ -8832,21 +8831,19 @@ void intel_mark_fb_busy(struct drm_i915_gem_object *obj,
                        struct intel_engine_cs *ring)
 {
        struct drm_device *dev = obj->base.dev;
-       struct drm_crtc *crtc;
+       enum pipe pipe;
 
        intel_edp_psr_exit(dev);
 
        if (!i915.powersave)
                return;
 
-       for_each_crtc(dev, crtc) {
-               if (!crtc->primary->fb)
-                       continue;
-
-               if (to_intel_framebuffer(crtc->primary->fb)->obj != obj)
+       for_each_pipe(pipe) {
+               if (!(obj->frontbuffer_bits &
+                     INTEL_FRONTBUFFER_ALL_MASK(pipe)))
                        continue;
 
-               intel_increase_pllclock(crtc);
+               intel_increase_pllclock(dev, pipe);
                if (ring && intel_fbc_enabled(dev))
                        ring->fbc_dirty = true;
        }
@@ -12796,7 +12793,6 @@ void intel_connector_unregister(struct intel_connector *intel_connector)
 void intel_modeset_cleanup(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
-       struct drm_crtc *crtc;
        struct drm_connector *connector;
 
        /*
@@ -12816,14 +12812,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
 
        intel_unregister_dsm_handler();
 
-       for_each_crtc(dev, crtc) {
-               /* Skip inactive CRTCs */
-               if (!crtc->primary->fb)
-                       continue;
-
-               intel_increase_pllclock(crtc);
-       }
-
        intel_disable_fbc(dev);
 
        intel_disable_gt_powersave(dev);