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
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index f7f3fac..04beae0 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1013,10 +1013,6 @@
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.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
@@ -1253,6 +1249,10 @@
mCurrentState.requested_legacy.h = h;
mCurrentState.modified = true;
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;
}
bool Layer::setAlpha(float alpha) {