Loading include/gui/BufferQueueCore.h +2 −0 Original line number Diff line number Diff line Loading @@ -126,9 +126,11 @@ private: // waitWhileAllocatingLocked blocks until mIsAllocating is false. void waitWhileAllocatingLocked() const; #if DEBUG_ONLY_CODE // validateConsistencyLocked ensures that the free lists are in sync with // the information stored in mSlots void validateConsistencyLocked() const; #endif // mAllocator is the connection to SurfaceFlinger that is used to allocate // new GraphicBuffer objects. Loading libs/gui/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ LOCAL_CPPFLAGS += -Wno-gnu-zero-variadic-macro-arguments # Don't warn about struct padding LOCAL_CPPFLAGS += -Wno-padded LOCAL_CPPFLAGS += -DDEBUG_ONLY_CODE=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0) LOCAL_SRC_FILES := \ IGraphicBufferConsumer.cpp \ IConsumerListener.cpp \ Loading libs/gui/BufferQueueConsumer.cpp +11 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,12 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 #if DEBUG_ONLY_CODE #define VALIDATE_CONSISTENCY() do { mCore->validateConsistencyLocked(); } while (0) #else #define VALIDATE_CONSISTENCY() #endif #include <gui/BufferItem.h> #include <gui/BufferQueueConsumer.h> #include <gui/BufferQueueCore.h> Loading Loading @@ -252,7 +258,7 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer, ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size()); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } if (listener != NULL) { Loading Loading @@ -296,7 +302,7 @@ status_t BufferQueueConsumer::detachBuffer(int slot) { mCore->mFreeSlots.insert(slot); mCore->clearBufferSlotLocked(slot); mCore->mDequeueCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -386,7 +392,7 @@ status_t BufferQueueConsumer::attachBuffer(int* outSlot, // for attached buffers. mSlots[*outSlot].mAcquireCalled = false; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -446,7 +452,7 @@ status_t BufferQueueConsumer::releaseBuffer(int slot, uint64_t frameNumber, BQ_LOGV("releaseBuffer: releasing slot %d", slot); mCore->mDequeueCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } // Autolock scope // Call back without lock held Loading Loading @@ -633,7 +639,7 @@ status_t BufferQueueConsumer::setMaxAcquiredBufferCount( BQ_LOGV("setMaxAcquiredBufferCount: %d", maxAcquiredBuffers); mCore->mMaxAcquiredBufferCount = maxAcquiredBuffers; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading libs/gui/BufferQueueCore.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,12 @@ #define EGL_EGLEXT_PROTOTYPES #if DEBUG_ONLY_CODE #define VALIDATE_CONSISTENCY() do { validateConsistencyLocked(); } while (0) #else #define VALIDATE_CONSISTENCY() #endif #include <inttypes.h> #include <gui/BufferItem.h> Loading Loading @@ -216,7 +222,7 @@ void BufferQueueCore::freeAllBuffersLocked() { b.mIsStale = true; } validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } bool BufferQueueCore::adjustAvailableSlotsLocked(int delta) { Loading Loading @@ -258,6 +264,7 @@ void BufferQueueCore::waitWhileAllocatingLocked() const { } } #if DEBUG_ONLY_CODE void BufferQueueCore::validateConsistencyLocked() const { static const useconds_t PAUSE_TIME = 0; int allocatedSlots = 0; Loading Loading @@ -382,5 +389,6 @@ void BufferQueueCore::validateConsistencyLocked() const { mUnusedSlots.size()); } } #endif } // namespace android libs/gui/BufferQueueProducer.cpp +18 −11 Original line number Diff line number Diff line Loading @@ -20,6 +20,12 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 #if DEBUG_ONLY_CODE #define VALIDATE_CONSISTENCY() do { mCore->validateConsistencyLocked(); } while (0) #else #define VALIDATE_CONSISTENCY() #endif #define EGL_EGLEXT_PROTOTYPES #include <gui/BufferItem.h> Loading Loading @@ -140,7 +146,7 @@ status_t BufferQueueProducer::setMaxDequeuedBufferCount( return BAD_VALUE; } mCore->mMaxDequeuedBufferCount = maxDequeuedBuffers; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); mCore->mDequeueCondition.broadcast(); listener = mCore->mConsumerListener; } // Autolock scope Loading Loading @@ -189,7 +195,7 @@ status_t BufferQueueProducer::setAsyncMode(bool async) { return BAD_VALUE; } mCore->mAsyncMode = async; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); mCore->mDequeueCondition.broadcast(); listener = mCore->mConsumerListener; } // Autolock scope Loading Loading @@ -495,7 +501,7 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot, return NO_INIT; } mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } // Autolock scope } Loading Loading @@ -566,7 +572,7 @@ status_t BufferQueueProducer::detachBuffer(int slot) { mCore->mFreeSlots.insert(slot); mCore->clearBufferSlotLocked(slot); mCore->mDequeueCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -616,7 +622,7 @@ status_t BufferQueueProducer::detachNextBuffer(sp<GraphicBuffer>* outBuffer, *outBuffer = mSlots[found].mGraphicBuffer; *outFence = mSlots[found].mFence; mCore->clearBufferSlotLocked(found); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -684,7 +690,7 @@ status_t BufferQueueProducer::attachBuffer(int* outSlot, mSlots[*outSlot].mRequestBufferCalled = true; mSlots[*outSlot].mAcquireCalled = false; mCore->mActiveBuffers.insert(found); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return returnFlags; } Loading Loading @@ -861,7 +867,7 @@ status_t BufferQueueProducer::queueBuffer(int slot, // Take a ticket for the callback functions callbackTicket = mNextCallbackTicket++; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } // Autolock scope // Don't send the GraphicBuffer through the callback, and don't send Loading Loading @@ -948,7 +954,7 @@ status_t BufferQueueProducer::cancelBuffer(int slot, const sp<Fence>& fence) { mSlots[slot].mFence = fence; mCore->mDequeueCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -1087,7 +1093,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, } mCore->mAllowAllocation = true; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return status; } Loading Loading @@ -1252,7 +1258,7 @@ void BufferQueueProducer::allocateBuffers(uint32_t width, uint32_t height, mCore->mIsAllocating = false; mCore->mIsAllocatingCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } // Autolock scope } } Loading Loading @@ -1316,7 +1322,8 @@ status_t BufferQueueProducer::setDequeueTimeout(nsecs_t timeout) { mDequeueTimeout = timeout; mCore->mDequeueBufferCannotBlock = false; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading
include/gui/BufferQueueCore.h +2 −0 Original line number Diff line number Diff line Loading @@ -126,9 +126,11 @@ private: // waitWhileAllocatingLocked blocks until mIsAllocating is false. void waitWhileAllocatingLocked() const; #if DEBUG_ONLY_CODE // validateConsistencyLocked ensures that the free lists are in sync with // the information stored in mSlots void validateConsistencyLocked() const; #endif // mAllocator is the connection to SurfaceFlinger that is used to allocate // new GraphicBuffer objects. Loading
libs/gui/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ LOCAL_CPPFLAGS += -Wno-gnu-zero-variadic-macro-arguments # Don't warn about struct padding LOCAL_CPPFLAGS += -Wno-padded LOCAL_CPPFLAGS += -DDEBUG_ONLY_CODE=$(if $(filter userdebug eng,$(TARGET_BUILD_VARIANT)),1,0) LOCAL_SRC_FILES := \ IGraphicBufferConsumer.cpp \ IConsumerListener.cpp \ Loading
libs/gui/BufferQueueConsumer.cpp +11 −5 Original line number Diff line number Diff line Loading @@ -20,6 +20,12 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 #if DEBUG_ONLY_CODE #define VALIDATE_CONSISTENCY() do { mCore->validateConsistencyLocked(); } while (0) #else #define VALIDATE_CONSISTENCY() #endif #include <gui/BufferItem.h> #include <gui/BufferQueueConsumer.h> #include <gui/BufferQueueCore.h> Loading Loading @@ -252,7 +258,7 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer, ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size()); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } if (listener != NULL) { Loading Loading @@ -296,7 +302,7 @@ status_t BufferQueueConsumer::detachBuffer(int slot) { mCore->mFreeSlots.insert(slot); mCore->clearBufferSlotLocked(slot); mCore->mDequeueCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -386,7 +392,7 @@ status_t BufferQueueConsumer::attachBuffer(int* outSlot, // for attached buffers. mSlots[*outSlot].mAcquireCalled = false; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -446,7 +452,7 @@ status_t BufferQueueConsumer::releaseBuffer(int slot, uint64_t frameNumber, BQ_LOGV("releaseBuffer: releasing slot %d", slot); mCore->mDequeueCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } // Autolock scope // Call back without lock held Loading Loading @@ -633,7 +639,7 @@ status_t BufferQueueConsumer::setMaxAcquiredBufferCount( BQ_LOGV("setMaxAcquiredBufferCount: %d", maxAcquiredBuffers); mCore->mMaxAcquiredBufferCount = maxAcquiredBuffers; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading
libs/gui/BufferQueueCore.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,12 @@ #define EGL_EGLEXT_PROTOTYPES #if DEBUG_ONLY_CODE #define VALIDATE_CONSISTENCY() do { validateConsistencyLocked(); } while (0) #else #define VALIDATE_CONSISTENCY() #endif #include <inttypes.h> #include <gui/BufferItem.h> Loading Loading @@ -216,7 +222,7 @@ void BufferQueueCore::freeAllBuffersLocked() { b.mIsStale = true; } validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } bool BufferQueueCore::adjustAvailableSlotsLocked(int delta) { Loading Loading @@ -258,6 +264,7 @@ void BufferQueueCore::waitWhileAllocatingLocked() const { } } #if DEBUG_ONLY_CODE void BufferQueueCore::validateConsistencyLocked() const { static const useconds_t PAUSE_TIME = 0; int allocatedSlots = 0; Loading Loading @@ -382,5 +389,6 @@ void BufferQueueCore::validateConsistencyLocked() const { mUnusedSlots.size()); } } #endif } // namespace android
libs/gui/BufferQueueProducer.cpp +18 −11 Original line number Diff line number Diff line Loading @@ -20,6 +20,12 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 #if DEBUG_ONLY_CODE #define VALIDATE_CONSISTENCY() do { mCore->validateConsistencyLocked(); } while (0) #else #define VALIDATE_CONSISTENCY() #endif #define EGL_EGLEXT_PROTOTYPES #include <gui/BufferItem.h> Loading Loading @@ -140,7 +146,7 @@ status_t BufferQueueProducer::setMaxDequeuedBufferCount( return BAD_VALUE; } mCore->mMaxDequeuedBufferCount = maxDequeuedBuffers; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); mCore->mDequeueCondition.broadcast(); listener = mCore->mConsumerListener; } // Autolock scope Loading Loading @@ -189,7 +195,7 @@ status_t BufferQueueProducer::setAsyncMode(bool async) { return BAD_VALUE; } mCore->mAsyncMode = async; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); mCore->mDequeueCondition.broadcast(); listener = mCore->mConsumerListener; } // Autolock scope Loading Loading @@ -495,7 +501,7 @@ status_t BufferQueueProducer::dequeueBuffer(int *outSlot, return NO_INIT; } mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } // Autolock scope } Loading Loading @@ -566,7 +572,7 @@ status_t BufferQueueProducer::detachBuffer(int slot) { mCore->mFreeSlots.insert(slot); mCore->clearBufferSlotLocked(slot); mCore->mDequeueCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -616,7 +622,7 @@ status_t BufferQueueProducer::detachNextBuffer(sp<GraphicBuffer>* outBuffer, *outBuffer = mSlots[found].mGraphicBuffer; *outFence = mSlots[found].mFence; mCore->clearBufferSlotLocked(found); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -684,7 +690,7 @@ status_t BufferQueueProducer::attachBuffer(int* outSlot, mSlots[*outSlot].mRequestBufferCalled = true; mSlots[*outSlot].mAcquireCalled = false; mCore->mActiveBuffers.insert(found); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return returnFlags; } Loading Loading @@ -861,7 +867,7 @@ status_t BufferQueueProducer::queueBuffer(int slot, // Take a ticket for the callback functions callbackTicket = mNextCallbackTicket++; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } // Autolock scope // Don't send the GraphicBuffer through the callback, and don't send Loading Loading @@ -948,7 +954,7 @@ status_t BufferQueueProducer::cancelBuffer(int slot, const sp<Fence>& fence) { mSlots[slot].mFence = fence; mCore->mDequeueCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading Loading @@ -1087,7 +1093,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, } mCore->mAllowAllocation = true; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return status; } Loading Loading @@ -1252,7 +1258,7 @@ void BufferQueueProducer::allocateBuffers(uint32_t width, uint32_t height, mCore->mIsAllocating = false; mCore->mIsAllocatingCondition.broadcast(); mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); } // Autolock scope } } Loading Loading @@ -1316,7 +1322,8 @@ status_t BufferQueueProducer::setDequeueTimeout(nsecs_t timeout) { mDequeueTimeout = timeout; mCore->mDequeueBufferCannotBlock = false; mCore->validateConsistencyLocked(); VALIDATE_CONSISTENCY(); return NO_ERROR; } Loading