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

Commit 1436aefc authored by Peter Collingbourne's avatar Peter Collingbourne
Browse files

Remove bufferhub support from libgui.

As far as I can tell the bufferhub support in libgui was never completed,
and it is unused except for tests and the libdvr library (which is
also unused except for benchmarks and tests, which I also removed,
and its headers which I kept for now). This will allow building the
platform with newer compilers that diagnose invalid code in libpdx,
one of bufferhub's dependencies.

Bug: 246977679
Change-Id: Iff5f879c2bb5583e789a604d64638e8ce7d2b2c5
parent 58864fd3
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
@@ -177,8 +177,6 @@ cc_library_shared {

        "BitTube.cpp",
        "BLASTBufferQueue.cpp",
        "BufferHubConsumer.cpp",
        "BufferHubProducer.cpp",
        "BufferItemConsumer.cpp",
        "ConsumerBase.cpp",
        "CpuConsumer.cpp",
@@ -216,9 +214,6 @@ cc_library_shared {

    shared_libs: [
        "libbinder",
        "libbufferhub",
        "libbufferhubqueue", // TODO(b/70046255): Remove this once BufferHub is integrated into libgui.
        "libpdx_default_transport",
    ],

    export_shared_lib_headers: [
@@ -229,24 +224,6 @@ cc_library_shared {
        "libgui_aidl_headers",
    ],

    // bufferhub is not used when building libgui for vendors
    target: {
        vendor: {
            cflags: [
                "-DNO_BUFFERHUB",
            ],
            exclude_srcs: [
                "BufferHubConsumer.cpp",
                "BufferHubProducer.cpp",
            ],
            exclude_shared_libs: [
                "libbufferhub",
                "libbufferhubqueue",
                "libpdx_default_transport",
            ],
        },
    },

    aidl: {
        export_aidl_headers: true,
    },
@@ -276,7 +253,6 @@ cc_library_static {
    min_sdk_version: "29",

    cflags: [
        "-DNO_BUFFERHUB",
        "-DNO_BINDER",
    ],

libs/gui/BufferHubConsumer.cpp

deleted100644 → 0
+0 −161
Original line number Diff line number Diff line
/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gui/BufferHubConsumer.h>

namespace android {

using namespace dvr;

/* static */
sp<BufferHubConsumer> BufferHubConsumer::Create(const std::shared_ptr<ConsumerQueue>& queue) {
    sp<BufferHubConsumer> consumer = new BufferHubConsumer;
    consumer->mQueue = queue;
    return consumer;
}

/* static */ sp<BufferHubConsumer> BufferHubConsumer::Create(ConsumerQueueParcelable parcelable) {
    if (!parcelable.IsValid()) {
        ALOGE("BufferHubConsumer::Create: Invalid consumer parcelable.");
        return nullptr;
    }

    sp<BufferHubConsumer> consumer = new BufferHubConsumer;
    consumer->mQueue = ConsumerQueue::Import(parcelable.TakeChannelHandle());
    return consumer;
}

status_t BufferHubConsumer::acquireBuffer(BufferItem* /*buffer*/, nsecs_t /*presentWhen*/,
                                          uint64_t /*maxFrameNumber*/) {
    ALOGE("BufferHubConsumer::acquireBuffer: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::detachBuffer(int /*slot*/) {
    ALOGE("BufferHubConsumer::detachBuffer: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::attachBuffer(int* /*outSlot*/, const sp<GraphicBuffer>& /*buffer*/) {
    ALOGE("BufferHubConsumer::attachBuffer: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::releaseBuffer(int /*buf*/, uint64_t /*frameNumber*/,
                                          EGLDisplay /*display*/, EGLSyncKHR /*fence*/,
                                          const sp<Fence>& /*releaseFence*/) {
    ALOGE("BufferHubConsumer::releaseBuffer: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::consumerConnect(const sp<IConsumerListener>& /*consumer*/,
                                            bool /*controlledByApp*/) {
    ALOGE("BufferHubConsumer::consumerConnect: not implemented.");

    // TODO(b/73267953): Make BufferHub honor producer and consumer connection. Returns NO_ERROR to
    // make IGraphicBufferConsumer_test happy.
    return NO_ERROR;
}

status_t BufferHubConsumer::consumerDisconnect() {
    ALOGE("BufferHubConsumer::consumerDisconnect: not implemented.");

    // TODO(b/73267953): Make BufferHub honor producer and consumer connection. Returns NO_ERROR to
    // make IGraphicBufferConsumer_test happy.
    return NO_ERROR;
}

status_t BufferHubConsumer::getReleasedBuffers(uint64_t* /*slotMask*/) {
    ALOGE("BufferHubConsumer::getReleasedBuffers: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::setDefaultBufferSize(uint32_t /*w*/, uint32_t /*h*/) {
    ALOGE("BufferHubConsumer::setDefaultBufferSize: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::setMaxBufferCount(int /*bufferCount*/) {
    ALOGE("BufferHubConsumer::setMaxBufferCount: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::setMaxAcquiredBufferCount(int /*maxAcquiredBuffers*/) {
    ALOGE("BufferHubConsumer::setMaxAcquiredBufferCount: not implemented.");

    // TODO(b/73267953): Make BufferHub honor producer and consumer connection. Returns NO_ERROR to
    // make IGraphicBufferConsumer_test happy.
    return NO_ERROR;
}

status_t BufferHubConsumer::setConsumerName(const String8& /*name*/) {
    ALOGE("BufferHubConsumer::setConsumerName: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::setDefaultBufferFormat(PixelFormat /*defaultFormat*/) {
    ALOGE("BufferHubConsumer::setDefaultBufferFormat: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::setDefaultBufferDataSpace(android_dataspace /*defaultDataSpace*/) {
    ALOGE("BufferHubConsumer::setDefaultBufferDataSpace: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::setConsumerUsageBits(uint64_t /*usage*/) {
    ALOGE("BufferHubConsumer::setConsumerUsageBits: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::setConsumerIsProtected(bool /*isProtected*/) {
    ALOGE("BufferHubConsumer::setConsumerIsProtected: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::setTransformHint(uint32_t /*hint*/) {
    ALOGE("BufferHubConsumer::setTransformHint: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::getSidebandStream(sp<NativeHandle>* /*outStream*/) const {
    ALOGE("BufferHubConsumer::getSidebandStream: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::getOccupancyHistory(
        bool /*forceFlush*/, std::vector<OccupancyTracker::Segment>* /*outHistory*/) {
    ALOGE("BufferHubConsumer::getOccupancyHistory: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::discardFreeBuffers() {
    ALOGE("BufferHubConsumer::discardFreeBuffers: not implemented.");
    return INVALID_OPERATION;
}

status_t BufferHubConsumer::dumpState(const String8& /*prefix*/, String8* /*outResult*/) const {
    ALOGE("BufferHubConsumer::dumpState: not implemented.");
    return INVALID_OPERATION;
}

IBinder* BufferHubConsumer::onAsBinder() {
    ALOGE("BufferHubConsumer::onAsBinder: BufferHubConsumer should never be used as an Binder "
          "object.");
    return nullptr;
}

} // namespace android

libs/gui/BufferHubProducer.cpp

deleted100644 → 0
+0 −868

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −33
Original line number Diff line number Diff line
@@ -18,11 +18,6 @@
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
//#define LOG_NDEBUG 0

#ifndef NO_BUFFERHUB
#include <gui/BufferHubConsumer.h>
#include <gui/BufferHubProducer.h>
#endif

#include <gui/BufferQueue.h>
#include <gui/BufferQueueConsumer.h>
#include <gui/BufferQueueCore.h>
@@ -127,32 +122,4 @@ void BufferQueue::createBufferQueue(sp<IGraphicBufferProducer>* outProducer,
    *outConsumer = consumer;
}

#ifndef NO_BUFFERHUB
void BufferQueue::createBufferHubQueue(sp<IGraphicBufferProducer>* outProducer,
                                       sp<IGraphicBufferConsumer>* outConsumer) {
    LOG_ALWAYS_FATAL_IF(outProducer == nullptr, "BufferQueue: outProducer must not be NULL");
    LOG_ALWAYS_FATAL_IF(outConsumer == nullptr, "BufferQueue: outConsumer must not be NULL");

    sp<IGraphicBufferProducer> producer;
    sp<IGraphicBufferConsumer> consumer;

    dvr::ProducerQueueConfigBuilder configBuilder;
    std::shared_ptr<dvr::ProducerQueue> producerQueue =
            dvr::ProducerQueue::Create(configBuilder.Build(), dvr::UsagePolicy{});
    LOG_ALWAYS_FATAL_IF(producerQueue == nullptr, "BufferQueue: failed to create ProducerQueue.");

    std::shared_ptr<dvr::ConsumerQueue> consumerQueue = producerQueue->CreateConsumerQueue();
    LOG_ALWAYS_FATAL_IF(consumerQueue == nullptr, "BufferQueue: failed to create ConsumerQueue.");

    producer = BufferHubProducer::Create(producerQueue);
    consumer = BufferHubConsumer::Create(consumerQueue);

    LOG_ALWAYS_FATAL_IF(producer == nullptr, "BufferQueue: failed to create BufferQueueProducer");
    LOG_ALWAYS_FATAL_IF(consumer == nullptr, "BufferQueue: failed to create BufferQueueConsumer");

    *outProducer = producer;
    *outConsumer = consumer;
}
#endif

}; // namespace android
+0 −14
Original line number Diff line number Diff line
@@ -27,10 +27,6 @@
#include <binder/Parcel.h>
#include <binder/IInterface.h>

#ifndef NO_BUFFERHUB
#include <gui/BufferHubProducer.h>
#endif

#include <gui/bufferqueue/1.0/H2BGraphicBufferProducer.h>
#include <gui/bufferqueue/2.0/H2BGraphicBufferProducer.h>
#include <gui/BufferQueueDefs.h>
@@ -1012,17 +1008,7 @@ sp<IGraphicBufferProducer> IGraphicBufferProducer::createFromParcel(const Parcel
        }
        case USE_BUFFER_HUB: {
            ALOGE("createFromParcel: BufferHub not implemented.");
#ifndef NO_BUFFERHUB
            dvr::ProducerQueueParcelable producerParcelable;
            res = producerParcelable.readFromParcel(parcel);
            if (res != NO_ERROR) {
                ALOGE("createFromParcel: Failed to read from parcel, error=%d", res);
                return nullptr;
            }
            return BufferHubProducer::Create(std::move(producerParcelable));
#else
            return nullptr;
#endif
        }
        default: {
            ALOGE("createFromParcel: Unexpected mgaic: 0x%x.", outMagic);
Loading