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

Commit 70a4e33a authored by Vishnu Nair's avatar Vishnu Nair Committed by android-build-merger
Browse files

Merge "Make NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY transforms sticky" into qt-dev

am: 8bbc4464

Change-Id: I52bfab89a5aa19e4340a01b02b9dfe6a4fb11312
parents 0cd86b50 8bbc4464
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -829,8 +829,9 @@ int Surface::queueBuffer(android_native_buffer_t* buffer, int fenceFd) {
    mDefaultHeight = output.height;
    mNextFrameNumber = output.nextFrameNumber;

    // Disable transform hint if sticky transform is set.
    if (mStickyTransform == 0) {
    // Ignore transform hint if sticky transform is set or transform to display inverse flag is
    // set.
    if (mStickyTransform == 0 && !transformToDisplayInverse()) {
        mTransformHint = output.transformHint;
    }

@@ -1271,6 +1272,11 @@ int Surface::dispatchGetConsumerUsage64(va_list args) {
    return getConsumerUsage(usage);
}

bool Surface::transformToDisplayInverse() {
    return (mTransform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY) ==
            NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
}

int Surface::connect(int api) {
    static sp<IProducerListener> listener = new DummyProducerListener();
    return connect(api, listener);
@@ -1293,8 +1299,10 @@ int Surface::connect(
        mDefaultHeight = output.height;
        mNextFrameNumber = output.nextFrameNumber;

        // Disable transform hint if sticky transform is set.
        if (mStickyTransform == 0) {
        // Ignore transform hint if sticky transform is set or transform to display inverse flag is
        // set. Transform hint should be ignored if the client is expected to always submit buffers
        // in the same orientation.
        if (mStickyTransform == 0 && !transformToDisplayInverse()) {
            mTransformHint = output.transformHint;
        }

@@ -1591,6 +1599,13 @@ int Surface::setBuffersTransform(uint32_t transform)
    ATRACE_CALL();
    ALOGV("Surface::setBuffersTransform");
    Mutex::Autolock lock(mMutex);
    // Ensure NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY is sticky. If the client sets the flag, do not
    // override it until the surface is disconnected. This is a temporary workaround for camera
    // until they switch to using Buffer State Layers. Currently if client sets the buffer transform
    // it may be overriden by the buffer producer when the producer sets the buffer transform.
    if (transformToDisplayInverse()) {
        transform |= NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
    }
    mTransform = transform;
    return NO_ERROR;
}
+1 −0
Original line number Diff line number Diff line
@@ -230,6 +230,7 @@ private:
    int dispatchGetWideColorSupport(va_list args);
    int dispatchGetHdrSupport(va_list args);
    int dispatchGetConsumerUsage64(va_list args);
    bool transformToDisplayInverse();

protected:
    virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
+2 −4
Original line number Diff line number Diff line
@@ -1230,10 +1230,8 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const {

void Layer::updateTransformHint(const sp<const DisplayDevice>& display) const {
    uint32_t orientation = 0;
    // Disable setting transform hint if the debug flag is set or if the
    // getTransformToDisplayInverse flag is set and the client wants to submit buffers
    // in one orientation.
    if (!mFlinger->mDebugDisableTransformHint && !getTransformToDisplayInverse()) {
    // Disable setting transform hint if the debug flag is set.
    if (!mFlinger->mDebugDisableTransformHint) {
        // The transform hint is used to improve performance, but we can
        // only have a single transform hint, it cannot
        // apply to all displays.