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

Commit 649449db authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "Add SurfaceControl::disconnect() to disconnect currently connected API" into nyc-dev

parents 0258add8 1b3a9acb
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -67,8 +67,13 @@ public:
    // consumer can run asynchronously.
    enum { MAX_MAX_ACQUIRED_BUFFERS = BufferQueueDefs::NUM_BUFFER_SLOTS - 2 };

    // The default API number used to indicate that no producer is connected
    enum { NO_CONNECTED_API = 0 };
    enum {
        // The API number used to indicate the currently connected producer
        CURRENTLY_CONNECTED_API = -1,

        // The API number used to indicate that no producer is connected
        NO_CONNECTED_API        = 0,
    };

    typedef Vector<BufferItem> Fifo;

+3 −0
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@ public:
    // release surface data from java
    void        clear();

    // disconnect any api that's connected
    void        disconnect();

    status_t    setLayerStack(uint32_t layerStack);
    status_t    setLayer(uint32_t layer);
    status_t    setPosition(float x, float y);
+4 −0
Original line number Diff line number Diff line
@@ -1115,6 +1115,10 @@ status_t BufferQueueProducer::disconnect(int api) {
            return NO_ERROR;
        }

        if (api == BufferQueueCore::CURRENTLY_CONNECTED_API) {
            api = mCore->mConnectedApi;
        }

        switch (api) {
            case NATIVE_WINDOW_API_EGL:
            case NATIVE_WINDOW_API_CPU:
+8 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <ui/GraphicBuffer.h>
#include <ui/Rect.h>

#include <gui/BufferQueueCore.h>
#include <gui/ISurfaceComposer.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
@@ -81,6 +82,13 @@ void SurfaceControl::clear()
    destroy();
}

void SurfaceControl::disconnect() {
    if (mGraphicBufferProducer != NULL) {
        mGraphicBufferProducer->disconnect(
                BufferQueueCore::CURRENTLY_CONNECTED_API);
    }
}

bool SurfaceControl::isSameSurface(
        const sp<SurfaceControl>& lhs, const sp<SurfaceControl>& rhs)
{