check the initialization before report the log.
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 10 Apr 2013 10:47:50 +0000 (19:47 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 11 Apr 2013 06:08:22 +0000 (15:08 +0900)
Change-Id: I5570a92b3c28671571d820719dfbb8fef6dfaa5b

lib/xdbg_log_drmevent.c
lib/xdbg_log_drmevent.h
lib/xdbg_log_fpsdebug.c
lib/xdbg_log_fpsdebug.h
lib/xdbg_log_plist.c
module/xdbg_module_fpsdebug.c

index 3adde3d..3f1ae3b 100755 (executable)
@@ -70,12 +70,15 @@ typedef struct _xdbgPageFlipInfo
     struct xorg_list link;
 } XDbgPageFlipInfo, *XDbgPageFlipInfoPtr;
 
+static int init_drmevent = 0;
 static struct xorg_list vblank_event_list;
 static struct xorg_list pageflip_event_list;
 
 API void
 xDbgLogDrmEventInit ()
 {
+    init_drmevent = 1;
+
     xorg_list_init (&vblank_event_list);
     xorg_list_init (&pageflip_event_list);
 }
@@ -148,7 +151,7 @@ xDbgLogDrmEventRemovePageflip (void *pageflip_data)
 }
 
 API void
-xDbgLogDrmEventPendingLists ( char *reply, int *remain)
+xDbgLogDrmEventPendingLists ( char *reply, int *len)
 {
     XDbgVblankInfoPtr vblank_ref = NULL;
     XDbgVblankInfoPtr vblank_next = NULL;
@@ -156,67 +159,48 @@ xDbgLogDrmEventPendingLists ( char *reply, int *remain)
     XDbgPageFlipInfoPtr flip_next = NULL;
     Bool check_flip = FALSE;
     Bool check_vblank = FALSE;
-    char *p = reply;
-    int len;
 
-    len = snprintf (p, *remain, "[vblank event pending]\n");
-    p += len;
-    *remain -= len;
+    if (!init_drmevent)
+    {
+        XDBG_REPLY ("drmevent_pending is not supported.\n");
+        return;
+    }
+
+
+    XDBG_REPLY ("[vblank event pending]\n");
     xorg_list_for_each_entry_safe (vblank_ref, vblank_next, &vblank_event_list, link)
     {
         check_vblank = TRUE;
 
         if (vblank_ref->flag > -1)
         {
-            len = snprintf (p, *remain, "req_time        client_id       draw_id       crtc_pipe     vblank_type\n");
-            p += len;
-           *remain -= len;
-           len = snprintf (p, *remain, "[%10.3f]    %5d          0x%x     %5d          %5d\n",
+            XDBG_REPLY ("req_time        client_id       draw_id       crtc_pipe     vblank_type\n");
+            XDBG_REPLY ("[%10.3f]    %5d          0x%x     %5d          %5d\n",
                        (double)vblank_ref->time/1000.0,
                        (unsigned int)vblank_ref->client_idx,
                        (unsigned int)vblank_ref->draw_id, vblank_ref->crtc_pipe, vblank_ref->flag);
-            p += len;
-           *remain -= len;
         }
         else
         {
-            len = snprintf (p, *remain, "req_time        vblank_type\n");
-            p += len;
-           *remain -= len;
-            len = snprintf (p, *remain, "[%10.3f]             %d\n", (double)vblank_ref->time/1000.0, vblank_ref->flag);
-            p += len;
-           *remain -= len;
+            XDBG_REPLY ("req_time        vblank_type\n");
+            XDBG_REPLY ("[%10.3f]             %d\n", (double)vblank_ref->time/1000.0, vblank_ref->flag);
         }
     }
     if (!check_vblank)
-    {
-        len = snprintf (p, *remain, "\t no pending events\n");
-        p += len;
-        *remain -= len;
-    }
+        XDBG_REPLY ("\t no pending events\n");
 
-    len = snprintf (p, *remain, "[flip event pending]\n");
-    p += len;
-    *remain -= len;
+    XDBG_REPLY ("[flip event pending]\n");
     xorg_list_for_each_entry_safe (flip_ref, flip_next, &pageflip_event_list, link)
     {
         check_flip = TRUE;
 
-        len = snprintf (p, *remain, "req_time        client_id       draw_id       crtc_pipe\n");
-        p += len;
-        *remain -= len;
-        len = snprintf (p, *remain, "[%10.3f]    %5d           0x%x      %4d\n",
+        XDBG_REPLY ("req_time        client_id       draw_id       crtc_pipe\n");
+        XDBG_REPLY ("[%10.3f]    %5d           0x%x      %4d\n",
                    (double)flip_ref->time/1000.0, (unsigned int)flip_ref->client_idx,
                    (unsigned int)flip_ref->draw_id, flip_ref->crtc_pipe);
-        p += len;
-        *remain -= len;
     }
     if (!check_flip)
-    {
-        len = snprintf (p, *remain, "\t no pending events\n");
-        p += len;
-        *remain -= len;
-    }
+        XDBG_REPLY ("\t no pending events\n");
 }
 
 
index f74a485..89364b7 100755 (executable)
@@ -41,7 +41,7 @@ void xDbgLogDrmEventRemoveVblank (void *vblank_data);
 void *xDbgLogDrmEventAddPageflip (int crtc_pipe, unsigned int client_idx, unsigned int draw_id);
 void xDbgLogDrmEventRemovePageflip (void *pageflip_data);
 
-void xDbgLogDrmEventPendingLists ( char *reply, int *remain);
+void xDbgLogDrmEventPendingLists ( char *reply, int *len);
 
 
 #endif  /* __XDBG_LOG_DRMEVENT_H__ */
index 618efe3..d2a3b5d 100755 (executable)
@@ -45,6 +45,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define API __attribute__ ((visibility("default")))
 #endif
 
+static int init_fpsdebug = 0;
 static Bool g_on = FALSE;
 
 struct _fpsDebug
@@ -128,6 +129,8 @@ xDbgLogFpsDebugCreate ()
 {
     FpsDebugPtr pFpsDebug = NULL;
 
+    init_fpsdebug = 1;
+
     pFpsDebug = calloc (1, sizeof (struct _fpsDebug));
     if (!pFpsDebug)
     {
@@ -155,9 +158,6 @@ xDbgLogFpsDebugCount (FpsDebugPtr pFpsDebug, int connector_type)
     if (!g_on)
         return;
 
-    if (!pFpsDebug)
-        return;
-
     if (connector_type != pFpsDebug->connector_type)
     {
         pFpsDebug->connector_type = connector_type;
@@ -179,8 +179,14 @@ xDbgLogFpsDebugCount (FpsDebugPtr pFpsDebug, int connector_type)
 }
 
 API void
-xDbgLogFpsDebug (int on)
+xDbgLogFpsDebug (char *reply, int *len, int on)
 {
+    if (!init_fpsdebug)
+    {
+        XDBG_REPLY ("fps_debug is not supported.\n");
+        return;
+    }
+
     if (g_on != on)
         g_on = on;
 }
index 0229c51..8a5520c 100755 (executable)
@@ -38,7 +38,7 @@ FpsDebugPtr xDbgLogFpsDebugCreate  (void);
 void        xDbgLogFpsDebugDestroy (FpsDebugPtr pFpsDebug);
 void        xDbgLogFpsDebugCount (FpsDebugPtr pFpsDebug, int connector_type);
 
-void        xDbgLogFpsDebug        (int on);
+void        xDbgLogFpsDebug        (char *reply, int *len, int on);
 
 #endif  /* __XDBG_LOG_FPSDEBUG_H__ */
 
index acc85e3..d86e1ae 100755 (executable)
@@ -81,6 +81,7 @@ typedef struct {
     struct xorg_list refPixmaps;
 } XDbgDrawable;
 
+static int init_plist = 0;
 static struct xorg_list xdbgPixmaps;
 static struct xorg_list xdbgDrawables;
 static PixmapPtr pPixRoot = NULL;
@@ -500,6 +501,8 @@ XDbgLogDestroyWindow (WindowPtr pWindow)
 API void
 xDbgLogPListInit (ScreenPtr pScreen)
 {
+    init_plist = 1;
+
     xorg_list_init (&xdbgPixmaps);
     xorg_list_init (&xdbgDrawables);
 
@@ -631,6 +634,12 @@ xDbgLogPListDrawRemoveRefPixmap (DrawablePtr pDraw, PixmapPtr pRefPixmap)
 API void
 xDbgLogPList (char *reply, int *len)
 {
+    if (!init_plist)
+    {
+        XDBG_REPLY ("plist is not supported.\n");
+        return;
+    }
+
     XDBG_REPLY ("\n\n====================================\n");
     XDBG_REPLY ("    Total:%d, Peek:%d\n", (unsigned int)total_size/1024, (unsigned int)peek_size/1024);
     XDBG_REPLY ( "====================================\n");
index f4d6e1e..da8b1c4 100755 (executable)
@@ -39,6 +39,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 void
 xDbgModuleFpsDebug (XDbgModule *pMod, int on, char *reply, int *len)
 {
-    xDbgLogFpsDebug (on);
+    xDbgLogFpsDebug (reply, len, on);
 }