libdisplay: backport acquireFenceFd close check from SM-N935S blob to stop potential...
authorDanny Wood <danwood76@gmail.com>
Thu, 4 Jul 2019 17:39:17 +0000 (18:39 +0100)
committerJan Altensen <info@stricted.net>
Thu, 8 Oct 2020 03:38:43 +0000 (05:38 +0200)
Change-Id: I6459575717a03ae8522e4d083edf0aad49724092

libdisplay/ExynosOverlayDisplay.cpp

index 2f12a259bd65743d95ebe0ffc88f1340a6a9dd10..33335ecd5a13375c494a883f8492099b18c43180 100644 (file)
@@ -858,6 +858,18 @@ int ExynosOverlayDisplay::set(hwc_display_contents_1_t* contents)
 
     mHwc->hwc_ctrl.max_num_ovly = mAllowedOverlays;
 
+    for (size_t i = 0; i < contents->numHwLayers; i++) {
+        hwc_layer_1_t &layer = contents->hwLayers[i];
+        /* If Fb is not needed and this is a HWC buffer (function reverse engineered from S7 libexynosdisplay.so) */
+        if(!mFbNeeded && layer.compositionType == HWC_FRAMEBUFFER_TARGET) {
+            /* Close the acquire fence Fd if it is valid */
+            if(layer.acquireFenceFd >= 0) {
+                close(layer.acquireFenceFd);
+                layer.acquireFenceFd = -1;
+            }
+        }
+    }
+
     return err;
 }