From 9e314337cdc65b1fbf52060e9a6a4ddf2215c352 Mon Sep 17 00:00:00 2001 From: Pablo Ceballos Date: Tue, 12 Jan 2016 13:49:19 -0800 Subject: BQ: Conditionally compile validateConsistencyLocked - Only enable it on userdebug and eng builds so that it won't slow down user builds. Change-Id: I70933a23d54657fdf5cbc23873da4fbee84b9a26 --- libs/gui/BufferQueueConsumer.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'libs/gui/BufferQueueConsumer.cpp') diff --git a/libs/gui/BufferQueueConsumer.cpp b/libs/gui/BufferQueueConsumer.cpp index d182f6b788..9c1bbe4211 100644 --- a/libs/gui/BufferQueueConsumer.cpp +++ b/libs/gui/BufferQueueConsumer.cpp @@ -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 #include #include @@ -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) { @@ -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; } @@ -386,7 +392,7 @@ status_t BufferQueueConsumer::attachBuffer(int* outSlot, // for attached buffers. mSlots[*outSlot].mAcquireCalled = false; - mCore->validateConsistencyLocked(); + VALIDATE_CONSISTENCY(); return NO_ERROR; } @@ -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 @@ -633,7 +639,7 @@ status_t BufferQueueConsumer::setMaxAcquiredBufferCount( BQ_LOGV("setMaxAcquiredBufferCount: %d", maxAcquiredBuffers); mCore->mMaxAcquiredBufferCount = maxAcquiredBuffers; - mCore->validateConsistencyLocked(); + VALIDATE_CONSISTENCY(); return NO_ERROR; } -- cgit v1.2.3-59-g8ed1b