Lines Matching refs:mCore
24 #define VALIDATE_CONSISTENCY() do { mCore->validateConsistencyLocked(); } while (0)
53 mCore->mUniqueId, mCore->mConnectedApi, mCore->mConnectedPid, (mCore->mUniqueId) >> 32, \
57 mCore->mUniqueId, mCore->mConnectedApi, mCore->mConnectedPid, (mCore->mUniqueId) >> 32, \
61 mCore->mUniqueId, mCore->mConnectedApi, mCore->mConnectedPid, (mCore->mUniqueId) >> 32, \
65 mCore->mUniqueId, mCore->mConnectedApi, mCore->mConnectedPid, (mCore->mUniqueId) >> 32, \
69 mCore->mUniqueId, mCore->mConnectedApi, mCore->mConnectedPid, (mCore->mUniqueId) >> 32, \
77 mCore(core), in BufferQueueProducer()
96 std::lock_guard<std::mutex> lock(mCore->mMutex); in requestBuffer()
98 if (mCore->mIsAbandoned) { in requestBuffer()
103 if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in requestBuffer()
137 std::unique_lock<std::mutex> lock(mCore->mMutex); in setMaxDequeuedBufferCount()
138 mCore->waitWhileAllocatingLocked(lock); in setMaxDequeuedBufferCount()
140 if (mCore->mIsAbandoned) { in setMaxDequeuedBufferCount()
146 *maxBufferCount = mCore->getMaxBufferCountLocked(); in setMaxDequeuedBufferCount()
148 if (maxDequeuedBuffers == mCore->mMaxDequeuedBufferCount) { in setMaxDequeuedBufferCount()
155 for (int s : mCore->mActiveBuffers) { in setMaxDequeuedBufferCount()
167 int bufferCount = mCore->getMinUndequeuedBufferCountLocked(); in setMaxDequeuedBufferCount()
176 const int minBufferSlots = mCore->getMinMaxBufferCountLocked(); in setMaxDequeuedBufferCount()
183 if (bufferCount > mCore->mMaxBufferCount) { in setMaxDequeuedBufferCount()
187 mCore->mMaxBufferCount, mCore->mMaxAcquiredBufferCount, in setMaxDequeuedBufferCount()
188 mCore->mAsyncMode, mCore->mDequeueBufferCannotBlock); in setMaxDequeuedBufferCount()
192 int delta = maxDequeuedBuffers - mCore->mMaxDequeuedBufferCount; in setMaxDequeuedBufferCount()
193 if (!mCore->adjustAvailableSlotsLocked(delta)) { in setMaxDequeuedBufferCount()
196 mCore->mMaxDequeuedBufferCount = maxDequeuedBuffers; in setMaxDequeuedBufferCount()
197 *maxBufferCount = mCore->getMaxBufferCountLocked(); in setMaxDequeuedBufferCount()
200 listener = mCore->mConsumerListener; in setMaxDequeuedBufferCount()
202 mCore->mDequeueCondition.notify_all(); in setMaxDequeuedBufferCount()
219 std::unique_lock<std::mutex> lock(mCore->mMutex); in setAsyncMode()
220 mCore->waitWhileAllocatingLocked(lock); in setAsyncMode()
222 if (mCore->mIsAbandoned) { in setAsyncMode()
227 if (async == mCore->mAsyncMode) { in setAsyncMode()
231 if ((mCore->mMaxAcquiredBufferCount + mCore->mMaxDequeuedBufferCount + in setAsyncMode()
232 (async || mCore->mDequeueBufferCannotBlock ? 1 : 0)) > in setAsyncMode()
233 mCore->mMaxBufferCount) { in setAsyncMode()
237 mCore->mMaxBufferCount, mCore->mMaxAcquiredBufferCount, in setAsyncMode()
238 mCore->mMaxDequeuedBufferCount, in setAsyncMode()
239 mCore->mDequeueBufferCannotBlock); in setAsyncMode()
243 int delta = mCore->getMaxBufferCountLocked(async, in setAsyncMode()
244 mCore->mDequeueBufferCannotBlock, mCore->mMaxBufferCount) in setAsyncMode()
245 - mCore->getMaxBufferCountLocked(); in setAsyncMode()
247 if (!mCore->adjustAvailableSlotsLocked(delta)) { in setAsyncMode()
252 mCore->mAsyncMode = async; in setAsyncMode()
254 mCore->mDequeueCondition.notify_all(); in setAsyncMode()
256 listener = mCore->mConsumerListener; in setAsyncMode()
268 if (mCore->mFreeBuffers.empty()) { in getFreeBufferLocked()
271 int slot = mCore->mFreeBuffers.front(); in getFreeBufferLocked()
272 mCore->mFreeBuffers.pop_front(); in getFreeBufferLocked()
277 if (mCore->mFreeSlots.empty()) { in getFreeSlotLocked()
280 int slot = *(mCore->mFreeSlots.begin()); in getFreeSlotLocked()
281 mCore->mFreeSlots.erase(slot); in getFreeSlotLocked()
291 if (mCore->mIsAbandoned) { in waitForFreeSlotThenRelock()
298 for (int s : mCore->mActiveBuffers) { in waitForFreeSlotThenRelock()
310 if (mCore->mBufferHasBeenQueued && in waitForFreeSlotThenRelock()
311 dequeuedCount >= mCore->mMaxDequeuedBufferCount) { in waitForFreeSlotThenRelock()
316 mCore->mMaxDequeuedBufferCount); in waitForFreeSlotThenRelock()
327 const int maxBufferCount = mCore->getMaxBufferCountLocked(); in waitForFreeSlotThenRelock()
328 bool tooManyBuffers = mCore->mQueue.size() in waitForFreeSlotThenRelock()
332 mCore->mQueue.size()); in waitForFreeSlotThenRelock()
336 if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot != in waitForFreeSlotThenRelock()
338 *found = mCore->mSharedBufferSlot; in waitForFreeSlotThenRelock()
345 } else if (mCore->mAllowAllocation) { in waitForFreeSlotThenRelock()
372 if ((mCore->mDequeueBufferCannotBlock || mCore->mAsyncMode) && in waitForFreeSlotThenRelock()
373 (acquiredCount <= mCore->mMaxAcquiredBufferCount)) { in waitForFreeSlotThenRelock()
377 std::cv_status result = mCore->mDequeueCondition.wait_for(lock, in waitForFreeSlotThenRelock()
383 mCore->mDequeueCondition.wait(lock); in waitForFreeSlotThenRelock()
397 std::lock_guard<std::mutex> lock(mCore->mMutex); in dequeueBuffer()
398 mConsumerName = mCore->mConsumerName; in dequeueBuffer()
400 if (mCore->mIsAbandoned) { in dequeueBuffer()
405 if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in dequeueBuffer()
432 std::unique_lock<std::mutex> lock(mCore->mMutex); in dequeueBuffer()
436 if (mCore->mFreeBuffers.empty() && mCore->mIsAllocating) { in dequeueBuffer()
438 mCore->waitWhileAllocatingLocked(lock); in dequeueBuffer()
444 format = mCore->mDefaultBufferFormat; in dequeueBuffer()
448 usage |= mCore->mConsumerUsageBits; in dequeueBuffer()
452 width = mCore->mDefaultWidth; in dequeueBuffer()
453 height = mCore->mDefaultHeight; in dequeueBuffer()
454 if (mCore->mAutoPrerotation && in dequeueBuffer()
455 (mCore->mTransformHintInUse & NATIVE_WINDOW_TRANSFORM_ROT_90)) { in dequeueBuffer()
479 if (!mCore->mAllowAllocation) { in dequeueBuffer()
481 if (mCore->mSharedBufferSlot == found) { in dequeueBuffer()
485 mCore->mFreeSlots.insert(found); in dequeueBuffer()
486 mCore->clearBufferSlotLocked(found); in dequeueBuffer()
500 mCore->mAdditionalOptionsGenerationId; in dequeueBuffer()
503 if (mCore->mSharedBufferSlot == found && needsReallocation) { in dequeueBuffer()
508 if (mCore->mSharedBufferSlot != found) { in dequeueBuffer()
509 mCore->mActiveBuffers.insert(found); in dequeueBuffer()
540 mCore->mBufferAge = 0; in dequeueBuffer()
541 mCore->mIsAllocating = true; in dequeueBuffer()
543 allocOptions = mCore->mAdditionalOptions; in dequeueBuffer()
544 allocOptionsGenId = mCore->mAdditionalOptionsGenerationId; in dequeueBuffer()
551 mCore->mBufferAge = mCore->mFrameCounter + 1 - mSlots[found].mFrameNumber; in dequeueBuffer()
555 mCore->mBufferAge); in dequeueBuffer()
567 *outFence = (mCore->mSharedBufferMode && in dequeueBuffer()
568 mCore->mSharedBufferSlot == found) ? in dequeueBuffer()
575 if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot == in dequeueBuffer()
577 mCore->mSharedBufferSlot = found; in dequeueBuffer()
586 listener = mCore->mConsumerListener; in dequeueBuffer()
618 std::lock_guard<std::mutex> lock(mCore->mMutex); in dequeueBuffer()
620 if (error == NO_ERROR && !mCore->mIsAbandoned) { in dequeueBuffer()
621 graphicBuffer->setGenerationNumber(mCore->mGenerationNumber); in dequeueBuffer()
630 mCore->mIsAllocating = false; in dequeueBuffer()
631 mCore->mIsAllocatingCondition.notify_all(); in dequeueBuffer()
634 mCore->mFreeSlots.insert(*outSlot); in dequeueBuffer()
635 mCore->clearBufferSlotLocked(*outSlot); in dequeueBuffer()
640 if (mCore->mIsAbandoned) { in dequeueBuffer()
641 mCore->mFreeSlots.insert(*outSlot); in dequeueBuffer()
642 mCore->clearBufferSlotLocked(*outSlot); in dequeueBuffer()
681 *outBufferAge = mCore->mBufferAge; in dequeueBuffer()
697 std::lock_guard<std::mutex> lock(mCore->mMutex); in detachBuffer()
699 if (mCore->mIsAbandoned) { in detachBuffer()
704 if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in detachBuffer()
709 if (mCore->mSharedBufferMode || mCore->mSharedBufferSlot == slot) { in detachBuffer()
731 listener = mCore->mConsumerListener; in detachBuffer()
738 mCore->mActiveBuffers.erase(slot); in detachBuffer()
739 mCore->mFreeSlots.insert(slot); in detachBuffer()
740 mCore->clearBufferSlotLocked(slot); in detachBuffer()
741 mCore->mDequeueCondition.notify_all(); in detachBuffer()
770 std::unique_lock<std::mutex> lock(mCore->mMutex); in detachNextBuffer()
772 if (mCore->mIsAbandoned) { in detachNextBuffer()
777 if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in detachNextBuffer()
782 if (mCore->mSharedBufferMode) { in detachNextBuffer()
788 mCore->waitWhileAllocatingLocked(lock); in detachNextBuffer()
790 if (mCore->mFreeBuffers.empty()) { in detachNextBuffer()
794 int found = mCore->mFreeBuffers.front(); in detachNextBuffer()
795 mCore->mFreeBuffers.remove(found); in detachNextBuffer()
796 mCore->mFreeSlots.insert(found); in detachNextBuffer()
802 mCore->clearBufferSlotLocked(found); in detachNextBuffer()
804 listener = mCore->mConsumerListener; in detachNextBuffer()
826 std::unique_lock<std::mutex> lock(mCore->mMutex); in attachBuffer()
828 if (mCore->mIsAbandoned) { in attachBuffer()
833 if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in attachBuffer()
838 if (mCore->mSharedBufferMode) { in attachBuffer()
843 if (buffer->getGenerationNumber() != mCore->mGenerationNumber) { in attachBuffer()
846 mCore->mGenerationNumber); in attachBuffer()
850 mCore->waitWhileAllocatingLocked(lock); in attachBuffer()
877 mCore->mActiveBuffers.insert(found); in attachBuffer()
930 std::lock_guard<std::mutex> lock(mCore->mMutex); in queueBuffer()
932 if (mCore->mIsAbandoned) { in queueBuffer()
937 if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in queueBuffer()
958 if (mCore->mSharedBufferMode && mCore->mSharedBufferSlot == in queueBuffer()
960 mCore->mSharedBufferSlot = slot; in queueBuffer()
966 slot, mCore->mFrameCounter + 1, requestedPresentTimestamp, dataSpace, in queueBuffer()
983 dataSpace = mCore->mDefaultBufferDataSpace; in queueBuffer()
991 ++mCore->mFrameCounter; in queueBuffer()
992 currentFrameNumber = mCore->mFrameCounter; in queueBuffer()
1011 item.mIsDroppable = mCore->mAsyncMode || in queueBuffer()
1012 (mConsumerIsSurfaceFlinger && mCore->mQueueBufferCanDrop) || in queueBuffer()
1013 (mCore->mLegacyBufferDrop && mCore->mQueueBufferCanDrop) || in queueBuffer()
1014 (mCore->mSharedBufferMode && mCore->mSharedBufferSlot == slot); in queueBuffer()
1017 item.mAutoRefresh = mCore->mSharedBufferMode && mCore->mAutoRefresh; in queueBuffer()
1018 item.mApi = mCore->mConnectedApi; in queueBuffer()
1023 if (mCore->mSharedBufferMode) { in queueBuffer()
1024 mCore->mSharedBufferCache.crop = crop; in queueBuffer()
1025 mCore->mSharedBufferCache.transform = transform; in queueBuffer()
1026 mCore->mSharedBufferCache.scalingMode = static_cast<uint32_t>( in queueBuffer()
1028 mCore->mSharedBufferCache.dataspace = dataSpace; in queueBuffer()
1032 if (mCore->mQueue.empty()) { in queueBuffer()
1035 mCore->mQueue.push_back(item); in queueBuffer()
1036 frameAvailableListener = mCore->mConsumerListener; in queueBuffer()
1040 const BufferItem& last = mCore->mQueue.itemAt( in queueBuffer()
1041 mCore->mQueue.size() - 1); in queueBuffer()
1050 if (!mCore->mSharedBufferMode && in queueBuffer()
1056 mCore->mActiveBuffers.erase(last.mSlot); in queueBuffer()
1057 mCore->mFreeBuffers.push_back(last.mSlot); in queueBuffer()
1072 mCore->mQueue.editItemAt(mCore->mQueue.size() - 1) = item; in queueBuffer()
1073 frameReplacedListener = mCore->mConsumerListener; in queueBuffer()
1075 mCore->mQueue.push_back(item); in queueBuffer()
1076 frameAvailableListener = mCore->mConsumerListener; in queueBuffer()
1080 mCore->mBufferHasBeenQueued = true; in queueBuffer()
1081 mCore->mDequeueCondition.notify_all(); in queueBuffer()
1082 mCore->mLastQueuedSlot = slot; in queueBuffer()
1084 output->width = mCore->mDefaultWidth; in queueBuffer()
1085 output->height = mCore->mDefaultHeight; in queueBuffer()
1086 output->transformHint = mCore->mTransformHintInUse = mCore->mTransformHint; in queueBuffer()
1087 output->numPendingBuffers = static_cast<uint32_t>(mCore->mQueue.size()); in queueBuffer()
1088 output->nextFrameNumber = mCore->mFrameCounter + 1; in queueBuffer()
1090 ATRACE_INT(mCore->mConsumerName.c_str(), static_cast<int32_t>(mCore->mQueue.size())); in queueBuffer()
1092 mCore->mOccupancyTracker.registerOccupancyChange(mCore->mQueue.size()); in queueBuffer()
1099 connectedApi = mCore->mConnectedApi; in queueBuffer()
1163 std::lock_guard<std::mutex> lock(mCore->mMutex); in cancelBuffer()
1165 if (mCore->mIsAbandoned) { in cancelBuffer()
1170 if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in cancelBuffer()
1175 if (mCore->mSharedBufferMode) { in cancelBuffer()
1198 if (!mCore->mSharedBufferMode && mSlots[slot].mBufferState.isFree()) { in cancelBuffer()
1204 mCore->mActiveBuffers.erase(slot); in cancelBuffer()
1205 mCore->mFreeBuffers.push_back(slot); in cancelBuffer()
1214 mCore->mDequeueCondition.notify_all(); in cancelBuffer()
1215 listener = mCore->mConsumerListener; in cancelBuffer()
1228 std::lock_guard<std::mutex> lock(mCore->mMutex); in query()
1235 if (mCore->mIsAbandoned) { in query()
1243 value = static_cast<int32_t>(mCore->mDefaultWidth); in query()
1246 value = static_cast<int32_t>(mCore->mDefaultHeight); in query()
1249 value = static_cast<int32_t>(mCore->mDefaultBufferFormat); in query()
1256 value = mCore->getMinUndequeuedBufferCountLocked(); in query()
1262 value = (mCore->mQueue.size() > 1); in query()
1266 value = static_cast<int32_t>(mCore->mConsumerUsageBits); in query()
1269 value = static_cast<int32_t>(mCore->mDefaultBufferDataSpace); in query()
1272 if (mCore->mBufferAge > INT32_MAX) { in query()
1275 value = static_cast<int32_t>(mCore->mBufferAge); in query()
1279 value = static_cast<int32_t>(mCore->mConsumerIsProtected); in query()
1293 std::lock_guard<std::mutex> lock(mCore->mMutex); in connect()
1294 mConsumerName = mCore->mConsumerName; in connect()
1298 if (mCore->mIsAbandoned) { in connect()
1303 if (mCore->mConsumerListener == nullptr) { in connect()
1313 if (mCore->mConnectedApi != BufferQueueCore::NO_CONNECTED_API) { in connect()
1315 mCore->mConnectedApi, api); in connect()
1319 int delta = mCore->getMaxBufferCountLocked(mCore->mAsyncMode, in connect()
1321 mCore->mConsumerControlledByApp && producerControlledByApp : false, in connect()
1322 mCore->mMaxBufferCount) - in connect()
1323 mCore->getMaxBufferCountLocked(); in connect()
1324 if (!mCore->adjustAvailableSlotsLocked(delta)) { in connect()
1336 mCore->mConnectedApi = api; in connect()
1338 output->width = mCore->mDefaultWidth; in connect()
1339 output->height = mCore->mDefaultHeight; in connect()
1340 output->transformHint = mCore->mTransformHintInUse = mCore->mTransformHint; in connect()
1342 static_cast<uint32_t>(mCore->mQueue.size()); in connect()
1343 output->nextFrameNumber = mCore->mFrameCounter + 1; in connect()
1345 output->maxBufferCount = mCore->mMaxBufferCount; in connect()
1358 mCore->mLinkedToDeath = listener; in connect()
1361 mCore->mConnectedProducerListener = listener; in connect()
1362 mCore->mBufferReleasedCbEnabled = listener->needsReleaseNotify(); in connect()
1370 mCore->mConnectedPid = BufferQueueThreadState::getCallingPid(); in connect()
1371 mCore->mBufferHasBeenQueued = false; in connect()
1372 mCore->mDequeueBufferCannotBlock = false; in connect()
1373 mCore->mQueueBufferCanDrop = false; in connect()
1374 mCore->mLegacyBufferDrop = true; in connect()
1375 if (mCore->mConsumerControlledByApp && producerControlledByApp) { in connect()
1376 mCore->mDequeueBufferCannotBlock = mDequeueTimeout < 0; in connect()
1377 mCore->mQueueBufferCanDrop = mDequeueTimeout <= 0; in connect()
1380 mCore->mAllowAllocation = true; in connect()
1382 mCore->mAdditionalOptions.clear(); in connect()
1395 std::unique_lock<std::mutex> lock(mCore->mMutex); in disconnect()
1398 if (BufferQueueThreadState::getCallingPid() != mCore->mConnectedPid) { in disconnect()
1404 mCore->waitWhileAllocatingLocked(lock); in disconnect()
1406 if (mCore->mIsAbandoned) { in disconnect()
1413 if (mCore->mConnectedApi == NATIVE_WINDOW_API_MEDIA) { in disconnect()
1416 api = mCore->mConnectedApi; in disconnect()
1429 if (mCore->mConnectedApi == api) { in disconnect()
1430 mCore->freeAllBuffersLocked(); in disconnect()
1434 if (mCore->mLinkedToDeath != nullptr) { in disconnect()
1436 IInterface::asBinder(mCore->mLinkedToDeath); in disconnect()
1443 mCore->mSharedBufferSlot = in disconnect()
1445 mCore->mLinkedToDeath = nullptr; in disconnect()
1446 mCore->mConnectedProducerListener = nullptr; in disconnect()
1447 mCore->mConnectedApi = BufferQueueCore::NO_CONNECTED_API; in disconnect()
1448 mCore->mConnectedPid = -1; in disconnect()
1449 mCore->mSidebandStream.clear(); in disconnect()
1450 mCore->mDequeueCondition.notify_all(); in disconnect()
1451 mCore->mAutoPrerotation = false; in disconnect()
1453 mCore->mAdditionalOptions.clear(); in disconnect()
1455 listener = mCore->mConsumerListener; in disconnect()
1456 } else if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in disconnect()
1461 "(cur=%d req=%d)", mCore->mConnectedApi, api); in disconnect()
1484 std::lock_guard<std::mutex> _l(mCore->mMutex); in setSidebandStream()
1485 mCore->mSidebandStream = stream; in setSidebandStream()
1486 listener = mCore->mConsumerListener; in setSidebandStream()
1512 std::unique_lock<std::mutex> lock(mCore->mMutex); in allocateBuffers()
1513 mCore->waitWhileAllocatingLocked(lock); in allocateBuffers()
1515 if (!mCore->mAllowAllocation) { in allocateBuffers()
1523 newBufferCount = mCore->mFreeSlots.empty() ? 0 : 1; in allocateBuffers()
1528 allocWidth = width > 0 ? width : mCore->mDefaultWidth; in allocateBuffers()
1529 allocHeight = height > 0 ? height : mCore->mDefaultHeight; in allocateBuffers()
1530 if (useDefaultSize && mCore->mAutoPrerotation && in allocateBuffers()
1531 (mCore->mTransformHintInUse & NATIVE_WINDOW_TRANSFORM_ROT_90)) { in allocateBuffers()
1535 allocFormat = format != 0 ? format : mCore->mDefaultBufferFormat; in allocateBuffers()
1536 allocUsage = usage | mCore->mConsumerUsageBits; in allocateBuffers()
1537 allocName.assign(mCore->mConsumerName.c_str(), mCore->mConsumerName.size()); in allocateBuffers()
1540 allocOptions = mCore->mAdditionalOptions; in allocateBuffers()
1541 allocOptionsGenId = mCore->mAdditionalOptionsGenerationId; in allocateBuffers()
1544 mCore->mIsAllocating = true; in allocateBuffers()
1581 std::lock_guard<std::mutex> lock(mCore->mMutex); in allocateBuffers()
1582 mCore->mIsAllocating = false; in allocateBuffers()
1583 mCore->mIsAllocatingCondition.notify_all(); in allocateBuffers()
1590 std::unique_lock<std::mutex> lock(mCore->mMutex); in allocateBuffers()
1591 uint32_t checkWidth = width > 0 ? width : mCore->mDefaultWidth; in allocateBuffers()
1592 uint32_t checkHeight = height > 0 ? height : mCore->mDefaultHeight; in allocateBuffers()
1593 if (useDefaultSize && mCore->mAutoPrerotation && in allocateBuffers()
1594 (mCore->mTransformHintInUse & NATIVE_WINDOW_TRANSFORM_ROT_90)) { in allocateBuffers()
1599 format : mCore->mDefaultBufferFormat; in allocateBuffers()
1600 uint64_t checkUsage = usage | mCore->mConsumerUsageBits; in allocateBuffers()
1603 allocOptionsChanged = allocOptionsGenId != mCore->mAdditionalOptionsGenerationId; in allocateBuffers()
1609 mCore->mIsAllocating = false; in allocateBuffers()
1610 mCore->mIsAllocatingCondition.notify_all(); in allocateBuffers()
1615 if (mCore->mFreeSlots.empty()) { in allocateBuffers()
1620 auto slot = mCore->mFreeSlots.begin(); in allocateBuffers()
1621 mCore->clearBufferSlotLocked(*slot); // Clean up the slot first in allocateBuffers()
1630 mCore->mFreeBuffers.push_front(*slot); in allocateBuffers()
1637 mCore->mFreeSlots.erase(slot); in allocateBuffers()
1640 mCore->mIsAllocating = false; in allocateBuffers()
1641 mCore->mIsAllocatingCondition.notify_all(); in allocateBuffers()
1657 std::lock_guard<std::mutex> lock(mCore->mMutex); in allowAllocation()
1658 mCore->mAllowAllocation = allow; in allowAllocation()
1666 std::lock_guard<std::mutex> lock(mCore->mMutex); in setGenerationNumber()
1667 mCore->mGenerationNumber = generationNumber; in setGenerationNumber()
1673 std::lock_guard<std::mutex> lock(mCore->mMutex); in getConsumerName()
1682 std::lock_guard<std::mutex> lock(mCore->mMutex); in setSharedBufferMode()
1684 mCore->mSharedBufferSlot = BufferQueueCore::INVALID_BUFFER_SLOT; in setSharedBufferMode()
1686 mCore->mSharedBufferMode = sharedBufferMode; in setSharedBufferMode()
1694 std::lock_guard<std::mutex> lock(mCore->mMutex); in setAutoRefresh()
1696 mCore->mAutoRefresh = autoRefresh; in setAutoRefresh()
1704 std::lock_guard<std::mutex> lock(mCore->mMutex); in setDequeueTimeout()
1706 timeout >= 0 ? false : mCore->mDequeueBufferCannotBlock; in setDequeueTimeout()
1707 int delta = mCore->getMaxBufferCountLocked(mCore->mAsyncMode, dequeueBufferCannotBlock, in setDequeueTimeout()
1708 mCore->mMaxBufferCount) - mCore->getMaxBufferCountLocked(); in setDequeueTimeout()
1709 if (!mCore->adjustAvailableSlotsLocked(delta)) { in setDequeueTimeout()
1716 mCore->mDequeueBufferCannotBlock = dequeueBufferCannotBlock; in setDequeueTimeout()
1718 mCore->mQueueBufferCanDrop = false; in setDequeueTimeout()
1729 std::lock_guard<std::mutex> lock(mCore->mMutex); in setLegacyBufferDrop()
1730 mCore->mLegacyBufferDrop = drop; in setLegacyBufferDrop()
1738 std::lock_guard<std::mutex> lock(mCore->mMutex); in getLastQueuedBuffer()
1739 BQ_LOGV("getLastQueuedBuffer, slot=%d", mCore->mLastQueuedSlot); in getLastQueuedBuffer()
1741 if (mCore->mLastQueuedSlot == BufferItem::INVALID_BUFFER_SLOT) { in getLastQueuedBuffer()
1747 *outBuffer = mSlots[mCore->mLastQueuedSlot].mGraphicBuffer; in getLastQueuedBuffer()
1755 mSlots[mCore->mLastQueuedSlot].mGraphicBuffer, mLastQueuedCrop, in getLastQueuedBuffer()
1765 std::lock_guard<std::mutex> lock(mCore->mMutex); in getLastQueuedBuffer()
1766 BQ_LOGV("getLastQueuedBuffer, slot=%d", mCore->mLastQueuedSlot); in getLastQueuedBuffer()
1767 if (mCore->mLastQueuedSlot == BufferItem::INVALID_BUFFER_SLOT || in getLastQueuedBuffer()
1768 mSlots[mCore->mLastQueuedSlot].mBufferState.isDequeued()) { in getLastQueuedBuffer()
1774 *outBuffer = mSlots[mCore->mLastQueuedSlot].mGraphicBuffer; in getLastQueuedBuffer()
1797 std::lock_guard<std::mutex> lock(mCore->mMutex); in addAndGetFrameTimestamps()
1798 listener = mCore->mConsumerListener; in addAndGetFrameTimestamps()
1810 int api = mCore->mConnectedApi; in binderDied()
1817 *outId = mCore->mUniqueId; in getUniqueId()
1824 std::lock_guard<std::mutex> lock(mCore->mMutex); in getConsumerUsage()
1825 *outUsage = mCore->mConsumerUsageBits; in getConsumerUsage()
1833 std::lock_guard<std::mutex> lock(mCore->mMutex); in setAutoPrerotation()
1835 mCore->mAutoPrerotation = autoPrerotation; in setAutoPrerotation()
1852 std::lock_guard<std::mutex> lock(mCore->mMutex); in setFrameRate()
1853 listener = mCore->mConsumerListener; in setFrameRate()
1872 std::lock_guard<std::mutex> lock(mCore->mMutex); in setAdditionalOptions()
1874 if (mCore->mConnectedApi == BufferQueueCore::NO_CONNECTED_API) { in setAdditionalOptions()
1879 if (mCore->mAdditionalOptions != options) { in setAdditionalOptions()
1880 mCore->mAdditionalOptions = options; in setAdditionalOptions()
1881 mCore->mAdditionalOptionsGenerationId++; in setAdditionalOptions()