From 1ba0a239435e5118e8d707e73874ea4a988c47c6 Mon Sep 17 00:00:00 2001 From: Danny Wood Date: Thu, 4 Jul 2019 18:39:17 +0100 Subject: [PATCH] libvppdisplay: backport acquireFenceFd close check from SM-N935S blob to stop potential Fd leak Change-Id: I6459575717a03ae8522e4d083edf0aad49724092 --- libvppdisplay/ExynosDisplay.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libvppdisplay/ExynosDisplay.cpp b/libvppdisplay/ExynosDisplay.cpp index ea2a6ea..17bfdeb 100644 --- a/libvppdisplay/ExynosDisplay.cpp +++ b/libvppdisplay/ExynosDisplay.cpp @@ -470,6 +470,15 @@ void ExynosDisplay::dupFence(int fence, hwc_display_contents_1_t *contents) if (layer.handle != NULL) handle = private_handle_t::dynamicCast(layer.handle); + /* 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; + } + } + if ((mVirtualOverlayFlag == true) && (layer.compositionType == HWC_OVERLAY) && ((handle != NULL) && (getDrmMode(handle->flags) == NO_DRM)) && (mFirstFb <= i) && (i <= mLastFb)) -- 2.20.1