SF Bounds caching 1/3: Defer calls that use layer bounds until the cached bounds are available.
End goal is to calculate the bounds once in the surface flinger loop. The bounds are invalidated
if the visible region changes. The first step is to defer any functions that use the cache to after
the bounds is calculated.
- Defer updating display dirty region when latching buffers.
- Defer updating cursor and input flinger until all the buffers have been latched.
- Recompute visible regions if transformToDisplayInverse flag changes
Test: go/wm-smoke
Test: atest -a libinput_tests inputflinger_tests SurfaceFlinger_test libsurfaceflinger_unittest SurfaceParcelable_test libgui_test
Change-Id: Ife6e0f06939d9f4fb051b68cb2b1c9f5bd180b57
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp
index 42021d1..2a981fe 100644
--- a/services/surfaceflinger/BufferQueueLayer.cpp
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
@@ -190,7 +190,7 @@
return mSidebandStreamChanged;
}
-std::optional<Region> BufferQueueLayer::latchSidebandStream(bool& recomputeVisibleRegions) {
+bool BufferQueueLayer::latchSidebandStream(bool& recomputeVisibleRegions) {
bool sidebandStreamChanged = true;
if (mSidebandStreamChanged.compare_exchange_strong(sidebandStreamChanged, false)) {
// mSidebandStreamChanged was changed to false
@@ -202,10 +202,9 @@
}
recomputeVisibleRegions = true;
- const State& s(getDrawingState());
- return getTransform().transform(Region(Rect(s.active_legacy.w, s.active_legacy.h)));
+ return true;
}
- return {};
+ return false;
}
bool BufferQueueLayer::hasFrameUpdate() const {