Skip to contentSkip to conversation

drm/i915: Add primary plane to mask if it's visible

PATCH In review Maarten Lankhorst 4 participants 6 messages Sep 23, 2015 – Oct 13, 2015

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

PATCH 1/2 drm/i915: Add primary plane to mask if it's visible

This fixes the warnings like

"plane A assertion failure, should be disabled but not"

that on the initial modeset during boot. This can happen if the primary plane is enabled by the firmware, but inheriting it fails because the DMAR is active or for other reasons.

Most likely caused by

commit 36750f284b3a4f19b304fda1bb7d6e9e1275ea8d

Author: Maarten Lankhorst <[email protected]>
Date:   Mon Jun 1 12:49:54 2015 +0200

drm/i915: update plane state during init

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91429

---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -2
index c5366b9ff809..854896e4794e 100644
@@ -15103,11 +15103,15 @@ static bool primary_get_hw_state(struct intel_plane *plane)
 /* FIXME read out full plane state for all planes */
 static void readout_plane_state(struct intel_crtc *crtc)
 {
+	struct drm_plane *primary = crtc->base.primary;
 	struct intel_plane_state *plane_state =
-		to_intel_plane_state(crtc->base.primary->state);
+		to_intel_plane_state(primary->state);
 
 	plane_state->visible =
-		primary_get_hw_state(to_intel_plane(crtc->base.primary));
+		primary_get_hw_state(to_intel_plane(primary));
+
+	if (plane_state->visible)
+		crtc->base.state->plane_mask |= 1 << drm_plane_index(primary);
 }
 
 static void intel_modeset_readout_hw_state(struct drm_device *dev)
Signature · 6 lines
2.1.0

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

PATCH 2/2 drm/i915: Fix primary_get_hw_state for gen9+.

On skylake and broxton the old registers are no longer in use. Instead it uses universal planes, fix primary_get_hw to use the correct registers.

---
 drivers/gpu/drm/i915/intel_display.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +4 -1
index 854896e4794e..92c96c34085d 100644
@@ -15097,7 +15097,10 @@ static bool primary_get_hw_state(struct intel_plane *plane)
 {
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 
-	return I915_READ(DSPCNTR(plane->plane)) & DISPLAY_PLANE_ENABLE;
+	if (INTEL_INFO(dev_priv)->gen >= 9)
+		return I915_READ(PLANE_CTL(plane->plane, 0)) & PLANE_CTL_ENABLE;
+	else
+		return I915_READ(DSPCNTR(plane->plane)) & DISPLAY_PLANE_ENABLE;
 }
 
 /* FIXME read out full plane state for all planes */
Signature · 6 lines
2.1.0

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

Re: [PATCH 2/2] drm/i915: Fix primary_get_hw_state for gen9+.

Quoted 6 lines · Maarten Lankhorst

On skylake and broxton the old registers are no longer in use. Instead it uses universal planes, fix primary_get_hw to use the correct registers.

SKL/BXT have only preliminary support in v4.2, so I'm not queuing SKL/BXT specific fixes there. v4.3 is another matter.

BR,
Jani.

Quoted 27 lines
---
 drivers/gpu/drm/i915/intel_display.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +4 -1
index 854896e4794e..92c96c34085d 100644
@@ -15097,7 +15097,10 @@ static bool primary_get_hw_state(struct intel_plane *plane)
 {
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 
-	return I915_READ(DSPCNTR(plane->plane)) & DISPLAY_PLANE_ENABLE;
+	if (INTEL_INFO(dev_priv)->gen >= 9)
+		return I915_READ(PLANE_CTL(plane->plane, 0)) & PLANE_CTL_ENABLE;
+	else
+		return I915_READ(DSPCNTR(plane->plane)) & DISPLAY_PLANE_ENABLE;
 }
 
 /* FIXME read out full plane state for all planes */
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#3 lore raw

Re: [PATCH 2/2] drm/i915: Fix primary_get_hw_state for gen9+.

In reply to Maarten Lankhorst
Quoted 6 lines · Maarten Lankhorst

On skylake and broxton the old registers are no longer in use. Instead it uses universal planes, fix primary_get_hw to use the correct registers.

Maarten, this patch has no reviews and it no longer applies to v4.3 cleanly. Please rebase and repost if it's still valid.

BR,
Jani.

Quoted 27 lines
---
 drivers/gpu/drm/i915/intel_display.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +4 -1
