Skip to contentSkip to conversation

Haswell watermarks, round 1

PATCH In review Paulo Zanoni 4 participants 33 messages May 3, 2013 – May 23, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Haswell watermarks, round 1

From: Paulo Zanoni <[email protected]>

Hi

All our Haswell watermarks code does not follow our specifications, and this series only does some small fixes and also fixes the linetime watermarks. For the other watermarks we're still calling the old sandybridge update_wm functions, so the next patches will implement Haswell-specific functions and use them, also using the linetime watermarks fixed in this series. Consider this series as a warm-up for the next ones :)

Cheers,
Paulo

Paulo Zanoni (9):
drm/i915: ILK, SNB and IVB don't have linetime watermarks drm/i915: fix linetime_watermarks code
drm/i915: use the mode->htotal to calculate linetime watermarks drm/i915: fix haswell linetime watermarks calculation drm/i915: use the correct clock when calculating linetime watermarks drm/i915: make intel_ddi_get_cdclk_freq return values in KHz drm/i915: set the IPS linetime watermark
drm/i915: MCH_SSKPD is a 64 bit register on Haswell drm/i915: set FORCE_ARB_IDLE_PLANES workaround

 drivers/gpu/drm/i915/i915_drv.h      |    2 -
 drivers/gpu/drm/i915/i915_reg.h      |    3 ++
 drivers/gpu/drm/i915/intel_ddi.c     |   10 ++---
 drivers/gpu/drm/i915/intel_display.c |    4 --
 drivers/gpu/drm/i915/intel_dp.c      |    3 +-
 drivers/gpu/drm/i915/intel_drv.h     |    2 -
 drivers/gpu/drm/i915/intel_pm.c      |   73 ++++++++++++++++++----------------
 7 files changed, 48 insertions(+), 49 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/9 drm/i915: ILK, SNB and IVB don't have linetime watermarks

From: Paulo Zanoni <[email protected]>

So don't call intel_update_linetime_watermarks from ironlake_crtc_mode_set. Only Haswell has these watermarks.

---
 drivers/gpu/drm/i915/intel_display.c |    2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -2
index 9af3ec2..3e742f9 100644
@@ -5863,8 +5863,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 
 	intel_update_watermarks(dev);
 
-	intel_update_linetime_watermarks(dev, pipe, adjusted_mode);
-
 	return ret;
 }
 
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/9
#2 lore raw

Re: [PATCH 1/9] drm/i915: ILK, SNB and IVB don't have linetime watermarks

Quoted 6 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

So don't call intel_update_linetime_watermarks from ironlake_crtc_mode_set. Only Haswell has these watermarks.

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_display.c |    2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -2
index 9af3ec2..3e742f9 100644
@@ -5863,8 +5863,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 
 	intel_update_watermarks(dev);
 
-	intel_update_linetime_watermarks(dev, pipe, adjusted_mode);
-
 	return ret;
 }
 
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#3 lore raw

PATCH 2/9 drm/i915: fix linetime_watermarks code

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

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.

---
 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      |   37 ++++++++++++++++++++++------------
 4 files changed, 24 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
index 5160e1e..f9864c7 100644
@@ -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. */
drivers/gpu/drm/i915/intel_display.c +0 -2
index 3e742f9..ab5690b 100644
@@ -6013,8 +6013,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;
 }
 
drivers/gpu/drm/i915/intel_drv.h +0 -2
index ae73631..f677af6 100644
@@ -732,8 +732,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,
drivers/gpu/drm/i915/intel_pm.c +24 -13
index 1afaec4..d056bc9 100644
@@ -2015,12 +2015,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;
 
@@ -2041,6 +2048,20 @@ 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;
+
+	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,
@@ -2236,15 +2257,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)
 {
@@ -4482,9 +4494,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");
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [PATCH 2/9] drm/i915: fix linetime_watermarks code

Quoted 13 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

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.

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, int pipe, · line 2060

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10 -0
+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;
+
+	for_each_pipe(pipe) {
+		crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+		haswell_update_linetime_wm(dev, crtc);
+	}

The LP watermarks are still enabled at this point.

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, int pipe, · line 2063

Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3 -0
+
+	sandybridge_update_wm(dev);
+}

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#5 lore raw

Re: [PATCH 2/9] drm/i915: fix linetime_watermarks code

2013/5/5 Chris Wilson <[email protected]>:

Quoted 14 lines · Paulo Zanoni
Quoted 12 lines

From: Paulo Zanoni <[email protected]>

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.

Quoted 12 lines

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, int pipe, · line 2060

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10 -0
+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;
+
+     for_each_pipe(pipe) {
+             crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+             haswell_update_linetime_wm(dev, crtc);
+     }

The LP watermarks are still enabled at this point.

Did you mean "they're not disabled yet"? Well, at least now we're programming the linetime registers _before_ we update the LP registers, and every time. If we want to be 100% spec-compliant without any intermediate steps then I guess we can discard this linetime series and merge it all inside the single patch that will fully implement haswell_update_wm. But it will be one single big patch. Just tell me which one you prefer.

Quoted 7 lines

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, int pipe, · line 2063

Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3 -0
+
+     sandybridge_update_wm(dev);
+}

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

Signature · 1 line
Paulo Zanoni
#6 lore raw

Re: [PATCH 2/9] drm/i915: fix linetime_watermarks code

Quoted 28 lines · Paulo Zanoni

2013/5/5 Chris Wilson <[email protected]>:

Quoted 14 lines · Paulo Zanoni
Quoted 12 lines

From: Paulo Zanoni <[email protected]>

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.

Quoted 12 lines

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, int pipe, · line 2060

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10 -0
+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;
+
+     for_each_pipe(pipe) {
+             crtc = dev_priv->pipe_to_crtc_mapping[pipe];
+             haswell_update_linetime_wm(dev, crtc);
+     }

The LP watermarks are still enabled at this point.

Quoted 7 lines

