From 6994796788d7f8c43ff3e3e9d2caacb3b9484b06 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 3 Jul 2015 14:18:14 +0900 Subject: [PATCH] remove wayland-drm Change-Id: I5c4702a894bf35680fb57b8219d5ee1a28b46178 --- configure.ac | 3 +- src/Makefile.am | 7 - src/tbm_wayland.c | 369 ++++++++++++++++++++++++++++------------ src/wayland-drm/Makefile.am | 24 --- src/wayland-drm/wayland-drm.c | 304 --------------------------------- src/wayland-drm/wayland-drm.h | 111 ------------ src/wayland-drm/wayland-drm.xml | 182 -------------------- 7 files changed, 257 insertions(+), 743 deletions(-) mode change 100644 => 100755 src/tbm_wayland.c delete mode 100644 src/wayland-drm/Makefile.am delete mode 100644 src/wayland-drm/wayland-drm.c delete mode 100644 src/wayland-drm/wayland-drm.h delete mode 100644 src/wayland-drm/wayland-drm.xml diff --git a/configure.ac b/configure.ac index d60b52b..7343f5c 100644 --- a/configure.ac +++ b/configure.ac @@ -112,8 +112,7 @@ AM_CONDITIONAL(HAVE_TBM_PLATFORM_WAYLAND, test "x$TBM_PLATFORM" = "xWAYLAND") AM_CONDITIONAL(HOST_CPU_X86_64, test "x$HOST_CPU_X86_64" = "xyes") AC_OUTPUT([ - src/Makefile - src/wayland-drm/Makefile + src/Makefile Makefile libtbm.pc]) diff --git a/src/Makefile.am b/src/Makefile.am index d710410..7458888 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,9 +1,5 @@ SUBDIRS = -if HAVE_TBM_PLATFORM_WAYLAND -SUBDIRS += wayland-drm -endif - AM_CFLAGS = \ $(WARN_CFLAGS) \ -I./ \ @@ -25,9 +21,6 @@ if HAVE_TBM_PLATFORM_X11 endif if HAVE_TBM_PLATFORM_WAYLAND - AM_CFLAGS += \ - -I$(top_srcdir)/src/wayland-drm - libtbm_la_LIBADD += $(top_builddir)/src/wayland-drm/libwayland-drm.la libtbm_la_SOURCES += \ tbm_wayland.c endif diff --git a/src/tbm_wayland.c b/src/tbm_wayland.c old mode 100644 new mode 100755 index 1a0a541..062e392 --- a/src/tbm_wayland.c +++ b/src/tbm_wayland.c @@ -33,157 +33,300 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tbm_bufmgr_int.h" #include -#include -#include -struct display { - struct wl_display *display; - struct wl_registry *registry; +#include +#include +#include "wayland-client.h" - struct wl_drm *wl_drm; - uint32_t drm_fd; - char* drm_device_name; -}; +struct wl_client; +struct wl_resource; -/* initialize drm device */ -static void -_drm_handle_device( void *data, struct wl_drm *drm, const char *device ) -{ - struct display *d = data; +struct wl_drm; - d->drm_device_name = strdup(device); - return; -} +#ifndef WL_DRM_ERROR_ENUM +#define WL_DRM_ERROR_ENUM +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_CAPABILITY_ENUM +#define WL_DRM_CAPABILITY_ENUM +/** + * wl_drm_capability - wl_drm capability bitmask + * @WL_DRM_CAPABILITY_PRIME: wl_drm prime available + * + * Bitmask of capabilities. + */ +enum wl_drm_capability { + WL_DRM_CAPABILITY_PRIME = 1, +}; +#endif /* WL_DRM_CAPABILITY_ENUM */ + +struct wl_drm_listener { + /** + * device - (none) + * @name: (none) + */ + void (*device)(void *data, + struct wl_drm *wl_drm, + const char *name); + /** + * format - (none) + * @format: (none) + */ + void (*format)(void *data, + struct wl_drm *wl_drm, + uint32_t format); + /** + * authenticated - (none) + */ + void (*authenticated)(void *data, + struct wl_drm *wl_drm); + /** + * capabilities - (none) + * @value: (none) + */ + void (*capabilities)(void *data, + struct wl_drm *wl_drm, + uint32_t value); +}; -/* handle format of drm device */ -static void -_drm_handle_format( void *data, struct wl_drm *drm, uint32_t format ) +static inline int +wl_drm_add_listener(struct wl_drm *wl_drm, + const struct wl_drm_listener *listener, void *data) { - return; + return wl_proxy_add_listener((struct wl_proxy *) wl_drm, + (void (**)(void)) listener, data); } -/* handle authentication of drm device */ -static void -_drm_handle_authenticated( void *data, struct wl_drm *drm ) -{ - struct display *d = data; +#define WL_DRM_AUTHENTICATE 0 - printf("DRM authenticated: name:%s fd:%d\n", d->drm_device_name, d->drm_fd); - return; +static inline void +wl_drm_destroy(struct wl_drm *wl_drm) +{ + wl_proxy_destroy((struct wl_proxy *) wl_drm); } -static void -_drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value) +static inline void +wl_drm_authenticate(struct wl_drm *wl_drm, uint32_t id) { - return; + wl_proxy_marshal((struct wl_proxy *) wl_drm, + WL_DRM_AUTHENTICATE, id); } -static const struct wl_drm_listener drm_listener = { - _drm_handle_device, - _drm_handle_format, - _drm_handle_authenticated, - _drm_handle_capabilities +static const struct wl_interface *types[] = { + NULL, + &wl_buffer_interface, + NULL, + NULL, + NULL, + NULL, + NULL, + &wl_buffer_interface, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + &wl_buffer_interface, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, }; +static const struct wl_message wl_drm_requests[] = { + { "authenticate", "u", types + 0 }, + { "create_buffer", "nuiiuu", types + 1 }, + { "create_planar_buffer", "nuiiuiiiiii", types + 7 }, + { "create_prime_buffer", "2nhiiuiiiiii", types + 18 }, +}; -static void -registry_handle_global(void *data, struct wl_registry *registry, - uint32_t id, const char *interface, uint32_t version) -{ - struct display *d = data; +static const struct wl_message wl_drm_events[] = { + { "device", "s", types + 0 }, + { "format", "u", types + 0 }, + { "authenticated", "", types + 0 }, + { "capabilities", "u", types + 0 }, +}; - if (strcmp(interface, "wl_drm") == 0) { - d->wl_drm = - wl_registry_bind(registry, id, &wl_drm_interface, version); - wl_drm_add_listener(d->wl_drm, &drm_listener, d); - } -} +static const struct wl_interface wl_drm_interface = { + "wl_drm", 2, + 4, wl_drm_requests, + 4, wl_drm_events, +}; -static void -registry_handle_global_remove(void *data, struct wl_registry *registry, - uint32_t name) -{ -} +#define USE_QUEUE 1 -static const struct wl_registry_listener registry_listener = { - registry_handle_global, - registry_handle_global_remove +struct wl_drm_info { +#if USE_QUEUE + struct wl_event_queue *wl_queue; +#endif + struct wl_drm* wl_drm; + int authenticated; + int fd; }; -static struct display * -create_display(void) +static void wl_client_drm_handle_device(void *data, struct wl_drm *drm, const char *device) { - struct display *display; + struct wl_drm_info *drm_info = (struct wl_drm_info *)data; drm_magic_t magic; - display = calloc(sizeof(struct display), 1); - if (display == NULL) { - TBM_LOG ("[libtbm:%d] out of memory\n", getpid()); - return NULL; - } - display->display = wl_display_connect(NULL); - if (display->display == NULL) { - TBM_LOG ("[libtbm:%d] fail to wl display\n", getpid()); - return NULL; + printf("device[%s]\n", device); + drm_info->fd = open(device, O_RDWR | O_CLOEXEC); + if (drm_info->fd < 0) { + printf("Failed to open a device: %d (%s)\n", errno, device); + return; } - display->registry = wl_display_get_registry(display->display); - wl_registry_add_listener(display->registry, - ®istry_listener, display); - wl_display_roundtrip(display->display); - - if (display->wl_drm == NULL) { - TBM_LOG ("[libtbm:%d] No wl_drm global\n", getpid()); - return NULL; - } - wl_display_roundtrip(display->display); - - if (!display->drm_device_name) { - TBM_LOG ("[libtbm:%d] No drm device name\n", getpid()); - return NULL; - } - - display->drm_fd = open( display->drm_device_name, O_RDWR | O_CLOEXEC ); - if (display->drm_fd < 0) { - TBM_LOG ("[libtbm:%d] Cannot open drm device\n", getpid()); - return NULL; - } + drmGetMagic(drm_info->fd, &magic); + printf("magic[%x]\n", magic); + wl_drm_authenticate(drm_info->wl_drm, magic); +} - drmGetMagic(display->drm_fd, &magic); - wl_drm_authenticate(display->wl_drm, magic); - wl_display_roundtrip(display->display); +static void wl_client_drm_handle_format(void *data, struct wl_drm *drm, uint32_t format) +{ + /* Do nothing */ +} - return display; +static void wl_client_drm_handle_authenticated(void *data, struct wl_drm *drm) +{ + struct wl_drm_info *drm_info = (struct wl_drm_info *)data; + drm_info->authenticated = 1; } -static void -destroy_display(struct display *display) +static void wl_client_drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value) { - if (display->wl_drm) - wl_drm_destroy(display->wl_drm); - wl_registry_destroy(display->registry); - wl_display_flush(display->display); - wl_display_disconnect(display->display); - if (display->drm_device_name) - free (display->drm_device_name); - free(display); + /* Do nothing */ } -int -tbm_bufmgr_get_drm_fd_wayland() + + +static void wl_client_registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) { - struct display *display = NULL; - int drm_fd; + struct wl_drm_info *info = (struct wl_drm_info *)data; + static const struct wl_drm_listener wl_drm_client_listener = { + wl_client_drm_handle_device, + wl_client_drm_handle_format, + wl_client_drm_handle_authenticated, + wl_client_drm_handle_capabilities + }; + + printf("interface[%s]\n", interface); + if (!strcmp(interface, "wl_drm")) { + info->wl_drm = wl_registry_bind(registry, name, &wl_drm_interface, (version > 2) ? 2 : version); +#if USE_QUEUE + wl_proxy_set_queue((struct wl_proxy *)info->wl_drm, info->wl_queue); +#endif + wl_drm_add_listener(info->wl_drm, &wl_drm_client_listener, data); + } +} - display = create_display(); - if (display == NULL) { - TBM_LOG ("[libtbm:%d] fail to create display\n", getpid()); +static int tbm_util_get_drm_fd(void *dpy, int *fd) +{ + struct wl_display *disp = NULL; + struct wl_registry *wl_registry; + int ret = 0; + struct wl_drm_info info = { +#if USE_QUEUE + .wl_queue = NULL, +#endif + .wl_drm = NULL, + .authenticated = 0, + .fd = -1, + }; + static const struct wl_registry_listener registry_listener = { + wl_client_registry_handle_global, + NULL + }; + + if (!fd) { return -1; } - drm_fd = display->drm_fd; - destroy_display(display); - - return drm_fd; + if (!dpy) { + disp = wl_display_connect(NULL); + if (!disp) { + printf("Failed to create a new display connection\n"); + return -1; + } + dpy = disp; + } + +#if USE_QUEUE + info.wl_queue = wl_display_create_queue(dpy); + if (!info.wl_queue) { + printf("Failed to create a WL Queue\n"); + if (disp == dpy) { + wl_display_disconnect(disp); + } + return -1; + } +#endif + wl_registry = wl_display_get_registry(dpy); + if (!wl_registry) { + printf("Failed to get registry\n"); +#if USE_QUEUE + wl_event_queue_destroy(info.wl_queue); +#endif + if (disp == dpy) { + wl_display_disconnect(disp); + } + return -1; + } +#if USE_QUEUE + wl_proxy_set_queue((struct wl_proxy *)wl_registry, info.wl_queue); +#endif + wl_registry_add_listener(wl_registry, ®istry_listener, &info); + wl_display_roundtrip(dpy); + + printf("Consuming Dispatch Queue begin\n"); + while (ret != -1 && !info.authenticated) { +#if USE_QUEUE + ret = wl_display_dispatch_queue(dpy, info.wl_queue); +#else + ret = wl_display_dispatch(dpy); +#endif + printf("Dispatch Queue consumed: %d\n", ret); + } + printf("Consuming Dispatch Queue end\n"); + +#if USE_QUEUE + wl_event_queue_destroy(info.wl_queue); +#endif + wl_registry_destroy(wl_registry); + wl_drm_destroy(info.wl_drm); + + *fd = info.fd; + if (disp == dpy) { + wl_display_disconnect(disp); + } + return *fd >= 0 ? 0 : -1; } +int +tbm_bufmgr_get_drm_fd_wayland() +{ + int fd = -1; + + if(tbm_util_get_drm_fd(NULL, &fd)) + { + printf("Failed to get drm_fd\n"); + } + + return fd; +} \ No newline at end of file diff --git a/src/wayland-drm/Makefile.am b/src/wayland-drm/Makefile.am deleted file mode 100644 index d66a12e..0000000 --- a/src/wayland-drm/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -AM_CFLAGS = \ - -I./ \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/wayland-drm \ - $(WAYLAND_CFLAGS) - -noinst_LTLIBRARIES = libwayland-drm.la -libwayland_drm_la_SOURCES = wayland-drm.c wayland-drm-protocol.c -noinst_HEADERS = wayland-drm.h - -BUILT_SOURCES = wayland-drm-protocol.c \ - wayland-drm-client-protocol.h \ - wayland-drm-server-protocol.h -CLEANFILES = $(BUILT_SOURCES) - -%-protocol.c : %.xml - $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@ - -%-server-protocol.h : %.xml - $(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@ - -%-client-protocol.h : %.xml - $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@ diff --git a/src/wayland-drm/wayland-drm.c b/src/wayland-drm/wayland-drm.c deleted file mode 100644 index e9c6e0a..0000000 --- a/src/wayland-drm/wayland-drm.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright © 2011 Kristian Høgsberg - * Copyright © 2011 Benjamin Franzke - * - * 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. - * - * Authors: - * Kristian Høgsberg - * Benjamin Franzke - */ - -#include -#include -#include -#include -#include - -#include -#include "wayland-drm.h" -#include "wayland-drm-server-protocol.h" - -#define MIN(x,y) (((x)<(y))?(x):(y)) - -struct wl_drm { - struct wl_display *display; - struct wl_global *wl_drm_global; - - void *user_data; - char *device_name; - uint32_t flags; - - struct wayland_drm_callbacks *callbacks; - - struct wl_buffer_interface buffer_interface; -}; - -static void -destroy_buffer(struct wl_resource *resource) -{ - struct wl_drm_buffer *buffer = resource->data; - struct wl_drm *drm = buffer->drm; - - drm->callbacks->release_buffer(drm->user_data, buffer); - free(buffer); -} - -static void -buffer_destroy(struct wl_client *client, struct wl_resource *resource) -{ - wl_resource_destroy(resource); -} - -static void -create_buffer(struct wl_client *client, struct wl_resource *resource, - uint32_t id, uint32_t name, int 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 wl_drm *drm = resource->data; - struct wl_drm_buffer *buffer; - - buffer = calloc(1, sizeof *buffer); - if (buffer == NULL) { - wl_resource_post_no_memory(resource); - return; - } - - buffer->drm = drm; - buffer->width = width; - buffer->height = height; - buffer->format = format; - buffer->offset[0] = offset0; - buffer->stride[0] = stride0; - buffer->offset[1] = offset1; - buffer->stride[1] = stride1; - buffer->offset[2] = offset2; - buffer->stride[2] = stride2; - - drm->callbacks->reference_buffer(drm->user_data, name, fd, buffer); - if (buffer->driver_buffer == NULL) { - wl_resource_post_error(resource, - WL_DRM_ERROR_INVALID_NAME, - "invalid name"); - return; - } - - buffer->resource = - wl_resource_create(client, &wl_buffer_interface, 1, id); - if (!buffer->resource) { - wl_resource_post_no_memory(resource); - free(buffer); - return; - } - - wl_resource_set_implementation(buffer->resource, - (void (**)(void)) &drm->buffer_interface, - buffer, destroy_buffer); -} - -static void -drm_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) -{ - switch (format) { - case WL_DRM_FORMAT_ARGB8888: - case WL_DRM_FORMAT_XRGB8888: - case WL_DRM_FORMAT_YUYV: - case WL_DRM_FORMAT_RGB565: - break; - default: - wl_resource_post_error(resource, - WL_DRM_ERROR_INVALID_FORMAT, - "invalid format"); - return; - } - - create_buffer(client, resource, id, - name, -1, width, height, format, 0, stride, 0, 0, 0, 0); -} - -static void -drm_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) -{ - switch (format) { - case WL_DRM_FORMAT_YUV410: - case WL_DRM_FORMAT_YUV411: - case WL_DRM_FORMAT_YUV420: - case WL_DRM_FORMAT_YUV422: - case WL_DRM_FORMAT_YUV444: - case WL_DRM_FORMAT_NV12: - case WL_DRM_FORMAT_NV16: - break; - default: - wl_resource_post_error(resource, - WL_DRM_ERROR_INVALID_FORMAT, - "invalid format"); - return; - } - - create_buffer(client, resource, id, name, -1, width, height, format, - offset0, stride0, offset1, stride1, offset2, stride2); -} - -static void -drm_create_prime_buffer(struct wl_client *client, - struct wl_resource *resource, - uint32_t id, int 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) -{ - create_buffer(client, resource, id, 0, fd, width, height, format, - offset0, stride0, offset1, stride1, offset2, stride2); - close(fd); -} - -static void -drm_authenticate(struct wl_client *client, - struct wl_resource *resource, uint32_t id) -{ - struct wl_drm *drm = resource->data; - - if (drm->callbacks->authenticate(drm->user_data, id) < 0) - wl_resource_post_error(resource, - WL_DRM_ERROR_AUTHENTICATE_FAIL, - "authenicate failed"); - else - wl_resource_post_event(resource, WL_DRM_AUTHENTICATED); -} - -const static struct wl_drm_interface drm_interface = { - drm_authenticate, - drm_create_buffer, - drm_create_planar_buffer, - drm_create_prime_buffer -}; - -static void -bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id) -{ - struct wl_drm *drm = data; - struct wl_resource *resource; - uint32_t capabilities; - - resource = wl_resource_create(client, &wl_drm_interface, - MIN(version, 2), id); - if (!resource) { - wl_client_post_no_memory(client); - return; - } - - wl_resource_set_implementation(resource, &drm_interface, data, NULL); - - wl_resource_post_event(resource, WL_DRM_DEVICE, drm->device_name); - wl_resource_post_event(resource, WL_DRM_FORMAT, - WL_DRM_FORMAT_ARGB8888); - wl_resource_post_event(resource, WL_DRM_FORMAT, - WL_DRM_FORMAT_XRGB8888); - wl_resource_post_event(resource, WL_DRM_FORMAT, - WL_DRM_FORMAT_RGB565); - wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV410); - wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV411); - wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV420); - wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV422); - wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUV444); - wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_NV12); - wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_NV16); - wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_YUYV); - - capabilities = 0; - if (drm->flags & WAYLAND_DRM_PRIME) - capabilities |= WL_DRM_CAPABILITY_PRIME; - - if (version >= 2) - wl_resource_post_event(resource, WL_DRM_CAPABILITIES, capabilities); -} - -struct wl_drm_buffer * -wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource) -{ - if (resource == NULL) - return NULL; - - if (wl_resource_instance_of(resource, &wl_buffer_interface, - &drm->buffer_interface)) - return wl_resource_get_user_data(resource); - else - return NULL; -} - -struct wl_drm * -wayland_drm_init(struct wl_display *display, char *device_name, - struct wayland_drm_callbacks *callbacks, void *user_data, - uint32_t flags) -{ - struct wl_drm *drm; - - drm = malloc(sizeof *drm); - - drm->display = display; - drm->device_name = strdup(device_name); - drm->callbacks = callbacks; - drm->user_data = user_data; - drm->flags = flags; - - drm->buffer_interface.destroy = buffer_destroy; - - drm->wl_drm_global = - wl_global_create(display, &wl_drm_interface, 2, - drm, bind_drm); - - return drm; -} - -void -wayland_drm_uninit(struct wl_drm *drm) -{ - free(drm->device_name); - - wl_global_destroy(drm->wl_drm_global); - - free(drm); -} - -uint32_t -wayland_drm_buffer_get_format(struct wl_drm_buffer *buffer) -{ - return buffer->format; -} - -void * -wayland_drm_buffer_get_buffer(struct wl_drm_buffer *buffer) -{ - return buffer->driver_buffer; -} diff --git a/src/wayland-drm/wayland-drm.h b/src/wayland-drm/wayland-drm.h deleted file mode 100644 index 7892d56..0000000 --- a/src/wayland-drm/wayland-drm.h +++ /dev/null @@ -1,111 +0,0 @@ -#ifndef WAYLAND_DRM_H -#define WAYLAND_DRM_H - -#include - -#ifndef WL_DRM_FORMAT_ENUM -#define WL_DRM_FORMAT_ENUM -enum wl_drm_format { - WL_DRM_FORMAT_C8 = 0x20203843, - WL_DRM_FORMAT_RGB332 = 0x38424752, - WL_DRM_FORMAT_BGR233 = 0x38524742, - WL_DRM_FORMAT_XRGB4444 = 0x32315258, - WL_DRM_FORMAT_XBGR4444 = 0x32314258, - WL_DRM_FORMAT_RGBX4444 = 0x32315852, - WL_DRM_FORMAT_BGRX4444 = 0x32315842, - WL_DRM_FORMAT_ARGB4444 = 0x32315241, - WL_DRM_FORMAT_ABGR4444 = 0x32314241, - WL_DRM_FORMAT_RGBA4444 = 0x32314152, - WL_DRM_FORMAT_BGRA4444 = 0x32314142, - WL_DRM_FORMAT_XRGB1555 = 0x35315258, - WL_DRM_FORMAT_XBGR1555 = 0x35314258, - WL_DRM_FORMAT_RGBX5551 = 0x35315852, - WL_DRM_FORMAT_BGRX5551 = 0x35315842, - WL_DRM_FORMAT_ARGB1555 = 0x35315241, - WL_DRM_FORMAT_ABGR1555 = 0x35314241, - WL_DRM_FORMAT_RGBA5551 = 0x35314152, - WL_DRM_FORMAT_BGRA5551 = 0x35314142, - WL_DRM_FORMAT_RGB565 = 0x36314752, - WL_DRM_FORMAT_BGR565 = 0x36314742, - WL_DRM_FORMAT_RGB888 = 0x34324752, - WL_DRM_FORMAT_BGR888 = 0x34324742, - WL_DRM_FORMAT_XRGB8888 = 0x34325258, - WL_DRM_FORMAT_XBGR8888 = 0x34324258, - WL_DRM_FORMAT_RGBX8888 = 0x34325852, - WL_DRM_FORMAT_BGRX8888 = 0x34325842, - WL_DRM_FORMAT_ARGB8888 = 0x34325241, - WL_DRM_FORMAT_ABGR8888 = 0x34324241, - WL_DRM_FORMAT_RGBA8888 = 0x34324152, - WL_DRM_FORMAT_BGRA8888 = 0x34324142, - WL_DRM_FORMAT_XRGB2101010 = 0x30335258, - WL_DRM_FORMAT_XBGR2101010 = 0x30334258, - WL_DRM_FORMAT_RGBX1010102 = 0x30335852, - WL_DRM_FORMAT_BGRX1010102 = 0x30335842, - WL_DRM_FORMAT_ARGB2101010 = 0x30335241, - WL_DRM_FORMAT_ABGR2101010 = 0x30334241, - WL_DRM_FORMAT_RGBA1010102 = 0x30334152, - WL_DRM_FORMAT_BGRA1010102 = 0x30334142, - WL_DRM_FORMAT_YUYV = 0x56595559, - WL_DRM_FORMAT_YVYU = 0x55595659, - WL_DRM_FORMAT_UYVY = 0x59565955, - WL_DRM_FORMAT_VYUY = 0x59555956, - WL_DRM_FORMAT_AYUV = 0x56555941, - WL_DRM_FORMAT_NV12 = 0x3231564e, - WL_DRM_FORMAT_NV21 = 0x3132564e, - WL_DRM_FORMAT_NV16 = 0x3631564e, - WL_DRM_FORMAT_NV61 = 0x3136564e, - WL_DRM_FORMAT_YUV410 = 0x39565559, - WL_DRM_FORMAT_YVU410 = 0x39555659, - WL_DRM_FORMAT_YUV411 = 0x31315559, - WL_DRM_FORMAT_YVU411 = 0x31315659, - WL_DRM_FORMAT_YUV420 = 0x32315559, - WL_DRM_FORMAT_YVU420 = 0x32315659, - WL_DRM_FORMAT_YUV422 = 0x36315559, - WL_DRM_FORMAT_YVU422 = 0x36315659, - WL_DRM_FORMAT_YUV444 = 0x34325559, - WL_DRM_FORMAT_YVU444 = 0x34325659, -}; -#endif /* WL_DRM_FORMAT_ENUM */ - -struct wl_drm; - -struct wl_drm_buffer { - struct wl_resource *resource; - struct wl_drm *drm; - int32_t width, height; - uint32_t format; - const void *driver_format; - int32_t offset[3]; - int32_t stride[3]; - void *driver_buffer; -}; - -struct wayland_drm_callbacks { - int (*authenticate)(void *user_data, uint32_t id); - - void (*reference_buffer)(void *user_data, uint32_t name, int fd, - struct wl_drm_buffer *buffer); - - void (*release_buffer)(void *user_data, struct wl_drm_buffer *buffer); -}; - -enum { WAYLAND_DRM_PRIME = 0x01 }; - -struct wl_drm_buffer * -wayland_drm_buffer_get(struct wl_drm *drm, struct wl_resource *resource); - -struct wl_drm * -wayland_drm_init(struct wl_display *display, char *device_name, - struct wayland_drm_callbacks *callbacks, void *user_data, - uint32_t flags); - -void -wayland_drm_uninit(struct wl_drm *drm); - -uint32_t -wayland_drm_buffer_get_format(struct wl_drm_buffer *buffer); - -void * -wayland_drm_buffer_get_buffer(struct wl_drm_buffer *buffer); - -#endif diff --git a/src/wayland-drm/wayland-drm.xml b/src/wayland-drm/wayland-drm.xml deleted file mode 100644 index 8a3ad69..0000000 --- a/src/wayland-drm/wayland-drm.xml +++ /dev/null @@ -1,182 +0,0 @@ - - - - - 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. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bitmask of capabilities. - - - - - - - - - - -- 2.7.4