surface: revert the code of return params of getting width/height
[platform/core/uifw/libtbm.git] / src / tbm_bufmgr.h
old mode 100755 (executable)
new mode 100644 (file)
index d8e18db..250274e
@@ -33,119 +33,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define _TBM_BUFMGR_H_
 
 #include <tbm_type.h>
-#include <stdint.h>
+#include <tbm_type_common.h>
+#include <tbm_bo.h>
+#include <tbm_error.h>
 
 /**
  * \file tbm_bufmgr.h
  * \brief Tizen Buffer Manager
  */
 
-/**
- * @brief Definition for the tizen buffer manager
- * @since_tizen 2.3
- */
-typedef struct _tbm_bufmgr * tbm_bufmgr;
-
-/**
- * @brief Definition for the tizen buffer object
- * @since_tizen 2.3
- */
-typedef struct _tbm_bo *tbm_bo;
-/**
- * @brief Definition for the key associated with the buffer object
- * @since_tizen 2.3
- */
-typedef uint32_t tbm_key;
-/**
- * @brief Definition for the file descripter of the system buffer manager
- * @since_tizen 2.3
- */
-typedef int32_t tbm_fd;
-
-
-/* TBM_DEVICE_TYPE */
-
-/**
- * @brief Definition for the device type to get the default handle
- * @since_tizen 2.3
- */
-#define TBM_DEVICE_DEFAULT   0
-/**
- * @brief Definition for the device type to get the virtual memory
- * @since_tizen 2.3
- */
-#define TBM_DEVICE_CPU       1
-/**
- * @brief Definition for the device type to get the 2D memory handle
- * @since_tizen 2.3
- */
-#define TBM_DEVICE_2D        2
-/**
- * @brief Definition for the device type to get the 3D memory handle
- * @since_tizen 2.3
- */
-#define TBM_DEVICE_3D        3
-/**
- * @brief Definition for the device type to get the multimedia handle
- * @since_tizen 2.3
- */
-#define TBM_DEVICE_MM        4
-
-/**
- * @brief Definition for the cache invalidate
- * @since_tizen 2.3
- */
-#define TBM_CACHE_INV            0x01
-/**
- * @brief Definition for the cache clean
- * @since_tizen 2.3
- */
-#define TBM_CACHE_CLN            0x02
-
-/* TBM_OPTION */
-
-/**
- * @brief Definition for the access option to read
- * @since_tizen 2.3
- */
-#define TBM_OPTION_READ      (1 << 0)
-/**
- * @brief Definition for the access option to write
- * @since_tizen 2.3
- */
-#define TBM_OPTION_WRITE     (1 << 1)
-/**
- * @brief Definition for the vendor specific option that depends on the backend
- * @since_tizen 2.3
- */
-#define TBM_OPTION_VENDOR    (0xffff0000)
-
-/**
- * @brief tbm_bo_handle abstraction of the memory handle by TBM_DEVICE_TYPE
- * @since_tizen 2.3
- */
-typedef union _tbm_bo_handle
-{
-   void     *ptr;
-   int32_t  s32;
-   uint32_t u32;
-   int64_t  s64;
-   uint64_t u64;
-} tbm_bo_handle;
-
-/**
- * @brief Enumeration of bo memory type
- * @since_tizen 2.3
- */
-enum TBM_BO_FLAGS
-{
-    TBM_BO_DEFAULT = 0,            /**< default memory: it depends on the backend         */
-    TBM_BO_SCANOUT = (1<<0),       /**< scanout memory                                    */
-    TBM_BO_NONCACHABLE = (1<<1),   /**< non-cachable memory                               */
-    TBM_BO_WC = (1<<2),            /**< write-combine memory                              */
-    TBM_BO_VENDOR = (0xffff0000), /**< vendor specific memory: it depends on the backend */
-};
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -165,7 +61,7 @@ extern "C" {
  * BUFMGR_MAP_CACHE default is true\n
  * true : use map cache flushing\n
  * false : to use map cache flushing
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @param[in] fd : file descripter of the system buffer manager
  * @return a buffer manager
  * @retval #tbm_bufmgr
@@ -175,7 +71,6 @@ extern "C" {
    #include <tbm_bufmgr.h>
    int bufmgr_fd;
 
-
    setenv("BUFMGR_LOCK_TYPE", "once", 1);
    setenv("BUFMGR_MAP_CACHE", "true", 1);
 
@@ -187,11 +82,11 @@ extern "C" {
    tbm_bufmgr_deinit (bufmgr);
    @endcode
  */
-tbm_bufmgr tbm_bufmgr_init   (int fd);
+tbm_bufmgr tbm_bufmgr_init(int fd);
 
 /**
  * @brief Deinitializes the buffer manager.
- * @since_tizen 2.3
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @param[in] bufmgr : the buffer manager
  * @see tbm_bufmgr_init()
  * @par Example
@@ -200,656 +95,141 @@ tbm_bufmgr tbm_bufmgr_init   (int fd);
 
    int bufmgr_fd;
    tbm_bufmgr bufmgr;
+   tbm_error_e error;
    bufmgr = tbm_bufmgr_init (bufmgr_fd);
+   if (!bufmgr)
+   {
+      error = tbm_get_last_error ();
+      ...
+   }
 
    ....
 
    tbm_bufmgr_deinit (bufmgr);
    @endcode
  */
-void       tbm_bufmgr_deinit (tbm_bufmgr bufmgr);
-
-/* Functions for bo */
+void tbm_bufmgr_deinit(tbm_bufmgr bufmgr);
 
 /**
- * @brief Allocates the buffer object.
- * @details This function create tbm_bo and set reference count to 1.\n
- * The user can craete tbm_bo with memory type flag #TBM_BO_FLAGS\n\n
- * #TBM_BO_DEFAULT indecates default memory: it depends on the backend\n
- * #TBM_BO_SCANOUT indecates scanout memory\n
- * #TBM_BO_NONCACHABLE indecates non-cachable memory\n
- * #TBM_BO_WC indecates write-combine memory\n
- * #TBM_BO_VENDOR indecates vendor specific memory: it depends on the tbm backend
- * @since_tizen 2.3
+ * @brief Gets the tbm buffer capability.
+ * @since_tizen 2.4
  * @param[in] bufmgr : the buffer manager
- * @param[in] size : the size of buffer object
- * @param[in] flags : the flags of memory type
- * @return a buffer object
- * @retval #tbm_bo
+ * @return the tbm bufmgr capability
  * @par Example
    @code
    #include <tbm_bufmgr.h>
 
    int bufmgr_fd;
    tbm_bufmgr bufmgr;
-   tbm_bo;
+   unsigned int capability;
 
    bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
 
-   ....
+   capability = tbm_bufmgr_get_capability (bufmgr);
 
    tbm_bufmgr_deinit (bufmgr);
    @endcode
  */
-tbm_bo        tbm_bo_alloc      (tbm_bufmgr bufmgr, int size, int flags);
+unsigned int tbm_bufmgr_get_capability(tbm_bufmgr bufmgr);
 
 /**
- * @brief Increases the reference count of bo.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @return a buffer object
- * @retval #tbm_bo
- * @see tbm_bo_unref()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo bo;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-
-   ...
-
-   bo = tbm_bo_ref (bo);
-
-   ....
-
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
+ * @brief bind the native_display.
+ * @since_tizen 3.0
+ * @param[in] bufmgr : the buffer manager
+ * @param[in] native_display : the native_display
  */
-tbm_bo        tbm_bo_ref        (tbm_bo bo);
+int tbm_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *native_display);
 
 /**
- * @brief Decreases the reference count of bo
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @see tbm_bo_ref()
- * @see tbm_bo_alloc()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo bo;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-
-   ...
-
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
+ * @brief Initializes the buffer manager at the display server.
+ * @details use this api to initialize the tbm_bufmgr at the display server.
+ * @since_tizen 5.0
  */
-void          tbm_bo_unref      (tbm_bo bo);
+tbm_bufmgr tbm_bufmgr_server_init(void);
 
 /**
- * @brief Maps the buffer object according to the device type and the option.
- * @details Cache flushing and Locking is executed, while tbm_bo is mapping in the proper condition according to the device type and the access option.\n
- * If the cache flush type of bufmgr set true, the map cache flushing is executed
- * If the lock type of bufmgr set once, the previous bo which is locked is unlock when the new bo is trying to be locked.\n
- * If the lock type of bufmgr set always, the new bo is locked until the previous bo which is locked is unlocked.\n
- * If the lock type of bufmgr set never, Every bo is never locked.\n\n
- * #TBM_DEVICE_DEFAULT indecates the default handle.\n
- * #TBM_DEVICE_2D indecates the 2D memory handle.\n
- * #TBM_DEVICE_3D indecates the 3D memory handle.\n
- * #TBM_DEVICE_CPU indecates the virtual memory handle.\n
- * #TBM_DEVICE_MM indecates the multimedia handle.\n\n
- * #TBM_OPTION_READ indecates the accss option to read.\n
- * #TBM_OPTION_WRITE indecates the access option to write.\n
- * #TBM_OPTION_VENDOR indecates the vendor specific option that depends on the backend.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @param[in] device : the device type to get a handle
- * @param[in] opt : the option to access the buffer object
- * @return the handle of the buffer object
- * @retval #tbm_bo
- * @see tbm_bo_unmap()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo bo;
-   tbm_bo_handle handle;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-
-   ...
-
-   handle = tbm_bo_map (bo, TBM_DEVICE_2D, TBM_OPTION_READ|TBM_OPTION_WRITE);
-
-   ...
-
-   tbm_bo_unmap (bo);
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
+ * @brief Set the bo_lock_type of the bufffer manager.
+ * @details set the bo_lock_type
+ * @since_tizen 5.0
  */
-tbm_bo_handle tbm_bo_map        (tbm_bo bo, int device, int opt);
+int tbm_bufmgr_set_bo_lock_type(tbm_bufmgr bufmgr, tbm_bufmgr_bo_lock_type bo_lock_type);
 
 /**
- * @brief Unmaps the buffer object.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @return 1 if this function succeeds, otherwise 0.
- * @see tbm_bo_map()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo bo
-   tbm_bo_handle handle;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-
-   ...
-
-   handle = tbm_bo_map (bo, TBM_DEVICE_2D, TBM_OPTION_READ|TBM_OPTION_WRITE);
-
-   ...
-
-   tbm_bo_unmap (bo);
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
+ * @brief Print out the information of tbm_bos.
+ * @since_tizen 3.0
+ * @param[in] bufmgr : the buffer manager
  */
-int           tbm_bo_unmap      (tbm_bo bo);
-
-/**
- * @brief Gets the tbm_bo_handle according to the device type.
- * @details The tbm_bo_handle can be get without the map of the tbm_bo.\n
- * In this case, TBM does not guarantee the lock and the cache flush of the tbm_bo.\n\n
- * #TBM_DEVICE_DEFAULT indecates the default handle.\n
- * #TBM_DEVICE_2D indecates the 2D memory handle.\n
- * #TBM_DEVICE_3D indecates the 3D memory handle.\n
- * #TBM_DEVICE_CPU indecates the virtual memory handle.\n
- * #TBM_DEVICE_MM indecates the multimedia handle.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @param[in] device : the device type to get a handle
- * @return the handle of the buffer object
- * @retval #tbm_bo_handle
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo bo;
-   tbm_bo_handle handle;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-
-   ...
-
-   handle = tbm_bo_get_handle (bo, TBM_DEVICE_2D);
-
-   ...
-
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
-  */
-tbm_bo_handle tbm_bo_get_handle (tbm_bo bo, int device);
+void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr);
 
 /**
- * @brief Exports the buffer object by key.
- * @details The tbm_bo can be exported to the anther process with the unique key associated with the the tbm_bo.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @return key associated with the buffer object
- * @retval #tbm_key
- * @see tbm_bo_import()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo;
-   tbm_key key;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-   key = tbm_bo_export (bo);
-
-   ...
-
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
-  */
-tbm_key  tbm_bo_export     (tbm_bo bo);
-
-/**
- * @brief Exports the buffer object by fd.
- * @details The tbm_bo can be exported to the anther process with the unique fd associated with the the tbm_bo.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @return fd associated with the buffer object
- * @retval #tbm_fd
- * @see tbm_bo_import_fd()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_fd bo_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-   bo_fd = tbm_bo_export (bo);
-
-   ...
-
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
-  */
-tbm_fd tbm_bo_export_fd (tbm_bo bo);
-
-/**
- * @brief Imports the buffer object associated with the key.
- * @details The reference count of the tbm_bo is 1.
- * @since_tizen 2.3
+ * @brief Get string with the information of tbm_bos.
+ * @since_tizen 3.0
  * @param[in] bufmgr : the buffer manager
- * @param[in] key : the key associated with the buffer object
- * @return a buffer object
- * @retval #tbm_bo
- * @see tbm_bo_export()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   int bo_key;
-   tbm_bufmgr bufmgr;
-   tbm_bo;
-
-   ...
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_import (key);
-
-   ...
-
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
-  */
-tbm_bo        tbm_bo_import     (tbm_bufmgr bufmgr, tbm_key key);
+ * @return sting with info if this function succeeds, otherwise NULL. It has to be free by user.
+ */
+char * tbm_bufmgr_debug_tbm_info_get(tbm_bufmgr bufmgr);
 
 /**
- * @brief Imports the buffer object associated with the fd.
- * @details The reference count of the tbm_bo is 1.
- * @since_tizen 2.3
+ * @brief Print out the trace of tbm_bos.
+ * @since_tizen 3.0
  * @param[in] bufmgr : the buffer manager
- * @param[in] fd : the fd associated with the buffer object
- * @return a buffer object
- * @retval #tbm_bo
- * @see tbm_bo_export_fd()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_fd bo_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo bo;
-
-   ...
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_import_fd (bo_fd);
-
-   ...
-
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
-  */
-tbm_bo        tbm_bo_import_fd  (tbm_bufmgr bufmgr, tbm_fd fd);
-
-/**
- * @brief Gets the size of a bo.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @return 1 if this function succeeds, otherwise 0.
- * @see tbm_bo_alloc()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo;
-   int size;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-   size = tbm_bo_size (bo);
-
-   ...
-
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
-  */
-int           tbm_bo_size       (tbm_bo bo);
-
-/**
- * @brief Gets the state where the buffer object is locked.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @return 1 if this bo is locked, otherwise 0.
- * @see tbm_bo_map()
- * @see tbm_bo_unmap()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo bo;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-
-   ...
-
-   if (tbm_bo_locked (bo))
-   {
-
-   ...
-
-   tbm_bo_unref (bo);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
-*/
-int           tbm_bo_locked     (tbm_bo bo);
-
-/**
- * @brief Swaps the buffer object.
- * @since_tizen 2.3
- * @param[in] bo1 : the buffer object
- * @param[in] bo2 : the buffer object
- * @return 1 if this function succeeds, otherwise 0.
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   int bufmgr_fd;
-   tbm_bufmgr bufmgr;
-   tbm_bo bo1;
-   tbm_bo bo2;
-   int ret;
-
-   bufmgr = tbm_bufmgr_init (bufmgr_fd);
-   bo1 = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-   bo2 = tbm_bo_alloc (bufmgr, 256 * 256, TBM_BO_DEFAULT);
-
-   ...
-
-   ret = tbm_bo_swap (bo1, bo2);
-
-   ...
-
-   tbm_bo_unref (bo1);
-   tbm_bo_unref (bo2);
-   tbm_bufmgr_deinit (bufmgr);
-   @endcode
+ * @param[in] onoff : 1 is on, and 0 is off
  */
-int           tbm_bo_swap       (tbm_bo bo1, tbm_bo bo2);
-
+void tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff);
 
 /**
- * @brief Called when the user data is deleted in buffer object.
- * @since_tizen 2.3
- * @param[in] user_data User_data to be passed to callback function
- * @pre The callback must be registered using tbm_bo_add_user_data().\n
- * tbm_bo_delete_user_data() must be called to invoke this callback.
- * @see tbm_bo_add_user_data()
- * @see tbm_bo_delete_user_data()
+ * @brief Dump all tbm surfaces
+ * @param[in] path : the given dump path
+ * @return 1 if this function succeeds, otherwise 0.
  */
