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_
36 * @brief Initialize authentication server in display server.
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()
47 int tbm_drm_helper_wl_auth_server_init(void *wl_display, int fd, const char *device_name, uint32_t flags);
50 * @brief Deinitialize authentication server in display server
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()
58 void tbm_drm_helper_wl_auth_server_deinit(void);
61 * @brief Get a drm master fd.
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()
71 int tbm_drm_helper_get_master_fd(void);
74 * @brief Set a drm master fd with the given fd.
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()
82 void tbm_drm_helper_set_tbm_master_fd(int fd);
85 * @brief Unset a drm master fd.
86 * @see #tbm_drm_helper_get_master_fd()
87 * @see #tbm_drm_helper_set_tbm_master_fd()
89 void tbm_drm_helper_unset_tbm_master_fd(void);
92 * @brief Get infomation of drm authentication.
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()
103 int tbm_drm_helper_get_auth_info(int *auth_fd, char **device, uint32_t *capabilities);
106 * @brief Set drm fd with the given fd.
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()
113 void tbm_drm_helper_set_fd(int fd);
116 * @brief Unset drm fd.
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()
123 void tbm_drm_helper_unset_fd(void);
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()
135 int tbm_drm_helper_get_fd(void);
137 #endif /* _TBM_DRM_HELPER_H_ */