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_SERVER_PROTOCOL_H
27 #define ANDROID_SERVER_PROTOCOL_H
35 #include "wayland-util.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 */
55 * android_wlegl - Android EGL graphics buffer support
56 * @create_handle: Create an Android native_handle_t object
57 * @create_buffer: Create a wl_buffer from the native handle
59 * Interface used in the Android wrapper libEGL to share graphics buffers
60 * between the server and the client.
62 struct android_wlegl_interface
{
64 * create_handle - Create an Android native_handle_t object
67 * @ints: an array of int32_t
69 * This creator method initialises the native_handle_t object
70 * with everything except the file descriptors, which have to be
71 * submitted separately.
73 void (*create_handle
)(struct wl_client
*client
,
74 struct wl_resource
*resource
,
77 struct wl_array
*ints
);
79 * create_buffer - Create a wl_buffer from the native handle
86 * @native_handle: (none)
88 * Pass the Android native_handle_t to the server and attach it
89 * to the new wl_buffer object.
91 * The android_wlegl_handle object must be destroyed immediately
94 void (*create_buffer
)(struct wl_client
*client
,
95 struct wl_resource
*resource
,
102 struct wl_resource
*native_handle
);
105 #ifndef ANDROID_WLEGL_HANDLE_ERROR_ENUM
106 #define ANDROID_WLEGL_HANDLE_ERROR_ENUM
107 enum android_wlegl_handle_error
{
108 ANDROID_WLEGL_HANDLE_ERROR_TOO_MANY_FDS
= 0,
110 #endif /* ANDROID_WLEGL_HANDLE_ERROR_ENUM */
113 * android_wlegl_handle - An Android native_handle_t object
117 * The Android native_handle_t is a semi-opaque object, that contains an
118 * EGL implementation specific number of int32 values and file descriptors.
120 * We cannot send a variable size array of file descriptors over the
121 * Wayland protocol, so we send them one by one.
123 struct android_wlegl_handle_interface
{
128 void (*add_fd
)(struct wl_client
*client
,
129 struct wl_resource
*resource
,
134 void (*destroy
)(struct wl_client
*client
,
135 struct wl_resource
*resource
);