add scale factor to tbm_bufmgr_debug_dump_all() and tbm_bufmgr_debug_queue_dump(... 58/134258/9
authorRoman Marchenko <r.marchenko@samsung.com>
Thu, 15 Jun 2017 12:28:57 +0000 (15:28 +0300)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 19 Jun 2017 07:04:32 +0000 (07:04 +0000)
Change-Id: I45803fdc89a1aa050be1365d41501325c263f81d
Signed-off-by: Roman Marchenko <r.marchenko@samsung.com>
src/tbm_bufmgr.c
src/tbm_bufmgr.h
src/tbm_surface_internal.c

index 64b12f6..f101e73 100644 (file)
@@ -56,7 +56,7 @@ int b_dump_queue;
 static pthread_mutex_t gLock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t tbm_bufmgr_lock = PTHREAD_MUTEX_INITIALIZER;
 static __thread tbm_error_e tbm_last_error = TBM_ERROR_NONE;
-
+static double scale_factor = 0;
 static void _tbm_bufmgr_mutex_unlock(void);
 
 //#define TBM_BUFMGR_INIT_TIME
@@ -1628,6 +1628,14 @@ tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff)
        _tbm_bufmgr_mutex_unlock();
 }
 
+void
+tbm_bufmgr_debug_dump_set_scale(double scale)
+{
+       pthread_mutex_lock(&gLock);
+       scale_factor = scale;
+       pthread_mutex_unlock(&gLock);
+}
+
 int
 tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff)
 {
@@ -1653,7 +1661,9 @@ tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff)
                        return 0;
                }
 
-               tbm_surface_internal_dump_start(path, w, h, count);
+               tbm_surface_internal_dump_with_scale_start(path, w, h, count, scale_factor);
+               scale_factor = 0;
+
                b_dump_queue = 1;
        }
 
@@ -1679,7 +1689,8 @@ tbm_bufmgr_debug_dump_all(char *path)
                return 1;
        }
 
-       tbm_surface_internal_dump_start(path, w, h, count);
+       tbm_surface_internal_dump_with_scale_start(path, w, h, count, scale_factor);
+       scale_factor = 0;
 
        LIST_FOR_EACH_ENTRY(surface, &gBufMgr->surf_list, item_link)
                tbm_surface_internal_dump_buffer(surface, "dump_all");
index 6ba3edb..7d89204 100644 (file)
@@ -1062,6 +1062,26 @@ int tbm_bufmgr_debug_dump_all(char *path);
  */
 int tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff);
 
+/**
+ * @brief Set scale factor for the nearest calling tbm_bufmgr_debug_dump_all() or tbm_bufmgr_debug_queue_dump()
+ * @since_tizen 3.0
+ * @param[in] scale : the scale factor, 0 - disable scaling
+ * @par Example
+   @code
+   #include <tbm_bufmgr.h>
+
+   // Dump all surface with scale factor 0.5
+   tbm_bufmgr_debug_dump_set_scale(0.5);
+   tbm_bufmgr_debug_dump_all("/tmp/");
+
+   // Start the dump debugging for queue with scale factor 0.5
+   tbm_bufmgr_debug_dump_set_scale(0.2);
+   tbm_bufmgr_debug_queue_dump("/tmp/", 10, 1);
+
+   @endcode
+ */
+void tbm_bufmgr_debug_dump_set_scale(double scale);
+
 int tbm_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *NativeDisplay);
 
 #ifdef __cplusplus
index afcf94f..df77fe7 100644 (file)
@@ -1708,10 +1708,12 @@ fail:
 void
 tbm_surface_internal_dump_with_scale_start(char *path, int w, int h, int count, double scale)
 {
-       TBM_RETURN_IF_FAIL(scale > 0.0);
-
-       tbm_surface_internal_dump_start(path, (int)(scale * w), (int)(scale * h), count);
+       if (scale > 0.0) {
+               w *= scale;
+               h *= scale;
+       }
 
+       tbm_surface_internal_dump_start(path, w, h, count);
        scale_factor = scale;
 }