Skip to contentSkip to conversation

drm/i915/vlv: don't try to enable a crtc without fb

PATCH In review Rob Clark 3 participants 3 messages Oct 17, 2014 – Oct 19, 2014

Subsystems (2)
lore
Share & tools
lore

Rob Clark

author
#0 lore raw

PATCH 1/1 drm/i915/vlv: don't try to enable a crtc without fb

On valleyview, all enabled pipes get added to the prepare mask. However if you did state readout to find that the crtc is enabled, but failed to map stolen mem and wrap it in a bo (and fb), you could end up in a scenario where crtc->primary->fb is still null on first modeset. So lets check for this rather than exploding.

---
As with http://lists.freedesktop.org/archives/dri-devel/2014-September/069341.html
the root cause is issues with stolen region. But it would be nice if i915 was a bit less fragile when things don't go as planned.

This could have the side effect that, at first modeset, the crtc's which were enabled by BIOS but not yet set (by fbcon or userspace) get disabled. This is a somewhat lesser inconvenience compared to opps'ing under console_lock.

 drivers/gpu/drm/i915/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +3 -0
index d8324c6..9f85033 100644
@@ -10895,6 +10895,9 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 
 	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
 	for_each_intel_crtc_masked(dev, prepare_pipes, intel_crtc) {
+		if (!intel_crtc->base.primary->fb)
+			continue;
+
 		update_scanline_offset(intel_crtc);
 
 		dev_priv->display.crtc_enable(&intel_crtc->base);
Signature · 1 line
1.9.3
#1 lore raw
Quoted 25 lines · Rob Clark

On valleyview, all enabled pipes get added to the prepare mask. However if you did state readout to find that the crtc is enabled, but failed to map stolen mem and wrap it in a bo (and fb), you could end up in a scenario where crtc->primary->fb is still null on first modeset. So lets check for this rather than exploding.

---
As with http://lists.freedesktop.org/archives/dri-devel/2014-September/069341.html
the root cause is issues with stolen region. But it would be nice if i915 was a bit less fragile when things don't go as planned.

This could have the side effect that, at first modeset, the crtc's which were enabled by BIOS but not yet set (by fbcon or userspace) get disabled. This is a somewhat lesser inconvenience compared to opps'ing under console_lock.

 drivers/gpu/drm/i915/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index d8324c6..9f85033 100644

drivers/gpu/drm/i915/intel_display.c static int __intel_set_mode(struct drm_crtc *crtc, · line 10900

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -10895,6 +10895,9 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 
 	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
 	for_each_intel_crtc_masked(dev, prepare_pipes, intel_crtc) {
+		if (!intel_crtc->base.primary->fb)
+			continue;
+

I think the right fix would be to turn off the primary plane during the sanitize phase. Although our primary plane code isn't quite up to the task yet since we'd still try to turn it back on during .crtc_enable(). The code is somewhat in flux currently and hopefully soon we'd be able to handle that case correctly.

In the meantime we could potentially disable the whole crtc in intel_sanitize_crtc() or we could stick a hack into intel_enable_primary_hw_plane() so that it won't try to enable the plane w/o an fb (with a comment stating that it's a temporary kludge).

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
 		update_scanline_offset(intel_crtc);
 
 		dev_priv->display.crtc_enable(&intel_crtc->base);
Signature · 6 lines
1.9.3

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä
Intel OTC
#2 lore raw
Quoted 39 lines · Ville Syrjälä
Quoted 25 lines · Rob Clark

On valleyview, all enabled pipes get added to the prepare mask. However if you did state readout to find that the crtc is enabled, but failed to map stolen mem and wrap it in a bo (and fb), you could end up in a scenario where crtc->primary->fb is still null on first modeset. So lets check for this rather than exploding.

---
As with http://lists.freedesktop.org/archives/dri-devel/2014-September/069341.html
the root cause is issues with stolen region. But it would be nice if i915 was a bit less fragile when things don't go as planned.

This could have the side effect that, at first modeset, the crtc's which were enabled by BIOS but not yet set (by fbcon or userspace) get disabled. This is a somewhat lesser inconvenience compared to opps'ing under console_lock.

 drivers/gpu/drm/i915/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index d8324c6..9f85033 100644

drivers/gpu/drm/i915/intel_display.c static int __intel_set_mode(struct drm_crtc *crtc, · line 10900

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -10895,6 +10895,9 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 
 	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
 	for_each_intel_crtc_masked(dev, prepare_pipes, intel_crtc) {
+		if (!intel_crtc->base.primary->fb)
+			continue;
+

I think the right fix would be to turn off the primary plane during the sanitize phase. Although our primary plane code isn't quite up to the task yet since we'd still try to turn it back on during .crtc_enable(). The code is somewhat in flux currently and hopefully soon we'd be able to handle that case correctly.

Quoted 4 lines

In the meantime we could potentially disable the whole crtc in intel_sanitize_crtc() or we could stick a hack into intel_enable_primary_hw_plane() so that it won't try to enable the plane w/o an fb (with a comment stating that it's a temporary kludge).

Yeah, I think whacking a temporary hack into sanitize_crtc is the better option. Long term we really want what Ville said and just disable the primary plane. But until we've fully untangled that mess in prep for atomic modesets we can't do that just yet.
-Daniel

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