-typedef void (*tbm_data_free)(void *user_data);
+int tbm_bufmgr_debug_dump_all(char *path);
 
 /**
- * @brief Adds a user_data to the buffer object.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @param[in] key : the key associated with the user_data
- * @param[in] data_free_func : the function pointer to free the user_data
+ * @brief Start the dump debugging for queue.
+ * @since_tizen 3.0
+ * @param[in] path : the given dump path
+ * @param[in] count : the dump count number
+ * @param[in] onoff : 1 is on, and 0 is off, if onoff==0 path and count are ignored
  * @return 1 if this function succeeds, otherwise 0.
- * @post tbm_data_free() will be called under certain conditions, after calling tbm_bo_delete_user_data().
- * @see tbm_data_free()
- * @see tbm_bo_set_user_data()
- * @see tbm_bo_get_user_data()
- * @see tbm_bo_delete_user_data()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   void example_data_free (void *user_data)
-   {
-       char *data = (char*) user_data;
-       free(data);
-   }
-
-   int main()
-   {
-       int bufmgr_fd;
-       tbm_bufmgr bufmgr;
-       tbm_bo bo;
-       char *user_data;
-       char *get_data;
-       int ret;
-
-       bufmgr = tbm_bufmgr_init (bufmgr_fd);
-       bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-       user_data = (char*) malloc (sizeof(char) * 128);
-
-       ...
-
-       tbm_bo_add_user_data (bo, 1, example_data_free);
-       tbm_bo_set_user_data (bo, 1, user_data);
-
-       ...
-
-       ret = tbm_bo_get_user_data (bo, 1, &get_data);
-       tbm_bo_delete_user_data (bo, 1);
-
-       ...
-
-       tbm_bo_unref (bo);
-       tbm_bufmgr_deinit (bufmgr);
-   }
-   @endcode
  */
