From 57fbf952f78e9af88dca27943f341bfa7b5ee2c9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 3 Mar 2011 10:56:22 +0000 Subject: [PATCH] drm/i915: Move gen3 INSTPM interrupt disable twiddling to intel_mark_busy Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_irq.c | 7 ---- drivers/gpu/drm/i915/intel_display.c | 65 +++++++++++++++------------------- 2 files changed, 29 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 188b497..538d77c 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -1354,9 +1354,6 @@ int i915_enable_vblank(struct drm_device *dev, int pipe) i915_enable_pipestat(dev_priv, pipe, PIPE_VBLANK_INTERRUPT_ENABLE); - /* maintain vblank delivery even in deep C-states */ - if (dev_priv->info->gen == 3) - I915_WRITE(INSTPM, INSTPM_AGPBUSY_DIS << 16); spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); return 0; @@ -1371,10 +1368,6 @@ void i915_disable_vblank(struct drm_device *dev, int pipe) unsigned long irqflags; spin_lock_irqsave(&dev_priv->irq_lock, irqflags); - if (dev_priv->info->gen == 3) - I915_WRITE(INSTPM, - INSTPM_AGPBUSY_DIS << 16 | INSTPM_AGPBUSY_DIS); - if (HAS_PCH_SPLIT(dev)) ironlake_disable_display_irq(dev_priv, (pipe == 0) ? DE_PIPEA_VBLANK: DE_PIPEB_VBLANK); diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 4a392b4..b6af991 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -5788,9 +5788,9 @@ static void intel_increase_pllclock(struct drm_crtc *crtc) I915_WRITE(PP_CONTROL, I915_READ(PP_CONTROL) & 0x3); } - /* Schedule downclock */ - mod_timer(&intel_crtc->idle_timer, jiffies + - msecs_to_jiffies(CRTC_IDLE_TIMEOUT)); + intel_crtc->busy = true; + mod_timer(&intel_crtc->idle_timer, + jiffies + msecs_to_jiffies(CRTC_IDLE_TIMEOUT)); } static void intel_decrease_pllclock(struct drm_crtc *crtc) @@ -5802,6 +5802,9 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) int dpll_reg = DPLL(pipe); int dpll = I915_READ(dpll_reg); + if (!i915_powersave) + return; + if (HAS_PCH_SPLIT(dev)) return; @@ -5830,7 +5833,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) /* ...and lock them again */ I915_WRITE(PP_CONTROL, I915_READ(PP_CONTROL) & 0x3); } - } /** @@ -5846,10 +5848,10 @@ static void intel_idle_update(struct work_struct *work) idle_work); struct drm_device *dev = dev_priv->dev; struct drm_crtc *crtc; - struct intel_crtc *intel_crtc; - if (!i915_powersave) - return; + if (!dev_priv->busy && dev_priv->info->gen == 3) + I915_WRITE(INSTPM, + INSTPM_AGPBUSY_DIS << 16 | INSTPM_AGPBUSY_DIS); mutex_lock(&dev->struct_mutex); @@ -5860,12 +5862,10 @@ static void intel_idle_update(struct work_struct *work) if (!crtc->fb) continue; - intel_crtc = to_intel_crtc(crtc); - if (!intel_crtc->busy) + if (!to_intel_crtc(crtc)->busy) intel_decrease_pllclock(crtc); } - mutex_unlock(&dev->struct_mutex); } @@ -5882,35 +5882,33 @@ static void intel_idle_update(struct work_struct *work) void intel_mark_busy(struct drm_device *dev, struct drm_i915_gem_object *obj) { drm_i915_private_t *dev_priv = dev->dev_private; - struct drm_crtc *crtc = NULL; - struct intel_framebuffer *intel_fb; - struct intel_crtc *intel_crtc; - - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return; + struct drm_crtc *crtc; - if (!dev_priv->busy) + if (!dev_priv->busy) { + /* maintain interrupt delivery even in deep C-states */ + if (dev_priv->info->gen == 3) + I915_WRITE(INSTPM, INSTPM_AGPBUSY_DIS << 16); dev_priv->busy = true; - else - mod_timer(&dev_priv->idle_timer, jiffies + - msecs_to_jiffies(GPU_IDLE_TIMEOUT)); + } + + mod_timer(&dev_priv->idle_timer, jiffies + + msecs_to_jiffies(GPU_IDLE_TIMEOUT)); list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { + struct intel_framebuffer *intel_fb; + if (!crtc->fb) continue; - intel_crtc = to_intel_crtc(crtc); intel_fb = to_intel_framebuffer(crtc->fb); if (intel_fb->obj == obj) { - if (!intel_crtc->busy) { - /* Non-busy -> busy, upclock */ + struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + + if (!intel_crtc->busy) intel_increase_pllclock(crtc); - intel_crtc->busy = true; - } else { - /* Busy -> busy, put off timer */ - mod_timer(&intel_crtc->idle_timer, jiffies + - msecs_to_jiffies(CRTC_IDLE_TIMEOUT)); - } + else + mod_timer(&intel_crtc->idle_timer, + jiffies + msecs_to_jiffies(CRTC_IDLE_TIMEOUT)); } } } @@ -7464,20 +7462,17 @@ void intel_modeset_cleanup(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; struct drm_crtc *crtc; - struct intel_crtc *intel_crtc; drm_kms_helper_poll_fini(dev); mutex_lock(&dev->struct_mutex); intel_unregister_dsm_handler(); - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { /* Skip inactive CRTCs */ if (!crtc->fb) continue; - intel_crtc = to_intel_crtc(crtc); intel_increase_pllclock(crtc); } @@ -7500,10 +7495,8 @@ void intel_modeset_cleanup(struct drm_device *dev) cancel_work_sync(&dev_priv->hotplug_work); /* Shut off idle work before the crtcs get freed. */ - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { - intel_crtc = to_intel_crtc(crtc); - del_timer_sync(&intel_crtc->idle_timer); - } + list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) + del_timer_sync(&to_intel_crtc(crtc)->idle_timer); del_timer_sync(&dev_priv->idle_timer); cancel_work_sync(&dev_priv->idle_work); -- 1.7.2.3