Did you mean "they're not disabled yet"? Well, at least now we're programming the linetime registers _before_ we update the LP registers, and every time. If we want to be 100% spec-compliant without any intermediate steps then I guess we can discard this linetime series and merge it all inside the single patch that will fully implement haswell_update_wm. But it will be one single big patch. Just tell me which one you prefer.

Or you can just disable the 3 LP wm first before updating the linetime wm.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw

PATCH 2/9 drm/i915: remove intel_update_linetime_watermarks

From: Paulo Zanoni <[email protected]>

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.

---
 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(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
index c81100c..8606103 100644
@@ -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. */
drivers/gpu/drm/i915/intel_display.c +0 -2
index b796752..7bcd60c 100644
@@ -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;
 }
 
drivers/gpu/drm/i915/intel_drv.h +0 -2
index be9ad39..80b417a 100644
@@ -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,
drivers/gpu/drm/i915/intel_pm.c +30 -13

72 lines not on this page · raw message

Signature · 1 line
1.7.10.4
Reviewed-by on v1 2/9
#8 lore raw

Re: [PATCH 2/9] drm/i915: remove intel_update_linetime_watermarks

Quoted 101 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

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.

---
 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(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
index c81100c..8606103 100644
@@ -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. */
drivers/gpu/drm/i915/intel_display.c +0 -2
index b796752..7bcd60c 100644
@@ -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;
 }
 
drivers/gpu/drm/i915/intel_drv.h +0 -2
index be9ad39..80b417a 100644
@@ -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,
drivers/gpu/drm/i915/intel_pm.c +13 -2
index 93b8f70..236cd99 100644
@@ -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;

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, int pipe, · line 2118

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10 -0
+	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];

list_for_each_entry(crtc, ...)

Otherwise:

Quoted 43 lines
drivers/gpu/drm/i915/intel_pm.c +7 -11
+		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");
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#9 lore raw

PATCH 3/9 drm/i915: use the mode->htotal to calculate linetime watermarks

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

... instead of mode->crtc_display. The spec says "pipe horizontal total number of pixels" and the "Haswell Watermark Calculator" tool uses the "Pipe H Total" instead of "Pipe H Src" as the value.

---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
index d056bc9..4cc5f99 100644
@@ -2035,7 +2035,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	 * row at the given clock rate, multiplied by 8.
 	 * */
 	temp |= PIPE_WM_LINETIME_TIME(
-		((mode->crtc_hdisplay * 1000) / mode->clock) * 8);
+		((mode->htotal * 1000) / mode->clock) * 8);
 
 	/* IPS watermarks are only used by pipe A, and are ignored by
 	 * pipes B and C.  They are calculated similarly to the common
Signature · 1 line
1.7.10.4
Reviewed-by on v1 3/9
#10 lore raw

Re: [PATCH 3/9] drm/i915: use the mode->htotal to calculate linetime watermarks

Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

... instead of mode->crtc_display. The spec says "pipe horizontal total number of pixels" and the "Haswell Watermark Calculator" tool uses the "Pipe H Total" instead of "Pipe H Src" as the value.

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
index d056bc9..4cc5f99 100644
@@ -2035,7 +2035,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	 * row at the given clock rate, multiplied by 8.
 	 * */
 	temp |= PIPE_WM_LINETIME_TIME(
-		((mode->crtc_hdisplay * 1000) / mode->clock) * 8);
+		((mode->htotal * 1000) / mode->clock) * 8);
 
 	/* IPS watermarks are only used by pipe A, and are ignored by
 	 * pipes B and C.  They are calculated similarly to the common
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#11 lore raw

Re: [PATCH 3/9] drm/i915: use the mode->htotal to calculate linetime watermarks

In reply to Paulo Zanoni
Quoted 16 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

... instead of mode->crtc_display. The spec says "pipe horizontal total number of pixels" and the "Haswell Watermark Calculator" tool uses the "Pipe H Total" instead of "Pipe H Src" as the value.

---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index d056bc9..4cc5f99 100644

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc) · line 2038

Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -2035,7 +2035,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	 * row at the given clock rate, multiplied by 8.
 	 * */
 	temp |= PIPE_WM_LINETIME_TIME(
-		((mode->crtc_hdisplay * 1000) / mode->clock) * 8);
+		((mode->htotal * 1000) / mode->clock) * 8);

Big question: What's the right value for interlaced modes? On progressive mode crtc_ mode values match the non-crtc_ prefixed ones, but not so much for interlaced modes ... So if your tool expects something resembling what we program into the pipe registers, we need to change this again.

Merged for now since the spec explicitly says "pixels", but I'd like someone to double-check this.
-Daniel

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0 -0
 	/* IPS watermarks are only used by pipe A, and are ignored by
 	 * pipes B and C.  They are calculated similarly to the common
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#12 lore raw

Re: [PATCH 3/9] drm/i915: use the mode->htotal to calculate linetime watermarks

2013/5/21 Daniel Vetter <[email protected]>:

Quoted 28 lines · Paulo Zanoni
Quoted 16 lines

From: Paulo Zanoni <[email protected]>

... instead of mode->crtc_display. The spec says "pipe horizontal total number of pixels" and the "Haswell Watermark Calculator" tool uses the "Pipe H Total" instead of "Pipe H Src" as the value.

---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index d056bc9..4cc5f99 100644

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc) · line 2038

Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -2035,7 +2035,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
       * row at the given clock rate, multiplied by 8.
       * */
      temp |= PIPE_WM_LINETIME_TIME(
-             ((mode->crtc_hdisplay * 1000) / mode->clock) * 8);
+             ((mode->htotal * 1000) / mode->clock) * 8);

Big question: What's the right value for interlaced modes? On progressive mode crtc_ mode values match the non-crtc_ prefixed ones, but not so much for interlaced modes ... So if your tool expects something resembling what we program into the pipe registers, we need to change this again.

Quoted 2 lines

Merged for now since the spec explicitly says "pixels", but I'd like someone to double-check this.

