WL_TBM_MONITOR_PROC_STATE_UNKNOWN,
} WL_TBM_MONITOR_PROC_STATE;
+typedef enum {
+ WL_TBM_MONITOR_RES_BO,
+ WL_TBM_MONITOR_RES_SURFACE_INTERNAL,
+ WL_TBM_MONITOR_RES_SURFACE,
+ WL_TBM_MONITOR_RES_SURFACE_QUEUE,
+ WL_TBM_MONITOR_RES_WL_TBM,
+ WL_TBM_MONITOR_RES_ALL,
+ WL_TBM_MONITOR_RES_UNKNOWN,
+} WL_TBM_MONITOR_RES;
+
#define WL_TBM_MONITOR_REPLY_MSG_LEN 8192
#define WL_TBM_MONITOR_ARGS_MAX 12
#define WL_TBM_MONITOR_PATH_LEN 256
WL_TBM_MONITOR_PROC_STATE
_waylend_tbm_util_proc_state_parse(char * str);
+WL_TBM_MONITOR_RES
+_waylend_tbm_util_resource_parse(char * str);
+
int
_waylend_tbm_util_dump_queue(WL_TBM_MONITOR_PROC_STATE cmd, tbm_bufmgr bufmgr, double scale);
_waylend_tbm_util_dump_snapshot(tbm_bufmgr bufmgr, double scale, char *path);
int
-_waylend_tbm_util_trace(WL_TBM_MONITOR_PROC_STATE cmd, tbm_bufmgr bufmgr);
+_waylend_tbm_util_trace(WL_TBM_MONITOR_PROC_STATE cmd, WL_TBM_MONITOR_RES res, tbm_bufmgr bufmgr);
char *
_wayland_tbm_dump_directory_make(void);
struct wayland_tbm_monitor_target target = {.all = 1, .server = 1, .pid = {0} };
WL_TBM_MONITOR_PROC_STATE cmd;
+ WL_TBM_MONITOR_RES res;
int st;
cmd = _waylend_tbm_util_proc_state_parse(r->argv[1]);
return;
}
- if (!_waylend_tbm_util_target_parse(r->argv[2], &target)) {
- _wayland_tbm_monitor_request_printf(r, "'%s' - unknown target for -trace\n", r->argv[2]);
+ res = _waylend_tbm_util_resource_parse(r->argv[2]);
+ if (res == WL_TBM_MONITOR_RES_UNKNOWN) {
+ _wayland_tbm_monitor_request_printf(r, "'%s' - unknown resource for -trace\n", r->argv[2]);
+ _wayland_tbm_monitor_server_usage(r);
+ return;
+ }
+
+ if (!_waylend_tbm_util_target_parse(r->argv[3], &target)) {
+ _wayland_tbm_monitor_request_printf(r, "'%s' - unknown target for -trace\n", r->argv[3]);
return;
}
if (target.server) {
- st = _waylend_tbm_util_trace(cmd, r->tbm_srv->bufmgr);
+ st = _waylend_tbm_util_trace(cmd, res, r->tbm_srv->bufmgr);
_wayland_tbm_monitor_request_printf(r, "server: trace state: %s\n", st ? "on" : "off");
}
{
"trace",
_waylend_tbm_monitor_server_trace,
- "trace the changes or the information of the tbm_bo (command: on | off | status)"
+ "trace the changes or the information of the tbm resources (command: on | off | status)\n"
+ "\t\t the trace log is shown through the dlog message with \"TBM\" tag."
,
"<cmd> [<resource>] [<target>]\n"
"\t"" <cmd>\n"
"\t"" on | off - turn on/off the trace\n"
"\t"" status - show status of all targets\n"
+ "\t"" <cmd>\n"
+ "\t"" tbm_bo - tbm_bo resource trace\n"
+ "\t"" tbm_surface_internal - tbm_surface_internal resource trace\n"
+ "\t"" tbm_surface - tbm_surface resource trace\n"
+ "\t"" tbm_surface_queue - tbm_surface_queue resource trace\n"
+ "\t"" wl_tbm - wl_tbm resource trace\n"
+ "\t"" all - all resources trace\n"
"\t"" <target>\n"
"\t"" all - clients and server(by default)\n"
"\t"" server,<pid>,... - list of targets"
return WL_TBM_MONITOR_PROC_STATE_UNKNOWN;
}
+WL_TBM_MONITOR_RES
+_waylend_tbm_util_resource_parse(char * str)
+{
+ if (str == NULL)
+ return WL_TBM_MONITOR_RES_UNKNOWN;
+ if (!strncmp(str, "tbm_bo", 6))
+ return WL_TBM_MONITOR_RES_BO;
+ if (!strncmp(str, "tbm_surface_internal", 19))
+ return WL_TBM_MONITOR_RES_SURFACE_INTERNAL;
+ if (!strncmp(str, "tbm_surface", 11))
+ return WL_TBM_MONITOR_RES_SURFACE;
+ if (!strncmp(str, "tbm_surface_queue", 17))
+ return WL_TBM_MONITOR_RES_SURFACE_QUEUE;
+ if (!strncmp(str, "wl_tbm", 6))
+ return WL_TBM_MONITOR_RES_WL_TBM;
+ if (!strncmp(str, "all", 3))
+ return WL_TBM_MONITOR_RES_ALL;
+ return WL_TBM_MONITOR_RES_UNKNOWN;
+}
+
int
_wayland_tbm_util_show_path_parse(char * path_str, char * cwd, struct wayland_tbm_monitor_path *path)
{
int
-_waylend_tbm_util_trace(WL_TBM_MONITOR_PROC_STATE cmd, tbm_bufmgr bufmgr)
+_waylend_tbm_util_trace(WL_TBM_MONITOR_PROC_STATE cmd, WL_TBM_MONITOR_RES res, tbm_bufmgr bufmgr)
{
- if (!bTrace && cmd == WL_TBM_MONITOR_PROC_STATE_ON) {
- tbm_bufmgr_debug_trace(bufmgr, 1);
- bTrace = 1;
- } else if (bTrace && cmd == WL_TBM_MONITOR_PROC_STATE_OFF) {
- tbm_bufmgr_debug_trace(bufmgr, 0);
- bTrace = 0;
+ int ret = 0;
+
+ if (cmd == WL_TBM_MONITOR_PROC_STATE_ON) {
+ if (res == WL_TBM_MONITOR_RES_BO)
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_BO, 1);
+ if (res == WL_TBM_MONITOR_RES_SURFACE_INTERNAL)
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL, 1);
+ if (res == WL_TBM_MONITOR_RES_SURFACE)
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE, 1);
+ if (res == WL_TBM_MONITOR_RES_SURFACE_QUEUE)
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE, 1);
+ if (res == WL_TBM_MONITOR_RES_WL_TBM)
+ bTrace = 1;
+ if (res == WL_TBM_MONITOR_RES_ALL) {
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_BO, 1);
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL, 1);
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE, 1);
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE, 1);
+ bTrace = 1;
+ }
+ ret = 1;
+ } else if (cmd == WL_TBM_MONITOR_PROC_STATE_OFF) {
+ if (res == WL_TBM_MONITOR_RES_BO)
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_BO, 0);
+ if (res == WL_TBM_MONITOR_RES_SURFACE_INTERNAL)
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL, 0);
+ if (res == WL_TBM_MONITOR_RES_SURFACE)
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE, 0);
+ if (res == WL_TBM_MONITOR_RES_SURFACE_QUEUE)
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE, 0);
+ if (res == WL_TBM_MONITOR_RES_WL_TBM)
+ bTrace = 0;
+ if (res == WL_TBM_MONITOR_RES_ALL) {
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_BO, 0);
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL, 0);
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE, 0);
+ tbm_bufmgr_debug_set_trace_mask(bufmgr, TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE, 0);
+ bTrace = 0;
+ }
+ ret = 0;
}
- return bTrace;
+
+ return ret;
}
void
_waylend_tbm_util_dump_snapshot(tbm_bufmgr bufmgr, double scale, char *path)