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

Commit 0a1926e2 authored by Carlos Martinez Romero's avatar Carlos Martinez Romero Committed by Android (Google) Code Review
Browse files

Merge "Add addReleaseFence API to ConsumerBase." into main

parents e07d8df1 0c9ce843
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -385,6 +385,26 @@ status_t ConsumerBase::detachBuffer(const sp<GraphicBuffer>& buffer) {
}
#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)

status_t ConsumerBase::addReleaseFence(const sp<GraphicBuffer> buffer, const sp<Fence>& fence) {
    CB_LOGV("addReleaseFence");
    Mutex::Autolock lock(mMutex);

    if (mAbandoned) {
        CB_LOGE("addReleaseFence: ConsumerBase is abandoned!");
        return NO_INIT;
    }
    if (buffer == nullptr) {
        return BAD_VALUE;
    }

    int slotIndex = getSlotForBufferLocked(buffer);
    if (slotIndex == BufferQueue::INVALID_BUFFER_SLOT) {
        return BAD_VALUE;
    }

    return addReleaseFenceLocked(slotIndex, buffer, fence);
}

status_t ConsumerBase::setDefaultBufferSize(uint32_t width, uint32_t height) {
    Mutex::Autolock _l(mMutex);
    if (mAbandoned) {
+2 −0
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@ public:
    status_t detachBuffer(const sp<GraphicBuffer>& buffer);
#endif // COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(WB_PLATFORM_API_IMPROVEMENTS)

    status_t addReleaseFence(const sp<GraphicBuffer> buffer, const sp<Fence>& fence);

    // See IGraphicBufferConsumer::setDefaultBufferSize
    status_t setDefaultBufferSize(uint32_t width, uint32_t height);