Skip to contentSkip to conversation

drm/i915: Move the min_pixclk[] handling to the end of readout

PATCH In review [email protected] 4 participants 5 messages Dec 20, 2016 – Dec 22, 2016

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

PATCH 1/1 drm/i915: Move the min_pixclk[] handling to the end of readout

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

Trying to determine the pixel rate of the pipe can't be done until we know the clock, which means it can't be done until the encoder .get_config() hooks have been called. So let's move the min_pixclk[] stuff to the end of intel_modeset_readout_hw_state() when we actually have gathered all the required infromation.

Cc Maarten Lankhorst <[email protected]>
Cc Mika Kahola <[email protected]>
Cc Ander Conselvan de Oliveira <[email protected]>
Fixes 565602d7501a ("drm/i915: Do not acquire crtc state to check clock during modeset, v4.")
---
 drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +16 -16
index ef5dde5ab1cf..d8effd4da034 100644
@@ -17033,7 +17033,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 
 	for_each_intel_crtc(dev, crtc) {
 		struct intel_crtc_state *crtc_state = crtc->config;
-		int pixclk = 0;
 
 		__drm_atomic_helper_crtc_destroy_state(&crtc_state->base);
 		memset(crtc_state, 0, sizeof(*crtc_state));
@@ -17045,23 +17044,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 		crtc->base.enabled = crtc_state->base.enable;
 		crtc->active = crtc_state->base.active;
 
-		if (crtc_state->base.active) {
+		if (crtc_state->base.active)
 			dev_priv->active_crtcs |= 1 << crtc->pipe;
 
-			if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
-				pixclk = ilk_pipe_pixel_rate(crtc_state);
-			else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-				pixclk = crtc_state->base.adjusted_mode.crtc_clock;
-			else
-				WARN_ON(dev_priv->display.modeset_calc_cdclk);
-
-			/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
-			if (IS_BROADWELL(dev_priv) && crtc_state->ips_enabled)
-				pixclk = DIV_ROUND_UP(pixclk * 100, 95);
-		}
-
-		dev_priv->min_pixclk[crtc->pipe] = pixclk;
-
 		readout_plane_state(crtc);
 
 		DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n",
@@ -17134,6 +17119,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 	}
 
 	for_each_intel_crtc(dev, crtc) {
+		int pixclk = 0;
+
 		crtc->base.hwmode = crtc->config->base.adjusted_mode;
 
 		memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));
@@ -17161,10 +17148,23 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 			 */
 			crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED;
 
+			if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
+				pixclk = ilk_pipe_pixel_rate(crtc->config);
+			else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
+				pixclk = crtc->config->base.adjusted_mode.crtc_clock;
+			else
+				WARN_ON(dev_priv->display.modeset_calc_cdclk);
+
+			/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
+			if (IS_BROADWELL(dev_priv) && crtc->config->ips_enabled)
+				pixclk = DIV_ROUND_UP(pixclk * 100, 95);
+
 			drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode);
 			update_scanline_offset(crtc);
 		}
 
+		dev_priv->min_pixclk[crtc->pipe] = pixclk;
+
 		intel_pipe_config_sanity_check(dev_priv, crtc->config);
 	}
 }
Signature · 6 lines
2.10.2

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

✓ Fi.CI.BAT: success for drm/i915: Move the min_pixclk[] handling to the end of readout

== Series Details ==

== Series Details ==

Series: drm/i915: Move the min_pixclk[] handling to the end of readout
URL : https://patchwork.freedesktop.org/series/17064/
State : success

== Summary ==

Series 17064v1 drm/i915: Move the min_pixclk[] handling to the end of readout
https://patchwork.freedesktop.org/api/1.0/series/17064/revisions/1/mbox/

fi-bdw-5557u     total:247  pass:233  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:247  pass:208  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:247  pass:225  dwarn:1   dfail:0   fail:0   skip:21 
fi-bxt-t5700     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-j1900     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-ilk-650       total:247  pass:195  dwarn:0   dfail:0   fail:0   skip:52 
fi-ivb-3520m     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:247  pass:227  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:247  pass:224  dwarn:3   dfail:0   fail:0   skip:20 
fi-skl-6770hq    total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:247  pass:215  dwarn:0   dfail:0   fail:0   skip:32 

6096aee14ea52e3163729129ee7362e56ff3efb9 drm-tip: 2016y-12m-20d-16h-33m-17s UTC integration manifest cde8f24 drm/i915: Move the min_pixclk[] handling to the end of readout

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3346/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 8 lines · On Tue, 2016-12-20 at 17:39 +0200, [email protected] wrote:

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

Trying to determine the pixel rate of the pipe can't be done until we know the clock, which means it can't be done until the encoder .get_config() hooks have been called. So let's move the min_pixclk[] stuff to the end of intel_modeset_readout_hw_state() when we actually have gathered all the required infromation.

Quoted 5 lines
Cc Maarten Lankhorst <[email protected]>
Cc Mika Kahola <[email protected]>
Cc Ander Conselvan de Oliveira <[email protected]>
Fixes 565602d7501a ("drm/i915: Do not acquire crtc state to check clock during modeset, v4.")
Quoted 71 lines

