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

Commit 512f006f authored by Eino-Ville Talvala's avatar Eino-Ville Talvala Committed by android-build-merger
Browse files

BufferQueue consumers: Add discardFreeBuffer method am: bc2df65a

am: 7ac8cefb

Change-Id: I5ed889a884b84ae0b0bc8eac2e683d7e1a84f5ef
parents 070d1d61 7ac8cefb
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -140,6 +140,9 @@ public:
    virtual status_t getOccupancyHistory(bool forceFlush,
    virtual status_t getOccupancyHistory(bool forceFlush,
            std::vector<OccupancyTracker::Segment>* outHistory) override;
            std::vector<OccupancyTracker::Segment>* outHistory) override;


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

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


+5 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,11 @@ private:
    // all slots, even if they're currently dequeued, queued, or acquired.
    // all slots, even if they're currently dequeued, queued, or acquired.
    void freeAllBuffersLocked();
    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
    // If delta is positive, makes more slots available. If negative, takes
    // away slots. Returns false if the request can't be met.
    // away slots. Returns false if the request can't be met.
    bool adjustAvailableSlotsLocked(int delta);
    bool adjustAvailableSlotsLocked(int delta);
+3 −0
Original line number Original line Diff line number Diff line
@@ -89,6 +89,9 @@ public:
    status_t getOccupancyHistory(bool forceFlush,
    status_t getOccupancyHistory(bool forceFlush,
            std::vector<OccupancyTracker::Segment>* outHistory);
            std::vector<OccupancyTracker::Segment>* outHistory);


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

private:
private:
    ConsumerBase(const ConsumerBase&);
    ConsumerBase(const ConsumerBase&);
    void operator=(const ConsumerBase&);
    void operator=(const ConsumerBase&);
+5 −0
Original line number Original line Diff line number Diff line
@@ -272,6 +272,11 @@ public:
    virtual status_t getOccupancyHistory(bool forceFlush,
    virtual status_t getOccupancyHistory(bool forceFlush,
            std::vector<OccupancyTracker::Segment>* outHistory) = 0;
            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
    // dump state into a string
    virtual void dump(String8& result, const char* prefix) const = 0;
    virtual void dump(String8& result, const char* prefix) const = 0;


+6 −0
Original line number Original line Diff line number Diff line
@@ -725,6 +725,12 @@ status_t BufferQueueConsumer::getOccupancyHistory(bool forceFlush,
    return NO_ERROR;
    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 {
void BufferQueueConsumer::dump(String8& result, const char* prefix) const {
    const IPCThreadState* ipc = IPCThreadState::self();
    const IPCThreadState* ipc = IPCThreadState::self();
    const pid_t pid = ipc->getCallingPid();
    const pid_t pid = ipc->getCallingPid();
Loading