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/Layer.h b/services/surfaceflinger/Layer.h
index 8209c51..07b2eb5 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -795,12 +795,12 @@
     // Returns index if removed, or negative value otherwise
     // for symmetry with Vector::remove
     ssize_t removeChild(const sp<Layer>& layer);
-    sp<Layer> getParent() const { return mCurrentParent.promote(); }
 
     // Should be called with the surfaceflinger statelock held
     bool isAtRoot() const { return mIsAtRoot; }
     void setIsAtRoot(bool isAtRoot) { mIsAtRoot = isAtRoot; }
 
+    Layer* getParent() const { return mCurrentParent; }
     bool hasParent() const { return getParent() != nullptr; }
     Rect getScreenBounds(bool reduceTransparentRegion = true) const;
     bool setChildLayer(const sp<Layer>& childLayer, int32_t z);
@@ -1007,8 +1007,8 @@
     LayerVector mCurrentChildren{LayerVector::StateSet::Current};
     LayerVector mDrawingChildren{LayerVector::StateSet::Drawing};
 
-    wp<Layer> mCurrentParent;
-    wp<Layer> mDrawingParent;
+    Layer* mCurrentParent = nullptr;
+    Layer* mDrawingParent = nullptr;
 
     // Window types from WindowManager.LayoutParams
     const gui::WindowInfo::Type mWindowType;