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

Commit 1992e943 authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Return the transform to apply in getLastQueuedBuffer" into nyc-dev

parents 55e5cc0e 1a61da5e
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ public:

    // See IGraphicBufferProducer::getLastQueuedBuffer
    virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
            sp<Fence>* outFence) override;
            sp<Fence>* outFence, float outTransformMatrix[16]) override;

private:
    // This is required by the IBinder::DeathRecipient interface
@@ -227,6 +227,9 @@ private:
    // since the previous buffer might have already been acquired.
    sp<Fence> mLastQueueBufferFence;

    Rect mLastQueuedCrop;
    uint32_t mLastQueuedTransform;

    // Take-a-ticket system for ensuring that onFrame* callbacks are called in
    // the order that frames are queued. While the BufferQueue lock
    // (mCore->mMutex) is held, a ticket is retained by the producer. After
+6 −0
Original line number Diff line number Diff line
@@ -132,6 +132,12 @@ public:
    // functions.
    void getTransformMatrix(float mtx[16]);

    // Computes the transform matrix documented by getTransformMatrix
    // from the BufferItem sub parts.
    static void computeTransformMatrix(float outTransform[16],
            const sp<GraphicBuffer>& buf, const Rect& cropRect,
            uint32_t transform, bool filtering);

    // getTimestamp retrieves the timestamp associated with the texture image
    // set by the most recent call to updateTexImage.
    //
+3 −1
Original line number Diff line number Diff line
@@ -563,9 +563,11 @@ public:
    // the queue, outBuffer will be populated with nullptr and outFence will be
    // populated with Fence::NO_FENCE
    //
    // outTransformMatrix is not modified if outBuffer is null.
    //
    // Returns NO_ERROR or the status of the Binder transaction
    virtual status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
            sp<Fence>* outFence) = 0;
            sp<Fence>* outFence, float outTransformMatrix[16]) = 0;
};

// ----------------------------------------------------------------------------
+2 −1
Original line number Diff line number Diff line
@@ -130,8 +130,9 @@ public:
    bool waitForNextFrame(uint64_t lastFrame, nsecs_t timeout);

    // See IGraphicBufferProducer::getLastQueuedBuffer
    // See GLConsumer::getTransformMatrix for outTransformMatrix format
    status_t getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
            sp<Fence>* outFence);
            sp<Fence>* outFence, float outTransformMatrix[16]);

protected:
    virtual ~Surface();
+12 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <gui/BufferItem.h>
#include <gui/BufferQueueCore.h>
#include <gui/BufferQueueProducer.h>
#include <gui/GLConsumer.h>
#include <gui/IConsumerListener.h>
#include <gui/IGraphicBufferAlloc.h>
#include <gui/IProducerListener.h>
@@ -923,6 +924,8 @@ status_t BufferQueueProducer::queueBuffer(int slot,
        mLastQueueBufferFence->waitForever("Throttling EGL Production");
    }
    mLastQueueBufferFence = fence;
    mLastQueuedCrop = item.mCrop;
    mLastQueuedTransform = item.mTransform;

    return NO_ERROR;
}
@@ -1372,7 +1375,7 @@ status_t BufferQueueProducer::setDequeueTimeout(nsecs_t timeout) {
}

status_t BufferQueueProducer::getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
        sp<Fence>* outFence) {
        sp<Fence>* outFence, float outTransformMatrix[16]) {
    ATRACE_CALL();
    BQ_LOGV("getLastQueuedBuffer");

@@ -1386,6 +1389,14 @@ status_t BufferQueueProducer::getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
    *outBuffer = mSlots[mCore->mLastQueuedSlot].mGraphicBuffer;
    *outFence = mLastQueueBufferFence;

    // Currently only SurfaceFlinger internally ever changes
    // GLConsumer's filtering mode, so we just use 'true' here as
    // this is slightly specialized for the current client of this API,
    // which does want filtering.
    GLConsumer::computeTransformMatrix(outTransformMatrix,
            mSlots[mCore->mLastQueuedSlot].mGraphicBuffer, mLastQueuedCrop,
            mLastQueuedTransform, true /* filter */);

    return NO_ERROR;
}

Loading