change dump API from tdm_helper to tbm_surface_internal
[platform/core/uifw/libtdm.git] / src / tdm_helper.c
index 534bebc..d85d412 100644 (file)
 
 static const char *dump_prefix[2] = {"png", "yuv"};
 
+int tdm_dump_enable;
+static int *tdm_helper_dump_count;
+static char *tdm_helper_dump_path;
+
 INTERN unsigned long
 tdm_helper_get_time_in_millis(void)
 {
@@ -27,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)
@@ -238,3 +253,36 @@ tdm_helper_set_fd(const char *env, int fd)
        if (fd >= 0)
                TDM_INFO("%s: fd(%d)", env, fd);
 }
+
+EXTERN void
+tdm_helper_dump_start(char *dumppath, int *count)
+{
+       if (tdm_helper_dump_count != NULL) {
+               TDM_DBG("tdm_helper_dump is already started.");
+               return;
+       }
+
+       if (dumppath == NULL || count == NULL) {
+               TDM_DBG("tdm_helper_dump dumppath or count is null.");
+               return;
+       }
+
+       tdm_helper_dump_count = count;
+       tdm_helper_dump_path = dumppath;
+
+       tdm_dump_enable = 1;
+
+       TDM_DBG("tdm_helper_dump start.(path : %s)", tdm_helper_dump_path);
+}
+
+EXTERN void
+tdm_helper_dump_stop(void)
+{
+       tdm_helper_dump_path = NULL;
+       tdm_helper_dump_count = NULL;
+
+       tdm_dump_enable = 0;
+
+       TDM_DBG("tdm_helper_dump stop.");
+}
+