-
-int tbm_bo_add_user_data    (tbm_bo bo, unsigned long key, tbm_data_free data_free_func);
+int tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff);
 
 /**
- * @brief Deletes the user_data in the buffer object.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @param[in] key : the key associated with the user_date
- * @return 1 if this function succeeds, otherwise 0.
- * @see tbm_bo_add_user_data()
- * @see tbm_bo_get_user_data()
- * @see tbm_bo_delete_user_data()
+ * @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>
 
-   void example_data_free (void *user_data)
-   {
-       char *data = (char*) user_data;
-       free(data);
-   }
-
-   int main()
-   {
-       int bufmgr_fd;
-       tbm_bufmgr bufmgr;
-       tbm_bo bo;
-       char *user_data;
-       char *get_data;
-       int ret;
-
-       bufmgr = tbm_bufmgr_init (bufmgr_fd);
-       bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-       user_data = (char*) malloc (sizeof(char) * 128);
-
-       ...
-
-       tbm_bo_add_user_data (bo, 1, example_data_free);
-       tbm_bo_set_user_data (bo, 1, user_data);
-
-       ...
-
-       ret = tbm_bo_get_user_data (bo, 1, &get_data);
-       tbm_bo_delete_user_data (bo, 1);
+   // 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);
 
-       tbm_bo_unref (bo);
-       tbm_bufmgr_deinit (bufmgr);
-   }
    @endcode
  */
