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

Commit 74676653 authored by Pablo Ceballos's avatar Pablo Ceballos Committed by android-build-merger
Browse files

BQ: Add and expose a unique id

am: 8e3e92b9

Change-Id: I2602c1d2f5247cf0b3d2718f52dddba6c23c003d
parents 4b5fe391 8e3e92b9
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -322,6 +322,8 @@ private:
    // The slot of the last queued buffer
    // The slot of the last queued buffer
    int mLastQueuedSlot;
    int mLastQueuedSlot;


    const uint64_t mUniqueId;

}; // class BufferQueueCore
}; // class BufferQueueCore


} // namespace android
} // namespace android
+3 −0
Original line number Original line Diff line number Diff line
@@ -186,6 +186,9 @@ public:
    virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
    virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
            sp<Fence>* outFence, float outTransformMatrix[16]) override;
            sp<Fence>* outFence, float outTransformMatrix[16]) override;


    // See IGraphicBufferProducer::getUniqueId
    virtual status_t getUniqueId(uint64_t* outId) const override;

private:
private:
    // This is required by the IBinder::DeathRecipient interface
    // This is required by the IBinder::DeathRecipient interface
    virtual void binderDied(const wp<IBinder>& who);
    virtual void binderDied(const wp<IBinder>& who);
+3 −0
Original line number Original line Diff line number Diff line
@@ -568,6 +568,9 @@ public:
    // Returns NO_ERROR or the status of the Binder transaction
    // Returns NO_ERROR or the status of the Binder transaction
    virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
    virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
            sp<Fence>* outFence, float outTransformMatrix[16]) = 0;
            sp<Fence>* outFence, float outTransformMatrix[16]) = 0;

    // Returns a unique id for this BufferQueue
    virtual status_t getUniqueId(uint64_t* outId) const = 0;
};
};


// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
+2 −0
Original line number Original line Diff line number Diff line
@@ -134,6 +134,8 @@ public:
    status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
    status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
            sp<Fence>* outFence, float outTransformMatrix[16]);
            sp<Fence>* outFence, float outTransformMatrix[16]);


    status_t getUniqueId(uint64_t* outId) const;

protected:
protected:
    virtual ~Surface();
    virtual ~Surface();


+8 −1
Original line number Original line Diff line number Diff line
@@ -47,6 +47,12 @@ static String8 getUniqueName() {
            android_atomic_inc(&counter));
            android_atomic_inc(&counter));
}
}


static uint64_t getUniqueId() {
    static std::atomic<uint32_t> counter{0};
    static uint64_t id = static_cast<uint64_t>(getpid()) << 32;
    return id | counter++;
}

BufferQueueCore::BufferQueueCore(const sp<IGraphicBufferAlloc>& allocator) :
BufferQueueCore::BufferQueueCore(const sp<IGraphicBufferAlloc>& allocator) :
    mAllocator(allocator),
    mAllocator(allocator),
    mMutex(),
    mMutex(),
@@ -85,7 +91,8 @@ BufferQueueCore::BufferQueueCore(const sp<IGraphicBufferAlloc>& allocator) :
    mAutoRefresh(false),
    mAutoRefresh(false),
    mSharedBufferSlot(INVALID_BUFFER_SLOT),
    mSharedBufferSlot(INVALID_BUFFER_SLOT),
    mSharedBufferCache(Rect::INVALID_RECT, 0, NATIVE_WINDOW_SCALING_MODE_FREEZE,
    mSharedBufferCache(Rect::INVALID_RECT, 0, NATIVE_WINDOW_SCALING_MODE_FREEZE,
            HAL_DATASPACE_UNKNOWN)
            HAL_DATASPACE_UNKNOWN),
    mUniqueId(getUniqueId())
{
{
    if (allocator == NULL) {
    if (allocator == NULL) {


Loading