From patchwork Thu Jun 25 17:08:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lespiau, Damien" X-Patchwork-Id: 6676751 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 3E5EB9F1C1 for ; Thu, 25 Jun 2015 17:09:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C29C206DC for ; Thu, 25 Jun 2015 17:09:17 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 82A9C206C7 for ; Thu, 25 Jun 2015 17:09:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B562D6EC57; Thu, 25 Jun 2015 10:09:15 -0700 (PDT) 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 AFA0E6EC57 for ; Thu, 25 Jun 2015 10:09:13 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 25 Jun 2015 10:08:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,678,1427785200"; d="scan'208";a="734642735" Received: from unknown (HELO strange.ger.corp.intel.com) ([10.252.32.192]) by fmsmga001.fm.intel.com with ESMTP; 25 Jun 2015 10:08:20 -0700 From: Damien Lespiau To: intel-gfx@lists.freedesktop.org Date: Thu, 25 Jun 2015 18:08:20 +0100 Message-Id: <1435252100-8234-1-git-send-email-damien.lespiau@intel.com> X-Mailer: git-send-email 2.1.0 Cc: paulo.r.zanoni@intel.com Subject: [Intel-gfx] [PATCH] drm/i915/skl: Skip remaining dividers when deviation is 0 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=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 We can't improve a 0 deviation, so when we find such a divider, skip the remaining ones they won't be better. This short-circuit the search for 34 of the 373 test frequencies in the corresponding i-g-t test (tools/skl_compute_wrpll) Suggested-by: Paulo Zanoni Signed-off-by: Damien Lespiau Tested-By: Intel Graphics QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com) --- This patch has to be applied after patch 12 and 13 for the recent SKL DPLL series. drivers/gpu/drm/i915/intel_ddi.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index f6b3ccc..45116d8 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -1122,7 +1122,11 @@ static void skl_wrpll_context_init(struct skl_wrpll_context *ctx) #define SKL_DCO_MAX_PDEVIATION 100 #define SKL_DCO_MAX_NDEVIATION 600 -static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx, +/* + * Returns true if we're sure to have found the definitive divider (ie + * deviation == 0). + */ +static bool skl_wrpll_try_divider(struct skl_wrpll_context *ctx, uint64_t central_freq, uint64_t dco_freq, unsigned int divider) @@ -1141,6 +1145,10 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx, ctx->dco_freq = dco_freq; ctx->p = divider; } + + /* we can't improve a 0 deviation */ + if (deviation == 0) + return true; /* negative deviation */ } else if (deviation < SKL_DCO_MAX_NDEVIATION && deviation < ctx->min_deviation) { @@ -1150,6 +1158,7 @@ static void skl_wrpll_try_divider(struct skl_wrpll_context *ctx, ctx->p = divider; } + return false; } static void skl_wrpll_get_multipliers(unsigned int p, @@ -1311,13 +1320,15 @@ skl_ddi_calculate_wrpll(int clock /* in Hz */, unsigned int p = dividers[d].list[i]; uint64_t dco_freq = p * afe_clock; - skl_wrpll_try_divider(&ctx, - dco_central_freq[dco], - dco_freq, - p); + if (skl_wrpll_try_divider(&ctx, + dco_central_freq[dco], + dco_freq, + p)) + goto skip_remaining_dividers; } } +skip_remaining_dividers: /* * If a solution is found with an even divider, prefer * this one.