-int tbm_bo_delete_user_data (tbm_bo bo, unsigned long key);
+void tbm_bufmgr_debug_dump_set_scale(double scale);
 
 /**
- * @brief Sets a user_date to the buffer object.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @param[in] key : the key associated with the user_date
- * @param[in] data : a pointer of the user_data
- * @return 1 if this function succeeds, otherwise 0.
- * @see tbm_bo_add_user_data()
- * @see tbm_bo_set_user_data()
- * @see tbm_bo_delete_user_data()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   void example_data_free (void *user_data)
-   {
-       char *data = (char*) user_data;
-       free(data);
-   }
-
-   int main()
-   {
-       int bufmgr_fd;
-       tbm_bufmgr bufmgr;
-       tbm_bo bo;
-       char *user_data;
-       char *get_data;
-       int ret;
-
-       bufmgr = tbm_bufmgr_init (bufmgr_fd);
-       bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-       user_data = (char*) malloc (sizeof(char) * 128);
-
-       ...
-
-       tbm_bo_add_user_data (bo, 1, example_data_free);
-       tbm_bo_set_user_data (bo, 1, user_data);
-
-       ...
-
-       ret = tbm_bo_get_user_data (bo, 1, &get_data);
-       tbm_bo_delete_user_data (bo, 1);
-
-       ...
-
-       tbm_bo_unref (bo);
-       tbm_bufmgr_deinit (bufmgr);
-   }
-   @endcode
+ * @brief Get ref_count of a global tbm_bufmgr
+ * @since_tizen 5.0
  */
