rename test tools and enhance logs 19/67219/2 accepted/tizen/common/20160427.053804 accepted/tizen/ivi/20160426.234112 accepted/tizen/mobile/20160426.234038 accepted/tizen/tv/20160426.234102 accepted/tizen/wearable/20160426.234058 submit/tizen/20160426.061111
authorBoram Park <boram1288.park@samsung.com>
Tue, 26 Apr 2016 02:08:52 +0000 (11:08 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 26 Apr 2016 06:05:18 +0000 (15:05 +0900)
Change-Id: I0ef5b4639c3a555ddcd0217f78d7ec3ba47a515a

client/tdm_client.c
packaging/libtdm.spec
protocol/tdm.xml
src/tdm_helper.c
src/tdm_private.h
src/tdm_server.c
tools/Makefile.am
tools/tdm_test_client.c

index 45dd757..b4ce7de 100644 (file)
@@ -40,6 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <time.h>
 
 #include "tdm_client.h"
 #include "tdm_log.h"
@@ -61,6 +62,8 @@ typedef struct _tdm_client_vblank_info {
        struct list_head link;
        struct wl_tdm_vblank *vblank;
        tdm_client_vblank_handler func;
+       unsigned int req_sec;
+       unsigned int req_usec;
        void *user_data;
 } tdm_client_vblank_info;
 
@@ -222,6 +225,7 @@ tdm_client_wait_vblank(tdm_client *client, char *name, int interval, int sync,
 {
        tdm_private_client *private_client = (tdm_private_client*)client;
        tdm_client_vblank_info *vblank_info;
+       struct timespec tp;
 
        TDM_RETURN_VAL_IF_FAIL(name != NULL, TDM_CLIENT_ERROR_INVALID_PARAMETER);
        TDM_RETURN_VAL_IF_FAIL(interval > 0, TDM_CLIENT_ERROR_INVALID_PARAMETER);
@@ -235,7 +239,14 @@ tdm_client_wait_vblank(tdm_client *client, char *name, int interval, int sync,
                return TDM_CLIENT_ERROR_OUT_OF_MEMORY;
        }
 
-       vblank_info->vblank = wl_tdm_wait_vblank(private_client->tdm, name, interval);
+       clock_gettime(CLOCK_MONOTONIC, &tp);
+
+       vblank_info->req_sec = (unsigned int)tp.tv_sec;
+       vblank_info->req_usec = (unsigned int)(tp.tv_nsec/1000L);
+
+       vblank_info->vblank =
+               wl_tdm_wait_vblank(private_client->tdm, name, interval,
+                                  vblank_info->req_sec, vblank_info->req_usec);
        if (!vblank_info->vblank) {
                TDM_ERR("couldn't create vblank resource");
                free(vblank_info);
index 37f86c1..6df4f07 100644 (file)
@@ -123,6 +123,6 @@ rm -f %{_unitdir_user}/default.target.wants/tdm-socket-user.path
 
 %files tools
 %manifest %{name}.manifest
-%{_bindir}/tdm-client
+%{_bindir}/tdm-test-client
 
 %changelog
index f3389cb..18af57d 100644 (file)
@@ -23,6 +23,8 @@
             <arg name="id" type="new_id" interface="wl_tdm_vblank"/>
             <arg name="name" type="string"/>
             <arg name="interval" type="int"/>
+            <arg name="req_sec" type="uint"/>
+            <arg name="req_usec" type="uint"/>
         </request>
 
     </interface>
index 25bb885..18b6a48 100644 (file)
@@ -31,6 +31,17 @@ tdm_helper_get_time_in_millis(void)
        return 0;
 }
 
+INTERN unsigned long
+tdm_helper_get_time_in_micros(void)
+{
+       struct timespec tp;
+
+       if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+               return (tp.tv_sec * 1000000) + (tp.tv_nsec / 1000L);
+
+       return 0;
+}
+
 static void
 _tdm_helper_dump_raw(const char *file, void *data1, int size1, void *data2,
                      int size2, void *data3, int size3)
index 6cd2185..8002366 100644 (file)
@@ -443,6 +443,8 @@ tdm_server_deinit(tdm_private_loop *private_loop);
 
 unsigned long
 tdm_helper_get_time_in_millis(void);
+unsigned long
+tdm_helper_get_time_in_micros(void);
 
 extern pthread_mutex_t tdm_mutex_check_lock;
 extern int tdm_mutex_locked;
index 142c1a3..50d552c 100644 (file)
@@ -58,6 +58,7 @@ typedef struct _tdm_server_vblank_info {
 } tdm_server_vblank_info;
 
 static tdm_private_server *keep_private_server;
+static int tdm_debug_server;
 
 static void
 _tdm_server_cb_output_vblank(tdm_output *output, unsigned int sequence,
@@ -77,6 +78,13 @@ _tdm_server_cb_output_vblank(tdm_output *output, unsigned int sequence,
                return;
        }
 
+       if (tdm_debug_server) {
+               unsigned long curr = tdm_helper_get_time_in_micros();
+               unsigned long vtime = (tv_sec * 1000000) + tv_usec;
+               if (curr - vtime > 1000) /* 1ms */
+                       TDM_WRN("delay: %d us", (int)(curr - vtime));
+       }
+
        TDM_DBG("wl_tdm_vblank@%d done", wl_resource_get_id(vblank_info->resource));
 
        wl_tdm_vblank_send_done(vblank_info->resource, sequence, tv_sec, tv_usec);
@@ -94,7 +102,8 @@ destroy_vblank_callback(struct wl_resource *resource)
 static void
 _tdm_server_cb_wait_vblank(struct wl_client *client,
                            struct wl_resource *resource,
-                           uint32_t id, const char *name, int32_t interval)
+                           uint32_t id, const char *name, int32_t interval,
+                           uint32_t req_sec, uint32_t req_usec)
 {
        tdm_private_loop *private_loop = wl_resource_get_user_data(resource);
        tdm_private_server *private_server = private_loop->private_server;
@@ -165,6 +174,13 @@ _tdm_server_cb_wait_vblank(struct wl_client *client,
                return;
        }
 
+       if (tdm_debug_server) {
+               unsigned long curr = tdm_helper_get_time_in_micros();
+               unsigned long reqtime = (req_sec * 1000000) + req_usec;
+               if (curr - reqtime > 1000) /* 1ms */
+                       TDM_WRN("delay(req): %d us", (int)(curr - reqtime));
+       }
+
        vblank_info->resource = vblank_resource;
        vblank_info->private_server = private_server;
 
@@ -199,6 +215,11 @@ INTERN tdm_error
 tdm_server_init(tdm_private_loop *private_loop)
 {
        tdm_private_server *private_server;
+       const char *debug;
+
+       debug = getenv("TDM_DEBUG_SERVER");
+       if (debug && (strstr(debug, "1")))
+               tdm_debug_server = 1;
 
        if (private_loop->private_server)
                return TDM_ERROR_NONE;
index 1395786..4863833 100644 (file)
@@ -1,14 +1,14 @@
 bin_PROGRAMS = \
-       tdm-client
+       tdm-test-client
 
-tdm_client_SOURCES = \
+tdm_test_client_SOURCES = \
        tdm_test_client.c
 
-tdm_client_LDFLAGS = ${LDFLAGS}
-tdm_client_CFLAGS = \
+tdm_test_client_LDFLAGS = ${LDFLAGS}
+tdm_test_client_CFLAGS = \
        $(TDM_CFLAGS) \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/client
-tdm_client_LDADD = \
+tdm_test_client_LDADD = \
        $(TDM_LIBS) \
        $(top_builddir)/client/libtdm-client.la
index bc29283..cb71c10 100644 (file)
@@ -61,7 +61,7 @@ _client_vblank_handler(unsigned int sequence, unsigned int tv_sec,
        if (vblank - prev > 16966 || vblank - prev < 16366) /* +0.3 ~ -0.3 ms */
                printf("vblank              : %d us\n", vblank - prev);
 
-       if (client - vblank > 3000) /* 3ms */
+       if (client - vblank > 2000) /* 2ms */
                printf("kernel -> tdm-client: %d us\n", client - vblank);
 
        prev = vblank;