From patchwork Tue Nov 12 04:54:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13871716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 60C86D41D52 for ; Tue, 12 Nov 2024 04:54:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D3E6F10E226; Tue, 12 Nov 2024 04:54:50 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="P0GD33qp"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id C0D0B10E0EB; Tue, 12 Nov 2024 04:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731387290; x=1762923290; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZcgpnOa40SIuetdynEKEerOPih2ow/d+dMCvF24+4HA=; b=P0GD33qpsHGbuzjry6l+4xSS9+8xP9iA+iX3qSuH5O5uzzvuqpsHXJtO +uz61mOf4p+GRfGBBQxx4mG9URgDAf0PsAn8qYkvLXyVrbEJBeQgAdIxm A0Nj7IkbmnMq5wEScTbwQyKkia7tzKbLRsOxPqfpZNpwrbym076eUf4Tr RayivdnQloNGpr2yDJgAMumA1Hy/+K0vpx5ENICLPpManjT9DNCA7go2o pJ7Kv9hKwJYKicm6wNWsb+fS93rB2bnVGi5vjxn9PeWxt94RZqGdxECKx ZhFLHnDoT6NRCoCQlj5DLgUAUzIkSgnJ4W5WOxWuKFChUs0nwTjTOHv0J g==; X-CSE-ConnectionGUID: PN51JjM8T8uo1sSfwtVViw== X-CSE-MsgGUID: O69vrzn/SPaAXmvqpnNA4w== X-IronPort-AV: E=McAfee;i="6700,10204,11253"; a="42585885" X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="42585885" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2024 20:54:49 -0800 X-CSE-ConnectionGUID: Mv7ESORqQsqZRRCGYFzZWw== X-CSE-MsgGUID: fhcWyHRKSneDnjZByatmtw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="87673092" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by fmviesa009.fm.intel.com with ESMTP; 11 Nov 2024 20:54:48 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: vinod.govindapillai@intel.com, mitulkumar.ajitkumar.golani@intel.com, Suraj Kandpal Subject: [PATCH 1/5] drm/i915/watermark: Initialize latency variable to appropriate value Date: Tue, 12 Nov 2024 10:24:31 +0530 Message-Id: <20241112045435.1189586-1-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Initialize max_latency variable to LNL_PKG_C_LATENCY_MASK which helps to eliminate the else block and make the whole code a lot cleaner. Signed-off-by: Suraj Kandpal Reviewed-by: Mitul Golani --- drivers/gpu/drm/i915/display/skl_watermark.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index d3bbf335c749..a97e90ac643f 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2850,7 +2850,7 @@ static int skl_wm_add_affected_planes(struct intel_atomic_state *state, static void skl_program_dpkgc_latency(struct drm_i915_private *i915, bool enable_dpkgc) { - u32 max_latency = 0; + u32 max_latency = LNL_PKG_C_LATENCY_MASK; u32 clear = 0, val = 0; u32 added_wake_time = 0; @@ -2863,9 +2863,6 @@ skl_program_dpkgc_latency(struct drm_i915_private *i915, bool enable_dpkgc) max_latency = LNL_PKG_C_LATENCY_MASK; added_wake_time = DSB_EXE_TIME + i915->display.sagv.block_time_us; - } else { - max_latency = LNL_PKG_C_LATENCY_MASK; - added_wake_time = 0; } clear |= LNL_ADDED_WAKE_TIME_MASK | LNL_PKG_C_LATENCY_MASK; From patchwork Tue Nov 12 04:54:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13871717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5088ED41D54 for ; Tue, 12 Nov 2024 04:54:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CBA3D10E301; Tue, 12 Nov 2024 04:54:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="a3OTsQw1"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2606C10E233; Tue, 12 Nov 2024 04:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731387291; x=1762923291; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JVc84VmJ7xPplE7bL4ZBDwb47Ft45bdE2pYA9hoi/OY=; b=a3OTsQw1dp7JQ7wva0WIrJO4x6s6QQHNzSGFUL9+5w0sN+AKsGq70ETs U9LrM4R8pIKmcY3T/wGzVpSGn5MemKtK8L/WhlD65yZe9flgNmLOgjDb6 raYWxScP6AT/J8yDWYrCsXWGM+H5B0Oo7KFk3oBCQEMXsjVURNw1BDArL z3DygAXYGWnfENTJplmI3a0HR2ieYXzIwjCn8MuQqzmpHap7mJGSH9HY/ GBZemV1GG1LgkeuMLuo1C/ja9nHftBU2fiwVQgkFQwo9m9U03iFbD+mCi /m42HIpAMPLtq3s3PLVM546EBCsfg3Rlluzhn4Y+WpbQuY+8nsMW1eshn A==; X-CSE-ConnectionGUID: HMj5kY6ATiyfd0nxPlmbig== X-CSE-MsgGUID: eG8prx4CROSm/8EyGVycLA== X-IronPort-AV: E=McAfee;i="6700,10204,11253"; a="42585888" X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="42585888" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2024 20:54:51 -0800 X-CSE-ConnectionGUID: ccacHcPmQEybfvE/mimZCw== X-CSE-MsgGUID: B4kKRmxYQjm+zHudqnb7UQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="87673113" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by fmviesa009.fm.intel.com with ESMTP; 11 Nov 2024 20:54:49 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: vinod.govindapillai@intel.com, mitulkumar.ajitkumar.golani@intel.com, Suraj Kandpal Subject: [PATCH 2/5] drm/i915/watermark: Rename enable_dpkgc variable Date: Tue, 12 Nov 2024 10:24:32 +0530 Message-Id: <20241112045435.1189586-2-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112045435.1189586-1-suraj.kandpal@intel.com> References: <20241112045435.1189586-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Rename the enable_dpkgc variable to make it more clear what it represents which is that if we are in fixed refresh rate or not. Signed-off-by: Suraj Kandpal --- drivers/gpu/drm/i915/display/skl_watermark.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index a97e90ac643f..3fa463159b0b 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2848,7 +2848,7 @@ static int skl_wm_add_affected_planes(struct intel_atomic_state *state, * Program PKG_C_LATENCY Added Wake Time = 0 */ static void -skl_program_dpkgc_latency(struct drm_i915_private *i915, bool enable_dpkgc) +skl_program_dpkgc_latency(struct drm_i915_private *i915, bool fixed_refresh_rate) { u32 max_latency = LNL_PKG_C_LATENCY_MASK; u32 clear = 0, val = 0; @@ -2857,7 +2857,7 @@ skl_program_dpkgc_latency(struct drm_i915_private *i915, bool enable_dpkgc) if (DISPLAY_VER(i915) < 20) return; - if (enable_dpkgc) { + if (fixed_refresh_rate) { max_latency = skl_watermark_max_latency(i915, 1); if (max_latency == 0) max_latency = LNL_PKG_C_LATENCY_MASK; @@ -2878,7 +2878,7 @@ skl_compute_wm(struct intel_atomic_state *state) struct intel_crtc *crtc; struct intel_crtc_state __maybe_unused *new_crtc_state; int ret, i; - bool enable_dpkgc = false; + bool fixed_refresh_rate = false; for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { ret = skl_build_pipe_wm(state, crtc); @@ -2907,10 +2907,10 @@ skl_compute_wm(struct intel_atomic_state *state) if ((new_crtc_state->vrr.vmin == new_crtc_state->vrr.vmax && new_crtc_state->vrr.vmin == new_crtc_state->vrr.flipline) || !new_crtc_state->vrr.enable) - enable_dpkgc = true; + fixed_refresh_rate = true; } - skl_program_dpkgc_latency(to_i915(state->base.dev), enable_dpkgc); + skl_program_dpkgc_latency(to_i915(state->base.dev), fixed_refresh_rate); skl_print_wm_changes(state); From patchwork Tue Nov 12 04:54:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13871718 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 6D552D41D52 for ; Tue, 12 Nov 2024 04:54:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 15FB510E55A; Tue, 12 Nov 2024 04:54:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TENGbjPn"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2C2E10E55A; Tue, 12 Nov 2024 04:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731387293; x=1762923293; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hIXeuFhpIeUNqGZ33Yr0m+mB8qPT1Fu9RLp9d7PsxLE=; b=TENGbjPnw/noDnyX9Jfr8vH0cwtLRBtcDhFIse08hZDhD2cxmXrcgu9H eoP+NpHYol6TWj1tr+F50fZEsthxCOuf0v7QjSFPvzY5C7Sy7366tKOQd +RgJ9S/qD2lcsrD9f5bk3lv1qp5W4wfADZihbOiu6ECFBmJc1zoXXM/RY RUet5LJVcrGV38IsARiMJSli2uGo5RnTjdEPPQ3Ym9XftKIhESYbGUFj6 eVpWmyKClb7sCXzhqaRS1p2lS3YIBtheToe0FZKKYd65SXQ7vIwX9Zia0 Vi9u2BRqVRiraxrgSrA3daxRnKtVlgiYJzP6ef/jcVHX/AioFIorv5yps Q==; X-CSE-ConnectionGUID: 99DofSf1QaOF4lwG98jRtA== X-CSE-MsgGUID: K2zLM/fYQSWfqUOBcgFMOA== X-IronPort-AV: E=McAfee;i="6700,10204,11253"; a="42585890" X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="42585890" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2024 20:54:53 -0800 X-CSE-ConnectionGUID: OlT86MfNSeCu4xbgc62YLA== X-CSE-MsgGUID: 1PXspbR6T/ObA8pJqiPHRw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="87673136" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by fmviesa009.fm.intel.com with ESMTP; 11 Nov 2024 20:54:51 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: vinod.govindapillai@intel.com, mitulkumar.ajitkumar.golani@intel.com, Suraj Kandpal Subject: [PATCH 3/5] drm/i915/watermark: Refactor dpkgc value prepration Date: Tue, 12 Nov 2024 10:24:33 +0530 Message-Id: <20241112045435.1189586-3-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112045435.1189586-1-suraj.kandpal@intel.com> References: <20241112045435.1189586-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Refactor the value getting prepped to be written into the PKG_C_LATENCY register by ORing the REG_FIELD_PREP values instead of having val getiing operated on twice. Signed-off-by: Suraj Kandpal --- drivers/gpu/drm/i915/display/skl_watermark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index 3fa463159b0b..4c92ada1c851 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2866,8 +2866,8 @@ skl_program_dpkgc_latency(struct drm_i915_private *i915, bool fixed_refresh_rate } clear |= LNL_ADDED_WAKE_TIME_MASK | LNL_PKG_C_LATENCY_MASK; - val |= REG_FIELD_PREP(LNL_PKG_C_LATENCY_MASK, max_latency); - val |= REG_FIELD_PREP(LNL_ADDED_WAKE_TIME_MASK, added_wake_time); + val |= REG_FIELD_PREP(LNL_PKG_C_LATENCY_MASK, max_latency) | + REG_FIELD_PREP(LNL_ADDED_WAKE_TIME_MASK, added_wake_time); intel_uncore_rmw(&i915->uncore, LNL_PKG_C_LATENCY, clear, val); } From patchwork Tue Nov 12 04:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13871719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A39EFD41D55 for ; Tue, 12 Nov 2024 04:54:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A4DC10E55B; Tue, 12 Nov 2024 04:54:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="aDEkKJXP"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0088410E55B; Tue, 12 Nov 2024 04:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731387295; x=1762923295; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6A5Q0d03tXyw7k3vdS/Bv8QAWyI6mriczuNxaPsHPMk=; b=aDEkKJXPtMpiYv4w7GWiQzC8gSxMqS8lG0SdraLCOWZZCq9Q74fF4xXo 3ZPKRcKgIT88px8Wod0qmpIDi2MFux6t39+fkYvriIwjwNCSakFrmV5YE NCjw1YwXcnrLeFoTgqc/Ul41geKakNy9Yw9nUxvfQ1DNbB0VnjJNTAKNT 8+8nGhU2Gh97PiZGWVkkzaNDB1vZDeGlnnyWJV1LIVpiyq2q2QIcxUkas JpJ+ygMaepiZ7UqBgJgEB4sag48jgFxvwvTf7j+Rcx5Ge++v4g/eEQNCm NooHsVBMOkQeHiFWW4qnS/dB8x4r/C9Eckk9emF1pLEmqyVo/6U+g2x5+ g==; X-CSE-ConnectionGUID: 0wZ9PtpRSoqhi6esOgemrA== X-CSE-MsgGUID: UiH1S6QKT9+u5cLEAlfc5w== X-IronPort-AV: E=McAfee;i="6700,10204,11253"; a="42585895" X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="42585895" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2024 20:54:55 -0800 X-CSE-ConnectionGUID: 9Y0frNBsSeCofCgdsSX7aA== X-CSE-MsgGUID: J2r1VEV6Rda5ftdsL5ym/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="87673165" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by fmviesa009.fm.intel.com with ESMTP; 11 Nov 2024 20:54:53 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: vinod.govindapillai@intel.com, mitulkumar.ajitkumar.golani@intel.com, Suraj Kandpal Subject: [PATCH 4/5] drm/i915/watermark: Modify latency programmed into PKG_C_LATENCY Date: Tue, 12 Nov 2024 10:24:34 +0530 Message-Id: <20241112045435.1189586-4-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112045435.1189586-1-suraj.kandpal@intel.com> References: <20241112045435.1189586-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Increase the latency programmed into PKG_C_LATENCY latency to be a multiple of line time which is written into WM_LINETIME. --v2 -Fix commit subject line [Sai Teja] -Use individual DISPLAY_VER checks instead of range [Sai Teja] -Initialize max_linetime [Sai Teja] --v3 -take into account the scenario when adjusted_latency is 0 [Vinod] --v4 -rename adjusted_latency to latency [Mitul] -fix the condition in which dpkgc is disabled [Vinod] WA: 22020299601 Signed-off-by: Suraj Kandpal --- drivers/gpu/drm/i915/display/skl_watermark.c | 28 +++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index 4c92ada1c851..71ca89fc2888 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2848,9 +2848,11 @@ static int skl_wm_add_affected_planes(struct intel_atomic_state *state, * Program PKG_C_LATENCY Added Wake Time = 0 */ static void -skl_program_dpkgc_latency(struct drm_i915_private *i915, bool fixed_refresh_rate) +skl_program_dpkgc_latency(struct drm_i915_private *i915, + bool fixed_refresh_rate, + u32 max_linetime) { - u32 max_latency = LNL_PKG_C_LATENCY_MASK; + u32 latency = LNL_PKG_C_LATENCY_MASK; u32 clear = 0, val = 0; u32 added_wake_time = 0; @@ -2858,15 +2860,23 @@ skl_program_dpkgc_latency(struct drm_i915_private *i915, bool fixed_refresh_rate return; if (fixed_refresh_rate) { - max_latency = skl_watermark_max_latency(i915, 1); - if (max_latency == 0) - max_latency = LNL_PKG_C_LATENCY_MASK; + latency = skl_watermark_max_latency(i915, 1); + + /* Wa_22020299601 */ + if (latency) { + if (DISPLAY_VER(i915) == 20 || DISPLAY_VER(i915) == 30) + latency = max_linetime * + DIV_ROUND_UP(latency, max_linetime); + } else { + latency = LNL_PKG_C_LATENCY_MASK; + } + added_wake_time = DSB_EXE_TIME + i915->display.sagv.block_time_us; } clear |= LNL_ADDED_WAKE_TIME_MASK | LNL_PKG_C_LATENCY_MASK; - val |= REG_FIELD_PREP(LNL_PKG_C_LATENCY_MASK, max_latency) | + val |= REG_FIELD_PREP(LNL_PKG_C_LATENCY_MASK, latency) | REG_FIELD_PREP(LNL_ADDED_WAKE_TIME_MASK, added_wake_time); intel_uncore_rmw(&i915->uncore, LNL_PKG_C_LATENCY, clear, val); @@ -2879,6 +2889,7 @@ skl_compute_wm(struct intel_atomic_state *state) struct intel_crtc_state __maybe_unused *new_crtc_state; int ret, i; bool fixed_refresh_rate = false; + u32 max_linetime = 0; for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) { ret = skl_build_pipe_wm(state, crtc); @@ -2908,9 +2919,12 @@ skl_compute_wm(struct intel_atomic_state *state) new_crtc_state->vrr.vmin == new_crtc_state->vrr.flipline) || !new_crtc_state->vrr.enable) fixed_refresh_rate = true; + + max_linetime = max(new_crtc_state->linetime, max_linetime); } - skl_program_dpkgc_latency(to_i915(state->base.dev), fixed_refresh_rate); + skl_program_dpkgc_latency(to_i915(state->base.dev), fixed_refresh_rate, + max_linetime); skl_print_wm_changes(state); From patchwork Tue Nov 12 04:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13871720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1547ED41D54 for ; Tue, 12 Nov 2024 04:54:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B0AC010E563; Tue, 12 Nov 2024 04:54:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="G0iCAz6R"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by gabe.freedesktop.org (Postfix) with ESMTPS id E2C3410E55D; Tue, 12 Nov 2024 04:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1731387297; x=1762923297; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=P1KFBcxnraYLw6eNy5/D6TwSLuB5ChYm58QWRZgutVw=; b=G0iCAz6R9rsdbS0ALW/TFu7Prdktlasi1UdQuJdDtPWKQOuA/a9xCl+F jcV8v6rCNQpn+KocR/MZXFVUAxQLOXlHpUc0Ugew/Ge1FKT2k+uiWa5CY C17oNgEo+ktV9r2pPggyKhRsLyG6mUnkcBsw0BaolRBD1Sv7YkieeZ8q8 RJjnYPnjpapS7TwVuqz5QhuviiX2P6/QjMEoRYjR9Qb8vxhBuu5TgA+B4 3t05r5i9fRDsbyiVafshk9ArZxvtj4yUgCHpbly0pIcjHFAXFNHWVzxV5 UVnU8wFuZUueBPcb+IFzMfVFgC/GZKviCpQguzzjA6q05Cy7hiSReMFJZ w==; X-CSE-ConnectionGUID: ajf1nzDkQzSPbTd07ZjJnA== X-CSE-MsgGUID: 7jzJizGxQAajkm9SCoHN7Q== X-IronPort-AV: E=McAfee;i="6700,10204,11253"; a="42585900" X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="42585900" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2024 20:54:57 -0800 X-CSE-ConnectionGUID: p0LHM+XYQvSLWRNpsPXB5g== X-CSE-MsgGUID: 5lCYOmCrQxmBxgDfzmyCMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,147,1728975600"; d="scan'208";a="87673188" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.10]) by fmviesa009.fm.intel.com with ESMTP; 11 Nov 2024 20:54:55 -0800 From: Suraj Kandpal To: intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: vinod.govindapillai@intel.com, mitulkumar.ajitkumar.golani@intel.com, Suraj Kandpal Subject: [PATCH 5/5] drm/i915/watermark: Use intel_display for dpkgc code Date: Tue, 12 Nov 2024 10:24:35 +0530 Message-Id: <20241112045435.1189586-5-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241112045435.1189586-1-suraj.kandpal@intel.com> References: <20241112045435.1189586-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Use intel_display for DPKGC code wherever we can. While we are at it also use intel_de_rmw instead of intel_uncore_rmw as we really don't need the internal uncore_rmw_function. Signed-off-by: Suraj Kandpal --- drivers/gpu/drm/i915/display/skl_watermark.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c index 71ca89fc2888..746c906baa11 100644 --- a/drivers/gpu/drm/i915/display/skl_watermark.c +++ b/drivers/gpu/drm/i915/display/skl_watermark.c @@ -2852,11 +2852,12 @@ skl_program_dpkgc_latency(struct drm_i915_private *i915, bool fixed_refresh_rate, u32 max_linetime) { + struct intel_display *display = to_intel_display(&i915->drm); u32 latency = LNL_PKG_C_LATENCY_MASK; u32 clear = 0, val = 0; u32 added_wake_time = 0; - if (DISPLAY_VER(i915) < 20) + if (DISPLAY_VER(display) < 20) return; if (fixed_refresh_rate) { @@ -2872,14 +2873,14 @@ skl_program_dpkgc_latency(struct drm_i915_private *i915, } added_wake_time = DSB_EXE_TIME + - i915->display.sagv.block_time_us; + display->sagv.block_time_us; } clear |= LNL_ADDED_WAKE_TIME_MASK | LNL_PKG_C_LATENCY_MASK; val |= REG_FIELD_PREP(LNL_PKG_C_LATENCY_MASK, latency) | REG_FIELD_PREP(LNL_ADDED_WAKE_TIME_MASK, added_wake_time); - intel_uncore_rmw(&i915->uncore, LNL_PKG_C_LATENCY, clear, val); + intel_de_rmw(display, LNL_PKG_C_LATENCY, clear, val); } static int