[Winscope] Add chips for HWC vs GPU composited layers

Bug: 119443475
Test: SF trace
Change-Id: I13289b403d394c07b3ac8e2e7d21e5188bba56d8
diff --git a/tools/winscope/src/TreeView.vue b/tools/winscope/src/TreeView.vue
index c7050f0..7c3cb49 100644
--- a/tools/winscope/src/TreeView.vue
+++ b/tools/winscope/src/TreeView.vue
@@ -155,4 +155,14 @@
   color: black;
 }
 
+.tree-view-chip.tree-view-chip-gpu {
+  background-color: #00c853;
+  color: black;
+}
+
+.tree-view-chip.tree-view-chip-hwc {
+  background-color: #448aff;
+  color: black;
+}
+
 </style>
diff --git a/tools/winscope/src/transform_sf.js b/tools/winscope/src/transform_sf.js
index 446af29..12cab2f 100644
--- a/tools/winscope/src/transform_sf.js
+++ b/tools/winscope/src/transform_sf.js
@@ -30,6 +30,12 @@
 var MISSING_LAYER = {short: 'MissingLayer',
     long: "This layer was referenced from the parent, but not present in the trace",
     class: 'error'};
+var GPU_CHIP = {short: 'GPU',
+    long: "This layer was composed on the GPU",
+    class: 'gpu'};
+var HWC_CHIP = {short: 'HWC',
+    long: "This layer was composed by Hardware Composer",
+    class: 'hwc'};
 
 function transform_layer(layer, {parentBounds, parentHidden}) {
   function get_size(layer) {
@@ -155,6 +161,14 @@
     return visible;
   }
 
+  function add_hwc_composition_type_chip(layer) {
+      if (layer.hwcCompositionType === "CLIENT") {
+          chips.push(GPU_CHIP);
+      } else if (layer.hwcCompositionType === "DEVICE") {
+          chips.push(HWC_CHIP);
+      }
+  }
+
   function postprocess_flags(layer) {
     if (!layer.flags) return;
     var verboseFlags = [];
@@ -234,6 +248,7 @@
   var transform_layer_with_parent_hidden =
       (layer) => transform_layer(layer, {parentBounds: rect, parentHidden: parentHidden});
   postprocess_flags(layer);
+  add_hwc_composition_type_chip(layer);
   return transform({
     obj: layer,
     kind: '',