diff -Nru dce-1.6.5.2/Makefile.am dce-1.6.5.3/Makefile.am --- dce-1.6.5.2/Makefile.am 2012-08-10 09:31:19.000000000 +0000 +++ dce-1.6.5.3/Makefile.am 2012-09-19 15:13:08.000000000 +0000 @@ -16,9 +16,16 @@ -I$(top_srcdir)/packages/xdais libdce_la_SOURCES = libdce.c -libdce_la_CFLAGS = $(WARN_CFLAGS) $(CE_CFLAGS) $(DRM_CFLAGS) $(X11_CFLAGS) +libdce_la_CFLAGS = $(WARN_CFLAGS) $(CE_CFLAGS) $(DRM_CFLAGS) $(X11_CFLAGS) $(WAYLAND_CFLAGS) libdce_la_LDFLAGS = -no-undefined -libdce_la_LIBADD = $(DRM_LIBS) $(X11_LIBS) +libdce_la_LIBADD = $(DRM_LIBS) $(X11_LIBS) $(WAYLAND_LIBS) + +if ENABLE_X11 +libdce_la_SOURCES += libdce-x11.c +endif +if ENABLE_WAYLAND +libdce_la_SOURCES += libdce-wayland.c wayland-drm-protocol.c +endif libdce_la_includedir = $(includedir)/dce/ libdce_la_include_HEADERS = dce.h diff -Nru dce-1.6.5.2/configure.ac dce-1.6.5.3/configure.ac --- dce-1.6.5.2/configure.ac 2012-08-10 09:31:19.000000000 +0000 +++ dce-1.6.5.3/configure.ac 2012-09-19 15:13:08.000000000 +0000 @@ -56,6 +56,16 @@ else AC_MSG_WARN([Building without X11 support]) fi +AM_CONDITIONAL(ENABLE_X11, [test "x$HAVE_X11" = xyes]) + +dnl Check for wayland +PKG_CHECK_MODULES(WAYLAND, wayland-client >= 0.95.0, [HAVE_WAYLAND=yes], [HAVE_WAYLAND=no]) +if test "x$HAVE_WAYLAND" = "xyes"; then + AC_DEFINE(HAVE_WAYLAND, 1, [Have Wayland support]) +else + AC_MSG_WARN([Building without Wayland support]) +fi +AM_CONDITIONAL(ENABLE_WAYLAND, [test "x$HAVE_WAYLAND" = xyes]) dnl *** checks for header files *** dnl check if we have ANSI C header files diff -Nru dce-1.6.5.2/debian/changelog dce-1.6.5.3/debian/changelog --- dce-1.6.5.2/debian/changelog 2012-09-23 01:12:11.000000000 +0000 +++ dce-1.6.5.3/debian/changelog 2012-09-23 01:12:11.000000000 +0000 @@ -1,3 +1,9 @@ +dce (1.6.5.3-1) precise; urgency=low + + * New upstream release, commit f8ceaa4 + + -- Xavier Boudet Wed, 19 Sep 2012 17:19:03 +0200 + dce (1.6.5.2-1) precise; urgency=low * New upstream release, commit 78215f5 diff -Nru dce-1.6.5.2/debian/control dce-1.6.5.3/debian/control --- dce-1.6.5.2/debian/control 2012-09-23 01:12:11.000000000 +0000 +++ dce-1.6.5.3/debian/control 2012-09-23 01:12:11.000000000 +0000 @@ -9,10 +9,11 @@ libdri2-dev (>= 1.0.2-0ubuntu2), libxext-dev, libxfixes-dev, - xserver-xorg-dev + xserver-xorg-dev, + libwayland-dev Standards-Version: 3.9.2 Homepage: https://gitorious.org/gstreamer-omap/libdce -Vcs-Git: git://gitorious.org/gstreamer-omap/libdce.git +Vcs-Git: git://gitorious.org/ubuntu-omap/dce.git Package: libdce0 Section: libs diff -Nru dce-1.6.5.2/ducati/ti/dce/dce.c dce-1.6.5.3/ducati/ti/dce/dce.c --- dce-1.6.5.2/ducati/ti/dce/dce.c 2012-08-10 09:31:19.000000000 +0000 +++ dce-1.6.5.3/ducati/ti/dce/dce.c 2012-09-19 15:13:08.000000000 +0000 @@ -273,6 +273,7 @@ Engine_Error ec; DEBUG(">> name=%s", req->name); + ivahd_boot(); rsp->engine = (uint32_t)Engine_open(req->name, NULL, &ec); rsp->error_code = ec; DEBUG("<< engine=%08x, ec=%d", rsp->engine, rsp->error_code); @@ -301,9 +302,11 @@ DEBUG(">> engine=%08x, name=%s, sparams=%p, codec_id=%d", req->engine, req->name, sparams, req->codec_id); DEBUG(" sparams size: %d", ((int32_t *)sparams)[0]); + ivahd_acquire(); rsp->codec = (uint32_t)codec_fxns[req->codec_id].create( (Engine_Handle)req->engine, req->name, sparams); dce_clean(sparams); + ivahd_release(); DEBUG("<< codec=%08x", rsp->codec); #ifdef MEMORYSTATS_DEBUG @@ -326,10 +329,12 @@ req->codec, req->cmd_id, dparams, status, req->codec_id); DEBUG(" dparams size: %d", ((int32_t *)dparams)[0]); DEBUG(" status size: %d", ((int32_t *)status)[0]); + ivahd_acquire(); rsp->result = codec_fxns[req->codec_id].control( (void *)req->codec, req->cmd_id, dparams, status); dce_clean(dparams); dce_clean(status); + ivahd_release(); DEBUG("<< ret=%d", rsp->result); return sizeof(*rsp); @@ -452,18 +457,18 @@ rsp->result = IALG_EOK; + ivahd_acquire(); if (req->reloc_len) rsp->result = codec_fxns[codec_id].reloc( (void *)req->codec, reloc, (req->reloc_len * 4)); if (rsp->result == IALG_EOK) { - ivahd_acquire(); rsp->result = codec_fxns[codec_id].process( (void *)req->codec, in_bufs, out_bufs, in_args, out_args); - ivahd_release(); } else { DEBUG("reloc failed"); } + ivahd_release(); DEBUG("<< ret=%d", rsp->result); @@ -502,7 +507,9 @@ struct dce_rpc_codec_delete_req *req = msg; DEBUG(">> codec=%08x, codec_id=%d", req->codec, req->codec_id); + ivahd_acquire(); codec_fxns[req->codec_id].delete((void *)req->codec); + ivahd_release(); DEBUG("<<"); #ifdef MEMORYSTATS_DEBUG diff -Nru dce-1.6.5.2/ducati/ti/dce/dce_priv.h dce-1.6.5.3/ducati/ti/dce/dce_priv.h --- dce-1.6.5.2/ducati/ti/dce/dce_priv.h 2012-08-10 09:31:19.000000000 +0000 +++ dce-1.6.5.3/ducati/ti/dce/dce_priv.h 2012-09-19 15:13:08.000000000 +0000 @@ -49,6 +49,7 @@ void ivahd_acquire(void); void ivahd_release(void); void ivahd_init(uint32_t chipset_id); +void ivahd_boot(); #endif #ifndef DIM diff -Nru dce-1.6.5.2/ducati/ti/dce/ivahd.c dce-1.6.5.3/ducati/ti/dce/ivahd.c --- dce-1.6.5.2/ducati/ti/dce/ivahd.c 2012-08-10 09:31:19.000000000 +0000 +++ dce-1.6.5.3/ducati/ti/dce/ivahd.c 2012-09-19 15:13:08.000000000 +0000 @@ -43,7 +43,6 @@ #include #include #include -#include #include #include "dce_priv.h" @@ -120,7 +119,7 @@ Task_sleep(((ms * 1000 + (Clock_tickPeriod - 1)) / Clock_tickPeriod)); } -static void ivahd_boot(void) +void ivahd_boot(void) { int i; volatile unsigned int *icont1_itcm_base_addr = @@ -134,26 +133,6 @@ DEBUG("Booting IVAHD..."); - /* Reset IVAHD sequencers and SL2 */ - RM_IVAHD_RSTCTRL = 0x00000007; - sleepms(10); - - /* Turn IVA power state to on */ - PM_IVAHD_PWRSTCTRL = 0x00000003; - sleepms(10); - - /* First put IVA into SW_WKUP mode */ - CM_IVAHD_CLKSTCTRL = 0x00000002; - sleepms(10); - - /* Set IVA clock to 'auto' */ - CM_IVAHD_CLKCTRL = 0x00000001; - sleepms(10); - - /* Set SL2 clock to 'auto' */ - CM_IVAHD_SL2_CLKCTRL = 0x00000001; - sleepms(10); - /* put ICONT1 & ICONT2 in reset and remove SL2 reset */ RM_IVAHD_RSTCTRL = 0x00000003; sleepms(10); @@ -243,7 +222,8 @@ UInt hwiKey = Hwi_disable(); if (++ivahd_use_cnt == 1) { DEBUG("ivahd acquire"); - set_ivahd_opp(100); + /* switch SW_WAKEUP mode */ + CM_IVAHD_CLKSTCTRL = 0x00000002; } else { DEBUG("ivahd already acquired"); } @@ -255,7 +235,8 @@ UInt hwiKey = Hwi_disable(); if (ivahd_use_cnt-- == 1) { DEBUG("ivahd release"); - set_ivahd_opp(0); + /* switch HW_AUTO mode */ + CM_IVAHD_CLKSTCTRL = 0x00000003; } else { DEBUG("ivahd still in use"); } @@ -302,6 +283,8 @@ /* bit of a hack.. not sure if there is a better way for this: */ HDVICP2_PARAMS.resetControlAddress[0] = ivahd_base + 0xF10; + ivahd_acquire(); + CERuntime_init(); ret = RMAN_init(); @@ -329,14 +312,10 @@ sleepms(10); - ivahd_boot(); - - /* clear HSDIVDER_CLKOUT2_DIV */ - set_ivahd_opp(0); - DEBUG("RMAN_register() for HDVICP is successful"); end: + ivahd_release(); return; } diff -Nru dce-1.6.5.2/libdce-wayland.c dce-1.6.5.3/libdce-wayland.c --- dce-1.6.5.2/libdce-wayland.c 1970-01-01 00:00:00.000000000 +0000 +++ dce-1.6.5.3/libdce-wayland.c 2012-09-19 15:13:08.000000000 +0000 @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "wayland-drm-client-protocol.h" + +#include + +struct display +{ + struct wl_display *display; + struct wl_drm *drm; + + int error; + int fd; + int authenticated; +}; + + +static void +drm_handle_device(void *data, struct wl_drm *drm, const char *device) +{ + struct display *d = data; + drm_magic_t magic; + + /* only open the device if we don't already have an fd.. see + * dce_set_fd(). Need to sort out a better way to handle this + * but GEM buffer handles are only valid within the context of + * a given file-open. Switching to dmabuf or flink handles + * would solve this. + */ + if (d->fd == -1) { + d->fd = open(device, O_RDWR | O_CLOEXEC); + if (d->fd == -1) { + ERROR("could not open %s: %m", device); + d->error = 1; + return; + } + } + + drmGetMagic (d->fd, &magic); + wl_drm_authenticate (d->drm, magic); +} + +static void +drm_handle_format(void *data, struct wl_drm *drm, uint32_t format) +{ +} + +static void +drm_handle_authenticated(void *data, struct wl_drm *drm) +{ + struct display *d = data; + INFO("authenticated"); + d->authenticated = 1; +} + +static const struct wl_drm_listener drm_listener = { + drm_handle_device, + drm_handle_format, + drm_handle_authenticated +}; + + +static void +display_handle_global (struct wl_display *display, uint32_t id, + const char *interface, uint32_t version, void *data) +{ + struct display *d = data; + + DEBUG("global: %s", interface); + + if (strcmp(interface, "wl_drm") == 0) { + d->drm = wl_display_bind(display, id, &wl_drm_interface); + wl_drm_add_listener(d->drm, &drm_listener, d); + } +} + +int dce_auth_wayland(int fd) +{ + struct display disp = {0}; + struct display *d = &disp; + + d->fd = fd; + + d->display = wl_display_connect(NULL); + wl_display_add_global_listener (d->display, + display_handle_global, d); + + while (!(d->authenticated || d->error)) { + INFO("waiting for authentication"); + wl_display_roundtrip (d->display); + } + + /* and then close display now that we are authenticated: */ + wl_drm_destroy (d->drm); + wl_display_flush (d->display); + wl_display_disconnect (d->display); + + return d->fd; +} diff -Nru dce-1.6.5.2/libdce-x11.c dce-1.6.5.3/libdce-x11.c --- dce-1.6.5.2/libdce-x11.c 1970-01-01 00:00:00.000000000 +0000 +++ dce-1.6.5.3/libdce-x11.c 2012-09-19 15:13:08.000000000 +0000 @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +int dce_auth_x11(int fd) +{ + Display *dpy; + Window root; + drm_magic_t magic; + int eventBase, errorBase, major, minor; + char *driver, *device; + + INFO("attempting to open X11 connection"); + dpy = XOpenDisplay(NULL); + if (!dpy) { + ERROR("Could not open display"); + goto no_x11; + } + + if (!DRI2InitDisplay(dpy, NULL)) { + ERROR("DRI2InitDisplay failed"); + goto no_x11; + } + + if (!DRI2QueryExtension(dpy, &eventBase, &errorBase)) { + ERROR("DRI2QueryExtension failed"); + goto no_x11; + } + + DEBUG("DRI2QueryExtension: eventBase=%d, errorBase=%d", eventBase, errorBase); + + if (!DRI2QueryVersion(dpy, &major, &minor)) { + ERROR("DRI2QueryVersion failed"); + goto no_x11; + } + + DEBUG("DRI2QueryVersion: major=%d, minor=%d", major, minor); + + root = RootWindow(dpy, DefaultScreen(dpy)); + + if (!DRI2Connect(dpy, root, DRI2DriverDRI, &driver, &device)) { + DEBUG("DRI2Connect failed"); + goto no_x11; + } + + DEBUG("DRI2Connect: driver=%s, device=%s", driver, device); + + /* only open the device if we don't already have an fd.. see + * dce_set_fd(). Need to sort out a better way to handle this + * but GEM buffer handles are only valid within the context of + * a given file-open. Switching to dmabuf or flink handles + * would solve this. + */ + if (fd == -1) { + fd = open(device, O_RDWR); + if (fd < 0) { + ERROR("open failed"); + goto no_x11_free; + } + } + + if (drmGetMagic(fd, &magic)) { + ERROR("drmGetMagic failed"); + goto no_x11_free; + } + + if (!DRI2Authenticate(dpy, root, magic)) { + ERROR("DRI2Authenticate failed"); + goto no_x11_free; + } + +no_x11_free: + XFree(driver); + XFree(device); +no_x11: + return fd; +} diff -Nru dce-1.6.5.2/libdce.c dce-1.6.5.3/libdce.c --- dce-1.6.5.2/libdce.c 2012-08-10 09:31:19.000000000 +0000 +++ dce-1.6.5.3/libdce.c 2012-09-19 15:13:08.000000000 +0000 @@ -51,10 +51,10 @@ #include #ifdef HAVE_X11 -# include -# include -# include -# include +int dce_auth_x11(int fd); +#endif +#ifdef HAVE_WAYLAND +int dce_auth_wayland(int fd); #endif static int init(void); @@ -417,15 +417,10 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static int count = 0; + static int init(void) { -#ifdef HAVE_X11 - Display *dpy; - Window root; - drm_magic_t magic; - int eventBase, errorBase, major, minor; - char *driver, *device; -#endif + int authenticated = 0; pthread_mutex_lock(&mutex); @@ -434,73 +429,22 @@ } #ifdef HAVE_X11 - INFO("attempting to open X11 connection"); - dpy = XOpenDisplay(NULL); - if (!dpy) { - ERROR("Could not open display"); - goto no_x11; - } - - if (!DRI2InitDisplay(dpy, NULL)) { - ERROR("DRI2InitDisplay failed"); - goto no_x11; - } - - if (!DRI2QueryExtension(dpy, &eventBase, &errorBase)) { - ERROR("DRI2QueryExtension failed"); - goto no_x11; - } - - DEBUG("DRI2QueryExtension: eventBase=%d, errorBase=%d", eventBase, errorBase); - - if (!DRI2QueryVersion(dpy, &major, &minor)) { - ERROR("DRI2QueryVersion failed"); - goto no_x11; - } - - DEBUG("DRI2QueryVersion: major=%d, minor=%d", major, minor); - - root = RootWindow(dpy, DefaultScreen(dpy)); - - if (!DRI2Connect(dpy, root, DRI2DriverDRI, &driver, &device)) { - DEBUG("DRI2Connect failed"); - goto no_x11; - } - - DEBUG("DRI2Connect: driver=%s, device=%s", driver, device); - - /* only open the device if we don't already have an fd.. see - * dce_set_fd(). Need to sort out a better way to handle this - * but GEM buffer handles are only valid within the context of - * a given file-open. Switching to dmabuf or flink handles - * would solve this. - */ - if (fd == -1) { - fd = open(device, O_RDWR); - if (fd < 0) { - ERROR("open failed"); - goto no_x11_free; - } - } - - if (drmGetMagic(fd, &magic)) { - ERROR("drmGetMagic failed"); - goto no_x11_free; + if (!authenticated) { + fd = dce_auth_x11(fd); + if (fd != -1) + authenticated = 1; } - - if (!DRI2Authenticate(dpy, root, magic)) { - ERROR("DRI2Authenticate failed"); - goto no_x11_free; +#endif +#ifdef HAVE_WAYLAND + if (!authenticated) { + fd = dce_auth_wayland(fd); + if (fd != -1) + authenticated = 1; } - -no_x11_free: - XFree(driver); - XFree(device); -no_x11: #endif - if (fd == -1) { - INFO("no X11, fallback to opening DRM device directly"); + if (!authenticated) { + INFO("no X11/wayland, fallback to opening DRM device directly"); fd = drmOpen("omapdrm", "platform:omapdrm:00"); } diff -Nru dce-1.6.5.2/wayland-drm-client-protocol.h dce-1.6.5.3/wayland-drm-client-protocol.h --- dce-1.6.5.2/wayland-drm-client-protocol.h 1970-01-01 00:00:00.000000000 +0000 +++ dce-1.6.5.3/wayland-drm-client-protocol.h 2012-09-19 15:13:08.000000000 +0000 @@ -0,0 +1,213 @@ +/* + * 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. + */ + +#ifndef DRM_CLIENT_PROTOCOL_H +#define DRM_CLIENT_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-util.h" + +struct wl_client; +struct wl_resource; + +struct wl_drm; + +extern const struct wl_interface wl_drm_interface; + +#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_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_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); +}; + +static inline int +wl_drm_add_listener(struct wl_drm *wl_drm, + const struct wl_drm_listener *listener, void *data) +{ + return wl_proxy_add_listener((struct wl_proxy *) wl_drm, + (void (**)(void)) listener, data); +} + +#define WL_DRM_AUTHENTICATE 0 +#define WL_DRM_CREATE_BUFFER 1 +#define WL_DRM_CREATE_PLANAR_BUFFER 2 + +static inline void +wl_drm_set_user_data(struct wl_drm *wl_drm, void *user_data) +{ + wl_proxy_set_user_data((struct wl_proxy *) wl_drm, user_data); +} + +static inline void * +wl_drm_get_user_data(struct wl_drm *wl_drm) +{ + return wl_proxy_get_user_data((struct wl_proxy *) wl_drm); +} + +static inline void +wl_drm_destroy(struct wl_drm *wl_drm) +{ + wl_proxy_destroy((struct wl_proxy *) wl_drm); +} + +static inline void +wl_drm_authenticate(struct wl_drm *wl_drm, uint32_t id) +{ + wl_proxy_marshal((struct wl_proxy *) wl_drm, + WL_DRM_AUTHENTICATE, id); +} + +static inline struct wl_buffer * +wl_drm_create_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t stride, uint32_t format) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) wl_drm, + &wl_buffer_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) wl_drm, + WL_DRM_CREATE_BUFFER, id, name, width, height, stride, format); + + return (struct wl_buffer *) id; +} + +static inline struct wl_buffer * +wl_drm_create_planar_buffer(struct wl_drm *wl_drm, 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) +{ + struct wl_proxy *id; + + id = wl_proxy_create((struct wl_proxy *) wl_drm, + &wl_buffer_interface); + if (!id) + return NULL; + + wl_proxy_marshal((struct wl_proxy *) wl_drm, + WL_DRM_CREATE_PLANAR_BUFFER, id, name, width, height, format, offset0, stride0, offset1, stride1, offset2, stride2); + + return (struct wl_buffer *) id; +} + +#ifdef __cplusplus +} +#endif + +#endif diff -Nru dce-1.6.5.2/wayland-drm-protocol.c dce-1.6.5.3/wayland-drm-protocol.c --- dce-1.6.5.2/wayland-drm-protocol.c 1970-01-01 00:00:00.000000000 +0000 +++ dce-1.6.5.3/wayland-drm-protocol.c 2012-09-19 15:13:08.000000000 +0000 @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#include +#include +#include "wayland-util.h" + +extern const struct wl_interface wl_buffer_interface; +extern const struct wl_interface wl_buffer_interface; + +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, +}; + +static const struct wl_message wl_drm_requests[] = { + { "authenticate", "u", types + 0 }, + { "create_buffer", "nuiiuu", types + 1 }, + { "create_planar_buffer", "nuiiuiiiiii", types + 7 }, +}; + +static const struct wl_message wl_drm_events[] = { + { "device", "s", types + 0 }, + { "format", "u", types + 0 }, + { "authenticated", "", types + 0 }, +}; + +WL_EXPORT const struct wl_interface wl_drm_interface = { + "wl_drm", 1, + ARRAY_LENGTH(wl_drm_requests), wl_drm_requests, + ARRAY_LENGTH(wl_drm_events), wl_drm_events, +}; +