From patchwork Tue Aug 20 11:06:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Kahola X-Patchwork-Id: 11103571 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8013C1395 for ; Tue, 20 Aug 2019 11:06:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6773622CF5 for ; Tue, 20 Aug 2019 11:06:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6773622CF5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 49E666E77F; Tue, 20 Aug 2019 11:06:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 46CDA6E77F for ; Tue, 20 Aug 2019 11:06:20 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Aug 2019 04:06:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,408,1559545200"; d="scan'208";a="183166346" Received: from sorvi.fi.intel.com ([10.237.72.159]) by orsmga006.jf.intel.com with ESMTP; 20 Aug 2019 04:06:18 -0700 From: Mika Kahola To: intel-gfx@lists.freedesktop.org Date: Tue, 20 Aug 2019 14:06:31 +0300 Message-Id: <20190820110631.15793-1-mika.kahola@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [Intel-gfx] [PATCH] drm/i915/tgl: Lower cdclk for sub 4k resolutions X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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" In order to achieve improved power savings we can tune down CD clock frequency for sub 4k resolutions. The maximum CD clock frequency for sub 4k resolutions is set to 172.8 MHz. Signed-off-by: Mika Kahola --- drivers/gpu/drm/i915/display/intel_cdclk.c | 26 +++++++++++++++++++++- drivers/gpu/drm/i915/display/intel_cdclk.h | 3 +++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c index d0bc42e5039c..1d6c7bc79470 100644 --- a/drivers/gpu/drm/i915/display/intel_cdclk.c +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c @@ -2610,6 +2610,24 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) return max_cdclk_freq*90/100; } +bool mode_is_4k(struct drm_i915_private *dev_priv) +{ + struct intel_crtc *crtc; + struct intel_crtc_state *pipe_config; + + for_each_intel_crtc(&dev_priv->drm, crtc) { + pipe_config = to_intel_crtc_state(crtc->base.state); + + if (pipe_config->base.active) { + if (pipe_config->pipe_src_w >= WIDTH_4K && + pipe_config->pipe_src_h >= HEIGHT_4K) + return true; + } + } + + return false; +} + /** * intel_update_max_cdclk - Determine the maximum support CDCLK frequency * @dev_priv: i915 device @@ -2620,7 +2638,13 @@ static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) */ void intel_update_max_cdclk(struct drm_i915_private *dev_priv) { - if (IS_ELKHARTLAKE(dev_priv)) { + /* + * Use lower CDCLK frequency on Tigerlake when selected + * mode is less than 4k. + */ + if (INTEL_GEN(dev_priv) >= 12 && !mode_is_4k(dev_priv)) { + dev_priv->max_cdclk_freq = 172800; + } else if (IS_ELKHARTLAKE(dev_priv)) { if (dev_priv->cdclk.hw.ref == 24000) dev_priv->max_cdclk_freq = 552000; else diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.h b/drivers/gpu/drm/i915/display/intel_cdclk.h index 4d6f7f5f8930..cefb5146ddca 100644 --- a/drivers/gpu/drm/i915/display/intel_cdclk.h +++ b/drivers/gpu/drm/i915/display/intel_cdclk.h @@ -15,6 +15,9 @@ struct intel_atomic_state; struct intel_cdclk_state; struct intel_crtc_state; +#define WIDTH_4K 3860 +#define HEIGHT_4K 2160 + int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state); void intel_cdclk_init(struct drm_i915_private *i915); void intel_cdclk_uninit(struct drm_i915_private *i915);