Latch Unsignaled when only a single layer is being updated.
Three conditions are introduced.
DISABLED (Default for now): This is when latch unsignaled is completely disabled.
AUTO: This is when we will latch for the single layer update. Further refinements will be done in b/200284381
ALWAYS: This will latch unsignaled no matter what the change is.
BUG: 198189193
Test: Did the manual test and
atest libsurfaceflinger_unittest
atest MockFence_test
atest libgui_test
Change-Id: I0c0b475ba4a093275fac23a986fc610ea462f73e
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 276c7f6..97fddf2 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -135,6 +135,8 @@
eTransactionMask = 0x1f,
};
+enum class LatchUnsignaledConfig { Always, Auto, Disabled };
+
using DisplayColorSetting = compositionengine::OutputColorSetting;
struct SurfaceFlingerBE {
@@ -257,7 +259,7 @@
// being treated as native display brightness
static bool enableSdrDimming;
- static bool enableLatchUnsignaled;
+ static LatchUnsignaledConfig enableLatchUnsignaledConfig;
// must be called before clients can connect
void init() ANDROID_API;
@@ -751,7 +753,14 @@
const FrameTimelineInfo& info, bool isAutoTimestamp, int64_t desiredPresentTime,
uid_t originUid, const Vector<ComposerState>& states,
const std::unordered_set<sp<IBinder>, ISurfaceComposer::SpHash<IBinder>>&
- bufferLayersReadyToPresent) const REQUIRES(mStateLock);
+ bufferLayersReadyToPresent,
+ bool allowLatchUnsignaled) const REQUIRES(mStateLock);
+ static LatchUnsignaledConfig getLatchUnsignaledConfig();
+ bool latchUnsignaledIsAllowed(std::vector<TransactionState>& transactions) REQUIRES(mStateLock);
+ bool allowedLatchUnsignaled() REQUIRES(mQueueLock, mStateLock);
+ bool checkTransactionCanLatchUnsignaled(const TransactionState& transaction)
+ REQUIRES(mStateLock);
+ bool applyTransactions(std::vector<TransactionState>& transactions) REQUIRES(mStateLock);
uint32_t setDisplayStateLocked(const DisplayState& s) REQUIRES(mStateLock);
uint32_t addInputWindowCommands(const InputWindowCommands& inputWindowCommands)
REQUIRES(mStateLock);
@@ -1242,7 +1251,7 @@
Condition mTransactionQueueCV;
std::unordered_map<sp<IBinder>, std::queue<TransactionState>, IListenerHash>
mPendingTransactionQueues GUARDED_BY(mQueueLock);
- std::queue<TransactionState> mTransactionQueue GUARDED_BY(mQueueLock);
+ std::deque<TransactionState> mTransactionQueue GUARDED_BY(mQueueLock);
/*
* Feature prototyping
*/