Add layer tracing tags in new pipeline

bug:28596354

Change-Id: I351cb50c8c9ddfc73be73d28a1af94d2a8f9992e
diff --git a/libs/hwui/FrameBuilder.cpp b/libs/hwui/FrameBuilder.cpp
index 502f027..84c8a74 100644
--- a/libs/hwui/FrameBuilder.cpp
+++ b/libs/hwui/FrameBuilder.cpp
@@ -82,6 +82,9 @@
         // removed during a dropped frame, but layers may still remain scheduled so
         // as not to lose info on what portion is damaged
         if (CC_LIKELY(layerNode->getLayer() != nullptr)) {
+            ATRACE_FORMAT("Optimize HW Layer DisplayList %s %ux%u",
+                    layerNode->getName(), layerNode->getWidth(), layerNode->getHeight());
+
             const Rect& layerDamage = layers.entries()[i].damage;
             layerNode->computeOrdering();
 
diff --git a/libs/hwui/LayerBuilder.cpp b/libs/hwui/LayerBuilder.cpp
index 3000777..66413dc 100644
--- a/libs/hwui/LayerBuilder.cpp
+++ b/libs/hwui/LayerBuilder.cpp
@@ -336,7 +336,13 @@
 
 void LayerBuilder::replayBakedOpsImpl(void* arg,
         BakedOpReceiver* unmergedReceivers, MergedOpReceiver* mergedReceivers) const {
-    ATRACE_NAME("flush drawing commands");
+    if (renderNode) {
+        ATRACE_FORMAT_BEGIN("Issue HW Layer DisplayList %s %ux%u",
+                renderNode->getName(), width, height);
+    } else {
+        ATRACE_BEGIN("flush drawing commands");
+    }
+
     for (const BatchBase* batch : mBatches) {
         size_t size = batch->getOps().size();
         if (size > 1 && batch->isMerging()) {
@@ -355,6 +361,7 @@
             }
         }
     }
+    ATRACE_END();
 }
 
 void LayerBuilder::clear() {
diff --git a/libs/hwui/renderstate/OffscreenBufferPool.cpp b/libs/hwui/renderstate/OffscreenBufferPool.cpp
index 73b6c02..10a26e0 100644
--- a/libs/hwui/renderstate/OffscreenBufferPool.cpp
+++ b/libs/hwui/renderstate/OffscreenBufferPool.cpp
@@ -20,6 +20,7 @@
 #include "Properties.h"
 #include "renderstate/RenderState.h"
 #include "utils/FatVector.h"
+#include "utils/TraceUtils.h"
 
 #include <utils/Log.h>
 
@@ -41,6 +42,7 @@
         , texture(caches) {
     uint32_t width = computeIdealDimension(viewportWidth);
     uint32_t height = computeIdealDimension(viewportHeight);
+    ATRACE_FORMAT("Allocate %ux%u HW Layer", width, height);
     caches.textureState().activateTexture(0);
     texture.resize(width, height, GL_RGBA);
     texture.blend = true;
@@ -101,6 +103,7 @@
 }
 
 OffscreenBuffer::~OffscreenBuffer() {
+    ATRACE_FORMAT("Destroy %ux%u HW Layer", texture.width(), texture.height());
     texture.deleteTexture();
     renderState.meshState().deleteMeshBuffer(vbo);
     elementCount = 0;