HWC2On1Adapter: Initialize variables and fix mutex
Initializes a few variables that had been missed before, and switches
the Adapter state mutex to be recursive, since it is held during the
call into HWC1 prepare, which can call back into the Adapter to perform
an invalidate.
Change-Id: Id300e8b23403f5339562fd860c2ce9d0f2b72f27
diff --git a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
index 500c48f..bffeefe 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2On1Adapter.h
@@ -236,7 +236,8 @@
Config(Display& display, hwc2_config_t id, uint32_t hwcId)
: mDisplay(display),
mId(id),
- mHwcId(hwcId) {}
+ mHwcId(hwcId),
+ mAttributes() {}
bool isOnDisplay(const Display& display) const {
return display.getId() == mDisplay.getId();
@@ -606,8 +607,10 @@
std::shared_ptr<Display> mHwc1VirtualDisplay;
// These are potentially accessed from multiple threads, and are protected
- // by this mutex
- std::timed_mutex mStateMutex;
+ // by this mutex. This needs to be recursive, since the HWC1 implementation
+ // can call back into the invalidate callback on the same thread that is
+ // calling prepare.
+ std::recursive_timed_mutex mStateMutex;
struct CallbackInfo {
hwc2_callback_data_t data;