remove hal_tbm_bufmgr_alloc_bo_with_tiled_format
[platform/hal/api/tbm.git] / include / hal-tbm-interface.h
1 /**************************************************************************
2  *
3  * hal-api-tbm
4  *
5  * Copyright 2021 Samsung Electronics co., Ltd. All Rights Reserved.
6  *
7  * Contact: SooChan Lim <sc1.lim@samsung.com>,
8  *          Junkyeong Kim <jk0430.kim@samsung.com>,
9  *          Changyeon Lee <cyeon.lee@samsung.com>
10  *
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:
18  *
19  * The above copyright notice and this permission notice (including the
20  * next paragraph) shall be included in all copies or substantial portions
21  * of the Software.
22  *
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.
30  *
31 **************************************************************************/
32
33 #ifndef __HAL_TBM_INTERFACE__
34 #define __HAL_TBM_INTERFACE__
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #include <hal-tbm-types.h>
41
42 typedef struct _hal_tbm_backend_data hal_tbm_backend_data;
43
44 typedef struct _hal_tbm_bufmgr_funcs hal_tbm_bufmgr_funcs;
45 typedef struct _hal_tbm_bo_funcs     hal_tbm_bo_funcs;
46
47 typedef hal_tbm_error (*hal_tbm_authenticated_drm_fd_handler)(hal_tbm_fd auth_fd, void *user_data);
48
49 struct _hal_tbm_backend_data {
50         hal_tbm_bufmgr *bufmgr; // handle
51
52         int has_drm_device;
53         struct {
54                 hal_tbm_fd drm_fd;
55                 int is_master;
56                 hal_tbm_authenticated_drm_fd_handler auth_drm_fd_func;
57                 void *user_data;
58         } drm_info;
59
60         hal_tbm_bufmgr_funcs *bufmgr_funcs;
61         hal_tbm_bo_funcs     *bo_funcs;
62 };
63
64 struct _hal_tbm_bufmgr_funcs {
65         /* tbm_bufmgr_func */
66         hal_tbm_bufmgr_capability (*bufmgr_get_capabilities)(hal_tbm_bufmgr *bufmgr, hal_tbm_error *error);
67         hal_tbm_error (*bufmgr_get_supported_formats)(hal_tbm_bufmgr *bufmgr, uint32_t **formats, uint32_t *num);
68         hal_tbm_error (*bufmgr_get_plane_data)(hal_tbm_bufmgr *bufmgr, hal_tbm_format format, int plane_idx, int width, int height,
69                                                                                 uint32_t *size, uint32_t *offset, uint32_t *pitch, int *bo_idx);
70         hal_tbm_bo *(*bufmgr_alloc_bo)(hal_tbm_bufmgr *bufmgr, unsigned int size, hal_tbm_bo_memory_type mem_types, hal_tbm_error *error);
71         hal_tbm_bo *(*bufmgr_alloc_bo_with_format)(hal_tbm_bufmgr *bufmgr, int format, int bo_idx, int width, int height,
72                                                                                 hal_tbm_bo_memory_type mem_types, hal_tbm_error *error);
73         hal_tbm_bo *(*bufmgr_import_fd)(hal_tbm_bufmgr *bufmgr, hal_tbm_fd fd, hal_tbm_error *error);
74         hal_tbm_bo *(*bufmgr_import_key)(hal_tbm_bufmgr *bufmgr, hal_tbm_key key, hal_tbm_error *error);
75 };
76
77 struct _hal_tbm_bo_funcs {
78         void (*bo_free)(hal_tbm_bo *bo);
79         int (*bo_get_size)(hal_tbm_bo *bo, hal_tbm_error *error);
80         hal_tbm_bo_memory_type (*bo_get_memory_types)(hal_tbm_bo *bo, hal_tbm_error *error);
81         hal_tbm_bo_handle (*bo_get_handle)(hal_tbm_bo *bo, hal_tbm_bo_device_type device, hal_tbm_error *error);
82         hal_tbm_bo_handle (*bo_map)(hal_tbm_bo *bo, hal_tbm_bo_device_type device, hal_tbm_bo_access_option opt, hal_tbm_error *error);
83         hal_tbm_error (*bo_unmap)(hal_tbm_bo *bo);
84         hal_tbm_error (*bo_lock)(hal_tbm_bo *bo, hal_tbm_bo_device_type device, hal_tbm_bo_access_option opt);
85         hal_tbm_error (*bo_unlock)(hal_tbm_bo *bo);
86         hal_tbm_fd (*bo_export_fd)(hal_tbm_bo *bo, hal_tbm_error *error);
87         hal_tbm_key (*bo_export_key)(hal_tbm_bo *bo, hal_tbm_error *error);
88 };
89
90 #ifdef __cplusplus
91 }
92 #endif
93 #endif /* __HAL_TBM_INTERFACE__ */