* @since_tizen 2.4
*/
typedef enum {
- TBM_ERROR_NONE = 0, /**< Successful */
- TBM_ERROR_OUT_OF_MEMORY = TBM_ERROR_BASE | 0x0001, /**< failed to allocate the memory */
- TBM_ERROR_INVALID_PARAMETER = TBM_ERROR_BASE | 0x0002, /**< failed to get the valid parameter */
- TBM_ERROR_OPERATION_FAILED = TBM_ERROR_BASE | 0x0003, /**< failed to operation */
-
- TBM_BO_ERROR_GET_FD_FAILED = TBM_ERROR_BASE | 0x0101, /**< failed to get fd in bo */
- TBM_BO_ERROR_HEAP_ALLOC_FAILED = TBM_ERROR_BASE | 0x0102, /**< failed to allocate the heap memory in bo */
- TBM_BO_ERROR_LOAD_MODULE_FAILED = TBM_ERROR_BASE | 0x0103,/**< failed to load module*/
- TBM_BO_ERROR_THREAD_INIT_FAILED = TBM_ERROR_BASE | 0x0104,/**< failed to initialize the pthread */
- TBM_BO_ERROR_BO_ALLOC_FAILED = TBM_ERROR_BASE | 0x0105, /**< failed to allocate tbm_bo */
- TBM_BO_ERROR_INIT_STATE_FAILED = TBM_ERROR_BASE | 0x0106, /**< failed to initialize the state of tbm_bo */
- TBM_BO_ERROR_IMPORT_FAILED = TBM_ERROR_BASE | 0x0107, /**< failed to import the handle of tbm_bo */
- TBM_BO_ERROR_IMPORT_FD_FAILED = TBM_ERROR_BASE | 0x0108, /**< failed to import fd of tbm_bo */
- TBM_BO_ERROR_EXPORT_FAILED = TBM_ERROR_BASE | 0x0109, /**< failed to export the handle of the tbm_bo */
- TBM_BO_ERROR_EXPORT_FD_FAILED = TBM_ERROR_BASE | 0x01010, /**< failed to export fd of tbm_bo */
- TBM_BO_ERROR_GET_HANDLE_FAILED = TBM_ERROR_BASE | 0x0111, /**< failed to get the tbm_bo_handle */
- TBM_BO_ERROR_LOCK_FAILED = TBM_ERROR_BASE | 0x0112, /**< failed to lock the tbm_bo */
- TBM_BO_ERROR_MAP_FAILED = TBM_ERROR_BASE | 0x0113, /**< failed to map the tbm_bo to get the tbm_bo_handle */
- TBM_BO_ERROR_UNMAP_FAILED = TBM_ERROR_BASE | 0x0114, /**< failed to unmap the tbm_bo */
- TBM_BO_ERROR_SWAP_FAILED = TBM_ERROR_BASE | 0x0115, /**< failed to swap the tbm_bos */
- TBM_BO_ERROR_DUP_FD_FAILED = TBM_ERROR_BASE | 0x0116, /**< failed to duplicate fd */
-
- TBM_SURFACE_QUEUE_ERROR_NONE = 0, /**< Successful */
- TBM_SURFACE_QUEUE_ERROR_INVALID_SURFACE = -1,
- TBM_SURFACE_QUEUE_ERROR_INVALID_QUEUE = -2,
- TBM_SURFACE_QUEUE_ERROR_EMPTY = -3,
- TBM_SURFACE_QUEUE_ERROR_INVALID_PARAMETER = -4,
- TBM_SURFACE_QUEUE_ERROR_SURFACE_ALLOC_FAILED = -5,
- TBM_SURFACE_QUEUE_ERROR_ALREADY_EXIST = -6,
- TBM_SURFACE_QUEUE_ERROR_UNKNOWN_SURFACE = -7,
+ /* 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;
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_ */