HWC2: Initialize retire fence to -1
Initializing to zero will cause us to inadvertently close fd 0.
While fd 0 (stdout) isn't used in the surfaceflinger process,
if we close it, the fd becomes available for other usages, such
as fences and ion buffers. Using it becomes problematic for some
drivers which may treat it as an invalid value.
Bug: 28640429
Test: Fixes GPU driver seeing fd of 0 and erroring
Change-Id: Ifa06472d24476edb27a4306d946eb616a15aee7a
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index 1502eeb..c89ca83 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -929,7 +929,7 @@
Error Display::present(sp<Fence>* outPresentFence)
{
- int32_t presentFenceFd = 0;
+ int32_t presentFenceFd = -1;
#ifdef BYPASS_IHWC
int32_t intError = mDevice.mPresentDisplay(mDevice.mHwcDevice, mId,
&presentFenceFd);