From ce6d98cdddb7a73d1eb0ad8691c22561a2db2299 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 26 Mar 2013 11:28:26 +0900 Subject: [PATCH] add drmevent_pending Change-Id: I3205a7bdf77cbbc6d14b3078c5b100cdba5632e7 --- lib/Makefile.am | 14 +-- lib/xdbg.h | 1 + lib/xdbg_log_drmevent.c | 223 ++++++++++++++++++++++++++++++++++++++++++ lib/xdbg_log_drmevent.h | 47 +++++++++ module/Makefile.am | 9 +- module/xdbg_module_clist.c | 3 +- module/xdbg_module_command.c | 18 ++++ module/xdbg_module_drmevent.c | 44 +++++++++ module/xdbg_module_drmevent.h | 39 ++++++++ 9 files changed, 386 insertions(+), 12 deletions(-) mode change 100644 => 100755 lib/xdbg.h create mode 100755 lib/xdbg_log_drmevent.c create mode 100755 lib/xdbg_log_drmevent.h mode change 100644 => 100755 module/xdbg_module_clist.c mode change 100644 => 100755 module/xdbg_module_command.c create mode 100755 module/xdbg_module_drmevent.c create mode 100755 module/xdbg_module_drmevent.h diff --git a/lib/Makefile.am b/lib/Makefile.am index d5c1edd..5d1c455 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,7 @@ # Copyright 2013 Samsung Electronics co., Ltd. All Rights Reserved. -# +# # Contact: Boram Park -# +# # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including @@ -9,11 +9,11 @@ # distribute, sub license, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: -# +# # The above copyright notice and this permission notice (including the # next paragraph) shall be included in all copies or substantial portions # of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -34,12 +34,14 @@ libxdbg_log_la_CFLAGS = \ libxdbg_log_la_SOURCES = \ xdbg_log.c \ xdbg_log_klog.c \ - xdbg_log_dlog.c + xdbg_log_dlog.c \ + xdbg_log_drmevent.c libincludedir = $(includedir)/xdbg libinclude_HEADERS = \ xdbg.h \ - xdbg_log.h + xdbg_log.h \ + xdbg_log_drmevent.h pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = xdbg.pc diff --git a/lib/xdbg.h b/lib/xdbg.h old mode 100644 new mode 100755 index e75182c..7df2e3d --- a/lib/xdbg.h +++ b/lib/xdbg.h @@ -34,5 +34,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* include only headers */ #include +#include #endif /* __XDBG_H__ */ diff --git a/lib/xdbg_log_drmevent.c b/lib/xdbg_log_drmevent.c new file mode 100755 index 0000000..3adde3d --- /dev/null +++ b/lib/xdbg_log_drmevent.c @@ -0,0 +1,223 @@ +/************************************************************************** + +xdbg + +Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + +Contact: SooChan Lim + Sangjin LEE + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "xdbg.h" + +#include + +#ifndef API +#define API __attribute__ ((visibility("default"))) +#endif + +typedef struct _xdbgVblankInfo +{ + int crtc_pipe; + unsigned int client_idx; + unsigned int draw_id; + int flag; + unsigned long time; + struct xorg_list link; +} XDbgVblankInfo, *XDbgVblankInfoPtr; + +typedef struct _xdbgPageFlipInfo +{ + int crtc_pipe; + unsigned int client_idx; + unsigned int draw_id; + unsigned long time; + struct xorg_list link; +} XDbgPageFlipInfo, *XDbgPageFlipInfoPtr; + +static struct xorg_list vblank_event_list; +static struct xorg_list pageflip_event_list; + +API void +xDbgLogDrmEventInit () +{ + xorg_list_init (&vblank_event_list); + xorg_list_init (&pageflip_event_list); +} + +API void +xDbgLogDrmEventDeInit () +{ + /* TODO: delete all link(xorg_list_del) in the two list */ +} + +API void * +xDbgLogDrmEventAddVblank ( int crtc_pipe, unsigned int client_idx, unsigned int draw_id, int flag) +{ + XDbgVblankInfoPtr pVblankInfo = NULL; + + pVblankInfo = calloc (1, sizeof (XDbgPageFlipInfo)); + if (!pVblankInfo) + return NULL; + + pVblankInfo->crtc_pipe = crtc_pipe; + pVblankInfo->client_idx = client_idx; + pVblankInfo->draw_id = draw_id; + pVblankInfo->flag = flag; + pVblankInfo->time =GetTimeInMillis(); + + xorg_list_init(&pVblankInfo->link); + xorg_list_add(&pVblankInfo->link, &vblank_event_list); + + return (void *)pVblankInfo; +} + +API void +xDbgLogDrmEventRemoveVblank (void *vblank_data) +{ + XDbgVblankInfoPtr pVblankInfo = (XDbgVblankInfoPtr) vblank_data; + + xorg_list_del (&pVblankInfo->link); + free (pVblankInfo); + pVblankInfo = NULL; +} + +API void * +xDbgLogDrmEventAddPageflip (int crtc_pipe, unsigned int client_idx, unsigned int draw_id) +{ + XDbgPageFlipInfoPtr pPageFlipInfo = NULL; + + pPageFlipInfo = calloc (1, sizeof (XDbgPageFlipInfo)); + if (!pPageFlipInfo) + return NULL; + + pPageFlipInfo->crtc_pipe = crtc_pipe; + pPageFlipInfo->client_idx = client_idx; + pPageFlipInfo->draw_id = draw_id; + pPageFlipInfo->time =GetTimeInMillis(); + + xorg_list_init(&pPageFlipInfo->link); + xorg_list_add(&pPageFlipInfo->link, &pageflip_event_list); + + return (void *)pPageFlipInfo; +} + +API void +xDbgLogDrmEventRemovePageflip (void *pageflip_data) +{ + XDbgPageFlipInfoPtr pPageFlipInfo = (XDbgPageFlipInfoPtr) pageflip_data; + + xorg_list_del (&pPageFlipInfo->link); + free (pPageFlipInfo); + pPageFlipInfo = NULL; +} + +API void +xDbgLogDrmEventPendingLists ( char *reply, int *remain) +{ + XDbgVblankInfoPtr vblank_ref = NULL; + XDbgVblankInfoPtr vblank_next = NULL; + XDbgPageFlipInfoPtr flip_ref = NULL; + 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; + 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", + (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; + } + } + if (!check_vblank) + { + len = snprintf (p, *remain, "\t no pending events\n"); + p += len; + *remain -= len; + } + + len = snprintf (p, *remain, "[flip event pending]\n"); + p += len; + *remain -= len; + 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", + (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; + } +} + + + diff --git a/lib/xdbg_log_drmevent.h b/lib/xdbg_log_drmevent.h new file mode 100755 index 0000000..f74a485 --- /dev/null +++ b/lib/xdbg_log_drmevent.h @@ -0,0 +1,47 @@ +/************************************************************************** + +xdbg + +Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + +Contact: SooChan Lim + Sangjin LEE + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +#ifndef __XDBG_LOG_DRMEVENT_H__ +#define __XDBG_LOG_DRMEVENT_H__ + +void xDbgLogDrmEventInit (void); +void xDbgLogDrmEventDeInit (void); + +void * xDbgLogDrmEventAddVblank ( int crtc_pipe, unsigned int client_idx, unsigned int draw_id, int flag); +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); + + +#endif /* __XDBG_LOG_DRMEVENT_H__ */ diff --git a/module/Makefile.am b/module/Makefile.am index 6d987ef..a9fe1fe 100644 --- a/module/Makefile.am +++ b/module/Makefile.am @@ -1,7 +1,7 @@ # Copyright 2013 Samsung Electronics co., Ltd. All Rights Reserved. -# +# # Contact: Boram Park -# +# # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including @@ -9,11 +9,11 @@ # distribute, sub license, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: -# +# # The above copyright notice and this permission notice (including the # next paragraph) shall be included in all copies or substantial portions # of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -44,6 +44,7 @@ libxdbg_la_SOURCES = \ xdbg_module_evlog.c \ xdbg_module_evlog_request.c \ xdbg_module_evlog_event.c \ + xdbg_module_drmevent.c \ ds/bintree.c \ ds/bool_exp_parser.c \ ds/bool_exp_rule_checker.c \ diff --git a/module/xdbg_module_clist.c b/module/xdbg_module_clist.c old mode 100644 new mode 100755 index 31be7e8..82bad99 --- a/module/xdbg_module_clist.c +++ b/module/xdbg_module_clist.c @@ -46,8 +46,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define XREGISTRY #include -#include - +#include "xdbg.h" #include "xdbg_module_types.h" diff --git a/module/xdbg_module_command.c b/module/xdbg_module_command.c old mode 100644 new mode 100755 index 5c389bd..8bfc498 --- a/module/xdbg_module_command.c +++ b/module/xdbg_module_command.c @@ -47,6 +47,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xdbg_module_clist.h" #include "xdbg_module_rlist.h" #include "xdbg_module_evlog.h" +#include "xdbg_module_drmevent.h" #include "xdbg_module_command.h" static Bool @@ -270,6 +271,17 @@ _CommandSetEvlogPrint (int pid, int argc, char **argv, char *reply, int *len, XD xDbgModuleEvlogPrintEvlog (pMod, pid, evlog_path, reply, len); } +static void +_CommandDrmEventPending (int pid, int argc, char **argv, char *reply, int *len, XDbgModule *pMod) +{ + if (argc != 2) + { + XDBG_REPLY ("Error : too few arguments\n"); + return; + } + + xDbgModuleDrmEventPending (pMod, reply, len); +} static struct { @@ -330,6 +342,12 @@ static struct NULL, "[filepath]", _CommandSetEvlogPrint }, + + { + "drmevent_pending", "to print pending drmvents", "", + NULL, "", + _CommandDrmEventPending + }, }; static void _CommandPrintUsage (char *reply, int *len, const char * exec) diff --git a/module/xdbg_module_drmevent.c b/module/xdbg_module_drmevent.c new file mode 100755 index 0000000..14ad6db --- /dev/null +++ b/module/xdbg_module_drmevent.c @@ -0,0 +1,44 @@ +/************************************************************************** + +xdbg + +Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + +Contact: SooChan Lim + Sangjin LEE + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "xdbg.h" +#include "xdbg_module_types.h" + + +void +xDbgModuleDrmEventPending (XDbgModule *pMod, char *reply, int *remain) +{ + xDbgLogDrmEventPendingLists (reply, remain); +} diff --git a/module/xdbg_module_drmevent.h b/module/xdbg_module_drmevent.h new file mode 100755 index 0000000..ff5e924 --- /dev/null +++ b/module/xdbg_module_drmevent.h @@ -0,0 +1,39 @@ +/************************************************************************** + +xdbg + +Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved + +Contact: SooChan Lim + Sangjin LEE + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +#ifndef __XDBG_MODULE_DRMEVENT_H__ +#define __XDBG_MODULE_DRMEVENT_H__ + +#include "xdbg_module_types.h" + +void xDbgModuleDrmEventPending (XDbgModule *pMod, char *reply, int *remain); + +#endif /* __XDBG_MODULE_DRMEVENT_H__ */ \ No newline at end of file -- 2.7.4