Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d37e2b0 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5075986 from b376e445 to qt-release

Change-Id: I917faa820934e9a51562b4f0fbcfc74595f16537
parents 3739b35d b376e445
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
 *
+3 −3
Original line number Diff line number Diff line
@@ -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:
+1 −12
Original line number Diff line number Diff line
@@ -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;
+1 −22
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@

#include <poll.h>

using android::dvr::BufferHubMetadata;
using android::dvr::BufferTraits;
using android::dvr::DetachedBufferRPC;
using android::dvr::NativeHandleWrapper;
@@ -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(),
@@ -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);
+2 −4
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include <ui/BufferHubMetadata.h>

namespace android {
namespace dvr {

namespace {

@@ -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) {
@@ -101,5 +100,4 @@ BufferHubMetadata::~BufferHubMetadata() {
    }
}

} // namespace dvr
} // namespace android
Loading