2 * Copyright © 2012 Collabora, Ltd.
4 * Permission to use, copy, modify, distribute, and sell this
5 * software and its documentation for any purpose is hereby granted
6 * without fee, provided that the above copyright notice appear in
7 * all copies and that both that copyright notice and this permission
8 * notice appear in supporting documentation, and that the name of
9 * the copyright holders not be used in advertising or publicity
10 * pertaining to distribution of the software without specific,
11 * written prior permission. The copyright holders make no
12 * representations about the suitability of this software for any
13 * purpose. It is provided "as is" without express or implied
16 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
21 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
26 #ifndef ANDROID_CLIENT_PROTOCOL_H
27 #define ANDROID_CLIENT_PROTOCOL_H
35 #include "wayland-client.h"
41 struct android_wlegl_handle
;
43 extern const struct wl_interface android_wlegl_interface
;
44 extern const struct wl_interface android_wlegl_handle_interface
;
46 #ifndef ANDROID_WLEGL_ERROR_ENUM
47 #define ANDROID_WLEGL_ERROR_ENUM
48 enum android_wlegl_error
{
49 ANDROID_WLEGL_ERROR_BAD_HANDLE
= 0,
50 ANDROID_WLEGL_ERROR_BAD_VALUE
= 1,
52 #endif /* ANDROID_WLEGL_ERROR_ENUM */
54 #define ANDROID_WLEGL_CREATE_HANDLE 0
55 #define ANDROID_WLEGL_CREATE_BUFFER 1
58 android_wlegl_set_user_data(struct android_wlegl
*android_wlegl
, void *user_data
)
60 wl_proxy_set_user_data((struct wl_proxy
*) android_wlegl
, user_data
);
64 android_wlegl_get_user_data(struct android_wlegl
*android_wlegl
)
66 return wl_proxy_get_user_data((struct wl_proxy
*) android_wlegl
);
70 android_wlegl_destroy(struct android_wlegl
*android_wlegl
)
72 wl_proxy_destroy((struct wl_proxy
*) android_wlegl
);
75 static inline struct android_wlegl_handle
*
76 android_wlegl_create_handle(struct android_wlegl
*android_wlegl
, int32_t num_fds
, struct wl_array
*ints
)
80 id
= wl_proxy_create((struct wl_proxy
*) android_wlegl
,
81 &android_wlegl_handle_interface
);
85 wl_proxy_marshal((struct wl_proxy
*) android_wlegl
,
86 ANDROID_WLEGL_CREATE_HANDLE
, id
, num_fds
, ints
);
88 return (struct android_wlegl_handle
*) id
;
91 static inline struct wl_buffer
*
92 android_wlegl_create_buffer(struct android_wlegl
*android_wlegl
, int32_t width
, int32_t height
, int32_t stride
, int32_t format
, int32_t usage
, struct android_wlegl_handle
*native_handle
)
96 id
= wl_proxy_create((struct wl_proxy
*) android_wlegl
,
97 &wl_buffer_interface
);
101 wl_proxy_marshal((struct wl_proxy
*) android_wlegl
,
102 ANDROID_WLEGL_CREATE_BUFFER
, id
, width
, height
, stride
, format
, usage
, native_handle
);
104 return (struct wl_buffer
*) id
;
107 #ifndef ANDROID_WLEGL_HANDLE_ERROR_ENUM
108 #define ANDROID_WLEGL_HANDLE_ERROR_ENUM
109 enum android_wlegl_handle_error
{
110 ANDROID_WLEGL_HANDLE_ERROR_TOO_MANY_FDS
= 0,
112 #endif /* ANDROID_WLEGL_HANDLE_ERROR_ENUM */
114 #define ANDROID_WLEGL_HANDLE_ADD_FD 0
115 #define ANDROID_WLEGL_HANDLE_DESTROY 1
118 android_wlegl_handle_set_user_data(struct android_wlegl_handle
*android_wlegl_handle
, void *user_data
)
120 wl_proxy_set_user_data((struct wl_proxy
*) android_wlegl_handle
, user_data
);
124 android_wlegl_handle_get_user_data(struct android_wlegl_handle
*android_wlegl_handle
)
126 return wl_proxy_get_user_data((struct wl_proxy
*) android_wlegl_handle
);
130 android_wlegl_handle_add_fd(struct android_wlegl_handle
*android_wlegl_handle
, int32_t fd
)
132 wl_proxy_marshal((struct wl_proxy
*) android_wlegl_handle
,
133 ANDROID_WLEGL_HANDLE_ADD_FD
, fd
);
137 android_wlegl_handle_destroy(struct android_wlegl_handle
*android_wlegl_handle
)
139 wl_proxy_marshal((struct wl_proxy
*) android_wlegl_handle
,
140 ANDROID_WLEGL_HANDLE_DESTROY
);
142 wl_proxy_destroy((struct wl_proxy
*) android_wlegl_handle
);