[Intel-gfx] [PATCH 2/2] drm/i915: Cleanup properly if the implicit fence wait fails

Ville Syrjala ville.syrjala at linux.intel.com
Wed Sep 12 18:52:52 UTC 2018


From: Ville Syrjälä <ville.syrjala at 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 wait 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.

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

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 1333493c0618..947301312ea3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13188,7 +13188,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 						      false, I915_FENCE_TIMEOUT,
 						      GFP_KERNEL);
 		if (ret < 0)
-			return ret;
+			goto unpin_fb;
 
 		fence = reservation_object_get_excl_rcu(obj->resv);
 		if (fence) {
@@ -13213,6 +13213,13 @@ intel_prepare_plane_fb(struct drm_plane *plane,
 	}
 
 	return 0;
+
+unpin_fb:
+	mutex_lock(&dev_priv->drm.struct_mutex);
+	intel_plane_unpin_fb(to_intel_plane_state(new_state));
+	mutex_unlock(&dev_priv->drm.struct_mutex);
+
+	return ret;
 }
 
 /**
-- 
2.16.4



More information about the Intel-gfx mailing list