From: SooChan Lim Date: Wed, 10 Apr 2013 10:47:50 +0000 (+0900) Subject: check the initialization before report the log. X-Git-Tag: 2.1b_release~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c695adac64a0c8a02b5c0a8fd28e128d7c1cdf3;p=adaptation%2Fxorg%2Fdriver%2Fxserver-xorg-module-xdbg.git check the initialization before report the log. Change-Id: I5570a92b3c28671571d820719dfbb8fef6dfaa5b --- diff --git a/lib/xdbg_log_drmevent.c b/lib/xdbg_log_drmevent.c index 3adde3d..3f1ae3b 100755 --- a/lib/xdbg_log_drmevent.c +++ b/lib/xdbg_log_drmevent.c @@ -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"); } diff --git a/lib/xdbg_log_drmevent.h b/lib/xdbg_log_drmevent.h index f74a485..89364b7 100755 --- a/lib/xdbg_log_drmevent.h +++ b/lib/xdbg_log_drmevent.h @@ -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__ */ diff --git a/lib/xdbg_log_fpsdebug.c b/lib/xdbg_log_fpsdebug.c index 618efe3..d2a3b5d 100755 --- a/lib/xdbg_log_fpsdebug.c +++ b/lib/xdbg_log_fpsdebug.c @@ -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; } diff --git a/lib/xdbg_log_fpsdebug.h b/lib/xdbg_log_fpsdebug.h index 0229c51..8a5520c 100755 --- a/lib/xdbg_log_fpsdebug.h +++ b/lib/xdbg_log_fpsdebug.h @@ -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__ */ diff --git a/lib/xdbg_log_plist.c b/lib/xdbg_log_plist.c index acc85e3..d86e1ae 100755 --- a/lib/xdbg_log_plist.c +++ b/lib/xdbg_log_plist.c @@ -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"); diff --git a/module/xdbg_module_fpsdebug.c b/module/xdbg_module_fpsdebug.c index f4d6e1e..da8b1c4 100755 --- a/module/xdbg_module_fpsdebug.c +++ b/module/xdbg_module_fpsdebug.c @@ -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); }