From patchwork Thu Feb 26 15:16:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: deepak.s@linux.intel.com X-Patchwork-Id: 5894081 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AE88F9F373 for ; Thu, 26 Feb 2015 15:22:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A75F12034A for ; Thu, 26 Feb 2015 15:22:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0C9C1203A5 for ; Thu, 26 Feb 2015 15:22:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4232B6E7DE; Thu, 26 Feb 2015 07:22:07 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 79D846E7DB for ; Thu, 26 Feb 2015 07:22:03 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 26 Feb 2015 07:20:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,653,1418112000"; d="scan'208";a="672094196" Received: from deepu.iind.intel.com ([10.223.82.32]) by fmsmga001.fm.intel.com with ESMTP; 26 Feb 2015 07:20:20 -0800 From: deepak.s@linux.intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 26 Feb 2015 20:46:57 +0530 Message-Id: <1424963818-11931-5-git-send-email-deepak.s@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1424963818-11931-1-git-send-email-deepak.s@linux.intel.com> References: <1424963818-11931-1-git-send-email-deepak.s@linux.intel.com> Subject: [Intel-gfx] [PATCH 4/5] drm/i915: Modifying RC6 Promotion timer for Media workloads. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Deepak S In normal cases, RC6 promotion timer is 1700us/500us. This will result in more time spent in C1 state. For more residency in C6 in case of media workloads, this is changed to 250us. Not doing this for 3D workloads as too many C6-C0 transition delays can result in performance impact Signed-off-by: Deepak S --- drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/i915_gem_execbuffer.c | 15 +++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_lrc.c | 15 +++++++++++++ drivers/gpu/drm/i915/intel_pm.c | 35 ++++++++++++++++++++++++++++++ 5 files changed, 70 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index a1dd8bc..e33bf0d 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1160,6 +1160,9 @@ struct intel_gen6_power_mgmt { * Must be taken after struct_mutex if nested. */ struct mutex hw_lock; + + /* Delayed work to adjust RC6 promotion timer */ + struct delayed_work vlv_media_timeout_work; }; /* defined intel_pm.c */ diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 85a6ada..81f4066 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -1272,6 +1272,21 @@ i915_gem_ringbuffer_submission(struct drm_device *dev, struct drm_file *file, i915_gem_execbuffer_move_to_active(vmas, ring); i915_gem_execbuffer_retire_commands(dev, file, ring, batch_obj); + /* For vlv/chv, modify RC6 promotion timer upon hitting Media workload only + * This will help in better power savings with media scenarios. + */ + if (((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_BSD) && + IS_VALLEYVIEW(dev) && dev_priv->rps.enabled) { + + vlv_modify_rc6_promotion_timer(dev_priv, true); + + /* Start a timer for 1 sec to reset this value to original */ + mod_delayed_work(dev_priv->wq, + &dev_priv->rps.vlv_media_timeout_work, + msecs_to_jiffies(1000)); + + } + error: kfree(cliprects); return ret; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1fb1529..000f2a6 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1234,6 +1234,8 @@ void ilk_wm_get_hw_state(struct drm_device *dev); void skl_wm_get_hw_state(struct drm_device *dev); void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, struct skl_ddb_allocation *ddb /* out */); +void vlv_modify_rc6_promotion_timer(struct drm_i915_private *dev_priv, + bool media_active); /* intel_sdvo.c */ diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index fcb074b..5f495e73 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -716,6 +716,21 @@ int intel_execlists_submission(struct drm_device *dev, struct drm_file *file, i915_gem_execbuffer_move_to_active(vmas, ring); i915_gem_execbuffer_retire_commands(dev, file, ring, batch_obj); + /* + * CHV: Extend RC6 promotion timer upon hitting Media workload to help + * increase power savings with media scenarios. + */ + if (((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_BSD) && + IS_CHERRYVIEW(dev_priv->dev) && dev_priv->rps.enabled) { + + vlv_modify_rc6_promotion_timer(dev_priv, true); + + /* Start a timer for 1 sec to reset this value to original */ + mod_delayed_work(dev_priv->wq, + &dev_priv->rps.vlv_media_timeout_work, + msecs_to_jiffies(1000)); + } + return 0; } diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index e8bd9b9..7716be9 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -3941,6 +3941,9 @@ static void cherryview_disable_rps(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; + /* Cancel any pending work-item */ + cancel_delayed_work_sync(&dev_priv->rps.vlv_media_timeout_work); + I915_WRITE(GEN6_RC_CONTROL, 0); } @@ -3952,6 +3955,9 @@ static void valleyview_disable_rps(struct drm_device *dev) * This what the BIOS expects when going into suspend */ intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL); + /* Cancel any pending work-item */ + cancel_delayed_work_sync(&dev_priv->rps.vlv_media_timeout_work); + I915_WRITE(GEN6_RC_CONTROL, 0); intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); @@ -4857,6 +4863,32 @@ static void cherryview_enable_rps(struct drm_device *dev) intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); } +void vlv_modify_rc6_promotion_timer(struct drm_i915_private *dev_priv, + bool media_active) +{ + if (media_active) { + /* TO threshold set to 250 us ( 0xC3 * 1.28 us) */ + I915_WRITE(GEN6_RC6_THRESHOLD, 0xC3); + } else { + if (IS_CHERRYVIEW(dev_priv->dev)) { + /* TO threshold set to 500 us ( 0x186 * 1.28 us) */ + I915_WRITE(GEN6_RC6_THRESHOLD, 0x186); + } else { + /* TO threshold set to 1750 us ( 0x557 * 1.28 us) */ + I915_WRITE(GEN6_RC6_THRESHOLD, 0x557); + } + } +} + +static void vlv_media_timeout_work_func(struct work_struct *work) +{ + struct drm_i915_private *dev_priv = container_of(work, struct drm_i915_private, + rps.vlv_media_timeout_work.work); + + vlv_modify_rc6_promotion_timer(dev_priv, false); +} + + static void valleyview_enable_rps(struct drm_device *dev) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -6687,5 +6719,8 @@ void intel_pm_setup(struct drm_device *dev) INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, intel_gen6_powersave_work); + INIT_DELAYED_WORK(&dev_priv->rps.vlv_media_timeout_work, + vlv_media_timeout_work_func); + dev_priv->pm.suspended = false; }