The WM calculator tool says:
"Pipe H total is found in PIPE_HTOTAL horizontal field".

But mode->htotal and mode->crtc_htotal are the same even when the mode is interlaced. So at least the values we compute are correct. I could write a follow-up patch updating this if you want.

Quoted 16 lines

-Daniel

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0 -1
      /* IPS watermarks are only used by pipe A, and are ignored by
       * pipes B and C.  They are calculated similarly to the common
--

1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 1 line
Paulo Zanoni
#13 lore raw

Re: [PATCH 3/9] drm/i915: use the mode->htotal to calculate linetime watermarks

Quoted 32 lines · Paulo Zanoni

2013/5/21 Daniel Vetter <[email protected]>:

Quoted 28 lines · Paulo Zanoni
Quoted 16 lines

From: Paulo Zanoni <[email protected]>

... instead of mode->crtc_display. The spec says "pipe horizontal total number of pixels" and the "Haswell Watermark Calculator" tool uses the "Pipe H Total" instead of "Pipe H Src" as the value.

---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +0 -0
index d056bc9..4cc5f99 100644

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc) · line 2038

Quoted 5 lines
drivers/gpu/drm/i915/intel_pm.c +1 -1
@@ -2035,7 +2035,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
       * row at the given clock rate, multiplied by 8.
       * */
      temp |= PIPE_WM_LINETIME_TIME(
-             ((mode->crtc_hdisplay * 1000) / mode->clock) * 8);
+             ((mode->htotal * 1000) / mode->clock) * 8);

Big question: What's the right value for interlaced modes? On progressive mode crtc_ mode values match the non-crtc_ prefixed ones, but not so much for interlaced modes ... So if your tool expects something resembling what we program into the pipe registers, we need to change this again.

Quoted 2 lines

Merged for now since the spec explicitly says "pixels", but I'd like someone to double-check this.

Quoted 6 lines

The WM calculator tool says:
"Pipe H total is found in PIPE_HTOTAL horizontal field".

But mode->htotal and mode->crtc_htotal are the same even when the mode is interlaced. So at least the values we compute are correct. I could write a follow-up patch updating this if you want.

Oh, I've mixed up the horizontal timings with the vertical ones. You're right, everything is working correctly as-is. -Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#14 lore raw

PATCH 4/9 drm/i915: fix haswell linetime watermarks calculation

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Move the "*8" calculation to the left side so we don't propagate rounding errors. Also use DIV_ROUND_CLOSEST because that's what the spec says we need to do.

