vblank: add server ttrace information 44/167644/2
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 06:13:16 +0000 (15:13 +0900)
Change-Id: I4ab060b514b04be0bd48606b8c56a5308b6bbe20

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

index 349c454..f126490 100644 (file)
@@ -60,6 +60,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;
 
@@ -130,10 +133,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;
 }
 
 /* LCOV_EXCL_START */
@@ -180,10 +189,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;
 }
 /* LCOV_EXCL_STOP */
 
@@ -432,8 +447,14 @@ tdm_client_handle_events(tdm_client *client)
        /* LCOV_EXCL_START */
        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;
        /* LCOV_EXCL_STOP */
 }
index 30b4a91..e20e7dd 100644 (file)
--- a/src/tdm.c
+++ b/src/tdm.c
@@ -1425,10 +1425,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))
@@ -1448,12 +1452,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 8b28fa8..6fdb190 100644 (file)
@@ -505,7 +505,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 fd641c1..a406ecd 100644 (file)
@@ -68,11 +68,13 @@ 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),
 };
 
 typedef enum {
index 0a359f4..c1b1359 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);
 
@@ -338,6 +342,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);
@@ -387,6 +394,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);
@@ -485,7 +495,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 4a0d03f..16c1838 100644 (file)
@@ -1040,6 +1040,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);
@@ -1109,6 +1112,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);