---
 drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++----------------

 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index ef5dde5ab1cf..d8effd4da034 100644
@@ -17033,7 +17033,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)


  for_each_intel_crtc(dev, crtc) {
  struct intel_crtc_state *crtc_state = crtc->config;

drivers/gpu/drm/i915/intel_display.c +0 -1
-		int pixclk = 0;


  __drm_atomic_helper_crtc_destroy_state(&crtc_state->base); memset(crtc_state, 0, sizeof(*crtc_state));

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -17045,23 +17044,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
  		crtc->base.enabled = crtc_state->base.enable;
  		crtc->active = crtc_state->base.active;

drivers/gpu/drm/i915/intel_display.c +1 -1
-		if (crtc_state->base.active) {
+		if (crtc_state->base.active)

  dev_priv->active_crtcs |= 1 << crtc->pipe;

drivers/gpu/drm/i915/intel_display.c +0 -14
-			if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
-				pixclk = ilk_pipe_pixel_rate(crtc_state);
-			else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-				pixclk = crtc_state->base.adjusted_mode.crtc_clock;
-			else
-				WARN_ON(dev_priv->display.modeset_calc_cdclk);
-
-			/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
-			if (IS_BROADWELL(dev_priv) && crtc_state->ips_enabled)
-				pixclk = DIV_ROUND_UP(pixclk * 100, 95);
-		}
-
-		dev_priv->min_pixclk[crtc->pipe] = pixclk;
-

  readout_plane_state(crtc);

  DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n",

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -17134,6 +17119,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
  	}


  for_each_intel_crtc(dev, crtc) {

drivers/gpu/drm/i915/intel_display.c +2 -0
+		int pixclk = 0;
+

  crtc->base.hwmode = crtc->config->base.adjusted_mode;
  memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));

drivers/gpu/drm/i915/intel_display.c +0 -0
@@ -17161,10 +17148,23 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
  			 */
  			crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED;

drivers/gpu/drm/i915/intel_display.c +11 -0
+			if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
+				pixclk = ilk_pipe_pixel_rate(crtc->config);
+			else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
+				pixclk = crtc->config->base.adjusted_mode.crtc_clock;
+			else
+				WARN_ON(dev_priv->display.modeset_calc_cdclk);
+
+			/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
+			if (IS_BROADWELL(dev_priv) && crtc->config->ips_enabled)
+				pixclk = DIV_ROUND_UP(pixclk * 100, 95);
+

  drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode); update_scanline_offset(crtc);
  }

drivers/gpu/drm/i915/intel_display.c +2 -0
+		dev_priv->min_pixclk[crtc->pipe] = pixclk;
+
Quoted 3 lines

  intel_pipe_config_sanity_check(dev_priv, crtc->config); }
 }

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

Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]

Op 20-12-16 om 16:39 schreef [email protected]:

Quoted 77 lines

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

Trying to determine the pixel rate of the pipe can't be done until we know the clock, which means it can't be done until the encoder .get_config() hooks have been called. So let's move the min_pixclk[] stuff to the end of intel_modeset_readout_hw_state() when we actually have gathered all the required infromation.

Cc Maarten Lankhorst <[email protected]>
Cc Mika Kahola <[email protected]>
Cc Ander Conselvan de Oliveira <[email protected]>
Fixes 565602d7501a ("drm/i915: Do not acquire crtc state to check clock during modeset, v4.")
---
 drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +13 -16
index ef5dde5ab1cf..d8effd4da034 100644
@@ -17033,7 +17033,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 
 	for_each_intel_crtc(dev, crtc) {
 		struct intel_crtc_state *crtc_state = crtc->config;
-		int pixclk = 0;
 
 		__drm_atomic_helper_crtc_destroy_state(&crtc_state->base);
 		memset(crtc_state, 0, sizeof(*crtc_state));
@@ -17045,23 +17044,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 		crtc->base.enabled = crtc_state->base.enable;
 		crtc->active = crtc_state->base.active;
 
-		if (crtc_state->base.active) {
+		if (crtc_state->base.active)
 			dev_priv->active_crtcs |= 1 << crtc->pipe;
 
-			if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
-				pixclk = ilk_pipe_pixel_rate(crtc_state);
-			else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-				pixclk = crtc_state->base.adjusted_mode.crtc_clock;
-			else
-				WARN_ON(dev_priv->display.modeset_calc_cdclk);
-
-			/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
-			if (IS_BROADWELL(dev_priv) && crtc_state->ips_enabled)
-				pixclk = DIV_ROUND_UP(pixclk * 100, 95);
-		}
-
-		dev_priv->min_pixclk[crtc->pipe] = pixclk;
-
 		readout_plane_state(crtc);
 
 		DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n",
@@ -17134,6 +17119,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 	}
 
 	for_each_intel_crtc(dev, crtc) {
+		int pixclk = 0;
+
 		crtc->base.hwmode = crtc->config->base.adjusted_mode;
 
 		memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));
