All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 2/9] drm/i915: remove intel_update_linetime_watermarks
Date: Thu,  9 May 2013 16:55:50 -0300	[thread overview]
Message-ID: <1368129350-15295-1-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <20130506134320.GA1985@cantiga.alporthouse.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

The spec says the linetime watermarks must be programmed before
enabling any display low power watermarks, but we're currently
updating the linetime watermarks after we call intel_update_watermarks
(and only at crtc_mode_set, not at crtc_{enable,disable}). So IMHO the
best way guarantee the linetime watermarks will be updated before the
low power watermarks is inside the update_wm function, because it's
the function that enables low power watermarks. And since Haswell is
the only platform that has linetime watermarks, let's completely kill
the "intel_update_linetime_watermarks" abstraction and just use the
intel_update_watermarks abstraction by creating haswell_update_wm.

For now haswell_update_wm is still calling sandybridge_update_wm, but
in the future I plan to implement a function specific to Haswell.

v2: - Rename patch
    - Disable LP watermarks before changing linetime WMs (Chris)
    - Add a comment explaining that this is just temporary code.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h      |    2 --
 drivers/gpu/drm/i915/intel_display.c |    2 --
 drivers/gpu/drm/i915/intel_drv.h     |    2 --
 drivers/gpu/drm/i915/intel_pm.c      |   43 ++++++++++++++++++++++++----------
 4 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c81100c..8606103 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -316,8 +316,6 @@ struct drm_i915_display_funcs {
 	void (*update_wm)(struct drm_device *dev);
 	void (*update_sprite_wm)(struct drm_device *dev, int pipe,
 				 uint32_t sprite_width, int pixel_size);
-	void (*update_linetime_wm)(struct drm_device *dev, int pipe,
-				 struct drm_display_mode *mode);
 	void (*modeset_global_resources)(struct drm_device *dev);
 	/* Returns the active state of the crtc, and if the crtc is active,
 	 * fills out the pipe-config with the hw state. */
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b796752..7bcd60c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6026,8 +6026,6 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc,
 
 	intel_update_watermarks(dev);
 
-	intel_update_linetime_watermarks(dev, pipe, adjusted_mode);
-
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index be9ad39..80b417a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -727,8 +727,6 @@ extern void intel_update_watermarks(struct drm_device *dev);
 extern void intel_update_sprite_watermarks(struct drm_device *dev, int pipe,
 					   uint32_t sprite_width,
 					   int pixel_size);
-extern void intel_update_linetime_watermarks(struct drm_device *dev, int pipe,
-			 struct drm_display_mode *mode);
 
 extern unsigned long intel_gen4_compute_page_offset(int *x, int *y,
 						    unsigned int tiling_mode,
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 93b8f70..236cd99 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2069,12 +2069,19 @@ static void ivybridge_update_wm(struct drm_device *dev)
 }
 
 static void
-haswell_update_linetime_wm(struct drm_device *dev, int pipe,
-				 struct drm_display_mode *mode)
+haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	enum pipe pipe = intel_crtc->pipe;
+	struct drm_display_mode *mode = &intel_crtc->config.adjusted_mode;
 	u32 temp;
 
+	if (!intel_crtc_active(crtc)) {
+		I915_WRITE(PIPE_WM_LINETIME(pipe), 0);
+		return;
+	}
+
 	temp = I915_READ(PIPE_WM_LINETIME(pipe));
 	temp &= ~PIPE_WM_LINETIME_MASK;
 
@@ -2095,6 +2102,26 @@ haswell_update_linetime_wm(struct drm_device *dev, int pipe,
 	I915_WRITE(PIPE_WM_LINETIME(pipe), temp);
 }
 
+static void haswell_update_wm(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc;
+	enum pipe pipe;
+
+	/* Disable the LP WMs before changine the linetime registers. This is
+	 * just a temporary code that will be replaced soon. */
+	I915_WRITE(WM3_LP_ILK, 0);
+	I915_WRITE(WM2_LP_ILK, 0);
+	I915_WRITE(WM1_LP_ILK, 0);
+
+	for_each_pipe(pipe) {
+		crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+		haswell_update_linetime_wm(dev, crtc);
+	}
+
+	sandybridge_update_wm(dev);
+}
+
 static bool
 sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,
 			      uint32_t sprite_width, int pixel_size,
@@ -2290,15 +2317,6 @@ void intel_update_watermarks(struct drm_device *dev)
 		dev_priv->display.update_wm(dev);
 }
 
