OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright © 2008-2011 Kristian Høgsberg |
| 3 * Copyright © 2010-2011 Intel Corporation |
| 4 * |
| 5 * Permission to use, copy, modify, distribute, and sell this |
| 6 * software and its documentation for any purpose is hereby granted |
| 7 * without fee, provided that\n the above copyright notice appear in |
| 8 * all copies and that both that copyright notice and this permission |
| 9 * notice appear in supporting documentation, and that the name of |
| 10 * the copyright holders not be used in advertising or publicity |
| 11 * pertaining to distribution of the software without specific, |
| 12 * written prior permission. The copyright holders make no |
| 13 * representations about the suitability of this software for any |
| 14 * purpose. It is provided "as is" without express or implied |
| 15 * warranty. |
| 16 * |
| 17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS |
| 18 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 19 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 20 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN |
| 22 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
| 23 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF |
| 24 * THIS SOFTWARE. |
| 25 */ |
| 26 |
| 27 #ifndef DRM_CLIENT_PROTOCOL_H |
| 28 #define DRM_CLIENT_PROTOCOL_H |
| 29 |
| 30 #ifdef __cplusplus |
| 31 extern "C" { |
| 32 #endif |
| 33 |
| 34 #include <stdint.h> |
| 35 #include <stddef.h> |
| 36 #include "wayland-client.h" |
| 37 |
| 38 struct wl_client; |
| 39 struct wl_resource; |
| 40 |
| 41 struct wl_drm; |
| 42 |
| 43 extern const struct wl_interface wl_drm_interface; |
| 44 |
| 45 #ifndef WL_DRM_ERROR_ENUM |
| 46 #define WL_DRM_ERROR_ENUM |
| 47 enum wl_drm_error { |
| 48 WL_DRM_ERROR_AUTHENTICATE_FAIL = 0, |
| 49 WL_DRM_ERROR_INVALID_FORMAT = 1, |
| 50 WL_DRM_ERROR_INVALID_NAME = 2, |
| 51 }; |
| 52 #endif /* WL_DRM_ERROR_ENUM */ |
| 53 |
| 54 #ifndef WL_DRM_FORMAT_ENUM |
| 55 #define WL_DRM_FORMAT_ENUM |
| 56 enum wl_drm_format { |
| 57 WL_DRM_FORMAT_C8 = 0x20203843, |
| 58 WL_DRM_FORMAT_RGB332 = 0x38424752, |
| 59 WL_DRM_FORMAT_BGR233 = 0x38524742, |
| 60 WL_DRM_FORMAT_XRGB4444 = 0x32315258, |
| 61 WL_DRM_FORMAT_XBGR4444 = 0x32314258, |
| 62 WL_DRM_FORMAT_RGBX4444 = 0x32315852, |
| 63 WL_DRM_FORMAT_BGRX4444 = 0x32315842, |
| 64 WL_DRM_FORMAT_ARGB4444 = 0x32315241, |
| 65 WL_DRM_FORMAT_ABGR4444 = 0x32314241, |
| 66 WL_DRM_FORMAT_RGBA4444 = 0x32314152, |
| 67 WL_DRM_FORMAT_BGRA4444 = 0x32314142, |
| 68 WL_DRM_FORMAT_XRGB1555 = 0x35315258, |
| 69 WL_DRM_FORMAT_XBGR1555 = 0x35314258, |
| 70 WL_DRM_FORMAT_RGBX5551 = 0x35315852, |
| 71 WL_DRM_FORMAT_BGRX5551 = 0x35315842, |
| 72 WL_DRM_FORMAT_ARGB1555 = 0x35315241, |
| 73 WL_DRM_FORMAT_ABGR1555 = 0x35314241, |
| 74 WL_DRM_FORMAT_RGBA5551 = 0x35314152, |
| 75 WL_DRM_FORMAT_BGRA5551 = 0x35314142, |
| 76 WL_DRM_FORMAT_RGB565 = 0x36314752, |
| 77 WL_DRM_FORMAT_BGR565 = 0x36314742, |
| 78 WL_DRM_FORMAT_RGB888 = 0x34324752, |
| 79 WL_DRM_FORMAT_BGR888 = 0x34324742, |
| 80 WL_DRM_FORMAT_XRGB8888 = 0x34325258, |
| 81 WL_DRM_FORMAT_XBGR8888 = 0x34324258, |
| 82 WL_DRM_FORMAT_RGBX8888 = 0x34325852, |
| 83 WL_DRM_FORMAT_BGRX8888 = 0x34325842, |
| 84 WL_DRM_FORMAT_ARGB8888 = 0x34325241, |
| 85 WL_DRM_FORMAT_ABGR8888 = 0x34324241, |
| 86 WL_DRM_FORMAT_RGBA8888 = 0x34324152, |
| 87 WL_DRM_FORMAT_BGRA8888 = 0x34324142, |
| 88 WL_DRM_FORMAT_XRGB2101010 = 0x30335258, |
| 89 WL_DRM_FORMAT_XBGR2101010 = 0x30334258, |
| 90 WL_DRM_FORMAT_RGBX1010102 = 0x30335852, |
| 91 WL_DRM_FORMAT_BGRX1010102 = 0x30335842, |
| 92 WL_DRM_FORMAT_ARGB2101010 = 0x30335241, |
| 93 WL_DRM_FORMAT_ABGR2101010 = 0x30334241, |
| 94 WL_DRM_FORMAT_RGBA1010102 = 0x30334152, |
| 95 WL_DRM_FORMAT_BGRA1010102 = 0x30334142, |
| 96 WL_DRM_FORMAT_YUYV = 0x56595559, |
| 97 WL_DRM_FORMAT_YVYU = 0x55595659, |
| 98 WL_DRM_FORMAT_UYVY = 0x59565955, |
| 99 WL_DRM_FORMAT_VYUY = 0x59555956, |
| 100 WL_DRM_FORMAT_AYUV = 0x56555941, |
| 101 WL_DRM_FORMAT_NV12 = 0x3231564e, |
| 102 WL_DRM_FORMAT_NV21 = 0x3132564e, |
| 103 WL_DRM_FORMAT_NV16 = 0x3631564e, |
| 104 WL_DRM_FORMAT_NV61 = 0x3136564e, |
| 105 WL_DRM_FORMAT_YUV410 = 0x39565559, |
| 106 WL_DRM_FORMAT_YVU410 = 0x39555659, |
| 107 WL_DRM_FORMAT_YUV411 = 0x31315559, |
| 108 WL_DRM_FORMAT_YVU411 = 0x31315659, |
| 109 WL_DRM_FORMAT_YUV420 = 0x32315559, |
| 110 WL_DRM_FORMAT_YVU420 = 0x32315659, |
| 111 WL_DRM_FORMAT_YUV422 = 0x36315559, |
| 112 WL_DRM_FORMAT_YVU422 = 0x36315659, |
| 113 WL_DRM_FORMAT_YUV444 = 0x34325559, |
| 114 WL_DRM_FORMAT_YVU444 = 0x34325659, |
| 115 }; |
| 116 #endif /* WL_DRM_FORMAT_ENUM */ |
| 117 |
| 118 #ifndef WL_DRM_CAPABILITY_ENUM |
| 119 #define WL_DRM_CAPABILITY_ENUM |
| 120 /** |
| 121 * wl_drm_capability - wl_drm capability bitmask |
| 122 * @WL_DRM_CAPABILITY_PRIME: wl_drm prime available |
| 123 * |
| 124 * Bitmask of capabilities. |
| 125 */ |
| 126 enum wl_drm_capability { |
| 127 WL_DRM_CAPABILITY_PRIME = 1, |
| 128 }; |
| 129 #endif /* WL_DRM_CAPABILITY_ENUM */ |
| 130 |
| 131 struct wl_drm_listener { |
| 132 /** |
| 133 * device - (none) |
| 134 * @name: (none) |
| 135 */ |
| 136 void (*device)(void *data, |
| 137 struct wl_drm *wl_drm, |
| 138 const char *name); |
| 139 /** |
| 140 * format - (none) |
| 141 * @format: (none) |
| 142 */ |
| 143 void (*format)(void *data, |
| 144 struct wl_drm *wl_drm, |
| 145 uint32_t format); |
| 146 /** |
| 147 * authenticated - (none) |
| 148 */ |
| 149 void (*authenticated)(void *data, |
| 150 struct wl_drm *wl_drm); |
| 151 /** |
| 152 * capabilities - (none) |
| 153 * @value: (none) |
| 154 */ |
| 155 void (*capabilities)(void *data, |
| 156 struct wl_drm *wl_drm, |
| 157 uint32_t value); |
| 158 }; |
| 159 |
| 160 static inline int |
| 161 wl_drm_add_listener(struct wl_drm *wl_drm, |
| 162 const struct wl_drm_listener *listener, void *data) |
| 163 { |
| 164 return wl_proxy_add_listener((struct wl_proxy *) wl_drm, |
| 165 (void (**)(void)) listener, data); |
| 166 } |
| 167 |
| 168 #define WL_DRM_AUTHENTICATE 0 |
| 169 #define WL_DRM_CREATE_BUFFER 1 |
| 170 #define WL_DRM_CREATE_PLANAR_BUFFER 2 |
| 171 #define WL_DRM_CREATE_PRIME_BUFFER 3 |
| 172 |
| 173 static inline void |
| 174 wl_drm_set_user_data(struct wl_drm *wl_drm, void *user_data) |
| 175 { |
| 176 wl_proxy_set_user_data((struct wl_proxy *) wl_drm, user_data); |
| 177 } |
| 178 |
| 179 static inline void * |
| 180 wl_drm_get_user_data(struct wl_drm *wl_drm) |
| 181 { |
| 182 return wl_proxy_get_user_data((struct wl_proxy *) wl_drm); |
| 183 } |
| 184 |
| 185 static inline void |
| 186 wl_drm_destroy(struct wl_drm *wl_drm) |
| 187 { |
| 188 wl_proxy_destroy((struct wl_proxy *) wl_drm); |
| 189 } |
| 190 |
| 191 static inline void |
| 192 wl_drm_authenticate(struct wl_drm *wl_drm, uint32_t id) |
| 193 { |
| 194 wl_proxy_marshal((struct wl_proxy *) wl_drm, |
| 195 WL_DRM_AUTHENTICATE, id); |
| 196 } |
| 197 |
| 198 static inline struct wl_buffer * |
| 199 wl_drm_create_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_
t height, uint32_t stride, uint32_t format) |
| 200 { |
| 201 struct wl_proxy *id; |
| 202 |
| 203 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm, |
| 204 WL_DRM_CREATE_BUFFER, &wl_buffer_interface, NULL, name,
width, height, stride, format); |
| 205 |
| 206 return (struct wl_buffer *) id; |
| 207 } |
| 208 |
| 209 static inline struct wl_buffer * |
| 210 wl_drm_create_planar_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width,
int32_t height, uint32_t format, int32_t offset0, int32_t stride0, int32_t offs
et1, int32_t stride1, int32_t offset2, int32_t stride2) |
| 211 { |
| 212 struct wl_proxy *id; |
| 213 |
| 214 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm, |
| 215 WL_DRM_CREATE_PLANAR_BUFFER, &wl_buffer_interface, NULL
, name, width, height, format, offset0, stride0, offset1, stride1, offset2, stri
de2); |
| 216 |
| 217 return (struct wl_buffer *) id; |
| 218 } |
| 219 |
| 220 static inline struct wl_buffer * |
| 221 wl_drm_create_prime_buffer(struct wl_drm *wl_drm, int32_t name, int32_t width, i
nt32_t height, uint32_t format, int32_t offset0, int32_t stride0, int32_t offset
1, int32_t stride1, int32_t offset2, int32_t stride2) |
| 222 { |
| 223 struct wl_proxy *id; |
| 224 |
| 225 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_drm, |
| 226 WL_DRM_CREATE_PRIME_BUFFER, &wl_buffer_interface, NULL,
name, width, height, format, offset0, stride0, offset1, stride1, offset2, strid
e2); |
| 227 |
| 228 return (struct wl_buffer *) id; |
| 229 } |
| 230 |
| 231 #ifdef __cplusplus |
| 232 } |
| 233 #endif |
| 234 |
| 235 #endif |
OLD | NEW |