From patchwork Mon Jan 3 18:28:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lam X-Patchwork-Id: 448711 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p03ISHoD024792 for ; Mon, 3 Jan 2011 18:28:38 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B601E9ECB6 for ; Mon, 3 Jan 2011 10:28:16 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qw0-f49.google.com (mail-qw0-f49.google.com [209.85.216.49]) by gabe.freedesktop.org (Postfix) with ESMTP id E4D409EB55 for ; Mon, 3 Jan 2011 10:27:50 -0800 (PST) Received: by qwj9 with SMTP id 9so13730602qwj.36 for ; Mon, 03 Jan 2011 10:27:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=liPblW3JrKL3cqOUyN1QZ3LfMjtUMoWiPZaZw62qmmY=; b=pFXv3SbE3RVukolLUicrNvD/nR9RWIv0q9Y5oMGNZ3BqGdYcm42R2W4N5Im/DF9Dl4 uuaXguRRPQPzE7NZO7gvkB5md59Oti9z6dmqyWu9BxeWdYaaF2Jw6Xv9tfqc66OjWpWi HNeYDkuLGigDeK5K9zvV76upnX2xIzfgu6VBM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=O6q9Gogm3B3y8XgMEBAHYQZPcNpcAewZS8WcNtpskhiCAXBr+W1OgBvpsYs05KSwkb d4zM10LLgzwmrgzDKLm4+tOA6oHx3duuUCigH02sdgkoXUTx9KQa4NBpmyHMWeIOh/K7 mo6RJbGrCYpMwzOpB56+fA99BZzAXnEXUADlo= Received: by 10.229.241.78 with SMTP id ld14mr18333162qcb.121.1294079270239; Mon, 03 Jan 2011 10:27:50 -0800 (PST) Received: from localhost.localdomain (pool-98-109-218-42.nwrknj.fios.verizon.net [98.109.218.42]) by mx.google.com with ESMTPS id s10sm10684688qco.11.2011.01.03.10.27.48 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 03 Jan 2011 10:27:49 -0800 (PST) From: Alexander Lam To: lambchop468@gmail.com, intel-gfx@lists.freedesktop.org Date: Mon, 3 Jan 2011 13:28:56 -0500 Message-Id: <1294079336-2744-1-git-send-email-lambchop468@gmail.com> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <[PATCH] allow 945 to control self refresh automatically> References: <[PATCH] allow 945 to control self refresh automatically> Subject: [Intel-gfx] [PATCH] allow 945 to control self refresh automatically X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 03 Jan 2011 18:28:39 +0000 (UTC) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index fe56cb3..46f6878 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -3316,7 +3316,7 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock, int planea_wm, planeb_wm; struct intel_watermark_params planea_params, planeb_params; unsigned long line_time_us; - int sr_clock, sr_entries = 0; + int sr_clock, sr_entries = 0, sr_enabled = 0; /* Create copies of the base settings for each pipe */ if (IS_CRESTLINE(dev) || IS_I945GM(dev)) @@ -3363,8 +3363,11 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock, if (srwm < 0) srwm = 1; - if (IS_I945G(dev) || IS_I945GM(dev)) + if (IS_I945G(dev) || IS_I945GM(dev)){ I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_FIFO_MASK | (srwm & 0xff)); + DRM_DEBUG_KMS("enable memory self refresh on 945\n"); + sr_enabled = 1; + } else if (IS_I915GM(dev)) { /* 915M has a smaller SRWM field */ I915_WRITE(FW_BLC_SELF, srwm & 0x3f); @@ -3373,6 +3376,8 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock, } else { /* Turn off self refresh if both pipes are enabled */ if (IS_I945G(dev) || IS_I945GM(dev)) { + DRM_DEBUG_KMS("disable memory self refresh on 945\n"); + sr_enabled = 0; I915_WRITE(FW_BLC_SELF, I915_READ(FW_BLC_SELF) & ~FW_BLC_SELF_EN); } else if (IS_I915GM(dev)) { @@ -3392,6 +3397,8 @@ static void i9xx_update_wm(struct drm_device *dev, int planea_clock, I915_WRITE(FW_BLC, fwater_lo); I915_WRITE(FW_BLC2, fwater_hi); + if (sr_enabled) + I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN_MASK | FW_BLC_SELF_EN); } static void i830_update_wm(struct drm_device *dev, int planea_clock, int unused, @@ -5125,7 +5132,6 @@ static void intel_idle_update(struct work_struct *work) struct drm_device *dev = dev_priv->dev; struct drm_crtc *crtc; struct intel_crtc *intel_crtc; - int enabled = 0; if (!i915_powersave) return; @@ -5139,16 +5145,11 @@ static void intel_idle_update(struct work_struct *work) if (!crtc->fb) continue; - enabled++; intel_crtc = to_intel_crtc(crtc); if (!intel_crtc->busy) intel_decrease_pllclock(crtc); } - if ((enabled == 1) && (IS_I945G(dev) || IS_I945GM(dev))) { - DRM_DEBUG_DRIVER("enable memory self refresh on 945\n"); - I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN_MASK | FW_BLC_SELF_EN); - } mutex_unlock(&dev->struct_mutex); } @@ -5173,17 +5174,9 @@ void intel_mark_busy(struct drm_device *dev, struct drm_i915_gem_object *obj) if (!drm_core_check_feature(dev, DRIVER_MODESET)) return; - if (!dev_priv->busy) { - if (IS_I945G(dev) || IS_I945GM(dev)) { - u32 fw_blc_self; - - DRM_DEBUG_DRIVER("disable memory self refresh on 945\n"); - fw_blc_self = I915_READ(FW_BLC_SELF); - fw_blc_self &= ~FW_BLC_SELF_EN; - I915_WRITE(FW_BLC_SELF, fw_blc_self | FW_BLC_SELF_EN_MASK); - } + if (!dev_priv->busy) dev_priv->busy = true; - } else + else mod_timer(&dev_priv->idle_timer, jiffies + msecs_to_jiffies(GPU_IDLE_TIMEOUT)); @@ -5195,14 +5188,6 @@ void intel_mark_busy(struct drm_device *dev, struct drm_i915_gem_object *obj) intel_fb = to_intel_framebuffer(crtc->fb); if (intel_fb->obj == obj) { if (!intel_crtc->busy) { - if (IS_I945G(dev) || IS_I945GM(dev)) { - u32 fw_blc_self; - - DRM_DEBUG_DRIVER("disable memory self refresh on 945\n"); - fw_blc_self = I915_READ(FW_BLC_SELF); - fw_blc_self &= ~FW_BLC_SELF_EN; - I915_WRITE(FW_BLC_SELF, fw_blc_self | FW_BLC_SELF_EN_MASK); - } /* Non-busy -> busy, upclock */ intel_increase_pllclock(crtc); intel_crtc->busy = true;