Merge \\"HWC2: Add properties to revert latching changes\\" into nyc-mr1-dev am: d16f6ae2bd
am: 3569f1fe4e
Change-Id: I430c5609590d2c5f04bf6a07ff509430a2bcdf9f
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 6024fa9..89627f2 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -51,6 +51,8 @@
#include "RenderEngine/RenderEngine.h"
+#include <mutex>
+
#define DEBUG_RESIZE 0
namespace android {
@@ -1089,6 +1091,20 @@
return static_cast<uint32_t>(producerStickyTransform);
}
+bool Layer::latchUnsignaledBuffers() {
+ static bool propertyLoaded = false;
+ static bool latch = false;
+ static std::mutex mutex;
+ std::lock_guard<std::mutex> lock(mutex);
+ if (!propertyLoaded) {
+ char value[PROPERTY_VALUE_MAX] = {};
+ property_get("debug.sf.latch_unsignaled", value, "0");
+ latch = atoi(value);
+ propertyLoaded = true;
+ }
+ return latch;
+}
+
uint64_t Layer::getHeadFrameNumber() const {
Mutex::Autolock lock(mQueueItemLock);
if (!mQueueItems.empty()) {
@@ -1100,6 +1116,10 @@
bool Layer::headFenceHasSignaled() const {
#ifdef USE_HWC2
+ if (latchUnsignaledBuffers()) {
+ return true;
+ }
+
Mutex::Autolock lock(mQueueItemLock);
if (mQueueItems.empty()) {
return true;
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 78a8427..c070539 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -465,6 +465,9 @@
// Temporary - Used only for LEGACY camera mode.
uint32_t getProducerStickyTransform() const;
+ // Loads the corresponding system property once per process
+ static bool latchUnsignaledBuffers();
+
// -----------------------------------------------------------------------
class SyncPoint
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 8d9215b..67997e7 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -192,6 +192,10 @@
}
ALOGI_IF(mDebugRegion, "showupdates enabled");
ALOGI_IF(mDebugDDMS, "DDMS debugging enabled");
+
+ property_get("debug.sf.disable_backpressure", value, "0");
+ mPropagateBackpressure = !atoi(value);
+ ALOGI_IF(!mPropagateBackpressure, "Disabling backpressure propagation");
}
void SurfaceFlinger::onFirstRef()
@@ -1022,7 +1026,7 @@
mPreviousPresentFence != Fence::NO_FENCE &&
mPreviousPresentFence->getSignalTime() == INT64_MAX;
ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
- if (frameMissed) {
+ if (mPropagateBackpressure && frameMissed) {
signalLayerUpdate();
break;
}
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 5cb9902..f50f9e7 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -526,6 +526,9 @@
bool mBootFinished;
bool mForceFullDamage;
FenceTracker mFenceTracker;
+#ifdef USE_HWC2
+ bool mPropagateBackpressure = true;
+#endif
// these are thread safe
mutable MessageQueue mEventQueue;