From patchwork Fri Mar 7 16:32:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 3793301 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 66C7ABF549 for ; Fri, 7 Mar 2014 16:34:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85850202F0 for ; Fri, 7 Mar 2014 16:34:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 97FE7202EA for ; Fri, 7 Mar 2014 16:34:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F1554FB588; Fri, 7 Mar 2014 08:34:02 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B64DFB545 for ; Fri, 7 Mar 2014 08:33:45 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga101.ch.intel.com with ESMTP; 07 Mar 2014 08:33:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,608,1389772800"; d="scan'208";a="488005374" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.65]) by fmsmga001.fm.intel.com with SMTP; 07 Mar 2014 08:33:42 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 07 Mar 2014 18:33:41 +0200 From: ville.syrjala@linux.intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 7 Mar 2014 18:32:29 +0200 Message-Id: <1394209951-9963-23-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1394209951-9963-1-git-send-email-ville.syrjala@linux.intel.com> References: <1394209951-9963-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 22/24] drm/i915: Prefer the 5/6 DDB split when primary is disabled X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org 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: Ville Syrjälä When the primary plane is disabled, pick the 5/6 DDB split to give the sprite as much FIFO space as possible. The normal heuristic of just looking at the highest valid WM level won't necessarily pick the optimal split since both splits might have the same number of levels enabled. Preferring the 5/6 split won't actually affect the watermarks here, but it does give more FIFO space to the sprite leading to potentially longer periods spent in LP1+ states since the FIFO takes longer to drain. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 9c84d21..848ed22 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -334,6 +334,7 @@ struct intel_pipe_wm { uint32_t linetime; bool fbc_wm_enabled; bool pipe_enabled; + bool primary_enabled; bool sprites_enabled; bool sprites_scaled; }; diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 6e07686..ddf77d5 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -1726,6 +1726,7 @@ struct ilk_wm_maximums { /* used in computing the new watermarks state */ struct intel_wm_config { unsigned int num_pipes_active; + bool primary_enabled; bool sprites_enabled; bool sprites_scaled; }; @@ -2162,6 +2163,7 @@ static void ilk_compute_wm_config(struct drm_device *dev, if (!wm->pipe_enabled) continue; + config->primary_enabled |= wm->primary_enabled; config->sprites_enabled |= wm->sprites_enabled; config->sprites_scaled |= wm->sprites_scaled; config->num_pipes_active++; @@ -2174,6 +2176,7 @@ static bool ilk_validate_pipe_wm(struct drm_device *dev, /* LP0 watermark maximums depend on this pipe alone */ const struct intel_wm_config config = { .num_pipes_active = 1, + .primary_enabled = pipe_wm->primary_enabled, .sprites_enabled = pipe_wm->sprites_enabled, .sprites_scaled = pipe_wm->sprites_scaled, }; @@ -2197,6 +2200,7 @@ static bool intel_compute_pipe_wm(struct drm_crtc *crtc, struct ilk_wm_maximums max; pipe_wm->pipe_enabled = params->active; + pipe_wm->primary_enabled = params->pri.enabled; pipe_wm->sprites_enabled = params->spr.enabled; pipe_wm->sprites_scaled = params->spr.scaled; @@ -2249,6 +2253,7 @@ static void ilk_wm_merge_intermediate(struct drm_device *dev, int level, max_level = ilk_wm_max_level(dev); a->pipe_enabled |= b->pipe_enabled; + a->primary_enabled |= b->primary_enabled; a->sprites_enabled |= b->sprites_enabled; a->sprites_scaled |= b->sprites_scaled; @@ -2440,11 +2445,21 @@ static void ilk_compute_wm_results(struct drm_device *dev, } } -/* Find the result with the highest level enabled. Check for enable_fbc_wm in - * case both are at the same level. Prefer r1 in case they're the same. */ +/* + * Find the result with the highest level enabled. + * When the max level for each result is the same, pick r2 + * when the primary plane is disabled, otherwise prefer the + * result which has FBC WM enabled. All else being equal, pick + * r1. + * + * FIXME should ideally calculate the FIFO drain time for each + * plane, and determine which split has the chance to keep + * the memory asleep for longest. + */ static struct intel_pipe_wm *ilk_find_best_result(struct drm_device *dev, struct intel_pipe_wm *r1, - struct intel_pipe_wm *r2) + struct intel_pipe_wm *r2, + bool primary_enabled) { int level, max_level = ilk_wm_max_level(dev); int level1 = 0, level2 = 0; @@ -2457,7 +2472,8 @@ static struct intel_pipe_wm *ilk_find_best_result(struct drm_device *dev, } if (level1 == level2) { - if (r2->fbc_wm_enabled && !r1->fbc_wm_enabled) + if (!primary_enabled || + (r2->fbc_wm_enabled && !r1->fbc_wm_enabled)) return r2; else return r1; @@ -2815,7 +2831,8 @@ static void ilk_program_watermarks(struct drm_device *dev) ilk_compute_wm_maximums(dev, 1, &config, INTEL_DDB_PART_5_6, &max); ilk_wm_merge(dev, &config, &max, &lp_wm_5_6); - best_lp_wm = ilk_find_best_result(dev, &lp_wm_1_2, &lp_wm_5_6); + best_lp_wm = ilk_find_best_result(dev, &lp_wm_1_2, &lp_wm_5_6, + config.primary_enabled); } else { best_lp_wm = &lp_wm_1_2; }