overlay: Trace MDP ioctls

Add trace points for all MDP ioctls called from liboverlay
so that they show up in systrace.

b/11387181 - HH suffers from "busy janks"
Change-Id: I99d6ef987499fc858d298e74a60fc3cd4f8a0609
diff --git a/msm8974/liboverlay/mdpWrapper.h b/msm8974/liboverlay/mdpWrapper.h
index d96317c..99b131b 100644
--- a/msm8974/liboverlay/mdpWrapper.h
+++ b/msm8974/liboverlay/mdpWrapper.h
@@ -29,6 +29,7 @@
 
 #ifndef MDP_WRAPPER_H
 #define MDP_WRAPPER_H
+#define ATRACE_TAG (ATRACE_TAG_GRAPHICS | ATRACE_TAG_HAL)
 
 /*
 * In order to make overlay::mdp_wrapper shorter, please do something like:
@@ -41,6 +42,7 @@
 #include <utils/Log.h>
 #include <errno.h>
 #include "overlayUtils.h"
+#include <utils/Trace.h>
 
 namespace overlay{
 
@@ -114,6 +116,7 @@
 //---------------Inlines -------------------------------------
 
 inline bool getFScreenInfo(int fd, fb_fix_screeninfo& finfo) {
+    ATRACE_CALL();
     if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0) {
         ALOGE("Failed to call ioctl FBIOGET_FSCREENINFO err=%s",
                 strerror(errno));
@@ -123,6 +126,7 @@
 }
 
 inline bool getVScreenInfo(int fd, fb_var_screeninfo& vinfo) {
+    ATRACE_CALL();
     if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) {
         ALOGE("Failed to call ioctl FBIOGET_VSCREENINFO err=%s",
                 strerror(errno));
@@ -132,6 +136,7 @@
 }
 
 inline bool setVScreenInfo(int fd, fb_var_screeninfo& vinfo) {
+    ATRACE_CALL();
     if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo) < 0) {
         ALOGE("Failed to call ioctl FBIOPUT_VSCREENINFO err=%s",
                 strerror(errno));
@@ -141,6 +146,7 @@
 }
 
 inline bool startRotator(int fd, msm_rotator_img_info& rot) {
+    ATRACE_CALL();
     if (ioctl(fd, MSM_ROTATOR_IOCTL_START, &rot) < 0){
         ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_START err=%s",
                 strerror(errno));
@@ -150,6 +156,7 @@
 }
 
 inline bool rotate(int fd, msm_rotator_data_info& rot) {
+    ATRACE_CALL();
     if (ioctl(fd, MSM_ROTATOR_IOCTL_ROTATE, &rot) < 0) {
         ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_ROTATE err=%s",
                 strerror(errno));
@@ -159,6 +166,7 @@
 }
 
 inline bool setOverlay(int fd, mdp_overlay& ov) {
+    ATRACE_CALL();
     if (ioctl(fd, MSMFB_OVERLAY_SET, &ov) < 0) {
         ALOGE("Failed to call ioctl MSMFB_OVERLAY_SET err=%s",
                 strerror(errno));
@@ -168,6 +176,7 @@
 }
 
 inline bool endRotator(int fd, uint32_t sessionId) {
+    ATRACE_CALL();
     if (ioctl(fd, MSM_ROTATOR_IOCTL_FINISH, &sessionId) < 0) {
         ALOGE("Failed to call ioctl MSM_ROTATOR_IOCTL_FINISH err=%s",
                 strerror(errno));
@@ -177,6 +186,7 @@
 }
 
 inline bool unsetOverlay(int fd, int ovId) {
+    ATRACE_CALL();
     if (ioctl(fd, MSMFB_OVERLAY_UNSET, &ovId) < 0) {
         ALOGE("Failed to call ioctl MSMFB_OVERLAY_UNSET err=%s",
                 strerror(errno));
@@ -186,6 +196,7 @@
 }
 
 inline bool getOverlay(int fd, mdp_overlay& ov) {
+    ATRACE_CALL();
     if (ioctl(fd, MSMFB_OVERLAY_GET, &ov) < 0) {
         ALOGE("Failed to call ioctl MSMFB_OVERLAY_GET err=%s",
                 strerror(errno));
@@ -195,6 +206,7 @@
 }
 
 inline bool play(int fd, msmfb_overlay_data& od) {
+    ATRACE_CALL();
     if (ioctl(fd, MSMFB_OVERLAY_PLAY, &od) < 0) {
         ALOGE("Failed to call ioctl MSMFB_OVERLAY_PLAY err=%s",
                 strerror(errno));
@@ -204,6 +216,7 @@
 }
 
 inline bool set3D(int fd, msmfb_overlay_3d& ov) {
+    ATRACE_CALL();
     if (ioctl(fd, MSMFB_OVERLAY_3D, &ov) < 0) {
         ALOGE("Failed to call ioctl MSMFB_OVERLAY_3D err=%s",
                 strerror(errno));
@@ -213,6 +226,7 @@
 }
 
 inline bool displayCommit(int fd, mdp_display_commit& info) {
+    ATRACE_CALL();
     if(ioctl(fd, MSMFB_DISPLAY_COMMIT, &info) == -1) {
         ALOGE("Failed to call ioctl MSMFB_DISPLAY_COMMIT err=%s",
                 strerror(errno));
@@ -222,6 +236,7 @@
 }
 
 inline bool wbInitStart(int fbfd) {
+    ATRACE_CALL();
     if(ioctl(fbfd, MSMFB_WRITEBACK_INIT, NULL) < 0) {
         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_INIT err=%s",
                 strerror(errno));
@@ -236,6 +251,7 @@
 }
 
 inline bool wbStopTerminate(int fbfd) {
+    ATRACE_CALL();
     if(ioctl(fbfd, MSMFB_WRITEBACK_STOP, NULL) < 0) {
         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_STOP err=%s",
                 strerror(errno));
@@ -250,6 +266,7 @@
 }
 
 inline bool wbQueueBuffer(int fbfd, struct msmfb_data& fbData) {
+    ATRACE_CALL();
     if(ioctl(fbfd, MSMFB_WRITEBACK_QUEUE_BUFFER, &fbData) < 0) {
         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_QUEUE_BUFFER err=%s",
                 strerror(errno));
@@ -259,6 +276,7 @@
 }
 
 inline bool wbDequeueBuffer(int fbfd, struct msmfb_data& fbData) {
+    ATRACE_CALL();
     if(ioctl(fbfd, MSMFB_WRITEBACK_DEQUEUE_BUFFER, &fbData) < 0) {
         ALOGE("Failed to call ioctl MSMFB_WRITEBACK_DEQUEUE_BUFFER err=%s",
                 strerror(errno));