---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 4cc5f99..8468b40 100644
@@ -2035,7 +2035,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	 * row at the given clock rate, multiplied by 8.
 	 * */
 	temp |= PIPE_WM_LINETIME_TIME(
-		((mode->htotal * 1000) / mode->clock) * 8);
+		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock));
 
 	/* IPS watermarks are only used by pipe A, and are ignored by
 	 * pipes B and C.  They are calculated similarly to the common
Signature · 1 line
1.7.10.4
Reviewed-by on v1 4/9
#15 lore raw

Re: [PATCH 4/9] drm/i915: fix haswell linetime watermarks calculation

Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Move the "*8" calculation to the left side so we don't propagate rounding errors. Also use DIV_ROUND_CLOSEST because that's what the spec says we need to do.

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 4cc5f99..8468b40 100644
@@ -2035,7 +2035,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	 * row at the given clock rate, multiplied by 8.
 	 * */
 	temp |= PIPE_WM_LINETIME_TIME(
-		((mode->htotal * 1000) / mode->clock) * 8);
+		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock));
 
 	/* IPS watermarks are only used by pipe A, and are ignored by
 	 * pipes B and C.  They are calculated similarly to the common
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#16 lore raw

PATCH 5/9 drm/i915: use the correct clock when calculating linetime watermarks

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

If we're using DP/eDP, adjusted_mode->clock may be just the port link clock, but we also can't use mode->clock because it's wrong when we're using the using panel fitter.

---
 drivers/gpu/drm/i915/intel_pm.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +7 -1
index 8468b40..3ca020c 100644
@@ -2021,6 +2021,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	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;
+	int target_clock;
 	u32 temp;
 
 	if (!intel_crtc_active(crtc)) {
@@ -2028,6 +2029,11 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 		return;
 	}
 
+	if (intel_crtc->config.pixel_target_clock)
+		target_clock = intel_crtc->config.pixel_target_clock;
+	else
+		target_clock = intel_crtc->config.adjusted_mode.clock;
+
 	temp = I915_READ(PIPE_WM_LINETIME(pipe));
 	temp &= ~PIPE_WM_LINETIME_MASK;
 
@@ -2035,7 +2041,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	 * row at the given clock rate, multiplied by 8.
 	 * */
 	temp |= PIPE_WM_LINETIME_TIME(
-		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock));
+		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, target_clock));
 
 	/* IPS watermarks are only used by pipe A, and are ignored by
 	 * pipes B and C.  They are calculated similarly to the common
Signature · 1 line
1.7.10.4
Reviewed-by on v1 5/9
#17 lore raw

Re: [PATCH 5/9] drm/i915: use the correct clock when calculating linetime watermarks

Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

If we're using DP/eDP, adjusted_mode->clock may be just the port link clock, but we also can't use mode->clock because it's wrong when we're using the using panel fitter.

Quoted 44 lines
---
 drivers/gpu/drm/i915/intel_pm.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +7 -1
index 8468b40..3ca020c 100644
@@ -2021,6 +2021,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	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;
+	int target_clock;
 	u32 temp;
 
 	if (!intel_crtc_active(crtc)) {
@@ -2028,6 +2029,11 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 		return;
 	}
 
+	if (intel_crtc->config.pixel_target_clock)
+		target_clock = intel_crtc->config.pixel_target_clock;
+	else
+		target_clock = intel_crtc->config.adjusted_mode.clock;
+
 	temp = I915_READ(PIPE_WM_LINETIME(pipe));
 	temp &= ~PIPE_WM_LINETIME_MASK;
 
@@ -2035,7 +2041,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	 * row at the given clock rate, multiplied by 8.
 	 * */
 	temp |= PIPE_WM_LINETIME_TIME(
-		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock));
+		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, target_clock));
 
 	/* IPS watermarks are only used by pipe A, and are ignored by
 	 * pipes B and C.  They are calculated similarly to the common
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#18 lore raw

Re: [PATCH 5/9] drm/i915: use the correct clock when calculating linetime watermarks

In reply to Paulo Zanoni
Quoted 24 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

If we're using DP/eDP, adjusted_mode->clock may be just the port link clock, but we also can't use mode->clock because it's wrong when we're using the using panel fitter.

---
 drivers/gpu/drm/i915/intel_pm.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -0
index 8468b40..3ca020c 100644
@@ -2021,6 +2021,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	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;
+	int target_clock;
 	u32 temp;
 
 	if (!intel_crtc_active(crtc)) {

drivers/gpu/drm/i915/intel_pm.c haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc) · line 2035

Quoted 7 lines
drivers/gpu/drm/i915/intel_pm.c +4 -0
@@ -2028,6 +2029,11 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 		return;
 	}
 
+	if (intel_crtc->config.pixel_target_clock)
+		target_clock = intel_crtc->config.pixel_target_clock;
+	else
+		target_clock = intel_crtc->config.adjusted_mode.clock;

I'll ignore this one here, since I already have the real fix at

http://cgit.freedesktop.org/~danvet/drm/commit/?h=fdi-dither&id=0600051ee5eb6d13d385c8629c0ab0f7809346be

I'll submit the series this patch is a part of asap to intel-gfx.

Cheers, Daniel

Quoted 20 lines
drivers/gpu/drm/i915/intel_pm.c +2 -1
+
 	temp = I915_READ(PIPE_WM_LINETIME(pipe));
 	temp &= ~PIPE_WM_LINETIME_MASK;
 
@@ -2035,7 +2041,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	 * row at the given clock rate, multiplied by 8.
 	 * */
 	temp |= PIPE_WM_LINETIME_TIME(
-		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, mode->clock));
+		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, target_clock));
 
 	/* IPS watermarks are only used by pipe A, and are ignored by
 	 * pipes B and C.  They are calculated similarly to the common
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#19 lore raw

PATCH 6/9 drm/i915: make intel_ddi_get_cdclk_freq return values in KHz

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

With this, that 338 can finally become the correct 337500.

Due to the change we need to adjust the intel_dp_aux_ch function to set the correct value, so adjust the division and also use DIV_ROUND_CLOSEST instead of the old "round down" behavior because the spec says the value "should be programmed to get as close as possible to the ideal rate of 2MHz".

---
 drivers/gpu/drm/i915/intel_ddi.c |   10 +++++-----
 drivers/gpu/drm/i915/intel_dp.c  |    3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +5 -5
index 21fb852..e5b1b63 100644
@@ -1335,14 +1335,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
 {
 	if (I915_READ(HSW_FUSE_STRAP) & HSW_CDCLK_LIMIT)
-		return 450;
+		return 450000;
 	else if ((I915_READ(LCPLL_CTL) & LCPLL_CLK_FREQ_MASK) ==
 		 LCPLL_CLK_FREQ_450)
-		return 450;
+		return 450000;
 	else if (IS_ULT(dev_priv->dev))
-		return 338;
+		return 337500;
 	else
-		return 540;
+		return 540000;
 }
 
 void intel_ddi_pll_init(struct drm_device *dev)
@@ -1355,7 +1355,7 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	 * Don't even try to turn it on.
 	 */
 
