diff options
author | Jamie Gennis <jgennis@google.com> | 2012-10-15 19:36:11 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-15 19:36:12 -0700 |
commit | 3365c56716432d3bfdf41bb82fb08df821f41d0c (patch) | |
tree | 3cd6925a96abcf5382a740d0ec0dd0e502a0528f /services | |
parent | b96fe08540dcf7e90be56919ea9863f687da779c (diff) | |
parent | 2d5e230292c27d59f4c096bc742a0a19abf811c1 (diff) | |
download | frameworks_native-3365c56716432d3bfdf41bb82fb08df821f41d0c.zip frameworks_native-3365c56716432d3bfdf41bb82fb08df821f41d0c.tar.gz frameworks_native-3365c56716432d3bfdf41bb82fb08df821f41d0c.tar.bz2 |
Merge "SurfaceFlinger: add animation transactions" into jb-mr1-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 32 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 3 |
2 files changed, 28 insertions, 7 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 492d1cf..e21e2bf 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -86,7 +86,8 @@ const String16 sDump("android.permission.DUMP"); SurfaceFlinger::SurfaceFlinger() : BnSurfaceComposer(), Thread(false), mTransactionFlags(0), - mTransationPending(false), + mTransactionPending(false), + mAnimTransactionPending(false), mLayersRemoved(false), mRepaintEverything(0), mBootTime(systemTime()), @@ -1264,7 +1265,8 @@ void SurfaceFlinger::commitTransaction() } mDrawingState = mCurrentState; - mTransationPending = false; + mTransactionPending = false; + mAnimTransactionPending = false; mTransactionCV.broadcast(); } @@ -1665,6 +1667,21 @@ void SurfaceFlinger::setTransactionState( Mutex::Autolock _l(mStateLock); uint32_t transactionFlags = 0; + if (flags & eAnimation) { + // For window updates that are part of an animation we must wait for + // previous animation "frames" to be handled. + while (mAnimTransactionPending) { + status_t err = mTransactionCV.waitRelative(mStateLock, 500 * 1000); + if (CC_UNLIKELY(err != NO_ERROR)) { + // just in case something goes wrong in SF, return to the + // caller after a few hundred microseconds. + ALOGW_IF(err == TIMED_OUT, "setTransactionState timed out!"); + mAnimTransactionPending = false; + break; + } + } + } + size_t count = displays.size(); for (size_t i=0 ; i<count ; i++) { const DisplayState& s(displays[i]); @@ -1685,15 +1702,18 @@ void SurfaceFlinger::setTransactionState( // if this is a synchronous transaction, wait for it to take effect // before returning. if (flags & eSynchronous) { - mTransationPending = true; + mTransactionPending = true; + } + if (flags & eAnimation) { + mAnimTransactionPending = true; } - while (mTransationPending) { + while (mTransactionPending) { status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5)); if (CC_UNLIKELY(err != NO_ERROR)) { // just in case something goes wrong in SF, return to the // called after a few seconds. - ALOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!"); - mTransationPending = false; + ALOGW_IF(err == TIMED_OUT, "setTransactionState timed out!"); + mTransactionPending = false; break; } } diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 6d36719..efe34af 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -398,7 +398,8 @@ private: volatile int32_t mTransactionFlags; Condition mTransactionCV; SortedVector<sp<LayerBase> > mLayerPurgatory; - bool mTransationPending; + bool mTransactionPending; + bool mAnimTransactionPending; Vector<sp<LayerBase> > mLayersPendingRemoval; // protected by mStateLock (but we could use another lock) |