1 /**************************************************************************
5 Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
7 Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
8 Inpyo Kang <mantiger@samsung.com>, Dongyeon Kim <dy5.kim@samsung.com>
9 Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
11 Permission is hereby granted, free of charge, to any person obtaining a
12 copy of this software and associated documentation files (the
13 "Software"), to deal in the Software without restriction, including
14 without limitation the rights to use, copy, modify, merge, publish,
15 distribute, sub license, and/or sell copies of the Software, and to
16 permit persons to whom the Software is furnished to do so, subject to
17 the following conditions:
19 The above copyright notice and this permission notice (including the
20 next paragraph) shall be included in all copies or substantial portions
23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
26 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
27 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
28 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 **************************************************************************/
33 #ifndef _TBM_TYPE_INT_H_
34 #define _TBM_TYPE_INT_H_
39 * \file tbm_type_int.h
40 * \brief Type definition used internally
43 /* tbm error base : this error base is same as TIZEN_ERROR_TBM in tizen_error.h */
44 #ifndef TBM_ERROR_BASE
45 #define TBM_ERROR_BASE -0x02830000
49 * @brief Definition for the tizen buffer manager
50 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
52 typedef struct _tbm_bufmgr *tbm_bufmgr;
55 * @brief Definition for the tizen buffer object
56 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
58 typedef struct _tbm_bo *tbm_bo;
60 * @brief Definition for the key associated with the buffer object
61 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
63 typedef uint32_t tbm_key;
65 * @brief Definition for the file descripter of the system buffer manager
66 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
68 typedef int32_t tbm_fd;
73 * @brief Enumeration for tbm error type.
77 TBM_ERROR_NONE = 0, /**< Successful */
78 TBM_BO_ERROR_GET_FD_FAILED = TBM_ERROR_BASE | 0x0101, /**< failed to get fd failed */
79 TBM_BO_ERROR_HEAP_ALLOC_FAILED = TBM_ERROR_BASE | 0x0102, /**< failed to allocate the heap memory */
80 TBM_BO_ERROR_LOAD_MODULE_FAILED = TBM_ERROR_BASE | 0x0103,/**< failed to load module*/
81 TBM_BO_ERROR_THREAD_INIT_FAILED = TBM_ERROR_BASE | 0x0104,/**< failed to initialize the pthread */
82 TBM_BO_ERROR_BO_ALLOC_FAILED = TBM_ERROR_BASE | 0x0105, /**< failed to allocate tbm_bo */
83 TBM_BO_ERROR_INIT_STATE_FAILED = TBM_ERROR_BASE | 0x0106, /**< failed to initialize the state of tbm_bo */
84 TBM_BO_ERROR_IMPORT_FAILED = TBM_ERROR_BASE | 0x0107, /**< failed to import the handle of tbm_bo */
85 TBM_BO_ERROR_IMPORT_FD_FAILED = TBM_ERROR_BASE | 0x0108, /**< failed to import fd of tbm_bo */
86 TBM_BO_ERROR_EXPORT_FAILED = TBM_ERROR_BASE | 0x0109, /**< failed to export the handle of the tbm_bo */
87 TBM_BO_ERROR_EXPORT_FD_FAILED = TBM_ERROR_BASE | 0x01010, /**< failed to export fd of tbm_bo */
88 TBM_BO_ERROR_GET_HANDLE_FAILED = TBM_ERROR_BASE | 0x0111, /**< failed to get the tbm_bo_handle */
89 TBM_BO_ERROR_LOCK_FAILED = TBM_ERROR_BASE | 0x0112, /**< failed to lock the tbm_bo */
90 TBM_BO_ERROR_MAP_FAILED = TBM_ERROR_BASE | 0x0113, /**< failed to map the tbm_bo to get the tbm_bo_handle */
91 TBM_BO_ERROR_UNMAP_FAILED = TBM_ERROR_BASE | 0x0114, /**< failed to unmap the tbm_bo */
92 TBM_BO_ERROR_SWAP_FAILED = TBM_ERROR_BASE | 0x0115, /**< failed to swap the tbm_bos */
93 TBM_BO_ERROR_DUP_FD_FAILED = TBM_ERROR_BASE | 0x0116, /**< failed to duplicate fd */
97 * @brief Enumeration of tbm buffer manager capability.
100 enum TBM_BUFMGR_CAPABILITY {
101 TBM_BUFMGR_CAPABILITY_NONE = 0, /**< Not Support capability*/
102 TBM_BUFMGR_CAPABILITY_SHARE_KEY = (1 << 0), /**< Support sharing buffer by tbm key */
103 TBM_BUFMGR_CAPABILITY_SHARE_FD = (1 << 1), /**< Support sharing buffer by tbm fd */
104 TBM_BUFMGR_CAPABILITY_TBM_SYNC = (1 << 2), /**< Support tbm sync */
108 * @brief Enumeration of buffer manager lock try for bo
112 TBM_BUFMGR_BO_LOCK_TYPE_NEVER = 0, /**< the bufmgr do not try to lock the bos when the tbm_bo_map is called. */
113 TBM_BUFMGR_BO_LOCK_TYPE_ONCE, /**< the bufmgr tries to lock the bos only once when the tbm_bo_map is called. */
114 TBM_BUFMGR_BO_LOCK_TYPE_ALWAYS, /**< the bufmgr always tries to lock the bos when the tbm_bo_map is called. */
115 } tbm_bufmgr_bo_lock_type;
118 * @brief Definition for the device type to get the default handle
119 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
121 #define TBM_DEVICE_DEFAULT 0
123 * @brief Definition for the device type to get the virtual memory
124 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
126 #define TBM_DEVICE_CPU 1
128 * @brief Definition for the device type to get the 2D memory handle
129 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
131 #define TBM_DEVICE_2D 2
133 * @brief Definition for the device type to get the 3D memory handle
134 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
136 #define TBM_DEVICE_3D 3
138 * @brief Definition for the device type to get the multimedia handle
139 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
141 #define TBM_DEVICE_MM 4
146 * @brief Definition for the access option to read
147 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
149 #define TBM_OPTION_READ (1 << 0)
151 * @brief Definition for the access option to write
152 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
154 #define TBM_OPTION_WRITE (1 << 1)
156 * @brief Definition for the vendor specific option that depends on the backend
157 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
159 #define TBM_OPTION_VENDOR (0xffff0000)
162 * @brief tbm_bo_handle abstraction of the memory handle by TBM_DEVICE_TYPE
163 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
165 typedef union _tbm_bo_handle {
174 * @brief Enumeration of bo memory type
175 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
178 TBM_BO_DEFAULT = 0, /**< default memory: it depends on the backend */
179 TBM_BO_SCANOUT = (1 << 0), /**< scanout memory */
180 TBM_BO_NONCACHABLE = (1 << 1), /**< non-cachable memory */
181 TBM_BO_WC = (1 << 2), /**< write-combine memory */
182 TBM_BO_VENDOR = (0xffff0000), /**< vendor specific memory: it depends on the backend */
186 * @brief Called when the user data is deleted in buffer object.
187 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
188 * @param[in] user_data User_data to be passed to callback function
189 * @pre The callback must be registered using tbm_bo_add_user_data().\n
190 * tbm_bo_delete_user_data() must be called to invoke this callback.
191 * @see tbm_bo_add_user_data()
192 * @see tbm_bo_delete_user_data()
194 typedef void (*tbm_data_free) (void *user_data);
197 * @brief Enumeration of the trace log for debug
201 TBM_BUFGMR_DEBUG_TRACE_NONE = 0,
202 TBM_BUFGMR_DEBUG_TRACE_BO = (1 << 0),
203 TBM_BUFGMR_DEBUG_TRACE_SURFACE_INTERNAL = (1 << 1),
204 TBM_BUFGMR_DEBUG_TRACE_SURFACE = (1 << 2),
205 TBM_BUFGMR_DEBUG_TRACE_SURFACE_QUEUE = (1 << 3),
206 } tbm_bufmgr_debug_trace_mask;
208 #endif /* _TBM_TYPE_INT_H_ */