summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-10-17 11:31:39 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-17 11:31:39 -0700
commit7f7362c02bcde8750e24781f5c7199f9551301c5 (patch)
tree83be1a0caf529baec9f7cd21870f5a6329caa182 /libs
parentbddddf47291a1d93a6907ca943fb299d775fd9c0 (diff)
parentde14ecaebcb958f542f50cff08109926aad2c685 (diff)
downloadframeworks_base-7f7362c02bcde8750e24781f5c7199f9551301c5.zip
frameworks_base-7f7362c02bcde8750e24781f5c7199f9551301c5.tar.gz
frameworks_base-7f7362c02bcde8750e24781f5c7199f9551301c5.tar.bz2
Merge changes I4e5ff00c,Id5e3ca1d,I97cbba61
* changes: SurfaceFlinger: Remove display freezing code SurfaceFlinger: add some layer update tests SurfaceFlinger: make sync transactions explicit
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/ISurfaceComposer.cpp6
-rw-r--r--libs/gui/SurfaceComposerClient.cpp33
2 files changed, 29 insertions, 10 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index eb90147..86bc62a 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -79,7 +79,7 @@ public:
}
virtual void setTransactionState(const Vector<ComposerState>& state,
- int orientation)
+ int orientation, uint32_t flags)
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
@@ -90,6 +90,7 @@ public:
b->write(data);
}
data.writeInt32(orientation);
+ data.writeInt32(flags);
remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
}
@@ -204,7 +205,8 @@ status_t BnSurfaceComposer::onTransact(
state.add(s);
}
int orientation = data.readInt32();
- setTransactionState(state, orientation);
+ uint32_t flags = data.readInt32();
+ setTransactionState(state, orientation, flags);
} break;
case BOOT_FINISHED: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 5f3d608..4ad6c22 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -92,11 +92,14 @@ class Composer : public Singleton<Composer>
mutable Mutex mLock;
SortedVector<ComposerState> mStates;
int mOrientation;
+ uint32_t mForceSynchronous;
Composer() : Singleton<Composer>(),
- mOrientation(ISurfaceComposer::eOrientationUnchanged) { }
+ mOrientation(ISurfaceComposer::eOrientationUnchanged),
+ mForceSynchronous(0)
+ { }
- void closeGlobalTransactionImpl();
+ void closeGlobalTransactionImpl(bool synchronous);
layer_state_t* getLayerStateLocked(
const sp<SurfaceComposerClient>& client, SurfaceID id);
@@ -123,8 +126,8 @@ public:
uint32_t tint);
status_t setOrientation(int orientation);
- static void closeGlobalTransaction() {
- Composer::getInstance().closeGlobalTransactionImpl();
+ static void closeGlobalTransaction(bool synchronous) {
+ Composer::getInstance().closeGlobalTransactionImpl(synchronous);
}
};
@@ -132,11 +135,12 @@ ANDROID_SINGLETON_STATIC_INSTANCE(Composer);
// ---------------------------------------------------------------------------
-void Composer::closeGlobalTransactionImpl() {
+void Composer::closeGlobalTransactionImpl(bool synchronous) {
sp<ISurfaceComposer> sm(getComposerService());
Vector<ComposerState> transaction;
int orientation;
+ uint32_t flags = 0;
{ // scope for the lock
Mutex::Autolock _l(mLock);
@@ -145,9 +149,14 @@ void Composer::closeGlobalTransactionImpl() {
orientation = mOrientation;
mOrientation = ISurfaceComposer::eOrientationUnchanged;
+
+ if (synchronous || mForceSynchronous) {
+ flags |= ISurfaceComposer::eSynchronous;
+ }
+ mForceSynchronous = false;
}
- sm->setTransactionState(transaction, orientation);
+ sm->setTransactionState(transaction, orientation, flags);
}
layer_state_t* Composer::getLayerStateLocked(
@@ -188,6 +197,10 @@ status_t Composer::setSize(const sp<SurfaceComposerClient>& client,
s->what |= ISurfaceComposer::eSizeChanged;
s->w = w;
s->h = h;
+
+ // Resizing a surface makes the transaction synchronous.
+ mForceSynchronous = true;
+
return NO_ERROR;
}
@@ -270,6 +283,10 @@ status_t Composer::setFreezeTint(const sp<SurfaceComposerClient>& client,
status_t Composer::setOrientation(int orientation) {
Mutex::Autolock _l(mLock);
mOrientation = orientation;
+
+ // Changing the orientation makes the transaction synchronous.
+ mForceSynchronous = true;
+
return NO_ERROR;
}
@@ -375,8 +392,8 @@ void SurfaceComposerClient::openGlobalTransaction() {
// Currently a no-op
}
-void SurfaceComposerClient::closeGlobalTransaction() {
- Composer::closeGlobalTransaction();
+void SurfaceComposerClient::closeGlobalTransaction(bool synchronous) {
+ Composer::closeGlobalTransaction(synchronous);
}
// ----------------------------------------------------------------------------