-	DRM_DEBUG_KMS("CDCLK running at %dMHz\n",
+	DRM_DEBUG_KMS("CDCLK running at %dKHz\n",
 		      intel_ddi_get_cdclk_freq(dev_priv));
 
 	if (val & LCPLL_CD_SOURCE_FCLK)
drivers/gpu/drm/i915/intel_dp.c +2 -1
index a293523..3df1383 100644
@@ -346,7 +346,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 	 */
 	if (is_cpu_edp(intel_dp)) {
 		if (HAS_DDI(dev))
-			aux_clock_divider = intel_ddi_get_cdclk_freq(dev_priv) >> 1;
+			aux_clock_divider = DIV_ROUND_CLOSEST(
+				intel_ddi_get_cdclk_freq(dev_priv), 2000);
 		else if (IS_VALLEYVIEW(dev))
 			aux_clock_divider = 100;
 		else if (IS_GEN6(dev) || IS_GEN7(dev))
Signature · 1 line
1.7.10.4
#20 lore raw

Re: [PATCH 6/9] drm/i915: make intel_ddi_get_cdclk_freq return values in KHz

Quoted 9 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

With this, that 338 can finally become the correct 337500.

Due to the change we need to adjust the intel_dp_aux_ch function to set the correct value, so adjust the division and also use DIV_ROUND_CLOSEST instead of the old "round down" behavior because the spec says the value "should be programmed to get as close as possible to the ideal rate of 2MHz".

Can you please demonstrate an instance where this code produces a different value? And only then correct the constants. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#21 lore raw

Re: [PATCH 6/9] drm/i915: make intel_ddi_get_cdclk_freq return values in KHz

2013/5/5 Chris Wilson <[email protected]>:

Quoted 5 lines · Paulo Zanoni
Quoted 4 lines

From: Paulo Zanoni <[email protected]>

With this, that 338 can finally become the correct 337500.

Quoted 8 lines
Quoted 5 lines

Due to the change we need to adjust the intel_dp_aux_ch function to set the correct value, so adjust the division and also use DIV_ROUND_CLOSEST instead of the old "round down" behavior because the spec says the value "should be programmed to get as close as possible to the ideal rate of 2MHz".

Can you please demonstrate an instance where this code produces a different value? And only then correct the constants.

I use the 337500 value on the next patch, when setting the ips_linetime value. The correct frequency is 337500, not 338000.

ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, intel_ddi_get_cdclk_freq);
For a mode with htotal of 2640 [0] we'll have: (i) (2640 * 1000 * 8) / 338000 = 62.48, resulting in 62 and (ii) (2640 * 1000 * 8) / 337500 = 62.57 resulting in 63.

For the case inside intel_dp.c:
Previously we were using 338. So with the old formula we were writing 338/2 = 169 to the register. And 337500 / 169 = 1997.04 (we use 337500 here because it's the real clock value). With the new value of 337500/2000 we'll have 168.75, which is 168 on the round-down case and 169 on the round-closest case. If we write 168 to the register, 337500 / 168 = 2008.92, and 2008.92 is more distant from 2000 than 1997.04. So with this patch we're changing the formula but still writing the same correct value to the DP AUX register.

[0]: That's 1920x1080@50Hz on my DP monitor.

Quoted 4 lines

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

Signature · 1 line
Paulo Zanoni
Reviewed-by on v1 6/9
#22 lore raw

Re: [PATCH 6/9] drm/i915: make intel_ddi_get_cdclk_freq return values in KHz

In reply to Paulo Zanoni
Quoted 11 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

With this, that 338 can finally become the correct 337500.

Due to the change we need to adjust the intel_dp_aux_ch function to set the correct value, so adjust the division and also use DIV_ROUND_CLOSEST instead of the old "round down" behavior because the spec says the value "should be programmed to get as close as possible to the ideal rate of 2MHz".

Quoted 58 lines
---
 drivers/gpu/drm/i915/intel_ddi.c |   10 +++++-----
 drivers/gpu/drm/i915/intel_dp.c  |    3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +5 -5
index 21fb852..e5b1b63 100644
@@ -1335,14 +1335,14 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)
 int intel_ddi_get_cdclk_freq(struct drm_i915_private *dev_priv)
 {
 	if (I915_READ(HSW_FUSE_STRAP) & HSW_CDCLK_LIMIT)
-		return 450;
+		return 450000;
 	else if ((I915_READ(LCPLL_CTL) & LCPLL_CLK_FREQ_MASK) ==
 		 LCPLL_CLK_FREQ_450)
-		return 450;
+		return 450000;
 	else if (IS_ULT(dev_priv->dev))
-		return 338;
+		return 337500;
 	else
-		return 540;
+		return 540000;
 }
 
 void intel_ddi_pll_init(struct drm_device *dev)
@@ -1355,7 +1355,7 @@ void intel_ddi_pll_init(struct drm_device *dev)
 	 * Don't even try to turn it on.
 	 */
 
-	DRM_DEBUG_KMS("CDCLK running at %dMHz\n",
+	DRM_DEBUG_KMS("CDCLK running at %dKHz\n",
 		      intel_ddi_get_cdclk_freq(dev_priv));
 
 	if (val & LCPLL_CD_SOURCE_FCLK)
drivers/gpu/drm/i915/intel_dp.c +2 -1
index a293523..3df1383 100644
@@ -346,7 +346,8 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
 	 */
 	if (is_cpu_edp(intel_dp)) {
 		if (HAS_DDI(dev))
-			aux_clock_divider = intel_ddi_get_cdclk_freq(dev_priv) >> 1;
+			aux_clock_divider = DIV_ROUND_CLOSEST(
+				intel_ddi_get_cdclk_freq(dev_priv), 2000);
 		else if (IS_VALLEYVIEW(dev))
 			aux_clock_divider = 100;
 		else if (IS_GEN6(dev) || IS_GEN7(dev))
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#23 lore raw

PATCH 7/9 drm/i915: set the IPS linetime watermark

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Remove the "placeholder" comment and set the actual value described by the specification. We still don't enable IPS, but it won't hurt to already have the value set here.

While at it, fully set the register value instead of just masking the values we're changing.

---
 drivers/gpu/drm/i915/intel_pm.c |   22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +7 -15
index 3ca020c..59bac2e 100644
@@ -2022,7 +2022,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	enum pipe pipe = intel_crtc->pipe;
 	struct drm_display_mode *mode = &intel_crtc->config.adjusted_mode;
 	int target_clock;
-	u32 temp;
+	u32 linetime, ips_linetime;
 
 	if (!intel_crtc_active(crtc)) {
 		I915_WRITE(PIPE_WM_LINETIME(pipe), 0);
@@ -2034,24 +2034,16 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	else
 		target_clock = intel_crtc->config.adjusted_mode.clock;
 
-	temp = I915_READ(PIPE_WM_LINETIME(pipe));
-	temp &= ~PIPE_WM_LINETIME_MASK;
-
 	/* The WM are computed with base on how long it takes to fill a single
 	 * row at the given clock rate, multiplied by 8.
 	 * */
-	temp |= PIPE_WM_LINETIME_TIME(
-		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, target_clock));
-
-	/* IPS watermarks are only used by pipe A, and are ignored by
-	 * pipes B and C.  They are calculated similarly to the common
-	 * linetime values, except that we are using CD clock frequency
-	 * in MHz instead of pixel rate for the division.
-	 *
-	 * This is a placeholder for the IPS watermark calculation code.
-	 */
+	linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, target_clock);
+	ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8,
+					 intel_ddi_get_cdclk_freq(dev_priv));
 
-	I915_WRITE(PIPE_WM_LINETIME(pipe), temp);
+	I915_WRITE(PIPE_WM_LINETIME(pipe),
+		   PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) |
+		   PIPE_WM_LINETIME_TIME(linetime));
 }
 
 static void haswell_update_wm(struct drm_device *dev)
Signature · 1 line
1.7.10.4
Reviewed-by on v1 7/9
#24 lore raw

Re: [PATCH 7/9] drm/i915: set the IPS linetime watermark

Quoted 10 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Remove the "placeholder" comment and set the actual value described by the specification. We still don't enable IPS, but it won't hurt to already have the value set here.

