434 lines
11 KiB
C
434 lines
11 KiB
C
/* Generated by wayland-scanner 1.24.0 */
|
|
|
|
#ifndef WL_DRM_SERVER_PROTOCOL_H
|
|
#define WL_DRM_SERVER_PROTOCOL_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "wayland-server.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct wl_client;
|
|
struct wl_resource;
|
|
|
|
/**
|
|
* @page page_wl_drm The wl_drm protocol
|
|
* @section page_ifaces_wl_drm Interfaces
|
|
* - @subpage page_iface_wl_drm - Protocol for using DRM buffers
|
|
* @section page_copyright_wl_drm Copyright
|
|
* <pre>
|
|
*
|
|
* Copyright © 2008-2011 Kristian Høgsberg
|
|
* Copyright © 2010-2011 Intel Corporation
|
|
* Copyright © 2012-2013 Collabora, Ltd.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person
|
|
* obtaining a copy of this software and associated documentation files
|
|
* (the "Software"), to deal in the Software without restriction,
|
|
* including without limitation the rights to use, copy, modify, merge,
|
|
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
* and to permit persons to whom the Software is furnished to do so,
|
|
* subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice (including the
|
|
* next paragraph) shall be included in all copies or substantial
|
|
* portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
* </pre>
|
|
*/
|
|
struct wl_buffer;
|
|
struct wl_drm;
|
|
|
|
#ifndef WL_DRM_INTERFACE
|
|
#define WL_DRM_INTERFACE
|
|
/**
|
|
* @page page_iface_wl_drm wl_drm
|
|
* @section page_iface_wl_drm_desc Description
|
|
*
|
|
* This protocol is used to create buffers that are backed by DRM
|
|
* buffers.
|
|
*
|
|
* This protocol is deprecated and not intended for new clients.
|
|
* @section page_iface_wl_drm_api API
|
|
* See @ref iface_wl_drm.
|
|
*/
|
|
/**
|
|
* @defgroup iface_wl_drm The wl_drm interface
|
|
*
|
|
* This protocol is used to create buffers that are backed by DRM
|
|
* buffers.
|
|
*
|
|
* This protocol is deprecated and not intended for new clients.
|
|
*/
|
|
extern const struct wl_interface wl_drm_interface;
|
|
#endif
|
|
|
|
#ifndef WL_DRM_ERROR_ENUM
|
|
#define WL_DRM_ERROR_ENUM
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* wl_drm error values
|
|
*
|
|
* These errors can be emitted in response to wl_drm requests.
|
|
*/
|
|
enum wl_drm_error {
|
|
WL_DRM_ERROR_AUTHENTICATE_FAIL = 0,
|
|
WL_DRM_ERROR_INVALID_FORMAT = 1,
|
|
WL_DRM_ERROR_INVALID_NAME = 2,
|
|
};
|
|
#endif /* WL_DRM_ERROR_ENUM */
|
|
|
|
#ifndef WL_DRM_ERROR_ENUM_IS_VALID
|
|
#define WL_DRM_ERROR_ENUM_IS_VALID
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* Validate a wl_drm error value.
|
|
*
|
|
* @return true on success, false on error.
|
|
* @ref wl_drm_error
|
|
*/
|
|
static inline bool
|
|
wl_drm_error_is_valid(uint32_t value, uint32_t version) {
|
|
switch (value) {
|
|
case WL_DRM_ERROR_AUTHENTICATE_FAIL:
|
|
return version >= 1;
|
|
case WL_DRM_ERROR_INVALID_FORMAT:
|
|
return version >= 1;
|
|
case WL_DRM_ERROR_INVALID_NAME:
|
|
return version >= 1;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
#endif /* WL_DRM_ERROR_ENUM_IS_VALID */
|
|
|
|
#ifndef WL_DRM_FORMAT_ENUM
|
|
#define WL_DRM_FORMAT_ENUM
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* DRM format values
|
|
*
|
|
* DRM formats are defined by the DRM_FORMAT_* macros in
|
|
* drm_fourcc.h. A list of formats is also available at:
|
|
* https://dri.freedesktop.org/docs/drm/graphics/drm-fourcc.html
|
|
*/
|
|
enum wl_drm_format {
|
|
WL_DRM_FORMAT_C8 = 0x20203843,
|
|
WL_DRM_FORMAT_RGB332 = 0x38424752,
|
|
WL_DRM_FORMAT_BGR233 = 0x38524742,
|
|
WL_DRM_FORMAT_XRGB2101010 = 0x30335258,
|
|
WL_DRM_FORMAT_XBGR2101010 = 0x30334258,
|
|
WL_DRM_FORMAT_RGB565 = 0x36314752,
|
|
WL_DRM_FORMAT_BGR565 = 0x36314742,
|
|
WL_DRM_FORMAT_ABGR2101010 = 0x30334241,
|
|
WL_DRM_FORMAT_ARGB2101010 = 0x30335241,
|
|
WL_DRM_FORMAT_YUYV = 0x56595559,
|
|
WL_DRM_FORMAT_ARGB8888 = 0x34325241,
|
|
WL_DRM_FORMAT_XRGB8888 = 0x34325258,
|
|
WL_DRM_FORMAT_RGB888 = 0x34324752,
|
|
WL_DRM_FORMAT_BGR888 = 0x34324742,
|
|
WL_DRM_FORMAT_YV12 = 0x32315659,
|
|
WL_DRM_FORMAT_NV12 = 0x3231564e,
|
|
WL_DRM_FORMAT_NV21 = 0x3132564e,
|
|
WL_DRM_FORMAT_NV16 = 0x3631564e,
|
|
WL_DRM_FORMAT_NV61 = 0x3136564e,
|
|
WL_DRM_FORMAT_YU12 = 0x32315559,
|
|
WL_DRM_FORMAT_AYUV = 0x56555941,
|
|
WL_DRM_FORMAT_ARGB4444 = 0x32315241,
|
|
WL_DRM_FORMAT_RGBA4444 = 0x32315247,
|
|
WL_DRM_FORMAT_ABGR4444 = 0x32314241,
|
|
WL_DRM_FORMAT_XBGR4444 = 0x32314258,
|
|
WL_DRM_FORMAT_BGRA4444 = 0x32314247,
|
|
WL_DRM_FORMAT_ARGB1555 = 0x35315241,
|
|
WL_DRM_FORMAT_RGBA5551 = 0x35315547,
|
|
WL_DRM_FORMAT_ABGR1555 = 0x35314241,
|
|
WL_DRM_FORMAT_BGRA5551 = 0x35314247,
|
|
WL_DRM_FORMAT_ARGB8565 = 0x36355241,
|
|
WL_DRM_FORMAT_BGRA8565 = 0x36355242,
|
|
};
|
|
#endif /* WL_DRM_FORMAT_ENUM */
|
|
|
|
#ifndef WL_DRM_FORMAT_ENUM_IS_VALID
|
|
#define WL_DRM_FORMAT_ENUM_IS_VALID
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* Validate a wl_drm format value.
|
|
*
|
|
* @return true on success, false on error.
|
|
* @ref wl_drm_format
|
|
*/
|
|
static inline bool
|
|
wl_drm_format_is_valid(uint32_t value, uint32_t version) {
|
|
switch (value) {
|
|
case WL_DRM_FORMAT_C8:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_RGB332:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_BGR233:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_XRGB2101010:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_XBGR2101010:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_RGB565:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_BGR565:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_ABGR2101010:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_ARGB2101010:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_YUYV:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_ARGB8888:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_XRGB8888:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_RGB888:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_BGR888:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_YV12:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_NV12:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_NV21:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_NV16:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_NV61:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_YU12:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_AYUV:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_ARGB4444:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_RGBA4444:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_ABGR4444:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_XBGR4444:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_BGRA4444:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_ARGB1555:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_RGBA5551:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_ABGR1555:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_BGRA5551:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_ARGB8565:
|
|
return version >= 1;
|
|
case WL_DRM_FORMAT_BGRA8565:
|
|
return version >= 1;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
#endif /* WL_DRM_FORMAT_ENUM_IS_VALID */
|
|
|
|
#ifndef WL_DRM_CAPABILITY_ENUM
|
|
#define WL_DRM_CAPABILITY_ENUM
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* wl_drm capability bitmask
|
|
*
|
|
* Bitmask of capabilities.
|
|
*/
|
|
enum wl_drm_capability {
|
|
WL_DRM_CAPABILITY_PRIME = 1,
|
|
};
|
|
#endif /* WL_DRM_CAPABILITY_ENUM */
|
|
|
|
#ifndef WL_DRM_CAPABILITY_ENUM_IS_VALID
|
|
#define WL_DRM_CAPABILITY_ENUM_IS_VALID
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* Validate a wl_drm capability value.
|
|
*
|
|
* @return true on success, false on error.
|
|
* @ref wl_drm_capability
|
|
*/
|
|
static inline bool
|
|
wl_drm_capability_is_valid(uint32_t value, uint32_t version) {
|
|
switch (value) {
|
|
case WL_DRM_CAPABILITY_PRIME:
|
|
return version >= 1;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
#endif /* WL_DRM_CAPABILITY_ENUM_IS_VALID */
|
|
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* @struct wl_drm_interface
|
|
*/
|
|
struct wl_drm_interface {
|
|
/**
|
|
* Authenticate the DRM device
|
|
*
|
|
* This request authenticates the DRM device. The device name is
|
|
* sent with the device event.
|
|
*/
|
|
void (*authenticate)(struct wl_client *client,
|
|
struct wl_resource *resource,
|
|
uint32_t name);
|
|
/**
|
|
* Create a drm buffer object
|
|
*
|
|
* This request creates a wl_buffer object backed by a DRM
|
|
* buffer. The DRM buffer is created by the server.
|
|
*/
|
|
void (*create_buffer)(struct wl_client *client,
|
|
struct wl_resource *resource,
|
|
uint32_t name,
|
|
int32_t width,
|
|
int32_t height,
|
|
uint32_t stride,
|
|
uint32_t format,
|
|
uint32_t id);
|
|
/**
|
|
* Create a planar drm buffer object
|
|
*
|
|
* This request creates a wl_buffer object backed by a DRM
|
|
* buffer. The DRM buffer is created by the server. The buffer has
|
|
* multiple planes.
|
|
*/
|
|
void (*create_planar_buffer)(struct wl_client *client,
|
|
struct wl_resource *resource,
|
|
uint32_t name,
|
|
int32_t width,
|
|
int32_t height,
|
|
uint32_t format,
|
|
int32_t offset0,
|
|
int32_t stride0,
|
|
int32_t offset1,
|
|
int32_t stride1,
|
|
int32_t offset2,
|
|
int32_t stride2,
|
|
uint32_t id);
|
|
/**
|
|
* Create a buffer from a DMA-BUF file descriptor
|
|
*
|
|
* This request creates a wl_buffer object backed by a DMA-BUF
|
|
* file descriptor. The buffer can have one, two or three planes.
|
|
*/
|
|
void (*create_prime_buffer)(struct wl_client *client,
|
|
struct wl_resource *resource,
|
|
uint32_t name,
|
|
int32_t fd,
|
|
int32_t width,
|
|
int32_t height,
|
|
uint32_t format,
|
|
int32_t offset0,
|
|
int32_t stride0,
|
|
int32_t offset1,
|
|
int32_t stride1,
|
|
int32_t offset2,
|
|
int32_t stride2,
|
|
uint32_t id);
|
|
};
|
|
|
|
#define WL_DRM_DEVICE 0
|
|
#define WL_DRM_FORMAT 1
|
|
#define WL_DRM_AUTHENTICATED 2
|
|
#define WL_DRM_CAPABILITIES 3
|
|
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
*/
|
|
#define WL_DRM_DEVICE_SINCE_VERSION 1
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
*/
|
|
#define WL_DRM_FORMAT_SINCE_VERSION 1
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
*/
|
|
#define WL_DRM_AUTHENTICATED_SINCE_VERSION 1
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
*/
|
|
#define WL_DRM_CAPABILITIES_SINCE_VERSION 1
|
|
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
*/
|
|
#define WL_DRM_AUTHENTICATE_SINCE_VERSION 1
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
*/
|
|
#define WL_DRM_CREATE_BUFFER_SINCE_VERSION 1
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
*/
|
|
#define WL_DRM_CREATE_PLANAR_BUFFER_SINCE_VERSION 1
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
*/
|
|
#define WL_DRM_CREATE_PRIME_BUFFER_SINCE_VERSION 1
|
|
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* Sends an device event to the client owning the resource.
|
|
* @param resource_ The client's resource
|
|
*/
|
|
static inline void
|
|
wl_drm_send_device(struct wl_resource *resource_, int32_t fd, const char *name)
|
|
{
|
|
wl_resource_post_event(resource_, WL_DRM_DEVICE, fd, name);
|
|
}
|
|
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* Sends an format event to the client owning the resource.
|
|
* @param resource_ The client's resource
|
|
*/
|
|
static inline void
|
|
wl_drm_send_format(struct wl_resource *resource_, uint32_t format)
|
|
{
|
|
wl_resource_post_event(resource_, WL_DRM_FORMAT, format);
|
|
}
|
|
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* Sends an authenticated event to the client owning the resource.
|
|
* @param resource_ The client's resource
|
|
*/
|
|
static inline void
|
|
wl_drm_send_authenticated(struct wl_resource *resource_)
|
|
{
|
|
wl_resource_post_event(resource_, WL_DRM_AUTHENTICATED);
|
|
}
|
|
|
|
/**
|
|
* @ingroup iface_wl_drm
|
|
* Sends an capabilities event to the client owning the resource.
|
|
* @param resource_ The client's resource
|
|
*/
|
|
static inline void
|
|
wl_drm_send_capabilities(struct wl_resource *resource_, uint32_t value)
|
|
{
|
|
wl_resource_post_event(resource_, WL_DRM_CAPABILITIES, value);
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|