diff options
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r-- | services/surfaceflinger/MessageQueue.cpp | 20 | ||||
-rw-r--r-- | services/surfaceflinger/MessageQueue.h | 2 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 20 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 1 |
4 files changed, 28 insertions, 15 deletions
diff --git a/services/surfaceflinger/MessageQueue.cpp b/services/surfaceflinger/MessageQueue.cpp index 1846ccb..85845c9 100644 --- a/services/surfaceflinger/MessageQueue.cpp +++ b/services/surfaceflinger/MessageQueue.cpp @@ -44,8 +44,7 @@ void MessageBase::handleMessage(const Message&) { // --------------------------------------------------------------------------- MessageQueue::MessageQueue() - : mLooper(new Looper(true)), - mInvalidatePending(0) + : mLooper(new Looper(true)), mWorkPending(0) { } @@ -54,20 +53,16 @@ MessageQueue::~MessageQueue() { void MessageQueue::waitMessage() { do { - // handle invalidate events first - if (android_atomic_and(0, &mInvalidatePending) != 0) - break; - IPCThreadState::self()->flushCommands(); int32_t ret = mLooper->pollOnce(-1); switch (ret) { case ALOOPER_POLL_WAKE: - // we got woken-up there is work to do in the main loop - continue; - case ALOOPER_POLL_CALLBACK: - // callback was handled, loop again + // callback and/or wake + if (android_atomic_and(0, &mWorkPending)) { + return; + } continue; case ALOOPER_POLL_TIMEOUT: @@ -99,8 +94,9 @@ status_t MessageQueue::postMessage( } status_t MessageQueue::invalidate() { - android_atomic_or(1, &mInvalidatePending); - mLooper->wake(); + if (android_atomic_or(1, &mWorkPending) == 0) { + mLooper->wake(); + } return NO_ERROR; } diff --git a/services/surfaceflinger/MessageQueue.h b/services/surfaceflinger/MessageQueue.h index 25030a6..2317d81 100644 --- a/services/surfaceflinger/MessageQueue.h +++ b/services/surfaceflinger/MessageQueue.h @@ -55,7 +55,7 @@ private: class MessageQueue { sp<Looper> mLooper; - volatile int32_t mInvalidatePending; + volatile int32_t mWorkPending; public: MessageQueue(); diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index d5a8d08..58196d8 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -69,6 +69,8 @@ #define AID_GRAPHICS 1003 #endif +#define EGL_VERSION_HW_ANDROID 0x3143 + #define DISPLAY_COUNT 1 namespace android { @@ -718,6 +720,14 @@ void SurfaceFlinger::computeVisibleRegions( void SurfaceFlinger::commitTransaction() { + if (!mLayersPendingRemoval.isEmpty()) { + // Notify removed layers now that they can't be drawn from + for (size_t i = 0; i < mLayersPendingRemoval.size(); i++) { + mLayersPendingRemoval[i]->onRemoved(); + } + mLayersPendingRemoval.clear(); + } + mDrawingState = mCurrentState; mTransationPending = false; mTransactionCV.broadcast(); @@ -1170,7 +1180,7 @@ status_t SurfaceFlinger::purgatorizeLayer_l(const sp<LayerBase>& layerBase) mLayerPurgatory.add(layerBase); } - layerBase->onRemoved(); + mLayersPendingRemoval.push(layerBase); // it's possible that we don't find a layer, because it might // have been destroyed already -- this is not technically an error @@ -1537,7 +1547,7 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) * Dump the layers in the purgatory */ - const size_t purgatorySize = mLayerPurgatory.size(); + const size_t purgatorySize = mLayerPurgatory.size(); snprintf(buffer, SIZE, "Purgatory state (%d entries)\n", purgatorySize); result.append(buffer); for (size_t i=0 ; i<purgatorySize ; i++) { @@ -1558,6 +1568,12 @@ status_t SurfaceFlinger::dump(int fd, const Vector<String16>& args) extensions.getRenderer(), extensions.getVersion()); result.append(buffer); + + snprintf(buffer, SIZE, "EGL : %s\n", + eglQueryString(graphicPlane(0).getEGLDisplay(), + EGL_VERSION_HW_ANDROID)); + result.append(buffer); + snprintf(buffer, SIZE, "EXTS: %s\n", extensions.getExtension()); result.append(buffer); diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 1039f47..e6d2cd9 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -352,6 +352,7 @@ private: Condition mTransactionCV; SortedVector< sp<LayerBase> > mLayerPurgatory; bool mTransationPending; + Vector< sp<LayerBase> > mLayersPendingRemoval; // protected by mStateLock (but we could use another lock) GraphicPlane mGraphicPlanes[1]; |