-void intel_update_linetime_watermarks(struct drm_device *dev,
-		int pipe, struct drm_display_mode *mode)
-{
-	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	if (dev_priv->display.update_linetime_wm)
-		dev_priv->display.update_linetime_wm(dev, pipe, mode);
-}
-
 void intel_update_sprite_watermarks(struct drm_device *dev, int pipe,
 				    uint32_t sprite_width, int pixel_size)
 {
@@ -4553,9 +4571,8 @@ void intel_init_pm(struct drm_device *dev)
 			dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
 		} else if (IS_HASWELL(dev)) {
 			if (SNB_READ_WM0_LATENCY()) {
-				dev_priv->display.update_wm = sandybridge_update_wm;
+				dev_priv->display.update_wm = haswell_update_wm;
 				dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
-				dev_priv->display.update_linetime_wm = haswell_update_linetime_wm;
 			} else {
 				DRM_DEBUG_KMS("Failed to read display plane latency. "
 					      "Disable CxSR\n");
-- 
1.7.10.4

  reply	other threads:[~2013-05-09 19:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03 20:23 [PATCH 0/9] Haswell watermarks, round 1 Paulo Zanoni
2013-05-03 20:23 ` [PATCH 1/9] drm/i915: ILK, SNB and IVB don't have linetime watermarks Paulo Zanoni
2013-05-20 13:41   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 2/9] drm/i915: fix linetime_watermarks code Paulo Zanoni
2013-05-05  7:19   ` Chris Wilson
2013-05-06 13:13     ` Paulo Zanoni
2013-05-06 13:43       ` Chris Wilson
2013-05-09 19:55         ` Paulo Zanoni [this message]
2013-05-20 13:48           ` [PATCH 2/9] drm/i915: remove intel_update_linetime_watermarks Ville Syrjälä
2013-05-03 20:23 ` [PATCH 3/9] drm/i915: use the mode->htotal to calculate linetime watermarks Paulo Zanoni
2013-05-20 13:42   ` Ville Syrjälä
2013-05-21  9:26   ` Daniel Vetter
2013-05-21 14:33     ` Paulo Zanoni
2013-05-21 14:59       ` Daniel Vetter
2013-05-03 20:23 ` [PATCH 4/9] drm/i915: fix haswell linetime watermarks calculation Paulo Zanoni
2013-05-20 13:53   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 5/9] drm/i915: use the correct clock when calculating linetime watermarks Paulo Zanoni
2013-05-20 14:00   ` Ville Syrjälä
2013-05-21  9:35   ` Daniel Vetter
2013-05-03 20:23 ` [PATCH 6/9] drm/i915: make intel_ddi_get_cdclk_freq return values in KHz Paulo Zanoni
2013-05-05  7:20   ` Chris Wilson
2013-05-06 13:53     ` Paulo Zanoni
2013-05-20 14:11   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 7/9] drm/i915: set the IPS linetime watermark Paulo Zanoni
2013-05-20 14:05   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 8/9] drm/i915: MCH_SSKPD is a 64 bit register on Haswell Paulo Zanoni
2013-05-20 13:38   ` Ville Syrjälä
2013-05-03 20:23 ` [PATCH 9/9] drm/i915: set FORCE_ARB_IDLE_PLANES workaround Paulo Zanoni
2013-05-20 13:37   ` Ville Syrjälä
2013-05-21 10:01   ` Daniel Vetter
2013-05-21 13:27     ` Paulo Zanoni
2013-05-23 10:36       ` Ville Syrjälä
2013-05-23 10:51         ` Daniel Vetter

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=1368129350-15295-1-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@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.