SortedVector<ComposerState> mComposerStates;
SortedVector<DisplayState > mDisplayStates;
uint32_t mForceSynchronous;
+ uint32_t mTransactionNestCount;
bool mAnimation;
Composer() : Singleton<Composer>(),
- mForceSynchronous(0),
+ mForceSynchronous(0), mTransactionNestCount(0),
mAnimation(false)
{ }
+ void openGlobalTransactionImpl();
void closeGlobalTransactionImpl(bool synchronous);
void setAnimationTransactionImpl();
Composer::getInstance().setAnimationTransactionImpl();
}
+ static void openGlobalTransaction() {
+ Composer::getInstance().openGlobalTransactionImpl();
+ }
+
static void closeGlobalTransaction(bool synchronous) {
Composer::getInstance().closeGlobalTransactionImpl(synchronous);
}
return ComposerService::getComposerService()->getBuiltInDisplay(id);
}
+void Composer::openGlobalTransactionImpl() {
+ { // scope for the lock
+ Mutex::Autolock _l(mLock);
+ mTransactionNestCount += 1;
+ }
+}
+
void Composer::closeGlobalTransactionImpl(bool synchronous) {
sp<ISurfaceComposer> sm(ComposerService::getComposerService());
{ // scope for the lock
Mutex::Autolock _l(mLock);
+ mForceSynchronous |= synchronous;
+ if (!mTransactionNestCount) {
+ ALOGW("At least one call to closeGlobalTransaction() was not matched by a prior "
+ "call to openGlobalTransaction().");
+ } else if (--mTransactionNestCount) {
+ return;
+ }
+
transaction = mComposerStates;
mComposerStates.clear();
displayTransaction = mDisplayStates;
mDisplayStates.clear();
- if (synchronous || mForceSynchronous) {
+ if (mForceSynchronous) {
flags |= ISurfaceComposer::eSynchronous;
}
if (mAnimation) {
// ----------------------------------------------------------------------------
void SurfaceComposerClient::openGlobalTransaction() {
- // Currently a no-op
+ Composer::openGlobalTransaction();
}
void SurfaceComposerClient::closeGlobalTransaction(bool synchronous) {