The exposed header files is at include directory now.
Change-Id: I2ba32fb4920e1e3dfd71befbfd8b1e885a83db19
if HAVE_HALTESTS
-SUBDIRS = src haltests
+SUBDIRS = include src haltests
else
-SUBDIRS = src
+SUBDIRS = include src
endif
pkgconfigdir = $(libdir)/pkgconfig
AM_CONDITIONAL(HOST_CPU_X86_64, test "x$HOST_CPU_X86_64" = "xyes")
AC_OUTPUT([
- src/Makefile
+ include/Makefile
+ src/Makefile
Makefile
libtbm.pc
haltests/Makefile])
tbm_haltests_CXXFLAGS = \
@DLOG_CFLAGS@ \
${CXXFLAGS} \
+ -I$(top_builddir)/include \
-I$(top_builddir)/src \
-I$(includedir)/gtest
--- /dev/null
+libtbmincludedir=$(includedir)
+libtbminclude_HEADERS = \
+ tbm_type.h \
+ tbm_type_common.h \
+ tbm_log.h \
+ tbm_error.h \
+ tbm_bufmgr.h \
+ tbm_bo.h \
+ tbm_surface.h \
+ tbm_surface_internal.h \
+ tbm_surface_queue.h \
+ tbm_sync.h \
+ tbm_drm_helper.h \
+ tbm_bufmgr_backend.h \
+ tbm_backend.h
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2018 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>,
+ Sangjin Lee <lsj119@samsung.com>,
+ Boram Park <boram1288.park@samsung.com>,
+ Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_BACKEND_H_
+#define _TBM_BACKEND_H_
+
+#include <tbm_type_common.h>
+
+/**
+ * \file tbm_backend.h
+ * \brief The backend header file for Tizen Buffer Manager
+ * This header is for the implementation of the TBM backend module.
+ * This backend header is used from the 3.0 version of libtbm and from
+ * the 5.0 version of the tizen.
+ * @code
+ * #include <tbm_backend.h>
+ * @endcode
+ */
+
+#define TBM_BACKEND_ABI_MINOR_MASK 0x0000FFFF
+#define TBM_BACKEND_ABI_MAJOR_MASK 0xFFFF0000
+#define TBM_BACKEND_GET_ABI_MINOR(v) ((v) & TBM_BACKEND_ABI_MINOR_MASK)
+#define TBM_BACKEND_GET_ABI_MAJOR(v) (((v) & TBM_BACKEND_ABI_MAJOR_MASK) >> 16)
+/*
+ * ABI versions. Each version has a major and minor revision. Modules
+ * using lower minor revisions must work with servers of a higher minor
+ * revision. There is no compatibility between different major revisions.
+ * Whenever the ABI_MAJOR_VERSION is changed, the others must also be
+ * changed. The minor revision mask is 0x0000FFFF and the major revision
+ * mask is 0xFFFF0000.
+ */
+#define TBM_BACKEND_SET_ABI_VERSION(maj, min) \
+ ((((maj) << 16) & TBM_BACKEND_ABI_MAJOR_MASK) | ((min) & TBM_BACKEND_ABI_MINOR_MASK))
+
+#define TBM_BACKEND_ABI_VERSION_1_0 TBM_BACKEND_SET_ABI_VERSION(1, 0)
+#define TBM_BACKEND_ABI_VERSION_2_0 TBM_BACKEND_SET_ABI_VERSION(2, 0)
+#define TBM_BACKEND_ABI_VERSION_3_0 TBM_BACKEND_SET_ABI_VERSION(3, 0)
+#define TBM_BACKEND_ABI_LATEST_VERSION TBM_BACKEND_ABI_VERSION_3_0 /**< the latest version of the tbm backend abi */
+
+/**
+ * @brief The backend bufmgr data
+ * @details
+ * The init() function of #tbm_backend_module returns the backend module data.
+ * This handle will be used in #tbm_backend_bufmgr_func.
+ * @see tbm_backend_module, tbm_backend_bufmgr_func
+ */
+typedef void tbm_backend_bufmgr_data;
+
+/**
+ * @brief The backend bo data
+ * @details
+ * The allocation function and the import function in #tbm_backend_bufmgr_func
+ * returns the backend bo data. This handle will be used in #tbm_backend_bo_func.
+ * @see tbm_backend_bufmgr_funce, tbm_backend_bo_func
+ */
+typedef void tbm_backend_bo_data;
+
+/**
+ * @brief The type definition of the bufmgr functions
+ */
+typedef struct _tbm_backend_bufmgr_func tbm_backend_bufmgr_func;
+
+/**
+ * @brief The type definition of the bo functions
+ */
+typedef struct _tbm_backend_bo_func tbm_backend_bo_func;
+
+/**
+ * @brief The bufmgr functions for a backend module.
+ */
+struct _tbm_backend_bufmgr_func {
+ /**
+ * @brief Get the capabilities of a buffer manager
+ * @remarks The backend must support the TBM_BUFMGR_CAPABILITY_SHARE_FD.
+ * TBM_BUFMGR_CAPABILITY_SHARE_KEY will help you do debugging to
+ * develop the platform because the tbm_key will be the unique
+ * identification of the tbm_bo memory in the system.
+ * @param[in] bufmgr_data The backend module data
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return the capabilities of a backend modul
+ */
+ tbm_bufmgr_capability (*bufmgr_get_capabilities)(tbm_backend_bufmgr_data *bufmgr_data,
+ tbm_error_e *error);
+
+ /**
+ * @brief set(bind) the native display
+ * @param[in] bufmgr_data The backend bufmgr data
+ * @param[in] native_display : the native display (wl_display in wayland window system)
+ * @return #TBM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tbm_error_e (*bufmgr_bind_native_display)(tbm_backend_bufmgr_data *bufmgr_data,
+ tbm_native_display *native_display);
+
+ /**
+ * @brief get the formats list and the num to be supported by backend.
+ * @param[in] bufmgr_data The backend bufmgr data
+ * @param[out] **formats : format array list. it is allocated by backend funtion
+ * @param[out] *num : the number of the formats to be supported by backend
+ * @return #TBM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tbm_error_e (*bufmgr_get_supported_formats)(tbm_backend_bufmgr_data *bufmgr_data,
+ uint32_t **formats, uint32_t *num);
+
+ /**
+ * @brief get the plane data of the plane_idx according to the format.
+ * @param[in] bufmgr_data The backend bufmgr data
+ * @param[in] format : the format of the surface
+ * @param[in] plane_idx : the index of the plane
+ * @param[in] width : the width of the surface with the format
+ * @param[in] height : the height of the surface with the format
+ * @param[out] size : the size of the plane index
+ * @param[out] offset : the offset of the plane index at the bo index
+ * @param[out] pitch : the pitch of the plane index
+ * @param[out] bo_idx : the bo index of the plane index
+ * @return #TBM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tbm_error_e (*bufmgr_get_plane_data)(tbm_backend_bufmgr_data *bufmgr_data,
+ tbm_format format, int plane_idx, int width,
+ int height, uint32_t *size, uint32_t *offset,
+ uint32_t *pitch, int *bo_idx);
+
+ /**
+ * @brief allocate the bo data of the tbm_backend
+ * @param[in] bufmgr_data The backend bufmgr data
+ * @param[in] size : the size of bo data
+ * @param[in] mem_types : the memory types
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return pointer of the bo_data of the tbm backend.
+ */
+ tbm_backend_bo_data *(*bufmgr_alloc_bo)(tbm_backend_bufmgr_data *bufmgr_data,
+ unsigned int size, tbm_bo_memory_type mem_types,
+ tbm_error_e *error);
+
+ /**
+ * @brief allocate the bo data of the bo index according to the format
+ * @param[in] bufmgr_data The backend bufmgr data
+ * @param[in] width : the width of the surface with the format
+ * @param[in] height : the height of the surface with the format
+ * @param[in] format : the format of the surface
+ * @param[in] mem_types : the memory types
+ * @param[in] bo_idx : the bo index of the surface
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return pointer of the bo data of the tbm backend.
+ */
+ tbm_backend_bo_data *(*bufmgr_alloc_bo_with_format)(tbm_backend_bufmgr_data *bufmgr_data,
+ int format, int bo_idx, int width,
+ int height, tbm_bo_memory_type mem_types,
+ tbm_error_e *error);
+
+ /**
+ * @brief import the bo data associated with the tdm_fd(prime fd).
+ * @remarks tbm_fd must be free by user.
+ * @remarks It must be supported at the backend module. To sharing the tdm_fd(prime fd)
+ * among the processes is the essential feature to run the graphic rendering.
+ * @param[in] bufmgr_data The backend bufmgr data
+ * @param[in] fd : the tdm_fd(prime fd) associated with the bo data
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return pointer of the bo data of the tbm backend.
+ */
+ tbm_backend_bo_data *(*bufmgr_import_fd)(tbm_backend_bufmgr_data *bufmgr_data,
+ tbm_fd fd, tbm_error_e *error);
+
+ /**
+ * @brief import the bo data associated with the tdm_key.
+ * @remarks If the backend doesn't support a buffer sharing by tbm key,
+ * fucntion pointer must be set to NULL.
+ * @param[in] bufmgr_data The backend bufmgr data
+ * @param[in] key : the tdm_key associated with the bo data
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return pointer of the bo data of the tbm backend.
+ */
+ tbm_backend_bo_data *(*bufmgr_import_key)(tbm_backend_bufmgr_data *bufmgr_data,
+ tbm_key key, tbm_error_e *error);
+
+ /* Padding for future extension */
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
+ void (*reserved4)(void);
+ void (*reserved5)(void);
+ void (*reserved6)(void);
+};
+
+/**
+ * @brief The bo functions for a backend module.
+ */
+struct _tbm_backend_bo_func {
+ /**
+ * @brief free the bo data.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @return #TBM_ERROR_NONE if success. Otherwise, error value.
+ */
+ void (*bo_free)(tbm_backend_bo_data *bo_data);
+
+ /**
+ * @brief get the size of a bo data.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return size if this function succeeds, otherwise 0.
+ */
+ int (*bo_get_size)(tbm_backend_bo_data *bo_data, tbm_error_e *error);
+
+ /**
+ * @brief get the tbm memory types
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @see #TBM_BO_FLAGS #tbm_bo_memory_type
+ * @return tbm flags of memory type is this function succeeds, otherwise 0.
+ */
+ tbm_bo_memory_type (*bo_get_memory_types)(tbm_backend_bo_data *bo_data,
+ tbm_error_e *error);
+
+ /**
+ * @brief get the tbm_bo_handle according to the device type.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @param[in] device : the device type to get a handle
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return the handle of the bo data
+ */
+ tbm_bo_handle (*bo_get_handle)(tbm_backend_bo_data *bo_data,
+ tbm_bo_device_type device, tbm_error_e *error);
+
+ /**
+ * @brief map the bo data according to the device type and the option.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @param[in] device : the device type to get a handle
+ * @param[in] opt : the option to access the bo data
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return the handle of the bo data
+ */
+ tbm_bo_handle (*bo_map)(tbm_backend_bo_data *bo_data, tbm_bo_device_type device,
+ tbm_bo_access_option opt, tbm_error_e *error);
+
+ /**
+ * @brief unmap the bo data.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @return #TBM_ERROR_NONE if success. Otherwise, error value.
+ */
+ tbm_error_e (*bo_unmap)(tbm_backend_bo_data *bo_data);
+
+ /**
+ * @brief lock the bo data with a device and an opt.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @param[in] device : the device type to get a handle
+ * @param[in] opt : the option to access the bo data
+ * @return #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @remark This function pointer could be null.
+ */
+ tbm_error_e (*bo_lock)(tbm_backend_bo_data *bo_data, tbm_bo_device_type device,
+ tbm_bo_access_option opt);
+
+ /**
+ * @brief unlock the bo data.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @return #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @remark This function pointer could be null.
+ */
+ tbm_error_e (*bo_unlock)(tbm_backend_bo_data *bo_data);
+
+ /**
+ * @brief export the bo data to the tdm_fd(prime fd)
+ * @remarks tbm_fd must be free by user.
+ * @remarks It must be supported at the backend module. To sharing the tdm_fd(prime fd)
+ * among the processes is the essential feature to run the graphic rendering.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return tbm_fd associated with the bo data
+ */
+ tbm_fd (*bo_export_fd)(tbm_backend_bo_data *bo_data, tbm_error_e *error);
+
+ /**
+ * @brief export the bo data to the tdm_key
+ * @remarks If the backend doesn't support a buffer sharing by tbm key,
+ * fucntion pointer must be set to NULL.
+ * @param[in] bo_data : the bo data of the tbm backend
+ * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
+ * @return key associated with the bo data
+ */
+ tbm_key (*bo_export_key)(tbm_backend_bo_data *bo_data, tbm_error_e *error);
+
+ /* Padding for future extension */
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
+ void (*reserved4)(void);
+ void (*reserved5)(void);
+ void (*reserved6)(void);
+};
+
+/**
+ * @brief The backend module information of the entry point to initialize a tbm
+ * backend module.
+ * @remark
+ * A backend module @b SHOULD define the global data symbol of which name is
+ * @b "tbm_backend_module_data". tbm will read this symbol, @b "tbm_backend_module_data",
+ * at the initial time and call init() function of #tbm_backend_module.
+ */
+typedef struct _tbm_backend_module {
+ const char *name; /**< The module name of a backend module */
+ const char *vendor; /**< The vendor name of a backend module */
+ unsigned long abi_version; /**< The ABI version of a backend module */
+
+ /**
+ * @brief The init function of a backend module
+ * @param[in] bufmgr A tbm buffer manager object.
+ * @return The backend module data
+ * @see tbm_backend_bufmgr_data
+ */
+ tbm_backend_bufmgr_data *(*init)(tbm_bufmgr bufmgr, tbm_error_e *error);
+
+ /**
+ * @brief deinitialize the bufmgr private data.
+ * @param[in] bufmgr_data : The backend module data
+ */
+ void (*deinit)(tbm_backend_bufmgr_data *bufmgr_data);
+} tbm_backend_module;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int tbm_backend_bufmgr_query_display_server(tbm_bufmgr bufmgr, tbm_error_e *error);
+tbm_backend_bufmgr_func *tbm_backend_bufmgr_alloc_bufmgr_func(tbm_bufmgr bufmgr, tbm_error_e *error);
+void tbm_backend_bufmgr_free_bufmgr_func(tbm_bufmgr bufmgr, tbm_backend_bufmgr_func *func);
+tbm_error_e tbm_backend_bufmgr_register_bufmgr_func(tbm_bufmgr bufmgr, tbm_backend_bufmgr_func *func);
+tbm_backend_bo_func *tbm_backend_bufmgr_alloc_bo_func(tbm_bufmgr bufmgr, tbm_error_e *error);
+void tbm_backend_bufmgr_free_bo_func(tbm_bufmgr bufmgr, tbm_backend_bo_func *func);
+tbm_error_e tbm_backend_bufmgr_register_bo_func(tbm_bufmgr bufmgr, tbm_backend_bo_func *func);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _TBM_BACKEND_H_ */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_BO_H_
+#define _TBM_BO_H_
+
+#include <tbm_type.h>
+#include <tbm_type_common.h>
+#include <tbm_error.h>
+
+/**
+ * \file tbm_bo.h
+ * \brief Tizen Buffer Object
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Functions for buffer object */
+
+/**
+ * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ * @par Example
+ @code
+ #include <tbm_bufmgr.h>
+
+ int bufmgr_fd;
+ tbm_bufmgr bufmgr;
+ tbm_bo;
+ tbm_error_e error;
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+ if (!bo)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ....
+
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_bo tbm_bo_alloc(tbm_bufmgr bufmgr, int size, int flags);
+
+/**
+ * @brief Increases the reference count of bo.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ */
+tbm_bo tbm_bo_ref(tbm_bo bo);
+
+/**
+ * @brief Decreases the reference count of bo
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ */
+void tbm_bo_unref(tbm_bo bo);
+
+/**
+ * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ * @exception #TBM_ERROR_NONE Success
+ * @exception #TBM_ERROR_BO_LOCK_FAILED tbm_bo lock failed
+ * @exception #TBM_ERROR_BO_MAP_FAILED tbm_bo map failed
+ * @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;
+ tbm_error_e error;
+
+ 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);
+ if (handle.ptr == NULL)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ tbm_bo_unmap (bo);
+ tbm_bo_unref (bo);
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_bo_handle tbm_bo_map(tbm_bo bo, int device, int opt);
+
+/**
+ * @brief Unmaps the buffer object.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ */
+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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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;
+ tbm_error_e error;
+
+ 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);
+ if (handle.ptr == NULL)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ tbm_bo_unref (bo);
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_bo_handle tbm_bo_get_handle(tbm_bo bo, int device);
+
+/**
+ * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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;
+ tbm_error_e error;
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+ key = tbm_bo_export (bo);
+ if (key == 0)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ 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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release the fd using close().
+ * @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;
+ tbm_error_e error;
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+ bo_fd = tbm_bo_export (bo);
+ if (bo_fd == 0)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ 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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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;
+ tbm_error_e error;
+
+ ...
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo = tbm_bo_import (bufmgr, key);
+ if (bo == NULL)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ tbm_bo_unref (bo);
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_bo tbm_bo_import(tbm_bufmgr bufmgr, tbm_key key);
+
+/**
+ * @brief Imports the buffer object associated with the fd.
+ * @details The reference count of the tbm_bo is 1.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks You must release the fd using close().
+ * @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;
+ tbm_error_e error;
+
+ ...
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo = tbm_bo_import_fd (bo_fd);
+ if (bo == 0)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ 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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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;
+ tbm_error_e error;
+
+ 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);
+ if (ret == 0)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ tbm_bo_unref (bo1);
+ tbm_bo_unref (bo2);
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+int tbm_bo_swap(tbm_bo bo1, tbm_bo bo2);
+
+/**
+ * @brief Adds a user_data to the buffer object.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ * @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);
+
+/**
+ * @brief Deletes the user_data in the buffer object.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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()
+ * @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_delete_user_data(tbm_bo bo, unsigned long key);
+
+/**
+ * @brief Sets a user_date to the buffer object.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ */
+int tbm_bo_set_user_data(tbm_bo bo, unsigned long key, void *data);
+
+/**
+ * @brief Gets a user_data from the buffer object with the key.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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
+ */
+int tbm_bo_get_user_data(tbm_bo bo, unsigned long key, void **data);
+
+/**
+ * @brief Gets the tbm bo flags.
+ * @since_tizen 2.4
+ * @param[in] bo : the buffer object
+ * @return the tbm bo flags
+ * @see TBM_BO_FLAGS
+ * @par Example
+ @code
+ #include <tbm_bufmgr.h>
+
+ int bufmgr_fd;
+ tbm_bufmgr bufmgr;
+ tbm_bo;
+ int flags;
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+ flags = tbm_bo_get_flags (bo);
+
+ ...
+
+ tbm_bo_unref (bo);
+ tbm_bufmgr_deinit (bufmgr);
+
+ @endcode
+ */
+int tbm_bo_get_flags(tbm_bo bo);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _TBM_BO_H_ */
\ No newline at end of file
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_BUFMGR_H_
+#define _TBM_BUFMGR_H_
+
+#include <tbm_type.h>
+#include <tbm_type_common.h>
+#include <tbm_bo.h>
+#include <tbm_error.h>
+
+/**
+ * \file tbm_bufmgr.h
+ * \brief Tizen Buffer Manager
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Functions for buffer manager */
+
+/**
+ * @brief Initializes the buffer manager.
+ * @details If fd is lower than zero, fd is get drm fd in tbm_bufmgr_init function\n
+ * The user can decide the lock type and cache flush type with the environment variables, which are BUFMGR_LOCK_TYPE and BUFMGR_MAP_CACHE.\n
+ * \n
+ * BUFMGR_LOCK default is once\n
+ * once : The previous bo which is locked is unlock when the new bo is trying to be locked\n
+ * always : The new bo is locked until the previous bo which is locked is unlocked\n
+ * never : Every bo is never locked.\n
+ * \n
+ * BUFMGR_MAP_CACHE default is true\n
+ * true : use map cache flushing\n
+ * false : to use map cache flushing
+ * @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
+ * @see tbm_bufmgr_deinit();
+ * @par Example
+ @code
+ #include <tbm_bufmgr.h>
+ int bufmgr_fd;
+
+ setenv("BUFMGR_LOCK_TYPE", "once", 1);
+ setenv("BUFMGR_MAP_CACHE", "true", 1);
+
+ tbm_bufmgr bufmgr;
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+
+ ....
+
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_bufmgr tbm_bufmgr_init(int fd);
+
+/**
+ * @brief Deinitializes the buffer manager.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bufmgr : the buffer manager
+ * @see tbm_bufmgr_init()
+ * @par Example
+ @code
+ #include <tbm_bufmgr.h>
+
+ 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);
+
+/**
+ * @brief Gets the tbm buffer capability.
+ * @since_tizen 2.4
+ * @param[in] bufmgr : the buffer manager
+ * @return the tbm bufmgr capability
+ * @par Example
+ @code
+ #include <tbm_bufmgr.h>
+
+ int bufmgr_fd;
+ tbm_bufmgr bufmgr;
+ unsigned int capability;
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+
+ capability = tbm_bufmgr_get_capability (bufmgr);
+
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+unsigned int tbm_bufmgr_get_capability(tbm_bufmgr bufmgr);
+
+/**
+ * @brief bind the native_display.
+ * @since_tizen 3.0
+ * @param[in] bufmgr : the buffer manager
+ * @param[in] native_display : the native_display
+ */
+int tbm_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *native_display);
+
+/**
+ * @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
+ */
+tbm_bufmgr tbm_bufmgr_server_init(void);
+
+/**
+ * @brief Set the bo_lock_type of the bufffer manager.
+ * @details set the bo_lock_type
+ * @since_tizen 5.0
+ */
+int tbm_bufmgr_set_bo_lock_type(tbm_bufmgr bufmgr, tbm_bufmgr_bo_lock_type bo_lock_type);
+
+/**
+ * @brief Print out the information of tbm_bos.
+ * @since_tizen 3.0
+ * @param[in] bufmgr : the buffer manager
+ */
+void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr);
+
+/**
+ * @brief Get string with the information of tbm_bos.
+ * @since_tizen 3.0
+ * @param[in] bufmgr : the buffer manager
+ * @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 Print out the trace of tbm_bos.
+ * @since_tizen 3.0
+ * @param[in] bufmgr : the buffer manager
+ * @param[in] onoff : 1 is on, and 0 is off
+ */
+void tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff);
+
+/**
+ * @brief Dump all tbm surfaces
+ * @param[in] path : the given dump path
+ * @return 1 if this function succeeds, otherwise 0.
+ */
+int tbm_bufmgr_debug_dump_all(char *path);
+
+/**
+ * @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.
+ */
+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);
+
+/**
+ * @brief Get ref_count of a global tbm_bufmgr
+ * @since_tizen 5.0
+ */
+int tbm_bufmgr_debug_get_ref_count(void);
+
+/**
+ * @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
+ */
+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_ */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * This file is referenced by the xf86Module.h in xorg server.
+ */
+
+#ifndef _TBM_BUFMGR_BACKEND_H_
+#define _TBM_BUFMGR_BACKEND_H_
+
+#include <tbm_bufmgr.h>
+#include <pthread.h>
+
+/**
+ * \file tbm_bufmgr_backend.h
+ * \brief backend header for Tizen Buffer Manager
+ * This header is for the implementation of the TBM backend module.
+ */
+
+#define ABI_MINOR_MASK 0x0000FFFF
+#define ABI_MAJOR_MASK 0xFFFF0000
+#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK)
+#define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16)
+
+/*
+ * ABI versions. Each version has a major and minor revision. Modules
+ * using lower minor revisions must work with servers of a higher minor
+ * revision. There is no compatibility between different major revisions.
+ * Whenever the ABI_ANSIC_VERSION is changed, the others must also be
+ * changed. The minor revision mask is 0x0000FFFF and the major revision
+ * mask is 0xFFFF0000.
+ */
+#define SET_ABI_VERSION(maj, min) \
+ ((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK))
+
+#define TBM_ABI_VERSION SET_ABI_VERSION(1, 1) /**< current abi vertion */
+
+typedef struct _tbm_bufmgr_backend *tbm_bufmgr_backend;
+
+/**
+ * @brief TBM backend functions
+ * the set of function pointers for the backend module of TBM.
+ */
+struct _tbm_bufmgr_backend {
+ int flags;
+
+ void *priv; /**< bufmgr private */
+
+ /**
+ * @brief deinitialize the bufmgr private.
+ * @param[in] priv : the private of the bufmgr
+ */
+ void (*bufmgr_deinit)(void *priv);
+
+ /**
+ * @brief get(bind) the native display
+ * @param[in] bufmgr : the buffer object
+ * @param[in] native_display : the native display
+ * @return 1 if this function succeeds, otherwise 0.
+ */
+ int (*bufmgr_bind_native_display)(tbm_bufmgr bufmgr, void *native_display);
+
+ /**
+ * @brief allocate the buffer object
+ * @param[in] bo : the buffer object
+ * @param[in] size : the size of buffer object
+ * @param[in] flags : the flags of memory type
+ * @return pointer of the bo private.
+ */
+ void *(*bo_alloc)(tbm_bo bo, int size, int flags);
+
+ /**
+ * @brief free the buffer object.
+ * @param[in] bo : the buffer object
+ */
+ void (*bo_free)(tbm_bo bo);
+
+ /**
+ * @brief get the size of a bo.
+ * @param[in] bo : the buffer object
+ * @return size if this function succeeds, otherwise 0.
+ */
+ int (*bo_size)(tbm_bo bo);
+
+ /**
+ * @brief get the tbm flags of memory type
+ * @param[in] bo : the buffer object
+ * @see #TBM_BO_FLAGS
+ * @return tbm flags of memory type is this function succeeds, otherwise 0.
+ */
+ int (*bo_get_flags)(tbm_bo bo);
+
+ /**
+ * @brief get the tbm_bo_handle according to the device type.
+ * @param[in] bo : the buffer object
+ * @param[in] device : the device type to get a handle
+ * @return the handle of the buffer object
+ */
+ tbm_bo_handle(*bo_get_handle)(tbm_bo bo, int device);
+
+ /**
+ * @brief map the buffer object according to the device type and the option.
+ * @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
+ */
+ tbm_bo_handle(*bo_map)(tbm_bo bo, int device, int opt);
+
+ /**
+ * @brief unmap the buffer object.
+ * @param[in] bo : the buffer object
+ * @return 1 if this function succeeds, otherwise 0.
+ */
+ int (*bo_unmap)(tbm_bo bo);
+
+ /**
+ * @brief lock the buffer object with a device and an opt.
+ * @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 1 if this function succeeds, otherwise 0.
+ * @remark This function pointer could be null. (default: use the tizen global lock)
+ */
+ int (*bo_lock)(tbm_bo bo, int device, int opt);
+
+ /**
+ * @brief unlock the buffer object.
+ * @param[in] bo : the buffer object
+ * @return 1 if this function succeeds, otherwise 0.
+ * @remark This function pointer could be null. (default: use the tizen global lock)
+ */
+ int (*bo_unlock)(tbm_bo bo);
+
+ /**
+ * @brief export the buffer object
+ * @remarks tbm_fd must be free by user.
+ * @remarks If the backend doesn't support a buffer sharing by tbm fd,
+ fucntion pointer must be set to NULL.
+ * @param[in] bo : the buffer object
+ * @return tbm_fd associated with the buffer object
+ */
+ tbm_fd (*bo_export_fd)(tbm_bo bo);
+
+ /**
+ * @brief import the buffer object associated with the prime fd.
+ * @remarks tbm_fd must be free by user.
+ * @remarks If the backend doesn't support a buffer sharing by tbm fd,
+ fucntion pointer must be set to NULL.
+ * @param[in] bo : the buffer object
+ * @param[in] fd : the prime fd associated with the buffer object
+ * @return pointer of the bo private.
+ */
+ void *(*bo_import_fd)(tbm_bo bo, tbm_fd fd);
+
+ /**
+ * @brief export the buffer object
+ * @remarks If the backend doesn't support a buffer sharing by tbm key,
+ fucntion pointer must be set to NULL.
+ * @param[in] bo : the buffer object
+ * @return key associated with the buffer object
+ */
+ unsigned int (*bo_export)(tbm_bo bo);
+
+ /**
+ * @brief import the buffer object associated with the key.
+ * @remarks If the backend doesn't support a buffer sharing by tbm key,
+ fucntion pointer must be set to NULL.
+ * @param[in] bo : the buffer object
+ * @param[in] key : the key associated with the buffer object
+ * @return pointer of the bo private.
+ */
+ void *(*bo_import)(tbm_bo bo, unsigned int key);
+
+ /**
+ * @brief query the formats list and the num to be supported by backend.
+ * @param[out] **formats : format array list. this array has to be allocated by backend funtion
+ * @param[out] *num : the number of the formats to be supported by backend
+ * @return 1 if this function succeeds, otherwise 0.
+ */
+ int (*surface_supported_format)(uint32_t **formats, uint32_t *num);
+
+ /**
+ * @brief get the plane data of the surface.
+ * @param[in] width : the width of the surface
+ * @param[in] height : the height of the surface
+ * @param[in] format : the format of the surface
+ * @param[in] plane_idx : the format of the surface
+ * @param[out] size : the size of the plane
+ * @param[out] offset : the offset of the plane
+ * @param[out] pitch : the pitch of the plane
+ * @param[out] bo_idx : the bo index of the plane
+ * @return 1 if this function succeeds, otherwise 0.
+ */
+ int (*surface_get_plane_data)(int width, int height,
+ tbm_format format, int plane_idx, uint32_t *size, uint32_t *offset,
+ uint32_t *pitch, int *bo_idx);
+
+ /**
+ * @brief allocate the buffer object for tbm surface
+ * @param[in] bo : the buffer object
+ * @param[in] width : the width of surface
+ * @param[in] height : the height of surface
+ * @param[in] format : the format of surface
+ * @param[in] flags : the flags of memory type
+ * @param[in] bo_idx : the index of bo in surface
+ * @return pointer of the bo private.
+ */
+ void * (*surface_bo_alloc)(tbm_bo bo, int width, int height, int format, int flags, int bo_idx);
+
+ /* Padding for future extension */
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
+ void (*reserved4)(void);
+ void (*reserved5)(void);
+ void (*reserved6)(void);
+};
+
+/**
+ * @brief tbm module information
+ * data type for the module information
+ */
+typedef struct {
+ const char *modname; /**< name of module, e.g. "foo" */
+ const char *vendor; /**< vendor specific string */
+ unsigned long abiversion; /**< ABI version */
+} TBMModuleVersionInfo;
+
+typedef int (*ModuleInitProc) (tbm_bufmgr, int);
+
+#define MODULEINITPPROTO(func) int func(tbm_bufmgr, int) /**< prototype for init symbol of bakcend module */
+
+/**
+ * @brief tbm module data
+ * data type for the entry point of the backend module
+ */
+typedef struct {
+ TBMModuleVersionInfo *vers; /**< tbm module informtaion */
+ ModuleInitProc init; /**< init function of a backend module */
+} TBMModuleData;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+tbm_bufmgr_backend tbm_backend_alloc(void);
+void tbm_backend_free(tbm_bufmgr_backend backend);
+int tbm_backend_init(tbm_bufmgr bufmgr, tbm_bufmgr_backend backend);
+
+void *tbm_backend_get_bufmgr_priv(tbm_bo bo);
+void *tbm_backend_get_priv_from_bufmgr(tbm_bufmgr bufmgr);
+void *tbm_backend_get_bo_priv(tbm_bo bo);
+int tbm_backend_is_display_server(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _TBM_BUFMGR_BACKEND_H_ */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_DRM_HELPER_H_
+#define _TBM_DRM_HELPER_H_
+
+/**
+ * @brief Initialize authentication server in display server.
+ * @details
+ * In DRM system, client sholud get authenticated fd from display server for using drm.
+ Tbm provides wayland protocol and helper function for passing and authenticating
+ fd from display server.
+ * @param[in] wl_display wayland display
+ * @param[in] fd fd of drm_master
+ * @param[in] device_name name of drm device
+ * @param[in] flags flags
+ * @see #tbm_drm_helper_wl_auth_server_deinit()
+ */
+int tbm_drm_helper_wl_auth_server_init(void *wl_display, int fd, const char *device_name, uint32_t flags);
+
+/**
+ * @brief Deinitialize authentication server in display server
+ * @details
+ * In DRM system, client sholud get authenticated fd from display server for using drm.
+ Tbm provides wayland protocol and helper function for passing and authenticating
+ fd from display server.
+ * @see #tdm_helper_set_tbm_master_fd()
+ * @see #tbm_drm_helper_unset_tbm_master_fd()
+ */
+void tbm_drm_helper_wl_auth_server_deinit(void);
+
+/**
+ * @brief Get a drm master fd.
+ * @details
+ * This function will dup the drm master fd.
+ The Caller SHOULD close the fd.
+ In DRM system, a drm master fd SHOULD be shared between TDM backend and
+ TBM backend in display server side.
+ * @return fd if success. Otherwise, -1.
+ * @see #tbm_drm_helper_set_tbm_master_fd()
+ * @see #tbm_drm_helper_unset_tbm_master_fd()
+ */
+int tbm_drm_helper_get_master_fd(void);
+
+/**
+ * @brief Set a drm master fd with the given fd.
+ * @details
+ * In DRM system, a drm master fd @b SHOULD be shared between TDM backend and
+ TBM backend in display server side.
+ * @param[in] fd The given fd
+ * @see #tbm_drm_helper_get_master_fd()
+ * @see #tbm_drm_helper_unset_tbm_master_fd()
+ */
+void tbm_drm_helper_set_tbm_master_fd(int fd);
+
+/**
+ * @brief Unset a drm master fd.
+ * @see #tbm_drm_helper_get_master_fd()
+ * @see #tbm_drm_helper_set_tbm_master_fd()
+ */
+void tbm_drm_helper_unset_tbm_master_fd(void);
+
+/**
+ * @brief Get infomation of drm authentication.
+ * @details
+ * In DRM system, client sholud get authenticated fd from display server for using drm.
+ Tbm provides wayland protocol and helper function for passing and authenticating
+ fd from display server.
+ * @param[out] fd The authenticated fd
+ * @param[out] device The device name
+ * @param[out] capabilities The capabilities of device
+ * @see #tdm_helper_set_tbm_master_fd()
+ * @see #tbm_drm_helper_unset_tbm_master_fd()
+ */
+int tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities);
+
+/**
+ * @brief Set drm fd with the given fd.
+ * @details
+ * Some client want to get drm fd used tbm_backend.
+ if tbm_backend allow that client use drm_fd, it SHOULD be set.
+ * @param[in] fd The given fd
+ * @see #tbm_drm_helper_get_fd()
+ */
+void tbm_drm_helper_set_fd(int fd);
+
+/**
+ * @brief Unset drm fd.
+ * @details
+ * Some client want to get drm fd used tbm_backend.
+ if tbm_backend allow that client use drm_fd, it SHOULD be set.
+ * @param[in] fd The given fd
+ * @see #tbm_drm_helper_get_fd()
+ */
+void tbm_drm_helper_unset_fd(void);
+
+/**
+ * @brief Get drm fd.
+ * @details
+ * Some client want to get drm fd used tbm_backend.
+ client can get drm fd from this fucntion.
+ The Caller SHOULD close the fd.
+ * @return fd if success. Otherwise, -1.
+ * @see #tdm_helper_set_tbm_master_fd()
+ * @see #tbm_drm_helper_unset_tbm_master_fd()
+ */
+int tbm_drm_helper_get_fd(void);
+
+#endif /* _TBM_DRM_HELPER_H_ */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2012-2018 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_ERROR_H_
+#define _TBM_ERROR_H_
+
+#include <tbm_type.h>
+#include <tbm_type_common.h>
+
+/**
+ * \file tbm_error.h
+ * \brief TBM Error
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Gets the latest tbm_error.
+ * @since_tizen 2.4
+ * @return the latest tbm_error
+ * @par Example
+ @code
+ #include <tbm_bufmgr.h>
+
+ int bufmgr_fd;
+ tbm_bufmgr bufmgr;
+ tbm_bo bo;
+ tbm_bo_handle handle;
+ tbm_error_e error;
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+ if (!bo)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ handle = tbm_bo_map (bo, TBM_DEVICE_2D, TBM_OPTION_READ|TBM_OPTION_WRITE);
+ if (handle.ptr == NULL)
+ {
+ error = tbm_get_last_error ();
+ ...
+ }
+
+ ...
+
+ tbm_bo_unmap (bo);
+ tbm_bo_unref (bo);
+ tbm_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_error_e tbm_get_last_error(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _TBM_ERROR_H_ */
\ No newline at end of file
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2018 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_LOG_H_
+#define _TBM_LOG_H_
+
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file tbm_log.h
+ * @brief The header file to print logs in frontend and backend modules
+ * @details
+ */
+
+enum {
+ TBM_LOG_LEVEL_NONE,
+ TBM_LOG_LEVEL_ERR,
+ TBM_LOG_LEVEL_WRN,
+ TBM_LOG_LEVEL_INFO,
+ TBM_LOG_LEVEL_DBG,
+};
+
+void tbm_log_enable_color(unsigned int enable);
+void tbm_log_enable_dlog(unsigned int enable);
+void tbm_log_set_debug_level(int level);
+void tbm_log_set_assert_level(int level);
+void tbm_log_set_path(const char *path);
+void tbm_log_print(int level, const char *fmt, ...);
+void tbm_log_print_stdout(int level, const char *fmt, ...);
+
+#define TBM_DBG(fmt, args...) \
+ do { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_DBG, "[%5d.%06d][%d][%s %d]"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } while (0)
+#define TBM_INFO(fmt, args...) \
+ do { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d]"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } while (0)
+#define TBM_WRN(fmt, args...) \
+ do { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_WRN, "[%5d.%06d][%d][%s %d]"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } while (0)
+#define TBM_ERR(fmt, args...) \
+ do { \
+ struct timespec ts; \
+ clock_gettime(CLOCK_MONOTONIC, &ts); \
+ tbm_log_print(TBM_LOG_LEVEL_ERR, "[%5d.%06d][%d][%s %d]"fmt, \
+ (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
+ (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
+ } while (0)
+
+#define TBM_NEVER_GET_HERE() TBM_WRN("** NEVER GET HERE **")
+#define TBM_DEPRECATED(str) \
+ do { \
+ if (str) \
+ TBM_WRN("** DEPRECATED: %s **", str); \
+ else \
+ TBM_WRN("** DEPRECATED **"); \
+ } while(0)
+
+/* check condition */
+#define TBM_RETURN_IF_FAIL(cond) {\
+ if (!(cond)) {\
+ TBM_ERR("'%s' failed.\n", #cond);\
+ return;\
+ } \
+}
+#define TBM_RETURN_VAL_IF_FAIL(cond, val) {\
+ if (!(cond)) {\
+ TBM_ERR("'%s' failed.\n", #cond);\
+ return val;\
+ } \
+}
+#define TBM_GOTO_VAL_IF_FAIL(cond, val) {\
+ if (!(cond)) {\
+ TBM_ERR("'%s' failed.\n", #cond);\
+ goto val;\
+ } \
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TBM_LOG_H_ */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_SURFACE_H_
+#define _TBM_SURFACE_H_
+
+/**
+ * @addtogroup CAPI_UI_TBM_SURFACE_MODULE
+ * @{
+ */
+
+#include <tbm_type.h>
+
+/**
+ * \file tbm_surface.h
+ * \brief TBM Surface
+ */
+
+/**
+ * @brief Enumeration for tbm_surface error type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ TBM_SURFACE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ TBM_SURFACE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ TBM_SURFACE_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
+} tbm_surface_error_e;
+
+/**
+ * @brief Definition for the max number of TBM surface plane.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_SURF_PLANE_MAX 4
+
+/* option to map the tbm_surface */
+/**
+ * @brief Definition for the access option to read.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_SURF_OPTION_READ (1 << 0)
+/**
+ * @brief Definition for the access option to write.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_SURF_OPTION_WRITE (1 << 1)
+
+/**
+ * @brief Definition for the TBM plane struct.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct _tbm_surface_plane {
+ unsigned char *ptr; /**< Plane pointer */
+ uint32_t size; /**< Plane size */
+ uint32_t offset; /**< Plane offset */
+ uint32_t stride; /**< Plane stride */
+
+ void *reserved1; /**< Reserved pointer1 */
+ void *reserved2; /**< Reserved pointer2 */
+ void *reserved3; /**< Reserved pointer3 */
+} tbm_surface_plane_s;
+
+/**
+ * @brief Definition for the TBM surface information struct.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct _tbm_surface_info {
+ uint32_t width; /**< TBM surface width */
+ uint32_t height; /**< TBM surface height */
+ tbm_format format; /**< TBM surface format*/
+ uint32_t bpp; /**< TBM surface bbp */
+ uint32_t size; /**< TBM surface size */
+
+ uint32_t num_planes; /**< The number of planes */
+ tbm_surface_plane_s planes[TBM_SURF_PLANE_MAX]; /**< Array of planes */
+
+ void *reserved4; /**< Reserved pointer4 */
+ void *reserved5; /**< Reserved pointer5 */
+ void *reserved6; /**< Reserved pointer6 */
+} tbm_surface_info_s;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Queries surface format list and number of format supported by the system.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks You must release the formats using free().
+ *
+ * @param[out] formats The format array which the system can support \n
+ * This pointer has to be freed by user.
+ * @param[out] num The number of formats
+ *
+ * @return #TBM_SURFACE_ERROR_NONE if this function succeeds,
+ * otherwise an error status value
+ *
+ * @retval #TBM_SURFACE_ERROR_NONE Success
+ * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ uint32_t *formats;
+ uint32_t format_num;
+ int ret, i;
+ tbm_surface_error_e tse;
+
+ tse = tbm_surface_query_formats (&formats, &format_num))
+
+ for( i = 0 ; i < format_num ; i++)
+ {
+ if (formats[i] == TBM_FORMAT_RGB332)
+ {
+ ....
+
+ free (formats);
+ @endcode
+ */
+int tbm_surface_query_formats(uint32_t **formats, uint32_t *num);
+
+/**
+ * @brief Creates the tbm_surface.
+ * @details This function creates the tbm_surface with the given width, height, and format.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @param[in] width The width of surface
+ * @param[in] height The height of surface
+ * @param[in] format The format of surface
+ *
+ * @return #tbm_surface_h on success,
+ * otherwise @c NULL
+ *
+ * @retval #tbm_surface_h The TBM surface handle
+ *
+ * @exception #TBM_SURFACE_ERROR_NONE Success
+ * @exception #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @see tbm_surface_destroy()
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ tbm_surface_h surface;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+tbm_surface_h tbm_surface_create(int width, int height, tbm_format format);
+
+/**
+ * @brief Destroys the tbm_surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] surface The #tbm_surface_h
+ *
+ * @return #TBM_SURFACE_ERROR_NONE on success,
+ * otherwise an error status value
+ *
+ * @retval #TBM_SURFACE_ERROR_NONE Success
+ * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see tbm_surface_create()
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ tbm_surface_h surface;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+int tbm_surface_destroy(tbm_surface_h surface);
+
+/**
+ * @brief Maps the tbm_surface according to the access option.
+ * @details After mapping tbm_surface, the information of tbm_surface is assigned in #tbm_surface_info_s struct. \n
+ * The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
+ * The information of planes has stride, offset, size and pointer of plane. \n
+ * #TBM_SURF_OPTION_READ indicates access option to read. \n
+ * #TBM_SURF_OPTION_WRITE indicates access option to write.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] surface The #tbm_surface_h
+ * @param[in] opt The option to access the tbm_surface
+ * @param[out] info The information of the tbm_surface
+ *
+ * @return #TBM_SURFACE_ERROR_NONE on success,
+ * otherwise an error status value
+ *
+ * @retval #TBM_SURFACE_ERROR_NONE Success
+ * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @see tbm_surface_unmap();
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ tbm_surface_h surface;
+ tbm_surface_info_s info;
+ int ret;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
+ ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);
+
+ ...
+
+ tbm_surface_unmap (surface);
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+int tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s *info);
+
+/**
+ * @brief Unmaps the tbm_surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] surface The #tbm_surface_h
+ *
+ * @return #TBM_SURFACE_ERROR_NONE on success,
+ * otherwise an error status value
+ *
+ * @retval #TBM_SURFACE_ERROR_NONE Success
+ * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see tbm_surface_map()
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ tbm_surface_h surface;
+ tbm_surface_info_s info;
+ int ret;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
+ ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);
+
+ ...
+
+ tbm_surface_unmap (surface);
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+int tbm_surface_unmap(tbm_surface_h surface);
+
+/**
+ * @brief Gets the information of the tbm_surface.
+ * @details The information of tbm_surface is assigned in #tbm_surface_info_s struct. \n
+ * The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
+ * The information of planes has stride, offset, size and pointer of plane.
+ *
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] surface The #tbm_surface_h
+ * @param[out] info The information of the tbm_surface
+ *
+ * @return #TBM_SURFACE_ERROR_NONE on success,
+ * otherwise an error status value
+ *
+ * @retval #TBM_SURFACE_ERROR_NONE Success
+ * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
+ *
+ * @see tbm_surface_map()
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ tbm_surface_h surface;
+ tbm_surface_info_s info;
+ int ret;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
+ ret = tbm_surface_get_info (surface, &info);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+int tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s *info);
+
+/**
+ * @brief Gets the width of the tbm_surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] surface The #tbm_surface_h
+ *
+ * @return The width of the tbm_surface on success,
+ * otherwise an error status value
+ *
+ * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ tbm_surface_h surface;
+ int width;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
+
+ ...
+
+ width = tbm_surface_get_width (surface);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+int tbm_surface_get_width(tbm_surface_h surface);
+
+/**
+ * @brief Gets the height of the tbm_surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @param[in] surface The #tbm_surface_h
+ *
+ * @return The height of the tbm_surface if this function succeeds,
+ * otherwise an error status value
+ *
+ * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ tbm_surface_h surface;
+ int height;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
+
+ ...
+
+ height = tbm_surface_get_height (surface);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+int tbm_surface_get_height(tbm_surface_h surface);
+
+/**
+ * @brief Gets the format of the tbm_surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @param[in] surface The #tbm_surface_h
+ *
+ * @return The format of the tbm_surface on success,
+ * otherwise @c 0 on failure
+ *
+ * @retval #tbm_format The format of surface
+ *
+ * @exception #TBM_SURFACE_ERROR_NONE Success
+ * @exception #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+
+ tbm_surface_s surface;
+ tbm_format format;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
+
+ ...
+
+ format = tbm_surface_get_format (surface);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+tbm_format tbm_surface_get_format(tbm_surface_h surface);
+
+#ifdef __cplusplus
+}
+#endif
+/**
+* @}
+*/
+#endif /* _TBM_SURFACE_H_ */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_SURFACE_INTERNAL_H_
+#define _TBM_SURFACE_INTERNAL_H_
+
+#include <tbm_bufmgr.h>
+#include <tbm_error.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Queries formats which the system can support.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks The formats must be released using free().
+ * @param[in] bufmgr : the buffer manager
+ * @param[out] *formats : format array which the system can support. This pointer has to be freed by user.
+ * @param[out] num : the number of formats.
+ * @return a tbm_surface_h if this function succeeds, otherwise NULL
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ tbm_bufmgr bufmgr;
+ uint32_t *formats;
+ uint32_t format_num;
+
+ bufmgr = tbm_bufmgr_create (-1);
+ ret = tbm_surface_internal_query_surpported_foramts (bufmgr, &formats, &format_num);
+
+ ...
+
+ free (foramts);
+ tbm_surface_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+int tbm_surface_internal_query_supported_formats(uint32_t **formats,
+ uint32_t *num);
+
+/**
+ * @brief Creates the tbm_surface with memory type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @details
+ * #TBM_BO_DEFAULT is default memory: it depends on the backend\n
+ * #TBM_BO_SCANOUT is scanout memory\n
+ * #TBM_BO_NONCACHABLE is non-cachable memory\n
+ * #TBM_BO_WC is write-combine memory\n
+ * #TBM_BO_VENDOR vendor specific memory: it depends on the tbm backend\n
+ * @param[in] bufmgr : the buffer manager
+ * @param[in] width : the width of surface
+ * @param[in] height : the height of surface
+ * @param[in] format : the format of surface
+ * @param[in] flags : the flags of memory type
+ * @return a tbm_surface_h if this function succeeds, otherwise NULL
+ * @retval #tbm_surface_h
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ int bufmgr_fd
+ tbm_bufmgr bufmgr;
+ tbm_surface_h surface;
+ uint32_t *format;
+ uint32_t format_num;
+
+ bufmgr = tbm_bufmgr_create (bufmgr_fd);
+ surface = tbm_surface_internal_create_with_flags (128, 128, TBM_FORMAT_YUV420, TBM_BO_DEFAULT);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ tbm_surface_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_surface_h tbm_surface_internal_create_with_flags(int width, int height,
+ int format, int flags);
+
+/**
+ * @brief Creates the tbm_surface with buffer objects.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] bufmgr : the buffer manager
+ * @param[in] width : the width of surface
+ * @param[in] height : the height of surface
+ * @param[in] format : the format of surface
+ * @param[in] *bos : the array pointer of buffer objects
+ * @param[in] num : the number of buffer objects
+ * @return a tbm_surface_h if this function succeeds, otherwise NULL
+ * @retval #tbm_surface_h
+ * @par Example
+ @code
+ #include <tbm_bufmgr.h>
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ int bufmgr_fd
+ tbm_bufmgr bufmgr;
+ tbm_surface_h surface;
+ tbm_surface_info_s info;
+ uint32_t *format;
+ uint32_t format_num;
+ tbm_bo bo[1];
+
+ bufmgr = tbm_bufmgr_init (bufmgr_fd);
+ bo[0] = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
+
+ info.width = 128;
+ info.height = 128;
+ info.format = TBM_FORMAT_ARGB8888;
+ info.bpp = 32;
+ info.size = 65536;
+ info.num_planes = 1;
+ info.planes[0].size = 65536;
+ info.planes[0].offset = 0;
+ info.planes[0].stride = 512;
+
+ surface = tbm_surface_internal_create_with_bos (&info, bo, 1);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ tbm_surface_bufmgr_deinit (bufmgr);
+ @endcode
+ */
+tbm_surface_h tbm_surface_internal_create_with_bos(tbm_surface_info_s *info,
+ tbm_bo *bos, int num);
+
+/**
+ * @brief Destroy the tbm surface
+ TODO:
+ */
+void tbm_surface_internal_destroy(tbm_surface_h surface);
+
+/**
+ * @brief reference the tbm surface
+ TODO:
+ */
+void tbm_surface_internal_ref(tbm_surface_h surface);
+
+/**
+ * @brief unreference the tbm surface
+ TODO:
+ */
+void tbm_surface_internal_unref(tbm_surface_h surface);
+
+/**
+ * @brief Gets the number of buffer objects associated with the tbm_surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] surface : the tbm_surface_h
+ * @return the number of buffer objects associated with the tbm_surface_h, otherwise 0.
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ tbm_surface_h surface;
+ int num_bos;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
+ num_bos = tbm_surface_internal_get_num_bos (surface);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+int tbm_surface_internal_get_num_bos(tbm_surface_h surface);
+
+/**
+ * @brief Gets the buffor object by the bo_index.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] surface : the tbm_surface_h
+ * @param[in] bo_idx : the bo index in the the tbm_surface
+ * @return the buffer object, otherwise NULL.
+ * @retval #tbm_bo
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ tbm_surface_h surface;
+ int num_bos;
+ tbm_bo bo;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
+ num_bos = tbm_surface_internal_get_num_bos (surface);
+
+ for (i=0 ; i < num_bos ; i++)
+ {
+ bo = tbm_surface_internal_get_bo (surface, i);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+tbm_bo tbm_surface_internal_get_bo(tbm_surface_h surface, int bo_idx);
+
+/**
+ * @brief Gets the size of the surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] surface : the tbm_surface_h
+ * @return the size of tbm_surface, otherwise 0.
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ tbm_surface_h surface;
+ int size;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
+ size = tbm_surface_internal_get_size (surface);
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+unsigned int tbm_surface_internal_get_size(tbm_surface_h surface);
+
+/**
+ * @brief Gets size, offset and pitch data of plane by the plane_index.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] surface : the tbm_surface_h
+ * @param[in] plane_idx : the bo index in the the tbm_surface
+ * @param[out] size : the size of plane in tbm_surface
+ * @param[out] offset : the offset of plane in tbm_surface
+ * @param[out] pitch : the pitch of plane in tbm_surface
+ * @return 1 if this function succeeds, otherwise 0.
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ tbm_surface_h surface;
+ uint32_t size, offset, pitch;
+ int ret;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
+ ret = tbm_surface_internal_get_plane_data (surface, 1, &size, &offset, &pitch);
+
+ ...
+
+ tbm_surface_destroy (surface);
+ @endcode
+ */
+int tbm_surface_internal_get_plane_data(tbm_surface_h surface, int plane_idx,
+ uint32_t *size, uint32_t *offset, uint32_t *pitch);
+
+/**
+ * @brief Gets number of planes by the format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] format : the format of surface
+ * @return number of planes by the format, otherwise 0.
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ int num;
+
+ num = tbm_surface_internal_get_num_planes (TBM_FORMAT_YUV420);
+
+ ...
+
+ @endcode
+ */
+int tbm_surface_internal_get_num_planes(tbm_format format);
+
+/**
+ * @brief Gets bpp by the format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @param[in] format : the format of surface
+ * @return bpp by the format, otherwise 0.
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ int bpp;
+
+ bpp = tbm_surface_internal_get_bpp (TBM_FORMAT_YUV420);
+
+ ...
+
+ @endcode
+ */
+int tbm_surface_internal_get_bpp(tbm_format format);
+
+/**
+ * @brief Gets bo index of plane.
+ * @since_tizen 2.4
+ * @param[in] surface : the tbm_surface_h
+ * @param[in] plane_idx : the bo index in the tbm_surface
+ * @return bo index of plane, otherwise 0.
+ * @par Example
+ @code
+ #include <tbm_surface.h>
+ #include <tbm_surface_internal.h>
+
+ int bo_idx;
+ tbm_surface_h surface;
+
+ surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
+ bo_idx = tbm_surface_internal_get_plane_bo_idx (surface, 0);
+
+ ...
+
+ @endcode
+ */
+int tbm_surface_internal_get_plane_bo_idx(tbm_surface_h surface, int plane_idx);
+
+/**
+ * @brief Set the pid to the tbm_surface for debugging.
+ * @since_tizen 3.0
+ * @param[in] surface : the tbm_surface_h
+ * @param[in] pid : the pid
+ */
+void tbm_surface_internal_set_debug_pid(tbm_surface_h surface,
+ unsigned int pid);
+
+/**
+ * @brief Set the string value to the tbm_surface for debugging.
+ * @since_tizen 3.0
+ * @param[in] surface : the tbm_surface_h
+ * @param[in] key : the key for debugging
+ * @param[in] value : the value for debugging
+ */
+int tbm_surface_internal_set_debug_data(tbm_surface_h surface,
+ char *key, char *value);
+
+/**
+ * @brief Adds a user_data to the tbm surface.
+ * @since_tizen 3.0
+ * @param[in] surface : the tbm surface.
+ * @param[in] key : the key associated with the user_data
+ * @param[in] data_free_func : the function pointer to free the user_data
+ * @return 1 if this function succeeds, otherwise 0.
+ * @post the tbm_surface_data_free() will be called under certain conditions, after calling tbm_surface_internal_delete_user_data().
+ * @see tbm_surface_free()
+ * @see tbm_surface_set_user_data()
+ * @see tbm_surface_get_user_data()
+ * @see tbm_surface_delete_user_data()
+ */
+int tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key,
+ tbm_data_free data_free_func);
+
+/**
+ * @brief Sets a user_date to the tbm surface.
+ * @since_tizen 3.0
+ * @param[in] surface : the tbm surface.
+ * @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.
+ */
+int tbm_surface_internal_set_user_data(tbm_surface_h surface, unsigned long key,
+ void *data);
+
+/**
+ * @brief Gets a user_data from the tbm surface with the key.
+ * @since_tizen 3.0
+ * @param[in] surface : the tbm surface.
+ * @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.
+ */
+int tbm_surface_internal_get_user_data(tbm_surface_h surface, unsigned long key,
+ void **data);
+
+/**
+ * @brief Deletes the user_data in the tbm surface.
+ * @since_tizen 3.0
+ * @param[in] surface : the tbm surface.
+ * @param[in] key : the key associated with the user_date
+ * @return 1 if this function succeeds, otherwise 0.
+ */
+int tbm_surface_internal_delete_user_data(tbm_surface_h surface,
+ unsigned long key);
+
+/**
+ * @brief Start the dump debugging.
+ * @since_tizen 3.0
+ * @param[in] path : the given dump path
+ * @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 w, int h, int count);
+
+/**
+ * @brief Start the dump with scale debugging.
+ * @details
+ * Dump with scale supports only if a buffer has below formats.
+ * - TBM_FORMAT_ARGB8888
+ * - TBM_FORMAT_XRGB8888
+ * @since_tizen 4.0
+ * @param[in] path : the given dump path
+ * @param[in] w : the width of dump image
+ * @param[in] h : the height of dump image
+ * @param[in] count : the dump count number
+ * @param[in] scale : the scale factor
+ * @see #tdm_helper_dump_stop()
+ */
+void tbm_surface_internal_dump_with_scale_start(char *path, int w, int h,
+ int count, double scale);
+
+/**
+ * @brief End the dump debugging.
+ * @since_tizen 3.0
+ * @see #tdm_helper_dump_start()
+ */
+void tbm_surface_internal_dump_end(void);
+
+/**
+ * @brief Dump a buffer
+ * @details
+ * This function supports only if a buffer has below formats.
+ * - TBM_FORMAT_ARGB8888
+ * - TBM_FORMAT_XRGB8888
+ * - TBM_FORMAT_YVU420
+ * - TBM_FORMAT_YUV420
+ * - TBM_FORMAT_NV12
+ * - TBM_FORMAT_NV21
+ * - TBM_FORMAT_YUYV
+ * - TBM_FORMAT_UYVY
+ * The filename extension should be "png" for TBM_FORMAT_ARGB8888 and TBM_FORMAT_XRGB8888
+ * or "yuv" for YUV formats.
+ * @param[in] surface : a tbm surface
+ * @param[in] name : a string used by a file name
+ */
+void tbm_surface_internal_dump_buffer(tbm_surface_h surface, const char *name);
+
+/**
+ * @brief Dump a shared memory buffer
+ * @details
+ * This function supports shared memory buffer dump.
+ * @param[in] ptr : a pointer of dump buffer
+ * @param[in] w : a width of dump buffer
+ * @param[in] h : a height of dump buffer
+ * @param[in] stride : a stride of dump buffer
+ * @param[in] name : a string used by a file name
+ */
+void tbm_surface_internal_dump_shm_buffer(void *ptr, int w, int h, int stride, const char *name);
+
+/**
+ * @brief check valid tbm surface.
+ * @since_tizen 3.0
+ * @param[in] surface : the tbm surface.
+ * @return 1 if surface is valid, otherwise 0.
+ */
+int tbm_surface_internal_is_valid(tbm_surface_h surface);
+
+/**
+ * @brief Capture a buffer
+ * @details
+ * This function supports only if a buffer has below formats.
+ * - TBM_FORMAT_ARGB8888
+ * - TBM_FORMAT_XRGB8888
+ * - TBM_FORMAT_YVU420
+ * - TBM_FORMAT_YUV420
+ * - TBM_FORMAT_NV12
+ * - TBM_FORMAT_NV21
+ * - TBM_FORMAT_YUYV
+ * - TBM_FORMAT_UYVY
+ * The type should be "png" for TBM_FORMAT_ARGB8888 and TBM_FORMAT_XRGB8888
+ * or "yuv" for YUV formats.
+ * @param[in] surface : a tbm surface
+ * @param[in] path : the given dump path
+ * @param[in] name : a string used by a file name
+ * @param[in] type : a string used by a file type ex)png, yuv
+ * @return 1 if success, otherwise 0.
+ */
+int tbm_surface_internal_capture_buffer(tbm_surface_h surface, const char *path,
+ const char *name, const char *type);
+
+/**
+ * @brief Capture a shared memory buffer
+ * @details
+ * This function supports shared memory buffer dump.
+ * The type should be "png".
+ * @param[in] ptr : a pointer of dump buffer
+ * @param[in] w : a width of dump buffer
+ * @param[in] h : a height of dump buffer
+ * @param[in] stride : a stride of dump buffer
+ * @param[in] path : the given dump path
+ * @param[in] name : a string used by a file name
+ * @param[in] type : a string used by a file type ex)png, yuv
+ * @return 1 if success, otherwise 0.
+ */
+int tbm_surface_internal_capture_shm_buffer(void *ptr, int w, int h, int stride,
+ const char *path, const char *name, const char *type);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _TBM_SURFACE_INTERNAL_H_ */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_SURFACE_QUEUE_H_
+#define _TBM_SURFACE_QUEUE_H_
+
+#include <tbm_surface.h>
+#include <tbm_type_common.h>
+#include <tbm_error.h>
+
+typedef enum {
+ TBM_SURFACE_QUEUE_TRACE_NONE = 0, /**< Successful */
+ TBM_SURFACE_QUEUE_TRACE_DEQUEUE = 1,
+ TBM_SURFACE_QUEUE_TRACE_ENQUEUE = 2,
+ TBM_SURFACE_QUEUE_TRACE_ACQUIRE = 3,
+ TBM_SURFACE_QUEUE_TRACE_RELEASE = 4,
+ TBM_SURFACE_QUEUE_TRACE_CANCEL_DEQUEUE = 5,
+ TBM_SURFACE_QUEUE_TRACE_CANCEL_ACQUIRE = 6,
+} tbm_surface_queue_trace;
+
+typedef enum {
+ TBM_SURFACE_QUEUE_MODE_NONE = 0,
+ /**
+ * GUARANTEE_CYCLE mode must do enqueue/aquire/release or cancel_dequeue
+ * for the tbm_surface which is dequeued before tbm_surface_queue is reset.
+ */
+ TBM_SURFACE_QUEUE_MODE_GUARANTEE_CYCLE = (1 << 0),
+} tbm_surface_queue_mode;
+
+typedef struct _tbm_surface_queue *tbm_surface_queue_h;
+
+typedef void (*tbm_surface_queue_notify_cb)(tbm_surface_queue_h surface_queue,
+ void *data);
+
+typedef tbm_surface_h(*tbm_surface_alloc_cb)(tbm_surface_queue_h surface_queue,
+ void *data);
+
+typedef void (*tbm_surface_free_cb)(tbm_surface_queue_h surface_queue,
+ void *data, tbm_surface_h surface);
+
+typedef void (*tbm_surface_queue_trace_cb)(tbm_surface_queue_h surface_queue,
+ tbm_surface_h surface, tbm_surface_queue_trace trace, void *data);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*The functions of queue factory*/
+tbm_surface_queue_h tbm_surface_queue_create(int queue_size, int width,
+ int height, int format, int flags);
+
+tbm_surface_queue_h tbm_surface_queue_sequence_create(int queue_size, int width,
+ int height, int format, int flags);
+
+void tbm_surface_queue_destroy(tbm_surface_queue_h surface_queue);
+
+tbm_surface_queue_error_e tbm_surface_queue_set_alloc_cb(
+ tbm_surface_queue_h surface_queue,
+ tbm_surface_alloc_cb alloc_cb,
+ tbm_surface_free_cb free_cb,
+ void *data);
+
+int tbm_surface_queue_get_width(tbm_surface_queue_h surface_queue);
+
+int tbm_surface_queue_get_height(tbm_surface_queue_h surface_queue);
+
+int tbm_surface_queue_get_format(tbm_surface_queue_h surface_queue);
+
+int tbm_surface_queue_get_size(tbm_surface_queue_h surface_queue);
+
+tbm_surface_queue_error_e tbm_surface_queue_get_surfaces(
+ tbm_surface_queue_h surface_queue,
+ tbm_surface_h *surfaces, int *num);
+
+tbm_surface_queue_error_e tbm_surface_queue_get_trace_surface_num(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_trace trace, int *num);
+
+tbm_surface_queue_error_e tbm_surface_queue_set_size(
+ tbm_surface_queue_h surface_queue, int queue_size, int flush);
+
+tbm_surface_queue_error_e tbm_surface_queue_set_modes(
+ tbm_surface_queue_h surface_queue, int modes);
+
+tbm_surface_queue_error_e tbm_surface_queue_set_sync_count(
+ tbm_surface_queue_h surface_queue, unsigned int sync_count);
+
+int tbm_surface_queue_can_dequeue(tbm_surface_queue_h surface_queue, int wait);
+
+int tbm_surface_queue_can_acquire(tbm_surface_queue_h surface_queue, int wait);
+
+tbm_surface_queue_error_e tbm_surface_queue_dequeue(
+ tbm_surface_queue_h surface_queue, tbm_surface_h *surface);
+
+tbm_surface_queue_error_e tbm_surface_queue_enqueue(
+ tbm_surface_queue_h surface_queue, tbm_surface_h surface);
+
+tbm_surface_queue_error_e tbm_surface_queue_acquire(
+ tbm_surface_queue_h surface_queue, tbm_surface_h *surface);
+
+tbm_surface_queue_error_e tbm_surface_queue_release(
+ tbm_surface_queue_h surface_queue, tbm_surface_h surface);
+
+tbm_surface_queue_error_e tbm_surface_queue_cancel_dequeue(
+ tbm_surface_queue_h surface_queue, tbm_surface_h surface);
+
+tbm_surface_queue_error_e tbm_surface_queue_cancel_acquire(
+ tbm_surface_queue_h surface_queue, tbm_surface_h surface);
+
+tbm_surface_queue_error_e tbm_surface_queue_reset(
+ tbm_surface_queue_h surface_queue, int width, int height, int format);
+
+tbm_surface_queue_error_e tbm_surface_queue_flush(tbm_surface_queue_h surface_queue);
+
+tbm_surface_queue_error_e tbm_surface_queue_free_flush(tbm_surface_queue_h surface_queue);
+
+tbm_surface_queue_error_e tbm_surface_queue_notify_reset(tbm_surface_queue_h surface_queue);
+
+tbm_surface_queue_error_e tbm_surface_queue_notify_dequeuable(tbm_surface_queue_h surface_queue);
+
+tbm_surface_queue_error_e tbm_surface_queue_add_destroy_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_remove_destroy_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_add_reset_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_remove_reset_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_add_dequeuable_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_remove_dequeuable_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_add_dequeue_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeue_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_remove_dequeue_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeue_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_add_can_dequeue_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb can_dequeue_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_remove_can_dequeue_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb can_dequeue_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_add_acquirable_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_remove_acquirable_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_add_trace_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_trace_cb trace_cb,
+ void *data);
+
+tbm_surface_queue_error_e tbm_surface_queue_remove_trace_cb(
+ tbm_surface_queue_h surface_queue, tbm_surface_queue_trace_cb trace_cb,
+ void *data);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _TBM_SURFACE_H_ */
--- /dev/null
+#ifndef _TBM_SYNC_H_
+#define _TBM_SYNC_H_
+
+#include <tbm_bufmgr.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Create timeline object.
+ * @return file descriptor for the created timeline on success, -1 otherwise
+ * @remarks close the fd when you no longer need it
+ */
+tbm_fd tbm_sync_timeline_create(void);
+
+/**
+ * @brief Increase the current value of the timeline.
+ * @param[in] timeline timeline object
+ * @param[in] count amount of increment
+ * @return 1 on success, 0 otherwise
+ */
+int tbm_sync_timeline_inc(tbm_fd timeline, unsigned int count);
+
+/**
+ * @brief Create fence object.
+ * @param[in] timeline timeline object on which the fence is created
+ * @param[in] name fence name (only first 31 characters will be used)
+ * @param[in] value timeline point value for the fence
+ * @return file descriptor for the created fence on success, -1 otherwise
+ * @remarks close the fd when you no longer need it
+ */
+tbm_fd tbm_sync_fence_create(tbm_fd timeline, const char *name, unsigned int value);
+
+/**
+ * @brief Wait for the given fence to be signaled
+ * @param[in] fence fence object
+ * @param[in] timeout timeout in milliseconds
+ * @return 1 on success, 0 on failure, -1 on timeout expire
+ * @remarks negative timeout means infinite, timeout 0 returns immediately
+ */
+int tbm_sync_fence_wait(tbm_fd fence, int timeout);
+
+/**
+ * @brief Merge two fences into one
+ * @param[in] name name of the new fence
+ * @param[in] fence1 fence to be merged
+ * @param[in] fence2 fence to be merged
+ * @return file descriptor for the new fence on success, -1 otherwise
+ * @remarks close the fd when you no longer need it
+ */
+tbm_fd tbm_sync_fence_merge(const char *name, tbm_fd fence1, tbm_fd fence2);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TBM_SYNC_H */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_TYPE_H_
+#define _TBM_TYPE_H_
+
+/**
+ * @addtogroup CAPI_UI_TBM_SURFACE_MODULE
+ * @{
+ */
+
+#include <stdint.h>
+#include <tizen.h>
+
+/**
+ * @brief Definition for the Tizen buffer surface.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct _tbm_surface *tbm_surface_h;
+/**
+ * @brief Definition for the Tizen buffer surface format.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef uint32_t tbm_format;
+
+#define __tbm_fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
+ ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
+
+/* color index */
+/**
+ * @brief Definition for the TBM surface format C8 ([7:0] C).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_C8 __tbm_fourcc_code('C', '8', ' ', ' ')
+
+/* 8 bpp RGB */
+/**
+ * @brief Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGB332 __tbm_fourcc_code('R', 'G', 'B', '8')
+/**
+ * @brief Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGR233 __tbm_fourcc_code('B', 'G', 'R', '8')
+
+/* 16 bpp RGB */
+/**
+ * @brief Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_XRGB4444 __tbm_fourcc_code('X', 'R', '1', '2')
+/**
+ * @brief Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_XBGR4444 __tbm_fourcc_code('X', 'B', '1', '2')
+/**
+ * @brief Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGBX4444 __tbm_fourcc_code('R', 'X', '1', '2')
+/**
+ * @brief Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGRX4444 __tbm_fourcc_code('B', 'X', '1', '2')
+
+/**
+ * @brief Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_ARGB4444 __tbm_fourcc_code('A', 'R', '1', '2')
+/**
+ * @brief Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_ABGR4444 __tbm_fourcc_code('A', 'B', '1', '2')
+/**
+ * @brief Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGBA4444 __tbm_fourcc_code('R', 'A', '1', '2')
+/**
+ * @brief Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGRA4444 __tbm_fourcc_code('B', 'A', '1', '2')
+
+/**
+ * @brief Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_XRGB1555 __tbm_fourcc_code('X', 'R', '1', '5')
+/**
+ * @brief Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_XBGR1555 __tbm_fourcc_code('X', 'B', '1', '5')
+/**
+ * @brief Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGBX5551 __tbm_fourcc_code('R', 'X', '1', '5')
+/**
+ * @brief Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGRX5551 __tbm_fourcc_code('B', 'X', '1', '5')
+
+/**
+ * @brief Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_ARGB1555 __tbm_fourcc_code('A', 'R', '1', '5')
+/**
+ * @brief Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_ABGR1555 __tbm_fourcc_code('A', 'B', '1', '5')
+/**
+ * @brief Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGBA5551 __tbm_fourcc_code('R', 'A', '1', '5')
+/**
+ * @brief Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGRA5551 __tbm_fourcc_code('B', 'A', '1', '5')
+
+/**
+ * @brief Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGB565 __tbm_fourcc_code('R', 'G', '1', '6')
+/**
+ * @brief Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGR565 __tbm_fourcc_code('B', 'G', '1', '6')
+
+/* 24 bpp RGB */
+/**
+ * @brief Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGB888 __tbm_fourcc_code('R', 'G', '2', '4')
+/**
+ * @brief Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGR888 __tbm_fourcc_code('B', 'G', '2', '4')
+
+/* 32 bpp RGB */
+/**
+ * @brief Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_XRGB8888 __tbm_fourcc_code('X', 'R', '2', '4')
+/**
+ * @brief Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_XBGR8888 __tbm_fourcc_code('X', 'B', '2', '4')
+/**
+ * @brief Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4')
+/**
+ * @brief Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGRX8888 __tbm_fourcc_code('B', 'X', '2', '4')
+
+/**
+ * @brief Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_ARGB8888 __tbm_fourcc_code('A', 'R', '2', '4')
+/**
+ * @brief Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_ABGR8888 __tbm_fourcc_code('A', 'B', '2', '4')
+/**
+ * @brief Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4')
+/**
+ * @brief Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4')
+
+/**
+ * @brief Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_XRGB2101010 __tbm_fourcc_code('X', 'R', '3', '0')
+/**
+ * @brief Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_XBGR2101010 __tbm_fourcc_code('X', 'B', '3', '0')
+/**
+ * @brief Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGBX1010102 __tbm_fourcc_code('R', 'X', '3', '0')
+/**
+ * @brief Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGRX1010102 __tbm_fourcc_code('B', 'X', '3', '0')
+
+/**
+ * @brief Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_ARGB2101010 __tbm_fourcc_code('A', 'R', '3', '0')
+/**
+ * @brief Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_ABGR2101010 __tbm_fourcc_code('A', 'B', '3', '0')
+/**
+ * @brief Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_RGBA1010102 __tbm_fourcc_code('R', 'A', '3', '0')
+/**
+ * @brief Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_BGRA1010102 __tbm_fourcc_code('B', 'A', '3', '0') /* */
+
+/* packed YCbCr */
+/**
+ * @brief Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YUYV __tbm_fourcc_code('Y', 'U', 'Y', 'V')
+/**
+ * @brief Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YVYU __tbm_fourcc_code('Y', 'V', 'Y', 'U') /* */
+/**
+ * @brief Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_UYVY __tbm_fourcc_code('U', 'Y', 'V', 'Y')
+/**
+ * @brief Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_VYUY __tbm_fourcc_code('V', 'Y', 'U', 'Y')
+
+/**
+ * @brief Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_AYUV __tbm_fourcc_code('A', 'Y', 'U', 'V')
+
+/*
+ * 2 plane YCbCr
+ * index 0 = Y plane, [7:0] Y
+ * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
+ * or
+ * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
+ */
+/**
+ * @brief Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_NV12 __tbm_fourcc_code('N', 'V', '1', '2')
+/**
+ * @brief Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_NV21 __tbm_fourcc_code('N', 'V', '2', '1') /* */
+/**
+ * @brief Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_NV16 __tbm_fourcc_code('N', 'V', '1', '6')
+/**
+ * @brief Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_NV61 __tbm_fourcc_code('N', 'V', '6', '1')
+
+/*
+ * 3 plane YCbCr
+ * index 0: Y plane, [7:0] Y
+ * index 1: Cb plane, [7:0] Cb
+ * index 2: Cr plane, [7:0] Cr
+ * or
+ * index 1: Cr plane, [7:0] Cr
+ * index 2: Cb plane, [7:0] Cb
+ */
+/**
+ * @brief Definition for the TBM surface format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
+ */
+#define TBM_FORMAT_YUV410 __tbm_fourcc_code('Y', 'U', 'V', '9')
+/**
+ * @brief Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YVU410 __tbm_fourcc_code('Y', 'V', 'U', '9')
+/**
+ * @brief Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YUV411 __tbm_fourcc_code('Y', 'U', '1', '1')
+/**
+ * @brief Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YVU411 __tbm_fourcc_code('Y', 'V', '1', '1')
+/**
+ * @brief Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YUV420 __tbm_fourcc_code('Y', 'U', '1', '2')
+/**
+ * @brief Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YVU420 __tbm_fourcc_code('Y', 'V', '1', '2')
+/**
+ * @brief Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YUV422 __tbm_fourcc_code('Y', 'U', '1', '6')
+/**
+ * @brief Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YVU422 __tbm_fourcc_code('Y', 'V', '1', '6')
+/**
+ * @brief Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YUV444 __tbm_fourcc_code('Y', 'U', '2', '4')
+/**
+ * @brief Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+#define TBM_FORMAT_YVU444 __tbm_fourcc_code('Y', 'V', '2', '4')
+
+/* 2 plane YCbCr */
+/**
+ * @brief Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).
+ * @since_tizen 3.0
+ */
+#define TBM_FORMAT_NV12MT __tbm_fourcc_code('T', 'M', '1', '2')
+
+/**
+* @}
+*/
+
+#endif /* _TBM_TYPE_H_ */
--- /dev/null
+/**************************************************************************
+
+libtbm
+
+Copyright 2012-2018 Samsung Electronics co., Ltd. All Rights Reserved.
+
+Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
+Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
+Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+#ifndef _TBM_TYPE_COMMON_H_
+#define _TBM_TYPE_COMMON_H_
+
+#include <tbm_type.h>
+
+/**
+ * \file tbm_type_common.h
+ * \brief Type definition used internally
+ */
+
+/* tbm error base : this error base is same as TIZEN_ERROR_TBM in tizen_error.h */
+#ifndef TBM_ERROR_BASE
+#define TBM_ERROR_BASE -0x02830000
+#endif
+
+/**
+ * @brief Definition for the tizen buffer manager
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct _tbm_bufmgr *tbm_bufmgr;
+
+/**
+ * @brief Definition for the tizen buffer object
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef struct _tbm_bo *tbm_bo;
+
+/**
+ * @brief Definition for the key associated with the buffer object
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+
+typedef uint32_t tbm_key;
+/**
+ * @brief Definition for the file descripter of the system buffer manager
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef int32_t tbm_fd;
+
+/**
+ * @brief Definition for native display (wl_display in tizen)
+ * @since_tizen 5.0
+ */
+typedef void tbm_native_display;
+
+
+/* TBM_DEVICE_TYPE */
+
+/**
+ * @brief Enumeration for tbm error type.
+ * @since_tizen 2.4
+ */
+typedef enum {
+ /* TBM_ERROR_XXX. start from (TBM_ERROR_BASE | 0x0001) to (TBM_ERROR_BASE | 0x0099) */
+ TBM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ TBM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ TBM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
+ TBM_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Function not implemented */
+ TBM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+
+ /* TBM_BO_ERROR_XXX. start from (TBM_ERROR_BASE | 0x0101) to (TBM_ERROR_BASE | 0x0199) */
+ TBM_BO_ERROR_GET_FD_FAILED = TBM_ERROR_BASE | 0x0101, /**< failed to get fd in bo (DEPRECATED) */
+ TBM_BO_ERROR_HEAP_ALLOC_FAILED = TBM_ERROR_OUT_OF_MEMORY, /**< failed to allocate the heap memory in bo (DEPRECATED) */
+ TBM_BO_ERROR_LOAD_MODULE_FAILED = TBM_ERROR_BASE | 0x0103, /**< failed to load module (DEPRECATED) */
+ TBM_BO_ERROR_THREAD_INIT_FAILED = TBM_ERROR_BASE | 0x0104, /**< failed to initialize the pthread (DEPRECATED) */
+ TBM_BO_ERROR_BO_ALLOC_FAILED = TBM_ERROR_OUT_OF_MEMORY, /**< failed to allocate tbm_bo (DEPRECATED) */
+ TBM_BO_ERROR_INIT_STATE_FAILED = TBM_ERROR_BASE | 0x0106, /**< failed to initialize the state of tbm_bo (DEPRECATED) */
+ TBM_BO_ERROR_IMPORT_FAILED = TBM_ERROR_BASE | 0x0107, /**< failed to import the handle of tbm_bo (DEPRECATED) */
+ TBM_BO_ERROR_IMPORT_FD_FAILED = TBM_ERROR_BASE | 0x0108, /**< failed to import fd of tbm_bo (DEPRECATED) */
+ TBM_BO_ERROR_EXPORT_FAILED = TBM_ERROR_BASE | 0x0109, /**< failed to export the handle of the tbm_bo (DEPRECATED) */
+ TBM_BO_ERROR_EXPORT_FD_FAILED = TBM_ERROR_BASE | 0x0110, /**< failed to export fd of tbm_bo (DEPRECATED) */
+ TBM_BO_ERROR_GET_HANDLE_FAILED = TBM_ERROR_BASE | 0x0111, /**< failed to get the tbm_bo_handle (DEPRECATED) */
+ TBM_BO_ERROR_LOCK_FAILED = TBM_ERROR_BASE | 0x0112, /**< failed to lock the tbm_bo (DEPRECATED) */
+ TBM_BO_ERROR_MAP_FAILED = TBM_ERROR_BASE | 0x0113, /**< failed to map the tbm_bo to get the tbm_bo_handle (DEPRECATED) */
+ TBM_BO_ERROR_UNMAP_FAILED = TBM_ERROR_BASE | 0x0114, /**< failed to unmap the tbm_bo (DEPRECATED) */
+ TBM_BO_ERROR_SWAP_FAILED = TBM_ERROR_BASE | 0x0115, /**< failed to swap the tbm_bos (DEPRECATED) */
+ TBM_BO_ERROR_DUP_FD_FAILED = TBM_ERROR_BASE | 0x0116, /**< failed to duplicate fd (DEPRECATED) */
+
+ /* TBM_SURFACE_ERROR_XXX. start from (TBM_ERROR_BASE | 0x0201) to (TBM_ERROR_BASE | 0x0299)
+ * TBM_SURFACE_ERROR_XXX is defined in tbm_surface.h file because it is CAPI.
+ *
+ * TBM_SURFACE_ERROR_NONE = TIZEN_ERROR_NONE, // Successful
+ * TBM_SURFACE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, // Invalid parameter
+ * TBM_SURFACE_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, // Invalid Operation
+ *
+ */
+
+ /* TBM_SURFACE_QUEUE_ERROR_XXX. start from (TBM_ERROR_BASE | 0x0301) to (TBM_ERROR_BASE | 0x0399) */
+ TBM_SURFACE_QUEUE_ERROR_NONE = TBM_ERROR_NONE, /**< Successful */
+ TBM_SURFACE_QUEUE_ERROR_EMPTY = TBM_ERROR_BASE | 0x0301, /**< Empty queue */
+ TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE = TBM_ERROR_BASE | 0x0302, /**< Invalid queue */
+ TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE = TBM_ERROR_BASE | 0x0303, /**< Invalid surface */
+ TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED = TBM_ERROR_BASE | 0x0304, /**< Allocation of surface failed */
+ TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST = TBM_ERROR_BASE | 0x0305, /**< Already existed surface */
+ TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE = TBM_ERROR_BASE | 0x0306, /**< Unknown surface */
+} tbm_error_e;
+
+typedef tbm_error_e tbm_surface_queue_error_e;
+
+/**
+ * @brief Enumeration of tbm buffer manager capability.
+ * @since_tizen 2.4
+ */
+enum TBM_BUFMGR_CAPABILITY {
+ TBM_BUFMGR_CAPABILITY_NONE = 0, /**< Not Support capability*/
+ TBM_BUFMGR_CAPABILITY_SHARE_KEY = (1 << 0), /**< Support sharing buffer by tbm key */
+ TBM_BUFMGR_CAPABILITY_SHARE_FD = (1 << 1), /**< Support sharing buffer by tbm fd */
+ TBM_BUFMGR_CAPABILITY_TBM_SYNC = (1 << 2), /**< Support tbm sync */
+};
+
+/**
+ * @brief Definition for the device type to access tbm_bo
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ TBM_DEVICE_DEFAULT = 0, /**< the device type to get the default handle */
+ TBM_DEVICE_CPU, /**< the device type to get the virtual memory */
+ TBM_DEVICE_2D, /**< the device type to get the 2D memory handle */
+ TBM_DEVICE_3D, /**< the device type to get the 3D memory handle */
+ TBM_DEVICE_MM, /**< the device type to get the the multimedia handle */
+
+} tbm_bo_device_type;
+
+/**
+ * @brief Definition for the optoin to access tbm_bo
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum {
+ TBM_OPTION_NONE = (1 << 0), /**< the option is none */
+ TBM_OPTION_READ = (1 << 0), /**< the option to access to read the bo */
+ TBM_OPTION_WRITE = (1 << 1), /**< the option to access to write the bo */
+ TBM_OPTION_VENDOR = (0xffff0000), /**< the the vendor specific option that depends on the backend */
+} tbm_bo_access_option;
+
+/**
+ * @brief tbm_bo_handle abstraction of the memory handle by TBM_DEVICE_TYPE
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+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 */
+};
+
+/**
+ * @brief Called when the user data is deleted in buffer object.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @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()
+ */
+typedef void (*tbm_data_free) (void *user_data);
+
+/**
+ * @brief Enumeration of tbm buffer manager capability.
+ * @since_tizen 5.0
+ */
+typedef enum TBM_BUFMGR_CAPABILITY tbm_bufmgr_capability;
+
+/**
+ * @brief Enumeration of tbm bo memory type.
+ * @since_tizen 5.0
+ */
+typedef enum TBM_BO_FLAGS tbm_bo_memory_type;
+
+/**
+ * @brief Enumeration of buffer manager lock try for bo
+ * @since_tizen 5.0
+ */
+typedef enum {
+ TBM_BUFMGR_BO_LOCK_TYPE_NEVER = 0, /**< the bufmgr do not try to lock the bos when the tbm_bo_map is called. */
+ TBM_BUFMGR_BO_LOCK_TYPE_ONCE, /**< the bufmgr tries to lock the bos only once when the tbm_bo_map is called. */
+ TBM_BUFMGR_BO_LOCK_TYPE_ALWAYS, /**< the bufmgr always tries to lock the bos when the tbm_bo_map is called. */
+} tbm_bufmgr_bo_lock_type;
+
+/**
+ * @brief Enumeration of the trace log for debug
+ * @since_tizen 5.0
+ */
+typedef enum {
+ TBM_BUFGMR_DEBUG_TRACE_NONE = 0,
+ TBM_BUFGMR_DEBUG_TRACE_BO = (1 << 0),
+ TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL = (1 << 1),
+ TBM_BUFGMR_DEBUG_TRACE_SURFACE = (1 << 2),
+ TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE = (1 << 3),
+} tbm_bufmgr_debug_trace_mask;
+
+/* type to string ***********************************************************/
+struct tbm_type_name {
+ int type;
+ const char *name;
+};
+
+#define TBM_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+#define TBM_TYPE_NAME_FN(res) \
+static inline const char * tbm_##res##_str(int type) \
+{ \
+ unsigned int i; \
+ for (i = 0; i < TBM_ARRAY_SIZE(tbm_##res##_names); i++) { \
+ if (tbm_##res##_names[i].type == type) \
+ return tbm_##res##_names[i].name; \
+ } \
+ return "(invalid)"; \
+}
+
+static struct tbm_type_name tbm_error_names[] = {
+ { TBM_ERROR_NONE, "TBM_ERROR_NONE" },
+ { TBM_ERROR_OUT_OF_MEMORY, "TBM_ERROR_OUT_OF_MEMORY" },
+ { TBM_ERROR_INVALID_PARAMETER, "TBM_ERROR_INVALID_PARAMETER" },
+ { TBM_ERROR_INVALID_OPERATION, "TBM_ERROR_INVALID_OPERATION" },
+ { TBM_ERROR_NOT_SUPPORTED, "TBM_ERROR_NOT_SUPPORTED" },
+ { TBM_SURFACE_QUEUE_ERROR_EMPTY, "TBM_SURFACE_QUEUE_ERROR_EMPTY" },
+ { TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE, "TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE" },
+ { TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE, "TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE" },
+ { TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED, "TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED" },
+ { TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST, "TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST" },
+ { TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE, "TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE" },
+};
+TBM_TYPE_NAME_FN(error)
+
+#endif /* _TBM_TYPE_COMMON_H_ */
%manifest %{name}.manifest
%defattr(-,root,root,-)
%dir %{_includedir}
-%{_includedir}/tbm_bufmgr.h
-%{_includedir}/tbm_surface.h
-%{_includedir}/tbm_surface_internal.h
-%{_includedir}/tbm_surface_queue.h
-%{_includedir}/tbm_bufmgr_backend.h
-%{_includedir}/tbm_type.h
-%{_includedir}/tbm_type_common.h
-%{_includedir}/tbm_drm_helper.h
-%{_includedir}/tbm_sync.h
-%{_includedir}/tbm_bo.h
-%{_includedir}/tbm_log.h
-%{_includedir}/tbm_error.h
-%{_includedir}/tbm_backend.h
+%{_includedir}/tbm_*.h
%{_libdir}/libtbm.so
%{_libdir}/pkgconfig/libtbm.pc
$(WARN_CFLAGS) \
-I./ \
-I$(top_srcdir) \
+ -I$(top_srcdir)/include \
-I$(top_srcdir)/src \
@LIBTBM_CFLAGS@ \
$(CFLAGS)
BUILT_SOURCES = $(nodist_libtbm_la_SOURCES)
-libtbmincludedir=$(includedir)
-libtbminclude_HEADERS = tbm_bufmgr.h \
- tbm_bo.h \
- tbm_surface.h \
- tbm_bufmgr_backend.h \
- tbm_type.h \
- tbm_type_common.h \
- tbm_surface_internal.h \
- tbm_surface_queue.h \
- tbm_drm_helper.h \
- tbm_sync.h \
- tbm_log.h \
- tbm_error.h \
- tbm_backend.h
-
CLEANFILES = $(BUILT_SOURCES)
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2018 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>,
- Sangjin Lee <lsj119@samsung.com>,
- Boram Park <boram1288.park@samsung.com>,
- Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_BACKEND_H_
-#define _TBM_BACKEND_H_
-
-#include <tbm_type_common.h>
-
-/**
- * \file tbm_backend.h
- * \brief The backend header file for Tizen Buffer Manager
- * This header is for the implementation of the TBM backend module.
- * This backend header is used from the 3.0 version of libtbm and from
- * the 5.0 version of the tizen.
- * @code
- * #include <tbm_backend.h>
- * @endcode
- */
-
-#define TBM_BACKEND_ABI_MINOR_MASK 0x0000FFFF
-#define TBM_BACKEND_ABI_MAJOR_MASK 0xFFFF0000
-#define TBM_BACKEND_GET_ABI_MINOR(v) ((v) & TBM_BACKEND_ABI_MINOR_MASK)
-#define TBM_BACKEND_GET_ABI_MAJOR(v) (((v) & TBM_BACKEND_ABI_MAJOR_MASK) >> 16)
-/*
- * ABI versions. Each version has a major and minor revision. Modules
- * using lower minor revisions must work with servers of a higher minor
- * revision. There is no compatibility between different major revisions.
- * Whenever the ABI_MAJOR_VERSION is changed, the others must also be
- * changed. The minor revision mask is 0x0000FFFF and the major revision
- * mask is 0xFFFF0000.
- */
-#define TBM_BACKEND_SET_ABI_VERSION(maj, min) \
- ((((maj) << 16) & TBM_BACKEND_ABI_MAJOR_MASK) | ((min) & TBM_BACKEND_ABI_MINOR_MASK))
-
-#define TBM_BACKEND_ABI_VERSION_1_0 TBM_BACKEND_SET_ABI_VERSION(1, 0)
-#define TBM_BACKEND_ABI_VERSION_2_0 TBM_BACKEND_SET_ABI_VERSION(2, 0)
-#define TBM_BACKEND_ABI_VERSION_3_0 TBM_BACKEND_SET_ABI_VERSION(3, 0)
-#define TBM_BACKEND_ABI_LATEST_VERSION TBM_BACKEND_ABI_VERSION_3_0 /**< the latest version of the tbm backend abi */
-
-/**
- * @brief The backend bufmgr data
- * @details
- * The init() function of #tbm_backend_module returns the backend module data.
- * This handle will be used in #tbm_backend_bufmgr_func.
- * @see tbm_backend_module, tbm_backend_bufmgr_func
- */
-typedef void tbm_backend_bufmgr_data;
-
-/**
- * @brief The backend bo data
- * @details
- * The allocation function and the import function in #tbm_backend_bufmgr_func
- * returns the backend bo data. This handle will be used in #tbm_backend_bo_func.
- * @see tbm_backend_bufmgr_funce, tbm_backend_bo_func
- */
-typedef void tbm_backend_bo_data;
-
-/**
- * @brief The type definition of the bufmgr functions
- */
-typedef struct _tbm_backend_bufmgr_func tbm_backend_bufmgr_func;
-
-/**
- * @brief The type definition of the bo functions
- */
-typedef struct _tbm_backend_bo_func tbm_backend_bo_func;
-
-/**
- * @brief The bufmgr functions for a backend module.
- */
-struct _tbm_backend_bufmgr_func {
- /**
- * @brief Get the capabilities of a buffer manager
- * @remarks The backend must support the TBM_BUFMGR_CAPABILITY_SHARE_FD.
- * TBM_BUFMGR_CAPABILITY_SHARE_KEY will help you do debugging to
- * develop the platform because the tbm_key will be the unique
- * identification of the tbm_bo memory in the system.
- * @param[in] bufmgr_data The backend module data
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return the capabilities of a backend modul
- */
- tbm_bufmgr_capability (*bufmgr_get_capabilities)(tbm_backend_bufmgr_data *bufmgr_data,
- tbm_error_e *error);
-
- /**
- * @brief set(bind) the native display
- * @param[in] bufmgr_data The backend bufmgr data
- * @param[in] native_display : the native display (wl_display in wayland window system)
- * @return #TBM_ERROR_NONE if success. Otherwise, error value.
- */
- tbm_error_e (*bufmgr_bind_native_display)(tbm_backend_bufmgr_data *bufmgr_data,
- tbm_native_display *native_display);
-
- /**
- * @brief get the formats list and the num to be supported by backend.
- * @param[in] bufmgr_data The backend bufmgr data
- * @param[out] **formats : format array list. it is allocated by backend funtion
- * @param[out] *num : the number of the formats to be supported by backend
- * @return #TBM_ERROR_NONE if success. Otherwise, error value.
- */
- tbm_error_e (*bufmgr_get_supported_formats)(tbm_backend_bufmgr_data *bufmgr_data,
- uint32_t **formats, uint32_t *num);
-
- /**
- * @brief get the plane data of the plane_idx according to the format.
- * @param[in] bufmgr_data The backend bufmgr data
- * @param[in] format : the format of the surface
- * @param[in] plane_idx : the index of the plane
- * @param[in] width : the width of the surface with the format
- * @param[in] height : the height of the surface with the format
- * @param[out] size : the size of the plane index
- * @param[out] offset : the offset of the plane index at the bo index
- * @param[out] pitch : the pitch of the plane index
- * @param[out] bo_idx : the bo index of the plane index
- * @return #TBM_ERROR_NONE if success. Otherwise, error value.
- */
- tbm_error_e (*bufmgr_get_plane_data)(tbm_backend_bufmgr_data *bufmgr_data,
- tbm_format format, int plane_idx, int width,
- int height, uint32_t *size, uint32_t *offset,
- uint32_t *pitch, int *bo_idx);
-
- /**
- * @brief allocate the bo data of the tbm_backend
- * @param[in] bufmgr_data The backend bufmgr data
- * @param[in] size : the size of bo data
- * @param[in] mem_types : the memory types
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return pointer of the bo_data of the tbm backend.
- */
- tbm_backend_bo_data *(*bufmgr_alloc_bo)(tbm_backend_bufmgr_data *bufmgr_data,
- unsigned int size, tbm_bo_memory_type mem_types,
- tbm_error_e *error);
-
- /**
- * @brief allocate the bo data of the bo index according to the format
- * @param[in] bufmgr_data The backend bufmgr data
- * @param[in] width : the width of the surface with the format
- * @param[in] height : the height of the surface with the format
- * @param[in] format : the format of the surface
- * @param[in] mem_types : the memory types
- * @param[in] bo_idx : the bo index of the surface
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return pointer of the bo data of the tbm backend.
- */
- tbm_backend_bo_data *(*bufmgr_alloc_bo_with_format)(tbm_backend_bufmgr_data *bufmgr_data,
- int format, int bo_idx, int width,
- int height, tbm_bo_memory_type mem_types,
- tbm_error_e *error);
-
- /**
- * @brief import the bo data associated with the tdm_fd(prime fd).
- * @remarks tbm_fd must be free by user.
- * @remarks It must be supported at the backend module. To sharing the tdm_fd(prime fd)
- * among the processes is the essential feature to run the graphic rendering.
- * @param[in] bufmgr_data The backend bufmgr data
- * @param[in] fd : the tdm_fd(prime fd) associated with the bo data
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return pointer of the bo data of the tbm backend.
- */
- tbm_backend_bo_data *(*bufmgr_import_fd)(tbm_backend_bufmgr_data *bufmgr_data,
- tbm_fd fd, tbm_error_e *error);
-
- /**
- * @brief import the bo data associated with the tdm_key.
- * @remarks If the backend doesn't support a buffer sharing by tbm key,
- * fucntion pointer must be set to NULL.
- * @param[in] bufmgr_data The backend bufmgr data
- * @param[in] key : the tdm_key associated with the bo data
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return pointer of the bo data of the tbm backend.
- */
- tbm_backend_bo_data *(*bufmgr_import_key)(tbm_backend_bufmgr_data *bufmgr_data,
- tbm_key key, tbm_error_e *error);
-
- /* Padding for future extension */
- void (*reserved1)(void);
- void (*reserved2)(void);
- void (*reserved3)(void);
- void (*reserved4)(void);
- void (*reserved5)(void);
- void (*reserved6)(void);
-};
-
-/**
- * @brief The bo functions for a backend module.
- */
-struct _tbm_backend_bo_func {
- /**
- * @brief free the bo data.
- * @param[in] bo_data : the bo data of the tbm backend
- * @return #TBM_ERROR_NONE if success. Otherwise, error value.
- */
- void (*bo_free)(tbm_backend_bo_data *bo_data);
-
- /**
- * @brief get the size of a bo data.
- * @param[in] bo_data : the bo data of the tbm backend
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return size if this function succeeds, otherwise 0.
- */
- int (*bo_get_size)(tbm_backend_bo_data *bo_data, tbm_error_e *error);
-
- /**
- * @brief get the tbm memory types
- * @param[in] bo_data : the bo data of the tbm backend
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @see #TBM_BO_FLAGS #tbm_bo_memory_type
- * @return tbm flags of memory type is this function succeeds, otherwise 0.
- */
- tbm_bo_memory_type (*bo_get_memory_types)(tbm_backend_bo_data *bo_data,
- tbm_error_e *error);
-
- /**
- * @brief get the tbm_bo_handle according to the device type.
- * @param[in] bo_data : the bo data of the tbm backend
- * @param[in] device : the device type to get a handle
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return the handle of the bo data
- */
- tbm_bo_handle (*bo_get_handle)(tbm_backend_bo_data *bo_data,
- tbm_bo_device_type device, tbm_error_e *error);
-
- /**
- * @brief map the bo data according to the device type and the option.
- * @param[in] bo_data : the bo data of the tbm backend
- * @param[in] device : the device type to get a handle
- * @param[in] opt : the option to access the bo data
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return the handle of the bo data
- */
- tbm_bo_handle (*bo_map)(tbm_backend_bo_data *bo_data, tbm_bo_device_type device,
- tbm_bo_access_option opt, tbm_error_e *error);
-
- /**
- * @brief unmap the bo data.
- * @param[in] bo_data : the bo data of the tbm backend
- * @return #TBM_ERROR_NONE if success. Otherwise, error value.
- */
- tbm_error_e (*bo_unmap)(tbm_backend_bo_data *bo_data);
-
- /**
- * @brief lock the bo data with a device and an opt.
- * @param[in] bo_data : the bo data of the tbm backend
- * @param[in] device : the device type to get a handle
- * @param[in] opt : the option to access the bo data
- * @return #TBM_ERROR_NONE if success. Otherwise, error value.
- * @remark This function pointer could be null.
- */
- tbm_error_e (*bo_lock)(tbm_backend_bo_data *bo_data, tbm_bo_device_type device,
- tbm_bo_access_option opt);
-
- /**
- * @brief unlock the bo data.
- * @param[in] bo_data : the bo data of the tbm backend
- * @return #TBM_ERROR_NONE if success. Otherwise, error value.
- * @remark This function pointer could be null.
- */
- tbm_error_e (*bo_unlock)(tbm_backend_bo_data *bo_data);
-
- /**
- * @brief export the bo data to the tdm_fd(prime fd)
- * @remarks tbm_fd must be free by user.
- * @remarks It must be supported at the backend module. To sharing the tdm_fd(prime fd)
- * among the processes is the essential feature to run the graphic rendering.
- * @param[in] bo_data : the bo data of the tbm backend
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return tbm_fd associated with the bo data
- */
- tbm_fd (*bo_export_fd)(tbm_backend_bo_data *bo_data, tbm_error_e *error);
-
- /**
- * @brief export the bo data to the tdm_key
- * @remarks If the backend doesn't support a buffer sharing by tbm key,
- * fucntion pointer must be set to NULL.
- * @param[in] bo_data : the bo data of the tbm backend
- * @param[out] error #TBM_ERROR_NONE if success. Otherwise, error value.
- * @return key associated with the bo data
- */
- tbm_key (*bo_export_key)(tbm_backend_bo_data *bo_data, tbm_error_e *error);
-
- /* Padding for future extension */
- void (*reserved1)(void);
- void (*reserved2)(void);
- void (*reserved3)(void);
- void (*reserved4)(void);
- void (*reserved5)(void);
- void (*reserved6)(void);
-};
-
-/**
- * @brief The backend module information of the entry point to initialize a tbm
- * backend module.
- * @remark
- * A backend module @b SHOULD define the global data symbol of which name is
- * @b "tbm_backend_module_data". tbm will read this symbol, @b "tbm_backend_module_data",
- * at the initial time and call init() function of #tbm_backend_module.
- */
-typedef struct _tbm_backend_module {
- const char *name; /**< The module name of a backend module */
- const char *vendor; /**< The vendor name of a backend module */
- unsigned long abi_version; /**< The ABI version of a backend module */
-
- /**
- * @brief The init function of a backend module
- * @param[in] bufmgr A tbm buffer manager object.
- * @return The backend module data
- * @see tbm_backend_bufmgr_data
- */
- tbm_backend_bufmgr_data *(*init)(tbm_bufmgr bufmgr, tbm_error_e *error);
-
- /**
- * @brief deinitialize the bufmgr private data.
- * @param[in] bufmgr_data : The backend module data
- */
- void (*deinit)(tbm_backend_bufmgr_data *bufmgr_data);
-} tbm_backend_module;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int tbm_backend_bufmgr_query_display_server(tbm_bufmgr bufmgr, tbm_error_e *error);
-tbm_backend_bufmgr_func *tbm_backend_bufmgr_alloc_bufmgr_func(tbm_bufmgr bufmgr, tbm_error_e *error);
-void tbm_backend_bufmgr_free_bufmgr_func(tbm_bufmgr bufmgr, tbm_backend_bufmgr_func *func);
-tbm_error_e tbm_backend_bufmgr_register_bufmgr_func(tbm_bufmgr bufmgr, tbm_backend_bufmgr_func *func);
-tbm_backend_bo_func *tbm_backend_bufmgr_alloc_bo_func(tbm_bufmgr bufmgr, tbm_error_e *error);
-void tbm_backend_bufmgr_free_bo_func(tbm_bufmgr bufmgr, tbm_backend_bo_func *func);
-tbm_error_e tbm_backend_bufmgr_register_bo_func(tbm_bufmgr bufmgr, tbm_backend_bo_func *func);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _TBM_BACKEND_H_ */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_BO_H_
-#define _TBM_BO_H_
-
-#include <tbm_type.h>
-#include <tbm_type_common.h>
-#include <tbm_error.h>
-
-/**
- * \file tbm_bo.h
- * \brief Tizen Buffer Object
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Functions for buffer object */
-
-/**
- * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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
- * @par Example
- @code
- #include <tbm_bufmgr.h>
-
- int bufmgr_fd;
- tbm_bufmgr bufmgr;
- tbm_bo;
- tbm_error_e error;
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
- if (!bo)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ....
-
- tbm_bufmgr_deinit (bufmgr);
- @endcode
- */
-tbm_bo tbm_bo_alloc(tbm_bufmgr bufmgr, int size, int flags);
-
-/**
- * @brief Increases the reference count of bo.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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
- */
-tbm_bo tbm_bo_ref(tbm_bo bo);
-
-/**
- * @brief Decreases the reference count of bo
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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
- */
-void tbm_bo_unref(tbm_bo bo);
-
-/**
- * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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
- * @exception #TBM_ERROR_NONE Success
- * @exception #TBM_ERROR_BO_LOCK_FAILED tbm_bo lock failed
- * @exception #TBM_ERROR_BO_MAP_FAILED tbm_bo map failed
- * @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;
- tbm_error_e error;
-
- 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);
- if (handle.ptr == NULL)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- tbm_bo_unmap (bo);
- tbm_bo_unref (bo);
- tbm_bufmgr_deinit (bufmgr);
- @endcode
- */
-tbm_bo_handle tbm_bo_map(tbm_bo bo, int device, int opt);
-
-/**
- * @brief Unmaps the buffer object.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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
- */
-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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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;
- tbm_error_e error;
-
- 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);
- if (handle.ptr == NULL)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- tbm_bo_unref (bo);
- tbm_bufmgr_deinit (bufmgr);
- @endcode
- */
-tbm_bo_handle tbm_bo_get_handle(tbm_bo bo, int device);
-
-/**
- * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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;
- tbm_error_e error;
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
- key = tbm_bo_export (bo);
- if (key == 0)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- 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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks You must release the fd using close().
- * @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;
- tbm_error_e error;
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
- bo_fd = tbm_bo_export (bo);
- if (bo_fd == 0)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- 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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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;
- tbm_error_e error;
-
- ...
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo = tbm_bo_import (bufmgr, key);
- if (bo == NULL)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- tbm_bo_unref (bo);
- tbm_bufmgr_deinit (bufmgr);
- @endcode
- */
-tbm_bo tbm_bo_import(tbm_bufmgr bufmgr, tbm_key key);
-
-/**
- * @brief Imports the buffer object associated with the fd.
- * @details The reference count of the tbm_bo is 1.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks You must release the fd using close().
- * @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;
- tbm_error_e error;
-
- ...
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo = tbm_bo_import_fd (bo_fd);
- if (bo == 0)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- 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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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;
- tbm_error_e error;
-
- 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);
- if (ret == 0)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- tbm_bo_unref (bo1);
- tbm_bo_unref (bo2);
- tbm_bufmgr_deinit (bufmgr);
- @endcode
- */
-int tbm_bo_swap(tbm_bo bo1, tbm_bo bo2);
-
-/**
- * @brief Adds a user_data to the buffer object.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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
- * @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);
-
-/**
- * @brief Deletes the user_data in the buffer object.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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()
- * @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_delete_user_data(tbm_bo bo, unsigned long key);
-
-/**
- * @brief Sets a user_date to the buffer object.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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
- */
-int tbm_bo_set_user_data(tbm_bo bo, unsigned long key, void *data);
-
-/**
- * @brief Gets a user_data from the buffer object with the key.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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
- */
-int tbm_bo_get_user_data(tbm_bo bo, unsigned long key, void **data);
-
-/**
- * @brief Gets the tbm bo flags.
- * @since_tizen 2.4
- * @param[in] bo : the buffer object
- * @return the tbm bo flags
- * @see TBM_BO_FLAGS
- * @par Example
- @code
- #include <tbm_bufmgr.h>
-
- int bufmgr_fd;
- tbm_bufmgr bufmgr;
- tbm_bo;
- int flags;
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
- flags = tbm_bo_get_flags (bo);
-
- ...
-
- tbm_bo_unref (bo);
- tbm_bufmgr_deinit (bufmgr);
-
- @endcode
- */
-int tbm_bo_get_flags(tbm_bo bo);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _TBM_BO_H_ */
\ No newline at end of file
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_BUFMGR_H_
-#define _TBM_BUFMGR_H_
-
-#include <tbm_type.h>
-#include <tbm_type_common.h>
-#include <tbm_bo.h>
-#include <tbm_error.h>
-
-/**
- * \file tbm_bufmgr.h
- * \brief Tizen Buffer Manager
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Functions for buffer manager */
-
-/**
- * @brief Initializes the buffer manager.
- * @details If fd is lower than zero, fd is get drm fd in tbm_bufmgr_init function\n
- * The user can decide the lock type and cache flush type with the environment variables, which are BUFMGR_LOCK_TYPE and BUFMGR_MAP_CACHE.\n
- * \n
- * BUFMGR_LOCK default is once\n
- * once : The previous bo which is locked is unlock when the new bo is trying to be locked\n
- * always : The new bo is locked until the previous bo which is locked is unlocked\n
- * never : Every bo is never locked.\n
- * \n
- * BUFMGR_MAP_CACHE default is true\n
- * true : use map cache flushing\n
- * false : to use map cache flushing
- * @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
- * @see tbm_bufmgr_deinit();
- * @par Example
- @code
- #include <tbm_bufmgr.h>
- int bufmgr_fd;
-
- setenv("BUFMGR_LOCK_TYPE", "once", 1);
- setenv("BUFMGR_MAP_CACHE", "true", 1);
-
- tbm_bufmgr bufmgr;
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
-
- ....
-
- tbm_bufmgr_deinit (bufmgr);
- @endcode
- */
-tbm_bufmgr tbm_bufmgr_init(int fd);
-
-/**
- * @brief Deinitializes the buffer manager.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] bufmgr : the buffer manager
- * @see tbm_bufmgr_init()
- * @par Example
- @code
- #include <tbm_bufmgr.h>
-
- 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);
-
-/**
- * @brief Gets the tbm buffer capability.
- * @since_tizen 2.4
- * @param[in] bufmgr : the buffer manager
- * @return the tbm bufmgr capability
- * @par Example
- @code
- #include <tbm_bufmgr.h>
-
- int bufmgr_fd;
- tbm_bufmgr bufmgr;
- unsigned int capability;
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
-
- capability = tbm_bufmgr_get_capability (bufmgr);
-
- tbm_bufmgr_deinit (bufmgr);
- @endcode
- */
-unsigned int tbm_bufmgr_get_capability(tbm_bufmgr bufmgr);
-
-/**
- * @brief bind the native_display.
- * @since_tizen 3.0
- * @param[in] bufmgr : the buffer manager
- * @param[in] native_display : the native_display
- */
-int tbm_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *native_display);
-
-/**
- * @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
- */
-tbm_bufmgr tbm_bufmgr_server_init(void);
-
-/**
- * @brief Set the bo_lock_type of the bufffer manager.
- * @details set the bo_lock_type
- * @since_tizen 5.0
- */
-int tbm_bufmgr_set_bo_lock_type(tbm_bufmgr bufmgr, tbm_bufmgr_bo_lock_type bo_lock_type);
-
-/**
- * @brief Print out the information of tbm_bos.
- * @since_tizen 3.0
- * @param[in] bufmgr : the buffer manager
- */
-void tbm_bufmgr_debug_show(tbm_bufmgr bufmgr);
-
-/**
- * @brief Get string with the information of tbm_bos.
- * @since_tizen 3.0
- * @param[in] bufmgr : the buffer manager
- * @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 Print out the trace of tbm_bos.
- * @since_tizen 3.0
- * @param[in] bufmgr : the buffer manager
- * @param[in] onoff : 1 is on, and 0 is off
- */
-void tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff);
-
-/**
- * @brief Dump all tbm surfaces
- * @param[in] path : the given dump path
- * @return 1 if this function succeeds, otherwise 0.
- */
-int tbm_bufmgr_debug_dump_all(char *path);
-
-/**
- * @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.
- */
-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);
-
-/**
- * @brief Get ref_count of a global tbm_bufmgr
- * @since_tizen 5.0
- */
-int tbm_bufmgr_debug_get_ref_count(void);
-
-/**
- * @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
- */
-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_ */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-/*
- * This file is referenced by the xf86Module.h in xorg server.
- */
-
-#ifndef _TBM_BUFMGR_BACKEND_H_
-#define _TBM_BUFMGR_BACKEND_H_
-
-#include <tbm_bufmgr.h>
-#include <pthread.h>
-
-/**
- * \file tbm_bufmgr_backend.h
- * \brief backend header for Tizen Buffer Manager
- * This header is for the implementation of the TBM backend module.
- */
-
-#define ABI_MINOR_MASK 0x0000FFFF
-#define ABI_MAJOR_MASK 0xFFFF0000
-#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK)
-#define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16)
-
-/*
- * ABI versions. Each version has a major and minor revision. Modules
- * using lower minor revisions must work with servers of a higher minor
- * revision. There is no compatibility between different major revisions.
- * Whenever the ABI_ANSIC_VERSION is changed, the others must also be
- * changed. The minor revision mask is 0x0000FFFF and the major revision
- * mask is 0xFFFF0000.
- */
-#define SET_ABI_VERSION(maj, min) \
- ((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK))
-
-#define TBM_ABI_VERSION SET_ABI_VERSION(1, 1) /**< current abi vertion */
-
-typedef struct _tbm_bufmgr_backend *tbm_bufmgr_backend;
-
-/**
- * @brief TBM backend functions
- * the set of function pointers for the backend module of TBM.
- */
-struct _tbm_bufmgr_backend {
- int flags;
-
- void *priv; /**< bufmgr private */
-
- /**
- * @brief deinitialize the bufmgr private.
- * @param[in] priv : the private of the bufmgr
- */
- void (*bufmgr_deinit)(void *priv);
-
- /**
- * @brief get(bind) the native display
- * @param[in] bufmgr : the buffer object
- * @param[in] native_display : the native display
- * @return 1 if this function succeeds, otherwise 0.
- */
- int (*bufmgr_bind_native_display)(tbm_bufmgr bufmgr, void *native_display);
-
- /**
- * @brief allocate the buffer object
- * @param[in] bo : the buffer object
- * @param[in] size : the size of buffer object
- * @param[in] flags : the flags of memory type
- * @return pointer of the bo private.
- */
- void *(*bo_alloc)(tbm_bo bo, int size, int flags);
-
- /**
- * @brief free the buffer object.
- * @param[in] bo : the buffer object
- */
- void (*bo_free)(tbm_bo bo);
-
- /**
- * @brief get the size of a bo.
- * @param[in] bo : the buffer object
- * @return size if this function succeeds, otherwise 0.
- */
- int (*bo_size)(tbm_bo bo);
-
- /**
- * @brief get the tbm flags of memory type
- * @param[in] bo : the buffer object
- * @see #TBM_BO_FLAGS
- * @return tbm flags of memory type is this function succeeds, otherwise 0.
- */
- int (*bo_get_flags)(tbm_bo bo);
-
- /**
- * @brief get the tbm_bo_handle according to the device type.
- * @param[in] bo : the buffer object
- * @param[in] device : the device type to get a handle
- * @return the handle of the buffer object
- */
- tbm_bo_handle(*bo_get_handle)(tbm_bo bo, int device);
-
- /**
- * @brief map the buffer object according to the device type and the option.
- * @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
- */
- tbm_bo_handle(*bo_map)(tbm_bo bo, int device, int opt);
-
- /**
- * @brief unmap the buffer object.
- * @param[in] bo : the buffer object
- * @return 1 if this function succeeds, otherwise 0.
- */
- int (*bo_unmap)(tbm_bo bo);
-
- /**
- * @brief lock the buffer object with a device and an opt.
- * @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 1 if this function succeeds, otherwise 0.
- * @remark This function pointer could be null. (default: use the tizen global lock)
- */
- int (*bo_lock)(tbm_bo bo, int device, int opt);
-
- /**
- * @brief unlock the buffer object.
- * @param[in] bo : the buffer object
- * @return 1 if this function succeeds, otherwise 0.
- * @remark This function pointer could be null. (default: use the tizen global lock)
- */
- int (*bo_unlock)(tbm_bo bo);
-
- /**
- * @brief export the buffer object
- * @remarks tbm_fd must be free by user.
- * @remarks If the backend doesn't support a buffer sharing by tbm fd,
- fucntion pointer must be set to NULL.
- * @param[in] bo : the buffer object
- * @return tbm_fd associated with the buffer object
- */
- tbm_fd (*bo_export_fd)(tbm_bo bo);
-
- /**
- * @brief import the buffer object associated with the prime fd.
- * @remarks tbm_fd must be free by user.
- * @remarks If the backend doesn't support a buffer sharing by tbm fd,
- fucntion pointer must be set to NULL.
- * @param[in] bo : the buffer object
- * @param[in] fd : the prime fd associated with the buffer object
- * @return pointer of the bo private.
- */
- void *(*bo_import_fd)(tbm_bo bo, tbm_fd fd);
-
- /**
- * @brief export the buffer object
- * @remarks If the backend doesn't support a buffer sharing by tbm key,
- fucntion pointer must be set to NULL.
- * @param[in] bo : the buffer object
- * @return key associated with the buffer object
- */
- unsigned int (*bo_export)(tbm_bo bo);
-
- /**
- * @brief import the buffer object associated with the key.
- * @remarks If the backend doesn't support a buffer sharing by tbm key,
- fucntion pointer must be set to NULL.
- * @param[in] bo : the buffer object
- * @param[in] key : the key associated with the buffer object
- * @return pointer of the bo private.
- */
- void *(*bo_import)(tbm_bo bo, unsigned int key);
-
- /**
- * @brief query the formats list and the num to be supported by backend.
- * @param[out] **formats : format array list. this array has to be allocated by backend funtion
- * @param[out] *num : the number of the formats to be supported by backend
- * @return 1 if this function succeeds, otherwise 0.
- */
- int (*surface_supported_format)(uint32_t **formats, uint32_t *num);
-
- /**
- * @brief get the plane data of the surface.
- * @param[in] width : the width of the surface
- * @param[in] height : the height of the surface
- * @param[in] format : the format of the surface
- * @param[in] plane_idx : the format of the surface
- * @param[out] size : the size of the plane
- * @param[out] offset : the offset of the plane
- * @param[out] pitch : the pitch of the plane
- * @param[out] bo_idx : the bo index of the plane
- * @return 1 if this function succeeds, otherwise 0.
- */
- int (*surface_get_plane_data)(int width, int height,
- tbm_format format, int plane_idx, uint32_t *size, uint32_t *offset,
- uint32_t *pitch, int *bo_idx);
-
- /**
- * @brief allocate the buffer object for tbm surface
- * @param[in] bo : the buffer object
- * @param[in] width : the width of surface
- * @param[in] height : the height of surface
- * @param[in] format : the format of surface
- * @param[in] flags : the flags of memory type
- * @param[in] bo_idx : the index of bo in surface
- * @return pointer of the bo private.
- */
- void * (*surface_bo_alloc)(tbm_bo bo, int width, int height, int format, int flags, int bo_idx);
-
- /* Padding for future extension */
- void (*reserved1)(void);
- void (*reserved2)(void);
- void (*reserved3)(void);
- void (*reserved4)(void);
- void (*reserved5)(void);
- void (*reserved6)(void);
-};
-
-/**
- * @brief tbm module information
- * data type for the module information
- */
-typedef struct {
- const char *modname; /**< name of module, e.g. "foo" */
- const char *vendor; /**< vendor specific string */
- unsigned long abiversion; /**< ABI version */
-} TBMModuleVersionInfo;
-
-typedef int (*ModuleInitProc) (tbm_bufmgr, int);
-
-#define MODULEINITPPROTO(func) int func(tbm_bufmgr, int) /**< prototype for init symbol of bakcend module */
-
-/**
- * @brief tbm module data
- * data type for the entry point of the backend module
- */
-typedef struct {
- TBMModuleVersionInfo *vers; /**< tbm module informtaion */
- ModuleInitProc init; /**< init function of a backend module */
-} TBMModuleData;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-tbm_bufmgr_backend tbm_backend_alloc(void);
-void tbm_backend_free(tbm_bufmgr_backend backend);
-int tbm_backend_init(tbm_bufmgr bufmgr, tbm_bufmgr_backend backend);
-
-void *tbm_backend_get_bufmgr_priv(tbm_bo bo);
-void *tbm_backend_get_priv_from_bufmgr(tbm_bufmgr bufmgr);
-void *tbm_backend_get_bo_priv(tbm_bo bo);
-int tbm_backend_is_display_server(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _TBM_BUFMGR_BACKEND_H_ */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_DRM_HELPER_H_
-#define _TBM_DRM_HELPER_H_
-
-/**
- * @brief Initialize authentication server in display server.
- * @details
- * In DRM system, client sholud get authenticated fd from display server for using drm.
- Tbm provides wayland protocol and helper function for passing and authenticating
- fd from display server.
- * @param[in] wl_display wayland display
- * @param[in] fd fd of drm_master
- * @param[in] device_name name of drm device
- * @param[in] flags flags
- * @see #tbm_drm_helper_wl_auth_server_deinit()
- */
-int tbm_drm_helper_wl_auth_server_init(void *wl_display, int fd, const char *device_name, uint32_t flags);
-
-/**
- * @brief Deinitialize authentication server in display server
- * @details
- * In DRM system, client sholud get authenticated fd from display server for using drm.
- Tbm provides wayland protocol and helper function for passing and authenticating
- fd from display server.
- * @see #tdm_helper_set_tbm_master_fd()
- * @see #tbm_drm_helper_unset_tbm_master_fd()
- */
-void tbm_drm_helper_wl_auth_server_deinit(void);
-
-/**
- * @brief Get a drm master fd.
- * @details
- * This function will dup the drm master fd.
- The Caller SHOULD close the fd.
- In DRM system, a drm master fd SHOULD be shared between TDM backend and
- TBM backend in display server side.
- * @return fd if success. Otherwise, -1.
- * @see #tbm_drm_helper_set_tbm_master_fd()
- * @see #tbm_drm_helper_unset_tbm_master_fd()
- */
-int tbm_drm_helper_get_master_fd(void);
-
-/**
- * @brief Set a drm master fd with the given fd.
- * @details
- * In DRM system, a drm master fd @b SHOULD be shared between TDM backend and
- TBM backend in display server side.
- * @param[in] fd The given fd
- * @see #tbm_drm_helper_get_master_fd()
- * @see #tbm_drm_helper_unset_tbm_master_fd()
- */
-void tbm_drm_helper_set_tbm_master_fd(int fd);
-
-/**
- * @brief Unset a drm master fd.
- * @see #tbm_drm_helper_get_master_fd()
- * @see #tbm_drm_helper_set_tbm_master_fd()
- */
-void tbm_drm_helper_unset_tbm_master_fd(void);
-
-/**
- * @brief Get infomation of drm authentication.
- * @details
- * In DRM system, client sholud get authenticated fd from display server for using drm.
- Tbm provides wayland protocol and helper function for passing and authenticating
- fd from display server.
- * @param[out] fd The authenticated fd
- * @param[out] device The device name
- * @param[out] capabilities The capabilities of device
- * @see #tdm_helper_set_tbm_master_fd()
- * @see #tbm_drm_helper_unset_tbm_master_fd()
- */
-int tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities);
-
-/**
- * @brief Set drm fd with the given fd.
- * @details
- * Some client want to get drm fd used tbm_backend.
- if tbm_backend allow that client use drm_fd, it SHOULD be set.
- * @param[in] fd The given fd
- * @see #tbm_drm_helper_get_fd()
- */
-void tbm_drm_helper_set_fd(int fd);
-
-/**
- * @brief Unset drm fd.
- * @details
- * Some client want to get drm fd used tbm_backend.
- if tbm_backend allow that client use drm_fd, it SHOULD be set.
- * @param[in] fd The given fd
- * @see #tbm_drm_helper_get_fd()
- */
-void tbm_drm_helper_unset_fd(void);
-
-/**
- * @brief Get drm fd.
- * @details
- * Some client want to get drm fd used tbm_backend.
- client can get drm fd from this fucntion.
- The Caller SHOULD close the fd.
- * @return fd if success. Otherwise, -1.
- * @see #tdm_helper_set_tbm_master_fd()
- * @see #tbm_drm_helper_unset_tbm_master_fd()
- */
-int tbm_drm_helper_get_fd(void);
-
-#endif /* _TBM_DRM_HELPER_H_ */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2012-2018 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_ERROR_H_
-#define _TBM_ERROR_H_
-
-#include <tbm_type.h>
-#include <tbm_type_common.h>
-
-/**
- * \file tbm_error.h
- * \brief TBM Error
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Gets the latest tbm_error.
- * @since_tizen 2.4
- * @return the latest tbm_error
- * @par Example
- @code
- #include <tbm_bufmgr.h>
-
- int bufmgr_fd;
- tbm_bufmgr bufmgr;
- tbm_bo bo;
- tbm_bo_handle handle;
- tbm_error_e error;
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
- if (!bo)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- handle = tbm_bo_map (bo, TBM_DEVICE_2D, TBM_OPTION_READ|TBM_OPTION_WRITE);
- if (handle.ptr == NULL)
- {
- error = tbm_get_last_error ();
- ...
- }
-
- ...
-
- tbm_bo_unmap (bo);
- tbm_bo_unref (bo);
- tbm_bufmgr_deinit (bufmgr);
- @endcode
- */
-tbm_error_e tbm_get_last_error(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _TBM_ERROR_H_ */
\ No newline at end of file
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2018 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_LOG_H_
-#define _TBM_LOG_H_
-
-#include <unistd.h>
-#include <sys/syscall.h>
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file tbm_log.h
- * @brief The header file to print logs in frontend and backend modules
- * @details
- */
-
-enum {
- TBM_LOG_LEVEL_NONE,
- TBM_LOG_LEVEL_ERR,
- TBM_LOG_LEVEL_WRN,
- TBM_LOG_LEVEL_INFO,
- TBM_LOG_LEVEL_DBG,
-};
-
-void tbm_log_enable_color(unsigned int enable);
-void tbm_log_enable_dlog(unsigned int enable);
-void tbm_log_set_debug_level(int level);
-void tbm_log_set_assert_level(int level);
-void tbm_log_set_path(const char *path);
-void tbm_log_print(int level, const char *fmt, ...);
-void tbm_log_print_stdout(int level, const char *fmt, ...);
-
-#define TBM_DBG(fmt, args...) \
- do { \
- struct timespec ts; \
- clock_gettime(CLOCK_MONOTONIC, &ts); \
- tbm_log_print(TBM_LOG_LEVEL_DBG, "[%5d.%06d][%d][%s %d]"fmt, \
- (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
- (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
- } while (0)
-#define TBM_INFO(fmt, args...) \
- do { \
- struct timespec ts; \
- clock_gettime(CLOCK_MONOTONIC, &ts); \
- tbm_log_print(TBM_LOG_LEVEL_INFO, "[%5d.%06d][%d][%s %d]"fmt, \
- (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
- (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
- } while (0)
-#define TBM_WRN(fmt, args...) \
- do { \
- struct timespec ts; \
- clock_gettime(CLOCK_MONOTONIC, &ts); \
- tbm_log_print(TBM_LOG_LEVEL_WRN, "[%5d.%06d][%d][%s %d]"fmt, \
- (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
- (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
- } while (0)
-#define TBM_ERR(fmt, args...) \
- do { \
- struct timespec ts; \
- clock_gettime(CLOCK_MONOTONIC, &ts); \
- tbm_log_print(TBM_LOG_LEVEL_ERR, "[%5d.%06d][%d][%s %d]"fmt, \
- (int)ts.tv_sec, (int)ts.tv_nsec / 1000, \
- (int)syscall(SYS_gettid), __FUNCTION__, __LINE__, ##args); \
- } while (0)
-
-#define TBM_NEVER_GET_HERE() TBM_WRN("** NEVER GET HERE **")
-#define TBM_DEPRECATED(str) \
- do { \
- if (str) \
- TBM_WRN("** DEPRECATED: %s **", str); \
- else \
- TBM_WRN("** DEPRECATED **"); \
- } while(0)
-
-/* check condition */
-#define TBM_RETURN_IF_FAIL(cond) {\
- if (!(cond)) {\
- TBM_ERR("'%s' failed.\n", #cond);\
- return;\
- } \
-}
-#define TBM_RETURN_VAL_IF_FAIL(cond, val) {\
- if (!(cond)) {\
- TBM_ERR("'%s' failed.\n", #cond);\
- return val;\
- } \
-}
-#define TBM_GOTO_VAL_IF_FAIL(cond, val) {\
- if (!(cond)) {\
- TBM_ERR("'%s' failed.\n", #cond);\
- goto val;\
- } \
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _TBM_LOG_H_ */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_SURFACE_H_
-#define _TBM_SURFACE_H_
-
-/**
- * @addtogroup CAPI_UI_TBM_SURFACE_MODULE
- * @{
- */
-
-#include <tbm_type.h>
-
-/**
- * \file tbm_surface.h
- * \brief TBM Surface
- */
-
-/**
- * @brief Enumeration for tbm_surface error type.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- TBM_SURFACE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- TBM_SURFACE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- TBM_SURFACE_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
-} tbm_surface_error_e;
-
-/**
- * @brief Definition for the max number of TBM surface plane.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_SURF_PLANE_MAX 4
-
-/* option to map the tbm_surface */
-/**
- * @brief Definition for the access option to read.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_SURF_OPTION_READ (1 << 0)
-/**
- * @brief Definition for the access option to write.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_SURF_OPTION_WRITE (1 << 1)
-
-/**
- * @brief Definition for the TBM plane struct.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef struct _tbm_surface_plane {
- unsigned char *ptr; /**< Plane pointer */
- uint32_t size; /**< Plane size */
- uint32_t offset; /**< Plane offset */
- uint32_t stride; /**< Plane stride */
-
- void *reserved1; /**< Reserved pointer1 */
- void *reserved2; /**< Reserved pointer2 */
- void *reserved3; /**< Reserved pointer3 */
-} tbm_surface_plane_s;
-
-/**
- * @brief Definition for the TBM surface information struct.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef struct _tbm_surface_info {
- uint32_t width; /**< TBM surface width */
- uint32_t height; /**< TBM surface height */
- tbm_format format; /**< TBM surface format*/
- uint32_t bpp; /**< TBM surface bbp */
- uint32_t size; /**< TBM surface size */
-
- uint32_t num_planes; /**< The number of planes */
- tbm_surface_plane_s planes[TBM_SURF_PLANE_MAX]; /**< Array of planes */
-
- void *reserved4; /**< Reserved pointer4 */
- void *reserved5; /**< Reserved pointer5 */
- void *reserved6; /**< Reserved pointer6 */
-} tbm_surface_info_s;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Queries surface format list and number of format supported by the system.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @remarks You must release the formats using free().
- *
- * @param[out] formats The format array which the system can support \n
- * This pointer has to be freed by user.
- * @param[out] num The number of formats
- *
- * @return #TBM_SURFACE_ERROR_NONE if this function succeeds,
- * otherwise an error status value
- *
- * @retval #TBM_SURFACE_ERROR_NONE Success
- * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- uint32_t *formats;
- uint32_t format_num;
- int ret, i;
- tbm_surface_error_e tse;
-
- tse = tbm_surface_query_formats (&formats, &format_num))
-
- for( i = 0 ; i < format_num ; i++)
- {
- if (formats[i] == TBM_FORMAT_RGB332)
- {
- ....
-
- free (formats);
- @endcode
- */
-int tbm_surface_query_formats(uint32_t **formats, uint32_t *num);
-
-/**
- * @brief Creates the tbm_surface.
- * @details This function creates the tbm_surface with the given width, height, and format.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- *
- * @param[in] width The width of surface
- * @param[in] height The height of surface
- * @param[in] format The format of surface
- *
- * @return #tbm_surface_h on success,
- * otherwise @c NULL
- *
- * @retval #tbm_surface_h The TBM surface handle
- *
- * @exception #TBM_SURFACE_ERROR_NONE Success
- * @exception #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
- *
- * @see tbm_surface_destroy()
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- tbm_surface_h surface;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-tbm_surface_h tbm_surface_create(int width, int height, tbm_format format);
-
-/**
- * @brief Destroys the tbm_surface.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @param[in] surface The #tbm_surface_h
- *
- * @return #TBM_SURFACE_ERROR_NONE on success,
- * otherwise an error status value
- *
- * @retval #TBM_SURFACE_ERROR_NONE Success
- * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @see tbm_surface_create()
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- tbm_surface_h surface;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-int tbm_surface_destroy(tbm_surface_h surface);
-
-/**
- * @brief Maps the tbm_surface according to the access option.
- * @details After mapping tbm_surface, the information of tbm_surface is assigned in #tbm_surface_info_s struct. \n
- * The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
- * The information of planes has stride, offset, size and pointer of plane. \n
- * #TBM_SURF_OPTION_READ indicates access option to read. \n
- * #TBM_SURF_OPTION_WRITE indicates access option to write.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @param[in] surface The #tbm_surface_h
- * @param[in] opt The option to access the tbm_surface
- * @param[out] info The information of the tbm_surface
- *
- * @return #TBM_SURFACE_ERROR_NONE on success,
- * otherwise an error status value
- *
- * @retval #TBM_SURFACE_ERROR_NONE Success
- * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
- *
- * @see tbm_surface_unmap();
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- tbm_surface_h surface;
- tbm_surface_info_s info;
- int ret;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
- ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);
-
- ...
-
- tbm_surface_unmap (surface);
- tbm_surface_destroy (surface);
- @endcode
- */
-int tbm_surface_map(tbm_surface_h surface, int opt, tbm_surface_info_s *info);
-
-/**
- * @brief Unmaps the tbm_surface.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @param[in] surface The #tbm_surface_h
- *
- * @return #TBM_SURFACE_ERROR_NONE on success,
- * otherwise an error status value
- *
- * @retval #TBM_SURFACE_ERROR_NONE Success
- * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @see tbm_surface_map()
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- tbm_surface_h surface;
- tbm_surface_info_s info;
- int ret;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
- ret = tbm_surface_map (surface, TBM_SURF_OPTION_WRITE|TBM_SURF_OPTION_READ, &info);
-
- ...
-
- tbm_surface_unmap (surface);
- tbm_surface_destroy (surface);
- @endcode
- */
-int tbm_surface_unmap(tbm_surface_h surface);
-
-/**
- * @brief Gets the information of the tbm_surface.
- * @details The information of tbm_surface is assigned in #tbm_surface_info_s struct. \n
- * The information of tbm_surface has width, height, format, bpp, size, number of planes and information of planes. \n
- * The information of planes has stride, offset, size and pointer of plane.
- *
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @param[in] surface The #tbm_surface_h
- * @param[out] info The information of the tbm_surface
- *
- * @return #TBM_SURFACE_ERROR_NONE on success,
- * otherwise an error status value
- *
- * @retval #TBM_SURFACE_ERROR_NONE Success
- * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #TBM_SURFACE_ERROR_INVALID_OPERATION Invalid operation
- *
- * @see tbm_surface_map()
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- tbm_surface_h surface;
- tbm_surface_info_s info;
- int ret;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
- ret = tbm_surface_get_info (surface, &info);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-int tbm_surface_get_info(tbm_surface_h surface, tbm_surface_info_s *info);
-
-/**
- * @brief Gets the width of the tbm_surface.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @param[in] surface The #tbm_surface_h
- *
- * @return The width of the tbm_surface on success,
- * otherwise an error status value
- *
- * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- tbm_surface_h surface;
- int width;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
-
- ...
-
- width = tbm_surface_get_width (surface);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-int tbm_surface_get_width(tbm_surface_h surface);
-
-/**
- * @brief Gets the height of the tbm_surface.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @param[in] surface The #tbm_surface_h
- *
- * @return The height of the tbm_surface if this function succeeds,
- * otherwise an error status value
- *
- * @retval #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- tbm_surface_h surface;
- int height;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
-
- ...
-
- height = tbm_surface_get_height (surface);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-int tbm_surface_get_height(tbm_surface_h surface);
-
-/**
- * @brief Gets the format of the tbm_surface.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- *
- * @remark The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- *
- * @param[in] surface The #tbm_surface_h
- *
- * @return The format of the tbm_surface on success,
- * otherwise @c 0 on failure
- *
- * @retval #tbm_format The format of surface
- *
- * @exception #TBM_SURFACE_ERROR_NONE Success
- * @exception #TBM_SURFACE_ERROR_INVALID_PARAMETER Invalid parameter
- *
- * @par Example
- @code
- #include <tbm_surface.h>
-
- tbm_surface_s surface;
- tbm_format format;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_RGB332);
-
- ...
-
- format = tbm_surface_get_format (surface);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-tbm_format tbm_surface_get_format(tbm_surface_h surface);
-
-#ifdef __cplusplus
-}
-#endif
-/**
-* @}
-*/
-#endif /* _TBM_SURFACE_H_ */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_SURFACE_INTERNAL_H_
-#define _TBM_SURFACE_INTERNAL_H_
-
-#include <tbm_bufmgr.h>
-#include <tbm_error.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Queries formats which the system can support.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @remarks The formats must be released using free().
- * @param[in] bufmgr : the buffer manager
- * @param[out] *formats : format array which the system can support. This pointer has to be freed by user.
- * @param[out] num : the number of formats.
- * @return a tbm_surface_h if this function succeeds, otherwise NULL
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- tbm_bufmgr bufmgr;
- uint32_t *formats;
- uint32_t format_num;
-
- bufmgr = tbm_bufmgr_create (-1);
- ret = tbm_surface_internal_query_surpported_foramts (bufmgr, &formats, &format_num);
-
- ...
-
- free (foramts);
- tbm_surface_bufmgr_deinit (bufmgr);
- @endcode
- */
-int tbm_surface_internal_query_supported_formats(uint32_t **formats,
- uint32_t *num);
-
-/**
- * @brief Creates the tbm_surface with memory type.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @details
- * #TBM_BO_DEFAULT is default memory: it depends on the backend\n
- * #TBM_BO_SCANOUT is scanout memory\n
- * #TBM_BO_NONCACHABLE is non-cachable memory\n
- * #TBM_BO_WC is write-combine memory\n
- * #TBM_BO_VENDOR vendor specific memory: it depends on the tbm backend\n
- * @param[in] bufmgr : the buffer manager
- * @param[in] width : the width of surface
- * @param[in] height : the height of surface
- * @param[in] format : the format of surface
- * @param[in] flags : the flags of memory type
- * @return a tbm_surface_h if this function succeeds, otherwise NULL
- * @retval #tbm_surface_h
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- int bufmgr_fd
- tbm_bufmgr bufmgr;
- tbm_surface_h surface;
- uint32_t *format;
- uint32_t format_num;
-
- bufmgr = tbm_bufmgr_create (bufmgr_fd);
- surface = tbm_surface_internal_create_with_flags (128, 128, TBM_FORMAT_YUV420, TBM_BO_DEFAULT);
-
- ...
-
- tbm_surface_destroy (surface);
- tbm_surface_bufmgr_deinit (bufmgr);
- @endcode
- */
-tbm_surface_h tbm_surface_internal_create_with_flags(int width, int height,
- int format, int flags);
-
-/**
- * @brief Creates the tbm_surface with buffer objects.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] bufmgr : the buffer manager
- * @param[in] width : the width of surface
- * @param[in] height : the height of surface
- * @param[in] format : the format of surface
- * @param[in] *bos : the array pointer of buffer objects
- * @param[in] num : the number of buffer objects
- * @return a tbm_surface_h if this function succeeds, otherwise NULL
- * @retval #tbm_surface_h
- * @par Example
- @code
- #include <tbm_bufmgr.h>
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- int bufmgr_fd
- tbm_bufmgr bufmgr;
- tbm_surface_h surface;
- tbm_surface_info_s info;
- uint32_t *format;
- uint32_t format_num;
- tbm_bo bo[1];
-
- bufmgr = tbm_bufmgr_init (bufmgr_fd);
- bo[0] = tbm_bo_alloc (bufmgr, 128 * 128, TBM_BO_DEFAULT);
-
- info.width = 128;
- info.height = 128;
- info.format = TBM_FORMAT_ARGB8888;
- info.bpp = 32;
- info.size = 65536;
- info.num_planes = 1;
- info.planes[0].size = 65536;
- info.planes[0].offset = 0;
- info.planes[0].stride = 512;
-
- surface = tbm_surface_internal_create_with_bos (&info, bo, 1);
-
- ...
-
- tbm_surface_destroy (surface);
- tbm_surface_bufmgr_deinit (bufmgr);
- @endcode
- */
-tbm_surface_h tbm_surface_internal_create_with_bos(tbm_surface_info_s *info,
- tbm_bo *bos, int num);
-
-/**
- * @brief Destroy the tbm surface
- TODO:
- */
-void tbm_surface_internal_destroy(tbm_surface_h surface);
-
-/**
- * @brief reference the tbm surface
- TODO:
- */
-void tbm_surface_internal_ref(tbm_surface_h surface);
-
-/**
- * @brief unreference the tbm surface
- TODO:
- */
-void tbm_surface_internal_unref(tbm_surface_h surface);
-
-/**
- * @brief Gets the number of buffer objects associated with the tbm_surface.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] surface : the tbm_surface_h
- * @return the number of buffer objects associated with the tbm_surface_h, otherwise 0.
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- tbm_surface_h surface;
- int num_bos;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
- num_bos = tbm_surface_internal_get_num_bos (surface);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-int tbm_surface_internal_get_num_bos(tbm_surface_h surface);
-
-/**
- * @brief Gets the buffor object by the bo_index.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] surface : the tbm_surface_h
- * @param[in] bo_idx : the bo index in the the tbm_surface
- * @return the buffer object, otherwise NULL.
- * @retval #tbm_bo
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- tbm_surface_h surface;
- int num_bos;
- tbm_bo bo;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
- num_bos = tbm_surface_internal_get_num_bos (surface);
-
- for (i=0 ; i < num_bos ; i++)
- {
- bo = tbm_surface_internal_get_bo (surface, i);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-tbm_bo tbm_surface_internal_get_bo(tbm_surface_h surface, int bo_idx);
-
-/**
- * @brief Gets the size of the surface.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] surface : the tbm_surface_h
- * @return the size of tbm_surface, otherwise 0.
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- tbm_surface_h surface;
- int size;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
- size = tbm_surface_internal_get_size (surface);
-
- tbm_surface_destroy (surface);
- @endcode
- */
-unsigned int tbm_surface_internal_get_size(tbm_surface_h surface);
-
-/**
- * @brief Gets size, offset and pitch data of plane by the plane_index.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] surface : the tbm_surface_h
- * @param[in] plane_idx : the bo index in the the tbm_surface
- * @param[out] size : the size of plane in tbm_surface
- * @param[out] offset : the offset of plane in tbm_surface
- * @param[out] pitch : the pitch of plane in tbm_surface
- * @return 1 if this function succeeds, otherwise 0.
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- tbm_surface_h surface;
- uint32_t size, offset, pitch;
- int ret;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
- ret = tbm_surface_internal_get_plane_data (surface, 1, &size, &offset, &pitch);
-
- ...
-
- tbm_surface_destroy (surface);
- @endcode
- */
-int tbm_surface_internal_get_plane_data(tbm_surface_h surface, int plane_idx,
- uint32_t *size, uint32_t *offset, uint32_t *pitch);
-
-/**
- * @brief Gets number of planes by the format.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] format : the format of surface
- * @return number of planes by the format, otherwise 0.
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- int num;
-
- num = tbm_surface_internal_get_num_planes (TBM_FORMAT_YUV420);
-
- ...
-
- @endcode
- */
-int tbm_surface_internal_get_num_planes(tbm_format format);
-
-/**
- * @brief Gets bpp by the format.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @param[in] format : the format of surface
- * @return bpp by the format, otherwise 0.
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- int bpp;
-
- bpp = tbm_surface_internal_get_bpp (TBM_FORMAT_YUV420);
-
- ...
-
- @endcode
- */
-int tbm_surface_internal_get_bpp(tbm_format format);
-
-/**
- * @brief Gets bo index of plane.
- * @since_tizen 2.4
- * @param[in] surface : the tbm_surface_h
- * @param[in] plane_idx : the bo index in the tbm_surface
- * @return bo index of plane, otherwise 0.
- * @par Example
- @code
- #include <tbm_surface.h>
- #include <tbm_surface_internal.h>
-
- int bo_idx;
- tbm_surface_h surface;
-
- surface = tbm_surface_create (128, 128, TBM_FORMAT_YUV420);
- bo_idx = tbm_surface_internal_get_plane_bo_idx (surface, 0);
-
- ...
-
- @endcode
- */
-int tbm_surface_internal_get_plane_bo_idx(tbm_surface_h surface, int plane_idx);
-
-/**
- * @brief Set the pid to the tbm_surface for debugging.
- * @since_tizen 3.0
- * @param[in] surface : the tbm_surface_h
- * @param[in] pid : the pid
- */
-void tbm_surface_internal_set_debug_pid(tbm_surface_h surface,
- unsigned int pid);
-
-/**
- * @brief Set the string value to the tbm_surface for debugging.
- * @since_tizen 3.0
- * @param[in] surface : the tbm_surface_h
- * @param[in] key : the key for debugging
- * @param[in] value : the value for debugging
- */
-int tbm_surface_internal_set_debug_data(tbm_surface_h surface,
- char *key, char *value);
-
-/**
- * @brief Adds a user_data to the tbm surface.
- * @since_tizen 3.0
- * @param[in] surface : the tbm surface.
- * @param[in] key : the key associated with the user_data
- * @param[in] data_free_func : the function pointer to free the user_data
- * @return 1 if this function succeeds, otherwise 0.
- * @post the tbm_surface_data_free() will be called under certain conditions, after calling tbm_surface_internal_delete_user_data().
- * @see tbm_surface_free()
- * @see tbm_surface_set_user_data()
- * @see tbm_surface_get_user_data()
- * @see tbm_surface_delete_user_data()
- */
-int tbm_surface_internal_add_user_data(tbm_surface_h surface, unsigned long key,
- tbm_data_free data_free_func);
-
-/**
- * @brief Sets a user_date to the tbm surface.
- * @since_tizen 3.0
- * @param[in] surface : the tbm surface.
- * @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.
- */
-int tbm_surface_internal_set_user_data(tbm_surface_h surface, unsigned long key,
- void *data);
-
-/**
- * @brief Gets a user_data from the tbm surface with the key.
- * @since_tizen 3.0
- * @param[in] surface : the tbm surface.
- * @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.
- */
-int tbm_surface_internal_get_user_data(tbm_surface_h surface, unsigned long key,
- void **data);
-
-/**
- * @brief Deletes the user_data in the tbm surface.
- * @since_tizen 3.0
- * @param[in] surface : the tbm surface.
- * @param[in] key : the key associated with the user_date
- * @return 1 if this function succeeds, otherwise 0.
- */
-int tbm_surface_internal_delete_user_data(tbm_surface_h surface,
- unsigned long key);
-
-/**
- * @brief Start the dump debugging.
- * @since_tizen 3.0
- * @param[in] path : the given dump path
- * @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 w, int h, int count);
-
-/**
- * @brief Start the dump with scale debugging.
- * @details
- * Dump with scale supports only if a buffer has below formats.
- * - TBM_FORMAT_ARGB8888
- * - TBM_FORMAT_XRGB8888
- * @since_tizen 4.0
- * @param[in] path : the given dump path
- * @param[in] w : the width of dump image
- * @param[in] h : the height of dump image
- * @param[in] count : the dump count number
- * @param[in] scale : the scale factor
- * @see #tdm_helper_dump_stop()
- */
-void tbm_surface_internal_dump_with_scale_start(char *path, int w, int h,
- int count, double scale);
-
-/**
- * @brief End the dump debugging.
- * @since_tizen 3.0
- * @see #tdm_helper_dump_start()
- */
-void tbm_surface_internal_dump_end(void);
-
-/**
- * @brief Dump a buffer
- * @details
- * This function supports only if a buffer has below formats.
- * - TBM_FORMAT_ARGB8888
- * - TBM_FORMAT_XRGB8888
- * - TBM_FORMAT_YVU420
- * - TBM_FORMAT_YUV420
- * - TBM_FORMAT_NV12
- * - TBM_FORMAT_NV21
- * - TBM_FORMAT_YUYV
- * - TBM_FORMAT_UYVY
- * The filename extension should be "png" for TBM_FORMAT_ARGB8888 and TBM_FORMAT_XRGB8888
- * or "yuv" for YUV formats.
- * @param[in] surface : a tbm surface
- * @param[in] name : a string used by a file name
- */
-void tbm_surface_internal_dump_buffer(tbm_surface_h surface, const char *name);
-
-/**
- * @brief Dump a shared memory buffer
- * @details
- * This function supports shared memory buffer dump.
- * @param[in] ptr : a pointer of dump buffer
- * @param[in] w : a width of dump buffer
- * @param[in] h : a height of dump buffer
- * @param[in] stride : a stride of dump buffer
- * @param[in] name : a string used by a file name
- */
-void tbm_surface_internal_dump_shm_buffer(void *ptr, int w, int h, int stride, const char *name);
-
-/**
- * @brief check valid tbm surface.
- * @since_tizen 3.0
- * @param[in] surface : the tbm surface.
- * @return 1 if surface is valid, otherwise 0.
- */
-int tbm_surface_internal_is_valid(tbm_surface_h surface);
-
-/**
- * @brief Capture a buffer
- * @details
- * This function supports only if a buffer has below formats.
- * - TBM_FORMAT_ARGB8888
- * - TBM_FORMAT_XRGB8888
- * - TBM_FORMAT_YVU420
- * - TBM_FORMAT_YUV420
- * - TBM_FORMAT_NV12
- * - TBM_FORMAT_NV21
- * - TBM_FORMAT_YUYV
- * - TBM_FORMAT_UYVY
- * The type should be "png" for TBM_FORMAT_ARGB8888 and TBM_FORMAT_XRGB8888
- * or "yuv" for YUV formats.
- * @param[in] surface : a tbm surface
- * @param[in] path : the given dump path
- * @param[in] name : a string used by a file name
- * @param[in] type : a string used by a file type ex)png, yuv
- * @return 1 if success, otherwise 0.
- */
-int tbm_surface_internal_capture_buffer(tbm_surface_h surface, const char *path,
- const char *name, const char *type);
-
-/**
- * @brief Capture a shared memory buffer
- * @details
- * This function supports shared memory buffer dump.
- * The type should be "png".
- * @param[in] ptr : a pointer of dump buffer
- * @param[in] w : a width of dump buffer
- * @param[in] h : a height of dump buffer
- * @param[in] stride : a stride of dump buffer
- * @param[in] path : the given dump path
- * @param[in] name : a string used by a file name
- * @param[in] type : a string used by a file type ex)png, yuv
- * @return 1 if success, otherwise 0.
- */
-int tbm_surface_internal_capture_shm_buffer(void *ptr, int w, int h, int stride,
- const char *path, const char *name, const char *type);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _TBM_SURFACE_INTERNAL_H_ */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_SURFACE_QUEUE_H_
-#define _TBM_SURFACE_QUEUE_H_
-
-#include <tbm_surface.h>
-#include <tbm_type_common.h>
-#include <tbm_error.h>
-
-typedef enum {
- TBM_SURFACE_QUEUE_TRACE_NONE = 0, /**< Successful */
- TBM_SURFACE_QUEUE_TRACE_DEQUEUE = 1,
- TBM_SURFACE_QUEUE_TRACE_ENQUEUE = 2,
- TBM_SURFACE_QUEUE_TRACE_ACQUIRE = 3,
- TBM_SURFACE_QUEUE_TRACE_RELEASE = 4,
- TBM_SURFACE_QUEUE_TRACE_CANCEL_DEQUEUE = 5,
- TBM_SURFACE_QUEUE_TRACE_CANCEL_ACQUIRE = 6,
-} tbm_surface_queue_trace;
-
-typedef enum {
- TBM_SURFACE_QUEUE_MODE_NONE = 0,
- /**
- * GUARANTEE_CYCLE mode must do enqueue/aquire/release or cancel_dequeue
- * for the tbm_surface which is dequeued before tbm_surface_queue is reset.
- */
- TBM_SURFACE_QUEUE_MODE_GUARANTEE_CYCLE = (1 << 0),
-} tbm_surface_queue_mode;
-
-typedef struct _tbm_surface_queue *tbm_surface_queue_h;
-
-typedef void (*tbm_surface_queue_notify_cb)(tbm_surface_queue_h surface_queue,
- void *data);
-
-typedef tbm_surface_h(*tbm_surface_alloc_cb)(tbm_surface_queue_h surface_queue,
- void *data);
-
-typedef void (*tbm_surface_free_cb)(tbm_surface_queue_h surface_queue,
- void *data, tbm_surface_h surface);
-
-typedef void (*tbm_surface_queue_trace_cb)(tbm_surface_queue_h surface_queue,
- tbm_surface_h surface, tbm_surface_queue_trace trace, void *data);
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*The functions of queue factory*/
-tbm_surface_queue_h tbm_surface_queue_create(int queue_size, int width,
- int height, int format, int flags);
-
-tbm_surface_queue_h tbm_surface_queue_sequence_create(int queue_size, int width,
- int height, int format, int flags);
-
-void tbm_surface_queue_destroy(tbm_surface_queue_h surface_queue);
-
-tbm_surface_queue_error_e tbm_surface_queue_set_alloc_cb(
- tbm_surface_queue_h surface_queue,
- tbm_surface_alloc_cb alloc_cb,
- tbm_surface_free_cb free_cb,
- void *data);
-
-int tbm_surface_queue_get_width(tbm_surface_queue_h surface_queue);
-
-int tbm_surface_queue_get_height(tbm_surface_queue_h surface_queue);
-
-int tbm_surface_queue_get_format(tbm_surface_queue_h surface_queue);
-
-int tbm_surface_queue_get_size(tbm_surface_queue_h surface_queue);
-
-tbm_surface_queue_error_e tbm_surface_queue_get_surfaces(
- tbm_surface_queue_h surface_queue,
- tbm_surface_h *surfaces, int *num);
-
-tbm_surface_queue_error_e tbm_surface_queue_get_trace_surface_num(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_trace trace, int *num);
-
-tbm_surface_queue_error_e tbm_surface_queue_set_size(
- tbm_surface_queue_h surface_queue, int queue_size, int flush);
-
-tbm_surface_queue_error_e tbm_surface_queue_set_modes(
- tbm_surface_queue_h surface_queue, int modes);
-
-tbm_surface_queue_error_e tbm_surface_queue_set_sync_count(
- tbm_surface_queue_h surface_queue, unsigned int sync_count);
-
-int tbm_surface_queue_can_dequeue(tbm_surface_queue_h surface_queue, int wait);
-
-int tbm_surface_queue_can_acquire(tbm_surface_queue_h surface_queue, int wait);
-
-tbm_surface_queue_error_e tbm_surface_queue_dequeue(
- tbm_surface_queue_h surface_queue, tbm_surface_h *surface);
-
-tbm_surface_queue_error_e tbm_surface_queue_enqueue(
- tbm_surface_queue_h surface_queue, tbm_surface_h surface);
-
-tbm_surface_queue_error_e tbm_surface_queue_acquire(
- tbm_surface_queue_h surface_queue, tbm_surface_h *surface);
-
-tbm_surface_queue_error_e tbm_surface_queue_release(
- tbm_surface_queue_h surface_queue, tbm_surface_h surface);
-
-tbm_surface_queue_error_e tbm_surface_queue_cancel_dequeue(
- tbm_surface_queue_h surface_queue, tbm_surface_h surface);
-
-tbm_surface_queue_error_e tbm_surface_queue_cancel_acquire(
- tbm_surface_queue_h surface_queue, tbm_surface_h surface);
-
-tbm_surface_queue_error_e tbm_surface_queue_reset(
- tbm_surface_queue_h surface_queue, int width, int height, int format);
-
-tbm_surface_queue_error_e tbm_surface_queue_flush(tbm_surface_queue_h surface_queue);
-
-tbm_surface_queue_error_e tbm_surface_queue_free_flush(tbm_surface_queue_h surface_queue);
-
-tbm_surface_queue_error_e tbm_surface_queue_notify_reset(tbm_surface_queue_h surface_queue);
-
-tbm_surface_queue_error_e tbm_surface_queue_notify_dequeuable(tbm_surface_queue_h surface_queue);
-
-tbm_surface_queue_error_e tbm_surface_queue_add_destroy_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_remove_destroy_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb destroy_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_add_reset_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_remove_reset_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb reset_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_add_dequeuable_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_remove_dequeuable_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeuable_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_add_dequeue_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeue_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_remove_dequeue_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb dequeue_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_add_can_dequeue_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb can_dequeue_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_remove_can_dequeue_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb can_dequeue_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_add_acquirable_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_remove_acquirable_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_notify_cb acquirable_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_add_trace_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_trace_cb trace_cb,
- void *data);
-
-tbm_surface_queue_error_e tbm_surface_queue_remove_trace_cb(
- tbm_surface_queue_h surface_queue, tbm_surface_queue_trace_cb trace_cb,
- void *data);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _TBM_SURFACE_H_ */
+++ /dev/null
-#ifndef _TBM_SYNC_H_
-#define _TBM_SYNC_H_
-
-#include <tbm_bufmgr.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @brief Create timeline object.
- * @return file descriptor for the created timeline on success, -1 otherwise
- * @remarks close the fd when you no longer need it
- */
-tbm_fd tbm_sync_timeline_create(void);
-
-/**
- * @brief Increase the current value of the timeline.
- * @param[in] timeline timeline object
- * @param[in] count amount of increment
- * @return 1 on success, 0 otherwise
- */
-int tbm_sync_timeline_inc(tbm_fd timeline, unsigned int count);
-
-/**
- * @brief Create fence object.
- * @param[in] timeline timeline object on which the fence is created
- * @param[in] name fence name (only first 31 characters will be used)
- * @param[in] value timeline point value for the fence
- * @return file descriptor for the created fence on success, -1 otherwise
- * @remarks close the fd when you no longer need it
- */
-tbm_fd tbm_sync_fence_create(tbm_fd timeline, const char *name, unsigned int value);
-
-/**
- * @brief Wait for the given fence to be signaled
- * @param[in] fence fence object
- * @param[in] timeout timeout in milliseconds
- * @return 1 on success, 0 on failure, -1 on timeout expire
- * @remarks negative timeout means infinite, timeout 0 returns immediately
- */
-int tbm_sync_fence_wait(tbm_fd fence, int timeout);
-
-/**
- * @brief Merge two fences into one
- * @param[in] name name of the new fence
- * @param[in] fence1 fence to be merged
- * @param[in] fence2 fence to be merged
- * @return file descriptor for the new fence on success, -1 otherwise
- * @remarks close the fd when you no longer need it
- */
-tbm_fd tbm_sync_fence_merge(const char *name, tbm_fd fence1, tbm_fd fence2);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _TBM_SYNC_H */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_TYPE_H_
-#define _TBM_TYPE_H_
-
-/**
- * @addtogroup CAPI_UI_TBM_SURFACE_MODULE
- * @{
- */
-
-#include <stdint.h>
-#include <tizen.h>
-
-/**
- * @brief Definition for the Tizen buffer surface.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef struct _tbm_surface *tbm_surface_h;
-/**
- * @brief Definition for the Tizen buffer surface format.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef uint32_t tbm_format;
-
-#define __tbm_fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
- ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
-
-/* color index */
-/**
- * @brief Definition for the TBM surface format C8 ([7:0] C).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_C8 __tbm_fourcc_code('C', '8', ' ', ' ')
-
-/* 8 bpp RGB */
-/**
- * @brief Definition for the TBM surface format RGB322 ([7:0] R:G:B 3:3:2).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGB332 __tbm_fourcc_code('R', 'G', 'B', '8')
-/**
- * @brief Definition for the TBM surface format RGB233 ([7:0] B:G:R 2:3:3).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGR233 __tbm_fourcc_code('B', 'G', 'R', '8')
-
-/* 16 bpp RGB */
-/**
- * @brief Definition for the TBM surface format XRGB4444 ([15:0] x:R:G:B 4:4:4:4 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_XRGB4444 __tbm_fourcc_code('X', 'R', '1', '2')
-/**
- * @brief Definition for the TBM surface format XBRG4444 ([15:0] x:B:G:R 4:4:4:4 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_XBGR4444 __tbm_fourcc_code('X', 'B', '1', '2')
-/**
- * @brief Definition for the TBM surface format RGBX4444 ([15:0] R:G:B:x 4:4:4:4 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGBX4444 __tbm_fourcc_code('R', 'X', '1', '2')
-/**
- * @brief Definition for the TBM surface format BGRX4444 ([15:0] B:G:R:x 4:4:4:4 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGRX4444 __tbm_fourcc_code('B', 'X', '1', '2')
-
-/**
- * @brief Definition for the TBM surface format ARGB4444 ([15:0] A:R:G:B 4:4:4:4 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_ARGB4444 __tbm_fourcc_code('A', 'R', '1', '2')
-/**
- * @brief Definition for the TBM surface format ABGR4444 ([15:0] A:B:G:R 4:4:4:4 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_ABGR4444 __tbm_fourcc_code('A', 'B', '1', '2')
-/**
- * @brief Definition for the TBM surface format RGBA4444 ([15:0] R:G:B:A 4:4:4:4 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGBA4444 __tbm_fourcc_code('R', 'A', '1', '2')
-/**
- * @brief Definition for the TBM surface format BGRA4444 ([15:0] B:G:R:A 4:4:4:4 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGRA4444 __tbm_fourcc_code('B', 'A', '1', '2')
-
-/**
- * @brief Definition for the TBM surface format XRGB1555 ([15:0] x:R:G:B 1:5:5:5 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_XRGB1555 __tbm_fourcc_code('X', 'R', '1', '5')
-/**
- * @brief Definition for the TBM surface format XBGR1555 ([15:0] x:B:G:R 1:5:5:5 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_XBGR1555 __tbm_fourcc_code('X', 'B', '1', '5')
-/**
- * @brief Definition for the TBM surface format RGBX5551 ([15:0] R:G:B:x 5:5:5:1 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGBX5551 __tbm_fourcc_code('R', 'X', '1', '5')
-/**
- * @brief Definition for the TBM surface format BGRX5551 ([15:0] B:G:R:x 5:5:5:1 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGRX5551 __tbm_fourcc_code('B', 'X', '1', '5')
-
-/**
- * @brief Definition for the TBM surface format ARGB1555 ([15:0] A:R:G:B 1:5:5:5 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_ARGB1555 __tbm_fourcc_code('A', 'R', '1', '5')
-/**
- * @brief Definition for the TBM surface format ABGR1555 ([15:0] A:B:G:R 1:5:5:5 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_ABGR1555 __tbm_fourcc_code('A', 'B', '1', '5')
-/**
- * @brief Definition for the TBM surface format RGBA5551 ([15:0] R:G:B:A 5:5:5:1 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGBA5551 __tbm_fourcc_code('R', 'A', '1', '5')
-/**
- * @brief Definition for the TBM surface format BGRA5551 ([15:0] B:G:R:A 5:5:5:1 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGRA5551 __tbm_fourcc_code('B', 'A', '1', '5')
-
-/**
- * @brief Definition for the TBM surface format RGB565 ([15:0] R:G:B 5:6:5 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGB565 __tbm_fourcc_code('R', 'G', '1', '6')
-/**
- * @brief Definition for the TBM surface format BGR565 ([15:0] B:G:R 5:6:5 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGR565 __tbm_fourcc_code('B', 'G', '1', '6')
-
-/* 24 bpp RGB */
-/**
- * @brief Definition for the TBM surface format RGB888 ([23:0] R:G:B little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGB888 __tbm_fourcc_code('R', 'G', '2', '4')
-/**
- * @brief Definition for the TBM surface format BGR888 ([23:0] B:G:R little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGR888 __tbm_fourcc_code('B', 'G', '2', '4')
-
-/* 32 bpp RGB */
-/**
- * @brief Definition for the TBM surface format XRGB8888 ([31:0] x:R:G:B 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_XRGB8888 __tbm_fourcc_code('X', 'R', '2', '4')
-/**
- * @brief Definition for the TBM surface format XBGR8888 ([31:0] x:B:G:R 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_XBGR8888 __tbm_fourcc_code('X', 'B', '2', '4')
-/**
- * @brief Definition for the TBM surface format RGBX8888 ([31:0] R:G:B:x 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4')
-/**
- * @brief Definition for the TBM surface format BGRX8888 ([31:0] B:G:R:x 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGRX8888 __tbm_fourcc_code('B', 'X', '2', '4')
-
-/**
- * @brief Definition for the TBM surface format ARGB8888 ([31:0] A:R:G:B 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_ARGB8888 __tbm_fourcc_code('A', 'R', '2', '4')
-/**
- * @brief Definition for the TBM surface format ABGR8888 ([31:0] [31:0] A:B:G:R 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_ABGR8888 __tbm_fourcc_code('A', 'B', '2', '4')
-/**
- * @brief Definition for the TBM surface format RGBA8888 ([31:0] R:G:B:A 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4')
-/**
- * @brief Definition for the TBM surface format BGRA8888 ([31:0] B:G:R:A 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4')
-
-/**
- * @brief Definition for the TBM surface format XRGB2101010 ([31:0] x:R:G:B 2:10:10:10 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_XRGB2101010 __tbm_fourcc_code('X', 'R', '3', '0')
-/**
- * @brief Definition for the TBM surface format XBGR2101010 ([31:0] x:B:G:R 2:10:10:10 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_XBGR2101010 __tbm_fourcc_code('X', 'B', '3', '0')
-/**
- * @brief Definition for the TBM surface format RGBX1010102 ([31:0] R:G:B:x 10:10:10:2 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGBX1010102 __tbm_fourcc_code('R', 'X', '3', '0')
-/**
- * @brief Definition for the TBM surface format BGRX1010102 ([31:0] B:G:R:x 10:10:10:2 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGRX1010102 __tbm_fourcc_code('B', 'X', '3', '0')
-
-/**
- * @brief Definition for the TBM surface format ARGB2101010 ([31:0] A:R:G:B 2:10:10:10 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_ARGB2101010 __tbm_fourcc_code('A', 'R', '3', '0')
-/**
- * @brief Definition for the TBM surface format ABGR2101010 ([31:0] A:B:G:R 2:10:10:10 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_ABGR2101010 __tbm_fourcc_code('A', 'B', '3', '0')
-/**
- * @brief Definition for the TBM surface format RGBA1010102 ([31:0] R:G:B:A 10:10:10:2 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_RGBA1010102 __tbm_fourcc_code('R', 'A', '3', '0')
-/**
- * @brief Definition for the TBM surface format BGRA1010102 ([31:0] B:G:R:A 10:10:10:2 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_BGRA1010102 __tbm_fourcc_code('B', 'A', '3', '0') /* */
-
-/* packed YCbCr */
-/**
- * @brief Definition for the TBM surface format YUYV ([31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YUYV __tbm_fourcc_code('Y', 'U', 'Y', 'V')
-/**
- * @brief Definition for the TBM surface format YVYU ([31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YVYU __tbm_fourcc_code('Y', 'V', 'Y', 'U') /* */
-/**
- * @brief Definition for the TBM surface format UYVY ([31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_UYVY __tbm_fourcc_code('U', 'Y', 'V', 'Y')
-/**
- * @brief Definition for the TBM surface format VYUY ([31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_VYUY __tbm_fourcc_code('V', 'Y', 'U', 'Y')
-
-/**
- * @brief Definition for the TBM surface format AYUV ([31:0] A:Y:Cb:Cr 8:8:8:8 little endian).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_AYUV __tbm_fourcc_code('A', 'Y', 'U', 'V')
-
-/*
- * 2 plane YCbCr
- * index 0 = Y plane, [7:0] Y
- * index 1 = Cr:Cb plane, [15:0] Cr:Cb little endian
- * or
- * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian
- */
-/**
- * @brief Definition for the TBM surface format NV12 (2x2 subsampled Cr:Cb plane).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_NV12 __tbm_fourcc_code('N', 'V', '1', '2')
-/**
- * @brief Definition for the TBM surface format NV21 (2x2 subsampled Cb:Cr plane).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_NV21 __tbm_fourcc_code('N', 'V', '2', '1') /* */
-/**
- * @brief Definition for the TBM surface format NV16 (2x1 subsampled Cr:Cb plane).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_NV16 __tbm_fourcc_code('N', 'V', '1', '6')
-/**
- * @brief Definition for the TBM surface format NV61 (2x1 subsampled Cb:Cr plane).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_NV61 __tbm_fourcc_code('N', 'V', '6', '1')
-
-/*
- * 3 plane YCbCr
- * index 0: Y plane, [7:0] Y
- * index 1: Cb plane, [7:0] Cb
- * index 2: Cr plane, [7:0] Cr
- * or
- * index 1: Cr plane, [7:0] Cr
- * index 2: Cb plane, [7:0] Cb
- */
-/**
- * @brief Definition for the TBM surface format YUV410 (4x4 subsampled Cb (1) and Cr (2) planes).
- */
-#define TBM_FORMAT_YUV410 __tbm_fourcc_code('Y', 'U', 'V', '9')
-/**
- * @brief Definition for the TBM surface format YVU410 (4x4 subsampled Cr (1) and Cb (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YVU410 __tbm_fourcc_code('Y', 'V', 'U', '9')
-/**
- * @brief Definition for the TBM surface format YUV411 (4x1 subsampled Cb (1) and Cr (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YUV411 __tbm_fourcc_code('Y', 'U', '1', '1')
-/**
- * @brief Definition for the TBM surface format YVU411 (4x1 subsampled Cr (1) and Cb (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YVU411 __tbm_fourcc_code('Y', 'V', '1', '1')
-/**
- * @brief Definition for the TBM surface format YUV420 (2x2 subsampled Cb (1) and Cr (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YUV420 __tbm_fourcc_code('Y', 'U', '1', '2')
-/**
- * @brief Definition for the TBM surface format YVU420 (2x2 subsampled Cr (1) and Cb (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YVU420 __tbm_fourcc_code('Y', 'V', '1', '2')
-/**
- * @brief Definition for the TBM surface format YUV422 (2x1 subsampled Cb (1) and Cr (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YUV422 __tbm_fourcc_code('Y', 'U', '1', '6')
-/**
- * @brief Definition for the TBM surface format YVU422 (2x1 subsampled Cr (1) and Cb (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YVU422 __tbm_fourcc_code('Y', 'V', '1', '6')
-/**
- * @brief Definition for the TBM surface format YUV444 (non-subsampled Cb (1) and Cr (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YUV444 __tbm_fourcc_code('Y', 'U', '2', '4')
-/**
- * @brief Definition for the TBM surface format YVU444 (non-subsampled Cr (1) and Cb (2) planes).
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-#define TBM_FORMAT_YVU444 __tbm_fourcc_code('Y', 'V', '2', '4')
-
-/* 2 plane YCbCr */
-/**
- * @brief Definition for the TBM surface format NV12MT (tiled '64x32' & multi-plane version of NV12).
- * @since_tizen 3.0
- */
-#define TBM_FORMAT_NV12MT __tbm_fourcc_code('T', 'M', '1', '2')
-
-/**
-* @}
-*/
-
-#endif /* _TBM_TYPE_H_ */
+++ /dev/null
-/**************************************************************************
-
-libtbm
-
-Copyright 2012-2018 Samsung Electronics co., Ltd. All Rights Reserved.
-
-Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
-Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
-Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sub license, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial portions
-of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
-ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-**************************************************************************/
-
-#ifndef _TBM_TYPE_COMMON_H_
-#define _TBM_TYPE_COMMON_H_
-
-#include <tbm_type.h>
-
-/**
- * \file tbm_type_common.h
- * \brief Type definition used internally
- */
-
-/* tbm error base : this error base is same as TIZEN_ERROR_TBM in tizen_error.h */
-#ifndef TBM_ERROR_BASE
-#define TBM_ERROR_BASE -0x02830000
-#endif
-
-/**
- * @brief Definition for the tizen buffer manager
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef struct _tbm_bufmgr *tbm_bufmgr;
-
-/**
- * @brief Definition for the tizen buffer object
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef struct _tbm_bo *tbm_bo;
-
-/**
- * @brief Definition for the key associated with the buffer object
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-
-typedef uint32_t tbm_key;
-/**
- * @brief Definition for the file descripter of the system buffer manager
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef int32_t tbm_fd;
-
-/**
- * @brief Definition for native display (wl_display in tizen)
- * @since_tizen 5.0
- */
-typedef void tbm_native_display;
-
-
-/* TBM_DEVICE_TYPE */
-
-/**
- * @brief Enumeration for tbm error type.
- * @since_tizen 2.4
- */
-typedef enum {
- /* TBM_ERROR_XXX. start from (TBM_ERROR_BASE | 0x0001) to (TBM_ERROR_BASE | 0x0099) */
- TBM_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- TBM_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
- TBM_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter */
- TBM_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Function not implemented */
- TBM_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
-
- /* TBM_BO_ERROR_XXX. start from (TBM_ERROR_BASE | 0x0101) to (TBM_ERROR_BASE | 0x0199) */
- TBM_BO_ERROR_GET_FD_FAILED = TBM_ERROR_BASE | 0x0101, /**< failed to get fd in bo (DEPRECATED) */
- TBM_BO_ERROR_HEAP_ALLOC_FAILED = TBM_ERROR_OUT_OF_MEMORY, /**< failed to allocate the heap memory in bo (DEPRECATED) */
- TBM_BO_ERROR_LOAD_MODULE_FAILED = TBM_ERROR_BASE | 0x0103, /**< failed to load module (DEPRECATED) */
- TBM_BO_ERROR_THREAD_INIT_FAILED = TBM_ERROR_BASE | 0x0104, /**< failed to initialize the pthread (DEPRECATED) */
- TBM_BO_ERROR_BO_ALLOC_FAILED = TBM_ERROR_OUT_OF_MEMORY, /**< failed to allocate tbm_bo (DEPRECATED) */
- TBM_BO_ERROR_INIT_STATE_FAILED = TBM_ERROR_BASE | 0x0106, /**< failed to initialize the state of tbm_bo (DEPRECATED) */
- TBM_BO_ERROR_IMPORT_FAILED = TBM_ERROR_BASE | 0x0107, /**< failed to import the handle of tbm_bo (DEPRECATED) */
- TBM_BO_ERROR_IMPORT_FD_FAILED = TBM_ERROR_BASE | 0x0108, /**< failed to import fd of tbm_bo (DEPRECATED) */
- TBM_BO_ERROR_EXPORT_FAILED = TBM_ERROR_BASE | 0x0109, /**< failed to export the handle of the tbm_bo (DEPRECATED) */
- TBM_BO_ERROR_EXPORT_FD_FAILED = TBM_ERROR_BASE | 0x0110, /**< failed to export fd of tbm_bo (DEPRECATED) */
- TBM_BO_ERROR_GET_HANDLE_FAILED = TBM_ERROR_BASE | 0x0111, /**< failed to get the tbm_bo_handle (DEPRECATED) */
- TBM_BO_ERROR_LOCK_FAILED = TBM_ERROR_BASE | 0x0112, /**< failed to lock the tbm_bo (DEPRECATED) */
- TBM_BO_ERROR_MAP_FAILED = TBM_ERROR_BASE | 0x0113, /**< failed to map the tbm_bo to get the tbm_bo_handle (DEPRECATED) */
- TBM_BO_ERROR_UNMAP_FAILED = TBM_ERROR_BASE | 0x0114, /**< failed to unmap the tbm_bo (DEPRECATED) */
- TBM_BO_ERROR_SWAP_FAILED = TBM_ERROR_BASE | 0x0115, /**< failed to swap the tbm_bos (DEPRECATED) */
- TBM_BO_ERROR_DUP_FD_FAILED = TBM_ERROR_BASE | 0x0116, /**< failed to duplicate fd (DEPRECATED) */
-
- /* TBM_SURFACE_ERROR_XXX. start from (TBM_ERROR_BASE | 0x0201) to (TBM_ERROR_BASE | 0x0299)
- * TBM_SURFACE_ERROR_XXX is defined in tbm_surface.h file because it is CAPI.
- *
- * TBM_SURFACE_ERROR_NONE = TIZEN_ERROR_NONE, // Successful
- * TBM_SURFACE_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, // Invalid parameter
- * TBM_SURFACE_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, // Invalid Operation
- *
- */
-
- /* TBM_SURFACE_QUEUE_ERROR_XXX. start from (TBM_ERROR_BASE | 0x0301) to (TBM_ERROR_BASE | 0x0399) */
- TBM_SURFACE_QUEUE_ERROR_NONE = TBM_ERROR_NONE, /**< Successful */
- TBM_SURFACE_QUEUE_ERROR_EMPTY = TBM_ERROR_BASE | 0x0301, /**< Empty queue */
- TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE = TBM_ERROR_BASE | 0x0302, /**< Invalid queue */
- TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE = TBM_ERROR_BASE | 0x0303, /**< Invalid surface */
- TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED = TBM_ERROR_BASE | 0x0304, /**< Allocation of surface failed */
- TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST = TBM_ERROR_BASE | 0x0305, /**< Already existed surface */
- TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE = TBM_ERROR_BASE | 0x0306, /**< Unknown surface */
-} tbm_error_e;
-
-typedef tbm_error_e tbm_surface_queue_error_e;
-
-/**
- * @brief Enumeration of tbm buffer manager capability.
- * @since_tizen 2.4
- */
-enum TBM_BUFMGR_CAPABILITY {
- TBM_BUFMGR_CAPABILITY_NONE = 0, /**< Not Support capability*/
- TBM_BUFMGR_CAPABILITY_SHARE_KEY = (1 << 0), /**< Support sharing buffer by tbm key */
- TBM_BUFMGR_CAPABILITY_SHARE_FD = (1 << 1), /**< Support sharing buffer by tbm fd */
- TBM_BUFMGR_CAPABILITY_TBM_SYNC = (1 << 2), /**< Support tbm sync */
-};
-
-/**
- * @brief Definition for the device type to access tbm_bo
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- TBM_DEVICE_DEFAULT = 0, /**< the device type to get the default handle */
- TBM_DEVICE_CPU, /**< the device type to get the virtual memory */
- TBM_DEVICE_2D, /**< the device type to get the 2D memory handle */
- TBM_DEVICE_3D, /**< the device type to get the 3D memory handle */
- TBM_DEVICE_MM, /**< the device type to get the the multimedia handle */
-
-} tbm_bo_device_type;
-
-/**
- * @brief Definition for the optoin to access tbm_bo
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum {
- TBM_OPTION_NONE = (1 << 0), /**< the option is none */
- TBM_OPTION_READ = (1 << 0), /**< the option to access to read the bo */
- TBM_OPTION_WRITE = (1 << 1), /**< the option to access to write the bo */
- TBM_OPTION_VENDOR = (0xffff0000), /**< the the vendor specific option that depends on the backend */
-} tbm_bo_access_option;
-
-/**
- * @brief tbm_bo_handle abstraction of the memory handle by TBM_DEVICE_TYPE
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-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 @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-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 */
-};
-
-/**
- * @brief Called when the user data is deleted in buffer object.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- * @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()
- */
-typedef void (*tbm_data_free) (void *user_data);
-
-/**
- * @brief Enumeration of tbm buffer manager capability.
- * @since_tizen 5.0
- */
-typedef enum TBM_BUFMGR_CAPABILITY tbm_bufmgr_capability;
-
-/**
- * @brief Enumeration of tbm bo memory type.
- * @since_tizen 5.0
- */
-typedef enum TBM_BO_FLAGS tbm_bo_memory_type;
-
-/**
- * @brief Enumeration of buffer manager lock try for bo
- * @since_tizen 5.0
- */
-typedef enum {
- TBM_BUFMGR_BO_LOCK_TYPE_NEVER = 0, /**< the bufmgr do not try to lock the bos when the tbm_bo_map is called. */
- TBM_BUFMGR_BO_LOCK_TYPE_ONCE, /**< the bufmgr tries to lock the bos only once when the tbm_bo_map is called. */
- TBM_BUFMGR_BO_LOCK_TYPE_ALWAYS, /**< the bufmgr always tries to lock the bos when the tbm_bo_map is called. */
-} tbm_bufmgr_bo_lock_type;
-
-/**
- * @brief Enumeration of the trace log for debug
- * @since_tizen 5.0
- */
-typedef enum {
- TBM_BUFGMR_DEBUG_TRACE_NONE = 0,
- TBM_BUFGMR_DEBUG_TRACE_BO = (1 << 0),
- TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL = (1 << 1),
- TBM_BUFGMR_DEBUG_TRACE_SURFACE = (1 << 2),
- TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE = (1 << 3),
-} tbm_bufmgr_debug_trace_mask;
-
-/* type to string ***********************************************************/
-struct tbm_type_name {
- int type;
- const char *name;
-};
-
-#define TBM_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-
-#define TBM_TYPE_NAME_FN(res) \
-static inline const char * tbm_##res##_str(int type) \
-{ \
- unsigned int i; \
- for (i = 0; i < TBM_ARRAY_SIZE(tbm_##res##_names); i++) { \
- if (tbm_##res##_names[i].type == type) \
- return tbm_##res##_names[i].name; \
- } \
- return "(invalid)"; \
-}
-
-static struct tbm_type_name tbm_error_names[] = {
- { TBM_ERROR_NONE, "TBM_ERROR_NONE" },
- { TBM_ERROR_OUT_OF_MEMORY, "TBM_ERROR_OUT_OF_MEMORY" },
- { TBM_ERROR_INVALID_PARAMETER, "TBM_ERROR_INVALID_PARAMETER" },
- { TBM_ERROR_INVALID_OPERATION, "TBM_ERROR_INVALID_OPERATION" },
- { TBM_ERROR_NOT_SUPPORTED, "TBM_ERROR_NOT_SUPPORTED" },
- { TBM_SURFACE_QUEUE_ERROR_EMPTY, "TBM_SURFACE_QUEUE_ERROR_EMPTY" },
- { TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE, "TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE" },
- { TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE, "TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE" },
- { TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED, "TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED" },
- { TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST, "TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST" },
- { TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE, "TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE" },
-};
-TBM_TYPE_NAME_FN(error)
-
-#endif /* _TBM_TYPE_COMMON_H_ */