-int tbm_bo_set_user_data    (tbm_bo bo, unsigned long key, void* data);
+int tbm_bufmgr_debug_get_ref_count(void);
 
 /**
- * @brief Gets a user_data from the buffer object with the key.
- * @since_tizen 2.3
- * @param[in] bo : the buffer object
- * @param[in] key : the key associated with the user_date
- * @param[out] data : to get the user data
- * @return 1 if this function succeeds, otherwise 0.
- * @see tbm_bo_add_user_data()
- * @see tbm_bo_set_user_data()
- * @see tbm_bo_get_user_data()
- * @par Example
-   @code
-   #include <tbm_bufmgr.h>
-
-   void example_data_free (void *user_data)
-   {
-       char *data = (char*) user_data;
-       free(data);
-   }
-
-   int main()
-   {
-       int bufmgr_fd;
-       tbm_bufmgr bufmgr;
-       tbm_bo bo;
-       char *user_data;
-       char *get_data;
-       int ret;
-
-       bufmgr = tbm_bufmgr_init (bufmgr_fd);
-       bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-       user_data = (char*) malloc (sizeof(char) * 128);
-
-       ...
-
-       tbm_bo_add_user_data (bo, 1, example_data_free);
-       tbm_bo_set_user_data (bo, 1, user_data);
-
-       ...
-
-       ret = tbm_bo_get_user_data (bo, 1, &get_data);
-       tbm_bo_delete_user_data (bo, 1);
-
-       ...
-
-       tbm_bo_unref (bo);
-       tbm_bufmgr_deinit (bufmgr);
-   }
-   @endcode
+ * @brief set or unset the trace_mask to print out the trace logs.
+ * @since_tizen 5.0
+ * @param[in] bufmgr : the buffer manager
+ * @param[in] mask : enum value for the trace log
+ * @param[in] set : set the mask when set is 1, otherwise unset the mask when set is 0
  */
-int tbm_bo_get_user_data    (tbm_bo bo, unsigned long key, void** data);
+void tbm_bufmgr_debug_set_trace_mask(tbm_bufmgr bufmgr, tbm_bufmgr_debug_trace_mask mask, int set);
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* _TBM_BUFMGR_H_ */
-
+#endif                                                 /* _TBM_BUFMGR_H_ */