While at it, fully set the register value instead of just masking the values we're changing.

Quoted 55 lines
---
 drivers/gpu/drm/i915/intel_pm.c |   22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +7 -15
index 3ca020c..59bac2e 100644
@@ -2022,7 +2022,7 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	enum pipe pipe = intel_crtc->pipe;
 	struct drm_display_mode *mode = &intel_crtc->config.adjusted_mode;
 	int target_clock;
-	u32 temp;
+	u32 linetime, ips_linetime;
 
 	if (!intel_crtc_active(crtc)) {
 		I915_WRITE(PIPE_WM_LINETIME(pipe), 0);
@@ -2034,24 +2034,16 @@ haswell_update_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
 	else
 		target_clock = intel_crtc->config.adjusted_mode.clock;
 
-	temp = I915_READ(PIPE_WM_LINETIME(pipe));
-	temp &= ~PIPE_WM_LINETIME_MASK;
-
 	/* The WM are computed with base on how long it takes to fill a single
 	 * row at the given clock rate, multiplied by 8.
 	 * */
-	temp |= PIPE_WM_LINETIME_TIME(
-		DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, target_clock));
-
-	/* IPS watermarks are only used by pipe A, and are ignored by
-	 * pipes B and C.  They are calculated similarly to the common
-	 * linetime values, except that we are using CD clock frequency
-	 * in MHz instead of pixel rate for the division.
-	 *
-	 * This is a placeholder for the IPS watermark calculation code.
-	 */
+	linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8, target_clock);
+	ips_linetime = DIV_ROUND_CLOSEST(mode->htotal * 1000 * 8,
+					 intel_ddi_get_cdclk_freq(dev_priv));
 
-	I915_WRITE(PIPE_WM_LINETIME(pipe), temp);
+	I915_WRITE(PIPE_WM_LINETIME(pipe),
+		   PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) |
+		   PIPE_WM_LINETIME_TIME(linetime));
 }
 
 static void haswell_update_wm(struct drm_device *dev)
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#25 lore raw

PATCH 8/9 drm/i915: MCH_SSKPD is a 64 bit register on Haswell

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

And the SNB_READ_WM0_LATENCY macro is not valid anymore because we have the "New WM0" at 63:56, so the "Old WM0" could maybe be zero if the new one is not zero.

