diff options
author | Mathias Agopian <mathias@google.com> | 2009-09-10 16:55:13 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-09-10 16:55:13 -0700 |
commit | b58b5d72d6877300fe39b2a30b4742c6f962833f (patch) | |
tree | aa1e32e51ef86a5ae1a3d5eb67836274a97ad083 /include | |
parent | bc52dabcb0f7ebe71cd7bfffacee9b1b1341547f (diff) | |
download | frameworks_native-b58b5d72d6877300fe39b2a30b4742c6f962833f.zip frameworks_native-b58b5d72d6877300fe39b2a30b4742c6f962833f.tar.gz frameworks_native-b58b5d72d6877300fe39b2a30b4742c6f962833f.tar.bz2 |
make sure conditions will return when the status of a surface is not NO_ERROR
Diffstat (limited to 'include')
-rw-r--r-- | include/private/ui/SharedBufferStack.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/private/ui/SharedBufferStack.h b/include/private/ui/SharedBufferStack.h index 2bd5344..e56b8b2 100644 --- a/include/private/ui/SharedBufferStack.h +++ b/include/private/ui/SharedBufferStack.h @@ -93,12 +93,12 @@ public: volatile int32_t available; // number of dequeue-able buffers volatile int32_t queued; // number of buffers waiting for post volatile int32_t inUse; // buffer currently in use by SF + volatile status_t status; // surface's status code // not part of the conditions volatile int32_t reallocMask; int32_t identity; // surface's identity (const) - status_t status; // surface's status code int32_t reserved32[13]; FlatRegion dirtyRegion[NUM_BUFFER_MAX]; // 12*4=48 bytes }; @@ -168,10 +168,11 @@ protected: template <typename T> status_t SharedBufferBase::waitForCondition(T condition) { + const SharedBufferStack& stack( *mSharedStack ); SharedClient& client( *mSharedClient ); const nsecs_t TIMEOUT = s2ns(1); Mutex::Autolock _l(client.lock); - while (!condition()) { + while ((condition()==false) && (stack.status == NO_ERROR)) { status_t err = client.cv.waitRelative(client.lock, TIMEOUT); // handle errors and timeouts @@ -195,7 +196,7 @@ status_t SharedBufferBase::waitForCondition(T condition) } } } - return NO_ERROR; + return stack.status; } @@ -265,9 +266,10 @@ public: ssize_t retireAndLock(); status_t unlock(int buffer); + void setStatus(status_t status); status_t reallocate(); status_t assertReallocate(int buffer); - + Region getDirtyRegion(int buffer) const; private: @@ -283,6 +285,12 @@ private: inline ssize_t operator()(); }; + struct StatusUpdate : public UpdateBase { + const status_t status; + inline StatusUpdate(SharedBufferBase* sbb, status_t status); + inline ssize_t operator()(); + }; + struct ReallocateCondition : public ConditionBase { int buf; inline ReallocateCondition(SharedBufferBase* sbb, int buf); |