[6/6] drm/i915: Cleanup properly if the implicit fence setup fails
diff mbox series

Message ID 20200110183228.8199-6-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/6] drm/i915: Make a copy of the ggtt view for slave plane
Related show

Commit Message

Ville Syrjälä Jan. 10, 2020, 6:32 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We've already pinned the vma and fence by the time we try to
deal with implicit fencing. Properly unpin the vma and fence
if the fence setup fails instead of just bailing straight out
from .prepare_fb(). As can be expected
drm_atomic_helper_prepare_planes() will not call .cleanup_fb()
for the plane whose .prepare_fb() failed so we must do the
cleanup ourself.

v2: Rebase

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Chris Wilson Jan. 10, 2020, 6:39 p.m. UTC | #1
Quoting Ville Syrjala (2020-01-10 18:32:28)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We've already pinned the vma and fence by the time we try to
> deal with implicit fencing. Properly unpin the vma and fence
> if the fence setup fails instead of just bailing straight out
> from .prepare_fb(). As can be expected
> drm_atomic_helper_prepare_planes() will not call .cleanup_fb()
> for the plane whose .prepare_fb() failed so we must do the
> cleanup ourself.
> 
> v2: Rebase
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index f79a6376bbf0..96e71204b86f 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -15823,7 +15823,7 @@  intel_prepare_plane_fb(struct drm_plane *_plane,
 						      false, I915_FENCE_TIMEOUT,
 						      GFP_KERNEL);
 		if (ret < 0)
-			return ret;
+			goto unpin_fb;
 
 		fence = dma_resv_get_excl_rcu(obj->base.resv);
 		if (fence) {
@@ -15850,6 +15850,11 @@  intel_prepare_plane_fb(struct drm_plane *_plane,
 	}
 
 	return 0;
+
+unpin_fb:
+	intel_plane_unpin_fb(new_plane_state);
+
+	return ret;
 }
 
 /**