Loading include/android/sharedmem.h +2 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,8 @@ size_t ASharedMemory_getSize(int fd) __INTRODUCED_IN(26); * int fd = ASharedMemory_create("memory", 128); * * // By default it has PROT_READ | PROT_WRITE | PROT_EXEC. * char *buffer = (char *) mmap(NULL, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); * size_t memSize = ASharedMemory_getSize(fd); * char *buffer = (char *) mmap(NULL, memSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); * * strcpy(buffer, "This is an example."); // trivially initialize content * Loading libs/binder/ndk/include_ndk/android/binder_interface_utils.h +3 −3 Original line number Diff line number Diff line Loading @@ -42,8 +42,8 @@ namespace ndk { /** * analog using std::shared_ptr for internally held refcount * * ref must be called at least one time during the lifetime of this object. The recommended way to construct * this object is with SharedRefBase::make. * ref must be called at least one time during the lifetime of this object. The recommended way to * construct this object is with SharedRefBase::make. */ class SharedRefBase { public: Loading libs/gui/BufferHubProducer.cpp +1 −12 Original line number Diff line number Diff line Loading @@ -400,19 +400,8 @@ status_t BufferHubProducer::attachBuffer(int* out_slot, const sp<GraphicBuffer>& ALOGE("attachBuffer: DetachedBufferHandle cannot be NULL."); return BAD_VALUE; } auto detached_buffer = BufferHubBuffer::Import(std::move(detached_handle->handle())); if (detached_buffer == nullptr) { ALOGE("attachBuffer: BufferHubBuffer cannot be NULL."); return BAD_VALUE; } auto status_or_handle = detached_buffer->Promote(); if (!status_or_handle.ok()) { ALOGE("attachBuffer: Failed to promote a BufferHubBuffer into a BufferProducer, error=%d.", status_or_handle.error()); return BAD_VALUE; } std::shared_ptr<BufferProducer> buffer_producer = BufferProducer::Import(status_or_handle.take()); BufferProducer::Import(std::move(detached_handle->handle())); if (buffer_producer == nullptr) { ALOGE("attachBuffer: Failed to import BufferProducer."); return BAD_VALUE; Loading libs/ui/BufferHubBuffer.cpp +1 −22 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ #include <poll.h> using android::dvr::BufferHubMetadata; using android::dvr::BufferTraits; using android::dvr::DetachedBufferRPC; using android::dvr::NativeHandleWrapper; Loading Loading @@ -160,7 +159,7 @@ int BufferHubBuffer::ImportGraphicBuffer() { // If all imports succeed, replace the previous buffer and id. mId = bufferId; mBfferStateBit = bufferTraits.buffer_state_bit(); mBufferStateBit = bufferTraits.buffer_state_bit(); // TODO(b/112012161) Set up shared fences. ALOGD("BufferHubBuffer::ImportGraphicBuffer: id=%d, buffer_state=%" PRIx64 ".", id(), Loading @@ -175,26 +174,6 @@ int BufferHubBuffer::Poll(int timeoutMs) { return poll(&p, 1, timeoutMs); } Status<LocalChannelHandle> BufferHubBuffer::Promote() { ATRACE_CALL(); // TODO(b/112338294) remove after migrate producer buffer to binder ALOGW("BufferHubBuffer::Promote: not supported operation during migration"); return {}; ALOGD("BufferHubBuffer::Promote: id=%d.", mId); auto statusOrHandle = mClient.InvokeRemoteMethod<DetachedBufferRPC::Promote>(); if (statusOrHandle.ok()) { // Invalidate the buffer. mBufferHandle = {}; } else { ALOGE("BufferHubBuffer::Promote: Failed to promote buffer (id=%d): %s.", mId, statusOrHandle.GetErrorMessage().c_str()); } return statusOrHandle; } Status<LocalChannelHandle> BufferHubBuffer::Duplicate() { ATRACE_CALL(); ALOGD("BufferHubBuffer::Duplicate: id=%d.", mId); Loading libs/ui/BufferHubMetadata.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include <ui/BufferHubMetadata.h> namespace android { namespace dvr { namespace { Loading @@ -30,8 +29,8 @@ static const int kAshmemProt = PROT_READ | PROT_WRITE; } // namespace using BufferHubDefs::kMetadataHeaderSize; using BufferHubDefs::MetadataHeader; using dvr::BufferHubDefs::kMetadataHeaderSize; using dvr::BufferHubDefs::MetadataHeader; /* static */ BufferHubMetadata BufferHubMetadata::Create(size_t userMetadataSize) { Loading Loading @@ -101,5 +100,4 @@ BufferHubMetadata::~BufferHubMetadata() { } } } // namespace dvr } // namespace android Loading
include/android/sharedmem.h +2 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,8 @@ size_t ASharedMemory_getSize(int fd) __INTRODUCED_IN(26); * int fd = ASharedMemory_create("memory", 128); * * // By default it has PROT_READ | PROT_WRITE | PROT_EXEC. * char *buffer = (char *) mmap(NULL, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); * size_t memSize = ASharedMemory_getSize(fd); * char *buffer = (char *) mmap(NULL, memSize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); * * strcpy(buffer, "This is an example."); // trivially initialize content * Loading
libs/binder/ndk/include_ndk/android/binder_interface_utils.h +3 −3 Original line number Diff line number Diff line Loading @@ -42,8 +42,8 @@ namespace ndk { /** * analog using std::shared_ptr for internally held refcount * * ref must be called at least one time during the lifetime of this object. The recommended way to construct * this object is with SharedRefBase::make. * ref must be called at least one time during the lifetime of this object. The recommended way to * construct this object is with SharedRefBase::make. */ class SharedRefBase { public: Loading
libs/gui/BufferHubProducer.cpp +1 −12 Original line number Diff line number Diff line Loading @@ -400,19 +400,8 @@ status_t BufferHubProducer::attachBuffer(int* out_slot, const sp<GraphicBuffer>& ALOGE("attachBuffer: DetachedBufferHandle cannot be NULL."); return BAD_VALUE; } auto detached_buffer = BufferHubBuffer::Import(std::move(detached_handle->handle())); if (detached_buffer == nullptr) { ALOGE("attachBuffer: BufferHubBuffer cannot be NULL."); return BAD_VALUE; } auto status_or_handle = detached_buffer->Promote(); if (!status_or_handle.ok()) { ALOGE("attachBuffer: Failed to promote a BufferHubBuffer into a BufferProducer, error=%d.", status_or_handle.error()); return BAD_VALUE; } std::shared_ptr<BufferProducer> buffer_producer = BufferProducer::Import(status_or_handle.take()); BufferProducer::Import(std::move(detached_handle->handle())); if (buffer_producer == nullptr) { ALOGE("attachBuffer: Failed to import BufferProducer."); return BAD_VALUE; Loading
libs/ui/BufferHubBuffer.cpp +1 −22 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ #include <poll.h> using android::dvr::BufferHubMetadata; using android::dvr::BufferTraits; using android::dvr::DetachedBufferRPC; using android::dvr::NativeHandleWrapper; Loading Loading @@ -160,7 +159,7 @@ int BufferHubBuffer::ImportGraphicBuffer() { // If all imports succeed, replace the previous buffer and id. mId = bufferId; mBfferStateBit = bufferTraits.buffer_state_bit(); mBufferStateBit = bufferTraits.buffer_state_bit(); // TODO(b/112012161) Set up shared fences. ALOGD("BufferHubBuffer::ImportGraphicBuffer: id=%d, buffer_state=%" PRIx64 ".", id(), Loading @@ -175,26 +174,6 @@ int BufferHubBuffer::Poll(int timeoutMs) { return poll(&p, 1, timeoutMs); } Status<LocalChannelHandle> BufferHubBuffer::Promote() { ATRACE_CALL(); // TODO(b/112338294) remove after migrate producer buffer to binder ALOGW("BufferHubBuffer::Promote: not supported operation during migration"); return {}; ALOGD("BufferHubBuffer::Promote: id=%d.", mId); auto statusOrHandle = mClient.InvokeRemoteMethod<DetachedBufferRPC::Promote>(); if (statusOrHandle.ok()) { // Invalidate the buffer. mBufferHandle = {}; } else { ALOGE("BufferHubBuffer::Promote: Failed to promote buffer (id=%d): %s.", mId, statusOrHandle.GetErrorMessage().c_str()); } return statusOrHandle; } Status<LocalChannelHandle> BufferHubBuffer::Duplicate() { ATRACE_CALL(); ALOGD("BufferHubBuffer::Duplicate: id=%d.", mId); Loading
libs/ui/BufferHubMetadata.cpp +2 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include <ui/BufferHubMetadata.h> namespace android { namespace dvr { namespace { Loading @@ -30,8 +29,8 @@ static const int kAshmemProt = PROT_READ | PROT_WRITE; } // namespace using BufferHubDefs::kMetadataHeaderSize; using BufferHubDefs::MetadataHeader; using dvr::BufferHubDefs::kMetadataHeaderSize; using dvr::BufferHubDefs::MetadataHeader; /* static */ BufferHubMetadata BufferHubMetadata::Create(size_t userMetadataSize) { Loading Loading @@ -101,5 +100,4 @@ BufferHubMetadata::~BufferHubMetadata() { } } } // namespace dvr } // namespace android