change tbm_surface_internal_dump_start parameter 01/69201/3
authorJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 12 May 2016 06:32:24 +0000 (15:32 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 12 May 2016 06:50:55 +0000 (23:50 -0700)
Change-Id: Icf81a414ba5a03d23efae7d11875e1099957c191
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/tbm_surface_internal.c [changed mode: 0644->0755]
src/tbm_surface_internal.h

old mode 100644 (file)
new mode 100755 (executable)
index fcc5686..59eac8f
@@ -1265,16 +1265,21 @@ _tbm_surface_internal_dump_file_png(const char *file, const void *data, int widt
 }
 
 void
-tbm_surface_internal_dump_start(char *path, int buffer_size, int count)
+tbm_surface_internal_dump_start(char *path, int w, int h, int count)
 {
        TBM_RETURN_IF_FAIL(path != NULL);
-       TBM_RETURN_IF_FAIL(buffer_size > 0);
+       TBM_RETURN_IF_FAIL(w > 0);
+       TBM_RETURN_IF_FAIL(h > 0);
        TBM_RETURN_IF_FAIL(count > 0);
 
        tbm_surface_dump_buf_info *buf_info = NULL;
        tbm_surface_dump_buf_info *tmp;
        tbm_bo bo = NULL;
        int i;
+       int buffer_size;
+       tbm_surface_h tbm_surface;
+       tbm_surface_info_s info;
+       tbm_surface_error_e err;
 
        /* check running */
        if (g_dump_info) {
@@ -1291,6 +1296,27 @@ tbm_surface_internal_dump_start(char *path, int buffer_size, int count)
        g_dump_info->count = 0;
        g_dump_info->dump_max = count;
 
+       /* get buffer size */
+       tbm_surface = tbm_surface_create(w, h, TBM_FORMAT_ARGB8888);
+       if (tbm_surface == NULL) {
+               TBM_LOG("tbm_surface_create fail\n");
+               free(g_dump_info);
+               g_dump_info = NULL;
+               return;
+       }
+       err = tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, &info);
+       if (err != TBM_SURFACE_ERROR_NONE) {
+               TBM_LOG("tbm_surface_map fail\n");
+               tbm_surface_destroy(tbm_surface);
+               free(g_dump_info);
+               g_dump_info = NULL;
+               return;
+       }
+       buffer_size = info.planes[0].stride * h;
+       tbm_surface_unmap(tbm_surface);
+       tbm_surface_destroy(tbm_surface);
+
+       /* create dump lists */
        for (i = 0; i < count; i++)     {
                buf_info = calloc(1, sizeof(tbm_surface_dump_buf_info));
                TBM_GOTO_VAL_IF_FAIL(buf_info, fail);
index d995d27..d6db4b1 100644 (file)
@@ -401,11 +401,12 @@ int tbm_surface_internal_delete_user_data(tbm_surface_h surface,
  * @brief Start the dump debugging.
  * @since_tizen 3.0
  * @param[in] path The given dump path
- * @param[in] buffer_size the buffer size of a dump image
+ * @param[in] w The width of dump image
+ * @param[in] h The height of dump image
  * @param[in] count The dump count number
  * @see #tdm_helper_dump_stop()
  */
-void tbm_surface_internal_dump_start(char *path, int buffer_size, int count);
+void tbm_surface_internal_dump_start(char *path, int w, int h, int count);
 
 /**
  * @brief End the dump debugging.