Avoid a potential race condition on mDisplays
I've now run this on a HWC1 and HWC2 build. Both appear to be running
correctly.
Original Message:
The race could occur when transitioning in/out of VR flinger mode.
It is now avoided by ensuring that the primary |DisplayDevice| is always
created once |mStateLock| is released, and ensuring that all accesses
to the primary |DisplayDevice| are guarded by |mStateLock|.
Bug: 36194616
Bug: 37249613
Bug: 37288476
Test: Compiled, installed, and ran with both HWC1 and HWC2 variants.
HWC1 was tested on Nexus 6P. Was able to boot, install apps, run apps,
turn screen on/off, and reboot phone.
HWC2 was tested on sailfish. Was able to boot, install apps, run apps,
run VR apps using both N path, and O1 path, turn screen on/off, and
reboot phone.
Change-Id: I0e80c2553f40cce2116b718bbb0d2566679f794a
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 7314127..40979c9 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -206,7 +206,7 @@
}
disp = DisplayDevice::DISPLAY_EXTERNAL;
}
- mEventHandler->onHotplugReceived(disp,
+ mEventHandler->onHotplugReceived(this, disp,
connected == HWC2::Connection::Connected);
}