hal_tbm_error hal_tbm_bufmgr_get_supported_formats(hal_tbm_bufmgr *bufmgr, uint32_t **formats, uint32_t *num);
hal_tbm_error hal_tbm_bufmgr_get_plane_data(hal_tbm_bufmgr *bufmgr, hal_tbm_format format, int plane_idx, int width, int height,
uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx);
+hal_tbm_surface *hal_tbm_bufmgr_alloc_surface(hal_tbm_bufmgr *bufmgr, int width, int height, hal_tbm_format format, hal_tbm_error *error);
+hal_tbm_surface *hal_tbm_bufmgr_import_surface(hal_tbm_bufmgr *bufmgr, int width, int height, hal_tbm_format format, hal_tbm_surface_buffer_data *buffer_data, hal_tbm_error *error);
hal_tbm_bo *hal_tbm_bufmgr_alloc_bo(hal_tbm_bufmgr *bufmgr, unsigned int size, hal_tbm_bo_memory_type mem_types, hal_tbm_error *error);
hal_tbm_bo *hal_tbm_bufmgr_alloc_bo_with_format(hal_tbm_bufmgr *bufmgr, int format, int bo_idx, int width, int height, int bpp,
hal_tbm_bo_memory_type mem_types, hal_tbm_error *error);
hal_tbm_bo *hal_tbm_bufmgr_import_fd(hal_tbm_bufmgr *bufmgr, hal_tbm_fd fd, hal_tbm_error *error);
hal_tbm_bo *hal_tbm_bufmgr_import_key(hal_tbm_bufmgr *bufmgr, hal_tbm_key key, hal_tbm_error *error);
+/* hal_tbm_surface_funcs*/
+void hal_tbm_surface_free(hal_tbm_surface *surface);
+hal_tbm_bo **hal_tbm_surface_get_bos(hal_tbm_surface *surface, int *num_bos, hal_tbm_error *error);
+hal_tbm_error hal_tbm_surface_get_plane_data(hal_tbm_surface *surface, int plane_idx, uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx);
+hal_tbm_surface_buffer_data *hal_tbm_surface_export(hal_tbm_surface *surface, hal_tbm_error *error);
+
/* hal_tbm_bo_funcs*/
void hal_tbm_bo_free(hal_tbm_bo *bo);
int hal_tbm_bo_get_size(hal_tbm_bo *bo, hal_tbm_error *error);
bufmgr_funcs = (hal_tbm_bufmgr_funcs *)g_hal_tbm_backend_data->bufmgr_funcs; \
if (!bufmgr_funcs->__func__) goto __goto__;
+#define SURFACE_FUNC_ENTRY(__func__) \
+ hal_tbm_surface_funcs *surface_funcs; \
+ if (!surface) return HAL_TBM_ERROR_INVALID_PARAMETER; \
+ if (!g_hal_tbm_backend_data || !g_hal_tbm_backend_data->surface_funcs) return HAL_TBM_ERROR_NOT_SUPPORTED; \
+ surface_funcs = g_hal_tbm_backend_data->surface_funcs; \
+ if (!surface_funcs->__func__) return HAL_TBM_ERROR_NOT_SUPPORTED;
+
+#define SURFACE_FUNC_ENTRY_NULL(__func__) \
+ hal_tbm_surface_funcs *surface_funcs; \
+ if (!surface) { if (error) *error = HAL_TBM_ERROR_INVALID_PARAMETER; return NULL; } \
+ if (!g_hal_tbm_backend_data || !g_hal_tbm_backend_data->surface_funcs) { if (error) *error = HAL_TBM_ERROR_NOT_SUPPORTED; return NULL; } \
+ surface_funcs = g_hal_tbm_backend_data->surface_funcs; \
+ if (!surface_funcs->__func__) { if (error) *error = HAL_TBM_ERROR_NOT_SUPPORTED; return NULL; };
+
+#define SURFACE_FUNC_ENTRY_VOID(__func__) \
+ hal_tbm_surface_funcs *surface_funcs; \
+ if (!g_hal_tbm_backend_data || !g_hal_tbm_backend_data->surface_funcs) return; \
+ surface_funcs = g_hal_tbm_backend_data->surface_funcs; \
+ if (!surface_funcs->__func__) return;
+
+#define SURFACE_FUNC_ENTRY_GOTO(__func__, __goto__) \
+ hal_tbm_surface_funcs *surface_funcs; \
+ if (!surface) goto __goto__; \
+ if (!g_hal_tbm_backend_data || !g_hal_tbm_backend_data->surface_funcs) goto __goto__; \
+ surface_funcs = (hal_tbm_surface_funcs *)g_hal_tbm_backend_data->surface_funcs; \
+ if (!surface_funcs->__func__) goto __goto__;
+
#define BO_FUNC_ENTRY(__func__) \
hal_tbm_bo_funcs *bo_funcs; \
if (!g_hal_tbm_backend_data || !g_hal_tbm_backend_data->bo_funcs) return HAL_TBM_ERROR_NOT_SUPPORTED; \
return bufmgr_funcs->bufmgr_get_plane_data((hal_tbm_bufmgr *)bufmgr, format, plane_idx, width, height, size, offset, pitch, bo_idx);
}
+
+EXTERN hal_tbm_surface *
+hal_tbm_bufmgr_alloc_surface(hal_tbm_bufmgr *bufmgr, int width, int height, hal_tbm_format format, hal_tbm_error *error)
+{
+ BUFMGR_FUNC_ENTRY_NULL(bufmgr_alloc_surface);
+
+ return bufmgr_funcs->bufmgr_alloc_surface((hal_tbm_bufmgr *)bufmgr, width, height, format, error);
+}
+
+EXTERN hal_tbm_surface *
+hal_tbm_bufmgr_import_surface(hal_tbm_bufmgr *bufmgr, int width, int height, hal_tbm_format format, hal_tbm_surface_buffer_data *buffer_data, hal_tbm_error *error)
+{
+ BUFMGR_FUNC_ENTRY_NULL(bufmgr_import_surface);
+
+ return bufmgr_funcs->bufmgr_import_surface((hal_tbm_bufmgr *)bufmgr, width, height, format, buffer_data, error);
+}
+
EXTERN hal_tbm_bo *
hal_tbm_bufmgr_alloc_bo(hal_tbm_bufmgr *bufmgr, unsigned int size, hal_tbm_bo_memory_type mem_types, hal_tbm_error *error)
{
return bufmgr_funcs->bufmgr_import_key((hal_tbm_bufmgr *)bufmgr, key, error);
}
+/* tbm_surface_func */
+EXTERN void
+hal_tbm_surface_free(hal_tbm_surface *surface)
+{
+ SURFACE_FUNC_ENTRY_VOID(surface_free);
+
+ return surface_funcs->surface_free((hal_tbm_surface *)surface);
+}
+
+EXTERN hal_tbm_bo **
+hal_tbm_surface_get_bos(hal_tbm_surface *surface, int *num_bos, hal_tbm_error *error)
+{
+ SURFACE_FUNC_ENTRY_NULL(surface_get_bos);
+
+ return surface_funcs->surface_get_bos((hal_tbm_surface *)surface, num_bos, error);
+}
+
+EXTERN hal_tbm_error
+hal_tbm_surface_get_plane_data(hal_tbm_surface *surface, int plane_idx, uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx)
+{
+ SURFACE_FUNC_ENTRY(surface_get_plane_data);
+
+ return surface_funcs->surface_get_plane_data((hal_tbm_surface *)surface, plane_idx, size, offset, pitch, bo_idx);
+}
+
+EXTERN hal_tbm_surface_buffer_data *
+hal_tbm_surface_export(hal_tbm_surface *surface, hal_tbm_error *error)
+{
+ SURFACE_FUNC_ENTRY_NULL(surface_export);
+
+ return surface_funcs->surface_export((hal_tbm_surface *)surface, error);
+}
/* tbm_bo_func*/
EXTERN void