---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 59bac2e..b56de92 100644
@@ -4491,7 +4491,7 @@ 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()) {
+			if (I915_READ64(MCH_SSKPD)) {
 				dev_priv->display.update_wm = haswell_update_wm;
 				dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
 			} else {
Signature · 1 line
1.7.10.4
Reviewed-by on v1 8/9
#26 lore raw

Re: [PATCH 8/9] drm/i915: MCH_SSKPD is a 64 bit register on Haswell

Quoted 7 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

And the SNB_READ_WM0_LATENCY macro is not valid anymore because we have the "New WM0" at 63:56, so the "Old WM0" could maybe be zero if the new one is not zero.

Quoted 24 lines
---
 drivers/gpu/drm/i915/intel_pm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_pm.c +1 -1
index 59bac2e..b56de92 100644
@@ -4491,7 +4491,7 @@ 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()) {
+			if (I915_READ64(MCH_SSKPD)) {
 				dev_priv->display.update_wm = haswell_update_wm;
 				dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
 			} else {
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#27 lore raw

PATCH 9/9 drm/i915: set FORCE_ARB_IDLE_PLANES workaround

In reply to Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Commit 1544d9d57396d5c0c6b7644ed5ae1f4d6caad07a added a workaround inside haswell_init_clock_gating and mentioned it is "a workaround for early silicon revisions and should be removed later". This workaround is documented in bit 31 of PRI_CTL. I asked Arthur and he mentioned that setting FORCE_ARB_IDLE_PLANES replaces that workaround for the newer machines. So use the new one.

Also notice that there's still another workaround for PRI_CTL that involves WM_DBG, but it's not the one we're reverting. And notice that we were previously setting WM_DBG_DISALLOW_MULTIPIPE_LP which disables the LP watermarks when more than one pipe is used, and we really don't want this because we need the LP watermarks if we want to reach deeper PC states.

---
 drivers/gpu/drm/i915/i915_reg.h |    3 +++
 drivers/gpu/drm/i915/intel_pm.c |   10 ++--------
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index aec569f..5879f23 100644
@@ -3697,6 +3697,9 @@
 # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE	(1 << 5)
 # define CHICKEN3_DGMG_DONE_FIX_DISABLE		(1 << 2)
 
+#define CHICKEN_PAR1_1		0x42080
+#define  FORCE_ARB_IDLE_PLANES	(1 << 14)
+
 #define DISP_ARB_CTL	0x45000
 #define  DISP_TILE_SURFACE_SWIZZLING	(1<<13)
 #define  DISP_FBC_WM_DIS		(1<<15)
drivers/gpu/drm/i915/intel_pm.c +2 -8
index b56de92..2297476 100644
@@ -4042,14 +4042,8 @@ static void haswell_init_clock_gating(struct drm_device *dev)
 	/* WaSwitchSolVfFArbitrationPriority */
 	I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL);
 
-	/* XXX: This is a workaround for early silicon revisions and should be
-	 * removed later.
-	 */
-	I915_WRITE(WM_DBG,
-			I915_READ(WM_DBG) |
-			WM_DBG_DISALLOW_MULTIPLE_LP |
-			WM_DBG_DISALLOW_SPRITE |
-			WM_DBG_DISALLOW_MAXFIFO);
+	I915_WRITE(CHICKEN_PAR1_1,
+		   I915_READ(CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES);
 
 	lpt_init_clock_gating(dev);
 }
Signature · 1 line
1.7.10.4
Reviewed-by on v1 9/9
#28 lore raw

Re: [PATCH 9/9] drm/i915: set FORCE_ARB_IDLE_PLANES workaround

Quoted 9 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Commit 1544d9d57396d5c0c6b7644ed5ae1f4d6caad07a added a workaround inside haswell_init_clock_gating and mentioned it is "a workaround for early silicon revisions and should be removed later". This workaround is documented in bit 31 of PRI_CTL. I asked Arthur and he mentioned that setting FORCE_ARB_IDLE_PLANES replaces that workaround for the newer machines. So use the new one.

Quoted 8 lines

Also notice that there's still another workaround for PRI_CTL that involves WM_DBG, but it's not the one we're reverting. And notice that we were previously setting WM_DBG_DISALLOW_MULTIPIPE_LP which disables the LP watermarks when more than one pipe is used, and we really don't want this because we need the LP watermarks if we want to reach deeper PC states.

Quoted 47 lines
---
 drivers/gpu/drm/i915/i915_reg.h |    3 +++
 drivers/gpu/drm/i915/intel_pm.c |   10 ++--------
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index aec569f..5879f23 100644
@@ -3697,6 +3697,9 @@
 # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE	(1 << 5)
 # define CHICKEN3_DGMG_DONE_FIX_DISABLE		(1 << 2)
 
+#define CHICKEN_PAR1_1		0x42080
+#define  FORCE_ARB_IDLE_PLANES	(1 << 14)
+
 #define DISP_ARB_CTL	0x45000
 #define  DISP_TILE_SURFACE_SWIZZLING	(1<<13)
 #define  DISP_FBC_WM_DIS		(1<<15)
drivers/gpu/drm/i915/intel_pm.c +2 -8
index b56de92..2297476 100644
@@ -4042,14 +4042,8 @@ static void haswell_init_clock_gating(struct drm_device *dev)
 	/* WaSwitchSolVfFArbitrationPriority */
 	I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL);
 
-	/* XXX: This is a workaround for early silicon revisions and should be
-	 * removed later.
-	 */
-	I915_WRITE(WM_DBG,
-			I915_READ(WM_DBG) |
-			WM_DBG_DISALLOW_MULTIPLE_LP |
-			WM_DBG_DISALLOW_SPRITE |
-			WM_DBG_DISALLOW_MAXFIFO);
+	I915_WRITE(CHICKEN_PAR1_1,
+		   I915_READ(CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES);
 
 	lpt_init_clock_gating(dev);
 }
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#29 lore raw

Re: [PATCH 9/9] drm/i915: set FORCE_ARB_IDLE_PLANES workaround

In reply to Paulo Zanoni
Quoted 9 lines · Paulo Zanoni

From: Paulo Zanoni <[email protected]>

Commit 1544d9d57396d5c0c6b7644ed5ae1f4d6caad07a added a workaround inside haswell_init_clock_gating and mentioned it is "a workaround for early silicon revisions and should be removed later". This workaround is documented in bit 31 of PRI_CTL. I asked Arthur and he mentioned that setting FORCE_ARB_IDLE_PLANES replaces that workaround for the newer machines. So use the new one.

Quoted 8 lines

Also notice that there's still another workaround for PRI_CTL that involves WM_DBG, but it's not the one we're reverting. And notice that we were previously setting WM_DBG_DISALLOW_MULTIPIPE_LP which disables the LP watermarks when more than one pipe is used, and we really don't want this because we need the LP watermarks if we want to reach deeper PC states.

I've applied all the patches in this series safe for the target_clock one. But this patch here is missing the w/a tag, can you please supply that one in a quick reply so that I can smash it into the patch?

Thanks, Daniel

Quoted 47 lines
---
 drivers/gpu/drm/i915/i915_reg.h |    3 +++
 drivers/gpu/drm/i915/intel_pm.c |   10 ++--------
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index aec569f..5879f23 100644
@@ -3697,6 +3697,9 @@
 # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE	(1 << 5)
 # define CHICKEN3_DGMG_DONE_FIX_DISABLE		(1 << 2)
 
+#define CHICKEN_PAR1_1		0x42080
+#define  FORCE_ARB_IDLE_PLANES	(1 << 14)
+
 #define DISP_ARB_CTL	0x45000
 #define  DISP_TILE_SURFACE_SWIZZLING	(1<<13)
 #define  DISP_FBC_WM_DIS		(1<<15)
drivers/gpu/drm/i915/intel_pm.c +2 -8
index b56de92..2297476 100644
@@ -4042,14 +4042,8 @@ static void haswell_init_clock_gating(struct drm_device *dev)
 	/* WaSwitchSolVfFArbitrationPriority */
 	I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL);
 
-	/* XXX: This is a workaround for early silicon revisions and should be
-	 * removed later.
-	 */
-	I915_WRITE(WM_DBG,
-			I915_READ(WM_DBG) |
-			WM_DBG_DISALLOW_MULTIPLE_LP |
-			WM_DBG_DISALLOW_SPRITE |
-			WM_DBG_DISALLOW_MAXFIFO);
+	I915_WRITE(CHICKEN_PAR1_1,
+		   I915_READ(CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES);
 
 	lpt_init_clock_gating(dev);
 }
Signature · 6 lines
1.7.10.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#30 lore raw

Re: [PATCH 9/9] drm/i915: set FORCE_ARB_IDLE_PLANES workaround

2013/5/21 Daniel Vetter <[email protected]>:

Quoted 17 lines · Paulo Zanoni
Quoted 16 lines

From: Paulo Zanoni <[email protected]>

Commit 1544d9d57396d5c0c6b7644ed5ae1f4d6caad07a added a workaround inside haswell_init_clock_gating and mentioned it is "a workaround for early silicon revisions and should be removed later". This workaround is documented in bit 31 of PRI_CTL. I asked Arthur and he mentioned that setting FORCE_ARB_IDLE_PLANES replaces that workaround for the newer machines. So use the new one.

Also notice that there's still another workaround for PRI_CTL that involves WM_DBG, but it's not the one we're reverting. And notice that we were previously setting WM_DBG_DISALLOW_MULTIPIPE_LP which disables the LP watermarks when more than one pipe is used, and we really don't want this because we need the LP watermarks if we want to reach deeper PC states.

