/* Generated by wayland-scanner 1.26.0 */ #ifndef ANDROID_SERVER_PROTOCOL_H #define ANDROID_SERVER_PROTOCOL_H #include #include #include "wayland-server.h" #ifdef __cplusplus extern "C" { #endif struct wl_client; struct wl_resource; /** * @page page_android The android protocol * @section page_ifaces_android Interfaces * - @subpage page_iface_android_wlegl - Android EGL graphics buffer support * - @subpage page_iface_android_wlegl_handle - An Android native_handle_t object * - @subpage page_iface_android_wlegl_server_buffer_handle - a server allocated buffer * @section page_copyright_android Copyright *
 *
 * Copyright © 2012 Collabora, Ltd.
 *
 * Permission to use, copy, modify, distribute, and sell this
 * software and its documentation for any purpose is hereby granted
 * without fee, provided that the above copyright notice appear in
 * all copies and that both that copyright notice and this permission
 * notice appear in supporting documentation, and that the name of
 * the copyright holders not be used in advertising or publicity
 * pertaining to distribution of the software without specific,
 * written prior permission.  The copyright holders make no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied
 * warranty.
 *
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
 * THIS SOFTWARE.
 * 
*/ struct android_wlegl; struct android_wlegl_handle; struct android_wlegl_server_buffer_handle; struct wl_buffer; #ifndef ANDROID_WLEGL_INTERFACE #define ANDROID_WLEGL_INTERFACE /** * @page page_iface_android_wlegl android_wlegl * @section page_iface_android_wlegl_desc Description * * Interface used in the Android wrapper libEGL to share * graphics buffers between the server and the client. * @section page_iface_android_wlegl_api API * See @ref iface_android_wlegl. */ /** * @defgroup iface_android_wlegl The android_wlegl interface * * Interface used in the Android wrapper libEGL to share * graphics buffers between the server and the client. */ extern const struct wl_interface android_wlegl_interface; #endif #ifndef ANDROID_WLEGL_HANDLE_INTERFACE #define ANDROID_WLEGL_HANDLE_INTERFACE /** * @page page_iface_android_wlegl_handle android_wlegl_handle * @section page_iface_android_wlegl_handle_desc Description * * The Android native_handle_t is a semi-opaque object, that * contains an EGL implementation specific number of int32 * values and file descriptors. * * We cannot send a variable size array of file descriptors * over the Wayland protocol, so we send them one by one. * @section page_iface_android_wlegl_handle_api API * See @ref iface_android_wlegl_handle. */ /** * @defgroup iface_android_wlegl_handle The android_wlegl_handle interface * * The Android native_handle_t is a semi-opaque object, that * contains an EGL implementation specific number of int32 * values and file descriptors. * * We cannot send a variable size array of file descriptors * over the Wayland protocol, so we send them one by one. */ extern const struct wl_interface android_wlegl_handle_interface; #endif #ifndef ANDROID_WLEGL_SERVER_BUFFER_HANDLE_INTERFACE #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_INTERFACE /** * @page page_iface_android_wlegl_server_buffer_handle android_wlegl_server_buffer_handle * @section page_iface_android_wlegl_server_buffer_handle_desc Description * * On creation a server_side_buffer object will immediately send * the "buffer_fd" and "buffer_ints" events needed by the client to * reference the gralloc buffer, followed by the "buffer" event carrying * the wl_buffer object. * @section page_iface_android_wlegl_server_buffer_handle_api API * See @ref iface_android_wlegl_server_buffer_handle. */ /** * @defgroup iface_android_wlegl_server_buffer_handle The android_wlegl_server_buffer_handle interface * * On creation a server_side_buffer object will immediately send * the "buffer_fd" and "buffer_ints" events needed by the client to * reference the gralloc buffer, followed by the "buffer" event carrying * the wl_buffer object. */ extern const struct wl_interface android_wlegl_server_buffer_handle_interface; #endif #ifndef ANDROID_WLEGL_ERROR_ENUM #define ANDROID_WLEGL_ERROR_ENUM enum android_wlegl_error { ANDROID_WLEGL_ERROR_BAD_HANDLE = 0, ANDROID_WLEGL_ERROR_BAD_VALUE = 1, }; #endif /* ANDROID_WLEGL_ERROR_ENUM */ #ifndef ANDROID_WLEGL_ERROR_ENUM_IS_VALID #define ANDROID_WLEGL_ERROR_ENUM_IS_VALID /** * @ingroup iface_android_wlegl * Validate a android_wlegl error value. * * @return true on success, false on error. * @ref android_wlegl_error */ static inline bool android_wlegl_error_is_valid(uint32_t value, uint32_t version) { switch (value) { case ANDROID_WLEGL_ERROR_BAD_HANDLE: return version >= 1; case ANDROID_WLEGL_ERROR_BAD_VALUE: return version >= 1; default: return false; } } #endif /* ANDROID_WLEGL_ERROR_ENUM_IS_VALID */ /** * @ingroup iface_android_wlegl * @struct android_wlegl_interface */ struct android_wlegl_interface { /** * Create an Android native_handle_t object * * This creator method initialises the native_handle_t object * with everything except the file descriptors, which have to be * submitted separately. * @param ints an array of int32_t */ void (*create_handle)(struct wl_client *client, struct wl_resource *resource, uint32_t id, int32_t num_fds, struct wl_array *ints); /** * Create a wl_buffer from the native handle * * Pass the Android native_handle_t to the server and attach it * to the new wl_buffer object. * * The android_wlegl_handle object must be destroyed immediately * after this request. */ void (*create_buffer)(struct wl_client *client, struct wl_resource *resource, uint32_t id, int32_t width, int32_t height, int32_t stride, int32_t format, int32_t usage, struct wl_resource *native_handle); /** * @since 2 */ void (*get_server_buffer_handle)(struct wl_client *client, struct wl_resource *resource, uint32_t id, int32_t width, int32_t height, int32_t format, int32_t usage); }; /** * @ingroup iface_android_wlegl */ #define ANDROID_WLEGL_CREATE_HANDLE_SINCE_VERSION 1 /** * @ingroup iface_android_wlegl */ #define ANDROID_WLEGL_CREATE_BUFFER_SINCE_VERSION 1 /** * @ingroup iface_android_wlegl */ #define ANDROID_WLEGL_GET_SERVER_BUFFER_HANDLE_SINCE_VERSION 2 #ifndef ANDROID_WLEGL_HANDLE_ERROR_ENUM #define ANDROID_WLEGL_HANDLE_ERROR_ENUM enum android_wlegl_handle_error { ANDROID_WLEGL_HANDLE_ERROR_TOO_MANY_FDS = 0, }; #endif /* ANDROID_WLEGL_HANDLE_ERROR_ENUM */ #ifndef ANDROID_WLEGL_HANDLE_ERROR_ENUM_IS_VALID #define ANDROID_WLEGL_HANDLE_ERROR_ENUM_IS_VALID /** * @ingroup iface_android_wlegl_handle * Validate a android_wlegl_handle error value. * * @return true on success, false on error. * @ref android_wlegl_handle_error */ static inline bool android_wlegl_handle_error_is_valid(uint32_t value, uint32_t version) { switch (value) { case ANDROID_WLEGL_HANDLE_ERROR_TOO_MANY_FDS: return version >= 1; default: return false; } } #endif /* ANDROID_WLEGL_HANDLE_ERROR_ENUM_IS_VALID */ /** * @ingroup iface_android_wlegl_handle * @struct android_wlegl_handle_interface */ struct android_wlegl_handle_interface { /** */ void (*add_fd)(struct wl_client *client, struct wl_resource *resource, int32_t fd); /** */ void (*destroy)(struct wl_client *client, struct wl_resource *resource); }; /** * @ingroup iface_android_wlegl_handle */ #define ANDROID_WLEGL_HANDLE_ADD_FD_SINCE_VERSION 1 /** * @ingroup iface_android_wlegl_handle */ #define ANDROID_WLEGL_HANDLE_DESTROY_SINCE_VERSION 1 #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER_FD 0 #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER_INTS 1 #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER 2 #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_LINEAR_LAYOUT 3 /** * @ingroup iface_android_wlegl_server_buffer_handle */ #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER_FD_SINCE_VERSION 1 /** * @ingroup iface_android_wlegl_server_buffer_handle */ #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER_INTS_SINCE_VERSION 1 /** * @ingroup iface_android_wlegl_server_buffer_handle */ #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER_SINCE_VERSION 1 /** * @ingroup iface_android_wlegl_server_buffer_handle */ #define ANDROID_WLEGL_SERVER_BUFFER_HANDLE_LINEAR_LAYOUT_SINCE_VERSION 3 /** * @ingroup iface_android_wlegl_server_buffer_handle * Sends an buffer_fd event to the client owning the resource. * @param resource_ The client's resource */ static inline void android_wlegl_server_buffer_handle_send_buffer_fd(struct wl_resource *resource_, int32_t fd) { wl_resource_post_event(resource_, ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER_FD, fd); } /** * @ingroup iface_android_wlegl_server_buffer_handle * Sends an buffer_ints event to the client owning the resource. * @param resource_ The client's resource */ static inline void android_wlegl_server_buffer_handle_send_buffer_ints(struct wl_resource *resource_, struct wl_array *ints) { wl_resource_post_event(resource_, ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER_INTS, ints); } /** * @ingroup iface_android_wlegl_server_buffer_handle * Sends an buffer event to the client owning the resource. * @param resource_ The client's resource */ static inline void android_wlegl_server_buffer_handle_send_buffer(struct wl_resource *resource_, struct wl_resource *buffer, int32_t format, int32_t stride) { wl_resource_post_event(resource_, ANDROID_WLEGL_SERVER_BUFFER_HANDLE_BUFFER, buffer, format, stride); } /** * @ingroup iface_android_wlegl_server_buffer_handle * Sends an linear_layout event to the client owning the resource. * @param resource_ The client's resource */ static inline void android_wlegl_server_buffer_handle_send_linear_layout(struct wl_resource *resource_, uint32_t drm_format, uint32_t stride) { wl_resource_post_event(resource_, ANDROID_WLEGL_SERVER_BUFFER_HANDLE_LINEAR_LAYOUT, drm_format, stride); } #ifdef __cplusplus } #endif #endif