vblank: add server ttrace information
authorBoram Park <boram1288.park@samsung.com>
Fri, 19 Jan 2018 01:47:54 +0000 (10:47 +0900)
committerBoram Park <boram1288.park@samsung.com>
Fri, 19 Jan 2018 07:17:42 +0000 (16:17 +0900)
Change-Id: I4ab060b514b04be0bd48606b8c56a5308b6bbe20

client/tdm_client.c
src/tdm.c
src/tdm_monitor_server.c
src/tdm_private.h
src/tdm_server.c
src/tdm_vblank.c

index e576c3d..79ed4bb 100644 (file)
@@ -59,6 +59,9 @@ typedef struct _tdm_private_client {
        struct wl_tdm *tdm;
        struct list_head output_list;
 
+       unsigned int enable_ttrace;
+       unsigned int stamp;
+
        tdm_private_client_vblank *temp_vblank;
 } tdm_private_client;
 
@@ -129,10 +132,16 @@ static void
 _tdm_client_vblank_cb_stamp(void *data, struct wl_tdm_vblank *wl_tdm_vblank, uint32_t stamp)
 {
        tdm_private_client_vblank *private_vblank = data;
+       tdm_private_client *private_client;
 
        TDM_RETURN_IF_FAIL(private_vblank != NULL);
 
        private_vblank->stamp = stamp;
+
+       TDM_RETURN_IF_FAIL(private_vblank->private_output != NULL);
+       private_client = private_vblank->private_output->private_client;
+
+       private_client->stamp = stamp;
 }
 
 static void
@@ -176,10 +185,16 @@ static void
 _tdm_client_vblank_cb_ttrace(void *data, struct wl_tdm_vblank *wl_tdm_vblank, uint32_t enable)
 {
        tdm_private_client_vblank *private_vblank = data;
+       tdm_private_client *private_client;
 
        TDM_RETURN_IF_FAIL(private_vblank != NULL);
 
        private_vblank->enable_ttrace = enable;
+
+       TDM_RETURN_IF_FAIL(private_vblank->private_output != NULL);
+       private_client = private_vblank->private_output->private_client;
+
+       private_client->enable_ttrace = enable;
 }
 
 static const struct wl_tdm_vblank_listener tdm_client_vblank_listener = {
@@ -413,8 +428,14 @@ tdm_client_handle_events(tdm_client *client)
 
        private_client = (tdm_private_client*)client;
 
+       if (private_client->enable_ttrace)
+               TDM_TRACE_ASYNC_BEGIN((int)private_client->stamp, "TDM_Client_Events:%u", (unsigned int)private_client->stamp);
+
        wl_display_dispatch(private_client->display);
 
+       if (private_client->enable_ttrace)
+               TDM_TRACE_ASYNC_END((int)private_client->stamp, "TDM_Client_Events:%u", (unsigned int)private_client->stamp);
+
        return TDM_ERROR_NONE;
 }
 
