diff options
author | 2018-12-31 18:40:02 -0800 | |
---|---|---|
committer | 2019-01-02 11:45:52 -0800 | |
commit | 1c730240e58ea241ffebc252b5cde395d694a25a (patch) | |
tree | f0277f574f90b358789fdf277261837ae3c72eac | |
parent | 49a99b9ff288a105de660cd43ce73e0ce2e7d2f2 (diff) |
Rename Buffer{Producer, Consumer} to {Producer, Consumer}Buffer
Bug: 116855254
Test: Build
Change-Id: Ief03795d2093f817f135d33eb252e1e040e150f7
-rw-r--r-- | libs/gui/BufferHubProducer.cpp | 86 | ||||
-rw-r--r-- | libs/gui/include/gui/BufferHubProducer.h | 4 | ||||
-rw-r--r-- | libs/vr/libbufferhub/include/private/dvr/consumer_buffer.h | 10 | ||||
-rw-r--r-- | libs/vr/libbufferhub/include/private/dvr/producer_buffer.h | 12 | ||||
-rw-r--r-- | libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp | 38 | ||||
-rw-r--r-- | libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h | 42 | ||||
-rw-r--r-- | libs/vr/libbufferhubqueue/tests/buffer_hub_queue-test.cpp | 22 | ||||
-rw-r--r-- | libs/vr/libdvr/dvr_buffer_queue.cpp | 24 | ||||
-rw-r--r-- | libs/vr/libdvr/dvr_display_manager.cpp | 4 | ||||
-rw-r--r-- | libs/vr/libdvr/dvr_internal.h | 14 | ||||
-rw-r--r-- | libs/vr/libdvr/dvr_surface.cpp | 1 | ||||
-rw-r--r-- | libs/vr/libvrflinger/acquired_buffer.cpp | 6 | ||||
-rw-r--r-- | libs/vr/libvrflinger/acquired_buffer.h | 30 | ||||
-rw-r--r-- | libs/vr/libvrsensor/pose_client.cpp | 4 | ||||
-rw-r--r-- | services/vr/bufferhubd/include/private/dvr/buffer_hub.h | 4 | ||||
-rw-r--r-- | services/vr/bufferhubd/include/private/dvr/producer_queue_channel.h | 4 | ||||
-rw-r--r-- | services/vr/bufferhubd/producer_channel.cpp | 2 |
17 files changed, 138 insertions, 169 deletions
diff --git a/libs/gui/BufferHubProducer.cpp b/libs/gui/BufferHubProducer.cpp index 16952a6625..4be014fbb1 100644 --- a/libs/gui/BufferHubProducer.cpp +++ b/libs/gui/BufferHubProducer.cpp @@ -64,13 +64,13 @@ status_t BufferHubProducer::requestBuffer(int slot, sp<GraphicBuffer>* buf) { } else if (buffers_[slot].mGraphicBuffer != nullptr) { ALOGE("requestBuffer: slot %d is not empty.", slot); return BAD_VALUE; - } else if (buffers_[slot].mBufferProducer == nullptr) { + } else if (buffers_[slot].mProducerBuffer == nullptr) { ALOGE("requestBuffer: slot %d is not dequeued.", slot); return BAD_VALUE; } - const auto& buffer_producer = buffers_[slot].mBufferProducer; - sp<GraphicBuffer> graphic_buffer = buffer_producer->buffer()->buffer(); + const auto& producer_buffer = buffers_[slot].mProducerBuffer; + sp<GraphicBuffer> graphic_buffer = producer_buffer->buffer()->buffer(); buffers_[slot].mGraphicBuffer = graphic_buffer; buffers_[slot].mRequestBufferCalled = true; @@ -158,19 +158,19 @@ status_t BufferHubProducer::dequeueBuffer(int* out_slot, sp<Fence>* out_fence, u } size_t slot = 0; - std::shared_ptr<BufferProducer> buffer_producer; + std::shared_ptr<ProducerBuffer> producer_buffer; for (size_t retry = 0; retry < BufferHubQueue::kMaxQueueCapacity; retry++) { LocalHandle fence; auto buffer_status = queue_->Dequeue(dequeue_timeout_ms_, &slot, &fence); if (!buffer_status) return NO_MEMORY; - buffer_producer = buffer_status.take(); - if (!buffer_producer) return NO_MEMORY; + producer_buffer = buffer_status.take(); + if (!producer_buffer) return NO_MEMORY; - if (width == buffer_producer->width() && height == buffer_producer->height() && - uint32_t(format) == buffer_producer->format()) { - // The producer queue returns a buffer producer matches the request. + if (width == producer_buffer->width() && height == producer_buffer->height() && + uint32_t(format) == producer_buffer->format()) { + // The producer queue returns a producer buffer matches the request. break; } @@ -179,8 +179,8 @@ status_t BufferHubProducer::dequeueBuffer(int* out_slot, sp<Fence>* out_fence, u ALOGI("dequeueBuffer: requested buffer (w=%u, h=%u, format=%u) is different " "from the buffer returned at slot: %zu (w=%u, h=%u, format=%u). Need " "re-allocattion.", - width, height, format, slot, buffer_producer->width(), buffer_producer->height(), - buffer_producer->format()); + width, height, format, slot, producer_buffer->width(), producer_buffer->height(), + producer_buffer->format()); // Mark the slot as reallocating, so that later we can set // BUFFER_NEEDS_REALLOCATION when the buffer actually get dequeued. buffers_[slot].mIsReallocating = true; @@ -249,18 +249,18 @@ status_t BufferHubProducer::DetachBufferLocked(size_t slot) { ALOGE("detachBuffer: buffer in slot %zu has not been requested", slot); return BAD_VALUE; } - std::shared_ptr<BufferProducer> buffer_producer = queue_->GetBuffer(slot); - if (buffer_producer == nullptr || buffer_producer->buffer() == nullptr) { - ALOGE("detachBuffer: Invalid BufferProducer at slot %zu.", slot); + std::shared_ptr<ProducerBuffer> producer_buffer = queue_->GetBuffer(slot); + if (producer_buffer == nullptr || producer_buffer->buffer() == nullptr) { + ALOGE("detachBuffer: Invalid ProducerBuffer at slot %zu.", slot); return BAD_VALUE; } - sp<GraphicBuffer> graphic_buffer = buffer_producer->buffer()->buffer(); + sp<GraphicBuffer> graphic_buffer = producer_buffer->buffer()->buffer(); if (graphic_buffer == nullptr) { ALOGE("detachBuffer: Invalid GraphicBuffer at slot %zu.", slot); return BAD_VALUE; } - // Remove the BufferProducer from the ProducerQueue. + // Remove the ProducerBuffer from the ProducerQueue. status_t error = RemoveBuffer(slot); if (error != NO_ERROR) { ALOGE("detachBuffer: Failed to remove buffer, slot=%zu, error=%d.", slot, error); @@ -269,9 +269,9 @@ status_t BufferHubProducer::DetachBufferLocked(size_t slot) { // Here we need to convert the existing ProducerBuffer into a DetachedBufferHandle and inject // the handle into the GraphicBuffer object at the requested slot. - auto status_or_handle = buffer_producer->Detach(); + auto status_or_handle = producer_buffer->Detach(); if (!status_or_handle.ok()) { - ALOGE("detachBuffer: Failed to detach from a BufferProducer at slot %zu, error=%d.", slot, + ALOGE("detachBuffer: Failed to detach from a ProducerBuffer at slot %zu, error=%d.", slot, status_or_handle.error()); return BAD_VALUE; } @@ -301,14 +301,14 @@ status_t BufferHubProducer::detachNextBuffer(sp<GraphicBuffer>* out_buffer, sp<F // sequence, except for two things: // // 1) It is unnecessary to know the dimensions, format, or usage of the next buffer, i.e. the - // function just returns whatever BufferProducer is available from the ProducerQueue and no + // function just returns whatever ProducerBuffer is available from the ProducerQueue and no // buffer allocation or re-allocation will happen. // 2) It will not block, since if it cannot find an appropriate buffer to return, it will return // an error instead. size_t slot = 0; LocalHandle fence; - // First, dequeue a BufferProducer from the ProducerQueue with no timeout. Report error + // First, dequeue a ProducerBuffer from the ProducerQueue with no timeout. Report error // immediately if ProducerQueue::Dequeue() fails. auto status_or_buffer = queue_->Dequeue(/*timeout=*/0, &slot, &fence); if (!status_or_buffer.ok()) { @@ -316,8 +316,8 @@ status_t BufferHubProducer::detachNextBuffer(sp<GraphicBuffer>* out_buffer, sp<F return NO_MEMORY; } - std::shared_ptr<BufferProducer> buffer_producer = status_or_buffer.take(); - if (buffer_producer == nullptr) { + std::shared_ptr<ProducerBuffer> producer_buffer = status_or_buffer.take(); + if (producer_buffer == nullptr) { ALOGE("detachNextBuffer: Dequeued buffer is null."); return NO_MEMORY; } @@ -331,14 +331,14 @@ status_t BufferHubProducer::detachNextBuffer(sp<GraphicBuffer>* out_buffer, sp<F buffers_[slot].mBufferState.string()); return BAD_VALUE; } - if (buffers_[slot].mBufferProducer == nullptr) { - ALOGE("detachNextBuffer: BufferProducer at slot %zu is null.", slot); + if (buffers_[slot].mProducerBuffer == nullptr) { + ALOGE("detachNextBuffer: ProducerBuffer at slot %zu is null.", slot); return BAD_VALUE; } - if (buffers_[slot].mBufferProducer->id() != buffer_producer->id()) { - ALOGE("detachNextBuffer: BufferProducer at slot %zu has mismatched id, actual: " + if (buffers_[slot].mProducerBuffer->id() != producer_buffer->id()) { + ALOGE("detachNextBuffer: ProducerBuffer at slot %zu has mismatched id, actual: " "%d, expected: %d.", - slot, buffers_[slot].mBufferProducer->id(), buffer_producer->id()); + slot, buffers_[slot].mProducerBuffer->id(), producer_buffer->id()); return BAD_VALUE; } @@ -347,8 +347,8 @@ status_t BufferHubProducer::detachNextBuffer(sp<GraphicBuffer>* out_buffer, sp<F buffers_[slot].mBufferState.dequeue(); // Second, request the buffer. - sp<GraphicBuffer> graphic_buffer = buffer_producer->buffer()->buffer(); - buffers_[slot].mGraphicBuffer = buffer_producer->buffer()->buffer(); + sp<GraphicBuffer> graphic_buffer = producer_buffer->buffer()->buffer(); + buffers_[slot].mGraphicBuffer = producer_buffer->buffer()->buffer(); // Finally, detach the buffer and then return. status_t error = DetachBufferLocked(slot); @@ -452,11 +452,11 @@ status_t BufferHubProducer::queueBuffer(int slot, const QueueBufferInput& input, return BAD_VALUE; } - // Post the buffer producer with timestamp in the metadata. - const auto& buffer_producer = buffers_[slot].mBufferProducer; + // Post the producer buffer with timestamp in the metadata. + const auto& producer_buffer = buffers_[slot].mProducerBuffer; // Check input crop is not out of boundary of current buffer. - Rect buffer_rect(buffer_producer->width(), buffer_producer->height()); + Rect buffer_rect(producer_buffer->width(), producer_buffer->height()); Rect cropped_rect(Rect::EMPTY_RECT); crop.intersect(buffer_rect, &cropped_rect); if (cropped_rect != crop) { @@ -477,11 +477,11 @@ status_t BufferHubProducer::queueBuffer(int slot, const QueueBufferInput& input, meta_data.scaling_mode = int32_t(scaling_mode); meta_data.transform = int32_t(transform); - buffer_producer->PostAsync(&meta_data, fence_fd); + producer_buffer->PostAsync(&meta_data, fence_fd); buffers_[slot].mBufferState.queue(); - output->width = buffer_producer->width(); - output->height = buffer_producer->height(); + output->width = producer_buffer->width(); + output->height = producer_buffer->height(); output->transformHint = 0; // default value, we don't use it yet. // |numPendingBuffers| counts of the number of buffers that has been enqueued @@ -519,8 +519,8 @@ status_t BufferHubProducer::cancelBuffer(int slot, const sp<Fence>& fence) { return BAD_VALUE; } - auto buffer_producer = buffers_[slot].mBufferProducer; - queue_->Enqueue(buffer_producer, size_t(slot), 0U); + auto producer_buffer = buffers_[slot].mProducerBuffer; + queue_->Enqueue(producer_buffer, size_t(slot), 0U); buffers_[slot].mBufferState.cancel(); buffers_[slot].mFence = fence; ALOGV("cancelBuffer: slot %d", slot); @@ -791,12 +791,12 @@ status_t BufferHubProducer::AllocateBuffer(uint32_t width, uint32_t height, uint } size_t slot = status.get(); - auto buffer_producer = queue_->GetBuffer(slot); + auto producer_buffer = queue_->GetBuffer(slot); - LOG_ALWAYS_FATAL_IF(buffer_producer == nullptr, "Failed to get buffer producer at slot: %zu", - slot); + LOG_ALWAYS_FATAL_IF(producer_buffer == nullptr, + "Failed to get the producer buffer at slot: %zu", slot); - buffers_[slot].mBufferProducer = buffer_producer; + buffers_[slot].mProducerBuffer = producer_buffer; return NO_ERROR; } @@ -810,7 +810,7 @@ status_t BufferHubProducer::RemoveBuffer(size_t slot) { } // Reset in memory objects related the the buffer. - buffers_[slot].mBufferProducer = nullptr; + buffers_[slot].mProducerBuffer = nullptr; buffers_[slot].mBufferState.detachProducer(); buffers_[slot].mFence = Fence::NO_FENCE; buffers_[slot].mGraphicBuffer = nullptr; @@ -821,7 +821,7 @@ status_t BufferHubProducer::RemoveBuffer(size_t slot) { status_t BufferHubProducer::FreeAllBuffers() { for (size_t slot = 0; slot < BufferHubQueue::kMaxQueueCapacity; slot++) { // Reset in memory objects related the the buffer. - buffers_[slot].mBufferProducer = nullptr; + buffers_[slot].mProducerBuffer = nullptr; buffers_[slot].mBufferState.reset(); buffers_[slot].mFence = Fence::NO_FENCE; buffers_[slot].mGraphicBuffer = nullptr; diff --git a/libs/gui/include/gui/BufferHubProducer.h b/libs/gui/include/gui/BufferHubProducer.h index f7af19b20e..0e925ceb3b 100644 --- a/libs/gui/include/gui/BufferHubProducer.h +++ b/libs/gui/include/gui/BufferHubProducer.h @@ -203,10 +203,10 @@ private: // requested buffer usage or geometry differs from that of the buffer // allocated to a slot. struct BufferHubSlot : public BufferSlot { - BufferHubSlot() : mBufferProducer(nullptr), mIsReallocating(false) {} + BufferHubSlot() : mProducerBuffer(nullptr), mIsReallocating(false) {} // BufferSlot comes from android framework, using m prefix to comply with // the name convention with the reset of data fields from BufferSlot. - std::shared_ptr<dvr::BufferProducer> mBufferProducer; + std::shared_ptr<dvr::ProducerBuffer> mProducerBuffer; bool mIsReallocating; }; BufferHubSlot buffers_[dvr::BufferHubQueue::kMaxQueueCapacity]; diff --git a/libs/vr/libbufferhub/include/private/dvr/consumer_buffer.h b/libs/vr/libbufferhub/include/private/dvr/consumer_buffer.h index 7aa50b1985..726f0350b0 100644 --- a/libs/vr/libbufferhub/include/private/dvr/consumer_buffer.h +++ b/libs/vr/libbufferhub/include/private/dvr/consumer_buffer.h @@ -6,16 +6,6 @@ namespace android { namespace dvr { -// BufferConsumer was originally poorly named and gets easily confused with -// IGraphicBufferConsumer. Actually, BufferConsumer is a single buffer that can -// consume (i.e. read) data from a buffer, but it doesn't consume buffer. On -// the other hand, IGraphicBufferConsumer is the consumer end of a BufferQueue -// and it is used to consume buffers. -// -// TODO(b/116855254): Remove this typedef once rename is complete in other -// projects and/or branches. -typedef class ConsumerBuffer BufferConsumer; - // This is a connection to a producer buffer, which can be located in another // application. When that buffer is Post()ed, this fd will be signaled and // Acquire allows read access. The user is responsible for making sure that diff --git a/libs/vr/libbufferhub/include/private/dvr/producer_buffer.h b/libs/vr/libbufferhub/include/private/dvr/producer_buffer.h index 2761416034..7ec345c4b5 100644 --- a/libs/vr/libbufferhub/include/private/dvr/producer_buffer.h +++ b/libs/vr/libbufferhub/include/private/dvr/producer_buffer.h @@ -6,23 +6,13 @@ namespace android { namespace dvr { -// BufferProducer was originally poorly named and gets easily confused with -// IGraphicBufferProducer. Actually, BufferProducer is a single buffer that can -// produce (i.e. write) data into a buffer, but it doesn't produce buffer. On -// the other hand, IGraphicBufferProducer is the producer end of a BufferQueue -// and it is used to produce buffers. -// -// TODO(b/116855254): Remove this typedef once rename is complete in other -// projects and/or branches. -typedef class ProducerBuffer BufferProducer; - // This represents a writable buffer. Calling Post notifies all clients and // makes the buffer read-only. Call Gain to acquire write access. A buffer // may have many consumers. // // The user of ProducerBuffer is responsible with making sure that the Post() is // done with the correct metadata type and size. The user is also responsible -// for making sure that remote ends (BufferConsumers) are also using the correct +// for making sure that remote ends (ConsumerBuffers) are also using the correct // metadata when acquiring the buffer. The API guarantees that a Post() with a // metadata of wrong size will fail. However, it currently does not do any // type checking. diff --git a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp index 9c4f73f37a..d7833f382b 100644 --- a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp +++ b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp @@ -480,7 +480,7 @@ Status<std::vector<size_t>> ProducerQueue::AllocateBuffers( // Note that import might (though very unlikely) fail. If so, buffer_handle // will be closed and included in returned buffer_slots. - if (AddBuffer(BufferProducer::Import(std::move(buffer_handle)), + if (AddBuffer(ProducerBuffer::Import(std::move(buffer_handle)), buffer_slot)) { ALOGD_IF(TRACE, "ProducerQueue::AllocateBuffers: new buffer at slot: %zu", buffer_slot); @@ -517,7 +517,7 @@ Status<size_t> ProducerQueue::AllocateBuffer(uint32_t width, uint32_t height, } Status<void> ProducerQueue::AddBuffer( - const std::shared_ptr<BufferProducer>& buffer, size_t slot) { + const std::shared_ptr<ProducerBuffer>& buffer, size_t slot) { ALOGD_IF(TRACE, "ProducerQueue::AddBuffer: queue_id=%d buffer_id=%d slot=%zu", id(), buffer->id(), slot); // For producer buffer, we need to enqueue the newly added buffer @@ -530,7 +530,7 @@ Status<void> ProducerQueue::AddBuffer( } Status<size_t> ProducerQueue::InsertBuffer( - const std::shared_ptr<BufferProducer>& buffer) { + const std::shared_ptr<ProducerBuffer>& buffer) { if (buffer == nullptr || !BufferHubDefs::IsClientGained(buffer->buffer_state(), buffer->client_state_mask())) { @@ -554,7 +554,7 @@ Status<size_t> ProducerQueue::InsertBuffer( size_t slot = status_or_slot.get(); // Note that we are calling AddBuffer() from the base class to explicitly - // avoid Enqueue() the BufferProducer. + // avoid Enqueue() the ProducerBuffer. auto status = BufferHubQueue::AddBuffer(buffer, slot); if (!status) { ALOGE("ProducerQueue::InsertBuffer: Failed to add buffer: %s.", @@ -576,13 +576,13 @@ Status<void> ProducerQueue::RemoveBuffer(size_t slot) { return BufferHubQueue::RemoveBuffer(slot); } -Status<std::shared_ptr<BufferProducer>> ProducerQueue::Dequeue( +Status<std::shared_ptr<ProducerBuffer>> ProducerQueue::Dequeue( int timeout, size_t* slot, LocalHandle* release_fence) { DvrNativeBufferMetadata canonical_meta; return Dequeue(timeout, slot, &canonical_meta, release_fence); } -pdx::Status<std::shared_ptr<BufferProducer>> ProducerQueue::Dequeue( +pdx::Status<std::shared_ptr<ProducerBuffer>> ProducerQueue::Dequeue( int timeout, size_t* slot, DvrNativeBufferMetadata* out_meta, pdx::LocalHandle* release_fence, bool gain_posted_buffer) { ATRACE_NAME("ProducerQueue::Dequeue"); @@ -591,14 +591,14 @@ pdx::Status<std::shared_ptr<BufferProducer>> ProducerQueue::Dequeue( return ErrorStatus(EINVAL); } - std::shared_ptr<BufferProducer> buffer; + std::shared_ptr<ProducerBuffer> buffer; Status<std::shared_ptr<BufferHubBase>> dequeue_status = BufferHubQueue::Dequeue(timeout, slot); if (dequeue_status.ok()) { - buffer = std::static_pointer_cast<BufferProducer>(dequeue_status.take()); + buffer = std::static_pointer_cast<ProducerBuffer>(dequeue_status.take()); } else { if (gain_posted_buffer) { - Status<std::shared_ptr<BufferProducer>> dequeue_unacquired_status = + Status<std::shared_ptr<ProducerBuffer>> dequeue_unacquired_status = ProducerQueue::DequeueUnacquiredBuffer(slot); if (!dequeue_unacquired_status.ok()) { ALOGE("%s: DequeueUnacquiredBuffer returned error: %d", __FUNCTION__, @@ -618,7 +618,7 @@ pdx::Status<std::shared_ptr<BufferProducer>> ProducerQueue::Dequeue( return {std::move(buffer)}; } -Status<std::shared_ptr<BufferProducer>> ProducerQueue::DequeueUnacquiredBuffer( +Status<std::shared_ptr<ProducerBuffer>> ProducerQueue::DequeueUnacquiredBuffer( size_t* slot) { if (unavailable_buffers_slot_.size() < 1) { ALOGE( @@ -632,7 +632,7 @@ Status<std::shared_ptr<BufferProducer>> ProducerQueue::DequeueUnacquiredBuffer( // unavailable_buffers_slot_. for (auto iter = unavailable_buffers_slot_.begin(); iter != unavailable_buffers_slot_.end(); iter++) { - std::shared_ptr<BufferProducer> buffer = ProducerQueue::GetBuffer(*iter); + std::shared_ptr<ProducerBuffer> buffer = ProducerQueue::GetBuffer(*iter); if (buffer == nullptr) { ALOGE("%s failed. Buffer slot %d is null.", __FUNCTION__, static_cast<int>(*slot)); @@ -718,9 +718,9 @@ Status<size_t> ConsumerQueue::ImportBuffers() { ALOGD_IF(TRACE, ": buffer_handle=%d", __FUNCTION__, buffer_handle_slot.first.value()); - std::unique_ptr<BufferConsumer> buffer_consumer = - BufferConsumer::Import(std::move(buffer_handle_slot.first)); - if (!buffer_consumer) { + std::unique_ptr<ConsumerBuffer> consumer_buffer = + ConsumerBuffer::Import(std::move(buffer_handle_slot.first)); + if (!consumer_buffer) { ALOGE("%s: Failed to import buffer: slot=%zu", __FUNCTION__, buffer_handle_slot.second); last_error = ErrorStatus(EPIPE); @@ -728,7 +728,7 @@ Status<size_t> ConsumerQueue::ImportBuffers() { } auto add_status = - AddBuffer(std::move(buffer_consumer), buffer_handle_slot.second); + AddBuffer(std::move(consumer_buffer), buffer_handle_slot.second); if (!add_status) { ALOGE("%s: Failed to add buffer: %s", __FUNCTION__, add_status.GetErrorMessage().c_str()); @@ -745,13 +745,13 @@ Status<size_t> ConsumerQueue::ImportBuffers() { } Status<void> ConsumerQueue::AddBuffer( - const std::shared_ptr<BufferConsumer>& buffer, size_t slot) { + const std::shared_ptr<ConsumerBuffer>& buffer, size_t slot) { ALOGD_IF(TRACE, "%s: queue_id=%d buffer_id=%d slot=%zu", __FUNCTION__, id(), buffer->id(), slot); return BufferHubQueue::AddBuffer(buffer, slot); } -Status<std::shared_ptr<BufferConsumer>> ConsumerQueue::Dequeue( +Status<std::shared_ptr<ConsumerBuffer>> ConsumerQueue::Dequeue( int timeout, size_t* slot, void* meta, size_t user_metadata_size, LocalHandle* acquire_fence) { if (user_metadata_size != user_metadata_size_) { @@ -780,7 +780,7 @@ Status<std::shared_ptr<BufferConsumer>> ConsumerQueue::Dequeue( return status; } -Status<std::shared_ptr<BufferConsumer>> ConsumerQueue::Dequeue( +Status<std::shared_ptr<ConsumerBuffer>> ConsumerQueue::Dequeue( int timeout, size_t* slot, DvrNativeBufferMetadata* out_meta, pdx::LocalHandle* acquire_fence) { ATRACE_NAME("ConsumerQueue::Dequeue"); @@ -793,7 +793,7 @@ Status<std::shared_ptr<BufferConsumer>> ConsumerQueue::Dequeue( if (!status) return status.error_status(); - auto buffer = std::static_pointer_cast<BufferConsumer>(status.take()); + auto buffer = std::static_pointer_cast<ConsumerBuffer>(status.take()); const int ret = buffer->AcquireAsync(out_meta, acquire_fence); if (ret < 0) return ErrorStatus(-ret); diff --git a/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h b/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h index 53ab2b2e7a..d1f0564685 100644 --- a/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h +++ b/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h @@ -307,12 +307,12 @@ class ProducerQueue : public pdx::ClientBase<ProducerQueue, BufferHubQueue> { return BASE::Create(std::move(handle)); } - // Get a buffer producer. Note that the method doesn't check whether the + // Get a producer buffer. Note that the method doesn't check whether the // buffer slot has a valid buffer that has been allocated already. When no // buffer has been imported before it returns nullptr; otherwise it returns - // a shared pointer to a BufferProducer. - std::shared_ptr<BufferProducer> GetBuffer(size_t slot) const { - return std::static_pointer_cast<BufferProducer>( + // a shared pointer to a ProducerBuffer. + std::shared_ptr<ProducerBuffer> GetBuffer(size_t slot) const { + return std::static_pointer_cast<ProducerBuffer>( BufferHubQueue::GetBuffer(slot)); } @@ -333,7 +333,7 @@ class ProducerQueue : public pdx::ClientBase<ProducerQueue, BufferHubQueue> { // Add a producer buffer to populate the queue. Once added, a producer buffer // is available to use (i.e. in GAINED state). - pdx::Status<void> AddBuffer(const std::shared_ptr<BufferProducer>& buffer, + pdx::Status<void> AddBuffer(const std::shared_ptr<ProducerBuffer>& buffer, size_t slot); // Inserts a ProducerBuffer into the queue. On success, the method returns the @@ -341,7 +341,7 @@ class ProducerQueue : public pdx::ClientBase<ProducerQueue, BufferHubQueue> { // being inserted should be in Gain'ed state prior to the call and it's // considered as already Dequeued when the function returns. pdx::Status<size_t> InsertBuffer( - const std::shared_ptr<BufferProducer>& buffer); + const std::shared_ptr<ProducerBuffer>& buffer); // Remove producer buffer from the queue. pdx::Status<void> RemoveBuffer(size_t slot) override; @@ -355,7 +355,7 @@ class ProducerQueue : public pdx::ClientBase<ProducerQueue, BufferHubQueue> { // and caller should call Post() once it's done writing to release the buffer // to the consumer side. // @return a buffer in gained state, which was originally in released state. - pdx::Status<std::shared_ptr<BufferProducer>> Dequeue( + pdx::Status<std::shared_ptr<ProducerBuffer>> Dequeue( int timeout, size_t* slot, pdx::LocalHandle* release_fence); // Dequeue a producer buffer to write. The returned buffer in |Gain|'ed mode, @@ -363,7 +363,7 @@ class ProducerQueue : public pdx::ClientBase<ProducerQueue, BufferHubQueue> { // to the consumer side. // // @param timeout to dequeue a buffer. - // @param slot is the slot of the output BufferProducer. + // @param slot is the slot of the output ProducerBuffer. // @param release_fence for gaining a buffer. // @param out_meta metadata of the output buffer. // @param gain_posted_buffer whether to gain posted buffer if no released @@ -375,12 +375,12 @@ class ProducerQueue : public pdx::ClientBase<ProducerQueue, BufferHubQueue> { // libdvrtracking from starving when there are non-responding clients. This // gain_posted_buffer param can be removed once libdvrtracking start to use // the new AHardwareBuffer API. - pdx::Status<std::shared_ptr<BufferProducer>> Dequeue( + pdx::Status<std::shared_ptr<ProducerBuffer>> Dequeue( int timeout, size_t* slot, DvrNativeBufferMetadata* out_meta, pdx::LocalHandle* release_fence, bool gain_posted_buffer = false); // Enqueues a producer buffer in the queue. - pdx::Status<void> Enqueue(const std::shared_ptr<BufferProducer>& buffer, + pdx::Status<void> Enqueue(const std::shared_ptr<ProducerBuffer>& buffer, size_t slot, uint64_t index) { return BufferHubQueue::Enqueue({buffer, slot, index}); } @@ -406,18 +406,18 @@ class ProducerQueue : public pdx::ClientBase<ProducerQueue, BufferHubQueue> { // @param slot the slot of the returned buffer. // @return a buffer in gained state, which was originally in posted state or // released state. - pdx::Status<std::shared_ptr<BufferProducer>> DequeueUnacquiredBuffer( + pdx::Status<std::shared_ptr<ProducerBuffer>> DequeueUnacquiredBuffer( size_t* slot); }; class ConsumerQueue : public BufferHubQueue { public: - // Get a buffer consumer. Note that the method doesn't check whether the + // Get a consumer buffer. Note that the method doesn't check whether the // buffer slot has a valid buffer that has been imported already. When no // buffer has been imported before it returns nullptr; otherwise returns a - // shared pointer to a BufferConsumer. - std::shared_ptr<BufferConsumer> GetBuffer(size_t slot) const { - return std::static_pointer_cast<BufferConsumer>( + // shared pointer to a ConsumerBuffer. + std::shared_ptr<ConsumerBuffer> GetBuffer(size_t slot) const { + return std::static_pointer_cast<ConsumerBuffer>( BufferHubQueue::GetBuffer(slot)); } @@ -435,23 +435,23 @@ class ConsumerQueue : public BufferHubQueue { // Dequeue a consumer buffer to read. The returned buffer in |Acquired|'ed // mode, and caller should call Releasse() once it's done writing to release // the buffer to the producer side. |meta| is passed along from BufferHub, - // The user of BufferProducer is responsible with making sure that the + // The user of ProducerBuffer is responsible with making sure that the // Dequeue() is done with the corect metadata type and size with those used // when the buffer is orignally created. template <typename Meta> - pdx::Status<std::shared_ptr<BufferConsumer>> Dequeue( + pdx::Status<std::shared_ptr<ConsumerBuffer>> Dequeue( int timeout, size_t* slot, Meta* meta, pdx::LocalHandle* acquire_fence) { return Dequeue(timeout, slot, meta, sizeof(*meta), acquire_fence); } - pdx::Status<std::shared_ptr<BufferConsumer>> Dequeue( + pdx::Status<std::shared_ptr<ConsumerBuffer>> Dequeue( int timeout, size_t* slot, pdx::LocalHandle* acquire_fence) { return Dequeue(timeout, slot, nullptr, 0, acquire_fence); } - pdx::Status<std::shared_ptr<BufferConsumer>> Dequeue( + pdx::Status<std::shared_ptr<ConsumerBuffer>> Dequeue( int timeout, size_t* slot, void* meta, size_t user_metadata_size, pdx::LocalHandle* acquire_fence); - pdx::Status<std::shared_ptr<BufferConsumer>> Dequeue( + pdx::Status<std::shared_ptr<ConsumerBuffer>> Dequeue( int timeout, size_t* slot, DvrNativeBufferMetadata* out_meta, pdx::LocalHandle* acquire_fence); @@ -464,7 +464,7 @@ class ConsumerQueue : public BufferHubQueue { // is NOT available to use until the producer side |Post| it. |WaitForBuffers| // will catch the |Post| and |Acquire| the buffer to make it available for // consumer. - pdx::Status<void> AddBuffer(const std::shared_ptr<BufferConsumer>& buffer, + pdx::Status<void> AddBuffer(const std::shared_ptr<ConsumerBuffer>& buffer, size_t slot); pdx::Status<void> OnBufferAllocated() override; diff --git a/libs/vr/libbufferhubqueue/tests/buffer_hub_queue-test.cpp b/libs/vr/libbufferhubqueue/tests/buffer_hub_queue-test.cpp index 159d6dc4b9..6ae603b892 100644 --- a/libs/vr/libbufferhubqueue/tests/buffer_hub_queue-test.cpp +++ b/libs/vr/libbufferhubqueue/tests/buffer_hub_queue-test.cpp @@ -125,7 +125,7 @@ TEST_F(BufferHubQueueTest, TestDequeue) { } TEST_F(BufferHubQueueTest, - TestDequeuePostedBufferIfNoAvailableReleasedBuffer_withBufferConsumer) { + TestDequeuePostedBufferIfNoAvailableReleasedBuffer_withConsumerBuffer) { ASSERT_TRUE(CreateQueues(config_builder_.Build(), UsagePolicy{})); // Allocate 3 buffers to use. @@ -205,7 +205,7 @@ TEST_F(BufferHubQueueTest, } TEST_F(BufferHubQueueTest, - TestDequeuePostedBufferIfNoAvailableReleasedBuffer_noBufferConsumer) { + TestDequeuePostedBufferIfNoAvailableReleasedBuffer_noConsumerBuffer) { ASSERT_TRUE(CreateQueues(config_builder_.Build(), UsagePolicy{})); // Allocate 4 buffers to use. @@ -332,7 +332,7 @@ TEST_F(BufferHubQueueTest, TestInsertBuffer) { EXPECT_EQ(producer_queue_->capacity(), 0); EXPECT_EQ(consumer_queue_->capacity(), 0); - std::shared_ptr<BufferProducer> p1 = BufferProducer::Create( + std::shared_ptr<ProducerBuffer> p1 = ProducerBuffer::Create( kBufferWidth, kBufferHeight, kBufferFormat, kBufferUsage, 0); ASSERT_TRUE(p1 != nullptr); ASSERT_EQ(p1->GainAsync(), 0); @@ -345,7 +345,7 @@ TEST_F(BufferHubQueueTest, TestInsertBuffer) { EXPECT_EQ(status_or_slot.error(), EINVAL); // Inserting a gained buffer will succeed. - std::shared_ptr<BufferProducer> p2 = BufferProducer::Create( + std::shared_ptr<ProducerBuffer> p2 = ProducerBuffer::Create( kBufferWidth, kBufferHeight, kBufferFormat, kBufferUsage); ASSERT_EQ(p2->GainAsync(), 0); ASSERT_TRUE(p2 != nullptr); @@ -382,7 +382,7 @@ TEST_F(BufferHubQueueTest, TestRemoveBuffer) { // Dequeue all the buffers and keep track of them in an array. This prevents // the producer queue ring buffer ref counts from interfering with the tests. struct Entry { - std::shared_ptr<BufferProducer> buffer; + std::shared_ptr<ProducerBuffer> buffer; LocalHandle fence; size_t slot; }; @@ -848,10 +848,10 @@ TEST_F(BufferHubQueueTest, TestFreeAllBuffers) { size_t slot; LocalHandle fence; pdx::Status<void> status; - pdx::Status<std::shared_ptr<BufferConsumer>> consumer_status; - pdx::Status<std::shared_ptr<BufferProducer>> producer_status; - std::shared_ptr<BufferConsumer> consumer_buffer; - std::shared_ptr<BufferProducer> producer_buffer; + pdx::Status<std::shared_ptr<ConsumerBuffer>> consumer_status; + pdx::Status<std::shared_ptr<ProducerBuffer>> producer_status; + std::shared_ptr<ConsumerBuffer> consumer_buffer; + std::shared_ptr<ProducerBuffer> producer_buffer; DvrNativeBufferMetadata mi, mo; ASSERT_TRUE(CreateQueues(config_builder_.Build(), UsagePolicy{})); @@ -994,7 +994,7 @@ TEST_F(BufferHubQueueTest, TestProducerExportToParcelable) { auto s3 = producer_queue_->Dequeue(0, &slot, &producer_meta, &fence); EXPECT_TRUE(s3.ok()); - std::shared_ptr<BufferProducer> p1 = s3.take(); + std::shared_ptr<ProducerBuffer> p1 = s3.take(); ASSERT_NE(p1, nullptr); producer_meta.timestamp = 42; @@ -1061,7 +1061,7 @@ TEST_F(BufferHubQueueTest, TestCreateConsumerParcelable) { auto s2 = producer_queue_->Dequeue(0, &slot, &producer_meta, &fence); EXPECT_TRUE(s2.ok()); - std::shared_ptr<BufferProducer> p1 = s2.take(); + std::shared_ptr<ProducerBuffer> p1 = s2.take(); ASSERT_NE(p1, nullptr); producer_meta.timestamp = 42; diff --git a/libs/vr/libdvr/dvr_buffer_queue.cpp b/libs/vr/libdvr/dvr_buffer_queue.cpp index f4c6600469..1ca653c4ff 100644 --- a/libs/vr/libdvr/dvr_buffer_queue.cpp +++ b/libs/vr/libdvr/dvr_buffer_queue.cpp @@ -8,10 +8,10 @@ #include "dvr_buffer_queue_internal.h" using namespace android; -using android::dvr::BufferConsumer; using android::dvr::BufferHubBase; -using android::dvr::BufferProducer; +using android::dvr::ConsumerBuffer; using android::dvr::ConsumerQueue; +using android::dvr::ProducerBuffer; using android::dvr::ProducerQueue; using android::dvr::ProducerQueueConfigBuilder; using android::dvr::UsagePolicy; @@ -103,13 +103,13 @@ int DvrWriteBufferQueue::GainBuffer(int timeout, "DvrWriteBufferQueue::GainBuffer: Buffer slot is not empty: %zu", slot); write_buffers_[slot]->write_buffer = std::move(buffer_status.take()); - const auto& buffer_producer = write_buffers_[slot]->write_buffer; - if (!buffer_producer) + const auto& producer_buffer = write_buffers_[slot]->write_buffer; + if (!producer_buffer) return -ENOMEM; - if (width_ == buffer_producer->width() && - height_ == buffer_producer->height() && - format_ == buffer_producer->format()) { + if (width_ == producer_buffer->width() && + height_ == producer_buffer->height() && + format_ == producer_buffer->format()) { // Producer queue returns a buffer matches the current request. break; } @@ -122,14 +122,14 @@ int DvrWriteBufferQueue::GainBuffer(int timeout, "DvrWriteBufferQueue::Dequeue: requested buffer at slot: %zu " "(w=%u, h=%u, fmt=%u) is different from the buffer returned " "(w=%u, h=%u, fmt=%u). Need re-allocation.", - slot, width_, height_, format_, buffer_producer->width(), - buffer_producer->height(), buffer_producer->format()); + slot, width_, height_, format_, producer_buffer->width(), + producer_buffer->height(), producer_buffer->format()); // Currently, we are not storing |layer_count| and |usage| in queue // configuration. Copy those setup from the last buffer dequeued before we // remove it. - uint32_t old_layer_count = buffer_producer->layer_count(); - uint64_t old_usage = buffer_producer->usage(); + uint32_t old_layer_count = producer_buffer->layer_count(); + uint64_t old_usage = producer_buffer->usage(); // Allocate a new producer buffer with new buffer configs. Note that if // there are already multiple available buffers in the queue, the next one @@ -443,7 +443,7 @@ void DvrReadBufferQueue::SetBufferRemovedCallback( // When buffer is removed from the queue, the slot is already invalid. auto read_buffer = std::make_unique<DvrReadBuffer>(); read_buffer->read_buffer = - std::static_pointer_cast<BufferConsumer>(buffer); + std::static_pointer_cast<ConsumerBuffer>(buffer); callback(read_buffer.release(), context); }); } diff --git a/libs/vr/libdvr/dvr_display_manager.cpp b/libs/vr/libdvr/dvr_display_manager.cpp index fe91b14679..7f631e3d39 100644 --- a/libs/vr/libdvr/dvr_display_manager.cpp +++ b/libs/vr/libdvr/dvr_display_manager.cpp @@ -10,10 +10,10 @@ #include "dvr_internal.h" #include "dvr_buffer_queue_internal.h" -using android::dvr::BufferConsumer; +using android::dvr::ConsumerBuffer; using android::dvr::display::DisplayManagerClient; -using android::dvr::display::SurfaceAttributes; using android::dvr::display::SurfaceAttribute; +using android::dvr::display::SurfaceAttributes; using android::dvr::display::SurfaceState; using android::pdx::rpc::EmptyVariant; diff --git a/libs/vr/libdvr/dvr_internal.h b/libs/vr/libdvr/dvr_internal.h index df8125a414..f845cd896d 100644 --- a/libs/vr/libdvr/dvr_internal.h +++ b/libs/vr/libdvr/dvr_internal.h @@ -16,21 +16,11 @@ typedef struct DvrWriteBuffer DvrWriteBuffer; namespace android { namespace dvr { -// TODO(b/116855254): Remove this typedef once rename is complete in libdvr. -// Note that the dvr::BufferProducer and dvr::BufferConsumer were poorly named, -// they should really be named as ProducerBuffer and ConsumerBuffer. -typedef class ProducerBuffer BufferProducer; -typedef class ConsumerBuffer BufferConsumer; class IonBuffer; DvrBuffer* CreateDvrBufferFromIonBuffer( const std::shared_ptr<IonBuffer>& ion_buffer); -DvrReadBuffer* CreateDvrReadBufferFromBufferConsumer( - const std::shared_ptr<BufferConsumer>& buffer_consumer); -DvrWriteBuffer* CreateDvrWriteBufferFromBufferProducer( - const std::shared_ptr<BufferProducer>& buffer_producer); - } // namespace dvr } // namespace android @@ -42,7 +32,7 @@ struct DvrWriteBuffer { // DvrWriteBuffer acquired from a DvrWriteBufferQueue. int32_t slot = -1; - std::shared_ptr<android::dvr::BufferProducer> write_buffer; + std::shared_ptr<android::dvr::ProducerBuffer> write_buffer; }; struct DvrReadBuffer { @@ -51,7 +41,7 @@ struct DvrReadBuffer { // DvrReadBuffer acquired from a DvrReadBufferQueue. int32_t slot = -1; - std::shared_ptr<android::dvr::BufferConsumer> read_buffer; + std::shared_ptr<android::dvr::ConsumerBuffer> read_buffer; }; struct DvrBuffer { diff --git a/libs/vr/libdvr/dvr_surface.cpp b/libs/vr/libdvr/dvr_surface.cpp index a3a47f10f5..0c7ec01640 100644 --- a/libs/vr/libdvr/dvr_surface.cpp +++ b/libs/vr/libdvr/dvr_surface.cpp @@ -14,7 +14,6 @@ using android::dvr::display::DisplayClient; using android::dvr::display::Surface; using android::dvr::display::SurfaceAttributes; using android::dvr::display::SurfaceAttributeValue; -using android::dvr::CreateDvrReadBufferFromBufferConsumer; using android::pdx::rpc::EmptyVariant; namespace { diff --git a/libs/vr/libvrflinger/acquired_buffer.cpp b/libs/vr/libvrflinger/acquired_buffer.cpp index 5d873d15c9..c360deed5b 100644 --- a/libs/vr/libvrflinger/acquired_buffer.cpp +++ b/libs/vr/libvrflinger/acquired_buffer.cpp @@ -8,11 +8,11 @@ using android::pdx::LocalHandle; namespace android { namespace dvr { -AcquiredBuffer::AcquiredBuffer(const std::shared_ptr<BufferConsumer>& buffer, +AcquiredBuffer::AcquiredBuffer(const std::shared_ptr<ConsumerBuffer>& buffer, LocalHandle acquire_fence, std::size_t slot) : buffer_(buffer), acquire_fence_(std::move(acquire_fence)), slot_(slot) {} -AcquiredBuffer::AcquiredBuffer(const std::shared_ptr<BufferConsumer>& buffer, +AcquiredBuffer::AcquiredBuffer(const std::shared_ptr<ConsumerBuffer>& buffer, int* error) { LocalHandle fence; const int ret = buffer->Acquire(&fence); @@ -75,7 +75,7 @@ LocalHandle AcquiredBuffer::ClaimAcquireFence() { return std::move(acquire_fence_); } -std::shared_ptr<BufferConsumer> AcquiredBuffer::ClaimBuffer() { +std::shared_ptr<ConsumerBuffer> AcquiredBuffer::ClaimBuffer() { return std::move(buffer_); } diff --git a/libs/vr/libvrflinger/acquired_buffer.h b/libs/vr/libvrflinger/acquired_buffer.h index 9e35a39bfd..7643e75ecf 100644 --- a/libs/vr/libvrflinger/acquired_buffer.h +++ b/libs/vr/libvrflinger/acquired_buffer.h @@ -9,42 +9,42 @@ namespace android { namespace dvr { -// Manages the ACQUIRE/RELEASE ownership cycle of a BufferConsumer. +// Manages the ACQUIRE/RELEASE ownership cycle of a ConsumerBuffer. class AcquiredBuffer { public: static constexpr int kEmptyFence = pdx::LocalHandle::kEmptyFileHandle; AcquiredBuffer() : buffer_(nullptr), acquire_fence_(kEmptyFence) {} - // Constructs an AcquiredBuffer from a BufferConsumer pointer and an acquire - // fence. The BufferConsumer MUST be in the ACQUIRED state prior to calling + // Constructs an AcquiredBuffer from a ConsumerBuffer pointer and an acquire + // fence. The ConsumerBuffer MUST be in the ACQUIRED state prior to calling // this constructor; the constructor does not attempt to ACQUIRE the buffer // itself. - AcquiredBuffer(const std::shared_ptr<BufferConsumer>& buffer, + AcquiredBuffer(const std::shared_ptr<ConsumerBuffer>& buffer, pdx::LocalHandle acquire_fence, std::size_t slot = 0); - // Constructs an AcquiredBuffer from a BufferConsumer. The BufferConsumer MUST + // Constructs an AcquiredBuffer from a ConsumerBuffer. The ConsumerBuffer MUST // be in the POSTED state prior to calling this constructor, as this // constructor attempts to ACQUIRE the buffer. If ACQUIRING the buffer fails // this instance is left in the empty state. An optional error code is // returned in |error|, which may be nullptr if not needed. - AcquiredBuffer(const std::shared_ptr<BufferConsumer>& buffer, int* error); + AcquiredBuffer(const std::shared_ptr<ConsumerBuffer>& buffer, int* error); // Move constructor. Behaves similarly to the move assignment operator below. AcquiredBuffer(AcquiredBuffer&& other) noexcept; ~AcquiredBuffer(); - // Move assignment operator. Moves the BufferConsumer and acquire fence from - // |other| into this instance after RELEASING the current BufferConsumer and + // Move assignment operator. Moves the ConsumerBuffer and acquire fence from + // |other| into this instance after RELEASING the current ConsumerBuffer and // closing the acquire fence. After the move |other| is left in the empty // state. AcquiredBuffer& operator=(AcquiredBuffer&& other) noexcept; - // Accessors for the underlying BufferConsumer, the acquire fence, and the + // Accessors for the underlying ConsumerBuffer, the acquire fence, and the // use-case specific sequence value from the acquisition (see // private/dvr/consumer_buffer.h). - std::shared_ptr<BufferConsumer> buffer() const { return buffer_; } + std::shared_ptr<ConsumerBuffer> buffer() const { return buffer_; } int acquire_fence() const { return acquire_fence_.Get(); } // When non-empty, returns true if the acquired fence was signaled (or if the @@ -58,11 +58,11 @@ class AcquiredBuffer { // Returns the buffer, passing ownership to the caller. Caller is responsible // for calling Release on the returned buffer. - std::shared_ptr<BufferConsumer> ClaimBuffer(); + std::shared_ptr<ConsumerBuffer> ClaimBuffer(); - // Releases the BufferConsumer, passing the release fence in |release_fence| - // to the producer. On success, the BufferConsumer and acquire fence are set - // to empty state; if release fails, the BufferConsumer and acquire fence are + // Releases the ConsumerBuffer, passing the release fence in |release_fence| + // to the producer. On success, the ConsumerBuffer and acquire fence are set + // to empty state; if release fails, the ConsumerBuffer and acquire fence are // left in place and a negative error code is returned. int Release(pdx::LocalHandle release_fence = {}); @@ -71,7 +71,7 @@ class AcquiredBuffer { std::size_t slot() const { return slot_; } private: - std::shared_ptr<BufferConsumer> buffer_; + std::shared_ptr<ConsumerBuffer> buffer_; // Mutable so that the fence can be closed when it is determined to be // signaled during IsAvailable(). mutable pdx::LocalHandle acquire_fence_; diff --git a/libs/vr/libvrsensor/pose_client.cpp b/libs/vr/libvrsensor/pose_client.cpp index c72f75e69c..4ff6a0912c 100644 --- a/libs/vr/libvrsensor/pose_client.cpp +++ b/libs/vr/libvrsensor/pose_client.cpp @@ -221,7 +221,7 @@ class PoseClient : public pdx::ClientBase<PoseClient> { return -status.error(); } - auto buffer = BufferConsumer::Import(status.take()); + auto buffer = ConsumerBuffer::Import(status.take()); if (!buffer) { ALOGE("Pose failed to import ring buffer"); return -EIO; @@ -290,7 +290,7 @@ class PoseClient : public pdx::ClientBase<PoseClient> { const DvrVsyncPoseBuffer* mapped_vsync_pose_buffer_ = nullptr; struct ControllerClientState { - std::unique_ptr<BufferConsumer> pose_buffer; + std::unique_ptr<ConsumerBuffer> pose_buffer; const DvrPoseAsync* mapped_pose_buffer = nullptr; }; ControllerClientState controllers_[MAX_CONTROLLERS]; diff --git a/services/vr/bufferhubd/include/private/dvr/buffer_hub.h b/services/vr/bufferhubd/include/private/dvr/buffer_hub.h index 676617d902..01520fc2ae 100644 --- a/services/vr/bufferhubd/include/private/dvr/buffer_hub.h +++ b/services/vr/bufferhubd/include/private/dvr/buffer_hub.h @@ -41,12 +41,12 @@ class BufferHubChannel : public pdx::Channel { // Captures buffer info for use by BufferHubService::DumpState(). struct BufferInfo { - // Common data field shared by BufferProducer and ProducerQueue. + // Common data field shared by ProducerBuffer and ProducerQueue. int id = -1; int type = -1; size_t consumer_count = 0; - // Data field for buffer producer. + // Data field for producer buffer. uint32_t width = 0; uint32_t height = 0; uint32_t layer_count = 0; diff --git a/services/vr/bufferhubd/include/private/dvr/producer_queue_channel.h b/services/vr/bufferhubd/include/private/dvr/producer_queue_channel.h index c4003da419..0456ad8a39 100644 --- a/services/vr/bufferhubd/include/private/dvr/producer_queue_channel.h +++ b/services/vr/bufferhubd/include/private/dvr/producer_queue_channel.h @@ -37,11 +37,11 @@ class ProducerQueueChannel : public BufferHubChannel { uint32_t format, uint64_t usage, size_t buffer_count); - // Inserts a BufferProducer into the queue. Note that the buffer must be in + // Inserts a ProducerBuffer into the queue. Note that the buffer must be in // Gain'ed state for the operation to succeed. pdx::Status<size_t> OnProducerQueueInsertBuffer(pdx::Message& message, int buffer_cid); - // Removes a BufferProducer indicated by |slot|. Note that the buffer must be + // Removes a ProducerBuffer indicated by |slot|. Note that the buffer must be // in Gain'ed state for the operation to succeed. pdx::Status<void> OnProducerQueueRemoveBuffer(pdx::Message& message, size_t slot); diff --git a/services/vr/bufferhubd/producer_channel.cpp b/services/vr/bufferhubd/producer_channel.cpp index 5c484b8505..2a6e9da389 100644 --- a/services/vr/bufferhubd/producer_channel.cpp +++ b/services/vr/bufferhubd/producer_channel.cpp @@ -455,7 +455,7 @@ Status<LocalFence> ProducerChannel::OnProducerGain(Message& /*message*/) { uint32_t buffer_state = buffer_state_->load(std::memory_order_acquire); if (!BufferHubDefs::IsClientGained( buffer_state, BufferHubDefs::kFirstClientStateMask)) { - // Can only detach a BufferProducer when it's in gained state. + // Can only detach a ProducerBuffer when it's in gained state. ALOGW( "ProducerChannel::OnProducerDetach: The buffer (id=%d, state=%" PRIx32 |