swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit a1aae65a05d412c885fa89a01663c44860770b48
parent 69d843060d7a965c96db0046dc5b6dc1fa75cc6b
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 11 Sep 2013 15:00:09 -0700

drm: Use our own wl_drm implementation based on wld

Diffstat:
MMakefile.am | 2+-
Mconfigure.ac | 7++++++-
Mlibswc/Makefile.am | 7++++---
Mlibswc/compositor.c | 21++-------------------
Mlibswc/compositor.h | 2--
Mlibswc/drm.c | 174++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
Mlibswc/drm.h | 3+++
Alibswc/drm_buffer.c | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Alibswc/drm_buffer.h | 44++++++++++++++++++++++++++++++++++++++++++++
Dlibswc/egl.c | 86-------------------------------------------------------------------------------
Dlibswc/egl.h | 25-------------------------
Aprotocol/Makefile.am | 8++++++++
Aprotocol/wayland-drm.xml | 182+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
13 files changed, 477 insertions(+), 160 deletions(-)

diff --git a/Makefile.am b/Makefile.am @@ -2,5 +2,5 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = launch libswc +SUBDIRS = launch protocol libswc diff --git a/configure.ac b/configure.ac @@ -29,10 +29,15 @@ PKG_CHECK_MODULES([intelbatch], [intelbatch]) PKG_CHECK_MODULES([gbm], [gbm]) PKG_CHECK_MODULES([egl], [egl]) PKG_CHECK_MODULES([pixman], [pixman-1]) +PKG_CHECK_MODULES([wld], [wld]) PKG_CHECK_MODULES([wayland_client], [wayland-client]) dnl }}} -AC_CONFIG_FILES([Makefile libswc/Makefile launch/Makefile]) +dnl Wayland protocol +AC_SUBST(PROTOCOL_DIR, ['$(top_builddir)/protocol']) +WAYLAND_SCANNER_RULES(['$(top_srcdir)/protocol']) + +AC_CONFIG_FILES([Makefile libswc/Makefile launch/Makefile protocol/Makefile]) AC_OUTPUT diff --git a/libswc/Makefile.am b/libswc/Makefile.am @@ -1,6 +1,6 @@ # swc: libswc/Makefile.am -AM_CPPFLAGS = -I$(top_srcdir) +AM_CPPFLAGS = -I$(top_srcdir) -I$(PROTOCOL_DIR) AM_CFLAGS = $(pixman_CFLAGS) $(drm_CFLAGS) $(intelbatch_CFLAGS) lib_LTLIBRARIES = libswc.la @@ -27,10 +27,11 @@ libswc_la_SOURCES = \ evdev_device.c evdev_device.h \ xkb.c xkb.h \ drm.c drm.h \ - egl.c egl.h + drm_buffer.c drm_buffer.h \ + $(PROTOCOL_DIR)/wayland-drm-protocol.c libswc_la_LIBADD = $(wayland_server_LIBS) $(udev_LIBS) $(xkbcommon_LIBS) \ $(drm_LIBS) $(drm_intel_LIBS) $(gbm_LIBS) $(egl_LIBS) \ - $(pixman_LIBS) $(intelbatch_LIBS) \ + $(pixman_LIBS) $(intelbatch_LIBS) $(wld_LIBS) \ ../launch/liblaunch-protocol.la diff --git a/libswc/compositor.c b/libswc/compositor.c @@ -346,24 +346,11 @@ bool swc_compositor_initialize(struct swc_compositor * compositor, goto error_drm; } - if (!swc_egl_initialize(&compositor->egl, compositor->gbm)) - { - printf("could not initialize egl\n"); - goto error_gbm; - } - - if (!swc_egl_bind_display(&compositor->egl, compositor->display)) - { - printf("could not bind egl display\n"); - swc_egl_finish(&compositor->egl); - goto error_gbm; - } - if (!swc_renderer_initialize(&compositor->renderer, &compositor->drm, compositor->gbm)) { printf("could not initialize renderer\n"); - goto error_egl; + goto error_gbm; } outputs = swc_drm_create_outputs(&compositor->drm); @@ -400,9 +387,6 @@ bool swc_compositor_initialize(struct swc_compositor * compositor, error_renderer: swc_renderer_finalize(&compositor->renderer); - error_egl: - swc_egl_unbind_display(&compositor->egl, compositor->display); - swc_egl_finish(&compositor->egl); error_gbm: gbm_device_destroy(compositor->gbm); error_drm: @@ -431,8 +415,6 @@ void swc_compositor_finish(struct swc_compositor * compositor) free(output); } - swc_egl_unbind_display(&compositor->egl, compositor->display); - swc_egl_finish(&compositor->egl); gbm_device_destroy(compositor->gbm); swc_drm_finish(&compositor->drm); swc_seat_finish(&compositor->seat); @@ -450,6 +432,7 @@ void swc_compositor_add_globals(struct swc_compositor * compositor, swc_data_device_manager_add_globals(display); swc_seat_add_globals(&compositor->seat, display); + swc_drm_add_globals(&compositor->drm, display); wl_list_for_each(output, &compositor->outputs, link) { diff --git a/libswc/compositor.h b/libswc/compositor.h @@ -6,7 +6,6 @@ #include "drm.h" #include "tty.h" #include "seat.h" -#include "egl.h" #include "binding.h" #include "renderer.h" @@ -20,7 +19,6 @@ struct swc_compositor struct swc_tty tty; struct swc_seat seat; struct swc_drm drm; - struct swc_egl egl; struct swc_renderer renderer; struct wl_list outputs; diff --git a/libswc/drm.c b/libswc/drm.c @@ -1,3 +1,31 @@ +/* swc: drm.c + * + * Copyright (c) 2013 Michael Forney + * + * 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 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. + */ + +#include "drm.h" +#include "drm_buffer.h" +#include "output.h" +#include "event.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -6,15 +34,103 @@ #include <libudev.h> #include <libdrm/drm.h> #include <xf86drm.h> -#include <libdrm/i915_drm.h> -#include <libdrm/intel_bufmgr.h> -#include <intelbatch/batch.h> -//#include <xf86drmMode.h> +#include <wld/wld.h> +#include <wld/drm.h> #include <wayland-util.h> +#include <wayland-drm-server-protocol.h> -#include "drm.h" -#include "output.h" -#include "event.h" +static void authenticate(struct wl_client * client, + struct wl_resource * resource, uint32_t magic) +{ + struct swc_drm * drm = wl_resource_get_user_data(resource); + int ret; + + if ((ret = drmAuthMagic(drm->fd, magic)) == 0) + wl_drm_send_authenticated(resource); + else + { + wl_resource_post_error(resource, WL_DRM_ERROR_AUTHENTICATE_FAIL, + "drmAuthMagic failed: %d\n", ret); + } +} + +static void create_buffer(struct wl_client * client, + struct wl_resource * resource, uint32_t id, + uint32_t name, int32_t width, int32_t height, + uint32_t stride, uint32_t format) +{ + struct swc_drm * drm = wl_resource_get_user_data(resource); + struct wld_drawable * drawable; + struct swc_drm_buffer * buffer; + + drawable = wld_drm_import_gem(drm->context, width, height, format, + name, stride); + + if (!drawable) + goto error0; + + buffer = swc_drm_buffer_new(client, id, drawable); + + if (!buffer) + goto error1; + + return; + + error1: + wld_destroy_drawable(drawable); + error0: + wl_resource_post_no_memory(resource); +} + +static void create_planar_buffer(struct wl_client * client, + struct wl_resource * resource, uint32_t id, + 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) +{ + wl_resource_post_error(resource, WL_DRM_ERROR_INVALID_FORMAT, + "planar buffers are not supported\n"); +} + +static void create_prime_buffer(struct wl_client * client, + struct wl_resource * resource, uint32_t id, + 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) +{ + struct swc_drm * drm = wl_resource_get_user_data(resource); + struct wld_drawable * drawable; + struct swc_drm_buffer * buffer; + + drawable = wld_drm_import(drm->context, width, height, format, fd, stride0); + close(fd); + + if (!drawable) + goto error0; + + buffer = swc_drm_buffer_new(client, id, drawable); + + if (!buffer) + goto error1; + + return; + + error1: + wld_destroy_drawable(drawable); + error0: + wl_resource_post_no_memory(resource); +} + +static const struct wl_drm_interface drm_implementation = { + .authenticate = &authenticate, + .create_buffer = &create_buffer, + .create_planar_buffer = &create_planar_buffer, + .create_prime_buffer = &create_prime_buffer +}; static struct udev_device * find_primary_drm_device(struct udev * udev, const char * seat) @@ -192,8 +308,8 @@ bool swc_drm_initialize(struct swc_drm * drm, struct udev * udev, printf("sysnum: %s\n", sysnum); - device_path = udev_device_get_devnode(drm_device); - drm->fd = open(device_path, O_RDWR | O_CLOEXEC); + drm->path = strdup(udev_device_get_devnode(drm_device)); + drm->fd = open(drm->path, O_RDWR | O_CLOEXEC); if (drm->fd == -1) { @@ -207,23 +323,10 @@ bool swc_drm_initialize(struct swc_drm * drm, struct udev * udev, goto error_fd; } - drm->bufmgr = drm_intel_bufmgr_gem_init(drm->fd, INTEL_MAX_COMMANDS << 2); - - if (!drm->bufmgr) - { - printf("could not create bufmgr\n"); - goto error_wld; - } - - //drm_intel_bufmgr_set_debug(drm->bufmgr, true); - drm_intel_bufmgr_gem_enable_fenced_relocs(drm->bufmgr); - udev_device_unref(drm_device); return true; - error_wld: - wld_drm_destroy_context(drm->context); error_fd: close(drm->fd); error_device: @@ -235,7 +338,7 @@ bool swc_drm_initialize(struct swc_drm * drm, struct udev * udev, void swc_drm_finish(struct swc_drm * drm) { wld_drm_destroy_context(drm->context); - drm_intel_bufmgr_destroy(drm->bufmgr); + free(drm->path); close(drm->fd); } @@ -246,6 +349,31 @@ void swc_drm_add_event_sources(struct swc_drm * drm, &handle_data, NULL); } +static void bind_drm(struct wl_client * client, void * data, uint32_t version, + uint32_t id) +{ + struct swc_drm * drm = data; + struct wl_resource * resource; + + if (version >= 2) + version = 2; + + resource = wl_resource_create(client, &wl_drm_interface, version, id); + wl_resource_set_implementation(resource, &drm_implementation, drm, NULL); + + if (version >= 2) + wl_drm_send_capabilities(resource, WL_DRM_CAPABILITY_PRIME); + + wl_drm_send_device(resource, drm->path); + wl_drm_send_format(resource, WL_DRM_FORMAT_XRGB8888); + wl_drm_send_format(resource, WL_DRM_FORMAT_ARGB8888); +} + +void swc_drm_add_globals(struct swc_drm * drm, struct wl_display * display) +{ + wl_global_create(display, &wl_drm_interface, 2, drm, &bind_drm); +} + void swc_drm_set_master(struct swc_drm * drm) { printf("setting drm master\n"); diff --git a/libswc/drm.h b/libswc/drm.h @@ -19,6 +19,7 @@ struct swc_drm { int fd; uint32_t id; + char * path; drm_intel_bufmgr * bufmgr; struct wld_drm_context * context; @@ -38,6 +39,8 @@ void swc_drm_finish(struct swc_drm * drm); void swc_drm_add_event_sources(struct swc_drm * drm, struct wl_event_loop * event_loop); +void swc_drm_add_globals(struct swc_drm * drm, struct wl_display * display); + void swc_drm_set_master(struct swc_drm * drm); void swc_drm_drop_master(struct swc_drm * drm); diff --git a/libswc/drm_buffer.c b/libswc/drm_buffer.c @@ -0,0 +1,76 @@ +/* swc: drm_buffer.c + * + * Copyright (c) 2013 Michael Forney + * + * 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 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. + */ + +#include "drm_buffer.h" + +#include <stdlib.h> +#include <wayland-server.h> +#include <wayland-drm-server-protocol.h> +#include <wld/wld.h> + +static void destroy(struct wl_client * client, struct wl_resource * resource) +{ + wl_resource_destroy(resource); +} + +static const struct wl_buffer_interface drm_buffer_implementation = { + .destroy = &destroy +}; + +static void buffer_destroy(struct wl_resource * resource) +{ + struct swc_drm_buffer * buffer = wl_resource_get_user_data(resource); + + wld_destroy_drawable(buffer->drawable); + free(buffer); +} + +struct swc_drm_buffer * swc_drm_buffer_new + (struct wl_client * client, uint32_t id, struct wld_drawable * drawable) +{ + struct swc_drm_buffer * buffer; + + buffer = malloc(sizeof *buffer); + + if (!buffer) + return NULL; + + buffer->resource = wl_resource_create(client, &wl_buffer_interface, 1, id); + wl_resource_set_implementation(buffer->resource, &drm_buffer_implementation, + buffer, &buffer_destroy); + buffer->drawable = drawable; + + return buffer; +} + +struct swc_drm_buffer * swc_drm_buffer_get(struct wl_resource * resource) +{ + if (wl_resource_instance_of(resource, &wl_buffer_interface, + &drm_buffer_implementation)) + { + return wl_resource_get_user_data(resource); + } + else + return NULL; +} + diff --git a/libswc/drm_buffer.h b/libswc/drm_buffer.h @@ -0,0 +1,44 @@ +/* swc: drm_buffer.h + * + * Copyright (c) 2013 Michael Forney + * + * 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 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. + */ + +#ifndef SWC_DRM_BUFFER_H +#define SWC_DRM_BUFFER_H 1 + +#include <stdint.h> + +struct wl_resource; +struct wl_client; + +struct swc_drm_buffer +{ + struct wl_resource * resource; + struct wld_drawable * drawable; +}; + +struct swc_drm_buffer * swc_drm_buffer_new + (struct wl_client * client, uint32_t id, struct wld_drawable * drawable); + +struct swc_drm_buffer * swc_drm_buffer_get(struct wl_resource * resource); + +#endif + diff --git a/libswc/egl.c b/libswc/egl.c @@ -1,86 +0,0 @@ -#include "egl.h" - -#include <stdio.h> -#include <string.h> - -#define EGL_EGLEXT_PROTOTYPES -#include <EGL/eglext.h> -#undef EGL_EGLEXT_PROTOTYPES - -bool swc_egl_initialize(struct swc_egl * egl, struct gbm_device * gbm) -{ - const char * extensions; - - egl->display = eglGetDisplay(gbm); - - if (egl->display == NULL) - { - printf("could not create egl display\n"); - goto error_base; - } - - if (!eglInitialize(egl->display, NULL, NULL)) - { - printf("could not initialize egl display\n"); - goto error_base; - } - -#if EGL_WL_bind_wayland_display - extensions = eglQueryString(egl->display, EGL_EXTENSIONS); - - if (!extensions) - { - printf("could not query EGL extensions\n"); - goto error_display; - } - - if (strstr(extensions, "EGL_WL_bind_wayland_display")) - egl->has_bind_wayland_display = true; - else - { - printf("warning: headers claim EGL_WL_bind_wayland_display exists, " - "but it is not in the queried extension list\n"); - egl->has_bind_wayland_display = false; - } -#else - printf("don't have EGL_WL_bind_wayland_display extension\n"); - egl->has_bind_wayland_display = false; -#endif - - return true; - - error_display: - eglTerminate(egl->display); - eglReleaseThread(); - error_base: - return false; -} - -void swc_egl_finish(struct swc_egl * egl) -{ - eglTerminate(egl->display); - eglReleaseThread(); -} - -bool swc_egl_bind_display(struct swc_egl * egl, struct wl_display * display) -{ -#if EGL_WL_bind_wayland_display - if (egl->has_bind_wayland_display) - return eglBindWaylandDisplayWL(egl->display, display); -#endif - - /* If we don't have this extension, just continue normally. */ - return true; -} - -bool swc_egl_unbind_display(struct swc_egl * egl, struct wl_display * display) -{ -#if EGL_WL_bind_wayland_display - if (egl->has_bind_wayland_display) - return eglUnbindWaylandDisplayWL(egl->display, display); -#endif - - /* If we don't have this extension, just continue normally. */ - return true; -} - diff --git a/libswc/egl.h b/libswc/egl.h @@ -1,25 +0,0 @@ -#ifndef SWC_EGL_H -#define SWC_EGL_H 1 - -#include <stdlib.h> -#include <stdbool.h> -#include <wayland-server.h> -#include <gbm.h> -#include <EGL/egl.h> - -struct swc_egl -{ - EGLDisplay display; - bool has_bind_wayland_display; -}; - -bool swc_egl_initialize(struct swc_egl * egl, struct gbm_device * gbm); - -void swc_egl_finish(struct swc_egl * egl); - -bool swc_egl_bind_display(struct swc_egl * egl, struct wl_display * display); - -bool swc_egl_unbind_display(struct swc_egl * egl, struct wl_display * display); - -#endif - diff --git a/protocol/Makefile.am b/protocol/Makefile.am @@ -0,0 +1,8 @@ +# wld: protocol/Makefile.am + +BUILT_SOURCES = wayland-drm-protocol.c wayland-drm-server-protocol.h +CLEANFILES = $(BUILT_SOURCES) + +@wayland_scanner_rules@ + + diff --git a/protocol/wayland-drm.xml b/protocol/wayland-drm.xml @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8"?> +<protocol name="drm"> + + <copyright> + Copyright © 2008-2011 Kristian Høgsberg + Copyright © 2010-2011 Intel Corporation + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that\n 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. + </copyright> + + <!-- drm support. This object is created by the server and published + using the display's global event. --> + <interface name="wl_drm" version="2"> + <enum name="error"> + <entry name="authenticate_fail" value="0"/> + <entry name="invalid_format" value="1"/> + <entry name="invalid_name" value="2"/> + </enum> + + <enum name="format"> + <!-- The drm format codes match the #defines in drm_fourcc.h. + The formats actually supported by the compositor will be + reported by the format event. --> + <entry name="c8" value="0x20203843"/> + <entry name="rgb332" value="0x38424752"/> + <entry name="bgr233" value="0x38524742"/> + <entry name="xrgb4444" value="0x32315258"/> + <entry name="xbgr4444" value="0x32314258"/> + <entry name="rgbx4444" value="0x32315852"/> + <entry name="bgrx4444" value="0x32315842"/> + <entry name="argb4444" value="0x32315241"/> + <entry name="abgr4444" value="0x32314241"/> + <entry name="rgba4444" value="0x32314152"/> + <entry name="bgra4444" value="0x32314142"/> + <entry name="xrgb1555" value="0x35315258"/> + <entry name="xbgr1555" value="0x35314258"/> + <entry name="rgbx5551" value="0x35315852"/> + <entry name="bgrx5551" value="0x35315842"/> + <entry name="argb1555" value="0x35315241"/> + <entry name="abgr1555" value="0x35314241"/> + <entry name="rgba5551" value="0x35314152"/> + <entry name="bgra5551" value="0x35314142"/> + <entry name="rgb565" value="0x36314752"/> + <entry name="bgr565" value="0x36314742"/> + <entry name="rgb888" value="0x34324752"/> + <entry name="bgr888" value="0x34324742"/> + <entry name="xrgb8888" value="0x34325258"/> + <entry name="xbgr8888" value="0x34324258"/> + <entry name="rgbx8888" value="0x34325852"/> + <entry name="bgrx8888" value="0x34325842"/> + <entry name="argb8888" value="0x34325241"/> + <entry name="abgr8888" value="0x34324241"/> + <entry name="rgba8888" value="0x34324152"/> + <entry name="bgra8888" value="0x34324142"/> + <entry name="xrgb2101010" value="0x30335258"/> + <entry name="xbgr2101010" value="0x30334258"/> + <entry name="rgbx1010102" value="0x30335852"/> + <entry name="bgrx1010102" value="0x30335842"/> + <entry name="argb2101010" value="0x30335241"/> + <entry name="abgr2101010" value="0x30334241"/> + <entry name="rgba1010102" value="0x30334152"/> + <entry name="bgra1010102" value="0x30334142"/> + <entry name="yuyv" value="0x56595559"/> + <entry name="yvyu" value="0x55595659"/> + <entry name="uyvy" value="0x59565955"/> + <entry name="vyuy" value="0x59555956"/> + <entry name="ayuv" value="0x56555941"/> + <entry name="nv12" value="0x3231564e"/> + <entry name="nv21" value="0x3132564e"/> + <entry name="nv16" value="0x3631564e"/> + <entry name="nv61" value="0x3136564e"/> + <entry name="yuv410" value="0x39565559"/> + <entry name="yvu410" value="0x39555659"/> + <entry name="yuv411" value="0x31315559"/> + <entry name="yvu411" value="0x31315659"/> + <entry name="yuv420" value="0x32315559"/> + <entry name="yvu420" value="0x32315659"/> + <entry name="yuv422" value="0x36315559"/> + <entry name="yvu422" value="0x36315659"/> + <entry name="yuv444" value="0x34325559"/> + <entry name="yvu444" value="0x34325659"/> + </enum> + + <!-- Call this request with the magic received from drmGetMagic(). + It will be passed on to the drmAuthMagic() or + DRIAuthConnection() call. This authentication must be + completed before create_buffer could be used. --> + <request name="authenticate"> + <arg name="id" type="uint"/> + </request> + + <!-- Create a wayland buffer for the named DRM buffer. The DRM + surface must have a name using the flink ioctl --> + <request name="create_buffer"> + <arg name="id" type="new_id" interface="wl_buffer"/> + <arg name="name" type="uint"/> + <arg name="width" type="int"/> + <arg name="height" type="int"/> + <arg name="stride" type="uint"/> + <arg name="format" type="uint"/> + </request> + + <!-- Create a wayland buffer for the named DRM buffer. The DRM + surface must have a name using the flink ioctl --> + <request name="create_planar_buffer"> + <arg name="id" type="new_id" interface="wl_buffer"/> + <arg name="name" type="uint"/> + <arg name="width" type="int"/> + <arg name="height" type="int"/> + <arg name="format" type="uint"/> + <arg name="offset0" type="int"/> + <arg name="stride0" type="int"/> + <arg name="offset1" type="int"/> + <arg name="stride1" type="int"/> + <arg name="offset2" type="int"/> + <arg name="stride2" type="int"/> + </request> + + <!-- Create a wayland buffer for the prime fd. Use for regular and planar + buffers. Pass 0 for offset and stride for unused planes. --> + <request name="create_prime_buffer" since="2"> + <arg name="id" type="new_id" interface="wl_buffer"/> + <arg name="name" type="fd"/> + <arg name="width" type="int"/> + <arg name="height" type="int"/> + <arg name="format" type="uint"/> + <arg name="offset0" type="int"/> + <arg name="stride0" type="int"/> + <arg name="offset1" type="int"/> + <arg name="stride1" type="int"/> + <arg name="offset2" type="int"/> + <arg name="stride2" type="int"/> + </request> + + <!-- Notification of the path of the drm device which is used by + the server. The client should use this device for creating + local buffers. Only buffers created from this device should + be be passed to the server using this drm object's + create_buffer request. --> + <event name="device"> + <arg name="name" type="string"/> + </event> + + <event name="format"> + <arg name="format" type="uint"/> + </event> + + <!-- Raised if the authenticate request succeeded --> + <event name="authenticated"/> + + <enum name="capability" since="2"> + <description summary="wl_drm capability bitmask"> + Bitmask of capabilities. + </description> + <entry name="prime" value="1" summary="wl_drm prime available"/> + </enum> + + <event name="capabilities"> + <arg name="value" type="uint"/> + </event> + </interface> + +</protocol>