From patchwork Tue Jun 16 11:31:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 6617451 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A7A88C0020 for ; Tue, 16 Jun 2015 11:30:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBDF2207A4 for ; Tue, 16 Jun 2015 11:30:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CE6D12078B for ; Tue, 16 Jun 2015 11:30:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 494F46E93D; Tue, 16 Jun 2015 04:30:27 -0700 (PDT) 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 C9F5F6E93F for ; Tue, 16 Jun 2015 04:30:21 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 16 Jun 2015 04:30:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,626,1427785200"; d="scan'208";a="728342706" Received: from sorvi.fi.intel.com ([10.237.72.63]) by fmsmga001.fm.intel.com with ESMTP; 16 Jun 2015 04:30:20 -0700 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Tue, 16 Jun 2015 14:31:34 +0300 Message-Id: <1434454295-7647-3-git-send-email-mika.kahola@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434454295-7647-1-git-send-email-mika.kahola@intel.com> References: <1434454295-7647-1-git-send-email-mika.kahola@intel.com> Subject: [Intel-gfx] [PATCH 2/3] drm/i915: Max CD clock for Broadwell 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.8 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 Max CD clock for Broadwell platform is added to 'intel_mode_max_pixclk()' function. This patch removes the need for 'ilk_max_pixel_rate()' function. Signed-off-by: Mika Kahola --- drivers/gpu/drm/i915/intel_display.c | 45 +++++++++++------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 953eda7..b178fe9 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -5879,6 +5879,7 @@ static int intel_mode_max_pixclk(struct drm_device *dev, struct intel_crtc *intel_crtc; struct intel_crtc_state *crtc_state; int max_pixclk = 0; + int pixel_rate; for_each_intel_crtc(dev, intel_crtc) { if (state) @@ -5892,8 +5893,16 @@ static int intel_mode_max_pixclk(struct drm_device *dev, if (!crtc_state->base.enable) continue; - max_pixclk = max(max_pixclk, - crtc_state->base.adjusted_mode.crtc_clock); + if (IS_BROADWELL(dev)) { + pixel_rate = ilk_pipe_pixel_rate(intel_crtc->config); + + if (intel_crtc->config->ips_enabled) + pixel_rate = DIV_ROUND_UP(pixel_rate * 100, 95); + + } else + pixel_rate = crtc_state->base.adjusted_mode.crtc_clock; + + max_pixclk = max(max_pixclk, pixel_rate); } return max_pixclk; @@ -9542,32 +9551,6 @@ static void broxton_modeset_global_resources(struct drm_atomic_state *old_state) broxton_set_cdclk(dev, req_cdclk); } -/* compute the max rate for new configuration */ -static int ilk_max_pixel_rate(struct drm_i915_private *dev_priv) -{ - struct drm_device *dev = dev_priv->dev; - struct intel_crtc *intel_crtc; - struct drm_crtc *crtc; - int max_pixel_rate = 0; - int pixel_rate; - - for_each_crtc(dev, crtc) { - if (!crtc->state->enable) - continue; - - intel_crtc = to_intel_crtc(crtc); - pixel_rate = ilk_pipe_pixel_rate(intel_crtc->config); - - /* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */ - if (IS_BROADWELL(dev) && intel_crtc->config->ips_enabled) - pixel_rate = DIV_ROUND_UP(pixel_rate * 100, 95); - - max_pixel_rate = max(max_pixel_rate, pixel_rate); - } - - return max_pixel_rate; -} - static void broadwell_set_cdclk(struct drm_device *dev, int cdclk) { struct drm_i915_private *dev_priv = dev->dev_private; @@ -9681,8 +9664,8 @@ static int broadwell_modeset_global_pipes(struct drm_atomic_state *state) struct drm_i915_private *dev_priv = to_i915(state->dev); struct drm_crtc *crtc; struct drm_crtc_state *crtc_state; - int max_pixclk = ilk_max_pixel_rate(dev_priv); - int cdclk, i; + int max_pixclk = intel_mode_max_pixclk(state->dev, state); + int cdclk; int ret = 0; if (max_pixclk < 0) @@ -9723,7 +9706,7 @@ static void broadwell_modeset_global_resources(struct drm_atomic_state *state) { struct drm_device *dev = state->dev; struct drm_i915_private *dev_priv = dev->dev_private; - int max_pixel_rate = ilk_max_pixel_rate(dev_priv); + int max_pixel_rate = intel_mode_max_pixclk(state->dev, state); int req_cdclk = broadwell_calc_cdclk(dev_priv, max_pixel_rate); if (req_cdclk != dev_priv->cdclk_freq)