Page MenuHomeFreeBSD

D10599.id36407.diff
No OneTemporary

D10599.id36407.diff

Index: GIDs
===================================================================
--- GIDs
+++ GIDs
@@ -801,7 +801,7 @@
# free: 857
# free: 858
# free: 859
-# free: 860
+weston-launch:*:860:
# free: 861
# free: 862
# free: 863
Index: x11-wm/Makefile
===================================================================
--- x11-wm/Makefile
+++ x11-wm/Makefile
@@ -120,6 +120,7 @@
SUBDIR += vtwm
SUBDIR += w9wm
SUBDIR += weewm
+ SUBDIR += weston
SUBDIR += windowlab
SUBDIR += windowmaker
SUBDIR += wm2
Index: x11-wm/weston/Makefile
===================================================================
--- /dev/null
+++ x11-wm/weston/Makefile
@@ -0,0 +1,102 @@
+# Created by: Johannes Lundberg <johalun0@gmail.com>
+# $FreeBSD$
+
+PORTNAME= weston
+PORTVERSION= 3.0.0
+CATEGORIES= x11-wm wayland
+MASTER_SITES= http://wayland.freedesktop.org/releases/
+
+MAINTAINER= x11@freebsd.org
+COMMENT= Wayland Reference Compositor
+
+LICENSE= MIT
+
+BUILD_DEPENDS= wayland-protocols>=1.7:graphics/wayland-protocols
+LIB_DEPENDS= \
+ libxkbcommon.so:x11/libxkbcommon \
+ libpixman-1.so:x11/pixman \
+ libcairo.so:graphics/cairo \
+ libpango-1.0.so:x11-toolkits/pango \
+ libcolord.so:graphics/colord \
+ libfontconfig.so:x11-fonts/fontconfig \
+ libfreetype.so:print/freetype2 \
+ libwayland-server.so:graphics/wayland \
+ libevent.so:devel/libevent \
+ libpng.so:graphics/png \
+ libwebp.so:graphics/webp \
+ libffi.so:devel/libffi \
+ libepoll-shim.so:devel/libepoll-shim \
+ libudev.so:devel/libudev-devd \
+ libunwind.so:devel/libunwind \
+ libevdev.so:devel/libevdev \
+ libinput.so:x11/libinput \
+ libmtdev.so:devel/libmtdev
+
+USES= autoreconf alias gmake pathfix jpeg libtool pkgconfig tar:xz localbase:ldflags
+
+USE_XORG= x11 xcb xcursor
+USE_GL= egl gbm glesv2
+
+OPTIONS_SUB= yes
+OPTIONS_DEFINE= SUID CLIENTS CLIENTS_INSTALL XWAYLAND
+OPTIONS_MULTI= COMPOSITORS
+OPTIONS_MULTI_COMPOSITORS= X11 DRM WAYLAND SCFB
+OPTIONS_SINGLE= CAIRO
+OPTIONS_SINGLE_CAIRO= CAIROIMAGE CAIROGL CAIROGLESV2
+
+OPTIONS_DEFAULT= SUID CAIROIMAGE CLIENTS CLIENTS_INSTALL XWAYLAND X11 DRM WAYLAND SCFB
+
+CAIRO_DESC= Cairo backend
+CAIROGL_DESC= GL (enabled in cairo by default)
+CAIROGLESV2_DESC= GLESv2 (requires cairo built with --enable-glesv2)
+CAIROIMAGE_DESC= Image (Recommended)
+CLIENTS_DESC= Build Weston clients
+CLIENTS_INSTALL_DESC= Install Weston clients
+DRM_DESC= Hardware accelerated compositor backend
+SCFB_DESC= Software rendered compositor backend
+SUID_DESC= Install weston-launch binary with setuid bit set
+WAYLAND_DESC= Nested Weston compositors
+X11_DESC= Run Weston as X11 client (good for testing)
+XWAYLAND_DESC= Support running X clients in Weston
+
+CAIROIMAGE_CONFIGURE_ON= --with-cairo=image
+CAIROGL_CONFIGURE_ON= --with-cairo=gl
+CAIROGLESV2_CONFIGURE_ON= --with-cairo=glesv2 --with-cairo-glesv2
+CLIENTS_CONFIGURE_ENABLE= clients
+CLIENTS_INSTALL_CONFIGURE_ENABLE= demo-clients-install
+DRM_CONFIGURE_ENABLE= drm-compositor
+DRM_LIB_DEPENDS= libdrm.so:graphics/libdrm
+SCFB_CONFIGURE_ENABLE= scfb-compositor
+WAYLAND_CONFIGURE_ENABLE= wayland-compositor
+X11_CONFIGURE_ENABLE= x11-compositor
+XWAYLAND_CONFIGURE_ENABLE= xwayland
+
+CPPFLAGS+= -I${LOCALBASE}/include/libepoll-shim
+
+GROUPS= weston-launch
+
+GNU_CONFIGURE= YES
+
+CONFIGURE_ARGS= --enable-weston-launch
+CONFIGURE_ARGS+= --disable-fbdev-compositor
+CONFIGURE_ARGS+= --disable-vaapi-recorder
+CONFIGURE_ARGS+= --disable-xwayland-test
+
+# We handle setuid in the plist. This allows to build as a user.
+CONFIGURE_ARGS+= --disable-setuid-install
+
+CONFIGURE_ENV+= LIBS="-lepoll-shim -lrt -lEGL"
+CONFIGURE_ENV+= EGL_TESTS_LIBS="-lwayland-client -lGLESv2 -lwayland-egl -lwayland-client"
+CONFIGURE_ENV+= EGL_TESTS_CFLAGS="-L${STAGEDIR}${PREFIX}/lib -I${STAGEDIR}${PREFIX}/include"
+
+# Should not have to do this. "make" should find them in $WAYLAND_PROTOCOLS_DATADIR set by automake...
+WAYLAND_PROTOCOLS_DATADIR=`pkg-config --variable=pkgdatadir wayland-protocols`
+pre-configure:
+ @${CP} ${WAYLAND_PROTOCOLS_DATADIR}/stable/*/* ${WRKSRC}/protocol/
+ @${CP} ${WAYLAND_PROTOCOLS_DATADIR}/unstable/*/* ${WRKSRC}/protocol/
+ @if ! pkg-config --exists wayland-egl; then \
+ ${ECHO_MSG} "${PKGNAME}: Needs mesa-libs with wayland support enabled."; \
+ ${FALSE}; \
+ fi
+
+.include <bsd.port.mk>
Index: x11-wm/weston/distinfo
===================================================================
--- /dev/null
+++ x11-wm/weston/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1507883343
+SHA256 (weston-3.0.0.tar.xz) = cde1d55e8dd70c3cbb3d1ec72f60e60000041579caa1d6a262bd9c35e93723a5
+SIZE (weston-3.0.0.tar.xz) = 1300340
Index: x11-wm/weston/files/patch-Makefile.am
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-Makefile.am
@@ -0,0 +1,47 @@
+--- Makefile.am.orig 2017-10-13 15:26:13 UTC
++++ Makefile.am
+@@ -85,6 +85,7 @@ libweston_@LIBWESTON_MAJOR@_la_SOURCES = \
+ libweston/compositor.h \
+ libweston/compositor-drm.h \
+ libweston/compositor-fbdev.h \
++ libweston/compositor-scfb.h \
+ libweston/compositor-headless.h \
+ libweston/compositor-rdp.h \
+ libweston/compositor-wayland.h \
+@@ -295,6 +296,7 @@ libwestoninclude_HEADERS = \
+ libweston/compositor.h \
+ libweston/compositor-drm.h \
+ libweston/compositor-fbdev.h \
++ libweston/compositor-scfb.h \
+ libweston/compositor-headless.h \
+ libweston/compositor-rdp.h \
+ libweston/compositor-wayland.h \
+@@ -459,6 +461,28 @@ fbdev_backend_la_CFLAGS = \
+ fbdev_backend_la_SOURCES = \
+ libweston/compositor-fbdev.c \
+ libweston/compositor-fbdev.h \
++ shared/helpers.h \
++ $(INPUT_BACKEND_SOURCES)
++endif
++
++if ENABLE_SCFB_COMPOSITOR
++libweston_module_LTLIBRARIES += scfb-backend.la
++scfb_backend_la_LDFLAGS = -module -avoid-version
++scfb_backend_la_LIBADD = \
++ $(COMPOSITOR_LIBS) \
++ $(SCFB_COMPOSITOR_LIBS) \
++ $(INPUT_BACKEND_LIBS) \
++ libsession-helper.la \
++ libshared.la
++scfb_backend_la_CFLAGS = \
++ $(COMPOSITOR_CFLAGS) \
++ $(EGL_CFLAGS) \
++ $(SCFB_COMPOSITOR_CFLAGS) \
++ $(PIXMAN_CFLAGS) \
++ $(AM_CFLAGS)
++scfb_backend_la_SOURCES = \
++ libweston/compositor-scfb.c \
++ libweston/compositor-scfb.h \
+ shared/helpers.h \
+ $(INPUT_BACKEND_SOURCES)
+ endif
Index: x11-wm/weston/files/patch-clients_desktop-shell.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-clients_desktop-shell.c
@@ -0,0 +1,19 @@
+--- clients/desktop-shell.c.orig 2017-08-08 18:57:02 UTC
++++ clients/desktop-shell.c
+@@ -41,6 +41,7 @@
+ #include <ctype.h>
+ #include <time.h>
+ #include <assert.h>
++#include <signal.h>
+
+ #include <wayland-client.h>
+ #include "window.h"
+@@ -49,6 +50,8 @@
+ #include "shared/helpers.h"
+ #include "shared/xalloc.h"
+ #include "shared/zalloc.h"
++
++#define program_invocation_short_name getprogname()
+
+ #include "weston-desktop-shell-client-protocol.h"
+
Index: x11-wm/weston/files/patch-clients_ivi-shell-user-interface.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-clients_ivi-shell-user-interface.c
@@ -0,0 +1,161 @@
+--- clients/ivi-shell-user-interface.c.orig 2017-10-13 16:13:46 UTC
++++ clients/ivi-shell-user-interface.c
+@@ -218,7 +218,7 @@ set_pointer_image(struct wlContextCommon *pCtx, uint32
+ return;
+
+ if (cursor->image_count <= index) {
+- fprintf(stderr, "cursor index out of range\n");
++ fprintf(stderr, "cursor index out of range\r\n");
+ return;
+ }
+
+@@ -250,7 +250,7 @@ PointerHandleEnter(void *data, struct wl_pointer *wlPo
+ pCtx->enterSurface = wlSurface;
+ set_pointer_image(pCtx, 0);
+ #ifdef _DEBUG
+- printf("ENTER PointerHandleEnter: x(%d), y(%d)\n", sx, sy);
++ printf("ENTER PointerHandleEnter: x(%d), y(%d)\r\n", sx, sy);
+ #endif
+ }
+
+@@ -263,7 +263,7 @@ PointerHandleLeave(void *data, struct wl_pointer *wlPo
+ pCtx->enterSurface = NULL;
+
+ #ifdef _DEBUG
+- printf("ENTER PointerHandleLeave: serial(%d)\n", serial);
++ printf("ENTER PointerHandleLeave: serial(%d)\r\n", serial);
+ #endif
+ }
+
+@@ -272,7 +272,7 @@ PointerHandleMotion(void *data, struct wl_pointer *wlP
+ wl_fixed_t sx, wl_fixed_t sy)
+ {
+ #ifdef _DEBUG
+- printf("ENTER PointerHandleMotion: x(%d), y(%d)\n", sx, sy);
++ printf("ENTER PointerHandleMotion: x(%d), y(%d)\r\n", sx, sy);
+ #endif
+ }
+
+@@ -287,13 +287,13 @@ execute_process(char *path, char *argv[])
+ {
+ pid_t pid = fork();
+ if (pid < 0)
+- fprintf(stderr, "Failed to fork\n");
++ fprintf(stderr, "Failed to fork\r\n");
+
+ if (pid)
+ return pid;
+
+ if (-1 == execve(path, argv, environ)) {
+- fprintf(stderr, "Failed to execve %s\n", path);
++ fprintf(stderr, "Failed to execve %s\r\n", path);
+ exit(1);
+ }
+
+@@ -408,7 +408,7 @@ PointerHandleButton(void *data, struct wl_pointer *wlP
+ break;
+ }
+ #ifdef _DEBUG
+- printf("ENTER PointerHandleButton: button(%d), state(%d)\n",
++ printf("ENTER PointerHandleButton: button(%d), state(%d)\r\n",
+ button, state);
+ #endif
+ }
+@@ -418,7 +418,7 @@ PointerHandleAxis(void *data, struct wl_pointer *wlPoi
+ uint32_t axis, wl_fixed_t value)
+ {
+ #ifdef _DEBUG
+- printf("ENTER PointerHandleAxis: axis(%d), value(%d)\n", axis, value);
++ printf("ENTER PointerHandleAxis: axis(%d), value(%d)\r\n", axis, value);
+ #endif
+ }
+
+@@ -766,7 +766,7 @@ create_cursors(struct wlContextCommon *cmm)
+ }
+
+ if (!cursor) {
+- fprintf(stderr, "could not load cursor '%s'\n",
++ fprintf(stderr, "could not load cursor '%s'\r\n",
+ cursors[i].names[0]);
+ }
+
+@@ -805,7 +805,7 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
+
+ fd = os_create_anonymous_file(size);
+ if (fd < 0) {
+- fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
++ fprintf(stderr, "creating a buffer file for %d B failed: %m\r\n",
+ size);
+ return ;
+ }
+@@ -814,7 +814,7 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
+ mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+
+ if (MAP_FAILED == p_wlCtx->data) {
+- fprintf(stderr, "mmap failed: %m\n");
++ fprintf(stderr, "mmap failed: %m\r\n");
+ close(fd);
+ return;
+ }
+@@ -827,7 +827,7 @@ createShmBuffer(struct wlContextStruct *p_wlCtx)
+ WL_SHM_FORMAT_ARGB8888);
+
+ if (NULL == p_wlCtx->wlBuffer) {
+- fprintf(stderr, "wl_shm_create_buffer failed: %m\n");
++ fprintf(stderr, "wl_shm_create_buffer failed: %m\r\n");
+ close(fd);
+ return;
+ }
+@@ -866,7 +866,7 @@ createSurface(struct wlContextStruct *p_wlCtx)
+ p_wlCtx->wlSurface =
+ wl_compositor_create_surface(p_wlCtx->cmm->wlCompositor);
+ if (NULL == p_wlCtx->wlSurface) {
+- printf("Error: wl_compositor_create_surface failed.\n");
++ printf("Error: wl_compositor_create_surface failed.\r\n");
+ destroyWLContextCommon(p_wlCtx->cmm);
+ abort();
+ }
+@@ -920,7 +920,7 @@ create_ivisurface(struct wlContextStruct *p_wlCtx,
+ id_surface,
+ p_wlCtx->wlSurface);
+ if (ivisurf == NULL) {
+- fprintf(stderr, "Failed to create ivi_client_surface\n");
++ fprintf(stderr, "Failed to create ivi_client_surface\r\n");
+ return;
+ }
+
+@@ -935,7 +935,7 @@ create_ivisurfaceFromFile(struct wlContextStruct *p_wl
+ cairo_surface_t *surface = load_cairo_surface(imageFile);
+
+ if (NULL == surface) {
+- fprintf(stderr, "Failed to load_cairo_surface %s\n", imageFile);
++ fprintf(stderr, "Failed to load_cairo_surface %s\r\n", imageFile);
+ return;
+ }
+
+@@ -1226,7 +1226,7 @@ int main(int argc, char **argv)
+
+ wlCtxCommon.wlDisplay = wl_display_connect(NULL);
+ if (NULL == wlCtxCommon.wlDisplay) {
+- printf("Error: wl_display_connect failed.\n");
++ printf("Error: wl_display_connect failed.\r\n");
+ return -1;
+ }
+
+@@ -1238,14 +1238,14 @@ int main(int argc, char **argv)
+ wl_display_roundtrip(wlCtxCommon.wlDisplay);
+
+ if (wlCtxCommon.wlShm == NULL) {
+- fprintf(stderr, "No wl_shm global\n");
++ fprintf(stderr, "No wl_shm global\r\n");
+ exit(1);
+ }
+
+ wl_display_roundtrip(wlCtxCommon.wlDisplay);
+
+ if (!(wlCtxCommon.formats & (1 << WL_SHM_FORMAT_XRGB8888))) {
+- fprintf(stderr, "WL_SHM_FORMAT_XRGB32 not available\n");
++ fprintf(stderr, "WL_SHM_FORMAT_XRGB32 not available\r\n");
+ exit(1);
+ }
+
Index: x11-wm/weston/files/patch-clients_screenshot.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-clients_screenshot.c
@@ -0,0 +1,11 @@
+--- clients/screenshot.c.orig 2017-08-08 18:57:02 UTC
++++ clients/screenshot.c
+@@ -40,6 +40,8 @@
+ #include "shared/os-compatibility.h"
+ #include "shared/xalloc.h"
+
++#define program_invocation_short_name getprogname()
++
+ /* The screenshooter is a good example of a custom object exposed by
+ * the compositor and serves as a test bed for implementing client
+ * side marshalling outside libwayland.so */
Index: x11-wm/weston/files/patch-clients_terminal.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-clients_terminal.c
@@ -0,0 +1,24 @@
+--- clients/terminal.c.orig 2017-08-08 18:57:02 UTC
++++ clients/terminal.c
+@@ -32,7 +32,11 @@
+ #include <unistd.h>
+ #include <math.h>
+ #include <time.h>
+-#include <pty.h>
++/* #include <pty.h> */
++#include <sys/types.h>
++#include <sys/ioctl.h>
++#include <termios.h>
++#include <libutil.h>
+ #include <ctype.h>
+ #include <cairo.h>
+ #include <sys/epoll.h>
+@@ -3112,7 +3116,7 @@ int main(int argc, char *argv[])
+
+ option_shell = getenv("SHELL");
+ if (!option_shell)
+- option_shell = "/bin/bash";
++ option_shell = "/bin/sh";
+
+ config_file = weston_config_get_name_from_env();
+ config = weston_config_parse(config_file);
Index: x11-wm/weston/files/patch-clients_weston-info.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-clients_weston-info.c
@@ -0,0 +1,15 @@
+--- clients/weston-info.c.orig 2017-08-08 18:57:02 UTC
++++ clients/weston-info.c
+@@ -605,9 +605,9 @@ clock_name(clockid_t clk_id)
+ static const char *names[] = {
+ [CLOCK_REALTIME] = "CLOCK_REALTIME",
+ [CLOCK_MONOTONIC] = "CLOCK_MONOTONIC",
+- [CLOCK_MONOTONIC_RAW] = "CLOCK_MONOTONIC_RAW",
+- [CLOCK_REALTIME_COARSE] = "CLOCK_REALTIME_COARSE",
+- [CLOCK_MONOTONIC_COARSE] = "CLOCK_MONOTONIC_COARSE",
++ /* [CLOCK_MONOTONIC_RAW] = "CLOCK_MONOTONIC_RAW", */
++ /* [CLOCK_REALTIME_COARSE] = "CLOCK_REALTIME_COARSE", */
++ /* [CLOCK_MONOTONIC_COARSE] = "CLOCK_MONOTONIC_COARSE", */
+ #ifdef CLOCK_BOOTTIME
+ [CLOCK_BOOTTIME] = "CLOCK_BOOTTIME",
+ #endif
Index: x11-wm/weston/files/patch-clients_window.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-clients_window.c
@@ -0,0 +1,450 @@
+--- clients/window.c.orig 2017-10-13 16:21:15 UTC
++++ clients/window.c
+@@ -616,7 +616,7 @@ egl_window_surface_acquire(struct toysurface *base, EG
+ cairo_device_acquire(device);
+ if (!eglMakeCurrent(surface->display->dpy, surface->egl_surface,
+ surface->egl_surface, ctx))
+- fprintf(stderr, "failed to make surface current\n");
++ fprintf(stderr, "failed to make surface current\r\n");
+
+ return 0;
+ }
+@@ -633,7 +633,7 @@ egl_window_surface_release(struct toysurface *base)
+
+ if (!eglMakeCurrent(surface->display->dpy,
+ EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT))
+- fprintf(stderr, "failed to make context current\n");
++ fprintf(stderr, "failed to make context current\r\n");
+
+ cairo_device_release(device);
+ }
+@@ -746,14 +746,14 @@ make_shm_pool(struct display *display, int size, void
+
+ fd = os_create_anonymous_file(size);
+ if (fd < 0) {
+- fprintf(stderr, "creating a buffer file for %d B failed: %m\n",
++ fprintf(stderr, "creating a buffer file for %d B failed: %m\r\n",
+ size);
+ return NULL;
+ }
+
+ *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (*data == MAP_FAILED) {
+- fprintf(stderr, "mmap failed: %m\n");
++ fprintf(stderr, "mmap failed: %m\r\n");
+ close(fd);
+ return NULL;
+ }
+@@ -935,7 +935,7 @@ check_size(struct rectangle *rect)
+ return 0;
+
+ fprintf(stderr, "tried to create surface of "
+- "width: %d, height: %d\n", rect->width, rect->height);
++ "width: %d, height: %d\r\n", rect->width, rect->height);
+ return -1;
+ }
+
+@@ -1014,7 +1014,7 @@ shm_surface_buffer_state_debug(struct shm_surface *sur
+ }
+
+ bufs[MAX_LEAVES] = '\0';
+- DBG_OBJ(surface->surface, "%s, leaves [%s]\n", msg, bufs);
++ DBG_OBJ(surface->surface, "%s, leaves [%s]\r\n", msg, bufs);
+ #endif
+ }
+
+@@ -1080,11 +1080,11 @@ shm_surface_prepare(struct toysurface *base, int dx, i
+ if (!leaf || surface->leaf[i].cairo_surface)
+ leaf = &surface->leaf[i];
+ }
+- DBG_OBJ(surface->surface, "pick leaf %d\n",
++ DBG_OBJ(surface->surface, "pick leaf %d\r\n",
+ (int)(leaf - &surface->leaf[0]));
+
+ if (!leaf) {
+- fprintf(stderr, "%s: all buffers are held by the server.\n",
++ fprintf(stderr, "%s: all buffers are held by the server.\r\n",
+ __func__);
+ exit(1);
+ return NULL;
+@@ -1163,7 +1163,7 @@ shm_surface_swap(struct toysurface *base,
+ server_allocation->width, server_allocation->height);
+ wl_surface_commit(surface->surface);
+
+- DBG_OBJ(surface->surface, "leaf %d busy\n",
++ DBG_OBJ(surface->surface, "leaf %d busy\r\n",
+ (int)(leaf - &surface->leaf[0]));
+
+ leaf->busy = 1;
+@@ -1198,7 +1198,7 @@ shm_surface_create(struct display *display, struct wl_
+ uint32_t flags, struct rectangle *rectangle)
+ {
+ struct shm_surface *surface;
+- DBG_OBJ(wl_surface, "\n");
++ DBG_OBJ(wl_surface, "\r\n");
+
+ surface = xzalloc(sizeof *surface);
+ surface->base.prepare = shm_surface_prepare;
+@@ -1356,7 +1356,7 @@ create_cursors(struct display *display)
+
+ display->cursor_theme = wl_cursor_theme_load(theme, size, display->shm);
+ if (!display->cursor_theme) {
+- fprintf(stderr, "could not load theme '%s'\n", theme);
++ fprintf(stderr, "could not load theme '%s'\r\n", theme);
+ return;
+ }
+ free(theme);
+@@ -1370,7 +1370,7 @@ create_cursors(struct display *display)
+ display->cursor_theme, cursors[i].names[j]);
+
+ if (!cursor)
+- fprintf(stderr, "could not load cursor '%s'\n",
++ fprintf(stderr, "could not load cursor '%s'\r\n",
+ cursors[i].names[0]);
+
+ display->cursors[i] = cursor;
+@@ -2012,7 +2012,7 @@ window_schedule_redraw_task(struct window *window);
+ void
+ widget_schedule_redraw(struct widget *widget)
+ {
+- DBG_OBJ(widget->surface->surface, "widget %p\n", widget);
++ DBG_OBJ(widget->surface->surface, "widget %p\r\n", widget);
+ widget->surface->redraw_needed = 1;
+ window_schedule_redraw_task(widget->window);
+ }
+@@ -2151,7 +2151,7 @@ tooltip_timer_reset(struct tooltip *tooltip)
+ its.it_value.tv_sec = TOOLTIP_TIMEOUT / 1000;
+ its.it_value.tv_nsec = (TOOLTIP_TIMEOUT % 1000) * 1000 * 1000;
+ if (timerfd_settime(tooltip->tooltip_fd, 0, &its, NULL) < 0) {
+- fprintf(stderr, "could not set timerfd\n: %m");
++ fprintf(stderr, "could not set timerfd\r\n: %m");
+ return -1;
+ }
+
+@@ -2188,7 +2188,7 @@ widget_set_tooltip(struct widget *parent, char *entry,
+ tooltip->entry = strdup(entry);
+ tooltip->tooltip_fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
+ if (tooltip->tooltip_fd < 0) {
+- fprintf(stderr, "could not create timerfd\n: %m");
++ fprintf(stderr, "could not create timerfd\r\n: %m");
+ return -1;
+ }
+
+@@ -2697,7 +2697,7 @@ cursor_delay_timer_reset(struct input *input, uint32_t
+ its.it_value.tv_sec = duration / 1000;
+ its.it_value.tv_nsec = (duration % 1000) * 1000 * 1000;
+ if (timerfd_settime(input->cursor_delay_fd, 0, &its, NULL) < 0)
+- fprintf(stderr, "could not set cursor timerfd\n: %m");
++ fprintf(stderr, "could not set cursor timerfd\r\n: %m");
+ }
+
+ static void cancel_pointer_image_update(struct input *input)
+@@ -2739,7 +2739,7 @@ pointer_handle_enter(void *data, struct wl_pointer *po
+
+ window = wl_surface_get_user_data(surface);
+ if (surface != window->main_surface->surface) {
+- DBG("Ignoring input event from subsurface %p\n", surface);
++ DBG("Ignoring input event from subsurface %p\r\n", surface);
+ return;
+ }
+
+@@ -3018,14 +3018,14 @@ keyboard_handle_keymap(void *data, struct wl_keyboard
+ close(fd);
+
+ if (!keymap) {
+- fprintf(stderr, "failed to compile keymap\n");
++ fprintf(stderr, "failed to compile keymap\r\n");
+ return;
+ }
+
+ /* Set up XKB state */
+ state = xkb_state_new(keymap);
+ if (!state) {
+- fprintf(stderr, "failed to create XKB state\n");
++ fprintf(stderr, "failed to create XKB state\r\n");
+ xkb_keymap_unref(keymap);
+ return;
+ }
+@@ -3053,13 +3053,13 @@ keyboard_handle_keymap(void *data, struct wl_keyboard
+ input->xkb.compose_table = compose_table;
+ } else {
+ fprintf(stderr, "could not create XKB compose state. "
+- "Disabiling compose.\n");
++ "Disabiling compose.\r\n");
+ xkb_compose_table_unref(compose_table);
+ compose_table = NULL;
+ }
+ } else {
+ fprintf(stderr, "could not create XKB compose table for locale '%s'. "
+- "Disabiling compose\n", locale);
++ "Disabiling compose\r\n", locale);
+ }
+ #endif
+
+@@ -3290,12 +3290,12 @@ touch_handle_down(void *data, struct wl_touch *wl_touc
+ input->display->serial = serial;
+ input->touch_focus = wl_surface_get_user_data(surface);
+ if (!input->touch_focus) {
+- DBG("Failed to find to touch focus for surface %p\n", surface);
++ DBG("Failed to find to touch focus for surface %p\r\n", surface);
+ return;
+ }
+
+ if (surface != input->touch_focus->main_surface->surface) {
+- DBG("Ignoring input event from subsurface %p\n", surface);
++ DBG("Ignoring input event from subsurface %p\r\n", surface);
+ input->touch_focus = NULL;
+ return;
+ }
+@@ -3332,7 +3332,7 @@ touch_handle_up(void *data, struct wl_touch *wl_touch,
+ struct touch_point *tp, *tmp;
+
+ if (!input->touch_focus) {
+- DBG("No touch focus found for touch up event!\n");
++ DBG("No touch focus found for touch up event!\r\n");
+ return;
+ }
+
+@@ -3361,10 +3361,10 @@ touch_handle_motion(void *data, struct wl_touch *wl_to
+ float sx = wl_fixed_to_double(x_w);
+ float sy = wl_fixed_to_double(y_w);
+
+- DBG("touch_handle_motion: %i %i\n", id, wl_list_length(&input->touch_point_list));
++ DBG("touch_handle_motion: %i %i\r\n", id, wl_list_length(&input->touch_point_list));
+
+ if (!input->touch_focus) {
+- DBG("No touch focus found for touch motion event!\n");
++ DBG("No touch focus found for touch motion event!\r\n");
+ return;
+ }
+
+@@ -3388,10 +3388,10 @@ touch_handle_frame(void *data, struct wl_touch *wl_tou
+ struct input *input = data;
+ struct touch_point *tp, *tmp;
+
+- DBG("touch_handle_frame\n");
++ DBG("touch_handle_frame\r\n");
+
+ if (!input->touch_focus) {
+- DBG("No touch focus found for touch frame event!\n");
++ DBG("No touch focus found for touch frame event!\r\n");
+ return;
+ }
+
+@@ -3408,10 +3408,10 @@ touch_handle_cancel(void *data, struct wl_touch *wl_to
+ struct input *input = data;
+ struct touch_point *tp, *tmp;
+
+- DBG("touch_handle_cancel\n");
++ DBG("touch_handle_cancel\r\n");
+
+ if (!input->touch_focus) {
+- DBG("No touch focus found for touch cancel event!\n");
++ DBG("No touch focus found for touch cancel event!\r\n");
+ return;
+ }
+
+@@ -3760,7 +3760,7 @@ input_set_pointer_image_index(struct input *input, int
+ return;
+
+ if (index >= (int) cursor->image_count) {
+- fprintf(stderr, "cursor index out of range\n");
++ fprintf(stderr, "cursor index out of range\r\n");
+ return;
+ }
+
+@@ -4192,7 +4192,7 @@ idle_resize(struct window *window)
+ window->resize_needed = 0;
+ window->redraw_needed = 1;
+
+- DBG("from %dx%d to %dx%d\n",
++ DBG("from %dx%d to %dx%d\r\n",
+ window->main_surface->server_allocation.width,
+ window->main_surface->server_allocation.height,
+ window->pending_allocation.width,
+@@ -4209,7 +4209,7 @@ undo_resize(struct window *window)
+ window->pending_allocation.height =
+ window->main_surface->server_allocation.height;
+
+- DBG("back to %dx%d\n",
++ DBG("back to %dx%d\r\n",
+ window->main_surface->server_allocation.width,
+ window->main_surface->server_allocation.height);
+
+@@ -4219,7 +4219,7 @@ undo_resize(struct window *window)
+ window->pending_allocation.height == 0) {
+ fprintf(stderr, "Error: Could not draw a surface, "
+ "most likely due to insufficient disk space in "
+- "%s (XDG_RUNTIME_DIR).\n", getenv("XDG_RUNTIME_DIR"));
++ "%s (XDG_RUNTIME_DIR).\r\n", getenv("XDG_RUNTIME_DIR"));
+ exit(EXIT_FAILURE);
+ }
+ }
+@@ -4496,14 +4496,14 @@ frame_callback(void *data, struct wl_callback *callbac
+ struct surface *surface = data;
+
+ assert(callback == surface->frame_cb);
+- DBG_OBJ(callback, "done\n");
++ DBG_OBJ(callback, "done\r\n");
+ wl_callback_destroy(callback);
+ surface->frame_cb = NULL;
+
+ surface->last_time = time;
+
+ if (surface->redraw_needed || surface->window->redraw_needed) {
+- DBG_OBJ(surface->surface, "window_schedule_redraw_task\n");
++ DBG_OBJ(surface->surface, "window_schedule_redraw_task\r\n");
+ window_schedule_redraw_task(surface->window);
+ }
+ }
+@@ -4515,7 +4515,7 @@ static const struct wl_callback_listener listener = {
+ static int
+ surface_redraw(struct surface *surface)
+ {
+- DBG_OBJ(surface->surface, "begin\n");
++ DBG_OBJ(surface->surface, "begin\r\n");
+
+ if (!surface->window->redraw_needed && !surface->redraw_needed)
+ return 0;
+@@ -4527,24 +4527,24 @@ surface_redraw(struct surface *surface)
+ if (!surface->window->redraw_needed)
+ return 0;
+
+- DBG_OBJ(surface->frame_cb, "cancelled\n");
++ DBG_OBJ(surface->frame_cb, "cancelled\r\n");
+ wl_callback_destroy(surface->frame_cb);
+ }
+
+ if (surface->widget->use_cairo &&
+ !widget_get_cairo_surface(surface->widget)) {
+- DBG_OBJ(surface->surface, "cancelled due to buffer failure\n");
++ DBG_OBJ(surface->surface, "cancelled due to buffer failure\r\n");
+ return -1;
+ }
+
+ surface->frame_cb = wl_surface_frame(surface->surface);
+ wl_callback_add_listener(surface->frame_cb, &listener, surface);
+- DBG_OBJ(surface->frame_cb, "new\n");
++ DBG_OBJ(surface->frame_cb, "new\r\n");
+
+ surface->redraw_needed = 0;
+- DBG_OBJ(surface->surface, "-> widget_redraw\n");
++ DBG_OBJ(surface->surface, "-> widget_redraw\r\n");
+ widget_redraw(surface->widget);
+- DBG_OBJ(surface->surface, "done\n");
++ DBG_OBJ(surface->surface, "done\r\n");
+ return 0;
+ }
+
+@@ -4556,7 +4556,7 @@ idle_redraw(struct task *task, uint32_t events)
+ int failed = 0;
+ int resized = 0;
+
+- DBG(" --------- \n");
++ DBG(" --------- \r\n");
+
+ wl_list_init(&window->redraw_task.link);
+ window->redraw_task_scheduled = 0;
+@@ -4564,7 +4564,7 @@ idle_redraw(struct task *task, uint32_t events)
+ if (window->resize_needed) {
+ /* throttle resizing to the main surface display */
+ if (window->main_surface->frame_cb) {
+- DBG_OBJ(window->main_surface->frame_cb, "pending\n");
++ DBG_OBJ(window->main_surface->frame_cb, "pending\r\n");
+ return;
+ }
+
+@@ -4618,7 +4618,7 @@ window_schedule_redraw(struct window *window)
+ {
+ struct surface *surface;
+
+- DBG_OBJ(window->main_surface->surface, "window %p\n", window);
++ DBG_OBJ(window->main_surface->surface, "window %p\r\n", window);
+
+ wl_list_for_each(surface, &window->subsurface_list, link)
+ surface->redraw_needed = 1;
+@@ -6102,31 +6102,31 @@ init_egl(struct display *d)
+ d->display, NULL);
+
+ if (!eglInitialize(d->dpy, &major, &minor)) {
+- fprintf(stderr, "failed to initialize EGL\n");
++ fprintf(stderr, "failed to initialize EGL\r\n");
+ return -1;
+ }
+
+ if (!eglBindAPI(api)) {
+- fprintf(stderr, "failed to bind EGL client API\n");
++ fprintf(stderr, "failed to bind EGL client API\r\n");
+ return -1;
+ }
+
+ if (!eglChooseConfig(d->dpy, argb_cfg_attribs,
+ &d->argb_config, 1, &n) || n != 1) {
+- fprintf(stderr, "failed to choose argb EGL config\n");
++ fprintf(stderr, "failed to choose argb EGL config\r\n");
+ return -1;
+ }
+
+ d->argb_ctx = eglCreateContext(d->dpy, d->argb_config,
+ EGL_NO_CONTEXT, context_attribs);
+ if (d->argb_ctx == NULL) {
+- fprintf(stderr, "failed to create EGL context\n");
++ fprintf(stderr, "failed to create EGL context\r\n");
+ return -1;
+ }
+
+ d->argb_device = cairo_egl_device_create(d->dpy, d->argb_ctx);
+ if (cairo_device_status(d->argb_device) != CAIRO_STATUS_SUCCESS) {
+- fprintf(stderr, "failed to get cairo EGL argb device\n");
++ fprintf(stderr, "failed to get cairo EGL argb device\r\n");
+ return -1;
+ }
+
+@@ -6216,14 +6216,14 @@ display_create(int *argc, char *argv[])
+
+ d->display = wl_display_connect(NULL);
+ if (d->display == NULL) {
+- fprintf(stderr, "failed to connect to Wayland display: %m\n");
++ fprintf(stderr, "failed to connect to Wayland display: %m\r\n");
+ free(d);
+ return NULL;
+ }
+
+ d->xkb_context = xkb_context_new(0);
+ if (d->xkb_context == NULL) {
+- fprintf(stderr, "Failed to create XKB context\n");
++ fprintf(stderr, "Failed to create XKB context\r\n");
+ free(d);
+ return NULL;
+ }
+@@ -6243,14 +6243,14 @@ display_create(int *argc, char *argv[])
+ wl_registry_add_listener(d->registry, &registry_listener, d);
+
+ if (wl_display_roundtrip(d->display) < 0) {
+- fprintf(stderr, "Failed to process Wayland connection: %m\n");
++ fprintf(stderr, "Failed to process Wayland connection: %m\r\n");
+ return NULL;
+ }
+
+ #ifdef HAVE_CAIRO_EGL
+ if (init_egl(d) < 0)
+ fprintf(stderr, "EGL does not seem to work, "
+- "falling back to software rendering and wl_shm.\n");
++ "falling back to software rendering and wl_shm.\r\n");
+ #endif
+
+ create_cursors(d);
+@@ -6288,11 +6288,11 @@ void
+ display_destroy(struct display *display)
+ {
+ if (!wl_list_empty(&display->window_list))
+- fprintf(stderr, "toytoolkit warning: %d windows exist.\n",
++ fprintf(stderr, "toytoolkit warning: %d windows exist.\r\n",
+ wl_list_length(&display->window_list));
+
+ if (!wl_list_empty(&display->deferred_list))
+- fprintf(stderr, "toytoolkit warning: deferred tasks exist.\n");
++ fprintf(stderr, "toytoolkit warning: deferred tasks exist.\r\n");
+
+ cairo_surface_destroy(display->dummy_surface);
+ free(display->dummy_surface_data);
Index: x11-wm/weston/files/patch-compositor_main.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-compositor_main.c
@@ -0,0 +1,164 @@
+--- compositor/main.c.orig 2017-08-08 18:57:02 UTC
++++ compositor/main.c
+@@ -41,7 +41,9 @@
+ #include <sys/socket.h>
+ #include <libinput.h>
+ #include <sys/time.h>
+-#include <linux/limits.h>
++/* #include <linux/limits.h> */
++#include <limits.h>
++#define PATH_MAX _POSIX_PATH_MAX
+
+ #ifdef HAVE_LIBUNWIND
+ #define UNW_LOCAL_ONLY
+@@ -61,6 +63,7 @@
+ #include "compositor-headless.h"
+ #include "compositor-rdp.h"
+ #include "compositor-fbdev.h"
++#include "compositor-scfb.h"
+ #include "compositor-x11.h"
+ #include "compositor-wayland.h"
+ #include "windowed-output-api.h"
+@@ -99,7 +102,7 @@ static int weston_log_timestamp(void)
+
+ if (brokendown_time->tm_mday != cached_tm_mday) {
+ strftime(string, sizeof string, "%Y-%m-%d %Z", brokendown_time);
+- fprintf(weston_logfile, "Date: %s\n", string);
++ fprintf(weston_logfile, "Date: %s\r\n", string);
+
+ cached_tm_mday = brokendown_time->tm_mday;
+ }
+@@ -115,6 +118,7 @@ custom_handler(const char *fmt, va_list arg)
+ weston_log_timestamp();
+ fprintf(weston_logfile, "libwayland: ");
+ vfprintf(weston_logfile, fmt, arg);
++ fprintf(weston_logfile, "\r");
+ }
+
+ static void
+@@ -149,6 +153,7 @@ vlog(const char *fmt, va_list ap)
+
+ l = weston_log_timestamp();
+ l += vfprintf(weston_logfile, fmt, ap);
++ l += fprintf(weston_logfile, "\r");
+
+ return l;
+ }
+@@ -538,6 +543,9 @@ usage(int error_code)
+ #if defined(BUILD_FBDEV_COMPOSITOR)
+ "\t\t\t\tfbdev-backend.so\n"
+ #endif
++#if defined(BUILD_SCFB_COMPOSITOR)
++ "\t\t\t\tscfb-backend.so\n"
++#endif
+ #if defined(BUILD_HEADLESS_COMPOSITOR)
+ "\t\t\t\theadless-backend.so\n"
+ #endif
+@@ -577,6 +585,14 @@ usage(int error_code)
+ "\n");
+ #endif
+
++#if defined(BUILD_SCFB_COMPOSITOR)
++ fprintf(stderr,
++ "Options for scfb-backend.so:\n\n"
++ " --tty=TTY\t\tThe tty to use\n"
++ " --device=DEVICE\tThe framebuffer device to use\n"
++ "\n");
++#endif
++
+ #if defined(BUILD_HEADLESS_COMPOSITOR)
+ fprintf(stderr,
+ "Options for headless-backend.so:\n\n"
+@@ -680,9 +696,9 @@ clock_name(clockid_t clk_id)
+ static const char *names[] = {
+ [CLOCK_REALTIME] = "CLOCK_REALTIME",
+ [CLOCK_MONOTONIC] = "CLOCK_MONOTONIC",
+- [CLOCK_MONOTONIC_RAW] = "CLOCK_MONOTONIC_RAW",
+- [CLOCK_REALTIME_COARSE] = "CLOCK_REALTIME_COARSE",
+- [CLOCK_MONOTONIC_COARSE] = "CLOCK_MONOTONIC_COARSE",
++ /* [CLOCK_MONOTONIC_RAW] = "CLOCK_MONOTONIC_RAW", */
++ /* [CLOCK_REALTIME_COARSE] = "CLOCK_REALTIME_COARSE", */
++ /* [CLOCK_MONOTONIC_COARSE] = "CLOCK_MONOTONIC_COARSE", */
+ #ifdef CLOCK_BOOTTIME
+ [CLOCK_BOOTTIME] = "CLOCK_BOOTTIME",
+ #endif
+@@ -1579,6 +1595,57 @@ load_x11_backend(struct weston_compositor *c,
+ }
+
+ static void
++scfb_backend_output_configure(struct wl_listener *listener, void *data)
++{
++ struct weston_output *output = data;
++ struct weston_config *wc = wet_get_config(output->compositor);
++ struct weston_config_section *section;
++
++ section = weston_config_get_section(wc, "output", "name", "scfb");
++
++ wet_output_set_transform(output, section, WL_OUTPUT_TRANSFORM_NORMAL, UINT32_MAX);
++ weston_output_set_scale(output, 1);
++
++ weston_output_enable(output);
++}
++
++static int
++load_scfb_backend(struct weston_compositor *c,
++ int *argc, char **argv, struct weston_config *wc)
++{
++ struct weston_scfb_backend_config config = {{ 0, }};
++ int ret = 0;
++
++ const struct weston_option scfb_options[] = {
++ { WESTON_OPTION_INTEGER, "tty", 0, &config.tty },
++ { WESTON_OPTION_STRING, "device", 0, &config.device },
++ };
++
++ parse_options(scfb_options, ARRAY_LENGTH(scfb_options), argc, argv);
++
++ if (!config.device)
++ config.device = strdup("/dev/ttyv1");
++
++ config.base.struct_version = WESTON_SCFB_BACKEND_CONFIG_VERSION;
++ config.base.struct_size = sizeof(struct weston_scfb_backend_config);
++ config.configure_device = configure_input_device;
++
++ /* load the actual wayland backend and configure it */
++ ret = weston_compositor_load_backend(c, WESTON_BACKEND_SCFB,
++ &config.base);
++
++ if (ret < 0)
++ goto out;
++
++ wet_set_pending_output_handler(c, scfb_backend_output_configure);
++
++out:
++ free(config.device);
++ return ret;
++
++}
++
++static void
+ wayland_backend_output_configure_hotplug(struct wl_listener *listener, void *data)
+ {
+ struct weston_output *output = data;
+@@ -1724,6 +1791,8 @@ load_backend(struct weston_compositor *compositor, con
+ return load_rdp_backend(compositor, argc, argv, config);
+ else if (strstr(backend, "fbdev-backend.so"))
+ return load_fbdev_backend(compositor, argc, argv, config);
++ else if (strstr(backend, "scfb-backend.so"))
++ return load_scfb_backend(compositor, argc, argv, config);
+ else if (strstr(backend, "drm-backend.so"))
+ return load_drm_backend(compositor, argc, argv, config);
+ else if (strstr(backend, "x11-backend.so"))
+@@ -1823,9 +1892,9 @@ int main(int argc, char *argv[])
+ weston_log_set_handler(vlog, vlog_continue);
+ weston_log_file_open(log);
+
+- weston_log("%s\n"
+- STAMP_SPACE "%s\n"
+- STAMP_SPACE "Bug reports to: %s\n"
++ weston_log("%s\r\n"
++ STAMP_SPACE "%s\r\n"
++ STAMP_SPACE "Bug reports to: %s\r\n"
+ STAMP_SPACE "Build: %s\n",
+ PACKAGE_STRING, PACKAGE_URL, PACKAGE_BUGREPORT,
+ BUILD_ID);
Index: x11-wm/weston/files/patch-configure.ac
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-configure.ac
@@ -0,0 +1,28 @@
+--- configure.ac.orig 2017-08-08 18:57:02 UTC
++++ configure.ac
+@@ -244,6 +244,17 @@ AS_IF([test x$enable_fbdev_compositor = xyes], [
+ PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 mtdev >= 1.1.0])
+ ])
+
++
++AC_ARG_ENABLE([scfb-compositor], [ --enable-scfb-compositor],,
++ enable_scfb_compositor=yes)
++AM_CONDITIONAL([ENABLE_SCFB_COMPOSITOR],
++ [test x$enable_scfb_compositor = xyes])
++AS_IF([test x$enable_scfb_compositor = xyes], [
++ AC_DEFINE([BUILD_SCFB_COMPOSITOR], [1], [Build the scfb compositor])
++ PKG_CHECK_MODULES([SCFB_COMPOSITOR], [libudev >= 136 mtdev >= 1.1.0])
++])
++
++
+ AC_ARG_ENABLE([rdp-compositor], [ --enable-rdp-compositor],,
+ enable_rdp_compositor=no)
+ AM_CONDITIONAL([ENABLE_RDP_COMPOSITOR],
+@@ -708,6 +719,7 @@ AC_MSG_RESULT([
+ Wayland Compositor ${enable_wayland_compositor}
+ Headless Compositor ${enable_headless_compositor}
+ FBDEV Compositor ${enable_fbdev_compositor}
++ SCFB Compositor ${enable_scfb_compositor}
+ RDP Compositor ${enable_rdp_compositor}
+ Screen Sharing ${enable_screen_sharing}
+ JUnit XML output ${enable_junit_xml}
Index: x11-wm/weston/files/patch-libweston_compositor-drm.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_compositor-drm.c
@@ -0,0 +1,45 @@
+--- libweston/compositor-drm.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/compositor-drm.c
+@@ -34,7 +34,7 @@
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <linux/input.h>
+-#include <linux/vt.h>
++//#include <linux/vt.h>
+ #include <assert.h>
+ #include <sys/mman.h>
+ #include <dlfcn.h>
+@@ -3189,6 +3189,8 @@ drm_device_is_kms(struct drm_backend *b, struct udev_d
+ drmModeRes *res;
+ int id, fd;
+
++ printf("%s] Got filename %s and sysnum %s\r\n", __func__, filename, sysnum);
++
+ if (!filename)
+ return false;
+
+@@ -3251,6 +3253,16 @@ find_primary_gpu(struct drm_backend *b, const char *se
+ struct udev_device *device, *drm_device, *pci;
+
+ e = udev_enumerate_new(b->udev);
++
++#ifdef __FreeBSD__
++ // libudev-devd don't support matching properly yet
++ device = udev_device_new_from_syspath(e, "/dev/dri/card0");
++ if (drm_device_is_kms(b, device)) {
++ udev_enumerate_unref(e);
++ return device;
++ }
++#endif
++
+ udev_enumerate_add_match_subsystem(e, "drm");
+ udev_enumerate_add_match_sysname(e, "card[0-9]*");
+
+@@ -3314,7 +3326,6 @@ find_primary_gpu(struct drm_backend *b, const char *se
+ /* If we're returning a device to use, we must have an open FD for
+ * it. */
+ assert(!!drm_device == (b->drm.fd >= 0));
+-
+ udev_enumerate_unref(e);
+ return drm_device;
+ }
Index: x11-wm/weston/files/patch-libweston_compositor-scfb.h
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_compositor-scfb.h
@@ -0,0 +1,64 @@
+--- libweston/compositor-scfb.h.orig 2017-10-13 15:26:13 UTC
++++ libweston/compositor-scfb.h
+@@ -0,0 +1,61 @@
++/*
++ * Copyright © 2016 Benoit Gschwind
++ *
++ * 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.
++ */
++
++#ifndef WESTON_COMPOSITOR_SCFB_H
++#define WESTON_COMPOSITOR_SCFB_H
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#include <stdint.h>
++
++#include "compositor.h"
++
++#define WESTON_SCFB_BACKEND_CONFIG_VERSION 2
++
++struct libinput_device;
++
++struct weston_scfb_backend_config {
++ struct weston_backend_config base;
++
++ int tty;
++ char *device;
++
++ /** Callback used to configure input devices.
++ *
++ * This function will be called by the backend when a new input device
++ * needs to be configured.
++ * If NULL the device will use the default configuration.
++ */
++ void (*configure_device)(struct weston_compositor *compositor,
++ struct libinput_device *device);
++};
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* WESTON_COMPOSITOR_SCFB_H */
Index: x11-wm/weston/files/patch-libweston_compositor-scfb.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_compositor-scfb.c
@@ -0,0 +1,835 @@
+--- libweston/compositor-scfb.c.orig 2017-10-13 15:26:13 UTC
++++ libweston/compositor-scfb.c
+@@ -0,0 +1,832 @@
++/*
++ * Copyright © 2008-2011 Kristian Høgsberg
++ * Copyright © 2011 Intel Corporation
++ * Copyright © 2012 Raspberry Pi Foundation
++ * Copyright © 2013 Philip Withnall
++ *
++ * 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.
++ */
++
++#include "config.h"
++
++#include <errno.h>
++#include <stdlib.h>
++#include <stdint.h>
++#include <stdio.h>
++#include <string.h>
++#include <math.h>
++#include <sys/mman.h>
++#include <sys/types.h>
++#include <sys/ioctl.h>
++#include <sys/fbio.h>
++#include <fcntl.h>
++#include <unistd.h>
++
++#include <linux/input.h>
++
++#include <libudev.h>
++
++#include "shared/helpers.h"
++#include "compositor.h"
++#include "compositor-scfb.h"
++#include "launcher-util.h"
++#include "pixman-renderer.h"
++#include "libinput-seat.h"
++#include "presentation-time-server-protocol.h"
++
++struct scfb_backend {
++ struct weston_backend base;
++ struct weston_compositor *compositor;
++ uint32_t prev_state;
++
++ struct udev *udev;
++ struct udev_input input;
++ uint32_t output_transform;
++ struct wl_listener session_listener;
++};
++
++struct scfb_screeninfo {
++ unsigned int x_resolution; /* pixels, visible area */
++ unsigned int y_resolution; /* pixels, visible area */
++ unsigned int width_mm; /* visible screen width in mm */
++ unsigned int height_mm; /* visible screen height in mm */
++ unsigned int bits_per_pixel;
++
++ size_t buffer_length; /* length of frame buffer memory in bytes */
++ size_t line_length; /* length of a line in bytes */
++ char id[16]; /* screen identifier */
++
++ pixman_format_code_t pixel_format; /* frame buffer pixel format */
++ unsigned int refresh_rate; /* Hertz */
++};
++
++struct scfb_output {
++ struct scfb_backend *backend;
++ struct weston_output base;
++
++ struct weston_mode mode;
++ struct wl_event_source *finish_frame_timer;
++
++ /* Frame buffer details. */
++ char *device;
++ struct scfb_screeninfo fb_info;
++ void *fb; /* length is fb_info.buffer_length */
++
++ /* pixman details. */
++ pixman_image_t *hw_surface;
++ uint8_t depth;
++};
++
++static const char default_seat[] = "seat0";
++
++static inline struct scfb_output *
++to_scfb_output(struct weston_output *base)
++{
++ return container_of(base, struct scfb_output, base);
++}
++
++static inline struct scfb_backend *
++to_scfb_backend(struct weston_compositor *base)
++{
++ return container_of(base->backend, struct scfb_backend, base);
++}
++
++static void
++scfb_output_start_repaint_loop(struct weston_output *output)
++{
++ struct timespec ts;
++
++ weston_compositor_read_presentation_clock(output->compositor, &ts);
++ weston_output_finish_frame(output, &ts, WP_PRESENTATION_FEEDBACK_INVALID);
++}
++
++static int
++scfb_output_repaint(struct weston_output *base, pixman_region32_t *damage)
++{
++ struct scfb_output *output = to_scfb_output(base);
++ struct weston_compositor *ec = output->base.compositor;
++
++ /* Repaint the damaged region onto the back buffer. */
++ pixman_renderer_output_set_buffer(base, output->hw_surface);
++ ec->renderer->repaint_output(base, damage);
++
++ /* Update the damage region. */
++ pixman_region32_subtract(&ec->primary_plane.damage,
++ &ec->primary_plane.damage, damage);
++
++ /* Schedule the end of the frame. We do not sync this to the frame
++ * buffer clock because users who want that should be using the DRM
++ * compositor. FBIO_WAITFORVSYNC blocks and FB_ACTIVATE_VBL requires
++ * panning, which is broken in most kernel drivers.
++ *
++ * Finish the frame synchronised to the specified refresh rate. The
++ * refresh rate is given in mHz and the interval in ms. */
++ wl_event_source_timer_update(output->finish_frame_timer,
++ 1000000 / output->mode.refresh);
++
++ return 0;
++}
++
++static int
++finish_frame_handler(void *data)
++{
++ struct scfb_output *output = data;
++ struct timespec ts;
++
++ weston_compositor_read_presentation_clock(output->base.compositor, &ts);
++ weston_output_finish_frame(&output->base, &ts, 0);
++
++ return 1;
++}
++
++static pixman_format_code_t
++calculate_pixman_format(struct fbtype *fb)
++{
++ /* Calculate the pixman format supported by the frame buffer from the
++ * buffer's metadata. Return 0 if no known pixman format is supported
++ * (since this has depth 0 it's guaranteed to not conflict with any
++ * actual pixman format).
++ *
++ * Documentation on the vinfo and finfo structures:
++ * http://www.mjmwired.net/kernel/Documentation/fb/api.txt
++ *
++ * TODO: Try a bit harder to support other formats, including setting
++ * the preferred format in the hardware. */
++ int type;
++
++ /* weston_log("Calculating pixman format from:\n" */
++ /* STAMP_SPACE " - type: %i (aux: %i)\n" */
++ /* STAMP_SPACE " - visual: %i\n" */
++ /* STAMP_SPACE " - bpp: %i (grayscale: %i)\n" */
++ /* STAMP_SPACE " - red: offset: %i, length: %i, MSB: %i\n" */
++ /* STAMP_SPACE " - green: offset: %i, length: %i, MSB: %i\n" */
++ /* STAMP_SPACE " - blue: offset: %i, length: %i, MSB: %i\n" */
++ /* STAMP_SPACE " - transp: offset: %i, length: %i, MSB: %i\n", */
++ /* finfo->type, finfo->type_aux, finfo->visual, */
++ /* vinfo->bits_per_pixel, vinfo->grayscale, */
++ /* vinfo->red.offset, vinfo->red.length, vinfo->red.msb_right, */
++ /* vinfo->green.offset, vinfo->green.length, */
++ /* vinfo->green.msb_right, */
++ /* vinfo->blue.offset, vinfo->blue.length, */
++ /* vinfo->blue.msb_right, */
++ /* vinfo->transp.offset, vinfo->transp.length, */
++ /* vinfo->transp.msb_right); */
++
++ /* We only handle packed formats at the moment. */
++ /* if (vinfo->vi_mem_model != V_INFO_MM_PACKED) { */
++ /* weston_log("[scfb %s] Error! Only packed format supported\n", */
++ /* __func__); */
++ /* return 0; */
++ /* } */
++
++ /* /\* We only handle true-colour frame buffers at the moment. *\/ */
++ /* switch(finfo->visual) { */
++ /* case FB_VISUAL_TRUECOLOR: */
++ /* case FB_VISUAL_DIRECTCOLOR: */
++ /* if (vinfo->grayscale != 0) */
++ /* return 0; */
++ /* break; */
++ /* default: */
++ /* return 0; */
++ /* } */
++
++ /* We only support formats with MSBs on the left. */
++ /* if (vinfo->red.msb_right != 0 || vinfo->green.msb_right != 0 || */
++ /* vinfo->blue.msb_right != 0) */
++ /* return 0; */
++
++ /* Work out the format type from the offsets. We only support RGBA and
++ * ARGB at the moment. */
++ /* type = PIXMAN_TYPE_OTHER; */
++
++ /* if ((vinfo->transp.offset >= vinfo->red.offset || */
++ /* vinfo->transp.length == 0) && */
++ /* vinfo->red.offset >= vinfo->green.offset && */
++ /* vinfo->green.offset >= vinfo->blue.offset) */
++ /* type = PIXMAN_TYPE_ARGB; */
++ /* else if (vinfo->red.offset >= vinfo->green.offset && */
++ /* vinfo->green.offset >= vinfo->blue.offset && */
++ /* vinfo->blue.offset >= vinfo->transp.offset) */
++
++ type = PIXMAN_TYPE_ARGB;
++
++ /* if (type == PIXMAN_TYPE_OTHER) */
++ /* return 0; */
++
++ /* Build the format. */
++ return PIXMAN_FORMAT(fb->fb_depth, type,
++ fb->fb_depth/4,
++ fb->fb_depth/4,
++ fb->fb_depth/4,
++ fb->fb_depth/4);
++}
++
++
++static int
++calculate_refresh_rate(struct fbtype *fb)
++{
++ /* uint64_t quot; */
++
++ /* /\* Calculate monitor refresh rate. Default is 60 Hz. Units are mHz. *\/ */
++ /* quot = (vinfo->upper_margin + vinfo->lower_margin + vinfo->yres); */
++ /* quot *= (vinfo->left_margin + vinfo->right_margin + vinfo->xres); */
++ /* quot *= vinfo->pixclock; */
++
++ /* if (quot > 0) { */
++ /* uint64_t refresh_rate; */
++
++ /* refresh_rate = 1000000000000000LLU / quot; */
++ /* if (refresh_rate > 200000) */
++ /* refresh_rate = 200000; /\* cap at 200 Hz *\/ */
++
++ /* return refresh_rate; */
++ /* } */
++
++ return 60 * 1000; /* default to 60 Hz */
++}
++
++static int
++scfb_query_screen_info(struct scfb_output *output, int fd,
++ struct scfb_screeninfo *info)
++{
++ weston_log("[scfb %s] fd %d\n",__func__,fd);
++
++ struct fbtype fb;
++ /* struct video_info vinfo; */
++ /* struct video_color_palette vpalette; */
++ uint32_t linewidth;
++
++ if (ioctl(fd, FBIOGTYPE, &fb) == -1) {
++ weston_log("Failed to get FBIOTYPE: %s\n", strerror(errno));
++ return -1;
++ }
++
++ /* if (ioctl(fd, FBIO_GETPALETTE, &vpalette) == -1) { */
++ /* weston_log("Failed to get FBIO_GETPALETTE: %s\n", strerror(errno)); */
++ /* return -1; */
++ /* } */
++
++ /* if (ioctl(fd, FBIO_GETLINEWIDTH, &linewidth) == -1) { */
++ /* weston_log("Failed to get FBIO_GETLINEWIDTH: %s\n", strerror(errno)); */
++ /* return -1; */
++ /* } */
++
++ /* if (ioctl(fd, FBIO_MODEINFO, &vinfo) == -1) { */
++ /* weston_log("Failed to get FBIO_MODEINFO: %s\n", strerror(errno)); */
++ /* return -1; */
++ /* } */
++
++ linewidth = fb.fb_size / fb.fb_height;
++
++ weston_log("[scfb %s]: width %d px\n", __func__, fb.fb_width);
++ weston_log("[scfb %s]: height %d px\n", __func__, fb.fb_height);
++ weston_log("[scfb %s]: depth %d bits per pixel\n", __func__, fb.fb_depth);
++ weston_log("[scfb %s]: size %d bytes\n", __func__, fb.fb_size);
++ weston_log("[scfb %s]: linewidth %d bytes\n", __func__, linewidth);
++ /* weston_log("[scfb %s]: palette c %d\n", __func__, vpalette.count); */
++ /* weston_log("[scfb %s]: palette r %d\n", __func__, *vpalette.red); */
++ /* weston_log("[scfb %s]: palette g %d\n", __func__, *vpalette.blue); */
++ /* weston_log("[scfb %s]: palette b %d\n", __func__, *vpalette.green); */
++ /* weston_log("[scfb %s]: palette a %d\n", __func__, *vpalette.transparent); */
++
++ info->x_resolution = fb.fb_width;
++ info->y_resolution = fb.fb_height;
++ info->width_mm = 0;
++ info->height_mm = 0;
++ info->bits_per_pixel = fb.fb_depth;
++ info->buffer_length = fb.fb_size;
++ info->line_length = linewidth;
++
++ const char *id = "scfb";
++ strncpy(info->id, id, sizeof(info->id));
++ info->id[sizeof(info->id)-1] = '\0';
++
++ info->pixel_format = calculate_pixman_format(&fb);
++ info->refresh_rate = calculate_refresh_rate(&fb);
++
++ if (info->pixel_format == 0) {
++ weston_log("Frame buffer uses an unsupported format.\n");
++ return -1;
++ }
++
++ return 1;
++}
++
++static int
++scfb_set_screen_info(struct scfb_output *output, int fd,
++ struct scfb_screeninfo *info)
++{
++ weston_log("[scfb %s] Changing video info is unsupported\n",__func__);
++ return 1;
++}
++
++static void scfb_frame_buffer_destroy(struct scfb_output *output);
++
++/* Returns an FD for the frame buffer device. */
++static int
++scfb_frame_buffer_open(struct scfb_output *output, const char *fb_dev,
++ struct scfb_screeninfo *screen_info)
++{
++ weston_log("[scfb %s] fb_dev %s\n",__func__,fb_dev);
++
++ int fd = -1;
++
++ /* weston_log("Opening scfb frame buffer.\n"); */
++
++ /* Open the frame buffer device. */
++ fd = open(fb_dev, O_RDWR | O_CLOEXEC);
++ if (fd < 0) {
++ weston_log("Failed to open frame buffer device ‘%s’: %s\n",
++ fb_dev, strerror(errno));
++ return -1;
++ }
++
++ /* Grab the screen info. */
++ if (scfb_query_screen_info(output, fd, screen_info) < 0) {
++ weston_log("Failed to get frame buffer info: %s\n",
++ strerror(errno));
++
++ close(fd);
++ return -1;
++ }
++
++ return fd;
++}
++
++/* Map the framebuffer's memory. */
++static void*
++scfb_mmap(size_t len, off_t off, int fd)
++{
++ int pagemask, mapsize;
++ caddr_t addr;
++ void *mapaddr;
++
++ pagemask = getpagesize() - 1;
++ mapsize = ((int) len + pagemask) & ~pagemask;
++ addr = 0;
++ /* Make it write only because read is slow (from fbdev backend) */
++ mapaddr = mmap(addr, mapsize, PROT_WRITE, MAP_SHARED, fd, off);
++
++ weston_log("[scfb %s] mmap returns: addr %p len 0x%x, fd %d, off %lx\n",
++ __func__, mapaddr, mapsize, fd, off);
++ return mapaddr;
++}
++
++/* Closes the FD on success or failure. */
++static int
++scfb_frame_buffer_map(struct scfb_output *output, int fd)
++{
++ weston_log("[scfb %s] fd %d\n",__func__,fd);
++
++ int retval = -1;
++
++
++ /* Map the frame buffer. Write-only mode, since we don't want to read
++ * anything back (because it's slow). */
++ output->fb = scfb_mmap(output->fb_info.buffer_length, 0, fd);
++ if (output->fb == MAP_FAILED) {
++ weston_log("Failed to mmap frame buffer: %s\n",
++ strerror(errno));
++ goto out_close;
++ }
++
++ /* Create a pixman image to wrap the memory mapped frame buffer. */
++ output->hw_surface =
++ pixman_image_create_bits(output->fb_info.pixel_format,
++ output->fb_info.x_resolution,
++ output->fb_info.y_resolution,
++ output->fb,
++ output->fb_info.line_length);
++ if (output->hw_surface == NULL) {
++ weston_log("Failed to create surface for frame buffer.\n");
++ goto out_unmap;
++ }
++
++ /* Success! */
++ retval = 0;
++
++out_unmap:
++ if (retval != 0 && output->fb != NULL)
++ scfb_frame_buffer_destroy(output);
++
++out_close:
++ if (fd >= 0)
++ close(fd);
++
++ return retval;
++}
++
++static void
++scfb_frame_buffer_destroy(struct scfb_output *output)
++{
++ weston_log("Destroying scfb frame buffer.\n");
++
++ if (munmap(output->fb, output->fb_info.buffer_length) < 0)
++ weston_log("Failed to munmap frame buffer: %s\n",
++ strerror(errno));
++
++ output->fb = NULL;
++}
++
++static void scfb_output_destroy(struct weston_output *base);
++static void scfb_output_disable(struct weston_output *base);
++
++static int
++scfb_output_enable(struct weston_output *base)
++{
++ struct scfb_output *output = to_scfb_output(base);
++ struct scfb_backend *backend = to_scfb_backend(base->compositor);
++ int fb_fd;
++ struct wl_event_loop *loop;
++
++ /* Create the frame buffer. */
++ fb_fd = scfb_frame_buffer_open(output, output->device, &output->fb_info);
++ if (fb_fd < 0) {
++ weston_log("Creating frame buffer failed.\n");
++ return -1;
++ }
++
++ if (scfb_frame_buffer_map(output, fb_fd) < 0) {
++ weston_log("Mapping frame buffer failed.\n");
++ return -1;
++ }
++
++ output->base.start_repaint_loop = scfb_output_start_repaint_loop;
++ output->base.repaint = scfb_output_repaint;
++
++ if (pixman_renderer_output_create(&output->base) < 0)
++ goto out_hw_surface;
++
++ loop = wl_display_get_event_loop(backend->compositor->wl_display);
++ output->finish_frame_timer =
++ wl_event_loop_add_timer(loop, finish_frame_handler, output);
++
++ weston_log("scfb output %d×%d px\n",
++ output->mode.width, output->mode.height);
++ weston_log_continue(STAMP_SPACE "guessing %d Hz and 96 dpi\n",
++ output->mode.refresh / 1000);
++
++ return 0;
++
++out_hw_surface:
++ pixman_image_unref(output->hw_surface);
++ output->hw_surface = NULL;
++ scfb_frame_buffer_destroy(output);
++
++ return -1;
++}
++
++static int
++scfb_output_create(struct scfb_backend *backend,
++ const char *device)
++{
++ weston_log("[scfb %s] device %s\n",__func__,device);
++
++ struct scfb_output *output;
++ int fb_fd;
++
++ weston_log("Creating scfb output.\n");
++
++ output = zalloc(sizeof *output);
++ if (output == NULL)
++ return -1;
++
++ output->backend = backend;
++ output->device = strdup(device);
++
++ /* Create the frame buffer. */
++ fb_fd = scfb_frame_buffer_open(output, device, &output->fb_info);
++ if (fb_fd < 0) {
++ weston_log("Creating frame buffer failed.\n");
++ goto out_free;
++ }
++
++ output->base.name = strdup("scfb");
++ output->base.destroy = scfb_output_destroy;
++ output->base.disable = NULL;
++ output->base.enable = scfb_output_enable;
++
++ weston_output_init(&output->base, backend->compositor);
++
++ /* only one static mode in list */
++ output->mode.flags =
++ WL_OUTPUT_MODE_CURRENT | WL_OUTPUT_MODE_PREFERRED;
++ output->mode.width = output->fb_info.x_resolution;
++ output->mode.height = output->fb_info.y_resolution;
++ output->mode.refresh = output->fb_info.refresh_rate;
++ wl_list_init(&output->base.mode_list);
++ wl_list_insert(&output->base.mode_list, &output->mode.link);
++
++ output->base.current_mode = &output->mode;
++ output->base.subpixel = WL_OUTPUT_SUBPIXEL_UNKNOWN;
++ output->base.make = "unknown";
++ output->base.model = output->fb_info.id;
++
++ output->base.mm_width = output->fb_info.width_mm;
++ output->base.mm_height = output->fb_info.height_mm;
++
++ close(fb_fd);
++
++ weston_compositor_add_pending_output(&output->base, backend->compositor);
++
++ return 0;
++
++out_free:
++ free(output->device);
++ free(output);
++
++ return -1;
++}
++
++static void
++scfb_output_destroy(struct weston_output *base)
++{
++ struct scfb_output *output = to_scfb_output(base);
++
++ weston_log("Destroying scfb output.\n");
++
++ /* Close the frame buffer. */
++ scfb_output_disable(base);
++
++ if (base->renderer_state != NULL)
++ pixman_renderer_output_destroy(base);
++
++ /* Remove the output. */
++ weston_output_destroy(&output->base);
++
++ free(output->device);
++ free(output);
++}
++
++/* strcmp()-style return values. */
++static int
++compare_screen_info (const struct scfb_screeninfo *a,
++ const struct scfb_screeninfo *b)
++{
++ if (a->x_resolution == b->x_resolution &&
++ a->y_resolution == b->y_resolution &&
++ a->width_mm == b->width_mm &&
++ a->height_mm == b->height_mm &&
++ a->bits_per_pixel == b->bits_per_pixel &&
++ a->pixel_format == b->pixel_format &&
++ a->refresh_rate == b->refresh_rate)
++ return 0;
++
++ return 1;
++}
++
++static int
++scfb_output_reenable(struct scfb_backend *backend,
++ struct weston_output *base)
++{
++ struct scfb_output *output = to_scfb_output(base);
++ struct scfb_screeninfo new_screen_info;
++ int fb_fd;
++ char *device;
++
++ weston_log("Re-enabling scfb output.\n");
++
++ /* Create the frame buffer. */
++ fb_fd = scfb_frame_buffer_open(output, output->device,
++ &new_screen_info);
++ if (fb_fd < 0) {
++ weston_log("Creating frame buffer failed.\n");
++ goto err;
++ }
++
++ /* Check whether the frame buffer details have changed since we were
++ * disabled. */
++ if (compare_screen_info (&output->fb_info, &new_screen_info) != 0) {
++ /* Perform a mode-set to restore the old mode. */
++ if (scfb_set_screen_info(output, fb_fd,
++ &output->fb_info) < 0) {
++ weston_log("Failed to restore mode settings. "
++ "Attempting to re-open output anyway.\n");
++ }
++
++ close(fb_fd);
++
++ /* Remove and re-add the output so that resources depending on
++ * the frame buffer X/Y resolution (such as the shadow buffer)
++ * are re-initialised. */
++ device = strdup(output->device);
++ scfb_output_destroy(&output->base);
++ scfb_output_create(backend, device);
++ free(device);
++
++ return 0;
++ }
++
++ /* Map the device if it has the same details as before. */
++ if (scfb_frame_buffer_map(output, fb_fd) < 0) {
++ weston_log("Mapping frame buffer failed.\n");
++ goto err;
++ }
++
++ return 0;
++
++err:
++ return -1;
++}
++
++/* NOTE: This leaves output->fb_info populated, caching data so that if
++ * scfb_output_reenable() is called again, it can determine whether a mode-set
++ * is needed. */
++static void
++scfb_output_disable(struct weston_output *base)
++{
++ struct scfb_output *output = to_scfb_output(base);
++
++ weston_log("Disabling scfb output.\n");
++
++ if (output->hw_surface != NULL) {
++ pixman_image_unref(output->hw_surface);
++ output->hw_surface = NULL;
++ }
++
++ scfb_frame_buffer_destroy(output);
++}
++
++static void
++scfb_backend_destroy(struct weston_compositor *base)
++{
++ struct scfb_backend *backend = to_scfb_backend(base);
++
++ udev_input_destroy(&backend->input);
++
++ /* Destroy the output. */
++ weston_compositor_shutdown(base);
++
++ /* Chain up. */
++ weston_launcher_destroy(base->launcher);
++
++ free(backend);
++}
++
++static void
++session_notify(struct wl_listener *listener, void *data)
++{
++ struct weston_compositor *compositor = data;
++ struct scfb_backend *backend = to_scfb_backend(compositor);
++ struct weston_output *output;
++
++ if (compositor->session_active) {
++ weston_log("entering VT\n");
++ compositor->state = backend->prev_state;
++
++ wl_list_for_each(output, &compositor->output_list, link) {
++ scfb_output_reenable(backend, output);
++ }
++
++ weston_compositor_damage_all(compositor);
++
++ udev_input_enable(&backend->input);
++ } else {
++ weston_log("leaving VT\n");
++ udev_input_disable(&backend->input);
++
++ wl_list_for_each(output, &compositor->output_list, link) {
++ scfb_output_disable(output);
++ }
++
++ backend->prev_state = compositor->state;
++ weston_compositor_offscreen(compositor);
++
++ /* If we have a repaint scheduled (from the idle handler), make
++ * sure we cancel that so we don't try to pageflip when we're
++ * vt switched away. The OFFSCREEN state will prevent
++ * further attempts at repainting. When we switch
++ * back, we schedule a repaint, which will process
++ * pending frame callbacks. */
++
++ wl_list_for_each(output,
++ &compositor->output_list, link) {
++ output->repaint_needed = 0;
++ }
++ }
++}
++
++static void
++scfb_restore(struct weston_compositor *compositor)
++{
++ weston_launcher_restore(compositor->launcher);
++}
++
++static struct scfb_backend *
++scfb_backend_create(struct weston_compositor *compositor,
++ struct weston_scfb_backend_config *param)
++{
++ struct scfb_backend *backend;
++ const char *seat_id = default_seat;
++
++ weston_log("initializing scfb backend\n");
++
++ backend = zalloc(sizeof *backend);
++ if (backend == NULL)
++ return NULL;
++
++ backend->compositor = compositor;
++ if (weston_compositor_set_presentation_clock_software(
++ compositor) < 0)
++ goto out_compositor;
++
++ backend->udev = udev_new();
++ if (backend->udev == NULL) {
++ weston_log("Failed to initialize udev context.\n");
++ goto out_compositor;
++ }
++
++ /* Set up the TTY. */
++ backend->session_listener.notify = session_notify;
++ wl_signal_add(&compositor->session_signal,
++ &backend->session_listener);
++ compositor->launcher =
++ weston_launcher_connect(compositor, param->tty, "seat0", false);
++ if (!compositor->launcher) {
++ weston_log("fatal: scfb backend should be run "
++ "using weston-launch binary or as root\n");
++ goto out_udev;
++ }
++
++ backend->base.destroy = scfb_backend_destroy;
++ backend->base.restore = scfb_restore;
++
++ backend->prev_state = WESTON_COMPOSITOR_ACTIVE;
++
++ weston_setup_vt_switch_bindings(compositor);
++
++ if (pixman_renderer_init(compositor) < 0)
++ goto out_launcher;
++
++ if (scfb_output_create(backend, param->device) < 0)
++ goto out_launcher;
++
++ udev_input_init(&backend->input, compositor, backend->udev,
++ seat_id, param->configure_device);
++
++ compositor->backend = &backend->base;
++ return backend;
++
++out_launcher:
++ weston_launcher_destroy(compositor->launcher);
++
++out_udev:
++ udev_unref(backend->udev);
++
++out_compositor:
++ weston_compositor_shutdown(compositor);
++ free(backend);
++
++ return NULL;
++}
++
++static void
++config_init_to_defaults(struct weston_scfb_backend_config *config)
++{
++ /* TODO: Ideally, available frame buffers should be enumerated using
++ * udev, rather than passing a device node in as a parameter. */
++ config->tty = 0; /* default to current tty */
++ config->device = "/dev/fb0"; /* default frame buffer */
++}
++
++WL_EXPORT int
++weston_backend_init(struct weston_compositor *compositor,
++ struct weston_backend_config *config_base)
++{
++ struct scfb_backend *b;
++ struct weston_scfb_backend_config config = {{ 0, }};
++
++ if (config_base == NULL ||
++ config_base->struct_version != WESTON_SCFB_BACKEND_CONFIG_VERSION ||
++ config_base->struct_size > sizeof(struct weston_scfb_backend_config)) {
++ weston_log("scfb backend config structure is invalid\n");
++ return -1;
++ }
++
++ config_init_to_defaults(&config);
++ memcpy(&config, config_base, config_base->struct_size);
++
++ b = scfb_backend_create(compositor, &config);
++ if (b == NULL)
++ return -1;
++ return 0;
++}
Index: x11-wm/weston/files/patch-libweston_compositor-wayland.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_compositor-wayland.c
@@ -0,0 +1,47 @@
+--- libweston/compositor-wayland.c.orig 2017-10-13 16:26:11 UTC
++++ libweston/compositor-wayland.c
+@@ -940,7 +940,7 @@ mode_feedback_successful(void *data,
+ {
+ enum mode_status *value = data;
+
+- printf("Mode switch successful\n");
++ printf("Mode switch successful\r\n");
+
+ *value = MODE_STATUS_SUCCESS;
+ }
+@@ -950,7 +950,7 @@ mode_feedback_failed(void *data, struct zwp_fullscreen
+ {
+ enum mode_status *value = data;
+
+- printf("Mode switch failed\n");
++ printf("Mode switch failed\r\n");
+
+ *value = MODE_STATUS_FAIL;
+ }
+@@ -960,7 +960,7 @@ mode_feedback_cancelled(void *data, struct zwp_fullscr
+ {
+ enum mode_status *value = data;
+
+- printf("Mode switch cancelled\n");
++ printf("Mode switch cancelled\r\n");
+
+ *value = MODE_STATUS_CANCEL;
+ }
+@@ -2447,7 +2447,7 @@ create_cursor(struct wayland_backend *b,
+ config->cursor_size,
+ b->parent.shm);
+ if (!b->cursor_theme) {
+- fprintf(stderr, "could not load cursor theme\n");
++ fprintf(stderr, "could not load cursor theme\r\n");
+ return;
+ }
+
+@@ -2456,7 +2456,7 @@ create_cursor(struct wayland_backend *b,
+ b->cursor = wl_cursor_theme_get_cursor(b->cursor_theme,
+ left_ptrs[i]);
+ if (!b->cursor) {
+- fprintf(stderr, "could not load left cursor\n");
++ fprintf(stderr, "could not load left cursor\r\n");
+ return;
+ }
+ }
Index: x11-wm/weston/files/patch-libweston_compositor-x11.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_compositor-x11.c
@@ -0,0 +1,10 @@
+--- libweston/compositor-x11.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/compositor-x11.c
+@@ -37,6 +37,7 @@
+ #include <errno.h>
+ #include <sys/time.h>
+ #include <sys/shm.h>
++#include <sys/stat.h>
+ #include <linux/input.h>
+
+ #include <xcb/xcb.h>
Index: x11-wm/weston/files/patch-libweston_compositor.h
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_compositor.h
@@ -0,0 +1,10 @@
+--- libweston/compositor.h.orig 2017-08-08 18:57:03 UTC
++++ libweston/compositor.h
+@@ -1672,6 +1672,7 @@ weston_compositor_create(struct wl_display *display, v
+ enum weston_compositor_backend {
+ WESTON_BACKEND_DRM,
+ WESTON_BACKEND_FBDEV,
++ WESTON_BACKEND_SCFB,
+ WESTON_BACKEND_HEADLESS,
+ WESTON_BACKEND_RDP,
+ WESTON_BACKEND_WAYLAND,
Index: x11-wm/weston/files/patch-libweston_compositor.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_compositor.c
@@ -0,0 +1,24 @@
+--- libweston/compositor.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/compositor.c
+@@ -5406,10 +5406,10 @@ weston_compositor_set_presentation_clock_software(
+ {
+ /* In order of preference */
+ static const clockid_t clocks[] = {
+- CLOCK_MONOTONIC_RAW, /* no jumps, no crawling */
+- CLOCK_MONOTONIC_COARSE, /* no jumps, may crawl, fast & coarse */
++ //CLOCK_MONOTONIC_RAW, /* no jumps, no crawling */
++ //CLOCK_MONOTONIC_COARSE, /* no jumps, may crawl, fast & coarse */
+ CLOCK_MONOTONIC, /* no jumps, may crawl */
+- CLOCK_REALTIME_COARSE, /* may jump and crawl, fast & coarse */
++ //CLOCK_REALTIME_COARSE, /* may jump and crawl, fast & coarse */
+ CLOCK_REALTIME /* may jump and crawl */
+ };
+ unsigned i;
+@@ -5598,6 +5598,7 @@ weston_compositor_get_user_data(struct weston_composit
+ static const char * const backend_map[] = {
+ [WESTON_BACKEND_DRM] = "drm-backend.so",
+ [WESTON_BACKEND_FBDEV] = "fbdev-backend.so",
++ [WESTON_BACKEND_SCFB] = "scfb-backend.so",
+ [WESTON_BACKEND_HEADLESS] = "headless-backend.so",
+ [WESTON_BACKEND_RDP] = "rdp-backend.so",
+ [WESTON_BACKEND_WAYLAND] = "wayland-backend.so",
Index: x11-wm/weston/files/patch-libweston_input.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_input.c
@@ -0,0 +1,12 @@
+--- libweston/input.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/input.c
+@@ -32,7 +32,8 @@
+ #include <sys/mman.h>
+ #include <assert.h>
+ #include <unistd.h>
+-#include <values.h>
++//#include <values.h>
++#include <float.h>
+ #include <fcntl.h>
+ #include <limits.h>
+
Index: x11-wm/weston/files/patch-libweston_launcher-direct.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_launcher-direct.c
@@ -0,0 +1,177 @@
+--- libweston/launcher-direct.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/launcher-direct.c
+@@ -33,19 +33,27 @@
+ #include <unistd.h>
+ #include <signal.h>
+ #include <sys/stat.h>
+-#include <sys/sysmacros.h>
++/* #include <sys/sysmacros.h> */
+ #include <sys/ioctl.h>
+-#include <linux/vt.h>
+-#include <linux/kd.h>
+-#include <linux/major.h>
++/* #include <linux/vt.h> */
++/* #include <linux/kd.h> */
++/* #include <linux/major.h> */
++/* #define TTY_BASENAME "/dev/tty" */
++/* #define TTY_0 "/dev/tty0" */
+
++#include <termios.h>
++#include <sys/consio.h>
++#include <sys/kbio.h>
++#define TTY_BASENAME "/dev/ttyv"
++#define TTY_0 "/dev/ttyv0"
++
+ #include "launcher-impl.h"
+
+-#define DRM_MAJOR 226
++/* #define DRM_MAJOR 226 */
+
+-#ifndef KDSKBMUTE
+-#define KDSKBMUTE 0x4B51
+-#endif
++/* #ifndef KDSKBMUTE */
++/* #define KDSKBMUTE 0x4B51 */
++/* #endif */
+
+ #ifdef BUILD_DRM_COMPOSITOR
+
+@@ -117,7 +125,7 @@ setup_tty(struct launcher_direct *launcher, int tty)
+ struct vt_mode mode = { 0 };
+ struct stat buf;
+ char tty_device[32] ="<stdin>";
+- int ret, kd_mode;
++ int ret, kd_mode, vt;
+
+ if (tty == 0) {
+ launcher->tty = dup(tty);
+@@ -126,7 +134,7 @@ setup_tty(struct launcher_direct *launcher, int tty)
+ return -1;
+ }
+ } else {
+- snprintf(tty_device, sizeof tty_device, "/dev/tty%d", tty);
++ snprintf(tty_device, sizeof tty_device, "%s%d", TTY_BASENAME, tty);
+ launcher->tty = open(tty_device, O_RDWR | O_CLOEXEC);
+ if (launcher->tty == -1) {
+ weston_log("couldn't open tty %s: %m\n", tty_device);
+@@ -134,14 +142,20 @@ setup_tty(struct launcher_direct *launcher, int tty)
+ }
+ }
+
+- if (fstat(launcher->tty, &buf) == -1 ||
+- major(buf.st_rdev) != TTY_MAJOR || minor(buf.st_rdev) == 0) {
+- weston_log("%s not a vt\n", tty_device);
+- weston_log("if running weston from ssh, "
+- "use --tty to specify a tty\n");
+- goto err_close;
++ ret = ioctl(launcher->tty, VT_GETINDEX, &vt);
++ if (ret) {
++ weston_log("failed to get VT index: %m\n");
++ return -1;
+ }
+
++ /* if (fstat(launcher->tty, &buf) == -1 || */
++ /* major(buf.st_rdev) != TTY_MAJOR || minor(buf.st_rdev) == 0) { */
++ /* weston_log("%s not a vt\n", tty_device); */
++ /* weston_log("if running weston from ssh, " */
++ /* "use --tty to specify a tty\n"); */
++ /* goto err_close; */
++ /* } */
++
+ ret = ioctl(launcher->tty, KDGETMODE, &kd_mode);
+ if (ret) {
+ weston_log("failed to get VT mode: %m\n");
+@@ -153,20 +167,31 @@ setup_tty(struct launcher_direct *launcher, int tty)
+ goto err_close;
+ }
+
+- ioctl(launcher->tty, VT_ACTIVATE, minor(buf.st_rdev));
+- ioctl(launcher->tty, VT_WAITACTIVE, minor(buf.st_rdev));
++ ioctl(launcher->tty, VT_ACTIVATE, vt);
++ ioctl(launcher->tty, VT_WAITACTIVE, vt);
+
+ if (ioctl(launcher->tty, KDGKBMODE, &launcher->kb_mode)) {
+ weston_log("failed to read keyboard mode: %m\n");
+ goto err_close;
+ }
+
+- if (ioctl(launcher->tty, KDSKBMUTE, 1) &&
+- ioctl(launcher->tty, KDSKBMODE, K_OFF)) {
+- weston_log("failed to set K_OFF keyboard mode: %m\n");
++ if (ioctl(launcher->tty, KDSKBMODE, K_RAW) == -1) {
++ weston_log("Could not set keyboard mode to K_RAW");
+ goto err_close;
+ }
+
++ /* Put the tty into raw mode */
++ struct termios tios;
++ if (tcgetattr(launcher->tty, &tios)) {
++ weston_log("Failed to get terminal attribute");
++ goto err_close;
++ }
++ cfmakeraw(&tios);
++ if (tcsetattr(launcher->tty, TCSAFLUSH, &tios)) {
++ weston_log("Failed to set terminal attribute");
++ goto err_close;
++ }
++
+ ret = ioctl(launcher->tty, KDSETMODE, KD_GRAPHICS);
+ if (ret) {
+ weston_log("failed to set KD_GRAPHICS mode on tty: %m\n");
+@@ -184,10 +209,10 @@ setup_tty(struct launcher_direct *launcher, int tty)
+ ret = -EINVAL;
+ goto err_close;
+ }
+-
+ mode.mode = VT_PROCESS;
+- mode.relsig = SIGRTMIN;
++ mode.relsig = SIGRTMAX;
+ mode.acqsig = SIGRTMIN;
++ mode.frsig = SIGIO; /* not used, but has to be set anyway */
+ if (ioctl(launcher->tty, VT_SETMODE, &mode) < 0) {
+ weston_log("failed to take control of vt handling\n");
+ goto err_close;
+@@ -222,13 +247,11 @@ launcher_direct_open(struct weston_launcher *launcher_
+ return -1;
+ }
+
+- if (major(s.st_rdev) == DRM_MAJOR) {
+- launcher->drm_fd = fd;
+- if (!is_drm_master(fd)) {
+- weston_log("drm fd not master\n");
+- close(fd);
+- return -1;
+- }
++ launcher->drm_fd = fd;
++ if (!is_drm_master(fd)) {
++ weston_log("drm fd not master\n");
++ close(fd);
++ return -1;
+ }
+
+ return fd;
+@@ -246,13 +269,22 @@ launcher_direct_restore(struct weston_launcher *launch
+ struct launcher_direct *launcher = wl_container_of(launcher_base, launcher, base);
+ struct vt_mode mode = { 0 };
+
+- if (ioctl(launcher->tty, KDSKBMUTE, 0) &&
+- ioctl(launcher->tty, KDSKBMODE, launcher->kb_mode))
++ if (ioctl(launcher->tty, KDSKBMODE, launcher->kb_mode))
+ weston_log("failed to restore kb mode: %m\n");
+
+ if (ioctl(launcher->tty, KDSETMODE, KD_TEXT))
+ weston_log("failed to set KD_TEXT mode on tty: %m\n");
+
++ /* Restore sane mode */
++ struct termios tios;
++ if (tcgetattr(launcher->tty, &tios)) {
++ weston_log("Failed to get terminal attribute");
++ } else {
++ cfmakesane(&tios);
++ if (tcsetattr(launcher->tty, TCSAFLUSH, &tios)) {
++ weston_log("Failed to set terminal attribute");
++ }
++ }
+ /* We have to drop master before we switch the VT back in
+ * VT_AUTO, so we don't risk switching to a VT with another
+ * display server, that will then fail to set drm master. */
Index: x11-wm/weston/files/patch-libweston_launcher-weston-launch.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_launcher-weston-launch.c
@@ -0,0 +1,84 @@
+--- libweston/launcher-weston-launch.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/launcher-weston-launch.c
+@@ -34,26 +34,36 @@
+ #include <errno.h>
+ #include <signal.h>
+ #include <sys/socket.h>
+-#include <sys/sysmacros.h>
++/* #include <sys/sysmacros.h> */
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/uio.h>
+ #include <sys/ioctl.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+-#include <linux/vt.h>
+-#include <linux/kd.h>
+-#include <linux/major.h>
+
++#include <termios.h>
++#include <sys/consio.h>
++#include <sys/kbio.h>
++#define TTY_BASENAME "/dev/ttyv"
++#define TTY_0 "/dev/ttyv0"
++
++/* #include <linux/kd.h> */
++/* #include <linux/major.h> */
++/* #include <linux/vt.h> */
++/* #define TTY_BASENAME "/dev/tty" */
++/* #define TTY_0 "/dev/tty0" */
++
++
+ #include "compositor.h"
+ #include "weston-launch.h"
+ #include "launcher-impl.h"
+
+-#define DRM_MAJOR 226
++/* #define DRM_MAJOR 226 */
+
+-#ifndef KDSKBMUTE
+-#define KDSKBMUTE 0x4B51
+-#endif
++/* #ifndef KDSKBMUTE */
++/* #define KDSKBMUTE 0x4B51 */
++/* #endif */
+
+ #ifdef BUILD_DRM_COMPOSITOR
+
+@@ -161,13 +171,24 @@ launcher_weston_launch_restore(struct weston_launcher
+ struct launcher_weston_launch *launcher = wl_container_of(launcher_base, launcher, base);
+ struct vt_mode mode = { 0 };
+
+- if (ioctl(launcher->tty, KDSKBMUTE, 0) &&
++ if (/*ioctl(launcher->tty, KDSKBMUTE, 0) &&*/
+ ioctl(launcher->tty, KDSKBMODE, launcher->kb_mode))
+ weston_log("failed to restore kb mode: %m\n");
+
+ if (ioctl(launcher->tty, KDSETMODE, KD_TEXT))
+ weston_log("failed to set KD_TEXT mode on tty: %m\n");
+
++ /* Restore sane mode */
++ struct termios tios;
++ if (tcgetattr(launcher->tty, &tios)) {
++ weston_log("Failed to get terminal attribute\n");
++ } else {
++ cfmakesane(&tios);
++ if (tcsetattr(launcher->tty, TCSAFLUSH, &tios)) {
++ weston_log("Failed to set terminal attribute\n");
++ }
++ }
++
+ /* We have to drop master before we switch the VT back in
+ * VT_AUTO, so we don't risk switching to a VT with another
+ * display server, that will then fail to set drm master. */
+@@ -244,7 +265,9 @@ launcher_weston_launch_connect(struct weston_launcher
+ /* We don't get a chance to read out the original kb
+ * mode for the tty, so just hard code K_UNICODE here
+ * in case we have to clean if weston-launch dies. */
+- launcher->kb_mode = K_UNICODE;
++
++ launcher->kb_mode = K_XLATE;
++ /* launcher->kb_mode = K_UNICODE; */
+
+ loop = wl_display_get_event_loop(compositor->wl_display);
+ launcher->source = wl_event_loop_add_fd(loop, launcher->fd,
Index: x11-wm/weston/files/patch-libweston_libbacklight.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_libbacklight.c
@@ -0,0 +1,16 @@
+--- libweston/libbacklight.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/libbacklight.c
+@@ -36,11 +36,11 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+-#include <linux/types.h>
++/* #include <linux/types.h> */
+ #include <dirent.h>
+ #include <drm.h>
+ #include <fcntl.h>
+-#include <malloc.h>
++/* #include <malloc.h> */
+ #include <string.h>
+ #include <errno.h>
+
Index: x11-wm/weston/files/patch-libweston_pixel-formats.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_pixel-formats.c
@@ -0,0 +1,11 @@
+--- libweston/pixel-formats.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/pixel-formats.c
+@@ -25,7 +25,7 @@
+
+ #include "config.h"
+
+-#include <endian.h>
++#include <sys/endian.h>
+ #include <inttypes.h>
+ #include <stdbool.h>
+ #include <unistd.h>
Index: x11-wm/weston/files/patch-libweston_timeline.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_timeline.c
@@ -0,0 +1,11 @@
+--- libweston/timeline.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/timeline.c
+@@ -36,6 +36,8 @@
+ #include "compositor.h"
+ #include "file-util.h"
+
++#define ETIME ETIMEDOUT
++
+ struct timeline_log {
+ clock_t clk_id;
+ FILE *file;
Index: x11-wm/weston/files/patch-libweston_weston-launch.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-libweston_weston-launch.c
@@ -0,0 +1,432 @@
+--- libweston/weston-launch.c.orig 2017-08-08 18:57:03 UTC
++++ libweston/weston-launch.c
+@@ -33,7 +33,6 @@
+ #include <poll.h>
+ #include <errno.h>
+
+-#include <error.h>
+ #include <getopt.h>
+
+ #include <sys/types.h>
+@@ -42,15 +41,40 @@
+ #include <sys/wait.h>
+ #include <sys/socket.h>
+ #include <sys/signalfd.h>
+-#include <sys/sysmacros.h>
++/* #include <sys/sysmacros.h> */
+ #include <signal.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+
+-#include <linux/vt.h>
+-#include <linux/major.h>
+-#include <linux/kd.h>
++#include <termios.h>
++#include <sys/consio.h>
++#include <sys/kbio.h>
++#define TTY_BASENAME "/dev/ttyv"
++#define TTY_0 "/dev/ttyv0"
++#define error(s,e,...) \
++ do { \
++ if(e) \
++ fprintf(stderr, "errno: %s\r\n",strerror(e)); \
++ fprintf(stderr, __VA_ARGS__); \
++ fprintf(stderr, "\r\n"); \
++ if (s != 0) { \
++ exit(-1); \
++ } \
++ } while(false)
++static inline int clearenv(void) {
++ extern char **environ;
++ environ[0] = NULL;
++ return 0;
++}
+
++/* #include <error.h> */
++/* #include <linux/kd.h> */
++/* #include <linux/major.h> */
++/* #include <linux/vt.h> */
++/* #define TTY_BASENAME "/dev/tty" */
++/* #define TTY_0 "/dev/tty0" */
++
++
+ #include <pwd.h>
+ #include <grp.h>
+ #include <security/pam_appl.h>
+@@ -61,12 +85,13 @@
+
+ #include "weston-launch.h"
+
+-#define DRM_MAJOR 226
+
+-#ifndef KDSKBMUTE
+-#define KDSKBMUTE 0x4B51
+-#endif
++/* #define DRM_MAJOR 226 */
+
++/* #ifndef KDSKBMUTE */
++/* #define KDSKBMUTE 0x4B51 */
++/* #endif */
++
+ #ifndef EVIOCREVOKE
+ #define EVIOCREVOKE _IOW('E', 0x91, int)
+ #endif
+@@ -122,7 +147,7 @@ read_groups(void)
+ n = getgroups(0, NULL);
+
+ if (n < 0) {
+- fprintf(stderr, "Unable to retrieve groups: %m\n");
++ fprintf(stderr, "Unable to retrieve groups: %m\r\n");
+ return NULL;
+ }
+
+@@ -131,7 +156,7 @@ read_groups(void)
+ return NULL;
+
+ if (getgroups(n, groups) < 0) {
+- fprintf(stderr, "Unable to retrieve groups: %m\n");
++ fprintf(stderr, "Unable to retrieve groups: %m\r\n");
+ free(groups);
+ return NULL;
+ }
+@@ -143,7 +168,7 @@ weston_launch_allowed(struct weston_launch *wl)
+ {
+ struct group *gr;
+ gid_t *groups;
+- int i;
++ int i,n;
+ #ifdef HAVE_SYSTEMD_LOGIN
+ char *session, *seat;
+ int err;
+@@ -156,7 +181,8 @@ weston_launch_allowed(struct weston_launch *wl)
+ if (gr) {
+ groups = read_groups();
+ if (groups) {
+- for (i = 0; groups[i]; ++i) {
++ n = getgroups(0, NULL);
++ for (i = 0; i<n; ++i) {
+ if (groups[i] == gr->gr_gid) {
+ free(groups);
+ return true;
+@@ -201,21 +227,21 @@ setup_pam(struct weston_launch *wl)
+
+ err = pam_start("login", wl->pw->pw_name, &wl->pc, &wl->ph);
+ if (err != PAM_SUCCESS) {
+- fprintf(stderr, "failed to start pam transaction: %d: %s\n",
++ fprintf(stderr, "failed to start pam transaction: %d: %s\r\n",
+ err, pam_strerror(wl->ph, err));
+ return -1;
+ }
+
+ err = pam_set_item(wl->ph, PAM_TTY, ttyname(wl->tty));
+ if (err != PAM_SUCCESS) {
+- fprintf(stderr, "failed to set PAM_TTY item: %d: %s\n",
++ fprintf(stderr, "failed to set PAM_TTY item: %d: %s\r\n",
+ err, pam_strerror(wl->ph, err));
+ return -1;
+ }
+
+ err = pam_open_session(wl->ph, 0);
+ if (err != PAM_SUCCESS) {
+- fprintf(stderr, "failed to open pam session: %d: %s\n",
++ fprintf(stderr, "failed to open pam session: %d: %s\r\n",
+ err, pam_strerror(wl->ph, err));
+ return -1;
+ }
+@@ -311,7 +337,7 @@ handle_open(struct weston_launch *wl, struct msghdr *m
+
+ fd = open(message->path, message->flags);
+ if (fd < 0) {
+- fprintf(stderr, "Error opening device %s: %m\n",
++ fprintf(stderr, "Error opening device %s: %m\r\n",
+ message->path);
+ goto err0;
+ }
+@@ -319,18 +345,18 @@ handle_open(struct weston_launch *wl, struct msghdr *m
+ if (fstat(fd, &s) < 0) {
+ close(fd);
+ fd = -1;
+- fprintf(stderr, "Failed to stat %s\n", message->path);
++ fprintf(stderr, "Failed to stat %s\r\n", message->path);
+ goto err0;
+ }
+
+- if (major(s.st_rdev) != INPUT_MAJOR &&
+- major(s.st_rdev) != DRM_MAJOR) {
+- close(fd);
+- fd = -1;
+- fprintf(stderr, "Device %s is not an input or drm device\n",
+- message->path);
+- goto err0;
+- }
++ /* if (major(s.st_rdev) != INPUT_MAJOR && */
++ /* major(s.st_rdev) != DRM_MAJOR) { */
++ /* close(fd); */
++ /* fd = -1; */
++ /* fprintf(stderr, "Device %s is not an input or drm device\r\n", */
++ /* message->path); */
++ /* goto err0; */
++ /* } */
+
+ err0:
+ memset(&nmsg, 0, sizeof nmsg);
+@@ -351,8 +377,8 @@ err0:
+ iov.iov_base = &ret;
+ iov.iov_len = sizeof ret;
+
+- if (wl->verbose)
+- fprintf(stderr, "weston-launch: opened %s: ret: %d, fd: %d\n",
++ /* if (wl->verbose) */
++ printf("weston-launch: opened %s: ret: %d, fd: %d\r\n",
+ message->path, ret, fd);
+ do {
+ len = sendmsg(wl->sock[0], &nmsg, 0);
+@@ -361,10 +387,9 @@ err0:
+ if (len < 0)
+ return -1;
+
+- if (fd != -1 && major(s.st_rdev) == DRM_MAJOR)
++ if (fd != -1)
+ wl->drm_fd = fd;
+- if (fd != -1 && major(s.st_rdev) == INPUT_MAJOR &&
+- wl->last_input_fd < fd)
++ if (fd != -1 && wl->last_input_fd < fd)
+ wl->last_input_fd = fd;
+
+ return 0;
+@@ -418,17 +443,26 @@ quit(struct weston_launch *wl, int status)
+ if (wl->new_user) {
+ err = pam_close_session(wl->ph, 0);
+ if (err)
+- fprintf(stderr, "pam_close_session failed: %d: %s\n",
++ fprintf(stderr, "pam_close_session failed: %d: %s\r\n",
+ err, pam_strerror(wl->ph, err));
+ pam_end(wl->ph, err);
+ }
+
+- if (ioctl(wl->tty, KDSKBMUTE, 0) &&
+- ioctl(wl->tty, KDSKBMODE, wl->kb_mode))
+- fprintf(stderr, "failed to restore keyboard mode: %m\n");
++ /* if (ioctl(wl->tty, KDSKBMODE, wl->kb_mode)) */
++ if (ioctl(wl->tty, KDSKBMODE, K_XLATE))
++ fprintf(stderr, "Could not restore keyboard\r\n");
+
++ struct termios tios;
++ if (tcgetattr(wl->tty, &tios)) {
++ fprintf(stderr, "Failed to get terminal attribute\r\n");
++ } else {
++ cfmakesane(&tios);
++ if (tcsetattr(wl->tty , TCSAFLUSH, &tios))
++ fprintf(stderr, "Failed to set terminal attribute\r\n");
++ }
++
+ if (ioctl(wl->tty, KDSETMODE, KD_TEXT))
+- fprintf(stderr, "failed to set KD_TEXT mode on tty: %m\n");
++ fprintf(stderr, "failed to set KD_TEXT mode on tty: %m\r\n");
+
+ /* We have to drop master before we switch the VT back in
+ * VT_AUTO, so we don't risk switching to a VT with another
+@@ -436,8 +470,9 @@ quit(struct weston_launch *wl, int status)
+ drmDropMaster(wl->drm_fd);
+
+ mode.mode = VT_AUTO;
++ mode.frsig = SIGIO; /* not used, but has to be set anyway */
+ if (ioctl(wl->tty, VT_SETMODE, &mode) < 0)
+- fprintf(stderr, "could not reset vt handling\n");
++ fprintf(stderr, "could not reset vt handling\r\n");
+
+ exit(status);
+ }
+@@ -445,15 +480,24 @@ quit(struct weston_launch *wl, int status)
+ static void
+ close_input_fds(struct weston_launch *wl)
+ {
++ // Input device are being closed by: launcher_weston_launch_close()
++ // on exit or deactivate.
++ // This function will close the wayland socket fd as well
++ // and crash the program...
++
++ // Do we need this function?
++
+ struct stat s;
+ int fd;
+
+ for (fd = 3; fd <= wl->last_input_fd; fd++) {
+- if (fstat(fd, &s) == 0 && major(s.st_rdev) == INPUT_MAJOR) {
++ if (fstat(fd, &s) == 0) {
+ /* EVIOCREVOKE may fail if the kernel doesn't
+ * support it, but all we can do is ignore it. */
+ ioctl(fd, EVIOCREVOKE, 0);
+ close(fd);
++ } else {
++ fprintf(stderr,"%s: stat failed on fd %d\r\n",__func__,fd);
+ }
+ }
+ }
+@@ -464,13 +508,17 @@ handle_signal(struct weston_launch *wl)
+ struct signalfd_siginfo sig;
+ int pid, status, ret;
+
+- if (read(wl->signalfd, &sig, sizeof sig) != sizeof sig) {
+- error(0, errno, "reading signalfd failed");
++ ret = read(wl->signalfd, &sig, sizeof sig);
++ if (ret != sizeof sig) {
++ error(0, errno, "reading signalfd %d failed", wl->signalfd);
++ // Temporary add delay here so we don't get spammed with error messages
++ usleep(500000);
+ return -1;
+ }
+
+ switch (sig.ssi_signo) {
+ case SIGCHLD:
++ printf("%s: SIGCHLD\r\n",__func__);
+ pid = waitpid(-1, &status, 0);
+ if (pid == wl->child) {
+ wl->child = 0;
+@@ -490,22 +538,32 @@ handle_signal(struct weston_launch *wl)
+ }
+ break;
+ case SIGTERM:
++ printf("%s: SIGTERM - killing\r\n",__func__);
+ case SIGINT:
++ printf("%s: SIGINT - killing\r\n",__func__);
+ if (wl->child)
+ kill(wl->child, sig.ssi_signo);
+ break;
+ case SIGUSR1:
++ printf("%s: SIGUSR1 - deactivating\r\n",__func__);
+ send_reply(wl, WESTON_LAUNCHER_DEACTIVATE);
+- close_input_fds(wl);
++
++ // This is done in launcher-weston-launcher.c,
++ // compositor-drm.c (session-notify)
++ // Double close = crash on vt switch (socket also get closed)
++ /* close_input_fds(wl); */
++
+ drmDropMaster(wl->drm_fd);
+ ioctl(wl->tty, VT_RELDISP, 1);
+ break;
+ case SIGUSR2:
++ printf("%s: SIGUSR2 - activating\r\n",__func__);
+ ioctl(wl->tty, VT_RELDISP, VT_ACKACQ);
+ drmSetMaster(wl->drm_fd);
+ send_reply(wl, WESTON_LAUNCHER_ACTIVATE);
+ break;
+ default:
++ printf("%s: Unknown signal\r\n",__func__);
+ return -1;
+ }
+
+@@ -528,7 +586,7 @@ setup_tty(struct weston_launch *wl, const char *tty)
+ else
+ wl->tty = open(tty, O_RDWR | O_NOCTTY);
+ } else {
+- int tty0 = open("/dev/tty0", O_WRONLY | O_CLOEXEC);
++ int tty0 = open(TTY_0, O_WRONLY | O_CLOEXEC);
+ char filename[16];
+
+ if (tty0 < 0)
+@@ -537,7 +595,7 @@ setup_tty(struct weston_launch *wl, const char *tty)
+ if (ioctl(tty0, VT_OPENQRY, &wl->ttynr) < 0 || wl->ttynr == -1)
+ error(1, errno, "failed to find non-opened console");
+
+- snprintf(filename, sizeof filename, "/dev/tty%d", wl->ttynr);
++ snprintf(filename, sizeof filename, "%s%d", TTY_BASENAME, wl->ttynr);
+ wl->tty = open(filename, O_RDWR | O_NOCTTY);
+ close(tty0);
+ }
+@@ -545,35 +603,36 @@ setup_tty(struct weston_launch *wl, const char *tty)
+ if (wl->tty < 0)
+ error(1, errno, "failed to open tty");
+
+- if (fstat(wl->tty, &buf) == -1 ||
+- major(buf.st_rdev) != TTY_MAJOR || minor(buf.st_rdev) == 0)
+- error(1, 0, "weston-launch must be run from a virtual terminal");
+-
+ if (tty) {
+ if (fstat(wl->tty, &buf) < 0)
+ error(1, errno, "stat %s failed", tty);
+
+- if (major(buf.st_rdev) != TTY_MAJOR)
+- error(1, 0, "invalid tty device: %s", tty);
+-
+- wl->ttynr = minor(buf.st_rdev);
++ if(ioctl(wl->tty, VT_GETINDEX, &wl->ttynr))
++ error(1, errno, "failed to get vt index for tty %s", tty);
+ }
+
+ if (ioctl(wl->tty, KDGKBMODE, &wl->kb_mode))
+- error(1, errno, "failed to get current keyboard mode: %m\n");
++ error(1, errno, "failed to get current keyboard mode: %m\r\n");
+
+- if (ioctl(wl->tty, KDSKBMUTE, 1) &&
+- ioctl(wl->tty, KDSKBMODE, K_OFF))
+- error(1, errno, "failed to set K_OFF keyboard mode: %m\n");
++ if (ioctl(wl->tty, KDSKBMODE, K_RAW) == -1)
++ error(1, errno, "Could not set keyboard mode to K_RAW\r\n");
+
++ struct termios tios;
++ if (tcgetattr(wl->tty, &tios))
++ error(1, errno, "Failed to get terminal attribute %m\r\n");
++ cfmakeraw(&tios);
++ if (tcsetattr(wl->tty , TCSAFLUSH, &tios))
++ error(1, errno, "Failed to set terminal attribute %m\r\n");
++
+ if (ioctl(wl->tty, KDSETMODE, KD_GRAPHICS))
+- error(1, errno, "failed to set KD_GRAPHICS mode on tty: %m\n");
++ error(1, errno, "failed to set KD_GRAPHICS mode on tty: %m\r\n");
+
+ mode.mode = VT_PROCESS;
+ mode.relsig = SIGUSR1;
+ mode.acqsig = SIGUSR2;
++ mode.frsig = SIGIO; /* not used, but has to be set anyway */
+ if (ioctl(wl->tty, VT_SETMODE, &mode) < 0)
+- error(1, errno, "failed to take control of vt handling\n");
++ error(1, errno, "failed to take control of vt handling\r\n");
+
+ return 0;
+ }
+@@ -641,7 +700,7 @@ launch_compositor(struct weston_launch *wl, int argc,
+ int o, i;
+
+ if (wl->verbose)
+- printf("weston-launch: spawned weston with pid: %d\n", getpid());
++ printf("weston-launch: spawned weston with pid: %d\r\n", getpid());
+ if (wl->new_user) {
+ o = setup_session(wl, child_argv);
+ } else {
+@@ -675,11 +734,11 @@ launch_compositor(struct weston_launch *wl, int argc,
+ static void
+ help(const char *name)
+ {
+- fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name);
+- fprintf(stderr, " -u, --user Start session as specified username\n");
+- fprintf(stderr, " -t, --tty Start session on alternative tty\n");
+- fprintf(stderr, " -v, --verbose Be verbose\n");
+- fprintf(stderr, " -h, --help Display this help message\n");
++ fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\r\n", name);
++ fprintf(stderr, " -u, --user Start session as specified username\r\n");
++ fprintf(stderr, " -t, --tty Start session on alternative tty\r\n");
++ fprintf(stderr, " -v, --verbose Be verbose\r\n");
++ fprintf(stderr, " -h, --help Display this help message\r\n");
+ }
+
+ int
+@@ -730,13 +789,13 @@ main(int argc, char *argv[])
+ error(1, errno, "failed to get username");
+
+ if (!weston_launch_allowed(&wl))
+- error(1, 0, "Permission denied. You should either:\n"
++ error(1, 0, "Permission denied. You should either:\r\n"
+ #ifdef HAVE_SYSTEMD_LOGIN
+- " - run from an active and local (systemd) session.\n"
++ " - run from an active and local (systemd) session.\r\n"
+ #else
+- " - enable systemd session support for weston-launch.\n"
++ " - enable systemd session support for weston-launch.\r\n"
+ #endif
+- " - or add yourself to the 'weston-launch' group.");
++ " - or add yourself to the 'weston-launch' group.\r\n");
+
+ if (setup_tty(&wl, tty) < 0)
+ exit(EXIT_FAILURE);
Index: x11-wm/weston/files/patch-shared_file-util.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-shared_file-util.c
@@ -0,0 +1,11 @@
+--- shared/file-util.c.orig 2017-08-08 18:57:03 UTC
++++ shared/file-util.c
+@@ -34,6 +34,8 @@
+
+ #include "file-util.h"
+
++#define ETIME ETIMEDOUT
++
+ static int
+ current_time_str(char *str, size_t len, const char *fmt)
+ {
Index: x11-wm/weston/files/patch-shared_string-helpers.h
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-shared_string-helpers.h
@@ -0,0 +1,10 @@
+--- shared/string-helpers.h.orig 2017-08-08 18:57:03 UTC
++++ shared/string-helpers.h
+@@ -31,6 +31,7 @@
+ #include <stdint.h>
+ #include <errno.h>
+ #include <assert.h>
++#include <unistd.h>
+
+ /* Convert string to integer
+ *
Index: x11-wm/weston/files/patch-shared_xalloc.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-shared_xalloc.c
@@ -0,0 +1,11 @@
+--- shared/xalloc.c.orig 2017-08-08 18:57:03 UTC
++++ shared/xalloc.c
+@@ -32,6 +32,8 @@
+
+ #include "xalloc.h"
+
++#define program_invocation_short_name getprogname()
++
+ void *
+ fail_on_null(void *p, size_t size, char *file, int32_t line)
+ {
Index: x11-wm/weston/files/patch-tests_surface-screenshot.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-tests_surface-screenshot.c
@@ -0,0 +1,11 @@
+--- tests/surface-screenshot.c.orig 2017-08-08 18:57:03 UTC
++++ tests/surface-screenshot.c
+@@ -37,6 +37,8 @@
+ #include "compositor/weston.h"
+ #include "file-util.h"
+
++#define ETIME ETIMEDOUT
++
+ static char *
+ encode_PAM_comment_line(const char *comment)
+ {
Index: x11-wm/weston/files/patch-tests_weston-test-runner.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-tests_weston-test-runner.c
@@ -0,0 +1,11 @@
+--- tests/weston-test-runner.c.orig 2017-08-08 18:57:03 UTC
++++ tests/weston-test-runner.c
+@@ -38,6 +38,8 @@
+
+ #define SKIP 77
+
++#define program_invocation_short_name getprogname()
++
+ char __attribute__((weak)) *server_parameters="";
+
+ extern const struct weston_test __start_test_section, __stop_test_section;
Index: x11-wm/weston/files/patch-tools_zunitc_src_zunitc__impl.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-tools_zunitc_src_zunitc__impl.c
@@ -0,0 +1,10 @@
+--- tools/zunitc/src/zunitc_impl.c.orig 2017-08-08 18:57:03 UTC
++++ tools/zunitc/src/zunitc_impl.c
+@@ -36,6 +36,7 @@
+ #include <sys/wait.h>
+ #include <time.h>
+ #include <unistd.h>
++#include <signal.h>
+
+ #include "zunitc/zunitc_impl.h"
+ #include "zunitc/zunitc.h"
Index: x11-wm/weston/files/patch-xwayland_launcher.c
===================================================================
--- /dev/null
+++ x11-wm/weston/files/patch-xwayland_launcher.c
@@ -0,0 +1,59 @@
+--- xwayland/launcher.c.orig 2017-08-08 18:57:03 UTC
++++ xwayland/launcher.c
+@@ -42,6 +42,10 @@
+ #include "shared/string-helpers.h"
+ #include "compositor/weston.h"
+
++#define LOCK_FMT "/tmp/.X%d-lock"
++#define SOCKET_FMT "/tmp/.X11-unix/X%d"
++#define SOCKET2_FMT "/tmp/.X11-unix/X%d_"
++
+ static int
+ weston_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
+ {
+@@ -68,10 +72,12 @@ weston_xserver_shutdown(struct weston_xserver *wxs)
+ {
+ char path[256];
+
+- snprintf(path, sizeof path, "/tmp/.X%d-lock", wxs->display);
++ snprintf(path, sizeof path, LOCK_FMT, wxs->display);
+ unlink(path);
+- snprintf(path, sizeof path, "/tmp/.X11-unix/X%d", wxs->display);
++ snprintf(path, sizeof path, SOCKET_FMT, wxs->display);
+ unlink(path);
++ snprintf(path, sizeof path, SOCKET2_FMT, wxs->display);
++ unlink(path);
+ if (wxs->pid == 0) {
+ wl_event_source_remove(wxs->abstract_source);
+ wl_event_source_remove(wxs->unix_source);
+@@ -98,10 +104,10 @@ bind_to_abstract_socket(int display)
+
+ addr.sun_family = AF_LOCAL;
+ name_size = snprintf(addr.sun_path, sizeof addr.sun_path,
+- "%c/tmp/.X11-unix/X%d", 0, display);
++ SOCKET2_FMT, display);
+ size = offsetof(struct sockaddr_un, sun_path) + name_size;
+ if (bind(fd, (struct sockaddr *) &addr, size) < 0) {
+- weston_log("failed to bind to @%s: %m\n", addr.sun_path + 1);
++ weston_log("failed to bind to '%s'\n", addr.sun_path);
+ close(fd);
+ return -1;
+ }
+@@ -127,7 +133,7 @@ bind_to_unix_socket(int display)
+
+ addr.sun_family = AF_LOCAL;
+ name_size = snprintf(addr.sun_path, sizeof addr.sun_path,
+- "/tmp/.X11-unix/X%d", display) + 1;
++ SOCKET_FMT, display);
+ size = offsetof(struct sockaddr_un, sun_path) + name_size;
+ unlink(addr.sun_path);
+ if (bind(fd, (struct sockaddr *) &addr, size) < 0) {
+@@ -154,7 +160,7 @@ create_lockfile(int display, char *lockfile, size_t ls
+ int fd, size;
+ pid_t other;
+
+- snprintf(lockfile, lsize, "/tmp/.X%d-lock", display);
++ snprintf(lockfile, lsize, LOCK_FMT, display);
+ fd = open(lockfile, O_WRONLY | O_CLOEXEC | O_CREAT | O_EXCL, 0444);
+ if (fd < 0 && errno == EEXIST) {
+ fd = open(lockfile, O_CLOEXEC | O_RDONLY);
Index: x11-wm/weston/pkg-descr
===================================================================
--- /dev/null
+++ x11-wm/weston/pkg-descr
@@ -0,0 +1,6 @@
+Weston is a reference implementation of a Wayland compositor. Weston can
+run as an X client or under KMS and ships with a few demo clients. The Weston
+compositor is a minimal and fast compositor and is suitable for many embedded
+and mobile use cases
+
+WWW: http://wayland.freedesktop.org
Index: x11-wm/weston/pkg-plist
===================================================================
--- /dev/null
+++ x11-wm/weston/pkg-plist
@@ -0,0 +1,104 @@
+%%SUID%%@(,,4755) bin/weston-launch
+%%NO_SUID%%bin/weston-launch
+bin/weston
+bin/wcap-decode
+%%CLIENTS_INSTALL%%bin/weston-calibrator
+%%CLIENTS_INSTALL%%bin/weston-clickdot
+%%CLIENTS_INSTALL%%bin/weston-cliptest
+%%CLIENTS_INSTALL%%bin/weston-confine
+%%CLIENTS_INSTALL%%bin/weston-dnd
+%%CLIENTS_INSTALL%%bin/weston-editor
+%%CLIENTS_INSTALL%%bin/weston-eventdemo
+%%CLIENTS_INSTALL%%bin/weston-flower
+%%CLIENTS_INSTALL%%bin/weston-fullscreen
+%%CLIENTS_INSTALL%%bin/weston-image
+%%CLIENTS_INSTALL%%bin/weston-info
+%%CLIENTS_INSTALL%%bin/weston-multi-resource
+%%CLIENTS_INSTALL%%bin/weston-presentation-shm
+%%CLIENTS_INSTALL%%bin/weston-resizor
+%%CLIENTS_INSTALL%%bin/weston-scaler
+%%CLIENTS_INSTALL%%bin/weston-simple-damage
+%%CLIENTS_INSTALL%%bin/weston-simple-dmabuf-drm
+%%CLIENTS_INSTALL%%bin/weston-simple-dmabuf-v4l
+%%CLIENTS_INSTALL%%bin/weston-simple-egl
+%%CLIENTS_INSTALL%%bin/weston-simple-shm
+%%CLIENTS_INSTALL%%bin/weston-simple-touch
+%%CLIENTS_INSTALL%%bin/weston-smoke
+%%CLIENTS_INSTALL%%bin/weston-stacking
+%%CLIENTS_INSTALL%%bin/weston-subsurfaces
+%%CLIENTS_INSTALL%%bin/weston-terminal
+%%CLIENTS_INSTALL%%bin/weston-transformed
+%%DRM%%include/libweston-3/compositor-drm.h
+include/libweston-3/compositor-fbdev.h
+include/libweston-3/compositor-headless.h
+include/libweston-3/compositor-rdp.h
+%%SCFB%%include/libweston-3/compositor-scfb.h
+%%WAYLAND%%include/libweston-3/compositor-wayland.h
+%%X11%%include/libweston-3/compositor-x11.h
+include/libweston-3/compositor.h
+include/libweston-3/config-parser.h
+include/libweston-3/libweston-desktop.h
+include/libweston-3/matrix.h
+include/libweston-3/plugin-registry.h
+include/libweston-3/timeline-object.h
+include/libweston-3/version.h
+include/libweston-3/windowed-output-api.h
+%%XWAYLAND%%include/libweston-3/xwayland-api.h
+include/libweston-3/zalloc.h
+include/weston/ivi-layout-export.h
+include/weston/weston.h
+lib/libweston-3.so
+lib/libweston-3.so.0
+lib/libweston-3.so.0.0.0
+%%DRM%%lib/libweston-3/drm-backend.so
+lib/libweston-3/gl-renderer.so
+lib/libweston-3/headless-backend.so
+%%SCFB%%lib/libweston-3/scfb-backend.so
+%%WAYLAND%%lib/libweston-3/wayland-backend.so
+%%X11%%lib/libweston-3/x11-backend.so
+%%XWAYLAND%%lib/libweston-3/xwayland.so
+lib/libweston-desktop-3.so
+lib/libweston-desktop-3.so.0
+lib/libweston-desktop-3.so.0.0.0
+lib/weston/cms-colord.so
+lib/weston/cms-static.so
+lib/weston/desktop-shell.so
+lib/weston/fullscreen-shell.so
+lib/weston/hmi-controller.so
+lib/weston/ivi-shell.so
+libdata/pkgconfig/libweston-3.pc
+libdata/pkgconfig/libweston-desktop-3.pc
+libdata/pkgconfig/weston.pc
+libexec/weston-desktop-shell
+libexec/weston-ivi-shell-user-interface
+libexec/weston-keyboard
+libexec/weston-screenshooter
+libexec/weston-simple-im
+man/man1/weston.1.gz
+man/man5/weston.ini.5.gz
+%%DRM%%man/man7/weston-drm.7.gz
+share/wayland-sessions/weston.desktop
+%%DATADIR%%/background.png
+%%DATADIR%%/border.png
+%%DATADIR%%/fullscreen.png
+%%DATADIR%%/home.png
+%%DATADIR%%/icon_editor.png
+%%DATADIR%%/icon_flower.png
+%%DATADIR%%/icon_ivi_clickdot.png
+%%DATADIR%%/icon_ivi_flower.png
+%%DATADIR%%/icon_ivi_simple-egl.png
+%%DATADIR%%/icon_ivi_simple-shm.png
+%%DATADIR%%/icon_ivi_smoke.png
+%%DATADIR%%/icon_terminal.png
+%%DATADIR%%/icon_window.png
+%%DATADIR%%/panel.png
+%%DATADIR%%/pattern.png
+%%DATADIR%%/random.png
+%%DATADIR%%/sidebyside.png
+%%DATADIR%%/sign_close.png
+%%DATADIR%%/sign_maximize.png
+%%DATADIR%%/sign_minimize.png
+%%DATADIR%%/terminal.png
+%%DATADIR%%/tiling.png
+%%DATADIR%%/wayland.png
+%%DATADIR%%/wayland.svg

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 21, 11:08 PM (10 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27124085
Default Alt Text
D10599.id36407.diff (102 KB)

Event Timeline