tbm_module: change the tbm_module_bo_xxx signature
[platform/core/uifw/libtbm.git] / include / tbm_drm_helper.h
1 /**************************************************************************
2
3 libtbm
4
5 Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
6
7 Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
8 Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
9
10 Permission is hereby granted, free of charge, to any person obtaining a
11 copy of this software and associated documentation files (the
12 "Software"), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sub license, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
17
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
20 of the Software.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 **************************************************************************/
31
32 #ifndef _TBM_DRM_HELPER_H_
33 #define _TBM_DRM_HELPER_H_
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /**
40  * @brief Initialize authentication server in display server.
41  * @details
42  * In DRM system, client sholud get authenticated fd from display server for using drm.
43    Tbm provides wayland protocol and helper function for passing and authenticating
44    fd from display server.
45  * @param[in] wl_display wayland display
46  * @param[in] fd fd of drm_master
47  * @param[in] device_name name of drm device
48  * @param[in] flags flags
49   * @see #tbm_drm_helper_wl_auth_server_deinit()
50  */
51 int tbm_drm_helper_wl_auth_server_init(void  *wl_display, int fd, const char *device_name, uint32_t flags);
52
53 /**
54  * @brief Deinitialize authentication server in display server
55  * @details
56  * In DRM system, client sholud get authenticated fd from display server for using drm.
57    Tbm provides wayland protocol and helper function for passing and authenticating
58    fd from display server.
59  * @see #tdm_helper_set_tbm_master_fd()
60  * @see #tbm_drm_helper_unset_tbm_master_fd()
61  */
62 void tbm_drm_helper_wl_auth_server_deinit(void);
63
64 /**
65  * @brief Get a drm master fd.
66  * @details
67  * This function will dup the drm master fd.
68    The Caller SHOULD close the fd.
69    In DRM system, a drm master fd SHOULD be shared between TDM backend and
70    TBM backend in display server side.
71  * @return fd if success. Otherwise, -1.
72  * @see #tbm_drm_helper_set_tbm_master_fd()
73  * @see #tbm_drm_helper_unset_tbm_master_fd()
74  */
75 int  tbm_drm_helper_get_master_fd(void);
76
77 /**
78  * @brief Set a drm master fd with the given fd.
79  * @details
80  * In DRM system, a drm master fd @b SHOULD be shared between TDM backend and
81    TBM backend in display server side.
82  * @param[in] fd The given fd
83  * @see #tbm_drm_helper_get_master_fd()
84  * @see #tbm_drm_helper_unset_tbm_master_fd()
85  */
86 void tbm_drm_helper_set_tbm_master_fd(int fd);
87
88 /**
89  * @brief Unset a drm master fd.
90  * @see #tbm_drm_helper_get_master_fd()
91  * @see #tbm_drm_helper_set_tbm_master_fd()
92  */
93 void tbm_drm_helper_unset_tbm_master_fd(void);
94
95 /**
96  * @brief Get infomation of drm authentication.
97  * @details
98  * In DRM system, client sholud get authenticated fd from display server for using drm.
99    Tbm provides wayland protocol and helper function for passing and authenticating
100    fd from display server.
101  * @param[out] fd The authenticated fd
102  * @param[out] device The device name
103  * @param[out] capabilities The capabilities of device
104  * @see #tdm_helper_set_tbm_master_fd()
105  * @see #tbm_drm_helper_unset_tbm_master_fd()
106  */
107 int tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities);
108
109 /**
110  * @brief Set drm fd with the given fd.
111  * @details
112  * Some client want to get drm fd used tbm_backend.
113    if tbm_backend allow that client use drm_fd, it SHOULD be set.
114  * @param[in] fd The given fd
115  * @see #tbm_drm_helper_get_fd()
116  */
117 void tbm_drm_helper_set_fd(int fd);
118
119 /**
120  * @brief Unset drm fd.
121  * @details
122  * Some client want to get drm fd used tbm_backend.
123    if tbm_backend allow that client use drm_fd, it SHOULD be set.
124  * @param[in] fd The given fd
125  * @see #tbm_drm_helper_get_fd()
126  */
127 void tbm_drm_helper_unset_fd(void);
128
129 /**
130  * @brief Get drm fd.
131  * @details
132  * Some client want to get drm fd used tbm_backend.
133    client can get drm fd from this fucntion.
134    The Caller SHOULD close the fd.
135  * @return fd if success. Otherwise, -1.
136  * @see #tdm_helper_set_tbm_master_fd()
137  * @see #tbm_drm_helper_unset_tbm_master_fd()
138  */
139 int tbm_drm_helper_get_fd(void);
140
141 #ifdef __cplusplus
142 }
143 #endif
144 #endif                                                  /* _TBM_DRM_HELPER_H_ */