Quoted 5 lines
Quoted 1 line

I've applied all the patches in this series safe for the target_clock one. But this patch here is missing the w/a tag, can you please supply that one in a quick reply so that I can smash it into the patch?

Just like most display workarounds, this one doesn't have a name.

Quoted 54 lines

Thanks, Daniel

Quoted 43 lines
---
 drivers/gpu/drm/i915/i915_reg.h |    3 +++
 drivers/gpu/drm/i915/intel_pm.c |   10 ++--------
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index aec569f..5879f23 100644
@@ -3697,6 +3697,9 @@
 # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE   (1 << 5)
 # define CHICKEN3_DGMG_DONE_FIX_DISABLE              (1 << 2)
 
+#define CHICKEN_PAR1_1               0x42080
+#define  FORCE_ARB_IDLE_PLANES       (1 << 14)
+
 #define DISP_ARB_CTL 0x45000
 #define  DISP_TILE_SURFACE_SWIZZLING (1<<13)
 #define  DISP_FBC_WM_DIS             (1<<15)
drivers/gpu/drm/i915/intel_pm.c +2 -9
index b56de92..2297476 100644
@@ -4042,14 +4042,8 @@ static void haswell_init_clock_gating(struct drm_device *dev)
      /* WaSwitchSolVfFArbitrationPriority */
      I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL);
 
-     /* XXX: This is a workaround for early silicon revisions and should be
-      * removed later.
-      */
-     I915_WRITE(WM_DBG,
-                     I915_READ(WM_DBG) |
-                     WM_DBG_DISALLOW_MULTIPLE_LP |
-                     WM_DBG_DISALLOW_SPRITE |
-                     WM_DBG_DISALLOW_MAXFIFO);
+     I915_WRITE(CHICKEN_PAR1_1,
+                I915_READ(CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES);
 
      lpt_init_clock_gating(dev);
 }
--

1.7.10.4

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 1 line
Paulo Zanoni
#31 lore raw

Re: [PATCH 9/9] drm/i915: set FORCE_ARB_IDLE_PLANES workaround

Quoted 18 lines · Paulo Zanoni

2013/5/21 Daniel Vetter <[email protected]>:

Quoted 17 lines · Paulo Zanoni
Quoted 16 lines

From: Paulo Zanoni <[email protected]>

Commit 1544d9d57396d5c0c6b7644ed5ae1f4d6caad07a added a workaround inside haswell_init_clock_gating and mentioned it is "a workaround for early silicon revisions and should be removed later". This workaround is documented in bit 31 of PRI_CTL. I asked Arthur and he mentioned that setting FORCE_ARB_IDLE_PLANES replaces that workaround for the newer machines. So use the new one.

Also notice that there's still another workaround for PRI_CTL that involves WM_DBG, but it's not the one we're reverting. And notice that we were previously setting WM_DBG_DISALLOW_MULTIPIPE_LP which disables the LP watermarks when more than one pipe is used, and we really don't want this because we need the LP watermarks if we want to reach deeper PC states.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I've applied all the patches in this series safe for the target_clock one. But this patch here is missing the w/a tag, can you please supply that one in a quick reply so that I can smash it into the patch?

Just like most display workarounds, this one doesn't have a name.

Actually I found a name for it in BSpec: WaRsPkgCStateDisplayPMReq

Quoted 64 lines
Quoted 55 lines

Thanks, Daniel

Quoted 43 lines
---
 drivers/gpu/drm/i915/i915_reg.h |    3 +++
 drivers/gpu/drm/i915/intel_pm.c |   10 ++--------
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
index aec569f..5879f23 100644
@@ -3697,6 +3697,9 @@
 # define CHICKEN3_DGMG_REQ_OUT_FIX_DISABLE   (1 << 5)
 # define CHICKEN3_DGMG_DONE_FIX_DISABLE              (1 << 2)
 
+#define CHICKEN_PAR1_1               0x42080
+#define  FORCE_ARB_IDLE_PLANES       (1 << 14)
+
 #define DISP_ARB_CTL 0x45000
 #define  DISP_TILE_SURFACE_SWIZZLING (1<<13)
 #define  DISP_FBC_WM_DIS             (1<<15)
drivers/gpu/drm/i915/intel_pm.c +2 -9
index b56de92..2297476 100644
@@ -4042,14 +4042,8 @@ static void haswell_init_clock_gating(struct drm_device *dev)
      /* WaSwitchSolVfFArbitrationPriority */
      I915_WRITE(GAM_ECOCHK, I915_READ(GAM_ECOCHK) | HSW_ECOCHK_ARB_PRIO_SOL);
 
-     /* XXX: This is a workaround for early silicon revisions and should be
-      * removed later.
-      */
-     I915_WRITE(WM_DBG,
-                     I915_READ(WM_DBG) |
-                     WM_DBG_DISALLOW_MULTIPLE_LP |
-                     WM_DBG_DISALLOW_SPRITE |
-                     WM_DBG_DISALLOW_MAXFIFO);
+     I915_WRITE(CHICKEN_PAR1_1,
+                I915_READ(CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES);
 
      lpt_init_clock_gating(dev);
 }
--

1.7.10.4

Quoted 4 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 5 lines
Paulo Zanoni
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä
Intel OTC
#32 lore raw

Re: [PATCH 9/9] drm/i915: set FORCE_ARB_IDLE_PLANES workaround

Quoted 7 lines · Ville Syrjälä
Quoted 5 lines
Quoted 3 lines

I've applied all the patches in this series safe for the target_clock one. But this patch here is missing the w/a tag, can you please supply that one in a quick reply so that I can smash it into the patch?

Just like most display workarounds, this one doesn't have a name.

Actually I found a name for it in BSpec: WaRsPkgCStateDisplayPMReq

Comment added, thanks for digging this one out.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch