QCamera2: Add more traces for reprocessing

To enable comprehensive tracing in camera HAL, set the below property
and restart camera processes.

adb shell setprop persist.camera.kpi.debug 2

Test: Run camera, and observe trace
Bug: 36890286
Change-Id: I357681867af88bf02acc152fc7b4690521090bf6
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index ecea044..eced938 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -4002,6 +4002,7 @@
     //Got the pproc data callback. Now send to jpeg encoding
     uint8_t frameIndex;
     uint32_t resultFrameNumber;
+    ATRACE_CALL();
     mm_camera_super_buf_t* frame = NULL;
     QCamera3ProcessingChannel *obj = (QCamera3ProcessingChannel *)inputChHandle;
     cam_dimension_t dim;
@@ -4603,6 +4604,7 @@
     int32_t rc = 0;
     int index;
     OfflineBuffer mappedBuffer;
+    ATRACE_CALL();
 
     if (m_numStreams < 1) {
         LOGE("No reprocess stream is created");
diff --git a/camera/QCamera2/HAL3/QCamera3Stream.cpp b/camera/QCamera2/HAL3/QCamera3Stream.cpp
index 8906e89..a8ce061 100644
--- a/camera/QCamera2/HAL3/QCamera3Stream.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Stream.cpp
@@ -32,6 +32,7 @@
 // Camera dependencies
 #include "QCamera3HWI.h"
 #include "QCamera3Stream.h"
+#include "QCameraTrace.h"
 
 extern "C" {
 #include "mm_camera_dbg.h"
@@ -1142,6 +1143,7 @@
 int32_t QCamera3Stream::mapBuf(uint8_t buf_type, uint32_t buf_idx,
         int32_t plane_idx, int fd, void *buffer, size_t size)
 {
+    ATRACE_CALL();
     return mCamOps->map_stream_buf(mCamHandle, mChannelHandle,
                                    mHandle, buf_type,
                                    buf_idx, plane_idx,
@@ -1165,6 +1167,7 @@
  *==========================================================================*/
 int32_t QCamera3Stream::unmapBuf(uint8_t buf_type, uint32_t buf_idx, int32_t plane_idx)
 {
+    ATRACE_CALL();
     return mCamOps->unmap_stream_buf(mCamHandle, mChannelHandle,
                                      mHandle, buf_type,
                                      buf_idx, plane_idx);
@@ -1186,6 +1189,7 @@
 {
     int32_t rc = NO_ERROR;
     mStreamInfo->parm_buf = param;
+    ATRACE_CALL();
     rc = mCamOps->set_stream_parms(mCamHandle,
                                    mChannelHandle,
                                    mHandle,
diff --git a/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c b/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c
index 3cce5e7..ba5cf02 100644
--- a/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c
+++ b/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_stream.c
@@ -38,6 +38,9 @@
 #define IOCTL_H <SYSTEM_HEADER_PREFIX/ioctl.h>
 #include IOCTL_H
 
+#define ATRACE_TAG ATRACE_TAG_CAMERA
+#include <cutils/trace.h>
+
 // Camera dependencies
 #include "cam_semaphore.h"
 #include "mm_camera_dbg.h"
@@ -1514,9 +1517,14 @@
     int32_t rc = 0;
     struct v4l2_buffer vb;
     struct v4l2_plane planes[VIDEO_MAX_PLANES];
+    char frame_type[64];
     LOGD("E, my_handle = 0x%x, fd = %d, state = %d",
           my_obj->my_hdl, my_obj->fd, my_obj->state);
 
+    snprintf(frame_type, sizeof(frame_type), "DQBUF: type %d",
+      my_obj->stream_info->stream_type);
+    ATRACE_BEGIN(frame_type);
+
     memset(&vb,  0,  sizeof(vb));
     vb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
     vb.memory = V4L2_MEMORY_USERPTR;
@@ -1578,6 +1586,7 @@
     }
 
     LOGD("X rc = %d",rc);
+    ATRACE_END();
     return rc;
 }