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 <stddef.h> |
| 35 #include <stdint.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 struct wl_drm_listener { |
| 119 /** |
| 120 * device - device |
| 121 * @name: name |
| 122 */ |
| 123 void (*device)(void* data, struct wl_drm* wl_drm, const char* name); |
| 124 /** |
| 125 * format - format |
| 126 * @format: format |
| 127 */ |
| 128 void (*format)(void* data, struct wl_drm* wl_drm, uint32_t format); |
| 129 /** |
| 130 * authenticated - authenticated |
| 131 */ |
| 132 void (*authenticated)(void* data, struct wl_drm* wl_drm); |
| 133 }; |
| 134 |
| 135 static inline int wl_drm_add_listener(struct wl_drm* wl_drm, |
| 136 const struct wl_drm_listener* listener, |
| 137 void* data) { |
| 138 return wl_proxy_add_listener((struct wl_proxy*)wl_drm, |
| 139 (void (**)(void))listener, data); |
| 140 } |
| 141 |
| 142 #define WL_DRM_AUTHENTICATE 0 |
| 143 #define WL_DRM_CREATE_BUFFER 1 |
| 144 #define WL_DRM_CREATE_PLANAR_BUFFER 2 |
| 145 |
| 146 static inline void wl_drm_set_user_data(struct wl_drm* wl_drm, |
| 147 void* user_data) { |
| 148 wl_proxy_set_user_data((struct wl_proxy*)wl_drm, user_data); |
| 149 } |
| 150 |
| 151 static inline void* wl_drm_get_user_data(struct wl_drm* wl_drm) { |
| 152 return wl_proxy_get_user_data((struct wl_proxy*)wl_drm); |
| 153 } |
| 154 |
| 155 static inline void wl_drm_destroy(struct wl_drm* wl_drm) { |
| 156 wl_proxy_destroy((struct wl_proxy*)wl_drm); |
| 157 } |
| 158 |
| 159 static inline void wl_drm_authenticate(struct wl_drm* wl_drm, uint32_t id) { |
| 160 wl_proxy_marshal((struct wl_proxy*)wl_drm, WL_DRM_AUTHENTICATE, id); |
| 161 } |
| 162 |
| 163 static inline struct wl_buffer* wl_drm_create_buffer(struct wl_drm* wl_drm, |
| 164 uint32_t name, |
| 165 int32_t width, |
| 166 int32_t height, |
| 167 uint32_t stride, |
| 168 uint32_t format) { |
| 169 struct wl_proxy* id; |
| 170 |
| 171 id = wl_proxy_create((struct wl_proxy*)wl_drm, &wl_buffer_interface); |
| 172 if (!id) |
| 173 return NULL; |
| 174 |
| 175 wl_proxy_marshal((struct wl_proxy*)wl_drm, WL_DRM_CREATE_BUFFER, id, name, |
| 176 width, height, stride, format); |
| 177 |
| 178 return (struct wl_buffer*)id; |
| 179 } |
| 180 |
| 181 static inline struct wl_buffer* wl_drm_create_planar_buffer( |
| 182 struct wl_drm* wl_drm, |
| 183 uint32_t name, |
| 184 int32_t width, |
| 185 int32_t height, |
| 186 uint32_t format, |
| 187 int32_t offset0, |
| 188 int32_t stride0, |
| 189 int32_t offset1, |
| 190 int32_t stride1, |
| 191 int32_t offset2, |
| 192 int32_t stride2) { |
| 193 struct wl_proxy* id; |
| 194 |
| 195 id = wl_proxy_create((struct wl_proxy*)wl_drm, &wl_buffer_interface); |
| 196 if (!id) |
| 197 return NULL; |
| 198 |
| 199 wl_proxy_marshal((struct wl_proxy*)wl_drm, WL_DRM_CREATE_PLANAR_BUFFER, id, |
| 200 name, width, height, format, offset0, stride0, offset1, |
| 201 stride1, offset2, stride2); |
| 202 |
| 203 return (struct wl_buffer*)id; |
| 204 } |
| 205 |
| 206 #ifdef __cplusplus |
| 207 } |
| 208 #endif |
| 209 |
| 210 #endif |
OLD | NEW |