1 /**************************************************************************
5 Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
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>
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:
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
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.
30 **************************************************************************/
32 #ifndef _TBM_DRM_HELPER_H_
33 #define _TBM_DRM_HELPER_H_
40 * @brief Initialize authentication server in display server.
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()
51 int tbm_drm_helper_wl_auth_server_init(void *wl_display, int fd, const char *device_name, uint32_t flags);
54 * @brief Deinitialize authentication server in display server
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()
62 void tbm_drm_helper_wl_auth_server_deinit(void);
65 * @brief Get a drm master fd.
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()
75 int tbm_drm_helper_get_master_fd(void);
78 * @brief Set a drm master fd with the given fd.
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()
86 void tbm_drm_helper_set_tbm_master_fd(int fd);
89 * @brief Unset a drm master fd.
90 * @see #tbm_drm_helper_get_master_fd()
91 * @see #tbm_drm_helper_set_tbm_master_fd()
93 void tbm_drm_helper_unset_tbm_master_fd(void);
96 * @brief Get infomation of drm authentication.
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()
107 int tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities);
110 * @brief Set drm fd with the given fd.
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()
117 void tbm_drm_helper_set_fd(int fd);
120 * @brief Unset drm fd.
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()
127 void tbm_drm_helper_unset_fd(void);
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()
139 int tbm_drm_helper_get_fd(void);
144 #endif /* _TBM_DRM_HELPER_H_ */