Lines Matching refs:slot
58 status_t BufferQueueProducer::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
60 BQ_LOGV("requestBuffer: slot %d", slot);
73 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
74 BQ_LOGE("requestBuffer: slot index %d out of range [0, %d)",
75 slot, BufferQueueDefs::NUM_BUFFER_SLOTS);
77 } else if (!mSlots[slot].mBufferState.isDequeued()) {
78 BQ_LOGE("requestBuffer: slot %d is not owned by the producer "
79 "(state = %s)", slot, mSlots[slot].mBufferState.string());
83 mSlots[slot].mRequestBufferCalled = true;
84 *buf = mSlots[slot].mGraphicBuffer;
227 int slot = mCore->mFreeBuffers.front();
229 return slot;
236 int slot = *(mCore->mFreeSlots.begin());
237 mCore->mFreeSlots.erase(slot);
238 return slot;
294 int slot = getFreeBufferLocked();
295 if (slot != BufferQueueCore::INVALID_BUFFER_SLOT) {
296 *found = slot;
302 int slot = getFreeSlotLocked();
303 if (slot != BufferQueueCore::INVALID_BUFFER_SLOT) {
304 *found = slot;
409 // waitForFreeSlotThenRelock must have returned a slot containing a
472 "slot=%d w=%d h=%d format=%u",
486 // If shared buffer mode has just been enabled, cache the slot of the
497 BQ_LOGV("dequeueBuffer: allocating a new buffer for slot %d", *outSlot);
544 BQ_LOGV("dequeueBuffer: returning slot=%d/%" PRIu64 " buf=%p flags=%#x",
552 status_t BufferQueueProducer::detachBuffer(int slot) {
554 ATRACE_BUFFER_INDEX(slot);
555 BQ_LOGV("detachBuffer: slot %d", slot);
571 if (mCore->mSharedBufferMode || mCore->mSharedBufferSlot == slot) {
576 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
577 BQ_LOGE("detachBuffer: slot index %d out of range [0, %d)",
578 slot, BufferQueueDefs::NUM_BUFFER_SLOTS);
580 } else if (!mSlots[slot].mBufferState.isDequeued()) {
581 BQ_LOGE("detachBuffer: slot %d is not owned by the producer "
582 "(state = %s)", slot, mSlots[slot].mBufferState.string());
584 } else if (!mSlots[slot].mRequestBufferCalled) {
585 BQ_LOGE("detachBuffer: buffer in slot %d has not been requested",
586 slot);
590 mSlots[slot].mBufferState.detachProducer();
591 mCore->mActiveBuffers.erase(slot);
592 mCore->mFreeSlots.insert(slot);
593 mCore->clearBufferSlotLocked(slot);
646 BQ_LOGV("detachNextBuffer detached slot %d", found);
709 BQ_LOGV("attachBuffer: returning slot %d flags=%#x",
724 status_t BufferQueueProducer::queueBuffer(int slot,
727 ATRACE_BUFFER_INDEX(slot);
774 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
775 BQ_LOGE("queueBuffer: slot index %d out of range [0, %d)",
776 slot, BufferQueueDefs::NUM_BUFFER_SLOTS);
778 } else if (!mSlots[slot].mBufferState.isDequeued()) {
779 BQ_LOGE("queueBuffer: slot %d is not owned by the producer "
780 "(state = %s)", slot, mSlots[slot].mBufferState.string());
782 } else if (!mSlots[slot].mRequestBufferCalled) {
783 BQ_LOGE("queueBuffer: slot %d was queued without requesting "
784 "a buffer", slot);
788 // If shared buffer mode has just been enabled, cache the slot of the
792 mCore->mSharedBufferSlot = slot;
793 mSlots[slot].mBufferState.mShared = true;
796 BQ_LOGV("queueBuffer: slot=%d/%" PRIu64 " time=%" PRIu64 " dataSpace=%d"
798 slot, mCore->mFrameCounter + 1, timestamp, dataSpace,
802 const sp<GraphicBuffer>& graphicBuffer(mSlots[slot].mGraphicBuffer);
808 "buffer in slot %d", slot);
817 mSlots[slot].mFence = fence;
818 mSlots[slot].mBufferState.queue();
821 mSlots[slot].mFrameNumber = mCore->mFrameCounter;
823 item.mAcquireCalled = mSlots[slot].mAcquireCalled;
824 item.mGraphicBuffer = mSlots[slot].mGraphicBuffer;
835 item.mSlot = slot;
839 (mCore->mSharedBufferMode && mCore->mSharedBufferSlot == slot);
895 mCore->mLastQueuedSlot = slot;
910 // the slot number, since the consumer shouldn't need it
946 status_t BufferQueueProducer::cancelBuffer(int slot, const sp<Fence>& fence) {
948 BQ_LOGV("cancelBuffer: slot %d", slot);
966 if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) {
967 BQ_LOGE("cancelBuffer: slot index %d out of range [0, %d)",
968 slot, BufferQueueDefs::NUM_BUFFER_SLOTS);
970 } else if (!mSlots[slot].mBufferState.isDequeued()) {
971 BQ_LOGE("cancelBuffer: slot %d is not owned by the producer "
972 "(state = %s)", slot, mSlots[slot].mBufferState.string());
979 mSlots[slot].mBufferState.cancel();
983 if (!mCore->mSharedBufferMode && mSlots[slot].mBufferState.isFree()) {
984 mSlots[slot].mBufferState.mShared = false;
988 if (!mSlots[slot].mBufferState.isShared()) {
989 mCore->mActiveBuffers.erase(slot);
990 mCore->mFreeBuffers.push_back(slot);
993 mSlots[slot].mFence = fence;
1288 BQ_LOGV("allocateBuffers: a slot was occupied while "
1292 auto slot = mCore->mFreeSlots.begin();
1293 mCore->clearBufferSlotLocked(*slot); // Clean up the slot first
1294 mSlots[*slot].mGraphicBuffer = buffers[i];
1295 mSlots[*slot].mFence = Fence::NO_FENCE;
1297 // freeBufferLocked puts this slot on the free slots list. Since
1298 // we then attached a buffer, move the slot to free buffer list.
1299 mCore->mFreeBuffers.push_front(*slot);
1301 BQ_LOGV("allocateBuffers: allocated a new buffer in slot %d",
1302 *slot);
1304 // Make sure the erase is done after all uses of the slot
1306 mCore->mFreeSlots.erase(slot);