Skip to contentSkip to conversation

drm/i915: BDW watermark fixes

PATCH In review [email protected] 3 participants 8 messages Jan 7, 2014 – Jan 8, 2014

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

cover drm/i915: BDW watermark fixes

From: Ville Syrjälä <[email protected]>

Seems I was a bit sloppy when I sent out the last set of ILK/SNB/IVB watermark patches and I forgot to update them for BDW. And I was even sloppier before that since I forgot to actually hook up the watermark vfuncs on BDW. This series should fix it all up.

I'm not sure what the 3.13 status is at the moment, but if there's still time to get something in, then a slightly modified version of patch 2 (just undo the haswell->ilk rename) should be what we want there. If there's no chance to get it into 3.13 the I guess we should just slap a cc stable on it.

Ville Syrjälä (3):
drm/i915: Fix watermark code for BDW drm/i915: Enable watermarks for BDW drm/i915: Simplify watermark/init_clock_gating setup

 drivers/gpu/drm/i915/intel_pm.c | 81 ++++++++++++-----------------------------
 1 file changed, 23 insertions(+), 58 deletions(-)
Signature · 6 lines
1.8.3.2

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

PATCH 1/3 drm/i915: Fix watermark code for BDW

From: Ville Syrjälä <[email protected]>

Looks like I forgot to update the ILK/SNB/IVB watermark patches to deal with BDW. Add the relevant BDW checks to make sure we take the HSW codepaths on BDW as well.

---
 drivers/gpu/drm/i915/intel_pm.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +7 -7
