add tbm_surface_internal_dump_all for debugging 46/78846/6 accepted/tizen/common/20160719.172045 accepted/tizen/ivi/20160718.105004 accepted/tizen/mobile/20160718.105047 accepted/tizen/tv/20160718.104748 accepted/tizen/wearable/20160718.105010 submit/tizen/20160718.061633
authorRoman Marchenko <r.marchenko@samsung.com>
Wed, 6 Jul 2016 14:34:50 +0000 (17:34 +0300)
committerRoman Marchenko <r.marchenko@samsung.com>
Fri, 15 Jul 2016 08:37:46 +0000 (11:37 +0300)
Change-Id: Ic9beae82f643c4e635ab7e49d7a4a5a2f07dd87f
Signed-off-by: Roman Marchenko <r.marchenko@samsung.com>
src/tbm_surface_internal.c
src/tbm_surface_internal.h

index 4d59884..dbdf5f9 100644 (file)
@@ -297,6 +297,32 @@ _tbm_surface_internal_destroy(tbm_surface_h surface)
        }
 }
 
+static int
+_tbm_surface_get_max_size(int * w, int * h)
+{
+       int count = 0;
+       tbm_surface_h surface = NULL, tmp = NULL;
+       tbm_surface_info_s info;
+
+       *w = 0;
+       *h = 0;
+
+       if (g_surface_bufmgr == NULL)
+               return count;
+
+       if (!LIST_IS_EMPTY(&g_surface_bufmgr->surf_list)) {
+               LIST_FOR_EACH_ENTRY_SAFE(surface, tmp, &g_surface_bufmgr->surf_list, item_link) {
+                       if (tbm_surface_get_info(surface, &info) == TBM_SURFACE_ERROR_NONE) {
+                               count++;
+                               if (*w < info.width) *w = info.width;
+                               if (*h < info.height) *h = info.height;
+                       }
+               }
+       }
+
+       return count;
+}
+
 int
 tbm_surface_internal_is_valid(tbm_surface_h surface)
 {
@@ -1699,4 +1725,25 @@ void tbm_surface_internal_dump_shm_buffer(void *ptr, int w, int h, int  stride,
 
        TBM_LOG_I("Dump %s \n", buf_info->name);
 }
+
+void tbm_surface_internal_dump_all(char *path)
+{
+       TBM_RETURN_IF_FAIL(path != NULL);
+       int w = 0, h = 0, count = 0;
+       tbm_surface_h surface = NULL, tmp = NULL;
+
+       count = _tbm_surface_get_max_size(&w, &h);
+       if (count == 0) {
+               TBM_LOG_I("No tbm_surface.\n");
+               return;
+       }
+
+       tbm_surface_internal_dump_start(path, w, h, count);
+
+       LIST_FOR_EACH_ENTRY_SAFE(surface, tmp, &g_surface_bufmgr->surf_list, item_link) {
+               tbm_surface_internal_dump_buffer(surface, "dump_all");
+       }
+
+       tbm_surface_internal_dump_end();
+}
 /*LCOV_EXCL_STOP*/
index 6240494..e31c8d9 100644 (file)
@@ -447,6 +447,12 @@ void tbm_surface_internal_dump_buffer(tbm_surface_h surface, const char *type);
 void tbm_surface_internal_dump_shm_buffer(void *ptr, int w, int h, int stride, const char *type);
 
 /**
+ * @brief Dump all tbm surfaces
+ * @param[in] path : the given dump path
+ */
+void tbm_surface_internal_dump_all(char *path);
+
+/**
  * @brief check valid tbm surface.
  * @since_tizen 3.0
  * @param[in] surface : the tbm surface.