Merge "Fix concurrent writes to the hardware composer" into oc-dr1-dev
am: 87cd11513f
Change-Id: I00d0a5267913c284eddd97bfe7eefb15b9ee403e
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 3d61932..bd2441f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1255,17 +1255,14 @@
enabled ? HWC2::Vsync::Enable : HWC2::Vsync::Disable);
}
-void SurfaceFlinger::clearHwcLayers(const LayerVector& layers) {
- for (size_t i = 0; i < layers.size(); ++i) {
- layers[i]->clearHwcLayers();
- }
-}
-
// Note: it is assumed the caller holds |mStateLock| when this is called
void SurfaceFlinger::resetHwcLocked() {
disableHardwareVsync(true);
clearHwcLayers(mDrawingState.layersSortedByZ);
clearHwcLayers(mCurrentState.layersSortedByZ);
+ for (size_t disp = 0; disp < mDisplays.size(); ++disp) {
+ clearHwcLayers(mDisplays[disp]->getVisibleLayersSortedByZ());
+ }
// Clear the drawing state so that the logic inside of
// handleTransactionLocked will fire. It will determine the delta between
// mCurrentState and mDrawingState and re-apply all changes when we make the
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 8e47396..53c3823 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -586,7 +586,12 @@
/* ------------------------------------------------------------------------
* VrFlinger
*/
- void clearHwcLayers(const LayerVector& layers);
+ template<typename T>
+ void clearHwcLayers(const T& layers) {
+ for (size_t i = 0; i < layers.size(); ++i) {
+ layers[i]->clearHwcLayers();
+ }
+ }
void resetHwcLocked();
// Check to see if we should handoff to vr flinger.