Initial commit. 80/30480/4
authorTakanari Hayama <taki@igel.co.jp>
Tue, 12 Nov 2013 23:38:43 +0000 (08:38 +0900)
committerTony SIM <chinyeow.sim.xt@renesas.com>
Thu, 18 Dec 2014 09:05:10 +0000 (17:05 +0800)
Change-Id: If050d8825d21fc56318cf0dd557d541e16d4beef
Signed-off-by: Tony SIM <chinyeow.sim.xt@renesas.com>
.gitignore [new file with mode: 0644]
LICENSE [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
configure.ac [new file with mode: 0644]
wayland-kms.c [new file with mode: 0644]
wayland-kms.h [new file with mode: 0644]
wayland-kms.pc.in [new file with mode: 0644]
wayland-kms.xml [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..f466ad5
--- /dev/null
@@ -0,0 +1,35 @@
+autom4te.cache/*
+aclocal.m4
+config.*
+configure
+depcomp
+m4/*
+missing
+*/*~
+*~
+*.o
+*.lo
+\#*\#
+.deps
+.libs
+ltmain.sh
+stamp-h1
+install-sh
+Makefile
+*.pc
+*.la
+libtool
+Makefile.in
+
+# gnu global files
+GPATH
+GRTAGS
+GSYMS
+GTAGS
+HTML
+
+# wayland protocol (automatically made)
+wayland-kms-client-protocol.h
+wayland-kms-protocol.c
+wayland-kms-server-protocol.h
+
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..643fb0b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+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.
\ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..57c211b
--- /dev/null
@@ -0,0 +1,43 @@
+lib_LTLIBRARIES = libwayland-kms.la
+
+AM_CFLAGS = \
+       $(WAYLAND_CFLAGS)
+
+AM_CPPFLAGS = \
+       -I$(top_srcdir)/include \
+       $(DEFINES)
+
+BUILT_SOURCES = wayland-kms-protocol.c \
+               wayland-kms-server-protocol.h \
+               wayland-kms-client-protocol.h
+CLEANFILES = $(BUILT_SOURCES)
+
+libwayland_kms_la_SOURCES = \
+       wayland-kms.c \
+       wayland-kms-protocol.c
+
+libwayland_kms_la_CFLAGS = \
+       @WAYLAND_SERVER_CFLAGS@ \
+       @LIBDRM_CFLAGS@
+
+libwayland_kms_la_LIBADD = \
+       @WAYLAND_SERVER_LIBS@ \
+       @LIBDRM_LIBS@
+
+extdir = $(includedir)
+ext_HEADERS = \
+       wayland-kms.h \
+       wayland-kms-server-protocol.h \
+       wayland-kms-client-protocol.h
+
+%-protocol.c : %.xml
+       $(WAYLAND_SCANNER) code < $< > $@
+
+%-server-protocol.h : %.xml
+       $(WAYLAND_SCANNER) server-header < $< > $@
+
+%-client-protocol.h : %.xml
+       $(WAYLAND_SCANNER) client-header < $< > $@
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = wayland-kms.pc
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..0eef284
--- /dev/null
@@ -0,0 +1,30 @@
+#
+#  Copyright 2013 Renesas Solutions Corp.
+#
+
+# Initialize Autoconf
+AC_PREREQ([2.60])
+AC_INIT([wayland-kms], [1.0.0],
+        [http://www.renesas.com/], [wayland-kms])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS([config.h])
+
+# Initialize Automake
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+#AM_MAINTAINER_MODE
+
+# Initialize libtool
+AC_PROG_LIBTOOL
+
+# Check for wayland-scanner
+AC_CHECK_PROG([WAYLAND_SCANNER], [wayland-scanner], [wayland-scanner], [no])
+if test x"${WAYLAND_SCANNER}" == x"no" ; then
+       AC_MSG_ERROR([Please install wayland-scanner.])
+fi
+
+# Obtain compiler/linker options for dependencies
+PKG_CHECK_MODULES([WAYLAND_SERVER], [wayland-server])
+PKG_CHECK_MODULES([LIBDRM], [libdrm])
+
+AC_CONFIG_FILES([Makefile wayland-kms.pc])
+AC_OUTPUT
diff --git a/wayland-kms.c b/wayland-kms.c
new file mode 100644 (file)
index 0000000..0a86845
--- /dev/null
@@ -0,0 +1,254 @@
+/*
+ * Copyright © 2013 Renesas Solutions Corp.
+ * 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:
+ *    Takanari Hayama <taki@igel.co.jp>
+ *
+ * Based on wayland-drm.c by the following authors:
+ *    Kristian Høgsberg <krh@bitplanet.net>
+ *    Benjamin Franzke <benjaminfranzke@googlemail.com>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <xf86drm.h>
+#include <wayland-server.h>
+#include "wayland-kms.h"
+#include "wayland-kms-server-protocol.h"
+
+#if defined(DEBUG)
+#      define WLKMS_DEBUG(s, x...) { printf(s, ##x); }
+#else
+#      define WLKMS_DEBUG(s, x...) { }
+#endif
+
+struct wl_kms {
+       struct wl_display *display;
+       int fd;                         /* FD for DRM */
+       char *device_name;
+};
+
+static void destroy_buffer(struct wl_resource *resource)
+{
+       struct wl_kms_buffer *buffer = resource->data;
+       free(buffer);
+}
+
+static void
+buffer_destroy(struct wl_client *client, struct wl_resource *resource)
+{
+       wl_resource_destroy(resource);
+}
+
+const static struct wl_buffer_interface kms_buffer_interface = {
+       .destroy = buffer_destroy
+};
+
+static void
+kms_authenticate(struct wl_client *client, struct wl_resource *resource,
+                uint32_t magic)
+{
+       struct wl_kms *kms = resource->data;
+       int err;
+
+       WLKMS_DEBUG("%s: %s: magic=%lu\n", __FILE__, __func__, magic);
+
+       if (drmAuthMagic(kms->fd, magic) < 0) {
+               wl_resource_post_error(resource, WL_KMS_ERROR_AUTHENTICATION_FAILED,
+                                      "authentication failed");
+               WLKMS_DEBUG("%s: %s: authentication failed.\n", __FILE__, __func__);
+       } else {
+               wl_resource_post_event(resource, WL_KMS_AUTHENTICATED);
+               WLKMS_DEBUG("%s: %s: authentication succeeded.\n", __FILE__, __func__);
+       }
+}
+
+static void
+kms_create_buffer(struct wl_client *client, struct wl_resource *resource,
+                 uint32_t id, int32_t prime_fd, int32_t width, int32_t height,
+                 uint32_t stride, uint32_t format, uint32_t handle)
+{
+       struct wl_kms *kms = resource->data;
+       struct wl_kms_buffer *buffer;
+       int err;
+
+       switch (format) {
+       case WL_KMS_FORMAT_ARGB8888:
+       case WL_KMS_FORMAT_XRGB8888:
+               break;
+       default:
+               wl_resource_post_error(resource,
+                                      WL_KMS_ERROR_INVALID_FORMAT,
+                                      "invalid format");
+               return;
+       }
+
+       buffer = calloc(1, sizeof *buffer);
+       if (buffer == NULL) {
+               wl_resource_post_no_memory(resource);
+               return;
+       }
+
+       buffer->kms = kms;
+       buffer->width = width;
+       buffer->height = height;
+       buffer->format = format;
+       buffer->stride = stride;
+       buffer->fd = prime_fd;
+
+       WLKMS_DEBUG("%s: %s: prime_fd=%d\n", __FILE__, __func__, prime_fd);
+#if 0
+       if ((err = drmPrimeFDToHandle(kms->fd, prime_fd, &buffer->handle))) {
+               WLKMS_DEBUG("%s: %s: drmPrimeFDToHandle() failed...%d (%s)\n", __FILE__, __func__, err, strerror(errno));
+               wl_resource_post_error(resource,
+                                      WL_KMS_ERROR_INVALID_FD,
+                                      "invalid prime FD");
+               return;
+       }
+#else
+       {
+               struct drm_gem_open op;
+               int ret;
+
+               op.name   = prime_fd;
+               op.handle = 0;
+
+               ret = drmIoctl(kms->fd, DRM_IOCTL_GEM_OPEN, &op);
+               if (ret) {
+                       WLKMS_DEBUG("%s: %s: DRM_IOCTL_GEM_OPEN failed...(%s)\n", __FILE__, __func__, strerror(errno));
+                       wl_resource_post_error(resource, WL_KMS_ERROR_INVALID_FD, "invalid prime FD");
+                       return;
+               }
+               buffer->handle = op.handle;
+       }
+#endif
+
+       // We create a wl_buffer
+       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))&kms_buffer_interface,
+                                      buffer, destroy_buffer);
+}
+
+const static struct wl_kms_interface kms_interface = {
+       .authenticate = kms_authenticate,
+       .create_buffer = kms_create_buffer,
+};
+
+static void
+bind_kms(struct wl_client *client, void *data, uint32_t version, uint32_t id)
+{
+       struct wl_kms *kms = data;
+       struct wl_resource *resource;
+       uint32_t capabilities;
+
+       resource = wl_resource_create(client, &wl_kms_interface, version, id);
+       if (!resource) {
+               wl_client_post_no_memory(client);
+               return;
+       }
+
+       wl_resource_set_implementation(resource, &kms_interface, data, NULL);
+
+       wl_resource_post_event(resource, WL_KMS_DEVICE, kms->device_name);
+       wl_resource_post_event(resource, WL_KMS_FORMAT, WL_KMS_FORMAT_ARGB8888);
+       wl_resource_post_event(resource, WL_KMS_FORMAT, WL_KMS_FORMAT_XRGB8888);
+}
+
+struct wl_kms_buffer *wayland_kms_buffer_get(struct wl_resource *resource)
+{
+       if (resource == NULL)
+               return NULL;
+
+       if (wl_resource_instance_of(resource, &wl_buffer_interface,
+                                   &kms_buffer_interface))
+               return wl_resource_get_user_data(resource);
+       else
+               return NULL;
+}
+
+struct wl_kms *wayland_kms_init(struct wl_display *display, char *device_name, int fd)
+{
+       struct wl_kms *kms;
+
+       kms = malloc(sizeof *kms);
+
+       kms->display = display;
+       kms->device_name = strdup(device_name);
+       kms->fd = fd;
+
+       wl_global_create(display, &wl_kms_interface, 1, kms, bind_kms);
+
+       return kms;
+}
+
+void wayland_kms_uninit(struct wl_kms *kms)
+{
+       free(kms->device_name);
+
+       /* FIXME: need wl_display_del_{object,global} */
+
+       free(kms);
+}
+
+uint32_t wayland_kms_buffer_get_format(struct wl_kms_buffer *buffer)
+{
+       return buffer->format;
+}
+
+int wayland_kms_query_buffer(struct wl_kms *kms, struct wl_resource *resource,
+                               enum wl_kms_attribute attr, int *value)
+{
+       struct wl_kms_buffer *buffer = wayland_kms_buffer_get(resource);
+       if (!buffer)
+               return -1;
+
+       switch(attr) {
+       case WL_KMS_WIDTH:
+               *value = buffer->width;
+               return 0;
+
+       case WL_KMS_HEIGHT:
+               *value = buffer->height;
+               return 0;
+       
+       case WL_KMS_TEXTURE_FORMAT:
+               *value = WL_KMS_FORMAT_ARGB8888;
+               return 0;
+       }
+
+       return -1;
+}
diff --git a/wayland-kms.h b/wayland-kms.h
new file mode 100644 (file)
index 0000000..7722644
--- /dev/null
@@ -0,0 +1,100 @@
+#ifndef WAYLAND_KMS_H
+#define WAYLAND_KMS_H
+
+#include <wayland-server.h>
+
+#ifndef WL_KMS_FORMAT_ENUM
+#define WL_KMS_FORMAT_ENUM
+enum wl_kms_format {
+       WL_KMS_FORMAT_C8 = 0x20203843,
+       WL_KMS_FORMAT_RGB332 = 0x38424752,
+       WL_KMS_FORMAT_BGR233 = 0x38524742,
+       WL_KMS_FORMAT_XRGB4444 = 0x32315258,
+       WL_KMS_FORMAT_XBGR4444 = 0x32314258,
+       WL_KMS_FORMAT_RGBX4444 = 0x32315852,
+       WL_KMS_FORMAT_BGRX4444 = 0x32315842,
+       WL_KMS_FORMAT_ARGB4444 = 0x32315241,
+       WL_KMS_FORMAT_ABGR4444 = 0x32314241,
+       WL_KMS_FORMAT_RGBA4444 = 0x32314152,
+       WL_KMS_FORMAT_BGRA4444 = 0x32314142,
+       WL_KMS_FORMAT_XRGB1555 = 0x35315258,
+       WL_KMS_FORMAT_XBGR1555 = 0x35314258,
+       WL_KMS_FORMAT_RGBX5551 = 0x35315852,
+       WL_KMS_FORMAT_BGRX5551 = 0x35315842,
+       WL_KMS_FORMAT_ARGB1555 = 0x35315241,
+       WL_KMS_FORMAT_ABGR1555 = 0x35314241,
+       WL_KMS_FORMAT_RGBA5551 = 0x35314152,
+       WL_KMS_FORMAT_BGRA5551 = 0x35314142,
+       WL_KMS_FORMAT_RGB565 = 0x36314752,
+       WL_KMS_FORMAT_BGR565 = 0x36314742,
+       WL_KMS_FORMAT_RGB888 = 0x34324752,
+       WL_KMS_FORMAT_BGR888 = 0x34324742,
+       WL_KMS_FORMAT_XRGB8888 = 0x34325258,
+       WL_KMS_FORMAT_XBGR8888 = 0x34324258,
+       WL_KMS_FORMAT_RGBX8888 = 0x34325852,
+       WL_KMS_FORMAT_BGRX8888 = 0x34325842,
+       WL_KMS_FORMAT_ARGB8888 = 0x34325241,
+       WL_KMS_FORMAT_ABGR8888 = 0x34324241,
+       WL_KMS_FORMAT_RGBA8888 = 0x34324152,
+       WL_KMS_FORMAT_BGRA8888 = 0x34324142,
+       WL_KMS_FORMAT_XRGB2101010 = 0x30335258,
+       WL_KMS_FORMAT_XBGR2101010 = 0x30334258,
+       WL_KMS_FORMAT_RGBX1010102 = 0x30335852,
+       WL_KMS_FORMAT_BGRX1010102 = 0x30335842,
+       WL_KMS_FORMAT_ARGB2101010 = 0x30335241,
+       WL_KMS_FORMAT_ABGR2101010 = 0x30334241,
+       WL_KMS_FORMAT_RGBA1010102 = 0x30334152,
+       WL_KMS_FORMAT_BGRA1010102 = 0x30334142,
+       WL_KMS_FORMAT_YUYV = 0x56595559,
+       WL_KMS_FORMAT_YVYU = 0x55595659,
+       WL_KMS_FORMAT_UYVY = 0x59565955,
+       WL_KMS_FORMAT_VYUY = 0x59555956,
+       WL_KMS_FORMAT_AYUV = 0x56555941,
+       WL_KMS_FORMAT_NV12 = 0x3231564e,
+       WL_KMS_FORMAT_NV21 = 0x3132564e,
+       WL_KMS_FORMAT_NV16 = 0x3631564e,
+       WL_KMS_FORMAT_NV61 = 0x3136564e,
+       WL_KMS_FORMAT_YUV410 = 0x39565559,
+       WL_KMS_FORMAT_YVU410 = 0x39555659,
+       WL_KMS_FORMAT_YUV411 = 0x31315559,
+       WL_KMS_FORMAT_YVU411 = 0x31315659,
+       WL_KMS_FORMAT_YUV420 = 0x32315559,
+       WL_KMS_FORMAT_YVU420 = 0x32315659,
+       WL_KMS_FORMAT_YUV422 = 0x36315559,
+       WL_KMS_FORMAT_YVU422 = 0x36315659,
+       WL_KMS_FORMAT_YUV444 = 0x34325559,
+       WL_KMS_FORMAT_YVU444 = 0x34325659,
+};
+#endif                         /* WL_KMS_FORMAT_ENUM */
+
+struct wl_kms;
+
+struct wl_kms_buffer {
+       struct wl_resource *resource;
+       struct wl_kms *kms;
+       int32_t width, height;
+       uint32_t stride, format;
+       uint32_t handle;
+       int fd;
+};
+
+struct wl_kms_buffer *wayland_kms_buffer_get(struct wl_resource *resource);
+
+struct wl_kms *wayland_kms_init(struct wl_display *display, char *device_name, int fd);
+
+void wayland_kms_uninit(struct wl_kms *kms);
+
+uint32_t wayland_kms_buffer_get_format(struct wl_kms_buffer *buffer);
+
+void *wayland_kms_buffer_get_buffer(struct wl_kms_buffer *buffer);
+
+enum wl_kms_attribute {
+       WL_KMS_WIDTH,
+       WL_KMS_HEIGHT,
+       WL_KMS_TEXTURE_FORMAT
+};
+
+int wayland_kms_query_buffer(struct wl_kms *kms, struct wl_resource *resource,
+                               enum wl_kms_attribute attr, int *value);
+
+#endif
diff --git a/wayland-kms.pc.in b/wayland-kms.pc.in
new file mode 100644 (file)
index 0000000..fce7259
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: wayland-kms
+Description: wayland-kms library
+Requires.private: wayland-server
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lwayland-kms
+Cflags: -I${includedir}
diff --git a/wayland-kms.xml b/wayland-kms.xml
new file mode 100644 (file)
index 0000000..9976f95
--- /dev/null
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="kms">
+
+  <copyright>
+    Copyright © 2013 Renesas Solutions Corp.
+
+    Based on wayland-drm.xml:
+    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>
+
+  <!-- KMS BO support. This object is created by the server and published
+       using the display's global event. -->
+  <interface name="wl_kms" version="1">
+    <enum name="error">
+      <entry name="invalid_format" value="0"/>
+      <entry name="invalid_fd" value="1"/>
+      <entry name="invalid_handle" value="2"/>
+      <entry name="authentication_failed" value="3"/>
+    </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>
+
+    <!-- DRM Authentication. Clients should send magic value
+         got with drmGetMagic(). -->
+    <request name="authenticate">
+      <arg name="magic" type="uint"/>
+    </request>
+
+    <!-- Create a wayland buffer for the KMS BO buffer.  The KMS
+         surface must have a prime FD. -->
+    <request name="create_buffer">
+      <arg name="id" type="new_id" interface="wl_buffer"/>
+      <arg name="fd" type="int"/>      <!-- KMS BO Prime FD -->
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+      <arg name="stride" type="uint"/>
+      <arg name="format" type="uint"/>
+      <arg name="handle" type="uint"/> <!-- DevMem Export Handle -->
+    </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>
+
+    <!-- Sent if the authentication succeeded -->
+    <event name="authenticated"/>
+
+  </interface>
+
+</protocol>