@@ -17161,10 +17148,23 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 			 */
 			crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED;
 
+			if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
+				pixclk = ilk_pipe_pixel_rate(crtc->config);
+			else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
+				pixclk = crtc->config->base.adjusted_mode.crtc_clock;
+			else
+				WARN_ON(dev_priv->display.modeset_calc_cdclk);
+
+			/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
+			if (IS_BROADWELL(dev_priv) && crtc->config->ips_enabled)
+				pixclk = DIV_ROUND_UP(pixclk * 100, 95);

drivers/gpu/drm/i915/intel_display.c static void intel_modeset_readout_hw_state(struct drm_device *dev) · line 17170

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
+
 			drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode);
 			update_scanline_offset(crtc);
 		}
 
+		dev_priv->min_pixclk[crtc->pipe] = pixclk;
+
 		intel_pipe_config_sanity_check(dev_priv, crtc->config);
 	}
 }

Looks good. Could you do intel_crtc_state = to_intel_crtc_state(crtc->base.state) at the start and fix all ->state and ->config dereferences in this loop too?
This is a cleanup I'm trying to apply to the whole driver. Atomic state should be passed in where possible, and crtc->config/state dereferences should be avoided as much as we can. Eventually I want to get rid of crtc->config altogether. :)

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

#4 lore raw
Quoted 83 lines · Maarten Lankhorst

Op 20-12-16 om 16:39 schreef [email protected]:

Quoted 82 lines

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

Trying to determine the pixel rate of the pipe can't be done until we know the clock, which means it can't be done until the encoder .get_config() hooks have been called. So let's move the min_pixclk[] stuff to the end of intel_modeset_readout_hw_state() when we actually have gathered all the required infromation.

Cc Maarten Lankhorst <[email protected]>
Cc Mika Kahola <[email protected]>
Cc Ander Conselvan de Oliveira <[email protected]>
Fixes 565602d7501a ("drm/i915: Do not acquire crtc state to check clock during modeset, v4.")
---
 drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +14 -16
index ef5dde5ab1cf..d8effd4da034 100644
@@ -17033,7 +17033,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 
 	for_each_intel_crtc(dev, crtc) {
 		struct intel_crtc_state *crtc_state = crtc->config;
-		int pixclk = 0;
 
 		__drm_atomic_helper_crtc_destroy_state(&crtc_state->base);
 		memset(crtc_state, 0, sizeof(*crtc_state));
@@ -17045,23 +17044,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 		crtc->base.enabled = crtc_state->base.enable;
 		crtc->active = crtc_state->base.active;
 
-		if (crtc_state->base.active) {
+		if (crtc_state->base.active)
 			dev_priv->active_crtcs |= 1 << crtc->pipe;
 
-			if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
-				pixclk = ilk_pipe_pixel_rate(crtc_state);
-			else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-				pixclk = crtc_state->base.adjusted_mode.crtc_clock;
-			else
-				WARN_ON(dev_priv->display.modeset_calc_cdclk);
-
-			/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
-			if (IS_BROADWELL(dev_priv) && crtc_state->ips_enabled)
-				pixclk = DIV_ROUND_UP(pixclk * 100, 95);
-		}
-
-		dev_priv->min_pixclk[crtc->pipe] = pixclk;
-
 		readout_plane_state(crtc);
 
 		DRM_DEBUG_KMS("[CRTC:%d:%s] hw state readout: %s\n",
@@ -17134,6 +17119,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 	}
 
 	for_each_intel_crtc(dev, crtc) {
+		int pixclk = 0;
+
 		crtc->base.hwmode = crtc->config->base.adjusted_mode;
 
 		memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));
@@ -17161,10 +17148,23 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 			 */
 			crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED;
 
+			if (INTEL_GEN(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
+				pixclk = ilk_pipe_pixel_rate(crtc->config);
+			else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
+				pixclk = crtc->config->base.adjusted_mode.crtc_clock;
+			else
+				WARN_ON(dev_priv->display.modeset_calc_cdclk);
+
+			/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */
+			if (IS_BROADWELL(dev_priv) && crtc->config->ips_enabled)
+				pixclk = DIV_ROUND_UP(pixclk * 100, 95);
+
 			drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode);
 			update_scanline_offset(crtc);
 		}
 
Quoted 11 lines

drivers/gpu/drm/i915/intel_display.c static void intel_modeset_readout_hw_state(struct drm_device *dev) · line 17170

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+		dev_priv->min_pixclk[crtc->pipe] = pixclk;
+
 		intel_pipe_config_sanity_check(dev_priv, crtc->config);
 	}
 }

Looks good. Could you do intel_crtc_state = to_intel_crtc_state(crtc->base.state) at the start and fix all ->state and ->config dereferences in this loop too?
This is a cleanup I'm trying to apply to the whole driver. Atomic state should be passed in where possible, and crtc->config/state dereferences should be avoided as much as we can. Eventually I want to get rid of crtc->config altogether. :)

I posted that as a followup.

Quoted 2 lines

Patch pushed to dinq. Thanks for the reviews.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx