intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Postpone plane readout until after encoder readout
@ 2015-07-31 13:04 Patrik Jakobsson
  2015-08-03  6:31 ` Maarten Lankhorst
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Patrik Jakobsson @ 2015-07-31 13:04 UTC (permalink / raw)
  To: intel-gfx

When reading out hw state for planes we disable inactive planes which in
turn triggers an update of the watermarks. The update depends on the
crtc_clock being set which is done when reading out encoders. Thus
postpone the plane readout until after encoder readout.

This prevents a warning in skl_compute_linetime_wm() where pixel_rate
becomes 0 when crtc_clock is 0.

Signed-off-by: Patrik Jakobsson <patrik.jakobsson@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 38 +++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 13a6608..73b2d4a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -15205,27 +15205,25 @@ static bool primary_get_hw_state(struct intel_crtc *crtc)
 	return !!(I915_READ(DSPCNTR(crtc->plane)) & DISPLAY_PLANE_ENABLE);
 }
 
-static void readout_plane_state(struct intel_crtc *crtc,
-				struct intel_crtc_state *crtc_state)
+static void intel_sanitize_plane(struct intel_plane *plane)
 {
-	struct intel_plane *p;
 	struct intel_plane_state *plane_state;
-	bool active = crtc_state->base.active;
+	struct intel_crtc *crtc;
 
-	for_each_intel_plane(crtc->base.dev, p) {
-		if (crtc->pipe != p->pipe)
-			continue;
+	plane_state = to_intel_plane_state(plane->base.state);
 
-		plane_state = to_intel_plane_state(p->base.state);
+	if (!plane_state->base.crtc)
+		return;
 
-		if (p->base.type == DRM_PLANE_TYPE_PRIMARY)
-			plane_state->visible = primary_get_hw_state(crtc);
-		else {
-			if (active)
-				p->disable_plane(&p->base, &crtc->base);
+	crtc = to_intel_crtc(plane_state->base.crtc);
 
-			plane_state->visible = false;
-		}
+	if (plane->base.type == DRM_PLANE_TYPE_PRIMARY) {
+		plane_state->visible = primary_get_hw_state(crtc);
+	} else {
+		if (crtc->base.state->active)
+			plane->disable_plane(&plane->base, &crtc->base);
+
+		plane_state->visible = false;
 	}
 }
 
@@ -15276,7 +15274,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
 		}
 
 		crtc->base.hwmode = crtc->config->base.adjusted_mode;
-		readout_plane_state(crtc, to_intel_crtc_state(crtc->base.state));
 
 		DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",
 			      crtc->base.base.id,
@@ -15349,6 +15346,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev)
 	enum pipe pipe;
 	struct intel_crtc *crtc;
 	struct intel_encoder *encoder;
+	struct intel_plane *plane;
 	int i;
 
 	intel_modeset_readout_hw_state(dev);
@@ -15360,6 +15358,14 @@ intel_modeset_setup_hw_state(struct drm_device *dev)
 
 	for_each_pipe(dev_priv, pipe) {
 		crtc = to_intel_crtc(dev_priv->pipe_to_crtc_mapping[pipe]);
+
+		for_each_intel_plane(crtc->base.dev, plane) {
+			if (crtc->pipe != plane->pipe)
+				continue;
+
+			intel_sanitize_plane(plane);
+		}
+
 		intel_sanitize_crtc(crtc);
 		intel_dump_pipe_config(crtc, crtc->config,
 				       "[setup_hw_state]");
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-10-13 12:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-31 13:04 [PATCH] drm/i915: Postpone plane readout until after encoder readout Patrik Jakobsson
2015-08-03  6:31 ` Maarten Lankhorst
2015-08-03 14:36 ` Maarten Lankhorst
2015-08-04 15:37   ` Patrik Jakobsson
2015-08-05 10:45     ` drm/i915: Postpone plane readout until after encoder readout, v2 Maarten Lankhorst
2015-08-26 14:43       ` Daniel Vetter
2015-08-27 11:05         ` Maarten Lankhorst
2015-09-01  9:52           ` Daniel Vetter
2015-08-27 11:47         ` [PATCH] drm/i915: Postpone plane readout until after encoder readout, v3 Maarten Lankhorst
2015-08-27 12:05           ` Ville Syrjälä
2015-08-31  5:59           ` shuang.he
2015-10-13 12:40           ` Jani Nikula
2015-10-13 12:44             ` Maarten Lankhorst
2015-08-10 17:56 ` [PATCH] drm/i915: Postpone plane readout until after encoder readout shuang.he

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).