Add backend function for vendor supported tiled format.
[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 /**
36  * @brief Initialize authentication server in display server.
37  * @details
38  * In DRM system, client sholud get authenticated fd from display server for using drm.
39    Tbm provides wayland protocol and helper function for passing and authenticating
40    fd from display server.
41  * @param[in] wl_display wayland display
42  * @param[in] fd fd of drm_master
43  * @param[in] device_name name of drm device
44  * @param[in] flags flags
45   * @see #tbm_drm_helper_wl_auth_server_deinit()
46  */
47 int tbm_drm_helper_wl_auth_server_init(void  *wl_display, int fd, const char *device_name, uint32_t flags);
48
49 /**
50  * @brief Deinitialize authentication server in display server
51  * @details
52  * In DRM system, client sholud get authenticated fd from display server for using drm.
53    Tbm provides wayland protocol and helper function for passing and authenticating
54    fd from display server.
55  * @see #tdm_helper_set_tbm_master_fd()
56  * @see #tbm_drm_helper_unset_tbm_master_fd()
57  */
58 void tbm_drm_helper_wl_auth_server_deinit(void);
59
60 /**
61  * @brief Get a drm master fd.
62  * @details
63  * This function will dup the drm master fd.
64    The Caller SHOULD close the fd.
65    In DRM system, a drm master fd SHOULD be shared between TDM backend and
66    TBM backend in display server side.
67  * @return fd if success. Otherwise, -1.
68  * @see #tbm_drm_helper_set_tbm_master_fd()
69  * @see #tbm_drm_helper_unset_tbm_master_fd()
70  */
71 int  tbm_drm_helper_get_master_fd(void);
72
73 /**
74  * @brief Set a drm master fd with the given fd.
75  * @details
76  * In DRM system, a drm master fd @b SHOULD be shared between TDM backend and
77    TBM backend in display server side.
78  * @param[in] fd The given fd
79  * @see #tbm_drm_helper_get_master_fd()
80  * @see #tbm_drm_helper_unset_tbm_master_fd()
81  */
82 void tbm_drm_helper_set_tbm_master_fd(int fd);
83
84 /**
85  * @brief Unset a drm master fd.
86  * @see #tbm_drm_helper_get_master_fd()
87  * @see #tbm_drm_helper_set_tbm_master_fd()
88  */
89 void tbm_drm_helper_unset_tbm_master_fd(void);
90
91 /**
92  * @brief Get infomation of drm authentication.
93  * @details
94  * In DRM system, client sholud get authenticated fd from display server for using drm.
95    Tbm provides wayland protocol and helper function for passing and authenticating
96    fd from display server.
97  * @param[out] fd The authenticated fd
98  * @param[out] device The device name
99  * @param[out] capabilities The capabilities of device
100  * @see #tdm_helper_set_tbm_master_fd()
101  * @see #tbm_drm_helper_unset_tbm_master_fd()
102  */
103 int tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities);
104
105 /**
106  * @brief Set drm fd with the given fd.
107  * @details
108  * Some client want to get drm fd used tbm_backend.
109    if tbm_backend allow that client use drm_fd, it SHOULD be set.
110  * @param[in] fd The given fd
111  * @see #tbm_drm_helper_get_fd()
112  */
113 void tbm_drm_helper_set_fd(int fd);
114
115 /**
116  * @brief Unset drm fd.
117  * @details
118  * Some client want to get drm fd used tbm_backend.
119    if tbm_backend allow that client use drm_fd, it SHOULD be set.
120  * @param[in] fd The given fd
121  * @see #tbm_drm_helper_get_fd()
122  */
123 void tbm_drm_helper_unset_fd(void);
124
125 /**
126  * @brief Get drm fd.
127  * @details
128  * Some client want to get drm fd used tbm_backend.
129    client can get drm fd from this fucntion.
130    The Caller SHOULD close the fd.
131  * @return fd if success. Otherwise, -1.
132  * @see #tdm_helper_set_tbm_master_fd()
133  * @see #tbm_drm_helper_unset_tbm_master_fd()
134  */
135 int tbm_drm_helper_get_fd(void);
136
137 #endif                                                  /* _TBM_DRM_HELPER_H_ */