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

Commit 163aa901 authored by Rob Carr's avatar Rob Carr Committed by Automerger Merge Worker
Browse files

Merge "BBQSurface: Give client a chance to observe transform hint earlier"...

Merge "BBQSurface: Give client a chance to observe transform hint earlier" into sc-dev am: 837d98eb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14487004

Change-Id: Ie2cef9b98cd23385c29cd9abfbb0552d5bdcf04c
parents ed8d705f 837d98eb
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -317,6 +317,11 @@ void BLASTBufferQueue::releaseBufferCallback(uint64_t graphicBufferId,
    std::unique_lock _lock{mMutex};
    std::unique_lock _lock{mMutex};
    BQA_LOGV("releaseBufferCallback graphicBufferId=%" PRIu64, graphicBufferId);
    BQA_LOGV("releaseBufferCallback graphicBufferId=%" PRIu64, graphicBufferId);


    if (mSurfaceControl != nullptr) {
        mTransformHint = mSurfaceControl->getTransformHint();
        mBufferItemConsumer->setTransformHint(mTransformHint);
    }

    auto it = mSubmitted.find(graphicBufferId);
    auto it = mSubmitted.find(graphicBufferId);
    if (it == mSubmitted.end()) {
    if (it == mSubmitted.end()) {
        BQA_LOGE("ERROR: releaseBufferCallback without corresponding submitted buffer %" PRIu64,
        BQA_LOGE("ERROR: releaseBufferCallback without corresponding submitted buffer %" PRIu64,
@@ -596,6 +601,14 @@ public:
    status_t setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInfo) override {
    status_t setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInfo) override {
        return mBbq->setFrameTimelineInfo(frameTimelineInfo);
        return mBbq->setFrameTimelineInfo(frameTimelineInfo);
    }
    }
 protected:
    uint32_t getTransformHint() const override {
        if (mStickyTransform == 0 && !transformToDisplayInverse()) {
            return mBbq->getLastTransformHint();
        } else {
            return 0;
        }
    }
};
};


// TODO: Can we coalesce this with frame updates? Need to confirm
// TODO: Can we coalesce this with frame updates? Need to confirm
@@ -765,4 +778,12 @@ PixelFormat BLASTBufferQueue::convertBufferFormat(PixelFormat& format) {
    return convertedFormat;
    return convertedFormat;
}
}


uint32_t BLASTBufferQueue::getLastTransformHint() const {
    if (mSurfaceControl != nullptr) {
        return mSurfaceControl->getTransformHint();
    } else {
        return 0;
    }
}

} // namespace android
} // namespace android
+2 −2
Original line number Original line Diff line number Diff line
@@ -1288,7 +1288,7 @@ int Surface::query(int what, int* value) const {
                        mUserHeight ? mUserHeight : mDefaultHeight);
                        mUserHeight ? mUserHeight : mDefaultHeight);
                return NO_ERROR;
                return NO_ERROR;
            case NATIVE_WINDOW_TRANSFORM_HINT:
            case NATIVE_WINDOW_TRANSFORM_HINT:
                *value = static_cast<int>(mTransformHint);
                *value = static_cast<int>(getTransformHint());
                return NO_ERROR;
                return NO_ERROR;
            case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: {
            case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: {
                status_t err = NO_ERROR;
                status_t err = NO_ERROR;
@@ -1822,7 +1822,7 @@ int Surface::dispatchGetExtraBufferCount(va_list args) {
    return getExtraBufferCount(extraBuffers);
    return getExtraBufferCount(extraBuffers);
}
}


bool Surface::transformToDisplayInverse() {
bool Surface::transformToDisplayInverse() const {
    return (mTransform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY) ==
    return (mTransform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY) ==
            NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
            NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -103,6 +103,8 @@ public:


    void setSidebandStream(const sp<NativeHandle>& stream);
    void setSidebandStream(const sp<NativeHandle>& stream);


    uint32_t getLastTransformHint() const;

    virtual ~BLASTBufferQueue();
    virtual ~BLASTBufferQueue();


private:
private:
+2 −1
Original line number Original line Diff line number Diff line
@@ -278,7 +278,6 @@ private:
    int dispatchGetLastQueuedBuffer(va_list args);
    int dispatchGetLastQueuedBuffer(va_list args);
    int dispatchSetFrameTimelineInfo(va_list args);
    int dispatchSetFrameTimelineInfo(va_list args);
    int dispatchGetExtraBufferCount(va_list args);
    int dispatchGetExtraBufferCount(va_list args);
    bool transformToDisplayInverse();


protected:
protected:
    virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
    virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
@@ -490,6 +489,8 @@ protected:
    // mTransformHint is the transform probably applied to buffers of this
    // mTransformHint is the transform probably applied to buffers of this
    // window. this is only a hint, actual transform may differ.
    // window. this is only a hint, actual transform may differ.
    uint32_t mTransformHint;
    uint32_t mTransformHint;
    virtual uint32_t getTransformHint() const { return mTransformHint; }
    bool transformToDisplayInverse() const;


    // mProducerControlledByApp whether this buffer producer is controlled
    // mProducerControlledByApp whether this buffer producer is controlled
    // by the application
    // by the application