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

Commit d01c4437 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

SF: Set the buffer size immediately when applying a transaction

If deferred transactions changes the buffer size as well, then the
client will not receive the correct buffer size to render its contents.

Bug: 111504081, 110763772
Test: go/wm-smoke
Test: mmma frameworks/native/services/surfaceflinger/tests/ && \
mmma frameworks/native/libs/gui/tests/ && adb sync data && \
adb shell /data/nativetest/libgui_test/libgui_test && \
adb shell /data/nativetest/libsurfaceflinger_unittest/libsurfaceflinger_unittest && \
adb shell /data/nativetest/SurfaceFlinger_test/SurfaceFlinger_test && \
adb shell /data/nativetest/SurfaceParcelable_test/SurfaceParcelable_test && \
adb shell /data/nativetest/sffakehwc_test/sffakehwc_test && \
adb shell /data/nativetest64/libgui_test/libgui_test && \
adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest && \
adb shell /data/nativetest64/SurfaceFlinger_test/SurfaceFlinger_test && \
adb shell /data/nativetest64/SurfaceParcelable_test/SurfaceParcelable_test && \
adb shell /data/nativetest64/sffakehwc_test/sffakehwc_test && \
echo "ALL TESTS PASSED"

Change-Id: Id7c9662d9b755645b4cfadab2add285964adf4a4
parent 7a4dcdf8
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -240,9 +240,6 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setSize(
    s->w = w;
    s->w = w;
    s->h = h;
    s->h = h;


    // Resizing a surface makes the transaction synchronous.
    mForceSynchronous = true;

    return *this;
    return *this;
}
}


+4 −4
Original line number Original line Diff line number Diff line
@@ -1013,10 +1013,6 @@ uint32_t Layer::doTransactionResize(uint32_t flags, State* stateToCommit) {
                 s.active_legacy.w, s.active_legacy.h, s.crop_legacy.left, s.crop_legacy.top,
                 s.active_legacy.w, s.active_legacy.h, s.crop_legacy.left, s.crop_legacy.top,
                 s.crop_legacy.right, s.crop_legacy.bottom, s.crop_legacy.getWidth(),
                 s.crop_legacy.right, s.crop_legacy.bottom, s.crop_legacy.getWidth(),
                 s.crop_legacy.getHeight(), s.requested_legacy.w, s.requested_legacy.h);
                 s.crop_legacy.getHeight(), s.requested_legacy.w, s.requested_legacy.h);

        // record the new size, form this point on, when the client request
        // a buffer, it'll get the new size.
        setDefaultBufferSize(stateToCommit->requested_legacy.w, stateToCommit->requested_legacy.h);
    }
    }


    // Don't let Layer::doTransaction update the drawing state
    // Don't let Layer::doTransaction update the drawing state
@@ -1253,6 +1249,10 @@ bool Layer::setSize(uint32_t w, uint32_t h) {
    mCurrentState.requested_legacy.h = h;
    mCurrentState.requested_legacy.h = h;
    mCurrentState.modified = true;
    mCurrentState.modified = true;
    setTransactionFlags(eTransactionNeeded);
    setTransactionFlags(eTransactionNeeded);

    // record the new size, from this point on, when the client request
    // a buffer, it'll get the new size.
    setDefaultBufferSize(mCurrentState.requested_legacy.w, mCurrentState.requested_legacy.h);
    return true;
    return true;
}
}
bool Layer::setAlpha(float alpha) {
bool Layer::setAlpha(float alpha) {