Skip to contentSkip to conversation

drm/i915: Sanitize prepare_pipes after valleyview_modeset_global_pipes()

PATCH In review [email protected] 2 participants 4 messages Nov 5, 2013 – Nov 6, 2013

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

PATCH 1/1 drm/i915: Sanitize prepare_pipes after valleyview_modeset_global_pipes()

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

valleyview_modeset_global_pipes() may add pipes that are getting fully disabled to prepare_pipes bitmask. The rest of the code doesn't expect this, so clear out any such pipes from the prepare_pipes bitmask.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +5 -1
index f97e895..ddbef9c 100644
@@ -9514,10 +9514,14 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 	 * mode set on this crtc.  For other crtcs we need to use the
 	 * adjusted_mode bits in the crtc directly.
 	 */
-	if (IS_VALLEYVIEW(dev))
+	if (IS_VALLEYVIEW(dev)) {
 		valleyview_modeset_global_pipes(dev, &prepare_pipes,
 						modeset_pipes, pipe_config);
 
+		/* may have added more to prepare_pipes than we should */
+		prepare_pipes &= ~disable_pipes;
+	}
+
 	for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc)
 		intel_crtc_disable(&intel_crtc->base);
 
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 17 lines · On Tue, Nov 05, 2013 at 10:34:12PM +0200, [email protected] wrote:

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

valleyview_modeset_global_pipes() may add pipes that are getting fully disabled to prepare_pipes bitmask. The rest of the code doesn't expect this, so clear out any such pipes from the prepare_pipes bitmask.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -0
index f97e895..ddbef9c 100644
@@ -9514,10 +9514,14 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 	 * mode set on this crtc.  For other crtcs we need to use the

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

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +4 -1
 	 * adjusted_mode bits in the crtc directly.
 	 */
-	if (IS_VALLEYVIEW(dev))
+	if (IS_VALLEYVIEW(dev)) {
 		valleyview_modeset_global_pipes(dev, &prepare_pipes,
 						modeset_pipes, pipe_config);
 
+		/* may have added more to prepare_pipes than we should */
+		prepare_pipes &= ~disable_pipes;
+	}

I'd have move the full "take disable_pipes out" block from affected_pipes. Afacs there's no need to do it twice.
-Daniel

Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
+
 	for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc)
 		intel_crtc_disable(&intel_crtc->base);
 
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw
Quoted 25 lines · Daniel Vetter
Quoted 24 lines · On Tue, Nov 05, 2013 at 10:34:12PM +0200, [email protected] wrote:

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

valleyview_modeset_global_pipes() may add pipes that are getting fully disabled to prepare_pipes bitmask. The rest of the code doesn't expect this, so clear out any such pipes from the prepare_pipes bitmask.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index f97e895..ddbef9c 100644
@@ -9514,10 +9514,14 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 	 * mode set on this crtc.  For other crtcs we need to use the
 	 * adjusted_mode bits in the crtc directly.
 	 */
-	if (IS_VALLEYVIEW(dev))
+	if (IS_VALLEYVIEW(dev)) {
 		valleyview_modeset_global_pipes(dev, &prepare_pipes,
 						modeset_pipes, pipe_config);
 
Quoted 6 lines

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

Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
+		/* may have added more to prepare_pipes than we should */
+		prepare_pipes &= ~disable_pipes;
+	}

I'd have move the full "take disable_pipes out" block from affected_pipes. Afacs there's no need to do it twice.

I think we'd need to keep the '*modeset_pipes &= ~(*disable_pipes)' part in intel_modeset_affected_pipes(). Otherwise we might end up calling intel_modeset_pipe_config() for a disabled pipe. For prepare_pipes, it looks like we could move the masking to happen only once after valleyview_modeset_global_pipes(). Not sure if spreading it around like that makes sense.

Quoted 17 lines

-Daniel

Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
+
 	for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc)
 		intel_crtc_disable(&intel_crtc->base);
 
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 2 lines
Ville Syrjälä
Intel OTC
#3 lore raw
Quoted 33 lines · Ville Syrjälä
Quoted 25 lines · Daniel Vetter
Quoted 24 lines · On Tue, Nov 05, 2013 at 10:34:12PM +0200, [email protected] wrote:

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

valleyview_modeset_global_pipes() may add pipes that are getting fully disabled to prepare_pipes bitmask. The rest of the code doesn't expect this, so clear out any such pipes from the prepare_pipes bitmask.

---
 drivers/gpu/drm/i915/intel_display.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index f97e895..ddbef9c 100644
@@ -9514,10 +9514,14 @@ static int __intel_set_mode(struct drm_crtc *crtc,
 	 * mode set on this crtc.  For other crtcs we need to use the
 	 * adjusted_mode bits in the crtc directly.
 	 */
-	if (IS_VALLEYVIEW(dev))
+	if (IS_VALLEYVIEW(dev)) {
 		valleyview_modeset_global_pipes(dev, &prepare_pipes,
 						modeset_pipes, pipe_config);
 
Quoted 6 lines

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

Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
+		/* may have added more to prepare_pipes than we should */
+		prepare_pipes &= ~disable_pipes;
+	}

I'd have move the full "take disable_pipes out" block from affected_pipes. Afacs there's no need to do it twice.

Quoted 6 lines

I think we'd need to keep the '*modeset_pipes &= ~(*disable_pipes)' part in intel_modeset_affected_pipes(). Otherwise we might end up calling intel_modeset_pipe_config() for a disabled pipe. For prepare_pipes, it looks like we could move the masking to happen only once after valleyview_modeset_global_pipes(). Not sure if spreading it around like that makes sense.

Hm, good point. I've merged this, we can beautify this code once the real atomic modeset stuff has landed and we can actually do modesets on more than one pipe.
-Daniel

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