public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Unpin framebuffers when crtc is deconfigured.
@ 2015-11-04 13:43 Maarten Lankhorst
  2015-11-17 18:54 ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Maarten Lankhorst @ 2015-11-04 13:43 UTC (permalink / raw)
  To: intel-gfx; +Cc: stable

When setcrtc is called and steals the last connector away from a crtc
it's turned off because it can't stay configured without connectors.

The framebuffer is still preserved however, and that causes troubles
in the IGT stress test kms_flip.flips-vs-fences which tries to use
as many pins as possible and hangs on the third crtc because of
framebuffer pins on the first 2 crtc's.

Cc: stable@vger.kernel.org #v4.3
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5e520ae5f42e..d95d8acae51f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13571,15 +13571,17 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 	struct intel_plane *intel_plane = to_intel_plane(plane);
 	struct drm_i915_gem_object *obj = intel_fb_obj(fb);
 	struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb);
+	struct drm_crtc_state *crtc_state;
 	int ret = 0;
 
 	if (!obj && !old_obj)
 		return 0;
 
-	if (old_obj) {
-		struct drm_crtc_state *crtc_state =
-			drm_atomic_get_existing_crtc_state(new_state->state, plane->state->crtc);
+	crtc_state = drm_atomic_get_existing_crtc_state(new_state->state,
+							new_state->crtc ?:
+							plane->state->crtc);
 
+	if (old_obj) {
 		/* Big Hammer, we also need to ensure that any pending
 		 * MI_WAIT_FOR_EVENT inside a user batch buffer on the
 		 * current scanout is retired before unpinning the old
@@ -13599,7 +13601,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 			return ret;
 	}
 
-	if (!obj) {
+	if (!obj || !crtc_state->enable) {
 		ret = 0;
 	} else if (plane->type == DRM_PLANE_TYPE_CURSOR &&
 	    INTEL_INFO(dev)->cursor_needs_physical) {
@@ -13644,15 +13646,22 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
 	struct intel_plane_state *old_intel_state;
 	struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb);
 	struct drm_i915_gem_object *obj = intel_fb_obj(plane->state->fb);
+	struct drm_crtc_state *old_crtc_state;
 
 	old_intel_state = to_intel_plane_state(old_state);
 
 	if (!obj && !old_obj)
 		return;
 
-	if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR ||
-	    !INTEL_INFO(dev)->cursor_needs_physical))
+	old_crtc_state = drm_atomic_get_existing_crtc_state(old_state->state,
+							    old_state->crtc ?:
+							    plane->state->crtc);
+
+	if (old_obj && old_crtc_state->enable &&
+	    (plane->type != DRM_PLANE_TYPE_CURSOR ||
+	     !INTEL_INFO(dev)->cursor_needs_physical)) {
 		intel_unpin_fb_obj(old_state->fb, old_state);
+	}
 
 	/* prepare_fb aborted? */
 	if ((old_obj && (old_obj->frontbuffer_bits & intel_plane->frontbuffer_bit)) ||
-- 
2.1.0

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

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

end of thread, other threads:[~2015-11-18  8:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-04 13:43 [PATCH] drm/i915: Unpin framebuffers when crtc is deconfigured Maarten Lankhorst
2015-11-17 18:54 ` Daniel Vetter
2015-11-18  8:52   ` [Intel-gfx] " Maarten Lankhorst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox