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

Commit 52f82ade authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by Android (Google) Code Review
Browse files

Merge "BufferQueue consumers: Add discardFreeBuffer method" into nyc-mr1-dev

parents 3dd1045c bc2df65a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -140,6 +140,9 @@ public:
    virtual status_t getOccupancyHistory(bool forceFlush,
            std::vector<OccupancyTracker::Segment>* outHistory) override;

    // See IGraphicBufferConsumer::discardFreeBuffers
    virtual status_t discardFreeBuffers() override;

    // dump our state in a String
    virtual void dump(String8& result, const char* prefix) const;

+5 −0
Original line number Diff line number Diff line
@@ -125,6 +125,11 @@ private:
    // all slots, even if they're currently dequeued, queued, or acquired.
    void freeAllBuffersLocked();

    // discardFreeBuffersLocked releases all currently-free buffers held by the
    // queue, in order to reduce the memory consumption of the queue to the
    // minimum possible without discarding data.
    void discardFreeBuffersLocked();

    // If delta is positive, makes more slots available. If negative, takes
    // away slots. Returns false if the request can't be met.
    bool adjustAvailableSlotsLocked(int delta);
+3 −0
Original line number Diff line number Diff line
@@ -89,6 +89,9 @@ public:
    status_t getOccupancyHistory(bool forceFlush,
            std::vector<OccupancyTracker::Segment>* outHistory);

    // See IGraphicBufferConsumer::discardFreeBuffers
    status_t discardFreeBuffers();

private:
    ConsumerBase(const ConsumerBase&);
    void operator=(const ConsumerBase&);
+5 −0
Original line number Diff line number Diff line
@@ -272,6 +272,11 @@ public:
    virtual status_t getOccupancyHistory(bool forceFlush,
            std::vector<OccupancyTracker::Segment>* outHistory) = 0;

    // discardFreeBuffers releases all currently-free buffers held by the queue,
    // in order to reduce the memory consumption of the queue to the minimum
    // possible without discarding data.
    virtual status_t discardFreeBuffers() = 0;

    // dump state into a string
    virtual void dump(String8& result, const char* prefix) const = 0;

+6 −0
Original line number Diff line number Diff line
@@ -725,6 +725,12 @@ status_t BufferQueueConsumer::getOccupancyHistory(bool forceFlush,
    return NO_ERROR;
}

status_t BufferQueueConsumer::discardFreeBuffers() {
    Mutex::Autolock lock(mCore->mMutex);
    mCore->discardFreeBuffersLocked();
    return NO_ERROR;
}

void BufferQueueConsumer::dump(String8& result, const char* prefix) const {
    const IPCThreadState* ipc = IPCThreadState::self();
    const pid_t pid = ipc->getCallingPid();
Loading