[LayerTraceGenerator] fix mirrors and rel-z data

relanding: actual regression was fixed here: Id58a41b46b4d03dc6d69259220c04e2f341be4fd and was not caused by this cl

Now that we are using the new front end to
generate layers trace, we need to make a few fixes
so we can generate data that's parsable by winscope.

This means use a unique id instead of the layer id to
identify layers.

Test: presubmit
Fixes: 255901752
Change-Id: Ife768ada07940f298a0a7b1ff81d95901559c57c
diff --git a/services/surfaceflinger/FrontEnd/LayerHierarchy.h b/services/surfaceflinger/FrontEnd/LayerHierarchy.h
index 3dd89ba..b25b731 100644
--- a/services/surfaceflinger/FrontEnd/LayerHierarchy.h
+++ b/services/surfaceflinger/FrontEnd/LayerHierarchy.h
@@ -104,6 +104,16 @@
         static const TraversalPath ROOT;
     };
 
+    struct TraversalPathHash {
+        std::size_t operator()(const LayerHierarchy::TraversalPath& key) const {
+            uint32_t hashCode = key.id * 31;
+            if (key.mirrorRootId != UNASSIGNED_LAYER_ID) {
+                hashCode += key.mirrorRootId * 31;
+            }
+            return std::hash<size_t>{}(hashCode);
+        }
+    };
+
     // Helper class to add nodes to an existing traversal id and removes the
     // node when it goes out of scope.
     class ScopedAddToTraversalPath {