index 6f88e5e..1d4d044 100644 (file)
--- a/src/tdm.c
+++ b/src/tdm.c
@@ -1385,10 +1385,14 @@ tdm_display_enable_ttrace(tdm_private_display *private_display, const char *ttra
                        tdm_ttrace_module = 0;
                else if (!strncmp(arg, "all", 3))
                        tdm_ttrace_module = 0xFFFFFFFF;
+               else if (!strncmp(arg, "vsync", 5))
+                       tdm_ttrace_module |= TDM_TTRACE_VSYNC;
+               else if (!strncmp(arg, "client_vblank", 13))
+                       tdm_ttrace_module |= TDM_TTRACE_CLIENT_VBLANK;
+               else if (!strncmp(arg, "server_vblank", 13))
+                       tdm_ttrace_module |= TDM_TTRACE_SERVER_VBLANK;
                else if (!strncmp(arg, "vblank", 6))
                        tdm_ttrace_module |= TDM_TTRACE_VBLANK;
-               else if (!strncmp(arg, "client", 6))
-                       tdm_ttrace_module |= TDM_TTRACE_CLIENT;
                else if (!strncmp(arg, "layer", 5))
                        tdm_ttrace_module |= TDM_TTRACE_LAYER;
                else if (!strncmp(arg, "pp", 2))
@@ -1408,12 +1412,12 @@ tdm_display_enable_ttrace(tdm_private_display *private_display, const char *ttra
 
        TDM_SNPRINTF(reply, len, "ttrace debugging... '%s' %x\n", ttrace, tdm_ttrace_module);
 
-       if (tdm_ttrace_module & TDM_TTRACE_VBLANK)
+       if (tdm_ttrace_module & TDM_TTRACE_VSYNC)
                tdm_display_enable_ttrace_vblank(private_display, output, 1);
        else
                tdm_display_enable_ttrace_vblank(private_display, NULL, 0);
 
-       if (tdm_ttrace_module & TDM_TTRACE_CLIENT)
+       if (tdm_ttrace_module & TDM_TTRACE_CLIENT_VBLANK)
                tdm_server_enable_ttrace_client_vblank(private_display, output, 1);
        else
                tdm_server_enable_ttrace_client_vblank(private_display, NULL, 0);
index 575b9c4..7fc739a 100644 (file)
@@ -501,7 +501,7 @@ static struct {
        },
        {
                "ttrace", _tdm_monitor_server_ttrace,
-               "enable/disable ttrace (module: none, vblank, client, layer, pp, capture, all",
+               "enable/disable ttrace (module: none,vsync,client_vblank,server_vblank,vblank,layer,pp,capture,all",
                "<module>[@<output_idx>]",
                NULL
        },
index 197ed5e..aa3749f 100644 (file)
@@ -87,13 +87,16 @@ enum {
 
 enum {
        TDM_TTRACE_NONE,
-       TDM_TTRACE_VBLANK    = (1 << 0),
-       TDM_TTRACE_CLIENT    = (1 << 1),
-       TDM_TTRACE_LAYER     = (1 << 2),
-       TDM_TTRACE_PP        = (1 << 3),
-       TDM_TTRACE_CAPTURE   = (1 << 4),
+       TDM_TTRACE_VSYNC            = (1 << 0),
+       TDM_TTRACE_CLIENT_VBLANK    = (1 << 1),
+       TDM_TTRACE_SERVER_VBLANK    = (1 << 2),
+       TDM_TTRACE_VBLANK           = (1 << 3),
+       TDM_TTRACE_LAYER            = (1 << 4),
+       TDM_TTRACE_PP               = (1 << 5),
+       TDM_TTRACE_CAPTURE          = (1 << 6),
 };
 
+
 extern int tdm_debug_module;
 extern int tdm_debug_dump;
 extern int tdm_ttrace_module;
index 2d99051..2629971 100644 (file)
@@ -182,6 +182,10 @@ _tdm_server_send_done(tdm_server_wait_info *wait_info, tdm_error error,
                TDM_DBG("req_id(%d) done", wait_info->req_id);
 
        vblank_info = wait_info->vblank_info;
+
+       if (tdm_ttrace_module & TDM_TTRACE_SERVER_VBLANK)
+               TDM_TRACE_ASYNC_END((int)wait_info->req_time, "TDM_Server_Vblank:%u", vblank_info->stamp);
+
        wl_tdm_vblank_send_done(vblank_info->resource, wait_info->req_id,
                                                        sequence, tv_sec, tv_usec, error);
 
@@ -321,6 +325,9 @@ _tdm_server_vblank_cb_wait_vblank(struct wl_client *client, struct wl_resource *
        if (tdm_debug_module & TDM_DEBUG_VBLANK)
                TDM_DBG("req_id(%d) wait", req_id);
 
+       if (tdm_ttrace_module & TDM_TTRACE_SERVER_VBLANK)
+               TDM_TRACE_ASYNC_BEGIN((int)wait_info->req_time, "TDM_Server_Vblank:%u", vblank_info->stamp);
+
        ret = tdm_vblank_wait(vblank_info->vblank, req_sec, req_usec, interval, _tdm_server_cb_vblank, wait_info);
 
        tdm_vblank_get_enable_fake(vblank_info->vblank, &enable_fake);
@@ -362,6 +369,9 @@ _tdm_server_vblank_cb_wait_vblank_seq(struct wl_client *client, struct wl_resour
        if (tdm_debug_module & TDM_DEBUG_VBLANK)
                TDM_DBG("req_id(%d) wait", req_id);
 
+       if (tdm_ttrace_module & TDM_TTRACE_SERVER_VBLANK)
+               TDM_TRACE_ASYNC_BEGIN((int)wait_info->req_time, "TDM_Server_Vblank:%u", vblank_info->stamp);
+
        ret = tdm_vblank_wait_seq(vblank_info->vblank, req_sec, req_usec, sequence, _tdm_server_cb_vblank, wait_info);
 
        tdm_vblank_get_enable_fake(vblank_info->vblank, &enable_fake);
@@ -442,7 +452,7 @@ _tdm_server_output_cb_create_vblank(struct wl_client *client, struct wl_resource
 
        wl_tdm_vblank_send_stamp(vblank_info->resource, vblank_info->stamp);
 
-       if (tdm_ttrace_module & TDM_TTRACE_CLIENT) {
+       if (tdm_ttrace_module & TDM_TTRACE_CLIENT_VBLANK) {
                tdm_output *output = tdm_display_get_output(private_loop->dpy, tdm_ttrace_output, NULL);
                if (output == output_info->output)
                        wl_tdm_vblank_send_ttrace(vblank_info->resource, 1);
index 523ea4c..0815a49 100644 (file)
@@ -823,6 +823,9 @@ _tdm_vblank_cb_vblank_HW(tdm_output *output, unsigned int sequence,
 
        VDB("wait(%p) last(%.6f) sequence(%u) done", wait_info, private_vblank->last_time, wait_info->target_seq);
 
+       if (tdm_ttrace_module & TDM_TTRACE_VBLANK)
+               TDM_TRACE_ASYNC_END((int)wait_info->req_time, "TDM_Vblank:%u", (unsigned int)private_vblank->stamp);
+
        if (wait_info->func)
                wait_info->func(private_vblank, TDM_ERROR_NONE, wait_info->target_seq,
                                                tv_sec, tv_usec, wait_info->user_data);
@@ -892,6 +895,9 @@ _tdm_vblank_wait_HW(tdm_vblank_wait_info *wait_info)
 
        private_vblank->last_interval = hw_interval;
 
+       if (tdm_ttrace_module & TDM_TTRACE_VBLANK)
+               TDM_TRACE_ASYNC_BEGIN((int)wait_info->req_time, "TDM_Vblank:%u", (unsigned int)private_vblank->stamp);
+
        if (private_vblank->add_front)
                ret = tdm_output_wait_vblank_add_front(private_vblank->output, hw_interval, 0,
                                                                                           _tdm_vblank_cb_vblank_HW, wait_info);