From patchwork Wed Jan 13 14:10:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao, Yakui" X-Patchwork-Id: 72645 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0DEDD2k019254 for ; Wed, 13 Jan 2010 14:13:13 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B17D49ECD1; Wed, 13 Jan 2010 06:13:13 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 993269E9C4 for ; Wed, 13 Jan 2010 06:13:05 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 13 Jan 2010 06:12:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.49,268,1262592000"; d="scan'208";a="530913069" Received: from yakui_zhao.sh.intel.com (HELO localhost.localdomain) ([10.239.13.83]) by fmsmga002.fm.intel.com with ESMTP; 13 Jan 2010 06:13:01 -0800 From: yakui.zhao@intel.com To: eric@anholt.net Date: Wed, 13 Jan 2010 22:10:54 +0800 Message-Id: <1263391855-9607-6-git-send-email-yakui.zhao@intel.com> X-Mailer: git-send-email 1.5.4.5 In-Reply-To: <1263391855-9607-5-git-send-email-yakui.zhao@intel.com> References: <1263391855-9607-1-git-send-email-yakui.zhao@intel.com> <1263391855-9607-2-git-send-email-yakui.zhao@intel.com> <1263391855-9607-3-git-send-email-yakui.zhao@intel.com> <1263391855-9607-4-git-send-email-yakui.zhao@intel.com> <1263391855-9607-5-git-send-email-yakui.zhao@intel.com> Cc: intel-gfx@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 5/6] drm/i915: update self-refresh watermark only when using single plane X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 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@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 485f1d5..5598932 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -1813,12 +1813,14 @@ #define DSPFW_SR_SHIFT 23 #define DSPFW_CURSORB_SHIFT 16 #define DSPFW_PLANEB_SHIFT 8 +#define DSPFW_SR_MASK (0x1ff << 23) #define DSPFW2 0x70038 #define DSPFW_CURSORA_MASK 0x00003f00 #define DSPFW_CURSORA_SHIFT 8 #define DSPFW3 0x7003c #define DSPFW_HPLL_SR_EN (1<<31) #define DSPFW_CURSOR_SR_SHIFT 24 +#define DSPFW_CURSOR_SR_MASK (0x3f << 24) #define PINEVIEW_SELF_REFRESH_EN (1<<30) /* FIFO watermark sizes etc */ diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d107532..af3df7c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2649,6 +2649,7 @@ static void g4x_update_wm(struct drm_device *dev, int planea_wm, planeb_wm, cursora_wm, cursorb_wm, cursor_sr; struct intel_watermark_params planea_params, planeb_params; int sr_entries = 0; + u32 reg_value; /* Create copies of the base settings for each pipe */ planea_params = planeb_params = g4x_wm_info; @@ -2678,7 +2679,6 @@ static void g4x_update_wm(struct drm_device *dev, planeb_wm = 16; cursora_wm = cursorb_wm = 16; - cursor_sr = 32; DRM_DEBUG("FIFO watermarks - A: %d, B: %d\n", planea_wm, planeb_wm); @@ -2702,24 +2702,34 @@ static void g4x_update_wm(struct drm_device *dev, sr_latency_ns, 1); DRM_DEBUG_KMS("Display plane self-refresh entries: %d\n", sr_entries); + reg_value = I915_READ(DSPFW1); + reg_value &= ~DSPFW_SR_MASK; + reg_value |= (sr_entries << DSPFW_SR_SHIFT); + I915_WRITE(DSPFW1, reg_value); DRM_DEBUG_KMS("cursor self-refresh entries: %d\n", cursor_sr); + reg_value = I915_READ(DSPFW3); + reg_value &= ~DSPFW_CURSOR_SR_MASK; + reg_value |= (cursor_sr << DSPFW_CURSOR_SR_SHIFT); + I915_WRITE(DSPFW3, reg_value); I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); } - DRM_DEBUG_KMS("Setting FIFO watermarks - A: %d, B: %d, SR %d\n", - planea_wm, planeb_wm, sr_entries); + DRM_DEBUG_KMS("Setting FIFO watermarks - A: %d, B: %d\n", + planea_wm, planeb_wm); + + reg_value = I915_READ(DSPFW1); + reg_value &= DSPFW_SR_MASK; + reg_value |= (cursorb_wm << DSPFW_CURSORB_SHIFT) | + (planeb_wm << DSPFW_PLANEB_SHIFT) | planea_wm; + I915_WRITE(DSPFW1, reg_value); - I915_WRITE(DSPFW1, (sr_entries << DSPFW_SR_SHIFT) | - (cursorb_wm << DSPFW_CURSORB_SHIFT) | - (planeb_wm << DSPFW_PLANEB_SHIFT) | planea_wm); /* Only update cursor A watermark in FW2 */ I915_WRITE(DSPFW2, (I915_READ(DSPFW2) & ~DSPFW_CURSORA_MASK) | (cursora_wm << DSPFW_CURSORA_SHIFT)); /* HPLL off in SR has some issues on G4x... disable it */ - I915_WRITE(DSPFW3, (I915_READ(DSPFW3) & ~DSPFW_HPLL_SR_EN) | - (cursor_sr << DSPFW_CURSOR_SR_SHIFT)); + I915_WRITE(DSPFW3, (I915_READ(DSPFW3) & ~DSPFW_HPLL_SR_EN)); } static void i965_update_wm(struct drm_device *dev, @@ -2729,6 +2739,7 @@ static void i965_update_wm(struct drm_device *dev, { struct drm_i915_private *dev_priv = dev->dev_private; int srwm = 1, cursor_sr; + u32 reg_value; cursor_sr = 32; /* Calc sr entries for one plane configs */ @@ -2750,18 +2761,32 @@ static void i965_update_wm(struct drm_device *dev, pixel_size, WM_TYPE_CURSOR, crtc_mode, sr_latency_ns, 1); + DRM_DEBUG_KMS("Display plane self-refresh entries: %d\n", + srwm); + reg_value = I915_READ(DSPFW1); + reg_value &= ~DSPFW_SR_MASK; + reg_value |= (srwm << DSPFW_SR_SHIFT); + I915_WRITE(DSPFW1, reg_value); + DRM_DEBUG_KMS("cursor self-refresh entries: %d\n", + cursor_sr); + reg_value = I915_READ(DSPFW3); + reg_value &= ~DSPFW_CURSOR_SR_MASK; + reg_value |= (cursor_sr << DSPFW_CURSOR_SR_SHIFT); + I915_WRITE(DSPFW3, reg_value); + I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); } - DRM_DEBUG_KMS("Setting FIFO watermarks - A: 8, B: 8, C: 8, SR %d\n", - srwm); + DRM_DEBUG_KMS("Setting FIFO watermarks - A: 8, B: 8, C: 8\n"); /* 965 has limitations... */ - I915_WRITE(DSPFW1, (srwm << DSPFW_SR_SHIFT) | (8 << 16) | (8 << 8) | + reg_value = I915_READ(DSPFW1); + reg_value &= DSPFW_SR_MASK; + I915_WRITE(DSPFW1, reg_value | (8 << 16) | (8 << 8) | (8 << 0)); I915_WRITE(DSPFW2, (8 << 8) | (8 << 0)); - /* update the cursor self-refresh watermark */ - I915_WRITE(DSPFW3, (cursor_sr << 24)); + /* Disable HPLL off in SR*/ + I915_WRITE(DSPFW3, (I915_READ(DSPFW3) & ~DSPFW_HPLL_SR_EN)); } static void i9xx_update_wm(struct drm_device *dev,