Lines Matching refs:slot

46 status_t BufferHubProducer::requestBuffer(int slot, sp<GraphicBuffer>* buf) {  in requestBuffer()  argument
47 ALOGV("requestBuffer: slot=%d", slot); in requestBuffer()
56 if (slot < 0 || slot >= max_buffer_count_) { in requestBuffer()
57 ALOGE("requestBuffer: slot index %d out of range [0, %d)", slot, max_buffer_count_); in requestBuffer()
59 } else if (!buffers_[slot].mBufferState.isDequeued()) { in requestBuffer()
60 ALOGE("requestBuffer: slot %d is not owned by the producer (state = %s)", slot, in requestBuffer()
61 buffers_[slot].mBufferState.string()); in requestBuffer()
63 } else if (buffers_[slot].mGraphicBuffer != nullptr) { in requestBuffer()
64 ALOGE("requestBuffer: slot %d is not empty.", slot); in requestBuffer()
66 } else if (buffers_[slot].mProducerBuffer == nullptr) { in requestBuffer()
67 ALOGE("requestBuffer: slot %d is not dequeued.", slot); in requestBuffer()
71 const auto& producer_buffer = buffers_[slot].mProducerBuffer; in requestBuffer()
74 buffers_[slot].mGraphicBuffer = graphic_buffer; in requestBuffer()
75 buffers_[slot].mRequestBufferCalled = true; in requestBuffer()
159 size_t slot = 0; in dequeueBuffer() local
164 auto buffer_status = queue_->Dequeue(dequeue_timeout_ms_, &slot, &fence); in dequeueBuffer()
181 width, height, format, slot, producer_buffer->width(), producer_buffer->height(), in dequeueBuffer()
185 buffers_[slot].mIsReallocating = true; in dequeueBuffer()
189 RemoveBuffer(slot); in dequeueBuffer()
204 LOG_ALWAYS_FATAL_IF((!buffers_[slot].mBufferState.isFree() && in dequeueBuffer()
205 !buffers_[slot].mBufferState.isQueued()), in dequeueBuffer()
206 "dequeueBuffer: slot %zu is not free or queued, actual state: %s.", slot, in dequeueBuffer()
207 buffers_[slot].mBufferState.string()); in dequeueBuffer()
209 buffers_[slot].mBufferState.freeQueued(); in dequeueBuffer()
210 buffers_[slot].mBufferState.dequeue(); in dequeueBuffer()
211 ALOGV("dequeueBuffer: slot=%zu", slot); in dequeueBuffer()
216 *out_slot = int(slot); in dequeueBuffer()
219 if (buffers_[slot].mIsReallocating) { in dequeueBuffer()
221 buffers_[slot].mIsReallocating = false; in dequeueBuffer()
227 status_t BufferHubProducer::detachBuffer(int slot) { in detachBuffer() argument
228 ALOGV("detachBuffer: slot=%d", slot); in detachBuffer()
231 return DetachBufferLocked(static_cast<size_t>(slot)); in detachBuffer()
234 status_t BufferHubProducer::DetachBufferLocked(size_t slot) { in DetachBufferLocked() argument
240 if (slot >= static_cast<size_t>(max_buffer_count_)) { in DetachBufferLocked()
241 ALOGE("detachBuffer: slot index %zu out of range [0, %d)", slot, max_buffer_count_); in DetachBufferLocked()
243 } else if (!buffers_[slot].mBufferState.isDequeued()) { in DetachBufferLocked()
244 ALOGE("detachBuffer: slot %zu is not owned by the producer (state = %s)", slot, in DetachBufferLocked()
245 buffers_[slot].mBufferState.string()); in DetachBufferLocked()
247 } else if (!buffers_[slot].mRequestBufferCalled) { in DetachBufferLocked()
248 ALOGE("detachBuffer: buffer in slot %zu has not been requested", slot); in DetachBufferLocked()
251 std::shared_ptr<ProducerBuffer> producer_buffer = queue_->GetBuffer(slot); in DetachBufferLocked()
253 ALOGE("detachBuffer: Invalid ProducerBuffer at slot %zu.", slot); in DetachBufferLocked()
258 ALOGE("detachBuffer: Invalid GraphicBuffer at slot %zu.", slot); in DetachBufferLocked()
263 status_t error = RemoveBuffer(slot); in DetachBufferLocked()
265 ALOGE("detachBuffer: Failed to remove buffer, slot=%zu, error=%d.", slot, error); in DetachBufferLocked()
273 ALOGE("detachBuffer: Failed to detach from a ProducerBuffer at slot %zu, error=%d.", slot, in DetachBufferLocked()
307 size_t slot = 0; in detachNextBuffer() local
312 auto status_or_buffer = queue_->Dequeue(/*timeout=*/0, &slot, &fence); in detachNextBuffer()
328 if (!buffers_[slot].mBufferState.isFree() && !buffers_[slot].mBufferState.isQueued()) { in detachNextBuffer()
329 ALOGE("detachNextBuffer: slot %zu is not free or queued, actual state: %s.", slot, in detachNextBuffer()
330 buffers_[slot].mBufferState.string()); in detachNextBuffer()
333 if (buffers_[slot].mProducerBuffer == nullptr) { in detachNextBuffer()
334 ALOGE("detachNextBuffer: ProducerBuffer at slot %zu is null.", slot); in detachNextBuffer()
337 if (buffers_[slot].mProducerBuffer->id() != producer_buffer->id()) { in detachNextBuffer()
340 slot, buffers_[slot].mProducerBuffer->id(), producer_buffer->id()); in detachNextBuffer()
344 ALOGV("detachNextBuffer: slot=%zu", slot); in detachNextBuffer()
345 buffers_[slot].mBufferState.freeQueued(); in detachNextBuffer()
346 buffers_[slot].mBufferState.dequeue(); in detachNextBuffer()
350 buffers_[slot].mGraphicBuffer = producer_buffer->buffer()->buffer(); in detachNextBuffer()
353 status_t error = DetachBufferLocked(slot); in detachNextBuffer()
396 status_t BufferHubProducer::queueBuffer(int slot, const QueueBufferInput& input, in queueBuffer() argument
398 ALOGV("queueBuffer: slot %d", slot); in queueBuffer()
440 if (slot < 0 || slot >= max_buffer_count_) { in queueBuffer()
441 ALOGE("queueBuffer: slot index %d out of range [0, %d)", slot, max_buffer_count_); in queueBuffer()
443 } else if (!buffers_[slot].mBufferState.isDequeued()) { in queueBuffer()
444 ALOGE("queueBuffer: slot %d is not owned by the producer (state = %s)", slot, in queueBuffer()
445 buffers_[slot].mBufferState.string()); in queueBuffer()
447 } else if ((!buffers_[slot].mRequestBufferCalled || buffers_[slot].mGraphicBuffer == nullptr)) { in queueBuffer()
450 slot, buffers_[slot].mRequestBufferCalled, buffers_[slot].mGraphicBuffer.get()); in queueBuffer()
455 const auto& producer_buffer = buffers_[slot].mProducerBuffer; in queueBuffer()
462 ALOGE("queueBuffer: slot %d has out-of-boundary crop.", slot); in queueBuffer()
480 buffers_[slot].mBufferState.queue(); in queueBuffer()
499 status_t BufferHubProducer::cancelBuffer(int slot, const sp<Fence>& fence) { in cancelBuffer() argument
509 if (slot < 0 || slot >= max_buffer_count_) { in cancelBuffer()
510 ALOGE("cancelBuffer: slot index %d out of range [0, %d)", slot, max_buffer_count_); in cancelBuffer()
512 } else if (!buffers_[slot].mBufferState.isDequeued()) { in cancelBuffer()
513 ALOGE("cancelBuffer: slot %d is not owned by the producer (state = %s)", slot, in cancelBuffer()
514 buffers_[slot].mBufferState.string()); in cancelBuffer()
521 auto producer_buffer = buffers_[slot].mProducerBuffer; in cancelBuffer()
522 queue_->Enqueue(producer_buffer, size_t(slot), 0U); in cancelBuffer()
523 buffers_[slot].mBufferState.cancel(); in cancelBuffer()
524 buffers_[slot].mFence = fence; in cancelBuffer()
525 ALOGV("cancelBuffer: slot %d", slot); in cancelBuffer()
792 size_t slot = status.get(); in AllocateBuffer() local
793 auto producer_buffer = queue_->GetBuffer(slot); in AllocateBuffer()
796 "Failed to get the producer buffer at slot: %zu", slot); in AllocateBuffer()
798 buffers_[slot].mProducerBuffer = producer_buffer; in AllocateBuffer()
803 status_t BufferHubProducer::RemoveBuffer(size_t slot) { in RemoveBuffer() argument
804 auto status = queue_->RemoveBuffer(slot); in RemoveBuffer()
807 slot, status.GetErrorMessage().c_str()); in RemoveBuffer()
812 buffers_[slot].mProducerBuffer = nullptr; in RemoveBuffer()
813 buffers_[slot].mBufferState.detachProducer(); in RemoveBuffer()
814 buffers_[slot].mFence = Fence::NO_FENCE; in RemoveBuffer()
815 buffers_[slot].mGraphicBuffer = nullptr; in RemoveBuffer()
816 buffers_[slot].mRequestBufferCalled = false; in RemoveBuffer()
821 for (size_t slot = 0; slot < BufferHubQueue::kMaxQueueCapacity; slot++) { in FreeAllBuffers() local
823 buffers_[slot].mProducerBuffer = nullptr; in FreeAllBuffers()
824 buffers_[slot].mBufferState.reset(); in FreeAllBuffers()
825 buffers_[slot].mFence = Fence::NO_FENCE; in FreeAllBuffers()
826 buffers_[slot].mGraphicBuffer = nullptr; in FreeAllBuffers()
827 buffers_[slot].mRequestBufferCalled = false; in FreeAllBuffers()