All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Gustavo Sousa <gustavo.sousa@intel.com>,
	Uma Shankar <uma.shankar@intel.com>
Subject: [PATCH v2 11/14] drm/i915: Use the correct mdclk/cdclk ratio in MBUS updates
Date: Tue,  2 Apr 2024 18:50:13 +0300	[thread overview]
Message-ID: <20240402155016.13733-12-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20240402155016.13733-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The current cdclk/mbus programming sequence is as follows:
1. intel_set_cdclk_pre_plane_update()
2. update_mbus_pre_enable()
3. intel_set_cdclk_post_plane_update()

when the actual mdclk/cdclk programming is postponed to
intel_set_cdclk_post_plane_update() we must keep using
the old mdclk/cdclk ratio during update_mbus_pre_enable().
This guarantees the programmed ratio matches the rest of
the hardware state (mdlk/cdclk/mbus joining).

v2: Extracted from the vblank synchronized mbus programming patch

Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Reviewed-by: Uma Shankar <uma.shankar@intel.com> #v1
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c   | 11 +++++++++++
 drivers/gpu/drm/i915/display/intel_cdclk.h   |  1 +
 drivers/gpu/drm/i915/display/skl_watermark.c | 19 ++++++++-----------
 3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index e0c69d85e733..c23b7ee2837c 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -2576,6 +2576,17 @@ static void intel_cdclk_pcode_post_notify(struct intel_atomic_state *state)
 			   update_cdclk, update_pipe_count);
 }
 
+bool intel_cdclk_is_decreasing_later(struct intel_atomic_state *state)
+{
+	const struct intel_cdclk_state *old_cdclk_state =
+		intel_atomic_get_old_cdclk_state(state);
+	const struct intel_cdclk_state *new_cdclk_state =
+		intel_atomic_get_new_cdclk_state(state);
+
+	return new_cdclk_state && !new_cdclk_state->disable_pipes &&
+		new_cdclk_state->actual.cdclk < old_cdclk_state->actual.cdclk;
+}
+
 /**
  * intel_set_cdclk_pre_plane_update - Push the CDCLK state to the hardware
  * @state: intel atomic state
diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.h b/drivers/gpu/drm/i915/display/intel_cdclk.h
index 2843fc091086..5d4faf401774 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.h
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.h
@@ -69,6 +69,7 @@ bool intel_cdclk_clock_changed(const struct intel_cdclk_config *a,
 			       const struct intel_cdclk_config *b);
 u8 intel_mdclk_cdclk_ratio(struct drm_i915_private *i915,
 			   const struct intel_cdclk_config *cdclk_config);
+bool intel_cdclk_is_decreasing_later(struct intel_atomic_state *state);
 void intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state);
 void intel_set_cdclk_post_plane_update(struct intel_atomic_state *state);
 void intel_cdclk_dump_config(struct drm_i915_private *i915,
diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c
index a118ecf9e532..028c3e6d6b1d 100644
--- a/drivers/gpu/drm/i915/display/skl_watermark.c
+++ b/drivers/gpu/drm/i915/display/skl_watermark.c
@@ -3663,20 +3663,17 @@ static void intel_dbuf_mdclk_min_tracker_update(struct intel_atomic_state *state
 		intel_atomic_get_old_dbuf_state(state);
 	const struct intel_dbuf_state *new_dbuf_state =
 		intel_atomic_get_new_dbuf_state(state);
+	int mdclk_cdclk_ratio;
 
-	if (DISPLAY_VER(i915) >= 20 &&
-	    old_dbuf_state->mdclk_cdclk_ratio != new_dbuf_state->mdclk_cdclk_ratio) {
-		/*
-		 * For Xe2LPD and beyond, when there is a change in the ratio
-		 * between MDCLK and CDCLK, updates to related registers need to
-		 * happen at a specific point in the CDCLK change sequence. In
-		 * that case, we defer to the call to
-		 * intel_dbuf_mdclk_cdclk_ratio_update() to the CDCLK logic.
-		 */
-		return;
+	if (intel_cdclk_is_decreasing_later(state)) {
+		/* cdclk/mdclk will be changed later by intel_set_cdclk_post_plane_update() */
+		mdclk_cdclk_ratio = old_dbuf_state->mdclk_cdclk_ratio;
+	} else {
+		/* cdclk/mdclk already changed by intel_set_cdclk_pre_plane_update() */
+		mdclk_cdclk_ratio = new_dbuf_state->mdclk_cdclk_ratio;
 	}
 
-	intel_dbuf_mdclk_cdclk_ratio_update(i915, new_dbuf_state->mdclk_cdclk_ratio,
+	intel_dbuf_mdclk_cdclk_ratio_update(i915, mdclk_cdclk_ratio,
 					    new_dbuf_state->joined_mbus);
 }
 
-- 
2.43.2


  parent reply	other threads:[~2024-04-02 15:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 15:50 [PATCH v2 00/14] drm/i915: Implemnt vblank sycnhronized mbus joining changes Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 01/14] drm/i915/cdclk: Fix CDCLK programming order when pipes are active Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 02/14] drm/i915/cdclk: Fix voltage_level programming edge case Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 03/14] drm/i915/cdclk: Drop tgl/dg2 cdclk bump hacks Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 04/14] drm/i915/cdclk: Indicate whether CDCLK change happens during pre or post plane update Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 05/14] drm/i915: Loop over all active pipes in intel_mbus_dbox_update Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 06/14] drm/i915: Relocate intel_mbus_dbox_update() Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 07/14] drm/i915: Extract intel_dbuf_mbus_join_update() Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 08/14] drm/i915: Extract intel_dbuf_mdclk_min_tracker_update() Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 09/14] drm/i915: Add debugs for mbus joining and dbuf ratio programming Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 10/14] drm/i915: Use old mbus_join value when increasing CDCLK Ville Syrjala
2024-04-02 15:50 ` Ville Syrjala [this message]
2024-04-02 15:50 ` [PATCH v2 12/14] drm/i915: Implement vblank synchronized MBUS join changes Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 13/14] drm/i915: Use a plain old int for the cdclk/mdclk ratio Ville Syrjala
2024-04-02 15:50 ` [PATCH v2 14/14] drm/i915: Optimize out redundant dbuf slice updates Ville Syrjala
2024-04-02 17:47 ` ✗ Fi.CI.SPARSE: warning for drm/i915: Implemnt vblank sycnhronized mbus joining changes (rev3) Patchwork
2024-04-02 17:53 ` ✓ Fi.CI.BAT: success " Patchwork
2024-04-03  3:54 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-04-03 13:39 ` ✗ Fi.CI.SPARSE: warning for drm/i915: Implemnt vblank sycnhronized mbus joining changes (rev4) Patchwork
2024-04-04  6:19 ` ✓ Fi.CI.BAT: success " Patchwork
2024-04-04  7:31 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240402155016.13733-12-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=uma.shankar@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.