index 854896e4794e..92c96c34085d 100644
@@ -15097,7 +15097,10 @@ static bool primary_get_hw_state(struct intel_plane *plane)
 {
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 
-	return I915_READ(DSPCNTR(plane->plane)) & DISPLAY_PLANE_ENABLE;
+	if (INTEL_INFO(dev_priv)->gen >= 9)
+		return I915_READ(PLANE_CTL(plane->plane, 0)) & PLANE_CTL_ENABLE;
+	else
+		return I915_READ(DSPCNTR(plane->plane)) & DISPLAY_PLANE_ENABLE;
 }
 
 /* FIXME read out full plane state for all planes */
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
In reply to Maarten Lankhorst
Quoted 14 lines · Maarten Lankhorst

This fixes the warnings like

"plane A assertion failure, should be disabled but not"

that on the initial modeset during boot. This can happen if the primary plane is enabled by the firmware, but inheriting it fails because the DMAR is active or for other reasons.

Most likely caused by

commit 36750f284b3a4f19b304fda1bb7d6e9e1275ea8d

Author: Maarten Lankhorst <[email protected]>
Date:   Mon Jun 1 12:49:54 2015 +0200
Quoted 8 lines

drm/i915: update plane state during init

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91429

Daniel, this one is for you. Another version of this is already upstream:

commit 721a09f7393de6c28a07516dccd654c6e995944a

Author: Maarten Lankhorst <[email protected]>
Date:   Tue Sep 15 14:28:54 2015 +0200

drm/i915: Add primary plane to mask if it's visible

Quoted 29 lines
---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -2
index c5366b9ff809..854896e4794e 100644
@@ -15103,11 +15103,15 @@ static bool primary_get_hw_state(struct intel_plane *plane)
 /* FIXME read out full plane state for all planes */
 static void readout_plane_state(struct intel_crtc *crtc)
 {
+	struct drm_plane *primary = crtc->base.primary;
 	struct intel_plane_state *plane_state =
-		to_intel_plane_state(crtc->base.primary->state);
+		to_intel_plane_state(primary->state);
 
 	plane_state->visible =
-		primary_get_hw_state(to_intel_plane(crtc->base.primary));
+		primary_get_hw_state(to_intel_plane(primary));
+
+	if (plane_state->visible)
+		crtc->base.state->plane_mask |= 1 << drm_plane_index(primary);
 }
 
 static void intel_modeset_readout_hw_state(struct drm_device *dev)
Signature · 1 line
2.1.0
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 24 lines · Jani Nikula
Quoted 14 lines · Maarten Lankhorst

This fixes the warnings like

"plane A assertion failure, should be disabled but not"

that on the initial modeset during boot. This can happen if the primary plane is enabled by the firmware, but inheriting it fails because the DMAR is active or for other reasons.

Most likely caused by

commit 36750f284b3a4f19b304fda1bb7d6e9e1275ea8d

Author: Maarten Lankhorst <[email protected]>
Date:   Mon Jun 1 12:49:54 2015 +0200
Quoted 8 lines

drm/i915: update plane state during init

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91429

Quoted 8 lines

Daniel, this one is for you. Another version of this is already upstream:

commit 721a09f7393de6c28a07516dccd654c6e995944a

Author: Maarten Lankhorst <[email protected]>
Date:   Tue Sep 15 14:28:54 2015 +0200

drm/i915: Add primary plane to mask if it's visible

Why did the commit message not explain that this was a forward port? </broken-maintainer-record>

Anyway we still seem to have a bit of a mess in the plane reconstruction code - if intel_find_initial_plane_obj fails we don't shut down the plane, but an enabled plane without an fb attached will upset the drm core a bit
...

Anyway applied this to dinq (with the forward-port note attached). -Daniel

Quoted 39 lines
Quoted 32 lines


---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -2
index c5366b9ff809..854896e4794e 100644
@@ -15103,11 +15103,15 @@ static bool primary_get_hw_state(struct intel_plane *plane)
 /* FIXME read out full plane state for all planes */
 static void readout_plane_state(struct intel_crtc *crtc)
 {
+	struct drm_plane *primary = crtc->base.primary;
 	struct intel_plane_state *plane_state =
-		to_intel_plane_state(crtc->base.primary->state);
+		to_intel_plane_state(primary->state);
 
 	plane_state->visible =
-		primary_get_hw_state(to_intel_plane(crtc->base.primary));
+		primary_get_hw_state(to_intel_plane(primary));
+
+	if (plane_state->visible)
+		crtc->base.state->plane_mask |= 1 << drm_plane_index(primary);
 }
 
 static void intel_modeset_readout_hw_state(struct drm_device *dev)
Signature · 1 line
2.1.0
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx