Layer: Use raw pointers for Current/Drawing parent
We should only be reading/writing this from the main thread
and likewise we only delete layers on the main thread and
so using raw pointers and managing the lifetime from the
Layer destructor will be safe. This significantly decreases
overhead in various code that traverses via parent (getAlpha,
isVisible, etc...).
Test: Existing tests pass. simpleperf
Bug: 186200583
Change-Id: I45745f7c865177ddfe9105d1440a9fa8f3470823
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index 8de43e0..82c91e7 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -223,7 +223,7 @@
* of a camera where the buffer remains in native orientation,
* we want the pixels to always be upright.
*/
- sp<Layer> p = mDrawingParent.promote();
+ auto p = mDrawingParent;
if (p != nullptr) {
const auto parentTransform = p->getTransform();
tr = tr * inverseOrientation(parentTransform.getOrientation());