index 469170c..5637183 100644
@@ -2013,7 +2013,7 @@ static void intel_read_wm_latency(struct drm_device *dev, uint16_t wm[5])
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (IS_HASWELL(dev)) {
+	if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
 		uint64_t sskpd = I915_READ64(MCH_SSKPD);
 
 		wm[0] = (sskpd >> 56) & 0xFF;
@@ -2061,7 +2061,7 @@ static void intel_fixup_cur_wm_latency(struct drm_device *dev, uint16_t wm[5])
 static int ilk_wm_max_level(const struct drm_device *dev)
 {
 	/* how many WM levels are we expecting */
-	if (IS_HASWELL(dev))
+	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		return 4;
 	else if (INTEL_INFO(dev)->gen >= 6)
 		return 3;
@@ -2180,7 +2180,7 @@ static bool intel_compute_pipe_wm(struct drm_crtc *crtc,
 		ilk_compute_wm_level(dev_priv, level, params,
 				     &pipe_wm->wm[level]);
 
-	if (IS_HASWELL(dev))
+	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		pipe_wm->linetime = hsw_compute_linetime_wm(dev, crtc);
 
 	/* At least LP0 must be valid */
@@ -2275,7 +2275,7 @@ static unsigned int ilk_wm_lp_latency(struct drm_device *dev, int level)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
-	if (IS_HASWELL(dev))
+	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		return 2 * level;
 	else
 		return dev_priv->wm.pri_latency[level];
@@ -2490,7 +2490,7 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv,
 		I915_WRITE(PIPE_WM_LINETIME(PIPE_C), results->wm_linetime[2]);
 
 	if (dirty & WM_DIRTY_DDB) {
-		if (IS_HASWELL(dev)) {
+		if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
 			val = I915_READ(WM_MISC);
 			if (results->partitioning == INTEL_DDB_PART_1_2)
 				val &= ~WM_MISC_DATA_PARTITION_5_6;
@@ -2629,7 +2629,7 @@ static void ilk_pipe_wm_get_hw_state(struct drm_crtc *crtc)
 	};
 
 	hw->wm_pipe[pipe] = I915_READ(wm0_pipe_reg[pipe]);
-	if (IS_HASWELL(dev))
+	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		hw->wm_linetime[pipe] = I915_READ(PIPE_WM_LINETIME(pipe));
 
 	if (intel_crtc_active(crtc)) {
@@ -2676,7 +2676,7 @@ void ilk_wm_get_hw_state(struct drm_device *dev)
 	hw->wm_lp_spr[1] = I915_READ(WM2S_LP_IVB);
 	hw->wm_lp_spr[2] = I915_READ(WM3S_LP_IVB);
 
-	if (IS_HASWELL(dev))
+	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		hw->partitioning = (I915_READ(WM_MISC) & WM_MISC_DATA_PARTITION_5_6) ?
 			INTEL_DDB_PART_5_6 : INTEL_DDB_PART_1_2;
 	else if (IS_IVYBRIDGE(dev))
Signature · 6 lines
1.8.3.2

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

PATCH 2/3 drm/i915: Enable watermarks for BDW

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

We forgot to intialize the watermark vfuncs for BDW, and hence the watermarks were never updated.

---
 drivers/gpu/drm/i915/intel_pm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/gpu/drm/i915/intel_pm.c +11 -0
index 5637183..04e1e29 100644
@@ -5628,6 +5628,17 @@ void intel_init_pm(struct drm_device *dev)
 			}
 			dev_priv->display.init_clock_gating = haswell_init_clock_gating;
 		} else if (INTEL_INFO(dev)->gen == 8) {
+			if (dev_priv->wm.pri_latency[0] &&
+			    dev_priv->wm.spr_latency[0] &&
+			    dev_priv->wm.cur_latency[0]) {
+				dev_priv->display.update_wm = ilk_update_wm;
+				dev_priv->display.update_sprite_wm =
+					ilk_update_sprite_wm;
+			} else {
+				DRM_DEBUG_KMS("Failed to read display plane latency. "
+					      "Disable CxSR\n");
+				dev_priv->display.update_wm = NULL;
+			}
 			dev_priv->display.init_clock_gating = gen8_init_clock_gating;
 		} else
 			dev_priv->display.update_wm = NULL;
Signature · 6 lines
1.8.3.2

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

PATCH 3/3 drm/i915: Simplify watermark/init_clock_gating setup

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

Avoid duplicating the same piece of code several times by separating the watemark vfunc setup from the init_clock_gating vfunc setup on PCH platforms.

---
 drivers/gpu/drm/i915/intel_pm.c | 78 +++++++++--------------------------------
 1 file changed, 16 insertions(+), 62 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +16 -62
index 04e1e29..a177a93 100644
@@ -5575,73 +5575,27 @@ void intel_init_pm(struct drm_device *dev)
 	if (HAS_PCH_SPLIT(dev)) {
 		intel_setup_wm_latency(dev);
 
-		if (IS_GEN5(dev)) {
-			if (dev_priv->wm.pri_latency[1] &&
-			    dev_priv->wm.spr_latency[1] &&
-			    dev_priv->wm.cur_latency[1]) {
-				dev_priv->display.update_wm = ilk_update_wm;
-				dev_priv->display.update_sprite_wm =
-					ilk_update_sprite_wm;
-			} else {
-				DRM_DEBUG_KMS("Failed to get proper latency. "
-					      "Disable CxSR\n");
-				dev_priv->display.update_wm = NULL;
-			}
+		if ((IS_GEN5(dev) && dev_priv->wm.pri_latency[1] &&
+		     dev_priv->wm.spr_latency[1] && dev_priv->wm.cur_latency[1]) ||
+		    (!IS_GEN5(dev) && dev_priv->wm.pri_latency[0] &&
+		     dev_priv->wm.spr_latency[0] && dev_priv->wm.cur_latency[0])) {
+			dev_priv->display.update_wm = ilk_update_wm;
+			dev_priv->display.update_sprite_wm = ilk_update_sprite_wm;
+		} else {
+			DRM_DEBUG_KMS("Failed to read display plane latency. "
+				      "Disable CxSR\n");
+		}
+
+		if (IS_GEN5(dev))
 			dev_priv->display.init_clock_gating = ironlake_init_clock_gating;
-		} else if (IS_GEN6(dev)) {
-			if (dev_priv->wm.pri_latency[0] &&
-			    dev_priv->wm.spr_latency[0] &&
-			    dev_priv->wm.cur_latency[0]) {
-				dev_priv->display.update_wm = ilk_update_wm;
-				dev_priv->display.update_sprite_wm =
-					ilk_update_sprite_wm;
-			} else {
-				DRM_DEBUG_KMS("Failed to read display plane latency. "
-					      "Disable CxSR\n");
-				dev_priv->display.update_wm = NULL;
-			}
+		else if (IS_GEN6(dev))
 			dev_priv->display.init_clock_gating = gen6_init_clock_gating;
-		} else if (IS_IVYBRIDGE(dev)) {
-			if (dev_priv->wm.pri_latency[0] &&
-			    dev_priv->wm.spr_latency[0] &&
-			    dev_priv->wm.cur_latency[0]) {
-				dev_priv->display.update_wm = ilk_update_wm;
-				dev_priv->display.update_sprite_wm =
-					ilk_update_sprite_wm;
-			} else {
-				DRM_DEBUG_KMS("Failed to read display plane latency. "
-					      "Disable CxSR\n");
-				dev_priv->display.update_wm = NULL;
-			}
+		else if (IS_IVYBRIDGE(dev))
 			dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
-		} else if (IS_HASWELL(dev)) {
-			if (dev_priv->wm.pri_latency[0] &&
-			    dev_priv->wm.spr_latency[0] &&
-			    dev_priv->wm.cur_latency[0]) {
-				dev_priv->display.update_wm = ilk_update_wm;
-				dev_priv->display.update_sprite_wm =
-					ilk_update_sprite_wm;
-			} else {
-				DRM_DEBUG_KMS("Failed to read display plane latency. "
-					      "Disable CxSR\n");
-				dev_priv->display.update_wm = NULL;
-			}
+		else if (IS_HASWELL(dev))
 			dev_priv->display.init_clock_gating = haswell_init_clock_gating;
-		} else if (INTEL_INFO(dev)->gen == 8) {
-			if (dev_priv->wm.pri_latency[0] &&
-			    dev_priv->wm.spr_latency[0] &&
-			    dev_priv->wm.cur_latency[0]) {
-				dev_priv->display.update_wm = ilk_update_wm;
-				dev_priv->display.update_sprite_wm =
-					ilk_update_sprite_wm;
-			} else {
-				DRM_DEBUG_KMS("Failed to read display plane latency. "
-					      "Disable CxSR\n");
-				dev_priv->display.update_wm = NULL;
-			}
+		else if (INTEL_INFO(dev)->gen == 8)
 			dev_priv->display.init_clock_gating = gen8_init_clock_gating;
-		} else
-			dev_priv->display.update_wm = NULL;
 	} else if (IS_VALLEYVIEW(dev)) {
 		dev_priv->display.update_wm = valleyview_update_wm;
 		dev_priv->display.init_clock_gating =
Signature · 6 lines
1.8.3.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] drm/i915: Simplify watermark/init_clock_gating setup

2014/1/7 <[email protected]>:

Quoted 27 lines

From: Ville Syrjälä <[email protected]>

Avoid duplicating the same piece of code several times by separating the watemark vfunc setup from the init_clock_gating vfunc setup on PCH platforms.

---
 drivers/gpu/drm/i915/intel_pm.c | 78 +++++++++--------------------------------
 1 file changed, 16 insertions(+), 62 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -8
index 04e1e29..a177a93 100644
@@ -5575,73 +5575,27 @@ void intel_init_pm(struct drm_device *dev)
        if (HAS_PCH_SPLIT(dev)) {
                intel_setup_wm_latency(dev);
 
-               if (IS_GEN5(dev)) {
-                       if (dev_priv->wm.pri_latency[1] &&
-                           dev_priv->wm.spr_latency[1] &&
-                           dev_priv->wm.cur_latency[1]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {

drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 5583

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -4
-                               DRM_DEBUG_KMS("Failed to get proper latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               if ((IS_GEN5(dev) && dev_priv->wm.pri_latency[1] &&
+                    dev_priv->wm.spr_latency[1] && dev_priv->wm.cur_latency[1]) ||
+                   (!IS_GEN5(dev) && dev_priv->wm.pri_latency[0] &&
+                    dev_priv->wm.spr_latency[0] && dev_priv->wm.cur_latency[0])) {
+                       dev_priv->display.update_wm = ilk_update_wm;
+                       dev_priv->display.update_sprite_wm = ilk_update_sprite_wm;

My tiny little brain doesn't remember why on gen5 we check for latency[1] instead of latency[0]. I know this is not the goal if your patch, but maybe a follow-up patch adding a little comment would be nice :)

For the 3 patches on the series:

Quoted 75 lines
drivers/gpu/drm/i915/intel_pm.c +10 -51
+               } else {
+                       DRM_DEBUG_KMS("Failed to read display plane latency. "
+                                     "Disable CxSR\n");
+               }
+
+               if (IS_GEN5(dev))
                        dev_priv->display.init_clock_gating = ironlake_init_clock_gating;
-               } else if (IS_GEN6(dev)) {
-                       if (dev_priv->wm.pri_latency[0] &&
-                           dev_priv->wm.spr_latency[0] &&
-                           dev_priv->wm.cur_latency[0]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to read display plane latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               else if (IS_GEN6(dev))
                        dev_priv->display.init_clock_gating = gen6_init_clock_gating;
-               } else if (IS_IVYBRIDGE(dev)) {
-                       if (dev_priv->wm.pri_latency[0] &&
-                           dev_priv->wm.spr_latency[0] &&
-                           dev_priv->wm.cur_latency[0]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to read display plane latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               else if (IS_IVYBRIDGE(dev))
                        dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
-               } else if (IS_HASWELL(dev)) {
-                       if (dev_priv->wm.pri_latency[0] &&
-                           dev_priv->wm.spr_latency[0] &&
-                           dev_priv->wm.cur_latency[0]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to read display plane latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               else if (IS_HASWELL(dev))
                        dev_priv->display.init_clock_gating = haswell_init_clock_gating;
-               } else if (INTEL_INFO(dev)->gen == 8) {
-                       if (dev_priv->wm.pri_latency[0] &&
-                           dev_priv->wm.spr_latency[0] &&
-                           dev_priv->wm.cur_latency[0]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to read display plane latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               else if (INTEL_INFO(dev)->gen == 8)
                        dev_priv->display.init_clock_gating = gen8_init_clock_gating;
-               } else
-                       dev_priv->display.update_wm = NULL;
        } else if (IS_VALLEYVIEW(dev)) {
                dev_priv->display.update_wm = valleyview_update_wm;
                dev_priv->display.init_clock_gating =
--

1.8.3.2

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

Signature · 1 line
Paulo Zanoni
#5 lore raw

Re: [PATCH 3/3] drm/i915: Simplify watermark/init_clock_gating setup

Quoted 35 lines · Paulo Zanoni

2014/1/7 <[email protected]>:

Quoted 34 lines

From: Ville Syrjälä <[email protected]>

Avoid duplicating the same piece of code several times by separating the watemark vfunc setup from the init_clock_gating vfunc setup on PCH platforms.

---
 drivers/gpu/drm/i915/intel_pm.c | 78 +++++++++--------------------------------
 1 file changed, 16 insertions(+), 62 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +3 -12
index 04e1e29..a177a93 100644
@@ -5575,73 +5575,27 @@ void intel_init_pm(struct drm_device *dev)
        if (HAS_PCH_SPLIT(dev)) {
                intel_setup_wm_latency(dev);
 
-               if (IS_GEN5(dev)) {
-                       if (dev_priv->wm.pri_latency[1] &&
-                           dev_priv->wm.spr_latency[1] &&
-                           dev_priv->wm.cur_latency[1]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to get proper latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               if ((IS_GEN5(dev) && dev_priv->wm.pri_latency[1] &&
+                    dev_priv->wm.spr_latency[1] && dev_priv->wm.cur_latency[1]) ||
+                   (!IS_GEN5(dev) && dev_priv->wm.pri_latency[0] &&
Quoted 8 lines

drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 5583

Quoted 3 lines
drivers/gpu/drm/i915/intel_pm.c +3 -0
+                    dev_priv->wm.spr_latency[0] && dev_priv->wm.cur_latency[0])) {
+                       dev_priv->display.update_wm = ilk_update_wm;
+                       dev_priv->display.update_sprite_wm = ilk_update_sprite_wm;

My tiny little brain doesn't remember why on gen5 we check for latency[1] instead of latency[0]. I know this is not the goal if your patch, but maybe a follow-up patch adding a little comment would be nice :)

I did it that way since the latency[0] values are hardcoded on ILK. So we can't tell from latency[0] values whether the BIOS programmed the latency values or not. I had an idea to kill these checks, and possibly just dynamically calculate the max level for which we have latency data. But that's for another patch.

Quoted 85 lines

For the 3 patches on the series:

Quoted 75 lines
drivers/gpu/drm/i915/intel_pm.c +10 -51
+               } else {
+                       DRM_DEBUG_KMS("Failed to read display plane latency. "
+                                     "Disable CxSR\n");
+               }
+
+               if (IS_GEN5(dev))
                        dev_priv->display.init_clock_gating = ironlake_init_clock_gating;
-               } else if (IS_GEN6(dev)) {
-                       if (dev_priv->wm.pri_latency[0] &&
-                           dev_priv->wm.spr_latency[0] &&
-                           dev_priv->wm.cur_latency[0]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to read display plane latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               else if (IS_GEN6(dev))
                        dev_priv->display.init_clock_gating = gen6_init_clock_gating;
-               } else if (IS_IVYBRIDGE(dev)) {
-                       if (dev_priv->wm.pri_latency[0] &&
-                           dev_priv->wm.spr_latency[0] &&
-                           dev_priv->wm.cur_latency[0]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to read display plane latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               else if (IS_IVYBRIDGE(dev))
                        dev_priv->display.init_clock_gating = ivybridge_init_clock_gating;
-               } else if (IS_HASWELL(dev)) {
-                       if (dev_priv->wm.pri_latency[0] &&
-                           dev_priv->wm.spr_latency[0] &&
-                           dev_priv->wm.cur_latency[0]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to read display plane latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               else if (IS_HASWELL(dev))
                        dev_priv->display.init_clock_gating = haswell_init_clock_gating;
-               } else if (INTEL_INFO(dev)->gen == 8) {
-                       if (dev_priv->wm.pri_latency[0] &&
-                           dev_priv->wm.spr_latency[0] &&
-                           dev_priv->wm.cur_latency[0]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {
-                               DRM_DEBUG_KMS("Failed to read display plane latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               else if (INTEL_INFO(dev)->gen == 8)
                        dev_priv->display.init_clock_gating = gen8_init_clock_gating;
-               } else
-                       dev_priv->display.update_wm = NULL;
        } else if (IS_VALLEYVIEW(dev)) {
                dev_priv->display.update_wm = valleyview_update_wm;
                dev_priv->display.init_clock_gating =
--

1.8.3.2

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

Signature · 1 line
Paulo Zanoni
Signature · 2 lines
Ville Syrjälä
Intel OTC
#6 lore raw

Re: [PATCH 3/3] drm/i915: Simplify watermark/init_clock_gating setup

In reply to Paulo Zanoni
Quoted 44 lines · Paulo Zanoni

2014/1/7 <[email protected]>:

Quoted 27 lines

From: Ville Syrjälä <[email protected]>

Avoid duplicating the same piece of code several times by separating the watemark vfunc setup from the init_clock_gating vfunc setup on PCH platforms.

---
 drivers/gpu/drm/i915/intel_pm.c | 78 +++++++++--------------------------------
 1 file changed, 16 insertions(+), 62 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -8
index 04e1e29..a177a93 100644
@@ -5575,73 +5575,27 @@ void intel_init_pm(struct drm_device *dev)
        if (HAS_PCH_SPLIT(dev)) {
                intel_setup_wm_latency(dev);
 
-               if (IS_GEN5(dev)) {
-                       if (dev_priv->wm.pri_latency[1] &&
-                           dev_priv->wm.spr_latency[1] &&
-                           dev_priv->wm.cur_latency[1]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {

drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 5583

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -4
-                               DRM_DEBUG_KMS("Failed to get proper latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               if ((IS_GEN5(dev) && dev_priv->wm.pri_latency[1] &&
+                    dev_priv->wm.spr_latency[1] && dev_priv->wm.cur_latency[1]) ||
+                   (!IS_GEN5(dev) && dev_priv->wm.pri_latency[0] &&
+                    dev_priv->wm.spr_latency[0] && dev_priv->wm.cur_latency[0])) {
+                       dev_priv->display.update_wm = ilk_update_wm;
+                       dev_priv->display.update_sprite_wm = ilk_update_sprite_wm;

My tiny little brain doesn't remember why on gen5 we check for latency[1] instead of latency[0]. I know this is not the goal if your patch, but maybe a follow-up patch adding a little comment would be nice :)

Quoted 2 lines

For the 3 patches on the series:

Merged to dinq, thanks for patches and review. And I'll use this occasion to repeat my plea to make our underrun reporting much louder - I fear that we'll silently break the watermark code soonish again if we don't ramp up automated testing. And I'd hate to see all the hard effort from you two wasted like that.

btw for the funny wm.*_latency checking logic Paulo was confused about:
Would it make sense for intel_setup_wm_latency to return a bool indicating whether doing the wm latency setup has succeeded or not? Also I wonder w a bit whether this is a real worl failure mode or whether we should just make the debug message a bit louder ...

Cheers, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw

Re: [PATCH 3/3] drm/i915: Simplify watermark/init_clock_gating setup

Quoted 54 lines · Daniel Vetter
Quoted 44 lines · Paulo Zanoni

2014/1/7 <[email protected]>:

Quoted 27 lines

From: Ville Syrjälä <[email protected]>

Avoid duplicating the same piece of code several times by separating the watemark vfunc setup from the init_clock_gating vfunc setup on PCH platforms.

---
 drivers/gpu/drm/i915/intel_pm.c | 78 +++++++++--------------------------------
 1 file changed, 16 insertions(+), 62 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +0 -8
index 04e1e29..a177a93 100644
@@ -5575,73 +5575,27 @@ void intel_init_pm(struct drm_device *dev)
        if (HAS_PCH_SPLIT(dev)) {
                intel_setup_wm_latency(dev);
 
-               if (IS_GEN5(dev)) {
-                       if (dev_priv->wm.pri_latency[1] &&
-                           dev_priv->wm.spr_latency[1] &&
-                           dev_priv->wm.cur_latency[1]) {
-                               dev_priv->display.update_wm = ilk_update_wm;
-                               dev_priv->display.update_sprite_wm =
-                                       ilk_update_sprite_wm;
-                       } else {

drivers/gpu/drm/i915/intel_pm.c void intel_init_pm(struct drm_device *dev) · line 5583

Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +6 -4
-                               DRM_DEBUG_KMS("Failed to get proper latency. "
-                                             "Disable CxSR\n");
-                               dev_priv->display.update_wm = NULL;
-                       }
+               if ((IS_GEN5(dev) && dev_priv->wm.pri_latency[1] &&
+                    dev_priv->wm.spr_latency[1] && dev_priv->wm.cur_latency[1]) ||
+                   (!IS_GEN5(dev) && dev_priv->wm.pri_latency[0] &&
+                    dev_priv->wm.spr_latency[0] && dev_priv->wm.cur_latency[0])) {
+                       dev_priv->display.update_wm = ilk_update_wm;
+                       dev_priv->display.update_sprite_wm = ilk_update_sprite_wm;

My tiny little brain doesn't remember why on gen5 we check for latency[1] instead of latency[0]. I know this is not the goal if your patch, but maybe a follow-up patch adding a little comment would be nice :)

Quoted 2 lines

For the 3 patches on the series:

Merged to dinq, thanks for patches and review. And I'll use this occasion to repeat my plea to make our underrun reporting much louder - I fear that we'll silently break the watermark code soonish again if we don't ramp up automated testing. And I'd hate to see all the hard effort from you two wasted like that.

Quoted 3 lines

btw for the funny wm.*_latency checking logic Paulo was confused about:
Would it make sense for intel_setup_wm_latency to return a bool indicating whether doing the wm latency setup has succeeded or not?

Yeah, that could also work.

Quoted 3 lines

Also I wonder w
a bit whether this is a real worl failure mode or whether we should just make the debug message a bit louder ...

I don't think it should happen unless the BIOS is broken.

Signature · 2 lines
Ville Syrjälä
Intel OTC