gralloc\memalloc: Add traces

Add traces to gralloc (mapper) and memalloc (ionalloc) functions

Change-Id: Ia980b8fce92659a8b72a37ef129f20eb01fe2b43
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 2f2ddc1..13e662a 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -29,6 +29,7 @@
 
 #include <cutils/log.h>
 #include <cutils/atomic.h>
+#include <utils/Trace.h>
 
 #include <hardware/hardware.h>
 #include <hardware/gralloc.h>
@@ -39,6 +40,8 @@
 #include "memalloc.h"
 #include <qdMetaData.h>
 
+#define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL)
+
 using namespace gralloc;
 /*****************************************************************************/
 
@@ -55,6 +58,7 @@
 static int gralloc_map(gralloc_module_t const* module,
                        buffer_handle_t handle)
 {
+    ATRACE_CALL();
     if(!module)
         return -EINVAL;
 
@@ -92,6 +96,7 @@
 static int gralloc_unmap(gralloc_module_t const* module,
                          buffer_handle_t handle)
 {
+    ATRACE_CALL();
     if(!module)
         return -EINVAL;
 
@@ -130,6 +135,7 @@
 int gralloc_register_buffer(gralloc_module_t const* module,
                             buffer_handle_t handle)
 {
+    ATRACE_CALL();
     if (!module || private_handle_t::validate(handle) < 0)
         return -EINVAL;
 
@@ -157,6 +163,7 @@
 int gralloc_unregister_buffer(gralloc_module_t const* module,
                               buffer_handle_t handle)
 {
+    ATRACE_CALL();
     if (!module || private_handle_t::validate(handle) < 0)
         return -EINVAL;
 
@@ -179,6 +186,7 @@
 int terminateBuffer(gralloc_module_t const* module,
                     private_handle_t* hnd)
 {
+    ATRACE_CALL();
     if(!module)
         return -EINVAL;
 
@@ -207,6 +215,7 @@
 static int gralloc_map_and_invalidate (gralloc_module_t const* module,
                                        buffer_handle_t handle, int usage)
 {
+    ATRACE_CALL();
     if (!module || private_handle_t::validate(handle) < 0)
         return -EINVAL;
 
@@ -243,6 +252,7 @@
                  int /*l*/, int /*t*/, int /*w*/, int /*h*/,
                  void** vaddr)
 {
+    ATRACE_CALL();
     private_handle_t* hnd = (private_handle_t*)handle;
     int err = gralloc_map_and_invalidate(module, handle, usage);
     if(!err)
@@ -255,6 +265,7 @@
                  int /*l*/, int /*t*/, int /*w*/, int /*h*/,
                  struct android_ycbcr *ycbcr)
 {
+    ATRACE_CALL();
     private_handle_t* hnd = (private_handle_t*)handle;
     int err = gralloc_map_and_invalidate(module, handle, usage);
     if(!err)
@@ -265,6 +276,7 @@
 int gralloc_unlock(gralloc_module_t const* module,
                    buffer_handle_t handle)
 {
+    ATRACE_CALL();
     if (!module || private_handle_t::validate(handle) < 0)
         return -EINVAL;