Merge "sdm: Fix output fences on prepare failure." into display.lnx.9.0.r1-rel
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index a20ac1f..54996f2 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -1327,6 +1327,13 @@
     } else {
       DLOGE("Prepare failed: %d", error);
     }
+    // Clear fences
+    DLOGI("Clearing fences on input layers on display %d-%d", display_id_, display_type_);
+    for (auto &layer : layer_stack->layers) {
+      layer->input_buffer.release_fence = nullptr;
+    }
+    layer_stack->retire_fence = nullptr;
+
     return error;
   }