From d64d53bc9caa503288b4a88a7d944cddfc815596 Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Feb 27 2014 19:02:07 +0000 Subject: import xorg-x11-server-1.15.0-7.el7.src.rpm --- diff --git a/.xorg-x11-server.metadata b/.xorg-x11-server.metadata index c3d57c4..2d0886b 100644 --- a/.xorg-x11-server.metadata +++ b/.xorg-x11-server.metadata @@ -1 +1 @@ -9a6929bc08b3fff52b98e68897d7ab3a3291534b SOURCES/xorg-server-1.14.99.901.tar.bz2 +a0f347a9002770925fe95d4b9275068b44b4a4b0 SOURCES/xorg-server-1.15.0.tar.bz2 diff --git a/SOURCES/0001-Disable-DRI3-and-sync-fence-FD-functions-if-xshmfenc.patch b/SOURCES/0001-Disable-DRI3-and-sync-fence-FD-functions-if-xshmfenc.patch deleted file mode 100644 index edf20b2..0000000 --- a/SOURCES/0001-Disable-DRI3-and-sync-fence-FD-functions-if-xshmfenc.patch +++ /dev/null @@ -1,186 +0,0 @@ -From aaf0e29619196a283fee7ead2020a91032d84f48 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Sun, 3 Nov 2013 09:56:02 -0800 -Subject: [PATCH 1/5] Disable DRI3 and sync fence FD functions if xshmfence - isn't available - -Make sure the server can build when the xshmfence library isn't present - -Signed-off-by: Keith Packard ---- - Xext/sync.c | 8 ++++++++ - configure.ac | 46 ++++++++++++++++++++++++++++++++++++++++++++-- - dri3/dri3.h | 6 ++++++ - include/xorg-server.h.in | 3 +++ - miext/sync/Makefile.am | 7 ++++++- - 5 files changed, 67 insertions(+), 3 deletions(-) - -diff --git a/Xext/sync.c b/Xext/sync.c -index a04c383..dd18cde 100644 ---- a/Xext/sync.c -+++ b/Xext/sync.c -@@ -919,6 +919,7 @@ SyncCreate(ClientPtr client, XID id, unsigned char type) - int - SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL initially_triggered) - { -+#if HAVE_XSHMFENCE - SyncFence *pFence; - int status; - -@@ -936,12 +937,19 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL - return BadAlloc; - - return Success; -+#else -+ return BadImplementation; -+#endif - } - - int - SyncFDFromFence(ClientPtr client, DrawablePtr pDraw, SyncFence *pFence) - { -+#if HAVE_XSHMFENCE - return miSyncFDFromFence(pDraw, pFence); -+#else -+ return BadImplementation; -+#endif - } - - static SyncCounter * -diff --git a/configure.ac b/configure.ac -index 0d855f2..a7515a3 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -792,6 +792,7 @@ DMXPROTO="dmxproto >= 2.2.99.1" - VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1" - WINDOWSWMPROTO="windowswmproto" - APPLEWMPROTO="applewmproto >= 1.4" -+XSHMFENCE="xshmfence" - - dnl Required modules - XPROTO="xproto >= 7.0.22" -@@ -1119,17 +1120,59 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes) - - PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO, - [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no]) -+ - case "$DRI3,$HAVE_DRI3PROTO" in -+ yes,yes | auto,yes) -+ ;; - yes,no) - AC_MSG_ERROR([DRI3 requested, but dri3proto not found.]) -+ DRI3=no -+ ;; -+ no,*) -+ ;; -+ *) -+ AC_MSG_NOTICE([DRI3 disabled because dri3proto not found.]) -+ DRI3=no - ;; -+esac -+ -+PKG_CHECK_MODULES([XSHMFENCE], $XSHMFENCE, -+ [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no]) -+ -+AM_CONDITIONAL(XSHMFENCE, test "x$HAVE_XSHMFENCE" = xyes) -+ -+case x"$HAVE_XSHMFENCE" in -+ xyes) -+ AC_DEFINE(HAVE_XSHMFENCE, 1, [Have X Shared Memory Fence library]) -+ ;; -+esac -+ -+ -+case "$DRI3,$HAVE_XSHMFENCE" in - yes,yes | auto,yes) -- AC_DEFINE(DRI3, 1, [Build DRI3 extension]) -+ ;; -+ yes,no) -+ AC_MSG_ERROR("DRI3 requested, but xshmfence not found.]) -+ DRI3=no -+ ;; -+ no,*) -+ ;; -+ *) -+ AC_MSG_NOTICE([DRI3 disabled because xshmfence not found.]) -+ DRI3=no -+ ;; -+esac -+ -+case x"$DRI3" in -+ xyes|xauto) - DRI3=yes -+ AC_DEFINE(DRI3, 1, [Build DRI3 extension]) - DRI3_LIB='$(top_builddir)/dri3/libdri3.la' - SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO" -+ AC_MSG_NOTICE([DRI3 enabled]); - ;; - esac -+ - AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes) - - if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then -@@ -1333,7 +1376,6 @@ if test "x$XDMAUTH" = xyes; then - XDMCP_MODULES="xdmcp" - fi - fi --REQUIRED_LIBS="$REQUIRED_LIBS xshmfence" - - AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path]) - AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path]) -diff --git a/dri3/dri3.h b/dri3/dri3.h -index 7774c87..7c0c330 100644 ---- a/dri3/dri3.h -+++ b/dri3/dri3.h -@@ -23,6 +23,10 @@ - #ifndef _DRI3_H_ - #define _DRI3_H_ - -+#include -+ -+#ifdef DRI3 -+ - #include - #include - -@@ -56,4 +60,6 @@ typedef struct dri3_screen_info { - extern _X_EXPORT Bool - dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info); - -+#endif -+ - #endif /* _DRI3_H_ */ -diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in -index 1281b3e..960817e 100644 ---- a/include/xorg-server.h.in -+++ b/include/xorg-server.h.in -@@ -218,4 +218,7 @@ - #define _XSERVER64 1 - #endif - -+/* Have support for X shared memory fence library (xshmfence) */ -+#undef HAVE_XSHMFENCE -+ - #endif /* _XORG_SERVER_H_ */ -diff --git a/miext/sync/Makefile.am b/miext/sync/Makefile.am -index e25ceac..ac13c52 100644 ---- a/miext/sync/Makefile.am -+++ b/miext/sync/Makefile.am -@@ -8,8 +8,13 @@ if XORG - sdk_HEADERS = misync.h misyncstr.h misyncshm.h - endif - -+XSHMFENCE_SRCS = misyncshm.c -+ - libsync_la_SOURCES = \ - misync.c \ - misync.h \ -- misyncshm.c \ - misyncstr.h -+ -+if XSHMFENCE -+libsync_la_SOURCES += $(XSHMFENCE_SRCS) -+endif --- -1.8.3.1 - diff --git a/SOURCES/0001-configure-Don-t-add-GLX_SYS_LIBS-to-Xorg-s-SYS_LIBS.patch b/SOURCES/0001-configure-Don-t-add-GLX_SYS_LIBS-to-Xorg-s-SYS_LIBS.patch new file mode 100644 index 0000000..489c170 --- /dev/null +++ b/SOURCES/0001-configure-Don-t-add-GLX_SYS_LIBS-to-Xorg-s-SYS_LIBS.patch @@ -0,0 +1,28 @@ +From e22db97a3a64c9c942fbabfb2a21244834cce1c9 Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Wed, 5 Feb 2014 11:06:10 -0500 +Subject: [PATCH] configure: Don't add GLX_SYS_LIBS to Xorg's SYS_LIBS + +libglx.so links libGL, but Xorg should not. + +Signed-off-by: Adam Jackson +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index f62e705..e607a55 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1868,7 +1868,7 @@ if test "x$XORG" = xyes; then + if test "x$PCI" = xyes; then + PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS) + SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $LIBPCIACCESS" +- XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS $LIBDRM_LIBS" ++ XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $LIBDRM_LIBS" + XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS $LIBDRM_CFLAGS" + + AC_DEFINE(XSERVER_LIBPCIACCESS, 1, [Use libpciaccess for all pci manipulation]) +-- +1.8.5.3 + diff --git a/SOURCES/0001-dbe-Cleanup-in-CloseScreen-hook-not-ext-CloseDown.patch b/SOURCES/0001-dbe-Cleanup-in-CloseScreen-hook-not-ext-CloseDown.patch index 62964e3..eebbee4 100644 --- a/SOURCES/0001-dbe-Cleanup-in-CloseScreen-hook-not-ext-CloseDown.patch +++ b/SOURCES/0001-dbe-Cleanup-in-CloseScreen-hook-not-ext-CloseDown.patch @@ -1,7 +1,7 @@ -From cace30177d37bf70dafcc297c38af4ecd7f74dba Mon Sep 17 00:00:00 2001 +From bd6c61de441087b808a45ff3fea4fe5a31455c5c Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 12 Jan 2012 18:16:08 +0000 -Subject: [PATCH 01/39] dbe: Cleanup in CloseScreen hook not ext CloseDown +Subject: [PATCH 01/38] dbe: Cleanup in CloseScreen hook not ext CloseDown Instead of registering an extension CloseDownProc when adding the dbe extension this patch hooks into pScreen->CloseScreen so that the chain @@ -121,5 +121,5 @@ index 2002066..7733d0e 100644 /* Per-screen DIX routines */ Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ , -- -1.8.3.1 +1.8.4.2 diff --git a/SOURCES/0001-dix-fix-button-state-check-before-changing-a-button-.patch b/SOURCES/0001-dix-fix-button-state-check-before-changing-a-button-.patch new file mode 100644 index 0000000..c808c39 --- /dev/null +++ b/SOURCES/0001-dix-fix-button-state-check-before-changing-a-button-.patch @@ -0,0 +1,37 @@ +From 25d10464f440b8b34594b7c988a99a830ea39a29 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Fri, 24 Jan 2014 18:16:54 +1000 +Subject: [PATCH] dix: fix button state check before changing a button mapping + +dev->button->down is a bitmask, not a normal array. Use the helper function to +check, we technically allow the mapping to change after the physical button +has been pressed (but not yet processed yet), so only check BUTTON_PROCESSED. + +From XSetPointerMapping(3): +"If any of the buttons to be altered are logically in the down state, +XSetPointerMapping returns MappingBusy, and the mapping is not changed." + +Reported-by: Ilja Van Sprundel +Signed-off-by: Peter Hutterer +Reviewed-by: Daniel Stone +--- + dix/inpututils.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/dix/inpututils.c b/dix/inpututils.c +index a10a7c7..e5bcc31 100644 +--- a/dix/inpututils.c ++++ b/dix/inpututils.c +@@ -60,7 +60,8 @@ check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out, + } + + for (i = 0; i < len; i++) { +- if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1]) ++ if (dev->button->map[i + 1] != map[i] && ++ button_is_down(dev, i + 1, BUTTON_PROCESSED)) + return MappingBusy; + } + +-- +1.8.4.2 + diff --git a/SOURCES/0001-link-with-z-now.patch b/SOURCES/0001-link-with-z-now.patch new file mode 100644 index 0000000..012be13 --- /dev/null +++ b/SOURCES/0001-link-with-z-now.patch @@ -0,0 +1,26 @@ +From 58f5196a02b2fea360a35e2ea7046a320aca2b4e Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Mon, 27 Jun 2011 11:21:23 -0400 +Subject: [PATCH 01/15] link with -z now + +Signed-off-by: Adam Jackson +--- + hw/xfree86/Makefile.am | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am +index c3899b5..9e422f2 100644 +--- a/hw/xfree86/Makefile.am ++++ b/hw/xfree86/Makefile.am +@@ -67,7 +67,7 @@ Xorg_LDADD = \ + $(XSERVER_SYS_LIBS) + Xorg_DEPENDENCIES = $(LOCAL_LIBS) + +-Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) ++Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -Wl,-z,now + + BUILT_SOURCES = xorg.conf.example + DISTCLEANFILES = xorg.conf.example +-- +1.7.7.6 + diff --git a/SOURCES/0001-mieq-Bump-default-queue-size-to-512.patch b/SOURCES/0001-mieq-Bump-default-queue-size-to-512.patch deleted file mode 100644 index a50df5d..0000000 --- a/SOURCES/0001-mieq-Bump-default-queue-size-to-512.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 2d554ab4874943a6b73132ba84835586011f2b45 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Fri, 30 Nov 2012 13:50:40 -0500 -Subject: [PATCH] mieq: Bump default queue size to 512 - -Based on some bugzilla scraping just now. Of xserver bugs with -attachments, the distribution looks like: - -String | Matches -------------------------------------- -Increasing EQ size to 512 | 460 -Increasing EQ size to 1024 | 52 -Increasing EQ size to 2048 | 6 -Increasing EQ size to 4096 | 0 - -Most of the "512" ones appear to be mostly harmless, some relatively -expensive path in either rendering or resource destruction simply taking -too long due to external pressures like paging or CPU contention. So -let's raise the initial queue size, both to reduce the number of -spurious abrt reports and to drop fewer events in all but the most -pathological cases. - -Signed-off-by: Adam Jackson ---- - mi/mieq.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/mi/mieq.c b/mi/mieq.c -index b2c7769..c1d845b 100644 ---- a/mi/mieq.c -+++ b/mi/mieq.c -@@ -60,7 +60,7 @@ in this Software without prior written authorization from The Open Group. - #endif - - /* Maximum size should be initial size multiplied by a power of 2 */ --#define QUEUE_INITIAL_SIZE 256 -+#define QUEUE_INITIAL_SIZE 512 - #define QUEUE_RESERVED_SIZE 64 - #define QUEUE_MAXIMUM_SIZE 4096 - #define QUEUE_DROP_BACKTRACE_FREQUENCY 100 --- -1.7.11.7 - diff --git a/SOURCES/0001-present-Don-t-try-to-initialize-when-building-withou.patch b/SOURCES/0001-present-Don-t-try-to-initialize-when-building-withou.patch deleted file mode 100644 index 449f5ca..0000000 --- a/SOURCES/0001-present-Don-t-try-to-initialize-when-building-withou.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 77c2d915c571894d1b17127ba29924fabb5a0fd8 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Thu, 7 Nov 2013 12:00:37 -0500 -Subject: [PATCH] present: Don't try to initialize when building without - present support - -There's a --disable-present, so it'd be nice if it worked. - -Signed-off-by: Adam Jackson ---- - mi/miinitext.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/mi/miinitext.c b/mi/miinitext.c -index 6366182..67511b8 100644 ---- a/mi/miinitext.c -+++ b/mi/miinitext.c -@@ -287,7 +287,9 @@ static ExtensionModule staticExtensions[] = { - #ifdef DPMSExtension - {DPMSExtensionInit, DPMSExtensionName, &noDPMSExtension}, - #endif -+#ifdef PRESENT - {present_extension_init, PRESENT_NAME, NULL}, -+#endif - #ifdef DRI3 - {dri3_extension_init, DRI3_NAME, NULL}, - #endif --- -1.8.3.1 - diff --git a/SOURCES/0001-randr-attempt-to-fix-primary-on-slave-output.patch b/SOURCES/0001-randr-attempt-to-fix-primary-on-slave-output.patch new file mode 100644 index 0000000..2ac89dd --- /dev/null +++ b/SOURCES/0001-randr-attempt-to-fix-primary-on-slave-output.patch @@ -0,0 +1,130 @@ +From 535366ffcf36b38815c9c344402b21c126050188 Mon Sep 17 00:00:00 2001 +From: Fedora X Ninjas +Date: Fri, 21 Feb 2014 03:30:50 +0000 +Subject: [PATCH] randr: attempt to fix primary on slave output + +--- + randr/rroutput.c | 6 +++++- + randr/rrscreen.c | 22 ++++++++++++++++++---- + randr/rrxinerama.c | 12 ++++++++++-- + 3 files changed, 33 insertions(+), 7 deletions(-) + +diff --git a/randr/rroutput.c b/randr/rroutput.c +index 2b0b82f..07aa0ec 100644 +--- a/randr/rroutput.c ++++ b/randr/rroutput.c +@@ -540,7 +540,11 @@ ProcRRSetOutputPrimary(ClientPtr client) + if (stuff->output) { + VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess); + +- if (output->pScreen != pWin->drawable.pScreen) { ++ if (!output->pScreen->isGPU && output->pScreen != pWin->drawable.pScreen) { ++ client->errorValue = stuff->window; ++ return BadMatch; ++ } ++ if (output->pScreen->isGPU && output->pScreen->current_master != pWin->drawable.pScreen) { + client->errorValue = stuff->window; + return BadMatch; + } +diff --git a/randr/rrscreen.c b/randr/rrscreen.c +index 36179ae..47d1823 100644 +--- a/randr/rrscreen.c ++++ b/randr/rrscreen.c +@@ -322,8 +322,13 @@ static inline void swap_modeinfos(xRRModeInfo *modeinfos, int i) + swapl(&modeinfos[i].modeFlags); + } + +-#define update_arrays(gpuscreen, pScrPriv) do { \ ++#define update_arrays(gpuscreen, pScrPriv, primary_crtc) do { \ + for (j = 0; j < pScrPriv->numCrtcs; j++) { \ ++ if (has_primary && \ ++ primary_crtc == pScrPriv->crtcs[j]) { \ ++ has_primary = 0; \ ++ continue; \ ++ }\ + crtcs[crtc_count] = pScrPriv->crtcs[j]->id; \ + if (client->swapped) \ + swapl(&crtcs[crtc_count]); \ +@@ -366,9 +371,11 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) + unsigned long extraLen; + CARD8 *extra; + RRCrtc *crtcs; ++ RRCrtcPtr primary_crtc = NULL; + RROutput *outputs; + xRRModeInfo *modeinfos; + CARD8 *names; ++ int has_primary = 0; + + /* we need to iterate all the GPU masters and all their output slaves */ + total_crtcs = 0; +@@ -426,18 +433,25 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) + modeinfos = (xRRModeInfo *)(outputs + total_outputs); + names = (CARD8 *)(modeinfos + total_modes); + +- /* TODO primary */ + crtc_count = 0; + output_count = 0; + mode_count = 0; + + pScrPriv = rrGetScrPriv(pScreen); +- update_arrays(pScreen, pScrPriv); ++ if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { ++ has_primary = 1; ++ primary_crtc = pScrPriv->primaryOutput->crtc; ++ crtcs[0] = pScrPriv->primaryOutput->crtc->id; ++ if (client->swapped) ++ swapl(&crtcs[0]); ++ crtc_count = 1; ++ } ++ update_arrays(pScreen, pScrPriv, primary_crtc); + + xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) { + pScrPriv = rrGetScrPriv(iter); + +- update_arrays(iter, pScrPriv); ++ update_arrays(iter, pScrPriv, primary_crtc); + } + + assert(bytes_to_int32((char *) names - (char *) extra) == rep.length); +diff --git a/randr/rrxinerama.c b/randr/rrxinerama.c +index 76d728c..363cead 100644 +--- a/randr/rrxinerama.c ++++ b/randr/rrxinerama.c +@@ -344,15 +344,17 @@ ProcRRXineramaQueryScreens(ClientPtr client) + ScreenPtr slave; + rrScrPriv(pScreen); + int has_primary = 0; ++ RRCrtcPtr primary_crtc = NULL; + + if (pScrPriv->primaryOutput && pScrPriv->primaryOutput->crtc) { + has_primary = 1; ++ primary_crtc = pScrPriv->primaryOutput->crtc; + RRXineramaWriteCrtc(client, pScrPriv->primaryOutput->crtc); + } + + for (i = 0; i < pScrPriv->numCrtcs; i++) { + if (has_primary && +- pScrPriv->primaryOutput->crtc == pScrPriv->crtcs[i]) { ++ primary_crtc == pScrPriv->crtcs[i]) { + has_primary = 0; + continue; + } +@@ -362,8 +364,14 @@ ProcRRXineramaQueryScreens(ClientPtr client) + xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) { + rrScrPrivPtr pSlavePriv; + pSlavePriv = rrGetScrPriv(slave); +- for (i = 0; i < pSlavePriv->numCrtcs; i++) ++ for (i = 0; i < pSlavePriv->numCrtcs; i++) { ++ if (has_primary && ++ primary_crtc == pSlavePriv->crtcs[i]) { ++ has_primary = 0; ++ continue; ++ } + RRXineramaWriteCrtc(client, pSlavePriv->crtcs[i]); ++ } + } + } + +-- +1.8.3.1 + diff --git a/SOURCES/0001-xf86-return-NULL-for-compat-output-if-no-outputs.patch b/SOURCES/0001-xf86-return-NULL-for-compat-output-if-no-outputs.patch deleted file mode 100644 index a7fe6da..0000000 --- a/SOURCES/0001-xf86-return-NULL-for-compat-output-if-no-outputs.patch +++ /dev/null @@ -1,30 +0,0 @@ -From f0ae8cbbb8b88c04b256a6895c21a056dddbbbb1 Mon Sep 17 00:00:00 2001 -From: Dave Airlie -Date: Mon, 10 Sep 2012 11:14:20 +1000 -Subject: [PATCH] xf86: return NULL for compat output if no outputs. - -With outputless GPUs showing up we crash here if there are not outputs -try and recover with a bit of grace. - -Signed-off-by: Dave Airlie ---- - hw/xfree86/modes/xf86Crtc.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c -index 803de88..7419400 100644 ---- a/hw/xfree86/modes/xf86Crtc.c -+++ b/hw/xfree86/modes/xf86Crtc.c -@@ -1764,6 +1764,9 @@ SetCompatOutput(xf86CrtcConfigPtr config) - DisplayModePtr maxmode = NULL, testmode, mode; - int o, compat = -1, count, mincount = 0; - -+ if (config->num_output == 0) -+ return NULL; -+ - /* Look for one that's definitely connected */ - for (o = 0; o < config->num_output; o++) { - test = config->output[o]; --- -1.7.10.2 - diff --git a/SOURCES/0001-xinerama-Export-the-screen-region.patch b/SOURCES/0001-xinerama-Export-the-screen-region.patch deleted file mode 100644 index 51f761b..0000000 --- a/SOURCES/0001-xinerama-Export-the-screen-region.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 7a9c524d0f68127baa0ced0a7f6b52b899a7cccb Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Tue, 29 Oct 2013 10:44:07 -0400 -Subject: [PATCH 1/6] xinerama: Export the screen region - -damageext wants this so it can intersect subtract requests against the -root window geometry. - -Signed-off-by: Adam Jackson ---- - Xext/panoramiX.c | 2 +- - Xext/panoramiXsrv.h | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c -index 2b3a570..15c38a9 100644 ---- a/Xext/panoramiX.c -+++ b/Xext/panoramiX.c -@@ -73,7 +73,7 @@ int PanoramiXPixWidth = 0; - int PanoramiXPixHeight = 0; - int PanoramiXNumScreens = 0; - --static RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL }; -+_X_EXPORT RegionRec PanoramiXScreenRegion = { {0, 0, 0, 0}, NULL }; - - static int PanoramiXNumDepths; - static DepthPtr PanoramiXDepths; -diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h -index 7c605fe..0fcde4f 100644 ---- a/Xext/panoramiXsrv.h -+++ b/Xext/panoramiXsrv.h -@@ -11,6 +11,7 @@ - extern _X_EXPORT int PanoramiXNumScreens; - extern _X_EXPORT int PanoramiXPixWidth; - extern _X_EXPORT int PanoramiXPixHeight; -+extern _X_EXPORT RegionRec PanoramiXScreenRegion; - - extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig); - extern _X_EXPORT void PanoramiXConsolidate(void); --- -1.8.3.1 - diff --git a/SOURCES/0002-dix-Add-PostDispatchCallback.patch b/SOURCES/0002-dix-Add-PostDispatchCallback.patch deleted file mode 100644 index ef32a97..0000000 --- a/SOURCES/0002-dix-Add-PostDispatchCallback.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 13f334e3699d8ca1fe02d07b1cbff8a348c47e49 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Wed, 2 Oct 2013 11:01:16 -0400 -Subject: [PATCH 2/6] dix: Add PostDispatchCallback - -This is required to Xineramify the Damage extension, since we need to -collect regions across screens. You can't quite use FlushCallback for -this since WriteEventsToClient can itself trigger FlushCallback and you -recurse. - -There are probably other cases where this would be useful though, for -example some of our abuse of BlockHandler may want to move to this -callback. - -Signed-off-by: Adam Jackson ---- - dix/dispatch.c | 5 ++++- - include/dixstruct.h | 1 + - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/dix/dispatch.c b/dix/dispatch.c -index 4fecfea..53cabdf 100644 ---- a/dix/dispatch.c -+++ b/dix/dispatch.c -@@ -167,6 +167,7 @@ static int nextFreeClientID; /* always MIN free client ID */ - static int nClients; /* number of authorized clients */ - - CallbackListPtr ClientStateCallback; -+CallbackListPtr PostDispatchCallback; - - /* dispatchException & isItTimeToYield must be declared volatile since they - * are modified by signal handlers - otherwise optimizer may assume it doesn't -@@ -428,9 +429,11 @@ Dispatch(void) - result = BadLength; - else { - result = XaceHookDispatch(client, client->majorOp); -- if (result == Success) -+ if (result == Success) { - result = - (*client->requestVector[client->majorOp]) (client); -+ CallCallbacks(&PostDispatchCallback, &result); -+ } - XaceHookAuditEnd(client, result); - } - #ifdef XSERVER_DTRACE -diff --git a/include/dixstruct.h b/include/dixstruct.h -index 456e633..d55b047 100644 ---- a/include/dixstruct.h -+++ b/include/dixstruct.h -@@ -39,6 +39,7 @@ SOFTWARE. - */ - - extern _X_EXPORT CallbackListPtr ClientStateCallback; -+extern _X_EXPORT CallbackListPtr PostDispatchCallback; - - typedef struct { - ClientPtr client; --- -1.8.3.1 - diff --git a/SOURCES/0002-hw-xfree86-Link-libdri3-only-when-DRI3-is-defined.patch b/SOURCES/0002-hw-xfree86-Link-libdri3-only-when-DRI3-is-defined.patch deleted file mode 100644 index cdfde71..0000000 --- a/SOURCES/0002-hw-xfree86-Link-libdri3-only-when-DRI3-is-defined.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 903a058370645ea075ea98d380fd565efb6160c9 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Mon, 4 Nov 2013 19:01:26 -0800 -Subject: [PATCH 2/5] hw/xfree86: Link libdri3 only when DRI3 is defined - -Don't attempt to link non-existant libraries... - -Signed-off-by: Keith Packard ---- - hw/xfree86/Makefile.am | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am -index eea16a8..485386f 100644 ---- a/hw/xfree86/Makefile.am -+++ b/hw/xfree86/Makefile.am -@@ -9,6 +9,11 @@ DRI2_SUBDIR = dri2 - DRI2_LIB = dri2/libdri2.la - endif - -+if DRI3 -+DRI3_BUILDDIR = $(top_builddir)/dri3 -+DRI3_LIB = $(DRI3_BUILDDIR)/libdri3.la -+endif -+ - if XF86UTILS - XF86UTILS_SUBDIR = utils - endif -@@ -59,7 +64,7 @@ LOCAL_LIBS = \ - dixmods/libxorgxkb.la \ - $(DRI_LIB) \ - $(DRI2_LIB) \ -- $(top_builddir)/dri3/libdri3.la \ -+ $(DRI3_LIB) \ - $(top_builddir)/miext/sync/libsync.la \ - $(top_builddir)/mi/libmi.la \ - $(top_builddir)/os/libos.la --- -1.8.3.1 - diff --git a/SOURCES/0002-xkb-Add-struct-XkbCompContext.patch b/SOURCES/0002-xkb-Add-struct-XkbCompContext.patch index 925f852..e8014b5 100644 --- a/SOURCES/0002-xkb-Add-struct-XkbCompContext.patch +++ b/SOURCES/0002-xkb-Add-struct-XkbCompContext.patch @@ -1,7 +1,7 @@ -From b126aca8d6b8b81527a7dcab0d9659a9b5d63d01 Mon Sep 17 00:00:00 2001 +From 8470f377fc36772d885f4b614f4d42443c4b812b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 9 Apr 2013 16:54:55 -0400 -Subject: [PATCH 02/39] xkb: Add struct XkbCompContext +Subject: [PATCH 02/38] xkb: Add struct XkbCompContext This commit adds a struct that contains most of the context for starting, running and cleaning up after xkbcomp. @@ -186,5 +186,5 @@ index d462957..5da3a35 100644 LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n", fileName); -- -1.8.3.1 +1.8.4.2 diff --git a/SOURCES/0003-damageext-Xineramify-v6.patch b/SOURCES/0003-damageext-Xineramify-v6.patch deleted file mode 100644 index 7f23b88..0000000 --- a/SOURCES/0003-damageext-Xineramify-v6.patch +++ /dev/null @@ -1,630 +0,0 @@ -From 728866dbc1246a04dc614fac94b81f6baed19959 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Mon, 16 Sep 2013 15:17:26 -0400 -Subject: [PATCH 3/6] damageext: Xineramify (v6) - -v6: -- Clip window damages even more excruciatingly correctly - -Screen 0 holds the "real" damage for all drawable types; the window -report hooks for other screens look up screen 0 and pile on. Therefore -we don't need to wrap Subtract, though we do have to be careful how we -subtract since we need to clip to the (apparent) root window geometry. -The real compexity is the cleverness required for deferring writing the -events, but there's no getting around that. - -Add is probably (still) somewhat broken since it will only hit screen 0, -but Add really only exists for DRI1's sake, and DRI1 disables itself -with Xinerama enabled anyway. In the absence of a use case, I'm leaving -it unwrapped under Xinerama; if someone wants to define how it ought to -work, be my guest. - -Signed-off-by: Adam Jackson - -stuff ---- - Xext/panoramiX.c | 3 + - Xext/panoramiX.h | 3 + - damageext/damageext.c | 425 ++++++++++++++++++++++++++++++++++++++++++----- - damageext/damageextint.h | 4 + - 4 files changed, 390 insertions(+), 45 deletions(-) - -diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c -index 15c38a9..ce0d072 100644 ---- a/Xext/panoramiX.c -+++ b/Xext/panoramiX.c -@@ -54,6 +54,7 @@ Equipment Corporation. - #include "resource.h" - #include "picturestr.h" - #include "xfixesint.h" -+#include "damageextint.h" - #ifdef COMPOSITE - #include "compint.h" - #endif -@@ -582,6 +583,7 @@ PanoramiXExtensionInit(void) - - PanoramiXRenderInit(); - PanoramiXFixesInit(); -+ PanoramiXDamageInit(); - #ifdef COMPOSITE - PanoramiXCompositeInit(); - #endif -@@ -887,6 +889,7 @@ PanoramiXResetProc(ExtensionEntry * extEntry) - - PanoramiXRenderReset(); - PanoramiXFixesReset(); -+ PanoramiXDamageReset(); - #ifdef COMPOSITE - PanoramiXCompositeReset (); - #endif -diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h -index 6578dfa..b06fce4 100644 ---- a/Xext/panoramiX.h -+++ b/Xext/panoramiX.h -@@ -64,6 +64,9 @@ typedef struct { - struct { - Bool root; - } pict; -+ struct { -+ Bool queued; -+ } damage; - char raw_data[4]; - } u; - } PanoramiXRes; -diff --git a/damageext/damageext.c b/damageext/damageext.c -index 9521c26..7c86491 100644 ---- a/damageext/damageext.c -+++ b/damageext/damageext.c -@@ -1,5 +1,6 @@ - /* - * Copyright © 2002 Keith Packard -+ * Copyright 2013 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that -@@ -28,6 +29,15 @@ - #include "protocol-versions.h" - #include "extinit.h" - -+#ifdef PANORAMIX -+#include "panoramiX.h" -+#include "panoramiXsrv.h" -+ -+static RESTYPE XRT_DAMAGE; -+static int (*PanoramiXSaveDamageVector[XDamageNumberRequests]) (ClientPtr); -+ -+#endif -+ - static unsigned char DamageReqCode; - static int DamageEventBase; - static RESTYPE DamageExtType; -@@ -37,25 +47,61 @@ static DevPrivateKeyRec DamageClientPrivateKeyRec; - #define DamageClientPrivateKey (&DamageClientPrivateKeyRec) - - static void -+DamageNoteCritical(ClientPtr pClient) -+{ -+ DamageClientPtr pDamageClient = GetDamageClient(pClient); -+ -+ /* Composite extension marks clients with manual Subwindows as critical */ -+ if (pDamageClient->critical > 0) { -+ SetCriticalOutputPending(); -+ pClient->smart_priority = SMART_MAX_PRIORITY; -+ } -+} -+ -+static void -+damageGetGeometry(DrawablePtr draw, int *x, int *y, int *w, int *h) -+{ -+#ifdef PANORAMIX -+ if (!noPanoramiXExtension && draw->type == DRAWABLE_WINDOW) { -+ WindowPtr win = (WindowPtr)draw; -+ -+ if (!win->parent) { -+ *x = screenInfo.x; -+ *y = screenInfo.y; -+ *w = screenInfo.width; -+ *h = screenInfo.height; -+ return; -+ } -+ } -+#endif -+ -+ *x = draw->x; -+ *y = draw->y; -+ *w = draw->width; -+ *h = draw->height; -+} -+ -+static void - DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) - { - ClientPtr pClient = pDamageExt->pClient; -- DamageClientPtr pDamageClient = GetDamageClient(pClient); - DrawablePtr pDrawable = pDamageExt->pDrawable; - xDamageNotifyEvent ev; -- int i; -+ int i, x, y, w, h; -+ -+ damageGetGeometry(pDrawable, &x, &y, &w, &h); - - UpdateCurrentTimeIf(); - ev = (xDamageNotifyEvent) { - .type = DamageEventBase + XDamageNotify, - .level = pDamageExt->level, - .drawable = pDamageExt->drawable, -- .damage = pDamageExt->id, -+ .damage = pDamageExt->report_id, - .timestamp = currentTime.milliseconds, -- .geometry.x = pDrawable->x, -- .geometry.y = pDrawable->y, -- .geometry.width = pDrawable->width, -- .geometry.height = pDrawable->height -+ .geometry.x = x, -+ .geometry.y = y, -+ .geometry.width = w, -+ .geometry.height = h - }; - if (pBoxes) { - for (i = 0; i < nBoxes; i++) { -@@ -72,15 +118,12 @@ DamageExtNotify(DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) - else { - ev.area.x = 0; - ev.area.y = 0; -- ev.area.width = pDrawable->width; -- ev.area.height = pDrawable->height; -+ ev.area.width = w; -+ ev.area.height = h; - WriteEventsToClient(pClient, 1, (xEvent *) &ev); - } -- /* Composite extension marks clients with manual Subwindows as critical */ -- if (pDamageClient->critical > 0) { -- SetCriticalOutputPending(); -- pClient->smart_priority = SMART_MAX_PRIORITY; -- } -+ -+ DamageNoteCritical(pClient); - } - - static void -@@ -162,19 +205,55 @@ ProcDamageQueryVersion(ClientPtr client) - return Success; - } - -+static DamageExtPtr -+DamageExtCreate(DrawablePtr pDrawable, DamageReportLevel level, -+ ClientPtr client, XID id, XID drawable, XID report_id, -+ DamageReportFunc reportFunc) -+{ -+ DamageExtPtr pDamageExt = malloc(sizeof(DamageExtRec)); -+ if (!pDamageExt) -+ return NULL; -+ -+ pDamageExt->id = id; -+ pDamageExt->report_id = report_id; -+ pDamageExt->drawable = drawable; -+ pDamageExt->pDrawable = pDrawable; -+ pDamageExt->level = level; -+ pDamageExt->pClient = client; -+ pDamageExt->pDamage = DamageCreate(reportFunc, DamageExtDestroy, level, -+ FALSE, pDrawable->pScreen, pDamageExt); -+ if (!pDamageExt->pDamage) { -+ free(pDamageExt); -+ return NULL; -+ } -+ -+ if (!AddResource(id, DamageExtType, (pointer) pDamageExt)) -+ return NULL; -+ -+ DamageSetReportAfterOp(pDamageExt->pDamage, TRUE); -+ DamageRegister(pDrawable, pDamageExt->pDamage); -+ -+ if (pDrawable->type == DRAWABLE_WINDOW) { -+ RegionPtr pRegion = &((WindowPtr) pDrawable)->borderClip; -+ RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y); -+ DamageReportDamage(pDamageExt->pDamage, pRegion); -+ RegionTranslate(pRegion, pDrawable->x, pDrawable->y); -+ } -+ -+ return pDamageExt; -+} -+ - static int --ProcDamageCreate(ClientPtr client) -+doDamageCreate(ClientPtr client, XID reportDrawable, XID reportDamage, -+ DamageReportFunc reportFunc) - { - DrawablePtr pDrawable; - DamageExtPtr pDamageExt; - DamageReportLevel level; -- RegionPtr pRegion; - int rc; - - REQUEST(xDamageCreateReq); - -- REQUEST_SIZE_MATCH(xDamageCreateReq); -- LEGAL_NEW_RESOURCE(stuff->damage, client); - rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, - DixGetAttrAccess | DixReadAccess); - if (rc != Success) -@@ -198,39 +277,25 @@ ProcDamageCreate(ClientPtr client) - return BadValue; - } - -- pDamageExt = malloc(sizeof(DamageExtRec)); -+ pDamageExt = DamageExtCreate(pDrawable, level, client, stuff->damage, -+ reportDrawable, reportDamage, reportFunc); - if (!pDamageExt) - return BadAlloc; -- pDamageExt->id = stuff->damage; -- pDamageExt->drawable = stuff->drawable; -- pDamageExt->pDrawable = pDrawable; -- pDamageExt->level = level; -- pDamageExt->pClient = client; -- pDamageExt->pDamage = DamageCreate(DamageExtReport, -- DamageExtDestroy, -- level, -- FALSE, pDrawable->pScreen, pDamageExt); -- if (!pDamageExt->pDamage) { -- free(pDamageExt); -- return BadAlloc; -- } -- if (!AddResource(stuff->damage, DamageExtType, (pointer) pDamageExt)) -- return BadAlloc; -- -- DamageSetReportAfterOp(pDamageExt->pDamage, TRUE); -- DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage); -- -- if (pDrawable->type == DRAWABLE_WINDOW) { -- pRegion = &((WindowPtr) pDrawable)->borderClip; -- RegionTranslate(pRegion, -pDrawable->x, -pDrawable->y); -- DamageReportDamage(pDamageExt->pDamage, pRegion); -- RegionTranslate(pRegion, pDrawable->x, pDrawable->y); -- } - - return Success; - } - - static int -+ProcDamageCreate(ClientPtr client) -+{ -+ REQUEST(xDamageCreateReq); -+ REQUEST_SIZE_MATCH(xDamageCreateReq); -+ LEGAL_NEW_RESOURCE(stuff->damage, client); -+ return doDamageCreate(client, stuff->drawable, stuff->damage, -+ DamageExtReport); -+} -+ -+static int - ProcDamageDestroy(ClientPtr client) - { - REQUEST(xDamageDestroyReq); -@@ -242,6 +307,88 @@ ProcDamageDestroy(ClientPtr client) - return Success; - } - -+#ifdef PANORAMIX -+static RegionPtr -+DamageExtSubtractWindowClip(DamageExtPtr pDamageExt) -+{ -+ WindowPtr win = (WindowPtr)pDamageExt->pDrawable; -+ PanoramiXRes *res = NULL; -+ RegionPtr ret; -+ int i; -+ -+ if (!win->parent) -+ return &PanoramiXScreenRegion; -+ -+ dixLookupResourceByType((void **)&res, win->drawable.id, XRT_WINDOW, -+ serverClient, DixReadAccess); -+ if (!res) -+ return NULL; -+ -+ ret = RegionCreate(NULL, 0); -+ if (!ret) -+ return NULL; -+ -+ FOR_NSCREENS_FORWARD(i) { -+ ScreenPtr screen; -+ if (Success != dixLookupWindow(&win, res->info[i].id, serverClient, -+ DixReadAccess)) -+ goto out; -+ -+ screen = win->drawable.pScreen; -+ -+ RegionTranslate(ret, -screen->x, -screen->y); -+ if (!RegionUnion(ret, ret, &win->borderClip)) -+ goto out; -+ RegionTranslate(ret, screen->x, screen->y); -+ } -+ -+ return ret; -+ -+out: -+ RegionDestroy(ret); -+ return NULL; -+} -+ -+static void -+DamageExtFreeWindowClip(RegionPtr reg) -+{ -+ if (reg != &PanoramiXScreenRegion) -+ RegionDestroy(reg); -+} -+#endif -+ -+/* -+ * DamageSubtract intersects with borderClip, so we must reconstruct the -+ * protocol's perspective of same... -+ */ -+static Bool -+DamageExtSubtract(DamageExtPtr pDamageExt, const RegionPtr pRegion) -+{ -+ DamagePtr pDamage = pDamageExt->pDamage; -+ -+#ifdef PANORAMIX -+ if (!noPanoramiXExtension) { -+ RegionPtr damage = DamageRegion(pDamage); -+ RegionSubtract(damage, damage, pRegion); -+ -+ if (pDamageExt->pDrawable->type == DRAWABLE_WINDOW) { -+ DrawablePtr pDraw = pDamageExt->pDrawable; -+ RegionPtr clip = DamageExtSubtractWindowClip(pDamageExt); -+ if (clip) { -+ RegionTranslate(clip, -pDraw->x, -pDraw->y); -+ RegionIntersect(damage, damage, clip); -+ RegionTranslate(clip, pDraw->x, pDraw->y); -+ DamageExtFreeWindowClip(clip); -+ } -+ } -+ -+ return RegionNotEmpty(damage); -+ } -+#endif -+ -+ return DamageSubtract(pDamage, pRegion); -+} -+ - static int - ProcDamageSubtract(ClientPtr client) - { -@@ -261,7 +408,7 @@ ProcDamageSubtract(ClientPtr client) - if (pRepair) { - if (pParts) - RegionIntersect(pParts, DamageRegion(pDamage), pRepair); -- if (DamageSubtract(pDamage, pRepair)) -+ if (DamageExtSubtract(pDamageExt, pRepair)) - DamageExtReport(pDamage, DamageRegion(pDamage), - (void *) pDamageExt); - } -@@ -271,6 +418,7 @@ ProcDamageSubtract(ClientPtr client) - DamageEmpty(pDamage); - } - } -+ - return Success; - } - -@@ -460,6 +608,188 @@ SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to) - cpswaps(from->geometry.height, to->geometry.height); - } - -+#ifdef PANORAMIX -+ -+static void -+damageDispatchCallback(CallbackListPtr *cbl, void *closure, void *unused) -+{ -+ DamageExtPtr pDamageExt = closure; -+ RegionPtr pRegion = DamageRegion(pDamageExt->pDamage); -+ PanoramiXRes *damage = NULL; -+ -+ DamageExtReport(pDamageExt->pDamage, pRegion, pDamageExt); -+ DeleteCallback(&PostDispatchCallback, damageDispatchCallback, pDamageExt); -+ -+ dixLookupResourceByType((void **)&damage, pDamageExt->id, XRT_DAMAGE, -+ serverClient, DixWriteAccess); -+ -+ if (damage) -+ damage->u.damage.queued = FALSE; -+} -+ -+/* for screen 0 */ -+static void -+PanoramiXDamageQueue(DamagePtr pDamage, RegionPtr pRegion, void *closure) -+{ -+ DamageExtPtr pDamageExt = closure; -+ PanoramiXRes *damage = NULL; -+ -+ /* happens on unmap? sigh xinerama */ -+ if (RegionNil(pRegion)) -+ return; -+ -+ dixLookupResourceByType((void **)&damage, pDamageExt->report_id, XRT_DAMAGE, -+ serverClient, DixWriteAccess); -+ -+ if (damage) { -+ if (!damage->u.damage.queued) { -+ AddCallback(&PostDispatchCallback, damageDispatchCallback, -+ pDamageExt); -+ damage->u.damage.queued = TRUE; -+ } -+ } -+ -+ DamageNoteCritical(pDamageExt->pClient); -+} -+ -+/* for screens 1 to n */ -+static void -+PanoramiXDamageAccumulate(DamagePtr pDamage, RegionPtr pRegion, void *closure) -+{ -+ DamageExtPtr pDamageExt = closure, pDamageExt0 = NULL; -+ PanoramiXRes *damage = NULL; -+ -+ /* happens on unmap? sigh xinerama */ -+ if (RegionNil(pRegion)) -+ return; -+ -+ dixLookupResourceByType((void **)&damage, pDamageExt->report_id, XRT_DAMAGE, -+ serverClient, DixWriteAccess); -+ -+ if (damage) { -+ dixLookupResourceByType((void **)&pDamageExt0, damage->info[0].id, -+ DamageExtType, serverClient, DixWriteAccess); -+ -+ if (pDamageExt0) { -+ DrawablePtr pDrawable = pDamageExt->pDrawable; -+ ScreenPtr pScreen = pDrawable->pScreen; -+ -+ if (pDrawable->type == DRAWABLE_WINDOW) { -+ WindowPtr pWin = (WindowPtr)pDrawable; -+ -+ if (!pWin->parent) -+ if (RegionNotEmpty(pRegion)) -+ RegionTranslate(pRegion, pScreen->x, pScreen->y); -+ } -+ -+ DamageReportDamage(pDamageExt0->pDamage, pRegion); -+ DamageEmpty(pDamageExt->pDamage); -+ } -+ } -+} -+ -+static int -+PanoramiXDamageCreate(ClientPtr client) -+{ -+ PanoramiXRes *draw, *damage; -+ int i, rc; -+ -+ REQUEST(xDamageCreateReq); -+ -+ REQUEST_SIZE_MATCH(xDamageCreateReq); -+ LEGAL_NEW_RESOURCE(stuff->damage, client); -+ rc = dixLookupResourceByClass((void **)&draw, stuff->drawable, XRC_DRAWABLE, -+ client, DixGetAttrAccess | DixReadAccess); -+ if (rc != Success) -+ return rc; -+ -+ if (!(damage = calloc(1, sizeof(PanoramiXRes)))) -+ return BadAlloc; -+ -+ damage->type = XRT_DAMAGE; -+ if (!AddResource(stuff->damage, XRT_DAMAGE, damage)) -+ return BadAlloc; -+ -+ /* pixmaps exist on all screens, so just watching screen 0 works */ -+ if (draw->type == XRT_PIXMAP) { -+ damage->info[0].id = stuff->damage; -+ -+ rc = PanoramiXSaveDamageVector[X_DamageCreate](client); -+ if (rc != Success) { -+ FreeResource(damage->info[0].id, None); -+ return rc; -+ } -+ } else { -+ rc = doDamageCreate(client, stuff->drawable, stuff->damage, -+ PanoramiXDamageQueue); -+ if (rc == Success) { -+ panoramix_setup_ids(damage, client, stuff->damage); -+ -+ FOR_NSCREENS_FORWARD_SKIP(i) { -+ stuff->damage = damage->info[i].id; -+ stuff->drawable = draw->info[i].id; -+ rc = doDamageCreate(client, draw->info[0].id, -+ damage->info[0].id, -+ PanoramiXDamageAccumulate); -+ if (rc != Success) -+ FreeResource(damage->info[0].id, None); -+ } -+ } else { -+ FreeResource(damage->info[0].id, None); -+ } -+ } -+ -+ return rc; -+} -+ -+static int -+PanoramiXDamageDestroy(ClientPtr client) -+{ -+ REQUEST(xDamageDestroyReq); -+ PanoramiXRes *damage; -+ int i, rc = Success; -+ -+ REQUEST_SIZE_MATCH(xDamageDestroyReq); -+ -+ rc = dixLookupResourceByType((void **)&damage, stuff->damage, XRT_DAMAGE, -+ client, DixDestroyAccess); -+ if (rc != Success) -+ return rc; -+ -+ FOR_NSCREENS_BACKWARD(i) { -+ stuff->damage = damage->info[i].id; -+ if (stuff->damage) { -+ rc = PanoramiXSaveDamageVector[X_DamageDestroy](client); -+ if (rc != Success) -+ break; -+ } -+ } -+ -+ return rc; -+} -+ -+void -+PanoramiXDamageInit(void) -+{ -+ XRT_DAMAGE = CreateNewResourceType(XineramaDeleteResource, -+ "XineramaDamage"); -+ -+ memcpy(PanoramiXSaveDamageVector, ProcDamageVector, -+ sizeof(ProcDamageVector)); -+ -+ ProcDamageVector[X_DamageCreate] = PanoramiXDamageCreate; -+ ProcDamageVector[X_DamageDestroy] = PanoramiXDamageDestroy; -+} -+ -+void -+PanoramiXDamageReset(void) -+{ -+ memcpy(ProcDamageVector, PanoramiXSaveDamageVector, -+ sizeof(ProcDamageVector)); -+} -+ -+#endif /* PANORAMIX */ -+ - void - DamageExtensionInit(void) - { -@@ -490,5 +820,10 @@ DamageExtensionInit(void) - (EventSwapPtr) SDamageNotifyEvent; - SetResourceTypeErrorValue(DamageExtType, - extEntry->errorBase + BadDamage); -+#ifdef PANORAMIX -+ if (XRT_DAMAGE) -+ SetResourceTypeErrorValue(XRT_DAMAGE, -+ extEntry->errorBase + BadDamage); -+#endif - } - } -diff --git a/damageext/damageextint.h b/damageext/damageextint.h -index 2723379..7319a1d 100644 ---- a/damageext/damageextint.h -+++ b/damageext/damageextint.h -@@ -54,6 +54,7 @@ typedef struct _DamageExt { - DamageReportLevel level; - ClientPtr pClient; - XID id; -+ XID report_id; - XID drawable; - } DamageExtRec, *DamageExtPtr; - -@@ -67,4 +68,7 @@ typedef struct _DamageExt { - void - DamageExtSetCritical(ClientPtr pClient, Bool critical); - -+void PanoramiXDamageInit(void); -+void PanoramiXDamageReset(void); -+ - #endif /* _DAMAGEEXTINT_H_ */ --- -1.8.3.1 - diff --git a/SOURCES/0003-os-Actually-use-the-computed-clockid-in-GetTimeInMic.patch b/SOURCES/0003-os-Actually-use-the-computed-clockid-in-GetTimeInMic.patch deleted file mode 100644 index d7236b2..0000000 --- a/SOURCES/0003-os-Actually-use-the-computed-clockid-in-GetTimeInMic.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 5f1e832694e57986c0185048a941b3af51b2f85f Mon Sep 17 00:00:00 2001 -From: Julien Cristau -Date: Tue, 5 Nov 2013 07:08:21 -0800 -Subject: [PATCH 3/5] os: Actually use the computed clockid in GetTimeInMicros - -The selection of which clock to use for this function was not actually -getting used when fetching the final clock value. - -Reported-by: Julien Cristau -Signed-off-by: Keith Packard ---- - os/utils.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/os/utils.c b/os/utils.c -index 995f62a..fb20da7 100644 ---- a/os/utils.c -+++ b/os/utils.c -@@ -480,7 +480,7 @@ GetTimeInMicros(void) - else - clockid = ~0L; - } -- if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) -+ if (clockid != ~0L && clock_gettime(clockid, &tp) == 0) - return (CARD64) tp.tv_sec * (CARD64)1000000 + tp.tv_nsec / 1000; - #endif - --- -1.8.3.1 - diff --git a/SOURCES/0003-xkb-Split-out-code-to-start-and-finish-xkbcomp.patch b/SOURCES/0003-xkb-Split-out-code-to-start-and-finish-xkbcomp.patch index f2ba3c3..77a8222 100644 --- a/SOURCES/0003-xkb-Split-out-code-to-start-and-finish-xkbcomp.patch +++ b/SOURCES/0003-xkb-Split-out-code-to-start-and-finish-xkbcomp.patch @@ -1,7 +1,7 @@ -From 04122fce2aac2185efc9a0e6d6e4363e73990658 Mon Sep 17 00:00:00 2001 +From 7d08561178ab9384791a944bdb5797cf2ea14e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 9 Apr 2013 17:11:03 -0400 -Subject: [PATCH 03/39] xkb: Split out code to start and finish xkbcomp +Subject: [PATCH 03/38] xkb: Split out code to start and finish xkbcomp Using the context struct from previous commit, we can now split out code to start xkbcomp and to finish and clean up after it. @@ -77,5 +77,5 @@ index 5da3a35..001ff46 100644 XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen) { -- -1.8.3.1 +1.8.4.2 diff --git a/SOURCES/0004-Link-with-xshmfence-reference-miSyncShmScreenInit-in.patch b/SOURCES/0004-Link-with-xshmfence-reference-miSyncShmScreenInit-in.patch deleted file mode 100644 index 9a05c99..0000000 --- a/SOURCES/0004-Link-with-xshmfence-reference-miSyncShmScreenInit-in.patch +++ /dev/null @@ -1,71 +0,0 @@ -From f348935e7d2c84a438aba08eee2f2c4e0dc77d20 Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Tue, 5 Nov 2013 18:37:12 -0800 -Subject: [PATCH 4/5] Link with xshmfence, reference miSyncShmScreenInit in - sdksyms - -This gets the server to link with xshmfence again, and also ensures -that the miSyncShm code is linked into the server with the reference -from sdksyms. - -Signed-off-by: Keith Packard ---- - configure.ac | 1 + - hw/xfree86/sdksyms.sh | 3 +++ - include/dix-config.h.in | 3 +++ - include/xorg-config.h.in | 3 +++ - 4 files changed, 10 insertions(+) - -diff --git a/configure.ac b/configure.ac -index a7515a3..feeae04 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1144,6 +1144,7 @@ AM_CONDITIONAL(XSHMFENCE, test "x$HAVE_XSHMFENCE" = xyes) - case x"$HAVE_XSHMFENCE" in - xyes) - AC_DEFINE(HAVE_XSHMFENCE, 1, [Have X Shared Memory Fence library]) -+ REQUIRED_LIBS="$REQUIRED_LIBS xshmfence" - ;; - esac - -diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh -index 7c9734c..d7f259d 100755 ---- a/hw/xfree86/sdksyms.sh -+++ b/hw/xfree86/sdksyms.sh -@@ -44,6 +44,9 @@ cat > sdksyms.c << EOF - /* miext/sync/Makefile.am */ - #include "misync.h" - #include "misyncstr.h" -+#if HAVE_XSHMFENCE -+#include "misyncshm.h" -+#endif - - /* Xext/Makefile.am -- half is module, half is builtin */ - #ifdef XV -diff --git a/include/dix-config.h.in b/include/dix-config.h.in -index 397ee96..156383b 100644 ---- a/include/dix-config.h.in -+++ b/include/dix-config.h.in -@@ -449,4 +449,7 @@ - #include "dix-config-apple-verbatim.h" - #endif - -+/* Have support for X shared memory fence library (xshmfence) */ -+#undef HAVE_XSHMFENCE -+ - #endif /* _DIX_CONFIG_H_ */ -diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in -index 487d7ad..e3444da 100644 ---- a/include/xorg-config.h.in -+++ b/include/xorg-config.h.in -@@ -145,4 +145,7 @@ - /* Support APM/ACPI power management in the server */ - #undef XF86PM - -+/* Have support for X shared memory fence library (xshmfence) */ -+#undef HAVE_XSHMFENCE -+ - #endif /* _XORG_CONFIG_H_ */ --- -1.8.3.1 - diff --git a/SOURCES/0004-composite-Fix-COW-creation-for-Xinerama.patch b/SOURCES/0004-composite-Fix-COW-creation-for-Xinerama.patch deleted file mode 100644 index fa492d3..0000000 --- a/SOURCES/0004-composite-Fix-COW-creation-for-Xinerama.patch +++ /dev/null @@ -1,35 +0,0 @@ -From cb020861deb8bfa91579de72f3860c445ed752d3 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Thu, 7 Nov 2013 13:59:30 -0500 -Subject: [PATCH 4/6] composite: Fix COW creation for Xinerama - -Say you have two 800x600 screens left/right of each other. A window -that's 200x200 at +700+0 in protocol coordinate space will appear to be -at -100+0 in the coordinate space of the right hand screen. Put another -way: windows are in the coordinate space of their root window pixmap. - -We weren't doing this translation for the COW, so when rendering came in -to it you'd see the top-left chunk of the COW on all screens. Cool -effect and all, but wrong. - -Signed-off-by: Adam Jackson ---- - composite/compoverlay.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/composite/compoverlay.c b/composite/compoverlay.c -index d3cfaf0..575be42 100644 ---- a/composite/compoverlay.c -+++ b/composite/compoverlay.c -@@ -142,7 +142,7 @@ compCreateOverlayWindow(ScreenPtr pScreen) - #endif - - pWin = cs->pOverlayWin = -- CreateWindow(cs->overlayWid, pRoot, 0, 0, w, h, 0, -+ CreateWindow(cs->overlayWid, pRoot, -pScreen->x, -pScreen->y, w, h, 0, - InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0], - pRoot->drawable.depth, - serverClient, pScreen->rootVisual, &result); --- -1.8.3.1 - diff --git a/SOURCES/0004-xkb-Add-XkbCompileKeymapFromString.patch b/SOURCES/0004-xkb-Add-XkbCompileKeymapFromString.patch index 415ce35..0ac25f4 100644 --- a/SOURCES/0004-xkb-Add-XkbCompileKeymapFromString.patch +++ b/SOURCES/0004-xkb-Add-XkbCompileKeymapFromString.patch @@ -1,7 +1,7 @@ -From ae806ffa6b94bf75b9cb1b2db3e717fcaf13c8d0 Mon Sep 17 00:00:00 2001 +From 927e9c1b26b618a20d590062d346b9a53b120d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 9 Apr 2013 17:45:08 -0400 -Subject: [PATCH 04/39] xkb: Add XkbCompileKeymapFromString() +Subject: [PATCH 04/38] xkb: Add XkbCompileKeymapFromString() This new function compiles a keymap from an in-memory string. We use it to add a new keyooard device init function, @@ -17,7 +17,7 @@ Reviewed-by: Daniel Stone 4 files changed, 144 insertions(+), 39 deletions(-) diff --git a/include/input.h b/include/input.h -index 350daba..6573a3a 100644 +index 2d5e531..b1cc3ff 100644 --- a/include/input.h +++ b/include/input.h @@ -385,6 +385,12 @@ extern _X_EXPORT Bool InitKeyboardDeviceStruct(DeviceIntPtr /*device */ , @@ -315,5 +315,5 @@ index f72655f..f3f0d8f 100644 /* -- -1.8.3.1 +1.8.4.2 diff --git a/SOURCES/0005-Use-GL_LIBS-instead-of-lGL-for-linking.patch b/SOURCES/0005-Use-GL_LIBS-instead-of-lGL-for-linking.patch deleted file mode 100644 index 8dc3eb6..0000000 --- a/SOURCES/0005-Use-GL_LIBS-instead-of-lGL-for-linking.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 8fcf82cbf015609e00b3feb9bc567133c7aee5cf Mon Sep 17 00:00:00 2001 -From: Keith Packard -Date: Tue, 5 Nov 2013 18:39:11 -0800 -Subject: [PATCH 5/5] Use $GL_LIBS instead of -lGL for linking - --lGL presumes that the GL library is in the system path, while - $GL_LIBS is auto-detected. - -Signed-off-by: Keith Packard ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index feeae04..6925df8 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1075,7 +1075,7 @@ if test "x$GLX" = xyes; then - AC_SUBST(XLIB_CFLAGS) - AC_DEFINE(GLXEXT, 1, [Build GLX extension]) - GLX_LIBS='$(top_builddir)/glx/libglx.la' -- GLX_SYS_LIBS="$GLX_SYS_LIBS -lGL" -+ GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS" - else - GLX=no - fi --- -1.8.3.1 - diff --git a/SOURCES/0005-configure-Track-updated-version-of-libxtrans.patch b/SOURCES/0005-configure-Track-updated-version-of-libxtrans.patch deleted file mode 100644 index f6059f7..0000000 --- a/SOURCES/0005-configure-Track-updated-version-of-libxtrans.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 4346239a5d9d34761885009ba65a4e3231a45182 Mon Sep 17 00:00:00 2001 -From: Tiago Vignatti -Date: Thu, 22 Nov 2012 20:22:56 -0200 -Subject: [PATCH 05/39] configure: Track updated version of libxtrans - -XWayland fails to initialize in some systems complaining about realloc -problems on libxtrans (when ListenOnOpenFD() is called). It got fixed in -libxtrans version 1.2.7, more specifically: - - commit 6086f6c1d0e0a1c9e590879acb2319dea0eb6e96 - Author: Robert Bragg - Date: Mon Dec 12 00:30:43 2011 +0000 - -Reported-by: nerdopolis, Prf_Jakob, spitzak among others at #wayland channel -Signed-off-by: Tiago Vignatti ---- - configure.ac | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 6925df8..9fb014f 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -806,7 +806,7 @@ FIXESPROTO="fixesproto >= 5.0" - DAMAGEPROTO="damageproto >= 1.1" - XCMISCPROTO="xcmiscproto >= 1.2.0" - BIGREQSPROTO="bigreqsproto >= 1.1.0" --XTRANS="xtrans >= 1.2.2" -+XTRANS="xtrans >= 1.2.7" - PRESENTPROTO="presentproto >= 1.0" - - dnl List of libraries that require a specific version --- -1.8.3.1 - diff --git a/SOURCES/0005-fixes-Fix-PanoramiXSetPictureClipRegion-for-window-p.patch b/SOURCES/0005-fixes-Fix-PanoramiXSetPictureClipRegion-for-window-p.patch deleted file mode 100644 index 378b6ab..0000000 --- a/SOURCES/0005-fixes-Fix-PanoramiXSetPictureClipRegion-for-window-p.patch +++ /dev/null @@ -1,55 +0,0 @@ -From b355ac5f3ab8cea52ebb61271247cb1cded6f9bf Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Mon, 4 Nov 2013 17:49:33 -0500 -Subject: [PATCH 5/6] fixes: Fix PanoramiXSetPictureClipRegion for window - pictures - -Windows in Xinerama are in the coordinate space of their root window -pixmap, not in protocol space. This fixes 'xcompmgr -n' when Xinerama -is active. - -Signed-off-by: Adam Jackson ---- - xfixes/region.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/xfixes/region.c b/xfixes/region.c -index 0e9ca44..eb4a082 100644 ---- a/xfixes/region.c -+++ b/xfixes/region.c -@@ -886,6 +886,8 @@ PanoramiXFixesSetPictureClipRegion(ClientPtr client) - REQUEST(xXFixesSetPictureClipRegionReq); - int result = Success, j; - PanoramiXRes *pict; -+ PicturePtr pPicture; -+ RegionPtr reg = NULL; - - REQUEST_SIZE_MATCH(xXFixesSetPictureClipRegionReq); - -@@ -896,10 +898,23 @@ PanoramiXFixesSetPictureClipRegion(ClientPtr client) - return result; - } - -+ VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess); -+ if (pPicture->pDrawable && pPicture->pDrawable->type == DRAWABLE_WINDOW) -+ VERIFY_REGION_OR_NONE(reg, stuff->region, client, DixReadAccess); -+ - FOR_NSCREENS_BACKWARD(j) { -+ ScreenPtr screen = screenInfo.screens[j]; - stuff->picture = pict->info[j].id; -+ -+ if (reg) -+ RegionTranslate(reg, -screen->x, -screen->y); -+ - result = - (*PanoramiXSaveXFixesVector[X_XFixesSetPictureClipRegion]) (client); -+ -+ if (reg) -+ RegionTranslate(reg, screen->x, screen->y); -+ - if (result != Success) - break; - } --- -1.8.3.1 - diff --git a/SOURCES/0005-os-Add-a-function-to-create-a-client-for-an-fd.patch b/SOURCES/0005-os-Add-a-function-to-create-a-client-for-an-fd.patch new file mode 100644 index 0000000..224d923 --- /dev/null +++ b/SOURCES/0005-os-Add-a-function-to-create-a-client-for-an-fd.patch @@ -0,0 +1,137 @@ +From efa65f0bd25889d34b690b91839a0b36d5864b39 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Tue, 21 Jun 2011 21:28:31 -0400 +Subject: [PATCH 05/38] os: Add a function to create a client for an fd + +--- + include/opaque.h | 1 + + include/os.h | 5 +++-- + os/connection.c | 32 +++++++++++++++++++++++++++++--- + os/utils.c | 6 +++++- + 4 files changed, 38 insertions(+), 6 deletions(-) + +diff --git a/include/opaque.h b/include/opaque.h +index b76ab6e..8ad9af0 100644 +--- a/include/opaque.h ++++ b/include/opaque.h +@@ -74,5 +74,6 @@ extern _X_EXPORT Bool whiteRoot; + extern _X_EXPORT Bool bgNoneRoot; + + extern _X_EXPORT Bool CoreDump; ++extern _X_EXPORT Bool NoListenAll; + + #endif /* OPAQUE_H */ +diff --git a/include/os.h b/include/os.h +index 9b67294..c36d09a 100644 +--- a/include/os.h ++++ b/include/os.h +@@ -166,8 +166,9 @@ extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ ); + + extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ ); + +-#ifdef XQUARTZ +-extern void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); ++#if defined(XQUARTZ) || defined(XORG_WAYLAND) ++extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); ++extern _X_EXPORT void AddClientOnOpenFD(int /* fd */ ); + #endif + + extern _X_EXPORT CARD32 GetTimeInMillis(void); +diff --git a/os/connection.c b/os/connection.c +index 162e1d9..a95e7da 100644 +--- a/os/connection.c ++++ b/os/connection.c +@@ -64,6 +64,7 @@ SOFTWARE. + #include + #endif + ++#include + #ifdef WIN32 + #include + #endif +@@ -138,6 +139,7 @@ fd_set OutputPending; /* clients with reply/event data ready to go */ + int MaxClients = 0; + Bool NewOutputPending; /* not yet attempted to write some new output */ + Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ ++Bool NoListenAll; /* Don't establish any listening sockets */ + + static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ + Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or +@@ -406,7 +408,10 @@ CreateWellKnownSockets(void) + /* display is initialized to "0" by main(). It is then set to the display + * number if specified on the command line, or to NULL when the -displayfd + * option is used. */ +- if (display) { ++ if (NoListenAll) { ++ ListenTransCount = 0; ++ } ++ else if (display) { + if (TryCreateSocket(atoi(display), &partial) && + ListenTransCount >= 1) + if (!PartialNetwork && partial) +@@ -440,9 +445,10 @@ CreateWellKnownSockets(void) + DefineSelf (fd); + } + +- if (!XFD_ANYSET(&WellKnownConnections)) ++ if (!XFD_ANYSET(&WellKnownConnections) && !NoListenAll) + FatalError + ("Cannot establish any listening sockets - Make sure an X server isn't already running"); ++ + #if !defined(WIN32) + OsSignal(SIGPIPE, SIG_IGN); + OsSignal(SIGHUP, AutoResetServer); +@@ -1253,7 +1259,7 @@ MakeClientGrabPervious(ClientPtr client) + } + } + +-#ifdef XQUARTZ ++#if defined(XQUARTZ) || defined(XORG_WAYLAND) + /* Add a fd (from launchd) to our listeners */ + void + ListenOnOpenFD(int fd, int noxauth) +@@ -1309,4 +1315,24 @@ ListenOnOpenFD(int fd, int noxauth) + #endif + } + ++/* based on TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) */ ++void ++AddClientOnOpenFD(int fd) ++{ ++ XtransConnInfo ciptr; ++ CARD32 connect_time; ++ ++ ciptr = _XSERVTransReopenCOTSServer(5, fd, "@anonymous"); ++ ++ _XSERVTransSetOption(ciptr, TRANS_NONBLOCKING, 1); ++ ciptr->flags |= TRANS_NOXAUTH; ++ ++ connect_time = GetTimeInMillis(); ++ ++ if (!AllocNewConnection(ciptr, fd, connect_time)) { ++ fprintf(stderr, "failed to create client for wayland server\n"); ++ return; ++ } ++} ++ + #endif +diff --git a/os/utils.c b/os/utils.c +index 608ee6a..a0cf951 100644 +--- a/os/utils.c ++++ b/os/utils.c +@@ -805,7 +805,11 @@ ProcessCommandLine(int argc, char *argv[]) + #endif + else if (strcmp(argv[i], "-nolisten") == 0) { + if (++i < argc) { +- if (_XSERVTransNoListen(argv[i])) ++ if (strcmp(argv[i], "all") == 0) { ++ NoListenAll = TRUE; ++ nolock = TRUE; ++ } ++ else if (_XSERVTransNoListen(argv[i])) + ErrorF("Failed to disable listen for %s transport", + argv[i]); + } +-- +1.8.4.2 + diff --git a/SOURCES/0006-Export-xf86NewInputDevice-and-xf86AllocateInput.patch b/SOURCES/0006-Export-xf86NewInputDevice-and-xf86AllocateInput.patch new file mode 100644 index 0000000..79e3c91 --- /dev/null +++ b/SOURCES/0006-Export-xf86NewInputDevice-and-xf86AllocateInput.patch @@ -0,0 +1,44 @@ +From f5767856b6dc214a7beb7c1f914a2e491da3f0c7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Thu, 21 Jul 2011 09:55:46 -0700 +Subject: [PATCH 06/38] Export xf86NewInputDevice and xf86AllocateInput + +--- + hw/xfree86/common/xf86Xinput.c | 2 +- + hw/xfree86/common/xf86Xinput.h | 7 +++---- + 2 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c +index 26c03c6..7669ee0 100644 +--- a/hw/xfree86/common/xf86Xinput.c ++++ b/hw/xfree86/common/xf86Xinput.c +@@ -811,7 +811,7 @@ xf86InputDevicePostInit(DeviceIntPtr dev) + * + * @return Success or an error code + */ +-_X_INTERNAL int ++int + xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) + { + InputDriverPtr drv = NULL; +diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h +index 35c38a5..ff3d894 100644 +--- a/hw/xfree86/common/xf86Xinput.h ++++ b/hw/xfree86/common/xf86Xinput.h +@@ -172,10 +172,9 @@ extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo); + extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo); + extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic); + extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev); +- +-/* not exported */ +-int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto); +-InputInfoPtr xf86AllocateInput(void); ++extern _X_EXPORT int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, ++ BOOL is_auto); ++extern _X_EXPORT InputInfoPtr xf86AllocateInput(void); + + /* xf86Helper.c */ + extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, +-- +1.8.4.2 + diff --git a/SOURCES/0006-fixes-Fix-PanoramiXSetWindowShapeRegion.patch b/SOURCES/0006-fixes-Fix-PanoramiXSetWindowShapeRegion.patch deleted file mode 100644 index f7cf0d5..0000000 --- a/SOURCES/0006-fixes-Fix-PanoramiXSetWindowShapeRegion.patch +++ /dev/null @@ -1,50 +0,0 @@ -From ad2ba329d91157cd5ad09d871d0d5a74998d2518 Mon Sep 17 00:00:00 2001 -From: Adam Jackson -Date: Mon, 4 Nov 2013 17:49:34 -0500 -Subject: [PATCH 6/6] fixes: Fix PanoramiXSetWindowShapeRegion - -Windows in Xinerama are in the coordinate space of their root window -pixmap, not in protocol space. - -Signed-off-by: Adam Jackson ---- - xfixes/region.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/xfixes/region.c b/xfixes/region.c -index eb4a082..752cef1 100644 ---- a/xfixes/region.c -+++ b/xfixes/region.c -@@ -857,6 +857,7 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client) - { - int result = Success, j; - PanoramiXRes *win; -+ RegionPtr reg = NULL; - - REQUEST(xXFixesSetWindowShapeRegionReq); - -@@ -869,10 +870,21 @@ PanoramiXFixesSetWindowShapeRegion(ClientPtr client) - return result; - } - -+ VERIFY_REGION_OR_NONE(reg, stuff->region, client, DixReadAccess); -+ - FOR_NSCREENS_FORWARD(j) { -+ ScreenPtr screen = screenInfo.screens[j]; - stuff->dest = win->info[j].id; -+ -+ if (reg) -+ RegionTranslate(reg, -screen->x, -screen->y); -+ - result = - (*PanoramiXSaveXFixesVector[X_XFixesSetWindowShapeRegion]) (client); -+ -+ if (reg) -+ RegionTranslate(reg, screen->x, screen->y); -+ - if (result != Success) - break; - } --- -1.8.3.1 - diff --git a/SOURCES/0006-os-Add-a-function-to-create-a-client-for-an-fd.patch b/SOURCES/0006-os-Add-a-function-to-create-a-client-for-an-fd.patch deleted file mode 100644 index 102e217..0000000 --- a/SOURCES/0006-os-Add-a-function-to-create-a-client-for-an-fd.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 82eb27b4322bf392542381adf4aef1aae9fc7c37 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Tue, 21 Jun 2011 21:28:31 -0400 -Subject: [PATCH 06/39] os: Add a function to create a client for an fd - ---- - include/opaque.h | 1 + - include/os.h | 5 +++-- - os/connection.c | 32 +++++++++++++++++++++++++++++--- - os/utils.c | 6 +++++- - 4 files changed, 38 insertions(+), 6 deletions(-) - -diff --git a/include/opaque.h b/include/opaque.h -index b76ab6e..8ad9af0 100644 ---- a/include/opaque.h -+++ b/include/opaque.h -@@ -74,5 +74,6 @@ extern _X_EXPORT Bool whiteRoot; - extern _X_EXPORT Bool bgNoneRoot; - - extern _X_EXPORT Bool CoreDump; -+extern _X_EXPORT Bool NoListenAll; - - #endif /* OPAQUE_H */ -diff --git a/include/os.h b/include/os.h -index 11b2198..4d4a0d6 100644 ---- a/include/os.h -+++ b/include/os.h -@@ -164,8 +164,9 @@ extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ ); - - extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ ); - --#ifdef XQUARTZ --extern void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); -+#if defined(XQUARTZ) || defined(XORG_WAYLAND) -+extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); -+extern _X_EXPORT void AddClientOnOpenFD(int /* fd */ ); - #endif - - extern _X_EXPORT CARD32 GetTimeInMillis(void); -diff --git a/os/connection.c b/os/connection.c -index 162e1d9..a95e7da 100644 ---- a/os/connection.c -+++ b/os/connection.c -@@ -64,6 +64,7 @@ SOFTWARE. - #include - #endif - -+#include - #ifdef WIN32 - #include - #endif -@@ -138,6 +139,7 @@ fd_set OutputPending; /* clients with reply/event data ready to go */ - int MaxClients = 0; - Bool NewOutputPending; /* not yet attempted to write some new output */ - Bool AnyClientsWriteBlocked; /* true if some client blocked on write */ -+Bool NoListenAll; /* Don't establish any listening sockets */ - - static Bool RunFromSmartParent; /* send SIGUSR1 to parent process */ - Bool RunFromSigStopParent; /* send SIGSTOP to our own process; Upstart (or -@@ -406,7 +408,10 @@ CreateWellKnownSockets(void) - /* display is initialized to "0" by main(). It is then set to the display - * number if specified on the command line, or to NULL when the -displayfd - * option is used. */ -- if (display) { -+ if (NoListenAll) { -+ ListenTransCount = 0; -+ } -+ else if (display) { - if (TryCreateSocket(atoi(display), &partial) && - ListenTransCount >= 1) - if (!PartialNetwork && partial) -@@ -440,9 +445,10 @@ CreateWellKnownSockets(void) - DefineSelf (fd); - } - -- if (!XFD_ANYSET(&WellKnownConnections)) -+ if (!XFD_ANYSET(&WellKnownConnections) && !NoListenAll) - FatalError - ("Cannot establish any listening sockets - Make sure an X server isn't already running"); -+ - #if !defined(WIN32) - OsSignal(SIGPIPE, SIG_IGN); - OsSignal(SIGHUP, AutoResetServer); -@@ -1253,7 +1259,7 @@ MakeClientGrabPervious(ClientPtr client) - } - } - --#ifdef XQUARTZ -+#if defined(XQUARTZ) || defined(XORG_WAYLAND) - /* Add a fd (from launchd) to our listeners */ - void - ListenOnOpenFD(int fd, int noxauth) -@@ -1309,4 +1315,24 @@ ListenOnOpenFD(int fd, int noxauth) - #endif - } - -+/* based on TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) */ -+void -+AddClientOnOpenFD(int fd) -+{ -+ XtransConnInfo ciptr; -+ CARD32 connect_time; -+ -+ ciptr = _XSERVTransReopenCOTSServer(5, fd, "@anonymous"); -+ -+ _XSERVTransSetOption(ciptr, TRANS_NONBLOCKING, 1); -+ ciptr->flags |= TRANS_NOXAUTH; -+ -+ connect_time = GetTimeInMillis(); -+ -+ if (!AllocNewConnection(ciptr, fd, connect_time)) { -+ fprintf(stderr, "failed to create client for wayland server\n"); -+ return; -+ } -+} -+ - #endif -diff --git a/os/utils.c b/os/utils.c -index fb20da7..42aa13b 100644 ---- a/os/utils.c -+++ b/os/utils.c -@@ -805,7 +805,11 @@ ProcessCommandLine(int argc, char *argv[]) - #endif - else if (strcmp(argv[i], "-nolisten") == 0) { - if (++i < argc) { -- if (_XSERVTransNoListen(argv[i])) -+ if (strcmp(argv[i], "all") == 0) { -+ NoListenAll = TRUE; -+ nolock = TRUE; -+ } -+ else if (_XSERVTransNoListen(argv[i])) - ErrorF("Failed to disable listen for %s transport", - argv[i]); - } --- -1.8.3.1 - diff --git a/SOURCES/0007-Add-redirect-window-for-input-device-feature.patch b/SOURCES/0007-Add-redirect-window-for-input-device-feature.patch new file mode 100644 index 0000000..245f6a0 --- /dev/null +++ b/SOURCES/0007-Add-redirect-window-for-input-device-feature.patch @@ -0,0 +1,89 @@ +From 65f033e38116ed4ebf318a7521190536e8fc6b1c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Fri, 18 Sep 2009 22:09:03 -0400 +Subject: [PATCH 07/38] Add redirect window for input device feature + +--- + Xi/exevents.c | 13 +++++++++++++ + dix/events.c | 11 ++++++++++- + include/exevents.h | 4 ++++ + include/inputstr.h | 2 ++ + 4 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/Xi/exevents.c b/Xi/exevents.c +index 5dc9020..69b4038 100644 +--- a/Xi/exevents.c ++++ b/Xi/exevents.c +@@ -2025,6 +2025,19 @@ DeliverTouchEvents(DeviceIntPtr dev, TouchPointInfoPtr ti, + } + } + ++void ++SetDeviceRedirectWindow(DeviceIntPtr dev, WindowPtr window) ++{ ++ SpritePtr pSprite = dev->spriteInfo->sprite; ++ DeviceIntPtr mouse; ++ ++ mouse = IsMaster(dev) ? dev : GetMaster(dev, MASTER_POINTER); ++ ++ pSprite->redirectWindow = window; ++ ++ CheckMotion(NULL, mouse); ++} ++ + int + InitProximityClassDeviceStruct(DeviceIntPtr dev) + { +diff --git a/dix/events.c b/dix/events.c +index 4632bb7..9caa8b0 100644 +--- a/dix/events.c ++++ b/dix/events.c +@@ -2877,7 +2877,16 @@ XYToWindow(SpritePtr pSprite, int x, int y) + BoxRec box; + + pSprite->spriteTraceGood = 1; /* root window still there */ +- pWin = RootWindow(pSprite)->firstChild; ++ if (pSprite->redirectWindow == PointerRootWin) { ++ return RootWindow(pSprite); ++ } ++ else if (pSprite->redirectWindow) { ++ pWin = pSprite->redirectWindow; ++ pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin; ++ pWin = pWin->firstChild; ++ } ++ else ++ pWin = RootWindow(pSprite)->firstChild; + while (pWin) { + if ((pWin->mapped) && + (x >= pWin->drawable.x - wBorderWidth(pWin)) && +diff --git a/include/exevents.h b/include/exevents.h +index 321fc42..ba93be3 100644 +--- a/include/exevents.h ++++ b/include/exevents.h +@@ -162,6 +162,10 @@ extern void + ProcessOtherEvent(InternalEvent * /* ev */ , + DeviceIntPtr /* other */ ); + ++extern _X_EXPORT void ++ SetDeviceRedirectWindow(DeviceIntPtr /* dev */ , ++ WindowPtr /* window */ ); ++ + extern int + CheckGrabValues(ClientPtr /* client */ , + GrabParameters * /* param */ ); +diff --git a/include/inputstr.h b/include/inputstr.h +index dc36c5d..09471cf 100644 +--- a/include/inputstr.h ++++ b/include/inputstr.h +@@ -246,6 +246,8 @@ typedef struct _SpriteRec { + ScreenPtr pEnqueueScreen; + ScreenPtr pDequeueScreen; + ++ WindowPtr redirectWindow; ++ + } SpriteRec; + + typedef struct _KeyClassRec { +-- +1.8.4.2 + diff --git a/SOURCES/0007-Export-xf86NewInputDevice-and-xf86AllocateInput.patch b/SOURCES/0007-Export-xf86NewInputDevice-and-xf86AllocateInput.patch deleted file mode 100644 index 6029ace..0000000 --- a/SOURCES/0007-Export-xf86NewInputDevice-and-xf86AllocateInput.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c676298e955548887ce98024c0a28456a8b21cb4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Thu, 21 Jul 2011 09:55:46 -0700 -Subject: [PATCH 07/39] Export xf86NewInputDevice and xf86AllocateInput - ---- - hw/xfree86/common/xf86Xinput.c | 2 +- - hw/xfree86/common/xf86Xinput.h | 7 +++---- - 2 files changed, 4 insertions(+), 5 deletions(-) - -diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c -index 26c03c6..7669ee0 100644 ---- a/hw/xfree86/common/xf86Xinput.c -+++ b/hw/xfree86/common/xf86Xinput.c -@@ -811,7 +811,7 @@ xf86InputDevicePostInit(DeviceIntPtr dev) - * - * @return Success or an error code - */ --_X_INTERNAL int -+int - xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) - { - InputDriverPtr drv = NULL; -diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h -index 35c38a5..ff3d894 100644 ---- a/hw/xfree86/common/xf86Xinput.h -+++ b/hw/xfree86/common/xf86Xinput.h -@@ -172,10 +172,9 @@ extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo); - extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo); - extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic); - extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev); -- --/* not exported */ --int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto); --InputInfoPtr xf86AllocateInput(void); -+extern _X_EXPORT int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, -+ BOOL is_auto); -+extern _X_EXPORT InputInfoPtr xf86AllocateInput(void); - - /* xf86Helper.c */ - extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, pointer module, --- -1.8.3.1 - diff --git a/SOURCES/0008-Export-CompositeRedirectSubwindows-and-CompositeUnRe.patch b/SOURCES/0008-Export-CompositeRedirectSubwindows-and-CompositeUnRe.patch deleted file mode 100644 index bb613bd..0000000 --- a/SOURCES/0008-Export-CompositeRedirectSubwindows-and-CompositeUnRe.patch +++ /dev/null @@ -1,65 +0,0 @@ -From b91512c03726e442854813af60b1e399492f346c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 18 Sep 2009 22:02:43 -0400 -Subject: [PATCH 08/39] Export CompositeRedirectSubwindows and - CompositeUnRedirectSubwindows - ---- - composite/compalloc.c | 11 +++++++++++ - composite/compositeext.h | 4 ++++ - 2 files changed, 15 insertions(+) - -diff --git a/composite/compalloc.c b/composite/compalloc.c -index b7d731e..98b27b1 100644 ---- a/composite/compalloc.c -+++ b/composite/compalloc.c -@@ -46,6 +46,7 @@ - #endif - - #include "compint.h" -+#include "compositeext.h" - - static void - compScreenUpdate(ScreenPtr pScreen) -@@ -411,6 +412,11 @@ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update) - return Success; - } - -+int CompositeRedirectSubwindows (WindowPtr pWin, int update) -+{ -+ return compRedirectSubwindows (serverClient, pWin, update); -+} -+ - /* - * Free one of the per-client per-subwindows resources, - * which frees one redirect per subwindow -@@ -482,6 +488,11 @@ compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update) - return BadValue; - } - -+int CompositeUnRedirectSubwindows (WindowPtr pWin, int update) -+{ -+ return compUnredirectSubwindows (serverClient, pWin, update); -+} -+ - /* - * Add redirection information for one subwindow (during reparent) - */ -diff --git a/composite/compositeext.h b/composite/compositeext.h -index 0b148f0..a072966 100644 ---- a/composite/compositeext.h -+++ b/composite/compositeext.h -@@ -34,6 +34,10 @@ - extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen, - VisualID * vids, - int nVisuals); -+extern _X_EXPORT int CompositeRedirectSubwindows(WindowPtr pWin, -+ int update); -+extern _X_EXPORT int CompositeUnRedirectSubwindows (WindowPtr pWin, -+ int update); - - extern _X_EXPORT RESTYPE CompositeClientWindowType; - --- -1.8.3.1 - diff --git a/SOURCES/0008-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch b/SOURCES/0008-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch new file mode 100644 index 0000000..fe860d7 --- /dev/null +++ b/SOURCES/0008-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch @@ -0,0 +1,144 @@ +From 39fddd5e087ee7681e7a26182dd7398dd64bc43f Mon Sep 17 00:00:00 2001 +From: Tiago Vignatti +Date: Wed, 21 Aug 2013 21:23:09 -0700 +Subject: [PATCH 08/38] dri2: Introduce a third version of the AuthMagic + function + +This most recent version takes a client pointer to allow xwayland to +asynchronously authenticate a client. +--- + hw/xfree86/dri2/dri2.c | 12 ++++++++---- + hw/xfree86/dri2/dri2.h | 7 +++++++ + hw/xfree86/dri2/dri2ext.c | 27 +++++++++++++++++++-------- + 3 files changed, 34 insertions(+), 12 deletions(-) + +diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c +index 0b047f0..efdcd66 100644 +--- a/hw/xfree86/dri2/dri2.c ++++ b/hw/xfree86/dri2/dri2.c +@@ -121,8 +121,9 @@ typedef struct _DRI2Screen { + DRI2ScheduleSwapProcPtr ScheduleSwap; + DRI2GetMSCProcPtr GetMSC; + DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; +- DRI2AuthMagic2ProcPtr AuthMagic; + DRI2AuthMagicProcPtr LegacyAuthMagic; ++ DRI2AuthMagic2ProcPtr LegacyAuthMagic2; ++ DRI2AuthMagic3ProcPtr AuthMagic; + DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; + DRI2SwapLimitValidateProcPtr SwapLimitValidate; + DRI2GetParamProcPtr GetParam; +@@ -1352,7 +1353,7 @@ DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic) + return FALSE; + + primescreen = GetScreenPrime(pScreen, dri2_client->prime_id); +- if ((*ds->AuthMagic)(primescreen, magic)) ++ if ((*ds->AuthMagic)(client, primescreen, magic)) + return FALSE; + return TRUE; + } +@@ -1457,8 +1458,11 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) + cur_minor = 1; + } + ++ if (info->version >= 10) { ++ ds->AuthMagic = info->AuthMagic3; ++ } + if (info->version >= 8) { +- ds->AuthMagic = info->AuthMagic2; ++ ds->LegacyAuthMagic2 = info->AuthMagic2; + } + if (info->version >= 5) { + ds->LegacyAuthMagic = info->AuthMagic; +@@ -1497,7 +1501,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) + * If the driver doesn't provide an AuthMagic function + * it relies on the old method (using libdrm) or fails + */ +- if (!ds->LegacyAuthMagic) ++ if (!ds->LegacyAuthMagic2 && !ds->LegacyAuthMagic) + #ifdef WITH_LIBDRM + ds->LegacyAuthMagic = drmAuthMagic; + #else +diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h +index 1e7afdd..38b4f58 100644 +--- a/hw/xfree86/dri2/dri2.h ++++ b/hw/xfree86/dri2/dri2.h +@@ -65,6 +65,8 @@ typedef void (*DRI2CopyRegionProcPtr) (DrawablePtr pDraw, + typedef void (*DRI2WaitProcPtr) (WindowPtr pWin, unsigned int sequence); + typedef int (*DRI2AuthMagicProcPtr) (int fd, uint32_t magic); + typedef int (*DRI2AuthMagic2ProcPtr) (ScreenPtr pScreen, uint32_t magic); ++typedef int (*DRI2AuthMagic3ProcPtr) (ClientPtr client, ++ ScreenPtr pScreen, uint32_t magic); + + /** + * Schedule a buffer swap +@@ -252,6 +254,9 @@ typedef struct { + DRI2CreateBuffer2ProcPtr CreateBuffer2; + DRI2DestroyBuffer2ProcPtr DestroyBuffer2; + DRI2CopyRegion2ProcPtr CopyRegion2; ++ ++ /* added in version 10 */ ++ DRI2AuthMagic3ProcPtr AuthMagic3; + } DRI2InfoRec, *DRI2InfoPtr; + + extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info); +@@ -268,6 +273,8 @@ extern _X_EXPORT Bool DRI2Connect(ClientPtr client, ScreenPtr pScreen, + + extern _X_EXPORT Bool DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic); + ++extern _X_EXPORT void DRI2SendAuthReply(ClientPtr client, Bool status); ++ + extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client, + DrawablePtr pDraw, + XID id, +diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c +index ffd66fa..b858213 100644 +--- a/hw/xfree86/dri2/dri2ext.c ++++ b/hw/xfree86/dri2/dri2ext.c +@@ -136,11 +136,23 @@ ProcDRI2Connect(ClientPtr client) + return Success; + } + ++void ++DRI2SendAuthReply(ClientPtr client, Bool status) ++{ ++ xDRI2AuthenticateReply rep = { ++ .type = X_Reply, ++ .sequenceNumber = client->sequence, ++ .length = 0, ++ .authenticated = status ++ }; ++ ++ WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep); ++} ++ + static int + ProcDRI2Authenticate(ClientPtr client) + { + REQUEST(xDRI2AuthenticateReq); +- xDRI2AuthenticateReply rep; + DrawablePtr pDraw; + int status; + +@@ -149,13 +161,12 @@ ProcDRI2Authenticate(ClientPtr client) + &pDraw, &status)) + return status; + +- rep = (xDRI2AuthenticateReply) { +- .type = X_Reply, +- .sequenceNumber = client->sequence, +- .length = 0, +- .authenticated = DRI2Authenticate(client, pDraw->pScreen, stuff->magic) +- }; +- WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep); ++ status = DRI2Authenticate(client, pDraw->pScreen, stuff->magic); ++ ++ /* if non-blocking authentication is in progress, then don't send a reply ++ * now but later in the implementation (e.g. drm_handle_authenticated) */ ++ if (client->ignoreCount == 0) ++ DRI2SendAuthReply(client, status); + + return Success; + } +-- +1.8.4.2 + diff --git a/SOURCES/0009-Add-redirect-window-for-input-device-feature.patch b/SOURCES/0009-Add-redirect-window-for-input-device-feature.patch deleted file mode 100644 index b06e1a3..0000000 --- a/SOURCES/0009-Add-redirect-window-for-input-device-feature.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 9702f1ac244758172c3f8edbfc26e99fe1d52fbe Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 18 Sep 2009 22:09:03 -0400 -Subject: [PATCH 09/39] Add redirect window for input device feature - ---- - Xi/exevents.c | 13 +++++++++++++ - dix/events.c | 11 ++++++++++- - include/exevents.h | 4 ++++ - include/inputstr.h | 2 ++ - 4 files changed, 29 insertions(+), 1 deletion(-) - -diff --git a/Xi/exevents.c b/Xi/exevents.c -index 5dc9020..69b4038 100644 ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -2025,6 +2025,19 @@ DeliverTouchEvents(DeviceIntPtr dev, TouchPointInfoPtr ti, - } - } - -+void -+SetDeviceRedirectWindow(DeviceIntPtr dev, WindowPtr window) -+{ -+ SpritePtr pSprite = dev->spriteInfo->sprite; -+ DeviceIntPtr mouse; -+ -+ mouse = IsMaster(dev) ? dev : GetMaster(dev, MASTER_POINTER); -+ -+ pSprite->redirectWindow = window; -+ -+ CheckMotion(NULL, mouse); -+} -+ - int - InitProximityClassDeviceStruct(DeviceIntPtr dev) - { -diff --git a/dix/events.c b/dix/events.c -index 4632bb7..9caa8b0 100644 ---- a/dix/events.c -+++ b/dix/events.c -@@ -2877,7 +2877,16 @@ XYToWindow(SpritePtr pSprite, int x, int y) - BoxRec box; - - pSprite->spriteTraceGood = 1; /* root window still there */ -- pWin = RootWindow(pSprite)->firstChild; -+ if (pSprite->redirectWindow == PointerRootWin) { -+ return RootWindow(pSprite); -+ } -+ else if (pSprite->redirectWindow) { -+ pWin = pSprite->redirectWindow; -+ pSprite->spriteTrace[pSprite->spriteTraceGood++] = pWin; -+ pWin = pWin->firstChild; -+ } -+ else -+ pWin = RootWindow(pSprite)->firstChild; - while (pWin) { - if ((pWin->mapped) && - (x >= pWin->drawable.x - wBorderWidth(pWin)) && -diff --git a/include/exevents.h b/include/exevents.h -index 321fc42..ba93be3 100644 ---- a/include/exevents.h -+++ b/include/exevents.h -@@ -162,6 +162,10 @@ extern void - ProcessOtherEvent(InternalEvent * /* ev */ , - DeviceIntPtr /* other */ ); - -+extern _X_EXPORT void -+ SetDeviceRedirectWindow(DeviceIntPtr /* dev */ , -+ WindowPtr /* window */ ); -+ - extern int - CheckGrabValues(ClientPtr /* client */ , - GrabParameters * /* param */ ); -diff --git a/include/inputstr.h b/include/inputstr.h -index dc36c5d..09471cf 100644 ---- a/include/inputstr.h -+++ b/include/inputstr.h -@@ -246,6 +246,8 @@ typedef struct _SpriteRec { - ScreenPtr pEnqueueScreen; - ScreenPtr pDequeueScreen; - -+ WindowPtr redirectWindow; -+ - } SpriteRec; - - typedef struct _KeyClassRec { --- -1.8.3.1 - diff --git a/SOURCES/0009-Add-xwayland-module.patch b/SOURCES/0009-Add-xwayland-module.patch new file mode 100644 index 0000000..e53a923 --- /dev/null +++ b/SOURCES/0009-Add-xwayland-module.patch @@ -0,0 +1,2896 @@ +From 010bee24b74e4ca0df6c69094b825d5232f85377 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Fri, 18 Sep 2009 22:08:16 -0400 +Subject: [PATCH 09/38] Add xwayland module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Squashed and rebased from the xwayland-1.12 branch. Contributions from + + Christopher James Halse Rogers + Corentin Chary + Daniel Stone + Kristian Høgsberg + Robert Bragg + Scott Moreau + Tiago Vignatti +--- + configure.ac | 13 +- + hw/xfree86/Makefile.am | 8 +- + hw/xfree86/common/xf86Config.c | 28 +- + hw/xfree86/common/xf86Globals.c | 2 + + hw/xfree86/common/xf86Init.c | 20 ++ + hw/xfree86/common/xf86Priv.h | 2 + + hw/xfree86/dri2/dri2.c | 7 +- + hw/xfree86/dri2/dri2.h | 2 +- + hw/xfree86/xwayland/Makefile.am | 44 +++ + hw/xfree86/xwayland/drm.xml | 139 ++++++++ + hw/xfree86/xwayland/xserver.xml | 18 + + hw/xfree86/xwayland/xwayland-cursor.c | 241 +++++++++++++ + hw/xfree86/xwayland/xwayland-drm.c | 235 +++++++++++++ + hw/xfree86/xwayland/xwayland-input.c | 610 +++++++++++++++++++++++++++++++++ + hw/xfree86/xwayland/xwayland-output.c | 309 +++++++++++++++++ + hw/xfree86/xwayland/xwayland-private.h | 132 +++++++ + hw/xfree86/xwayland/xwayland-window.c | 317 +++++++++++++++++ + hw/xfree86/xwayland/xwayland.c | 392 +++++++++++++++++++++ + hw/xfree86/xwayland/xwayland.h | 83 +++++ + include/xorg-server.h.in | 3 + + 20 files changed, 2595 insertions(+), 10 deletions(-) + create mode 100644 hw/xfree86/xwayland/Makefile.am + create mode 100644 hw/xfree86/xwayland/drm.xml + create mode 100644 hw/xfree86/xwayland/xserver.xml + create mode 100644 hw/xfree86/xwayland/xwayland-cursor.c + create mode 100644 hw/xfree86/xwayland/xwayland-drm.c + create mode 100644 hw/xfree86/xwayland/xwayland-input.c + create mode 100644 hw/xfree86/xwayland/xwayland-output.c + create mode 100644 hw/xfree86/xwayland/xwayland-private.h + create mode 100644 hw/xfree86/xwayland/xwayland-window.c + create mode 100644 hw/xfree86/xwayland/xwayland.c + create mode 100644 hw/xfree86/xwayland/xwayland.h + +diff --git a/configure.ac b/configure.ac +index 8bedd35..8078846 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -629,6 +629,7 @@ AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg + AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes]) + AC_ARG_ENABLE(linux_acpi, AC_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes]) + AC_ARG_ENABLE(linux_apm, AC_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes]) ++AC_ARG_ENABLE(wayland, AS_HELP_STRING([--disable-wayland], [Build Wayland extension (default: enabled)]), [WAYLAND=$enableval], [WAYLAND=yes]) + + dnl DDXes. + AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto]) +@@ -1018,6 +1019,14 @@ fi + if test "x$MITSHM" = xauto; then + MITSHM="$ac_cv_sysv_ipc" + fi ++ ++AM_CONDITIONAL(WAYLAND, [test "x$WAYLAND" = xyes]) ++if test "x$WAYLAND" = xyes; then ++ AC_DEFINE(XORG_WAYLAND, 1, [Support wayland mode]) ++ REQUIRED_MODULES="$REQUIRED_MODULES wayland-client" ++ WAYLAND_SCANNER_RULES(['$(top_srcdir)/hw/xfree86/xwayland']) ++fi ++ + AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes]) + if test "x$MITSHM" = xyes; then + AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension]) +@@ -1241,12 +1250,13 @@ esac + + AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes) + +-if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then ++if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes || test "x$WAYLAND" = xyes ; then + if test "x$DRM" = xyes; then + AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support]) + PKG_CHECK_MODULES([LIBDRM], $LIBDRM) + fi + fi ++AM_CONDITIONAL(DRM, test "x$DRM" = xyes) + + if test "x$DRI2" = xyes; then + save_CFLAGS=$CFLAGS +@@ -2462,6 +2472,7 @@ hw/xfree86/dixmods/Makefile + hw/xfree86/doc/Makefile + hw/xfree86/dri/Makefile + hw/xfree86/dri2/Makefile ++hw/xfree86/xwayland/Makefile + hw/xfree86/exa/Makefile + hw/xfree86/exa/man/Makefile + hw/xfree86/fbdevhw/Makefile +diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am +index 15670d0..cf60196 100644 +--- a/hw/xfree86/Makefile.am ++++ b/hw/xfree86/Makefile.am +@@ -14,6 +14,10 @@ DRI3_BUILDDIR = $(top_builddir)/dri3 + DRI3_LIB = $(DRI3_BUILDDIR)/libdri3.la + endif + ++if WAYLAND ++WAYLAND_SUBDIR = xwayland ++endif ++ + if XF86UTILS + XF86UTILS_SUBDIR = utils + endif +@@ -32,12 +36,12 @@ endif + + SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ + ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ +- $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \ ++ $(DRI2_SUBDIR) $(WAYLAND_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \ + fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man + + DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ + parser ramdac shadowfb vbe vgahw \ +- loader dixmods dri dri2 exa modes \ ++ loader dixmods dri dri2 exa modes xwayland \ + utils doc man + + bin_PROGRAMS = Xorg +diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c +index b5efc02..3b0bb89 100644 +--- a/hw/xfree86/common/xf86Config.c ++++ b/hw/xfree86/common/xf86Config.c +@@ -118,7 +118,8 @@ static ModuleDefault ModuleDefaults[] = { + {.name = "fb",.toLoad = TRUE,.load_opt = NULL}, + {.name = "shadow",.toLoad = TRUE,.load_opt = NULL}, + #endif +- {.name = NULL,.toLoad = FALSE,.load_opt = NULL} ++ {.name = "xwayland",.toLoad = FALSE,.load_opt=NULL}, ++ {.name = NULL,.toLoad = FALSE,.load_opt=NULL} + }; + + /* Forward declarations */ +@@ -260,6 +261,17 @@ xf86ModulelistFromConfig(pointer **optlist) + return NULL; + } + ++ /* ++ * Set the xwayland module to autoload if requested. ++ */ ++ if (xorgWayland) { ++ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) { ++ if (strcmp(ModuleDefaults[i].name, "xwayland") == 0) { ++ ModuleDefaults[i].toLoad = TRUE; ++ } ++ } ++ } ++ + if (xf86configptr->conf_modules) { + /* Walk the disable list and let people know what we've parsed to + * not be loaded +@@ -863,6 +875,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) + } + xf86Msg(from, "%sutomatically adding GPU devices\n", + xf86Info.autoAddGPU ? "A" : "Not a"); ++ ++ /* FIXME: Do that at the right place (before xf86Msg). */ ++ if (xorgWayland) { ++ xf86Info.autoAddDevices = FALSE; ++ xf86Info.autoEnableDevices = FALSE; ++ } ++ + /* + * Set things up based on the config file information. Some of these + * settings may be overridden later when the command line options are +@@ -953,9 +972,10 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) + } + #endif + +- /* if we're not hotplugging, force some input devices to exist */ +- xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && +- xf86Info.autoEnableDevices); ++ if (xorgWayland) /* Don't force input devices */ ++ xf86Info.forceInputDevices = FALSE; ++ else /* if we're not hotplugging, force some input devices to exist */ ++ xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && xf86Info.autoEnableDevices); + + /* when forcing input devices, we use kbd. otherwise evdev, so use the + * evdev rules set. */ +diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c +index 7df7a80..b41d2cc 100644 +--- a/hw/xfree86/common/xf86Globals.c ++++ b/hw/xfree86/common/xf86Globals.c +@@ -204,3 +204,5 @@ Bool xf86VidModeAllowNonLocal = FALSE; + #endif + RootWinPropPtr *xf86RegisteredPropertiesTable = NULL; + Bool xorgHWAccess = FALSE; ++Bool xorgWayland = FALSE; ++Bool xorgRootless = FALSE; +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index 91ec4c8..98adaab 100644 +--- a/hw/xfree86/common/xf86Init.c ++++ b/hw/xfree86/common/xf86Init.c +@@ -546,6 +546,13 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) + + if (!(flags & HW_SKIP_CONSOLE)) + xorgHWOpenConsole = TRUE; ++ ++ if (xorgWayland && ++ (NEED_IO_ENABLED(flags) || !(flags & HW_SKIP_CONSOLE))) { ++ ++ xf86DeleteDriver(i); ++ continue; ++ } + } + + if (xorgHWOpenConsole) +@@ -957,6 +964,9 @@ InitInput(int argc, char **argv) + + mieqInit(); + ++ if (xorgWayland) ++ return; ++ + /* Initialize all configured input devices */ + for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) { + (*pInfo)->options = +@@ -1455,6 +1465,16 @@ ddxProcessArgument(int argc, char **argv, int i) + return 1; + } + ++ if (!strcmp(argv[i], "-wayland")) { ++ xorgWayland = TRUE; ++ return 1; ++ } ++ ++ if (!strcmp(argv[i], "-rootless")) { ++ xorgRootless = TRUE; ++ return 1; ++ } ++ + /* OS-specific processing */ + return xf86ProcessArgument(argc, argv, i); + } +diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h +index 58cfe0a..3dd2697 100644 +--- a/hw/xfree86/common/xf86Priv.h ++++ b/hw/xfree86/common/xf86Priv.h +@@ -91,6 +91,8 @@ extern _X_EXPORT int xf86NumScreens; + extern _X_EXPORT const char *xf86VisualNames[]; + extern _X_EXPORT int xf86Verbose; /* verbosity level */ + extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */ ++extern _X_EXPORT Bool xorgWayland; ++extern _X_EXPORT Bool xorgRootless; + + extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable; + +diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c +index efdcd66..483d630 100644 +--- a/hw/xfree86/dri2/dri2.c ++++ b/hw/xfree86/dri2/dri2.c +@@ -1332,13 +1332,16 @@ DRI2Connect(ClientPtr client, ScreenPtr pScreen, + } + + static int +-DRI2AuthMagic (ScreenPtr pScreen, uint32_t magic) ++DRI2AuthMagic (ClientPtr client, ScreenPtr pScreen, uint32_t magic) + { + DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + if (ds == NULL) + return -EINVAL; + +- return (*ds->LegacyAuthMagic) (ds->fd, magic); ++ if (ds->LegacyAuthMagic2) ++ return (*ds->LegacyAuthMagic2) (pScreen, magic); ++ else ++ return (*ds->LegacyAuthMagic) (ds->fd, magic); + } + + Bool +diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h +index 38b4f58..ed67d01 100644 +--- a/hw/xfree86/dri2/dri2.h ++++ b/hw/xfree86/dri2/dri2.h +@@ -207,7 +207,7 @@ typedef int (*DRI2GetParamProcPtr) (ClientPtr client, + /** + * Version of the DRI2InfoRec structure defined in this header + */ +-#define DRI2INFOREC_VERSION 9 ++#define DRI2INFOREC_VERSION 10 + + typedef struct { + unsigned int version; /**< Version of this struct */ +diff --git a/hw/xfree86/xwayland/Makefile.am b/hw/xfree86/xwayland/Makefile.am +new file mode 100644 +index 0000000..b739145 +--- /dev/null ++++ b/hw/xfree86/xwayland/Makefile.am +@@ -0,0 +1,44 @@ ++AM_CPPFLAGS = \ ++ $(XORG_INCS) \ ++ -I$(srcdir)/../ddc \ ++ -I$(srcdir)/../ramdac \ ++ -I$(srcdir)/../i2c \ ++ -I$(srcdir)/../parser \ ++ -I$(srcdir)/../modes ++ ++libxwayland_la_LTLIBRARIES = libxwayland.la ++libxwayland_la_CFLAGS = \ ++ -DHAVE_XORG_CONFIG_H \ ++ @DIX_CFLAGS@ @XORG_CFLAGS@ @LIBDRM_CFLAGS@ \ ++ -I$(top_srcdir)/hw/xfree86/common \ ++ -I$(top_srcdir)/hw/xfree86/os-support/bus ++ ++libxwayland_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -lwayland-client ++libxwayland_ladir = $(moduledir)/extensions ++libxwayland_la_SOURCES = \ ++ xwayland.c \ ++ xwayland-input.c \ ++ xwayland-output.c \ ++ xwayland-cursor.c \ ++ xwayland-window.c \ ++ xwayland-private.h \ ++ drm-client-protocol.h \ ++ drm-protocol.c \ ++ xserver-client-protocol.h \ ++ xserver-protocol.c ++ ++if DRM ++libxwayland_la_SOURCES += xwayland-drm.c ++endif ++ ++sdk_HEADERS = xwayland.h ++ ++BUILT_SOURCES = \ ++ drm-client-protocol.h \ ++ drm-protocol.c \ ++ xserver-client-protocol.h \ ++ xserver-protocol.c ++ ++CLEANFILES = $(BUILT_SOURCES) ++ ++@wayland_scanner_rules@ +diff --git a/hw/xfree86/xwayland/drm.xml b/hw/xfree86/xwayland/drm.xml +new file mode 100644 +index 0000000..89fd8f0 +--- /dev/null ++++ b/hw/xfree86/xwayland/drm.xml +@@ -0,0 +1,139 @@ ++ ++ ++ ++ ++ Copyright © 2008-2011 Kristian Høgsberg ++ Copyright © 2010-2011 Intel Corporation ++ ++ Permission to use, copy, modify, distribute, and sell this ++ software and its documentation for any purpose is hereby granted ++ without fee, provided that\n the above copyright notice appear in ++ all copies and that both that copyright notice and this permission ++ notice appear in supporting documentation, and that the name of ++ the copyright holders not be used in advertising or publicity ++ pertaining to distribution of the software without specific, ++ written prior permission. The copyright holders make no ++ representations about the suitability of this software for any ++ purpose. It is provided "as is" without express or implied ++ warranty. ++ ++ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ++ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ++ THIS SOFTWARE. ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/hw/xfree86/xwayland/xserver.xml b/hw/xfree86/xwayland/xserver.xml +new file mode 100644 +index 0000000..9e25f5c +--- /dev/null ++++ b/hw/xfree86/xwayland/xserver.xml +@@ -0,0 +1,18 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c +new file mode 100644 +index 0000000..f8860bd +--- /dev/null ++++ b/hw/xfree86/xwayland/xwayland-cursor.c +@@ -0,0 +1,241 @@ ++/* ++ * Copyright © 2011 Kristian Høgsberg ++ * ++ * Permission to use, copy, modify, distribute, and sell this software ++ * and its documentation for any purpose is hereby granted without ++ * fee, provided that the above copyright notice appear in all copies ++ * and that both that copyright notice and this permission notice ++ * appear in supporting documentation, and that the name of the ++ * copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#ifdef HAVE_XORG_CONFIG_H ++#include "xorg-config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include "xwayland.h" ++#include "xwayland-private.h" ++#include "xserver-client-protocol.h" ++ ++static DevPrivateKeyRec xwl_cursor_private_key; ++ ++static void ++expand_source_and_mask(CursorPtr cursor, void *data) ++{ ++ CARD32 *argb, *p, d, fg, bg; ++ CursorBitsPtr bits = cursor->bits; ++ int size; ++ int x, y, stride, i, bit; ++ ++ size = bits->width * bits->height * 4; ++ argb = malloc(size); ++ if (argb == NULL) ++ return; ++ ++ p = argb; ++ fg = ((cursor->foreRed & 0xff00) << 8) | ++ (cursor->foreGreen & 0xff00) | (cursor->foreGreen >> 8); ++ bg = ((cursor->backRed & 0xff00) << 8) | ++ (cursor->backGreen & 0xff00) | (cursor->backGreen >> 8); ++ stride = (bits->width / 8 + 3) & ~3; ++ for (y = 0; y < bits->height; y++) ++ for (x = 0; x < bits->width; x++) { ++ i = y * stride + x / 8; ++ bit = 1 << (x & 7); ++ if (bits->source[i] & bit) ++ d = fg; ++ else ++ d = bg; ++ if (bits->mask[i] & bit) ++ d |= 0xff000000; ++ else ++ d = 0x00000000; ++ ++ *p++ = d; ++ } ++ ++ memcpy(data, argb, size); ++ free(argb); ++} ++ ++static Bool ++xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) ++{ ++ struct xwl_screen *xwl_screen; ++ int size; ++ char filename[] = "/tmp/wayland-shm-XXXXXX"; ++ int fd; ++ struct wl_shm_pool *pool; ++ struct wl_buffer *buffer; ++ void *data; ++ ++ xwl_screen = xwl_screen_get(screen); ++ size = cursor->bits->width * cursor->bits->height * 4; ++ ++ fd = mkstemp(filename); ++ if (fd < 0) { ++ ErrorF("open %s failed: %s", filename, strerror(errno)); ++ return FALSE; ++ } ++ if (ftruncate(fd, size) < 0) { ++ ErrorF("ftruncate failed: %s", strerror(errno)); ++ close(fd); ++ return FALSE; ++ } ++ ++ data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); ++ unlink(filename); ++ ++ if (data == MAP_FAILED) { ++ ErrorF("mmap failed: %s", strerror(errno)); ++ close(fd); ++ return FALSE; ++ } ++ ++ if (cursor->bits->argb) ++ memcpy(data, cursor->bits->argb, size); ++ else ++ expand_source_and_mask(cursor, data); ++ munmap(data, size); ++ ++ pool = wl_shm_create_pool(xwl_screen->shm, fd, size); ++ close(fd); ++ buffer = wl_shm_pool_create_buffer(pool, 0, ++ cursor->bits->width, cursor->bits->height, ++ cursor->bits->width * 4, ++ WL_SHM_FORMAT_ARGB8888); ++ wl_shm_pool_destroy(pool); ++ ++ dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, buffer); ++ ++ return TRUE; ++} ++ ++static Bool ++xwl_unrealize_cursor(DeviceIntPtr device, ++ ScreenPtr screen, CursorPtr cursor) ++{ ++ struct wl_buffer *buffer; ++ ++ buffer = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); ++ wl_buffer_destroy(buffer); ++ ++ return TRUE; ++} ++ ++void ++xwl_seat_set_cursor(struct xwl_seat *xwl_seat) ++{ ++ struct wl_buffer *buffer; ++ ++ if (!xwl_seat->x_cursor || !xwl_seat->wl_pointer) ++ return; ++ ++ buffer = dixGetPrivate(&xwl_seat->x_cursor->devPrivates, ++ &xwl_cursor_private_key); ++ ++ wl_pointer_set_cursor(xwl_seat->wl_pointer, ++ xwl_seat->pointer_enter_serial, ++ xwl_seat->cursor, ++ xwl_seat->x_cursor->bits->xhot, ++ xwl_seat->x_cursor->bits->yhot); ++ wl_surface_attach(xwl_seat->cursor, buffer, 0, 0); ++ wl_surface_damage(xwl_seat->cursor, 0, 0, ++ xwl_seat->x_cursor->bits->width, ++ xwl_seat->x_cursor->bits->height); ++ wl_surface_commit(xwl_seat->cursor); ++} ++ ++static void ++xwl_set_cursor(DeviceIntPtr device, ++ ScreenPtr screen, CursorPtr cursor, int x, int y) ++{ ++ struct xwl_screen *xwl_screen; ++ struct xwl_seat *xwl_seat; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ if (!xwl_screen || xorg_list_is_empty(&xwl_screen->seat_list)) ++ return; ++ ++ xwl_seat = xorg_list_first_entry(&xwl_screen->seat_list, ++ struct xwl_seat, link); ++ ++ xwl_seat->x_cursor = cursor; ++ xwl_seat_set_cursor(xwl_seat); ++} ++ ++static void ++xwl_move_cursor(DeviceIntPtr device, ScreenPtr screen, int x, int y) ++{ ++} ++ ++static Bool ++xwl_device_cursor_initialize(DeviceIntPtr device, ScreenPtr screen) ++{ ++ struct xwl_screen *xwl_screen; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ return xwl_screen->sprite_funcs->DeviceCursorInitialize(device, ++ screen); ++} ++ ++static void ++xwl_device_cursor_cleanup(DeviceIntPtr device, ScreenPtr screen) ++{ ++ struct xwl_screen *xwl_screen; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ xwl_screen->sprite_funcs->DeviceCursorCleanup(device, screen); ++} ++ ++static miPointerSpriteFuncRec xwl_pointer_sprite_funcs = ++{ ++ xwl_realize_cursor, ++ xwl_unrealize_cursor, ++ xwl_set_cursor, ++ xwl_move_cursor, ++ xwl_device_cursor_initialize, ++ xwl_device_cursor_cleanup ++}; ++ ++int ++xwl_screen_init_cursor(struct xwl_screen *xwl_screen, ScreenPtr screen) ++{ ++ miPointerScreenPtr pointer_priv; ++ ++ if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR, 0)) ++ return BadAlloc; ++ ++ pointer_priv = dixLookupPrivate(&screen->devPrivates, miPointerScreenKey); ++ xwl_screen->sprite_funcs = pointer_priv->spriteFuncs; ++ pointer_priv->spriteFuncs = &xwl_pointer_sprite_funcs; ++ ++ return Success; ++} +diff --git a/hw/xfree86/xwayland/xwayland-drm.c b/hw/xfree86/xwayland/xwayland-drm.c +new file mode 100644 +index 0000000..ce56e4c +--- /dev/null ++++ b/hw/xfree86/xwayland/xwayland-drm.c +@@ -0,0 +1,235 @@ ++/* ++ * Copyright © 2011 Kristian Høgsberg ++ * ++ * Permission to use, copy, modify, distribute, and sell this software ++ * and its documentation for any purpose is hereby granted without ++ * fee, provided that the above copyright notice appear in all copies ++ * and that both that copyright notice and this permission notice ++ * appear in supporting documentation, and that the name of the ++ * copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#ifdef HAVE_XORG_CONFIG_H ++#include "xorg-config.h" ++#endif ++ ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "xwayland.h" ++#include "xwayland-private.h" ++#include "../dri2/dri2.h" ++ ++struct xwl_auth_req { ++ struct xorg_list link; ++ ++ ClientPtr client; ++ struct xwl_screen *xwl_screen; ++ uint32_t magic; ++}; ++ ++static void ++drm_handle_device (void *data, struct wl_drm *drm, const char *device) ++{ ++ struct xwl_screen *xwl_screen = data; ++ ++ xwl_screen->device_name = strdup (device); ++} ++ ++static void ++drm_handle_format(void *data, struct wl_drm *wl_drm, uint32_t format) ++{ ++} ++ ++static void ++drm_handle_authenticated (void *data, struct wl_drm *drm) ++{ ++ struct xwl_screen *xwl_screen = data; ++ struct xwl_auth_req *req; ++ ++ xwl_screen->authenticated = 1; ++ ++ /* it does one authentication transaction at a time, so if there's an ++ * element in the list, we call DRI2SendAuthReply for that client, remove ++ * the head and free the struct. If there are still elements in the list, ++ * it means that we have one or more clients waiting to be authenticated ++ * and we send out a wl_drm authenticate request for the first client in ++ * the list */ ++ if (xorg_list_is_empty(&xwl_screen->authenticate_client_list)) ++ return; ++ ++ req = xorg_list_first_entry(&xwl_screen->authenticate_client_list, ++ struct xwl_auth_req, link); ++ DRI2SendAuthReply(req->client, TRUE); ++ AttendClient(req->client); ++ xorg_list_del(&req->link); ++ free(req); ++ ++ xorg_list_for_each_entry(req, &xwl_screen->authenticate_client_list, ++ link) { ++ wl_drm_authenticate (xwl_screen->drm, req->magic); ++ return; ++ } ++} ++ ++static const struct wl_drm_listener xwl_drm_listener = ++{ ++ drm_handle_device, ++ drm_handle_format, ++ drm_handle_authenticated ++}; ++ ++static void ++drm_handler(void *data, struct wl_registry *registry, uint32_t id, ++ const char *interface, uint32_t version) ++{ ++ struct xwl_screen *xwl_screen = data; ++ ++ if (strcmp (interface, "wl_drm") == 0) { ++ xwl_screen->drm = wl_registry_bind(xwl_screen->registry, id, ++ &wl_drm_interface, 1); ++ wl_drm_add_listener(xwl_screen->drm, &xwl_drm_listener, xwl_screen); ++ } ++} ++ ++static const struct wl_registry_listener drm_listener = { ++ drm_handler, ++}; ++ ++int ++xwl_drm_pre_init(struct xwl_screen *xwl_screen) ++{ ++ uint32_t magic; ++ ++ xwl_screen->drm_registry = wl_display_get_registry(xwl_screen->display); ++ wl_registry_add_listener(xwl_screen->drm_registry, &drm_listener, ++ xwl_screen); ++ ++ /* Ensure drm_handler has seen all the interfaces */ ++ wl_display_roundtrip(xwl_screen->display); ++ /* Ensure the xwl_drm_listener has seen the drm device, if any */ ++ wl_display_roundtrip(xwl_screen->display); ++ ++ ErrorF("wayland_drm_screen_init, device name %s\n", ++ xwl_screen->device_name); ++ ++ xwl_screen->drm_fd = open(xwl_screen->device_name, O_RDWR); ++ if (xwl_screen->drm_fd < 0) { ++ ErrorF("failed to open the drm fd\n"); ++ return BadAccess; ++ } ++ ++ if (drmGetMagic(xwl_screen->drm_fd, &magic)) { ++ ErrorF("failed to get drm magic"); ++ return BadAccess; ++ } ++ ++ wl_drm_authenticate(xwl_screen->drm, magic); ++ ++ wl_display_roundtrip(xwl_screen->display); ++ ++ ErrorF("opened drm fd: %d\n", xwl_screen->drm_fd); ++ ++ if (!xwl_screen->authenticated) { ++ ErrorF("Failed to auth drm fd\n"); ++ return BadAccess; ++ } ++ ++ return Success; ++} ++ ++Bool xwl_drm_initialised(struct xwl_screen *xwl_screen) ++{ ++ return xwl_screen->authenticated; ++} ++ ++int xwl_screen_get_drm_fd(struct xwl_screen *xwl_screen) ++{ ++ return xwl_screen->drm_fd; ++} ++ ++int xwl_drm_authenticate(ClientPtr client, struct xwl_screen *xwl_screen, ++ uint32_t magic) ++{ ++ struct xwl_auth_req *req; ++ ++ if (!xwl_screen->drm) ++ return BadAccess; ++ ++ req = malloc (sizeof *req); ++ if (req == NULL) ++ return BadAlloc; ++ ++ req->client = client; ++ req->xwl_screen = xwl_screen; ++ req->magic = magic; ++ ++ if (xorg_list_is_empty(&xwl_screen->authenticate_client_list)) ++ wl_drm_authenticate (xwl_screen->drm, magic); ++ ++ xorg_list_append(&req->link, &xwl_screen->authenticate_client_list); ++ ++ IgnoreClient(req->client); ++ xwl_screen->authenticated = 0; ++ ++ return Success; ++} ++ ++ ++int ++xwl_create_window_buffer_drm(struct xwl_window *xwl_window, ++ PixmapPtr pixmap, uint32_t name) ++{ ++ VisualID visual; ++ WindowPtr window = xwl_window->window; ++ ScreenPtr screen = window->drawable.pScreen; ++ uint32_t format; ++ int i; ++ ++ visual = wVisual(window); ++ for (i = 0; i < screen->numVisuals; i++) ++ if (screen->visuals[i].vid == visual) ++ break; ++ ++ if (screen->visuals[i].nplanes == 32) ++ format = WL_DRM_FORMAT_ARGB8888; ++ else ++ format = WL_DRM_FORMAT_XRGB8888; ++ ++ xwl_window->buffer = ++ wl_drm_create_buffer(xwl_window->xwl_screen->drm, ++ name, ++ pixmap->drawable.width, ++ pixmap->drawable.height, ++ pixmap->devKind, ++ format); ++ ++ return xwl_window->buffer ? Success : BadDrawable; ++} +diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c +new file mode 100644 +index 0000000..2f8e0c7 +--- /dev/null ++++ b/hw/xfree86/xwayland/xwayland-input.c +@@ -0,0 +1,610 @@ ++/* ++ * Copyright © 2008 Kristian Høgsberg ++ * ++ * Permission to use, copy, modify, distribute, and sell this software ++ * and its documentation for any purpose is hereby granted without ++ * fee, provided that the above copyright notice appear in all copies ++ * and that both that copyright notice and this permission notice ++ * appear in supporting documentation, and that the name of the ++ * copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#ifdef HAVE_XORG_CONFIG_H ++#include "xorg-config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "xwayland.h" ++#include "xwayland-private.h" ++#include "xserver-client-protocol.h" ++ ++static void ++xwl_pointer_control(DeviceIntPtr device, PtrCtrl *ctrl) ++{ ++ /* Nothing to do, dix handles all settings */ ++} ++ ++static int ++xwl_pointer_proc(DeviceIntPtr device, int what) ++{ ++#define NBUTTONS 10 ++#define NAXES 2 ++ BYTE map[NBUTTONS + 1]; ++ int i = 0; ++ Atom btn_labels[NBUTTONS] = {0}; ++ Atom axes_labels[NAXES] = {0}; ++ ++ switch (what) { ++ case DEVICE_INIT: ++ device->public.on = FALSE; ++ ++ for (i = 1; i <= NBUTTONS; i++) ++ map[i] = i; ++ ++ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); ++ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); ++ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); ++ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); ++ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); ++ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); ++ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); ++ /* don't know about the rest */ ++ ++ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); ++ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); ++ ++ if (!InitValuatorClassDeviceStruct(device, 2, btn_labels, ++ GetMotionHistorySize(), Absolute)) ++ return BadValue; ++ ++ /* Valuators */ ++ InitValuatorAxisStruct(device, 0, axes_labels[0], ++ 0, 0xFFFF, 10000, 0, 10000, Absolute); ++ InitValuatorAxisStruct(device, 1, axes_labels[1], ++ 0, 0xFFFF, 10000, 0, 10000, Absolute); ++ ++ if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control)) ++ return BadValue; ++ ++ if (!InitButtonClassDeviceStruct(device, 3, btn_labels, map)) ++ return BadValue; ++ ++ return Success; ++ ++ case DEVICE_ON: ++ device->public.on = TRUE; ++ return Success; ++ ++ case DEVICE_OFF: ++ case DEVICE_CLOSE: ++ device->public.on = FALSE; ++ return Success; ++ } ++ ++ return BadMatch; ++ ++#undef NBUTTONS ++#undef NAXES ++} ++ ++static void ++xwl_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl) ++{ ++ /* FIXME: Set keyboard leds based on CAPSFLAG etc being set in ++ * ctrl->leds - needs private protocol. */ ++} ++ ++static int ++xwl_keyboard_proc(DeviceIntPtr device, int what) ++{ ++ InputInfoPtr pInfo = device->public.devicePrivate; ++ struct xwl_seat *xwl_seat = pInfo->private; ++ int len; ++ ++ switch (what) { ++ case DEVICE_INIT: ++ device->public.on = FALSE; ++ len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size); ++ if (!InitKeyboardDeviceStructFromString(device, xwl_seat->keymap, ++ len, ++ NULL, xwl_keyboard_control)) ++ return BadValue; ++ ++ return Success; ++ case DEVICE_ON: ++ device->public.on = TRUE; ++ return Success; ++ ++ case DEVICE_OFF: ++ case DEVICE_CLOSE: ++ device->public.on = FALSE; ++ return Success; ++ } ++ ++ return BadMatch; ++} ++ ++static void ++xwl_keyboard_uninit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) ++{ ++} ++ ++static int ++xwl_keyboard_init(InputDriverPtr drv, InputInfoPtr pInfo, int flags) ++{ ++ pInfo->type_name = "xwayland-keyboard"; ++ pInfo->device_control = xwl_keyboard_proc; ++ pInfo->read_input = NULL; ++ pInfo->control_proc = NULL; ++ pInfo->switch_mode = NULL; ++ pInfo->fd = -1; ++ ++ return Success; ++} ++ ++_X_EXPORT InputDriverRec xwl_keyboard_driver = { ++ 1, ++ "xwayland-keyboard", ++ NULL, ++ xwl_keyboard_init, ++ xwl_keyboard_uninit, ++ NULL, ++}; ++ ++static void ++xwl_pointer_uninit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) ++{ ++} ++ ++static int ++xwl_pointer_init(InputDriverPtr drv, InputInfoPtr pInfo, int flags) ++{ ++ pInfo->type_name = "xwayland-pointer"; ++ pInfo->device_control = xwl_pointer_proc; ++ pInfo->read_input = NULL; ++ pInfo->control_proc = NULL; ++ pInfo->switch_mode = NULL; ++ pInfo->fd = -1; ++ ++ return Success; ++} ++ ++_X_EXPORT InputDriverRec xwl_pointer_driver = { ++ 1, ++ "xwayland-pointer", ++ NULL, ++ xwl_pointer_init, ++ xwl_pointer_uninit, ++ NULL, ++}; ++ ++void ++xwl_input_teardown(pointer p) ++{ ++} ++ ++pointer ++xwl_input_setup(pointer module, pointer opts, int *errmaj, int *errmin) ++{ ++ xf86AddInputDriver(&xwl_keyboard_driver, module, 0); ++ xf86AddInputDriver(&xwl_pointer_driver, module, 0); ++ ++ return module; ++} ++ ++static DeviceIntPtr ++device_added(struct xwl_seat *xwl_seat, const char *driver) ++{ ++ DeviceIntPtr dev = NULL; ++ InputInfoPtr pInfo; ++ int rc; ++ ++ pInfo = xf86AllocateInput(); ++ if (!pInfo) ++ return NULL; ++ ++ pInfo->driver = xstrdup(driver); ++ ++ if (asprintf(&pInfo->name, "%s:%d", pInfo->driver, xwl_seat->id) == -1) { ++ free(pInfo); ++ return NULL; ++ } ++ ++ pInfo->private = xwl_seat; ++ ++ rc = xf86NewInputDevice(pInfo, &dev, 1); ++ if (rc != Success) { ++ free(pInfo); ++ return NULL; ++ } ++ ++ LogMessage(X_INFO, "config/xwayland: Adding input device %s\n", ++ pInfo->name); ++ ++ return dev; ++} ++ ++static void ++pointer_handle_enter(void *data, struct wl_pointer *pointer, ++ uint32_t serial, struct wl_surface *surface, ++ wl_fixed_t sx_w, wl_fixed_t sy_w) ++ ++{ ++ struct xwl_seat *xwl_seat = data; ++ DeviceIntPtr dev = xwl_seat->pointer; ++ int i; ++ int sx = wl_fixed_to_int(sx_w); ++ int sy = wl_fixed_to_int(sy_w); ++ ScreenPtr pScreen = xwl_seat->xwl_screen->screen; ++ ++ xwl_seat->xwl_screen->serial = serial; ++ xwl_seat->pointer_enter_serial = serial; ++ ++ xwl_seat->focus_window = wl_surface_get_user_data(surface); ++ ++ (*pScreen->SetCursorPosition) (dev, pScreen, sx, sy, TRUE); ++ ++ SetDeviceRedirectWindow(xwl_seat->pointer, xwl_seat->focus_window->window); ++ ++ /* Ideally, X clients shouldn't see these button releases. When ++ * the pointer leaves a window with buttons down, it means that ++ * the wayland compositor has grabbed the pointer. The button ++ * release event is consumed by whatever grab in the compositor ++ * and won't be sent to clients (the X server is a client). ++ * However, we need to reset X's idea of which buttons are up and ++ * down, and they're all up (by definition) when the pointer ++ * enters a window. We should figure out a way to swallow these ++ * events, perhaps using an X grab whenever the pointer is not in ++ * any X window, but for now just send the events. */ ++ for (i = 0; i < dev->button->numButtons; i++) ++ if (BitIsOn(dev->button->down, i)) ++ xf86PostButtonEvent(dev, TRUE, i, 0, 0, 0); ++ ++ (*pScreen->DisplayCursor)(dev, pScreen, dev->spriteInfo->sprite->current); ++} ++ ++static void ++pointer_handle_leave(void *data, struct wl_pointer *pointer, ++ uint32_t serial, struct wl_surface *surface) ++{ ++ struct xwl_seat *xwl_seat = data; ++ DeviceIntPtr dev = xwl_seat->pointer; ++ ScreenPtr pScreen = xwl_seat->xwl_screen->screen; ++ ++ xwl_seat->xwl_screen->serial = serial; ++ ++ xwl_seat->focus_window = NULL; ++ SetDeviceRedirectWindow(xwl_seat->pointer, PointerRootWin); ++ (*pScreen->DisplayCursor)(dev, pScreen, NullCursor); ++} ++ ++static void ++pointer_handle_motion(void *data, struct wl_pointer *pointer, ++ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) ++{ ++ struct xwl_seat *xwl_seat = data; ++ int32_t dx, dy; ++ int sx = wl_fixed_to_int(sx_w); ++ int sy = wl_fixed_to_int(sy_w); ++ ValuatorMask mask; ++ ++ if (!xwl_seat->focus_window) ++ return ; ++ ++ dx = xwl_seat->focus_window->window->drawable.x; ++ dy = xwl_seat->focus_window->window->drawable.y; ++ ++ valuator_mask_zero(&mask); ++ valuator_mask_set(&mask, 0, dx + sx); ++ valuator_mask_set(&mask, 1, dy + sy); ++ ++ QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, ++ POINTER_ABSOLUTE | POINTER_SCREEN, &mask); ++} ++ ++static void ++pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, ++ uint32_t time, uint32_t button, uint32_t state) ++{ ++ struct xwl_seat *xwl_seat = data; ++ int index; ++ ++ xwl_seat->xwl_screen->serial = serial; ++ ++ switch (button) { ++ case BTN_MIDDLE: ++ index = 2; ++ break; ++ case BTN_RIGHT: ++ index = 3; ++ break; ++ default: ++ index = button - BTN_LEFT + 1; ++ break; ++ } ++ ++ xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, state, 0, 0); ++} ++ ++static void ++pointer_handle_axis(void *data, struct wl_pointer *pointer, ++ uint32_t time, uint32_t axis, wl_fixed_t value) ++{ ++ struct xwl_seat *xwl_seat = data; ++ int index, count; ++ int i, val; ++ const int divisor = 10; ++ ++ if (time - xwl_seat->scroll_time > 2000) { ++ xwl_seat->vertical_scroll = 0; ++ xwl_seat->horizontal_scroll = 0; ++ } ++ xwl_seat->scroll_time = time; ++ ++ /* FIXME: Need to do proper smooth scrolling here! */ ++ switch (axis) { ++ case WL_POINTER_AXIS_VERTICAL_SCROLL: ++ xwl_seat->vertical_scroll += value / divisor; ++ val = wl_fixed_to_int(xwl_seat->vertical_scroll); ++ xwl_seat->vertical_scroll -= wl_fixed_from_int(val); ++ ++ if (val <= -1) ++ index = 4; ++ else if (val >= 1) ++ index = 5; ++ else ++ return; ++ break; ++ case WL_POINTER_AXIS_HORIZONTAL_SCROLL: ++ xwl_seat->horizontal_scroll += value / divisor; ++ val = wl_fixed_to_int(xwl_seat->horizontal_scroll); ++ xwl_seat->horizontal_scroll -= wl_fixed_from_int(val); ++ ++ if (val <= -1) ++ index = 6; ++ else if (val >= 1) ++ index = 7; ++ else ++ return; ++ break; ++ default: ++ return; ++ } ++ ++ count = abs(val); ++ for (i = 0; i < count; i++) { ++ xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, 1, 0, 0); ++ xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, 0, 0, 0); ++ } ++} ++ ++static const struct wl_pointer_listener pointer_listener = { ++ pointer_handle_enter, ++ pointer_handle_leave, ++ pointer_handle_motion, ++ pointer_handle_button, ++ pointer_handle_axis, ++}; ++ ++static void ++keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, ++ uint32_t time, uint32_t key, uint32_t state) ++{ ++ struct xwl_seat *xwl_seat = data; ++ uint32_t *k, *end; ++ ++ xwl_seat->xwl_screen->serial = serial; ++ ++ end = xwl_seat->keys.data + xwl_seat->keys.size; ++ for (k = xwl_seat->keys.data; k < end; k++) { ++ if (*k == key) ++ *k = *--end; ++ } ++ xwl_seat->keys.size = (void *) end - xwl_seat->keys.data; ++ if (state) { ++ k = wl_array_add(&xwl_seat->keys, sizeof *k); ++ *k = key; ++ } ++ ++ xf86PostKeyboardEvent(xwl_seat->keyboard, key + 8, state); ++} ++ ++static void ++keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, ++ uint32_t format, int fd, uint32_t size) ++{ ++ struct xwl_seat *xwl_seat = data; ++ ++ xwl_seat->keymap_size = size; ++ xwl_seat->keymap = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); ++ if (xwl_seat->keymap == MAP_FAILED) ++ ; /* wah wah */ ++ ++ close(fd); ++} ++ ++static void ++keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, ++ uint32_t serial, ++ struct wl_surface *surface, struct wl_array *keys) ++{ ++ struct xwl_seat *xwl_seat = data; ++ uint32_t *k; ++ ++ xwl_seat->xwl_screen->serial = serial; ++ ++ wl_array_copy(&xwl_seat->keys, keys); ++ wl_array_for_each(k, &xwl_seat->keys) ++ xf86PostKeyboardEvent(xwl_seat->keyboard, *k + 8, 1); ++} ++ ++static void ++keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, ++ uint32_t serial, struct wl_surface *surface) ++{ ++ struct xwl_seat *xwl_seat = data; ++ uint32_t *k; ++ ++ xwl_seat->xwl_screen->serial = serial; ++ ++ wl_array_for_each(k, &xwl_seat->keys) ++ xf86PostKeyboardEvent(xwl_seat->keyboard, *k + 8, 0); ++} ++ ++static void ++keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, ++ uint32_t serial, uint32_t mods_depressed, ++ uint32_t mods_latched, uint32_t mods_locked, ++ uint32_t group) ++{ ++ /* FIXME: Need more server XKB API here. */ ++} ++ ++static const struct wl_keyboard_listener keyboard_listener = { ++ keyboard_handle_keymap, ++ keyboard_handle_enter, ++ keyboard_handle_leave, ++ keyboard_handle_key, ++ keyboard_handle_modifiers, ++}; ++ ++static void ++add_devices(void *data, struct wl_callback *callback, uint32_t time) ++{ ++ struct xwl_seat *xwl_seat = data; ++ ++ wl_callback_destroy(callback); ++ ++ if (xwl_seat->wl_pointer) ++ xwl_seat->pointer = device_added(xwl_seat, "xwayland-pointer"); ++ if (xwl_seat->wl_keyboard) ++ xwl_seat->keyboard = device_added(xwl_seat, "xwayland-keyboard"); ++} ++ ++static const struct wl_callback_listener add_devices_listener = { ++ add_devices ++}; ++ ++static void ++seat_handle_capabilities(void *data, struct wl_seat *seat, ++ enum wl_seat_capability caps) ++{ ++ struct xwl_seat *xwl_seat = data; ++ struct wl_callback *callback; ++ ++ if (caps & WL_SEAT_CAPABILITY_POINTER) { ++ xwl_seat->wl_pointer = wl_seat_get_pointer(seat); ++ wl_pointer_add_listener(xwl_seat->wl_pointer, ++ &pointer_listener, xwl_seat); ++ xwl_seat_set_cursor(xwl_seat); ++ } ++ ++ if (caps & WL_SEAT_CAPABILITY_KEYBOARD) { ++ xwl_seat->wl_keyboard = wl_seat_get_keyboard(seat); ++ wl_keyboard_add_listener(xwl_seat->wl_keyboard, ++ &keyboard_listener, xwl_seat); ++ ++ } ++ /* FIXME: Touch ... */ ++ ++ /* Add devices after we've received keymaps. */ ++ if (caps) { ++ callback = wl_display_sync(xwl_seat->xwl_screen->display); ++ wl_callback_add_listener(callback, ++ &add_devices_listener, xwl_seat); ++ } ++} ++ ++static const struct wl_seat_listener seat_listener = { ++ seat_handle_capabilities, ++}; ++ ++static void ++create_input_device(struct xwl_screen *xwl_screen, uint32_t id) ++{ ++ struct xwl_seat *xwl_seat; ++ ++ xwl_seat = calloc(sizeof *xwl_seat, 1); ++ if (xwl_seat == NULL) { ++ ErrorF("create_input ENOMEM"); ++ return ; ++ } ++ ++ xwl_seat->xwl_screen = xwl_screen; ++ xorg_list_add(&xwl_seat->link, &xwl_screen->seat_list); ++ ++ xwl_seat->seat = ++ wl_registry_bind(xwl_screen->registry, id, &wl_seat_interface, 1); ++ xwl_seat->id = id; ++ ++ xwl_seat->cursor = wl_compositor_create_surface(xwl_screen->compositor); ++ wl_seat_add_listener(xwl_seat->seat, &seat_listener, xwl_seat); ++ wl_array_init(&xwl_seat->keys); ++} ++ ++static void ++input_handler(void *data, struct wl_registry *registry, uint32_t id, ++ const char *interface, uint32_t version) ++{ ++ struct xwl_screen *xwl_screen = data; ++ ++ if (strcmp (interface, "wl_seat") == 0) { ++ create_input_device(xwl_screen, id); ++ } else if (strcmp(interface, "xserver") == 0) { ++ xwl_screen->xorg_server = ++ wl_registry_bind(registry, id, &xserver_interface, 1); ++ xserver_add_listener(xwl_screen->xorg_server, &xwl_server_listener, ++ xwl_screen); ++ } ++} ++ ++static const struct wl_registry_listener input_listener = { ++ input_handler, ++}; ++ ++void ++xwl_input_init(struct xwl_screen *xwl_screen) ++{ ++ xwl_screen->input_registry = wl_display_get_registry(xwl_screen->display); ++ wl_registry_add_listener(xwl_screen->input_registry, &input_listener, ++ xwl_screen); ++} +diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c +new file mode 100644 +index 0000000..8f087f6 +--- /dev/null ++++ b/hw/xfree86/xwayland/xwayland-output.c +@@ -0,0 +1,309 @@ ++/* ++ * Copyright © 2011 Intel Corporation ++ * ++ * Permission to use, copy, modify, distribute, and sell this software ++ * and its documentation for any purpose is hereby granted without ++ * fee, provided that the above copyright notice appear in all copies ++ * and that both that copyright notice and this permission notice ++ * appear in supporting documentation, and that the name of the ++ * copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#ifdef HAVE_XORG_CONFIG_H ++#include "xorg-config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++ ++#include "xwayland.h" ++#include "xwayland-private.h" ++#include "xserver-client-protocol.h" ++ ++static void ++crtc_dpms(xf86CrtcPtr drmmode_crtc, int mode) ++{ ++} ++ ++static Bool ++crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, ++ Rotation rotation, int x, int y) ++{ ++ return TRUE; ++} ++ ++static void ++crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg) ++{ ++} ++ ++static void ++crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) ++{ ++} ++ ++static void ++crtc_show_cursor (xf86CrtcPtr crtc) ++{ ++} ++ ++static void ++crtc_hide_cursor (xf86CrtcPtr crtc) ++{ ++} ++ ++static void ++crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) ++{ ++} ++ ++static PixmapPtr ++crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height) ++{ ++ return NULL; ++} ++ ++static void * ++crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height) ++{ ++ return NULL; ++} ++ ++static void ++crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) ++{ ++} ++ ++static const xf86CrtcFuncsRec crtc_funcs = { ++ .dpms = crtc_dpms, ++ .set_mode_major = crtc_set_mode_major, ++ .set_cursor_colors = crtc_set_cursor_colors, ++ .set_cursor_position = crtc_set_cursor_position, ++ .show_cursor = crtc_show_cursor, ++ .hide_cursor = crtc_hide_cursor, ++ .load_cursor_argb = crtc_load_cursor_argb, ++ .shadow_create = crtc_shadow_create, ++ .shadow_allocate = crtc_shadow_allocate, ++ .shadow_destroy = crtc_shadow_destroy, ++ .destroy = NULL, /* XXX */ ++}; ++ ++static void ++output_dpms(xf86OutputPtr output, int mode) ++{ ++ return; ++} ++ ++static xf86OutputStatus ++output_detect(xf86OutputPtr output) ++{ ++ return XF86OutputStatusConnected; ++} ++ ++static Bool ++output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes) ++{ ++ return MODE_OK; ++} ++ ++static DisplayModePtr ++output_get_modes(xf86OutputPtr xf86output) ++{ ++ struct xwl_output *output = xf86output->driver_private; ++ struct monitor_ranges *ranges; ++ DisplayModePtr modes; ++ ++ modes = xf86CVTMode(output->width, output->height, 60, TRUE, FALSE); ++ output->xf86monitor.det_mon[0].type = DS_RANGES; ++ ranges = &output->xf86monitor.det_mon[0].section.ranges; ++ ranges->min_h = modes->HSync - 10; ++ ranges->max_h = modes->HSync + 10; ++ ranges->min_v = modes->VRefresh - 10; ++ ranges->max_v = modes->VRefresh + 10; ++ ranges->max_clock = modes->Clock + 100; ++ output->xf86monitor.det_mon[1].type = DT; ++ output->xf86monitor.det_mon[2].type = DT; ++ output->xf86monitor.det_mon[3].type = DT; ++ output->xf86monitor.no_sections = 0; ++ ++ xf86output->MonInfo = &output->xf86monitor; ++ ++ return modes; ++} ++ ++static void ++output_destroy(xf86OutputPtr xf86output) ++{ ++ struct xwl_output *output = xf86output->driver_private; ++ ++ free(output); ++} ++ ++static const xf86OutputFuncsRec output_funcs = { ++ .dpms = output_dpms, ++ .detect = output_detect, ++ .mode_valid = output_mode_valid, ++ .get_modes = output_get_modes, ++ .destroy = output_destroy ++}; ++ ++struct xwl_output * ++xwl_output_create(struct xwl_screen *xwl_screen) ++{ ++ struct xwl_output *xwl_output; ++ xf86OutputPtr xf86output; ++ xf86CrtcPtr xf86crtc; ++ ++ xwl_output = calloc(sizeof *xwl_output, 1); ++ if (xwl_output == NULL) { ++ ErrorF("create_output ENOMEM"); ++ return NULL; ++ } ++ ++ xwl_output->xwl_screen = xwl_screen; ++ ++ xf86output = xf86OutputCreate(xwl_screen->scrninfo, ++ &output_funcs, "XWAYLAND-1"); ++ xf86output->driver_private = xwl_output; ++ xf86output->possible_crtcs = 1; ++ xf86output->possible_clones = 1; ++ ++ xf86crtc = xf86CrtcCreate(xwl_screen->scrninfo, &crtc_funcs); ++ xf86crtc->driver_private = xwl_output; ++ ++ xwl_output->xf86output = xf86output; ++ xwl_output->xf86crtc = xf86crtc; ++ ++ return xwl_output; ++} ++ ++static Bool ++resize(ScrnInfoPtr scrn, int width, int height) ++{ ++ if (scrn->virtualX == width && scrn->virtualY == height) ++ return TRUE; ++ /* We don't handle resize at all, we must match the compositor size */ ++ return FALSE; ++} ++ ++static const xf86CrtcConfigFuncsRec config_funcs = { ++ resize ++}; ++ ++static void ++display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, ++ int physical_width, int physical_height, int subpixel, ++ const char *make, const char *model, int transform) ++{ ++ struct xwl_output *xwl_output = data; ++ struct xwl_screen *xwl_screen = xwl_output->xwl_screen; ++ ++ xwl_output->xf86output->mm_width = physical_width; ++ xwl_output->xf86output->mm_height = physical_height; ++ ++ switch (subpixel) { ++ case WL_OUTPUT_SUBPIXEL_UNKNOWN: ++ xwl_output->xf86output->subpixel_order = SubPixelUnknown; ++ break; ++ case WL_OUTPUT_SUBPIXEL_NONE: ++ xwl_output->xf86output->subpixel_order = SubPixelNone; ++ break; ++ case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: ++ xwl_output->xf86output->subpixel_order = SubPixelHorizontalRGB; ++ break; ++ case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: ++ xwl_output->xf86output->subpixel_order = SubPixelHorizontalBGR; ++ break; ++ case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: ++ xwl_output->xf86output->subpixel_order = SubPixelVerticalRGB; ++ break; ++ case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: ++ xwl_output->xf86output->subpixel_order = SubPixelVerticalBGR; ++ break; ++ } ++ ++ xwl_output->x = x; ++ xwl_output->y = y; ++ ++ xwl_screen->xwl_output = xwl_output; ++} ++ ++static void ++display_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, ++ int width, int height, int refresh) ++{ ++ struct xwl_output *xwl_output = data; ++ ++ if (flags & WL_OUTPUT_MODE_CURRENT) { ++ xwl_output->width = width; ++ xwl_output->height = height; ++ } ++} ++ ++static const struct wl_output_listener output_listener = { ++ display_handle_geometry, ++ display_handle_mode ++}; ++ ++static void ++global_handler(void *data, struct wl_registry *registry, uint32_t id, ++ const char *interface, uint32_t version) ++{ ++ struct xwl_screen *xwl_screen = data; ++ struct xwl_output *xwl_output; ++ ++ if (strcmp (interface, "wl_output") == 0) { ++ xwl_output = xwl_output_create(xwl_screen); ++ xwl_output->output = wl_registry_bind(registry, id, ++ &wl_output_interface, 1); ++ wl_output_add_listener(xwl_output->output, ++ &output_listener, xwl_output); ++ } ++} ++ ++static const struct wl_registry_listener global_listener = { ++ global_handler, ++}; ++ ++void ++xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrninfo) ++{ ++ int ret; ++ ++ xf86CrtcConfigInit(scrninfo, &config_funcs); ++ ++ xf86CrtcSetSizeRange(scrninfo, 320, 200, 8192, 8192); ++ ++ xwl_screen->output_registry = wl_display_get_registry(xwl_screen->display); ++ wl_registry_add_listener(xwl_screen->output_registry, &global_listener, ++ xwl_screen); ++ ++ while (!xwl_screen->xwl_output) { ++ ret = wl_display_roundtrip(xwl_screen->display); ++ if (ret == -1) ++ FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); ++ } ++ ++ xf86InitialConfiguration(scrninfo, TRUE); ++} +diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h +new file mode 100644 +index 0000000..e427316 +--- /dev/null ++++ b/hw/xfree86/xwayland/xwayland-private.h +@@ -0,0 +1,132 @@ ++/* ++ * Copyright © 2010 Kristian Høgsberg ++ * ++ * Permission to use, copy, modify, distribute, and sell this software ++ * and its documentation for any purpose is hereby granted without ++ * fee, provided that the above copyright notice appear in all copies ++ * and that both that copyright notice and this permission notice ++ * appear in supporting documentation, and that the name of the ++ * copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#ifndef _XWAYLAND_PRIVATE_H_ ++#define _XWAYLAND_PRIVATE_H_ ++ ++struct xwl_window { ++ struct xwl_screen *xwl_screen; ++ struct wl_surface *surface; ++ struct wl_buffer *buffer; ++ WindowPtr window; ++ DamagePtr damage; ++ struct xorg_list link; ++ struct xorg_list link_damage; ++}; ++ ++struct xwl_output; ++ ++struct xwl_screen { ++ struct xwl_driver *driver; ++ ScreenPtr screen; ++ ScrnInfoPtr scrninfo; ++ int drm_fd; ++ int wayland_fd; ++ struct xwl_output *xwl_output; ++ struct wl_display *display; ++ struct wl_registry *registry; ++ struct wl_registry *drm_registry; ++ struct wl_registry *input_registry; ++ struct wl_registry *output_registry; ++ struct wl_compositor *compositor; ++ struct wl_drm *drm; ++ struct wl_shm *shm; ++ struct xserver *xorg_server; ++ uint32_t mask; ++ uint32_t flags; ++ char *device_name; ++ uint32_t authenticated; ++ struct xorg_list seat_list; ++ struct xorg_list damage_window_list; ++ struct xorg_list window_list; ++ struct xorg_list authenticate_client_list; ++ uint32_t serial; ++ ++ CreateWindowProcPtr CreateWindow; ++ DestroyWindowProcPtr DestroyWindow; ++ RealizeWindowProcPtr RealizeWindow; ++ UnrealizeWindowProcPtr UnrealizeWindow; ++ SetWindowPixmapProcPtr SetWindowPixmap; ++ MoveWindowProcPtr MoveWindow; ++ miPointerSpriteFuncPtr sprite_funcs; ++}; ++ ++struct xwl_output { ++ struct wl_output *output; ++ struct xwl_screen *xwl_screen; ++ int32_t x, y, width, height; ++ xf86Monitor xf86monitor; ++ xf86OutputPtr xf86output; ++ xf86CrtcPtr xf86crtc; ++}; ++ ++ ++#define MODIFIER_META 0x01 ++ ++struct xwl_seat { ++ DeviceIntPtr pointer; ++ DeviceIntPtr keyboard; ++ struct xwl_screen *xwl_screen; ++ struct wl_seat *seat; ++ struct wl_pointer *wl_pointer; ++ struct wl_keyboard *wl_keyboard; ++ struct wl_array keys; ++ struct wl_surface *cursor; ++ struct xwl_window *focus_window; ++ uint32_t id; ++ uint32_t pointer_enter_serial; ++ struct xorg_list link; ++ CursorPtr x_cursor; ++ ++ wl_fixed_t horizontal_scroll; ++ wl_fixed_t vertical_scroll; ++ uint32_t scroll_time; ++ ++ size_t keymap_size; ++ char *keymap; ++ ++}; ++ ++ ++struct xwl_screen *xwl_screen_get(ScreenPtr screen); ++ ++void xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrninfo); ++ ++int xwl_screen_init_cursor(struct xwl_screen *xwl_screen, ScreenPtr screen); ++int xwl_screen_init_window(struct xwl_screen *xwl_screen, ScreenPtr screen); ++ ++struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen); ++ ++void xwl_input_teardown(pointer p); ++pointer xwl_input_setup(pointer module, pointer opts, int *errmaj, int *errmin); ++void xwl_input_init(struct xwl_screen *screen); ++ ++Bool xwl_drm_initialised(struct xwl_screen *screen); ++ ++void xwl_seat_set_cursor(struct xwl_seat *xwl_seat); ++ ++extern const struct xserver_listener xwl_server_listener; ++ ++#endif /* _XWAYLAND_PRIVATE_H_ */ +diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c +new file mode 100644 +index 0000000..d56e0d0 +--- /dev/null ++++ b/hw/xfree86/xwayland/xwayland-window.c +@@ -0,0 +1,317 @@ ++/* ++ * Copyright © 2011 Intel Corporation ++ * ++ * Permission to use, copy, modify, distribute, and sell this software ++ * and its documentation for any purpose is hereby granted without ++ * fee, provided that the above copyright notice appear in all copies ++ * and that both that copyright notice and this permission notice ++ * appear in supporting documentation, and that the name of the ++ * copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#ifdef HAVE_XORG_CONFIG_H ++#include "xorg-config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "xwayland.h" ++#include "xwayland-private.h" ++#include "xserver-client-protocol.h" ++ ++static DevPrivateKeyRec xwl_window_private_key; ++ ++static void ++free_pixmap(void *data, struct wl_callback *callback, uint32_t time) ++{ ++ PixmapPtr pixmap = data; ++ ScreenPtr screen = pixmap->drawable.pScreen; ++ ++ (*screen->DestroyPixmap)(pixmap); ++ wl_callback_destroy(callback); ++} ++ ++static const struct wl_callback_listener free_pixmap_listener = { ++ free_pixmap, ++}; ++ ++static void ++xwl_window_attach(struct xwl_window *xwl_window, PixmapPtr pixmap) ++{ ++ struct xwl_screen *xwl_screen = xwl_window->xwl_screen; ++ struct wl_callback *callback; ++ ++ /* We can safely destroy the buffer because we only use one buffer ++ * per surface in xwayland model */ ++ if (xwl_window->buffer) ++ wl_buffer_destroy(xwl_window->buffer); ++ ++ xwl_screen->driver->create_window_buffer(xwl_window, pixmap); ++ ++ if (!xwl_window->buffer) { ++ ErrorF("failed to create buffer\n"); ++ return; ++ } ++ ++ wl_surface_attach(xwl_window->surface, xwl_window->buffer, 0, 0); ++ wl_surface_damage(xwl_window->surface, 0, 0, ++ pixmap->drawable.width, ++ pixmap->drawable.height); ++ wl_surface_commit(xwl_window->surface); ++ ++ callback = wl_display_sync(xwl_screen->display); ++ wl_callback_add_listener(callback, &free_pixmap_listener, pixmap); ++ pixmap->refcnt++; ++} ++ ++static Bool ++xwl_create_window(WindowPtr window) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ struct xwl_screen *xwl_screen; ++ char buffer[32]; ++ int len, rc; ++ Atom name; ++ Bool ret; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ screen->CreateWindow = xwl_screen->CreateWindow; ++ ret = (*screen->CreateWindow)(window); ++ xwl_screen->CreateWindow = screen->CreateWindow; ++ screen->CreateWindow = xwl_create_window; ++ ++ if (!(xwl_screen->flags & XWL_FLAGS_ROOTLESS) || ++ window->parent != NULL) ++ return ret; ++ ++ CompositeRedirectSubwindows(window, CompositeRedirectManual); ++ ++ return ret; ++} ++ ++static int ++xwl_destroy_window (WindowPtr window) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ struct xwl_screen *xwl_screen; ++ Bool ret; ++ ++ if (window->parent == NULL) ++ CompositeUnRedirectSubwindows (window, CompositeRedirectManual); ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ screen->DestroyWindow = xwl_screen->DestroyWindow; ++ ret = (*screen->DestroyWindow)(window); ++ xwl_screen->DestroyWindow = screen->DestroyWindow; ++ screen->DestroyWindow = xwl_destroy_window; ++ ++ return ret; ++} ++ ++static void ++damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) ++{ ++ struct xwl_window *xwl_window = data; ++ struct xwl_screen *xwl_screen = xwl_window->xwl_screen; ++ ++ xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list); ++} ++ ++static void ++damage_destroy(DamagePtr pDamage, void *data) ++{ ++} ++ ++static Bool ++xwl_realize_window(WindowPtr window) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ struct xwl_screen *xwl_screen; ++ struct xwl_window *xwl_window; ++ Bool ret; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ screen->RealizeWindow = xwl_screen->RealizeWindow; ++ ret = (*screen->RealizeWindow)(window); ++ xwl_screen->RealizeWindow = xwl_screen->RealizeWindow; ++ screen->RealizeWindow = xwl_realize_window; ++ ++ if (xwl_screen->flags & XWL_FLAGS_ROOTLESS) { ++ if (window->redirectDraw != RedirectDrawManual) ++ return ret; ++ } else { ++ if (window->parent) ++ return ret; ++ } ++ ++ xwl_window = calloc(sizeof *xwl_window, 1); ++ xwl_window->xwl_screen = xwl_screen; ++ xwl_window->window = window; ++ xwl_window->surface = ++ wl_compositor_create_surface(xwl_screen->compositor); ++ if (xwl_window->surface == NULL) { ++ ErrorF("wl_display_create_surface failed\n"); ++ return FALSE; ++ } ++ ++ if (xwl_screen->xorg_server) ++ xserver_set_window_id(xwl_screen->xorg_server, ++ xwl_window->surface, window->drawable.id); ++ ++ wl_surface_set_user_data(xwl_window->surface, xwl_window); ++ xwl_window_attach(xwl_window, (*screen->GetWindowPixmap)(window)); ++ ++ dixSetPrivate(&window->devPrivates, ++ &xwl_window_private_key, xwl_window); ++ ++ xwl_window->damage = ++ DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty, ++ FALSE, screen, xwl_window); ++ DamageRegister(&window->drawable, xwl_window->damage); ++ DamageSetReportAfterOp(xwl_window->damage, TRUE); ++ ++ xorg_list_add(&xwl_window->link, &xwl_screen->window_list); ++ xorg_list_init(&xwl_window->link_damage); ++ ++ return ret; ++} ++ ++static Bool ++xwl_unrealize_window(WindowPtr window) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ struct xwl_screen *xwl_screen; ++ struct xwl_window *xwl_window; ++ struct xwl_seat *xwl_seat; ++ Bool ret; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ xorg_list_for_each_entry(xwl_seat, ++ &xwl_screen->seat_list, link) { ++ if (!xwl_seat->focus_window) ++ continue ; ++ if (xwl_seat->focus_window->window == window) { ++ xwl_seat->focus_window = NULL; ++ SetDeviceRedirectWindow(xwl_seat->pointer, PointerRootWin); ++ } ++ } ++ ++ screen->UnrealizeWindow = xwl_screen->UnrealizeWindow; ++ ret = (*screen->UnrealizeWindow)(window); ++ xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; ++ screen->UnrealizeWindow = xwl_unrealize_window; ++ ++ xwl_window = ++ dixLookupPrivate(&window->devPrivates, &xwl_window_private_key); ++ if (!xwl_window) ++ return ret; ++ ++ if (xwl_window->buffer) ++ wl_buffer_destroy(xwl_window->buffer); ++ wl_surface_destroy(xwl_window->surface); ++ xorg_list_del(&xwl_window->link); ++ if (RegionNotEmpty(DamageRegion(xwl_window->damage))) ++ xorg_list_del(&xwl_window->link_damage); ++ DamageUnregister(&window->drawable, xwl_window->damage); ++ DamageDestroy(xwl_window->damage); ++ free(xwl_window); ++ dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL); ++ ++ return ret; ++} ++ ++static void ++xwl_set_window_pixmap(WindowPtr window, PixmapPtr pixmap) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ struct xwl_screen *xwl_screen; ++ struct xwl_window *xwl_window; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ screen->SetWindowPixmap = xwl_screen->SetWindowPixmap; ++ (*screen->SetWindowPixmap)(window, pixmap); ++ xwl_screen->SetWindowPixmap = screen->SetWindowPixmap; ++ screen->SetWindowPixmap = xwl_set_window_pixmap; ++ ++ xwl_window = ++ dixLookupPrivate(&window->devPrivates, &xwl_window_private_key); ++ if (xwl_window) ++ xwl_window_attach(xwl_window, pixmap); ++} ++ ++static void ++xwl_move_window(WindowPtr window, int x, int y, ++ WindowPtr sibling, VTKind kind) ++{ ++ ScreenPtr screen = window->drawable.pScreen; ++ struct xwl_screen *xwl_screen; ++ struct xwl_window *xwl_window; ++ ++ xwl_screen = xwl_screen_get(screen); ++ ++ screen->MoveWindow = xwl_screen->MoveWindow; ++ (*screen->MoveWindow)(window, x, y, sibling, kind); ++ xwl_screen->MoveWindow = screen->MoveWindow; ++ screen->MoveWindow = xwl_move_window; ++ ++ xwl_window = ++ dixLookupPrivate(&window->devPrivates, &xwl_window_private_key); ++ if (xwl_window == NULL) ++ return; ++} ++ ++int ++xwl_screen_init_window(struct xwl_screen *xwl_screen, ScreenPtr screen) ++{ ++ if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0)) ++ return BadAlloc; ++ ++ xwl_screen->CreateWindow = screen->CreateWindow; ++ screen->CreateWindow = xwl_create_window; ++ ++ xwl_screen->DestroyWindow = screen->DestroyWindow; ++ screen->DestroyWindow = xwl_destroy_window; ++ ++ xwl_screen->RealizeWindow = screen->RealizeWindow; ++ screen->RealizeWindow = xwl_realize_window; ++ ++ xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; ++ screen->UnrealizeWindow = xwl_unrealize_window; ++ ++ xwl_screen->SetWindowPixmap = screen->SetWindowPixmap; ++ screen->SetWindowPixmap = xwl_set_window_pixmap; ++ ++ xwl_screen->MoveWindow = screen->MoveWindow; ++ screen->MoveWindow = xwl_move_window; ++ ++ return Success; ++} +diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c +new file mode 100644 +index 0000000..f59bfe4 +--- /dev/null ++++ b/hw/xfree86/xwayland/xwayland.c +@@ -0,0 +1,392 @@ ++/* ++ * Copyright © 2008-2011 Kristian Høgsberg ++ * ++ * Permission to use, copy, modify, distribute, and sell this software ++ * and its documentation for any purpose is hereby granted without ++ * fee, provided that the above copyright notice appear in all copies ++ * and that both that copyright notice and this permission notice ++ * appear in supporting documentation, and that the name of the ++ * copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#ifdef HAVE_XORG_CONFIG_H ++#include "xorg-config.h" ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "xwayland.h" ++#include "xwayland-private.h" ++#include "xserver-client-protocol.h" ++ ++/* ++ * TODO: ++ * - lose X kb focus when wayland surface loses it ++ * - active grabs, grab owner crack ++ */ ++ ++static DevPrivateKeyRec xwl_screen_private_key; ++static Atom xdnd_atom; ++ ++static void ++xserver_client(void *data, struct xserver *xserver, int fd) ++{ ++ AddClientOnOpenFD(fd); ++} ++ ++static void ++xserver_listen_socket(void *data, struct xserver *xserver, int fd) ++{ ++ ListenOnOpenFD(fd, TRUE); ++} ++ ++const struct xserver_listener xwl_server_listener = { ++ xserver_client, ++ xserver_listen_socket ++}; ++ ++static void ++xwl_input_delayed_init(void *data, struct wl_callback *callback, uint32_t time) ++{ ++ struct xwl_screen *xwl_screen = data; ++ ++ ErrorF("xwl_input_delayed_init\n"); ++ ++ wl_callback_destroy(callback); ++ xwl_input_init(xwl_screen); ++} ++ ++static const struct wl_callback_listener delayed_init_listner = { ++ xwl_input_delayed_init ++}; ++ ++static void ++registry_global(void *data, struct wl_registry *registry, uint32_t id, ++ const char *interface, uint32_t version) ++{ ++ struct xwl_screen *xwl_screen = data; ++ ++ if (strcmp (interface, "wl_compositor") == 0) { ++ xwl_screen->compositor = ++ wl_registry_bind(registry, id, &wl_compositor_interface, 1); ++ } else if (strcmp(interface, "wl_shm") == 0) { ++ xwl_screen->shm = ++ wl_registry_bind(registry, id, &wl_shm_interface, 1); ++ } ++} ++ ++static const struct wl_registry_listener registry_listener = { ++ registry_global, ++}; ++ ++static void ++wakeup_handler(pointer data, int err, pointer read_mask) ++{ ++ struct xwl_screen *xwl_screen = data; ++ int ret; ++ ++ if (err < 0) ++ return; ++ ++ if (!FD_ISSET(xwl_screen->wayland_fd, (fd_set *) read_mask)) ++ return; ++ ++ ret = wl_display_dispatch(xwl_screen->display); ++ if (ret == -1) ++ FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); ++} ++ ++static void ++block_handler(pointer data, struct timeval **tv, pointer read_mask) ++{ ++ struct xwl_screen *xwl_screen = data; ++ int ret; ++ ++ ret = wl_display_dispatch_pending(xwl_screen->display); ++ if (ret == -1) ++ FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); ++ ++ ret = wl_display_flush(xwl_screen->display); ++ if (ret == -1) ++ FatalError("failed to write to XWayland fd: %s\n", strerror(errno)); ++} ++ ++int ++xwl_screen_init(struct xwl_screen *xwl_screen, ScreenPtr screen) ++{ ++ struct wl_callback *callback; ++ ++ xwl_screen->screen = screen; ++ ++ if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0)) ++ return BadAlloc; ++ ++ dixSetPrivate(&screen->devPrivates, ++ &xwl_screen_private_key, xwl_screen); ++ ++ xwl_screen_init_window(xwl_screen, screen); ++ ++ xwl_screen_init_cursor(xwl_screen, screen); ++ ++ AddGeneralSocket(xwl_screen->wayland_fd); ++ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen); ++ ++ callback = wl_display_sync(xwl_screen->display); ++ wl_callback_add_listener(callback, &delayed_init_listner, xwl_screen); ++ ++ return Success; ++} ++ ++struct xwl_screen * ++xwl_screen_get(ScreenPtr screen) ++{ ++ return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key); ++} ++ ++static void ++xwayland_selection_callback(CallbackListPtr *callbacks, ++ pointer data, pointer args) ++{ ++ SelectionInfoRec *info = (SelectionInfoRec *) args; ++ Selection *selection = info->selection; ++ ++ switch (info->kind) { ++ case SelectionSetOwner: ++ if (selection->selection == xdnd_atom) { ++ if (selection->window != None) ++ ErrorF("client %p starts dnd\n", info->client); ++ else ++ ErrorF("client %p stops dnd\n", info->client); ++ } ++ break; ++ case SelectionWindowDestroy: ++ ErrorF("selection window destroy\n"); ++ break; ++ case SelectionClientClose: ++ ErrorF("selection client close\n"); ++ break; ++ } ++} ++ ++struct xwl_screen * ++xwl_screen_create(void) ++{ ++ struct xwl_screen *xwl_screen; ++ ++ xwl_screen = calloc(sizeof *xwl_screen, 1); ++ if (xwl_screen == NULL) { ++ ErrorF("calloc failed\n"); ++ return NULL; ++ } ++ ++ xwl_screen->display = wl_display_connect(NULL); ++ if (xwl_screen->display == NULL) { ++ ErrorF("wl_display_create failed\n"); ++ return NULL; ++ } ++ ++ return xwl_screen; ++} ++ ++Bool ++xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen, ++ uint32_t flags, struct xwl_driver *driver) ++{ ++ int ret; ++ ++ noScreenSaverExtension = TRUE; ++ ++ xdnd_atom = MakeAtom("XdndSelection", 13, 1); ++ if (!AddCallback(&SelectionCallback, ++ xwayland_selection_callback, xwl_screen)) { ++ return FALSE; ++ } ++ ++ xorg_list_init(&xwl_screen->seat_list); ++ xorg_list_init(&xwl_screen->damage_window_list); ++ xorg_list_init(&xwl_screen->window_list); ++ xorg_list_init(&xwl_screen->authenticate_client_list); ++ xwl_screen->scrninfo = scrninfo; ++ xwl_screen->driver = driver; ++ xwl_screen->flags = flags; ++ xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display); ++ ++ if (xorgRootless) ++ xwl_screen->flags |= XWL_FLAGS_ROOTLESS; ++ ++ /* Set up listener so we'll catch all events. */ ++ xwl_screen->registry = wl_display_get_registry(xwl_screen->display); ++ wl_registry_add_listener(xwl_screen->registry, ®istry_listener, ++ xwl_screen); ++ ret = wl_display_roundtrip(xwl_screen->display); ++ if (ret == -1) { ++ xf86DrvMsg(scrninfo->scrnIndex, X_ERROR, ++ "failed to dispatch Wayland events: %s\n", strerror(errno)); ++ return FALSE; ++ } ++ ++#ifdef WITH_LIBDRM ++ if (xwl_screen->driver->use_drm && !xwl_drm_initialised(xwl_screen)) ++ if (xwl_drm_pre_init(xwl_screen) != Success) ++ return FALSE; ++#endif ++ ++ xwayland_screen_preinit_output(xwl_screen, scrninfo); ++ ++ return TRUE; ++} ++ ++int ++xwl_create_window_buffer_shm(struct xwl_window *xwl_window, ++ PixmapPtr pixmap, int fd) ++{ ++ struct wl_shm_pool *pool; ++ int size, stride; ++ ++ stride = pixmap->drawable.width * 4; ++ ++ size = pixmap->drawable.width * pixmap->drawable.height * 4; ++ pool = wl_shm_create_pool(xwl_window->xwl_screen->shm, fd, size); ++ xwl_window->buffer = wl_shm_pool_create_buffer(pool, 0, ++ pixmap->drawable.width, ++ pixmap->drawable.height, ++ stride, WL_SHM_FORMAT_ARGB8888); ++ wl_shm_pool_destroy(pool); ++ ++ return xwl_window->buffer ? Success : BadDrawable; ++} ++ ++void xwl_screen_close(struct xwl_screen *xwl_screen) ++{ ++ struct xwl_seat *xwl_seat, *itmp; ++ struct xwl_window *xwl_window, *wtmp; ++ ++ if (xwl_screen->registry) ++ wl_registry_destroy(xwl_screen->registry); ++ xwl_screen->registry = NULL; ++ ++ xorg_list_for_each_entry_safe(xwl_seat, itmp, ++ &xwl_screen->seat_list, link) { ++ wl_seat_destroy(xwl_seat->seat); ++ free(xwl_seat); ++ } ++ xorg_list_for_each_entry_safe(xwl_window, wtmp, ++ &xwl_screen->window_list, link) { ++ wl_buffer_destroy(xwl_window->buffer); ++ wl_surface_destroy(xwl_window->surface); ++ free(xwl_window); ++ } ++ ++ xorg_list_init(&xwl_screen->seat_list); ++ xorg_list_init(&xwl_screen->damage_window_list); ++ xorg_list_init(&xwl_screen->window_list); ++ xorg_list_init(&xwl_screen->authenticate_client_list); ++ ++ wl_display_roundtrip(xwl_screen->display); ++} ++ ++void xwl_screen_destroy(struct xwl_screen *xwl_screen) ++{ ++ if (xwl_screen->xwl_output) { ++ xf86OutputDestroy(xwl_screen->xwl_output->xf86output); ++ xf86CrtcDestroy(xwl_screen->xwl_output->xf86crtc); ++ } ++ ++ free(xwl_screen->xwl_output); ++ free(xwl_screen); ++} ++ ++/* DDX driver must call this after submitting the rendering */ ++void xwl_screen_post_damage(struct xwl_screen *xwl_screen) ++{ ++ struct xwl_window *xwl_window; ++ RegionPtr region; ++ BoxPtr box; ++ int count, i; ++ ++ xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list, ++ link_damage) { ++ ++ region = DamageRegion(xwl_window->damage); ++ count = RegionNumRects(region); ++ for (i = 0; i < count; i++) { ++ box = &RegionRects(region)[i]; ++ wl_surface_damage(xwl_window->surface, ++ box->x1, box->y1, ++ box->x2 - box->x1 + 1, ++ box->y2 - box->y1 + 1); ++ } ++ wl_surface_attach(xwl_window->surface, ++ xwl_window->buffer, ++ 0, 0); ++ wl_surface_commit(xwl_window->surface); ++ DamageEmpty(xwl_window->damage); ++ } ++ ++ xorg_list_init(&xwl_screen->damage_window_list); ++} ++ ++static pointer ++xwl_setup(pointer module, pointer opts, int *errmaj, int *errmin) ++{ ++ return xwl_input_setup(module, opts, errmaj, errmin); ++} ++ ++static void ++xwl_teardown(pointer p) ++{ ++ xwl_input_teardown(p); ++} ++ ++static XF86ModuleVersionInfo xwl_version_info = { ++ "xwayland", ++ MODULEVENDORSTRING, ++ MODINFOSTRING1, ++ MODINFOSTRING2, ++ XORG_VERSION_CURRENT, ++ 1, 0, 0, ++ ABI_CLASS_EXTENSION, ++ ABI_EXTENSION_VERSION, ++ MOD_CLASS_NONE, ++ { 0, 0, 0, 0 } ++}; ++ ++_X_EXPORT const XF86ModuleData xwaylandModuleData = { ++ &xwl_version_info, ++ &xwl_setup, ++ &xwl_teardown ++}; ++ ++int ++xwl_version(void) ++{ ++ return xwl_version_info.minorversion; ++} +diff --git a/hw/xfree86/xwayland/xwayland.h b/hw/xfree86/xwayland/xwayland.h +new file mode 100644 +index 0000000..f268366 +--- /dev/null ++++ b/hw/xfree86/xwayland/xwayland.h +@@ -0,0 +1,83 @@ ++/* ++ * Copyright © 2008 Kristian Høgsberg ++ * ++ * Permission to use, copy, modify, distribute, and sell this software ++ * and its documentation for any purpose is hereby granted without ++ * fee, provided that the above copyright notice appear in all copies ++ * and that both that copyright notice and this permission notice ++ * appear in supporting documentation, and that the name of the ++ * copyright holders not be used in advertising or publicity ++ * pertaining to distribution of the software without specific, ++ * written prior permission. The copyright holders make no ++ * representations about the suitability of this software for any ++ * purpose. It is provided "as is" without express or implied ++ * warranty. ++ * ++ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS ++ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND ++ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ++ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING ++ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS ++ * SOFTWARE. ++ */ ++ ++#ifndef _XWAYLAND_H_ ++#define _XWAYLAND_H_ ++ ++#define XWL_VERSION 2 ++ ++struct xwl_window; ++struct xwl_screen; ++ ++struct xwl_driver { ++ int version; ++ int use_drm; ++ int (*create_window_buffer)(struct xwl_window *xwl_window, ++ PixmapPtr pixmap); ++}; ++ ++#define XWL_FLAGS_ROOTLESS 0x01 ++ ++extern _X_EXPORT int ++xwl_version(void); ++ ++extern _X_EXPORT struct xwl_screen * ++xwl_screen_create(void); ++ ++extern _X_EXPORT Bool ++xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen, ++ uint32_t flags, struct xwl_driver *driver); ++ ++extern _X_EXPORT int ++xwl_screen_init(struct xwl_screen *xwl_screen, ScreenPtr screen); ++ ++extern _X_EXPORT int ++xwl_drm_pre_init(struct xwl_screen *xwl_screen); ++ ++extern _X_EXPORT int ++xwl_screen_get_drm_fd(struct xwl_screen *xwl_screen); ++ ++extern _X_EXPORT void ++xwl_screen_close(struct xwl_screen *xwl_screen); ++ ++extern _X_EXPORT void ++xwl_screen_destroy(struct xwl_screen *xwl_screen); ++ ++extern _X_EXPORT void ++xwl_screen_post_damage(struct xwl_screen *xwl_screen); ++ ++extern _X_EXPORT int ++xwl_drm_authenticate(ClientPtr client, struct xwl_screen *xwl_screen, ++ uint32_t magic); ++ ++extern _X_EXPORT int ++xwl_create_window_buffer_drm(struct xwl_window *xwl_window, ++ PixmapPtr pixmap, uint32_t name); ++ ++extern _X_EXPORT int ++xwl_create_window_buffer_shm(struct xwl_window *xwl_window, ++ PixmapPtr pixmap, int fd); ++ ++#endif /* _XWAYLAND_H_ */ +diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in +index 0c651bf..7f6eba2 100644 +--- a/include/xorg-server.h.in ++++ b/include/xorg-server.h.in +@@ -224,4 +224,7 @@ + /* Use XTrans FD passing support */ + #undef XTRANS_SEND_FDS + ++/* Building Xorg server. */ ++#undef XORG_WAYLAND ++ + #endif /* _XORG_SERVER_H_ */ +-- +1.8.4.2 + diff --git a/SOURCES/0010-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch b/SOURCES/0010-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch deleted file mode 100644 index 8058431..0000000 --- a/SOURCES/0010-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch +++ /dev/null @@ -1,144 +0,0 @@ -From 995cadad451bce76a211b1b2f366c41efa1a8c65 Mon Sep 17 00:00:00 2001 -From: Tiago Vignatti -Date: Wed, 21 Aug 2013 21:23:09 -0700 -Subject: [PATCH 10/39] dri2: Introduce a third version of the AuthMagic - function - -This most recent version takes a client pointer to allow xwayland to -asynchronously authenticate a client. ---- - hw/xfree86/dri2/dri2.c | 12 ++++++++---- - hw/xfree86/dri2/dri2.h | 7 +++++++ - hw/xfree86/dri2/dri2ext.c | 27 +++++++++++++++++++-------- - 3 files changed, 34 insertions(+), 12 deletions(-) - -diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c -index 0b047f0..efdcd66 100644 ---- a/hw/xfree86/dri2/dri2.c -+++ b/hw/xfree86/dri2/dri2.c -@@ -121,8 +121,9 @@ typedef struct _DRI2Screen { - DRI2ScheduleSwapProcPtr ScheduleSwap; - DRI2GetMSCProcPtr GetMSC; - DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; -- DRI2AuthMagic2ProcPtr AuthMagic; - DRI2AuthMagicProcPtr LegacyAuthMagic; -+ DRI2AuthMagic2ProcPtr LegacyAuthMagic2; -+ DRI2AuthMagic3ProcPtr AuthMagic; - DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; - DRI2SwapLimitValidateProcPtr SwapLimitValidate; - DRI2GetParamProcPtr GetParam; -@@ -1352,7 +1353,7 @@ DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic) - return FALSE; - - primescreen = GetScreenPrime(pScreen, dri2_client->prime_id); -- if ((*ds->AuthMagic)(primescreen, magic)) -+ if ((*ds->AuthMagic)(client, primescreen, magic)) - return FALSE; - return TRUE; - } -@@ -1457,8 +1458,11 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) - cur_minor = 1; - } - -+ if (info->version >= 10) { -+ ds->AuthMagic = info->AuthMagic3; -+ } - if (info->version >= 8) { -- ds->AuthMagic = info->AuthMagic2; -+ ds->LegacyAuthMagic2 = info->AuthMagic2; - } - if (info->version >= 5) { - ds->LegacyAuthMagic = info->AuthMagic; -@@ -1497,7 +1501,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) - * If the driver doesn't provide an AuthMagic function - * it relies on the old method (using libdrm) or fails - */ -- if (!ds->LegacyAuthMagic) -+ if (!ds->LegacyAuthMagic2 && !ds->LegacyAuthMagic) - #ifdef WITH_LIBDRM - ds->LegacyAuthMagic = drmAuthMagic; - #else -diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h -index 1e7afdd..38b4f58 100644 ---- a/hw/xfree86/dri2/dri2.h -+++ b/hw/xfree86/dri2/dri2.h -@@ -65,6 +65,8 @@ typedef void (*DRI2CopyRegionProcPtr) (DrawablePtr pDraw, - typedef void (*DRI2WaitProcPtr) (WindowPtr pWin, unsigned int sequence); - typedef int (*DRI2AuthMagicProcPtr) (int fd, uint32_t magic); - typedef int (*DRI2AuthMagic2ProcPtr) (ScreenPtr pScreen, uint32_t magic); -+typedef int (*DRI2AuthMagic3ProcPtr) (ClientPtr client, -+ ScreenPtr pScreen, uint32_t magic); - - /** - * Schedule a buffer swap -@@ -252,6 +254,9 @@ typedef struct { - DRI2CreateBuffer2ProcPtr CreateBuffer2; - DRI2DestroyBuffer2ProcPtr DestroyBuffer2; - DRI2CopyRegion2ProcPtr CopyRegion2; -+ -+ /* added in version 10 */ -+ DRI2AuthMagic3ProcPtr AuthMagic3; - } DRI2InfoRec, *DRI2InfoPtr; - - extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info); -@@ -268,6 +273,8 @@ extern _X_EXPORT Bool DRI2Connect(ClientPtr client, ScreenPtr pScreen, - - extern _X_EXPORT Bool DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic); - -+extern _X_EXPORT void DRI2SendAuthReply(ClientPtr client, Bool status); -+ - extern _X_EXPORT int DRI2CreateDrawable(ClientPtr client, - DrawablePtr pDraw, - XID id, -diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c -index e1decec..4ab0186 100644 ---- a/hw/xfree86/dri2/dri2ext.c -+++ b/hw/xfree86/dri2/dri2ext.c -@@ -136,11 +136,23 @@ ProcDRI2Connect(ClientPtr client) - return Success; - } - -+void -+DRI2SendAuthReply(ClientPtr client, Bool status) -+{ -+ xDRI2AuthenticateReply rep = { -+ .type = X_Reply, -+ .sequenceNumber = client->sequence, -+ .length = 0, -+ .authenticated = status -+ }; -+ -+ WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep); -+} -+ - static int - ProcDRI2Authenticate(ClientPtr client) - { - REQUEST(xDRI2AuthenticateReq); -- xDRI2AuthenticateReply rep; - DrawablePtr pDraw; - int status; - -@@ -149,13 +161,12 @@ ProcDRI2Authenticate(ClientPtr client) - &pDraw, &status)) - return status; - -- rep = (xDRI2AuthenticateReply) { -- .type = X_Reply, -- .sequenceNumber = client->sequence, -- .length = 0, -- .authenticated = DRI2Authenticate(client, pDraw->pScreen, stuff->magic) -- }; -- WriteToClient(client, sizeof(xDRI2AuthenticateReply), &rep); -+ status = DRI2Authenticate(client, pDraw->pScreen, stuff->magic); -+ -+ /* if non-blocking authentication is in progress, then don't send a reply -+ * now but later in the implementation (e.g. drm_handle_authenticated) */ -+ if (client->ignoreCount == 0) -+ DRI2SendAuthReply(client, status); - - return Success; - } --- -1.8.3.1 - diff --git a/SOURCES/0010-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch b/SOURCES/0010-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch new file mode 100644 index 0000000..b3c155a --- /dev/null +++ b/SOURCES/0010-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch @@ -0,0 +1,49 @@ +From b50ab974f639e02f878e608bf7f6097be7fbc60c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Wed, 21 Aug 2013 23:02:58 -0700 +Subject: [PATCH 10/38] xwayland: Add a HW_WAYLAND flag to let drivers + explicitly opt-in + +--- + hw/xfree86/common/xf86Init.c | 11 +++++++---- + hw/xfree86/common/xf86str.h | 1 + + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index 98adaab..2d3bb01 100644 +--- a/hw/xfree86/common/xf86Init.c ++++ b/hw/xfree86/common/xf86Init.c +@@ -547,11 +547,14 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) + if (!(flags & HW_SKIP_CONSOLE)) + xorgHWOpenConsole = TRUE; + +- if (xorgWayland && +- (NEED_IO_ENABLED(flags) || !(flags & HW_SKIP_CONSOLE))) { ++ if (xorgWayland) { ++ if (flags != HW_WAYLAND) { ++ xf86DeleteDriver(i); ++ continue; ++ } + +- xf86DeleteDriver(i); +- continue; ++ want_hw_access = FALSE; ++ xorgHWOpenConsole = FALSE; + } + } + +diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h +index 4c2d147..976fa30 100644 +--- a/hw/xfree86/common/xf86str.h ++++ b/hw/xfree86/common/xf86str.h +@@ -288,6 +288,7 @@ typedef struct { + #define HW_MMIO 2 + #define HW_SKIP_CONSOLE 4 + #define NEED_IO_ENABLED(x) (x & HW_IO) ++#define HW_WAYLAND 8 + + typedef CARD32 xorgHWFlags; + +-- +1.8.4.2 + diff --git a/SOURCES/0011-Add-xwayland-module.patch b/SOURCES/0011-Add-xwayland-module.patch deleted file mode 100644 index e40fa57..0000000 --- a/SOURCES/0011-Add-xwayland-module.patch +++ /dev/null @@ -1,2904 +0,0 @@ -From 0831ea9c83af12f497093e2566d94f75c3ba202f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 18 Sep 2009 22:08:16 -0400 -Subject: [PATCH 11/39] Add xwayland module -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Squashed and rebased from the xwayland-1.12 branch. Contributions from - - Christopher James Halse Rogers - Corentin Chary - Daniel Stone - Kristian Høgsberg - Robert Bragg - Scott Moreau - Tiago Vignatti ---- - configure.ac | 15 + - hw/xfree86/Makefile.am | 8 +- - hw/xfree86/common/xf86Config.c | 28 +- - hw/xfree86/common/xf86Globals.c | 2 + - hw/xfree86/common/xf86Init.c | 20 ++ - hw/xfree86/common/xf86Priv.h | 2 + - hw/xfree86/dri2/dri2.c | 7 +- - hw/xfree86/dri2/dri2.h | 2 +- - hw/xfree86/xwayland/Makefile.am | 44 +++ - hw/xfree86/xwayland/drm.xml | 139 ++++++++ - hw/xfree86/xwayland/xserver.xml | 18 + - hw/xfree86/xwayland/xwayland-cursor.c | 241 +++++++++++++ - hw/xfree86/xwayland/xwayland-drm.c | 235 +++++++++++++ - hw/xfree86/xwayland/xwayland-input.c | 610 +++++++++++++++++++++++++++++++++ - hw/xfree86/xwayland/xwayland-output.c | 309 +++++++++++++++++ - hw/xfree86/xwayland/xwayland-private.h | 132 +++++++ - hw/xfree86/xwayland/xwayland-window.c | 316 +++++++++++++++++ - hw/xfree86/xwayland/xwayland.c | 392 +++++++++++++++++++++ - hw/xfree86/xwayland/xwayland.h | 83 +++++ - include/xorg-server.h.in | 3 + - 20 files changed, 2597 insertions(+), 9 deletions(-) - create mode 100644 hw/xfree86/xwayland/Makefile.am - create mode 100644 hw/xfree86/xwayland/drm.xml - create mode 100644 hw/xfree86/xwayland/xserver.xml - create mode 100644 hw/xfree86/xwayland/xwayland-cursor.c - create mode 100644 hw/xfree86/xwayland/xwayland-drm.c - create mode 100644 hw/xfree86/xwayland/xwayland-input.c - create mode 100644 hw/xfree86/xwayland/xwayland-output.c - create mode 100644 hw/xfree86/xwayland/xwayland-private.h - create mode 100644 hw/xfree86/xwayland/xwayland-window.c - create mode 100644 hw/xfree86/xwayland/xwayland.c - create mode 100644 hw/xfree86/xwayland/xwayland.h - -diff --git a/configure.ac b/configure.ac -index 9fb014f..c146b7b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -635,6 +635,7 @@ AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg - AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes]) - AC_ARG_ENABLE(linux_acpi, AC_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes]) - AC_ARG_ENABLE(linux_apm, AC_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes]) -+AC_ARG_ENABLE(wayland, AS_HELP_STRING([--disable-wayland], [Build Wayland extension (default: enabled)]), [WAYLAND=$enableval], [WAYLAND=yes]) - - dnl DDXes. - AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto]) -@@ -1023,6 +1024,14 @@ fi - if test "x$MITSHM" = xauto; then - MITSHM="$ac_cv_sysv_ipc" - fi -+ -+AM_CONDITIONAL(WAYLAND, [test "x$WAYLAND" = xyes]) -+if test "x$WAYLAND" = xyes; then -+ AC_DEFINE(XORG_WAYLAND, 1, [Support wayland mode]) -+ REQUIRED_MODULES="$REQUIRED_MODULES wayland-client" -+ WAYLAND_SCANNER_RULES(['$(top_srcdir)/hw/xfree86/xwayland']) -+fi -+ - AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes]) - if test "x$MITSHM" = xyes; then - AC_DEFINE(MITSHM, 1, [Support MIT-SHM extension]) -@@ -1118,6 +1127,7 @@ case "$DRI2,$HAVE_DRI2PROTO" in - esac - AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes) - -+<<<<<<< HEAD - PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO, - [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no]) - -@@ -1177,11 +1187,15 @@ esac - AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes) - - if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then -+======= -+if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$CONFIG_UDEV_KMS" = xyes || test "x$WAYLAND" = xyes ; then -+>>>>>>> Add xwayland module - if test "x$DRM" = xyes; then - AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support]) - PKG_CHECK_MODULES([LIBDRM], $LIBDRM) - fi - fi -+AM_CONDITIONAL(DRM, test "x$DRM" = xyes) - - if test "x$DRI2" = xyes; then - save_CFLAGS=$CFLAGS -@@ -2352,6 +2366,7 @@ hw/xfree86/dixmods/Makefile - hw/xfree86/doc/Makefile - hw/xfree86/dri/Makefile - hw/xfree86/dri2/Makefile -+hw/xfree86/xwayland/Makefile - hw/xfree86/exa/Makefile - hw/xfree86/exa/man/Makefile - hw/xfree86/fbdevhw/Makefile -diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am -index 485386f..ff04b25 100644 ---- a/hw/xfree86/Makefile.am -+++ b/hw/xfree86/Makefile.am -@@ -14,6 +14,10 @@ DRI3_BUILDDIR = $(top_builddir)/dri3 - DRI3_LIB = $(DRI3_BUILDDIR)/libdri3.la - endif - -+if WAYLAND -+WAYLAND_SUBDIR = xwayland -+endif -+ - if XF86UTILS - XF86UTILS_SUBDIR = utils - endif -@@ -32,12 +36,12 @@ endif - - SUBDIRS = common ddc x86emu $(INT10_SUBDIR) os-support parser \ - ramdac $(VGAHW_SUBDIR) loader modes $(DRI_SUBDIR) \ -- $(DRI2_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \ -+ $(DRI2_SUBDIR) $(WAYLAND_SUBDIR) . $(VBE_SUBDIR) i2c dixmods \ - fbdevhw shadowfb exa $(XF86UTILS_SUBDIR) doc man - - DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \ - parser ramdac shadowfb vbe vgahw \ -- loader dixmods dri dri2 exa modes \ -+ loader dixmods dri dri2 exa modes xwayland \ - utils doc man - - bin_PROGRAMS = Xorg -diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c -index 74d5ed3..39cd58c 100644 ---- a/hw/xfree86/common/xf86Config.c -+++ b/hw/xfree86/common/xf86Config.c -@@ -118,7 +118,8 @@ static ModuleDefault ModuleDefaults[] = { - {.name = "fb",.toLoad = TRUE,.load_opt = NULL}, - {.name = "shadow",.toLoad = TRUE,.load_opt = NULL}, - #endif -- {.name = NULL,.toLoad = FALSE,.load_opt = NULL} -+ {.name = "xwayland",.toLoad = FALSE,.load_opt=NULL}, -+ {.name = NULL,.toLoad = FALSE,.load_opt=NULL} - }; - - /* Forward declarations */ -@@ -260,6 +261,17 @@ xf86ModulelistFromConfig(pointer **optlist) - return NULL; - } - -+ /* -+ * Set the xwayland module to autoload if requested. -+ */ -+ if (xorgWayland) { -+ for (i=0 ; ModuleDefaults[i].name != NULL ; i++) { -+ if (strcmp(ModuleDefaults[i].name, "xwayland") == 0) { -+ ModuleDefaults[i].toLoad = TRUE; -+ } -+ } -+ } -+ - if (xf86configptr->conf_modules) { - /* Walk the disable list and let people know what we've parsed to - * not be loaded -@@ -863,6 +875,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) - } - xf86Msg(from, "%sutomatically adding GPU devices\n", - xf86Info.autoAddGPU ? "A" : "Not a"); -+ -+ /* FIXME: Do that at the right place (before xf86Msg). */ -+ if (xorgWayland) { -+ xf86Info.autoAddDevices = FALSE; -+ xf86Info.autoEnableDevices = FALSE; -+ } -+ - /* - * Set things up based on the config file information. Some of these - * settings may be overridden later when the command line options are -@@ -953,9 +972,10 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) - } - #endif - -- /* if we're not hotplugging, force some input devices to exist */ -- xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && -- xf86Info.autoEnableDevices); -+ if (xorgWayland) /* Don't force input devices */ -+ xf86Info.forceInputDevices = FALSE; -+ else /* if we're not hotplugging, force some input devices to exist */ -+ xf86Info.forceInputDevices = !(xf86Info.autoAddDevices && xf86Info.autoEnableDevices); - - /* when forcing input devices, we use kbd. otherwise evdev, so use the - * evdev rules set. */ -diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c -index 7df7a80..b41d2cc 100644 ---- a/hw/xfree86/common/xf86Globals.c -+++ b/hw/xfree86/common/xf86Globals.c -@@ -204,3 +204,5 @@ Bool xf86VidModeAllowNonLocal = FALSE; - #endif - RootWinPropPtr *xf86RegisteredPropertiesTable = NULL; - Bool xorgHWAccess = FALSE; -+Bool xorgWayland = FALSE; -+Bool xorgRootless = FALSE; -diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c -index 91ec4c8..98adaab 100644 ---- a/hw/xfree86/common/xf86Init.c -+++ b/hw/xfree86/common/xf86Init.c -@@ -546,6 +546,13 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) - - if (!(flags & HW_SKIP_CONSOLE)) - xorgHWOpenConsole = TRUE; -+ -+ if (xorgWayland && -+ (NEED_IO_ENABLED(flags) || !(flags & HW_SKIP_CONSOLE))) { -+ -+ xf86DeleteDriver(i); -+ continue; -+ } - } - - if (xorgHWOpenConsole) -@@ -957,6 +964,9 @@ InitInput(int argc, char **argv) - - mieqInit(); - -+ if (xorgWayland) -+ return; -+ - /* Initialize all configured input devices */ - for (pInfo = xf86ConfigLayout.inputs; pInfo && *pInfo; pInfo++) { - (*pInfo)->options = -@@ -1455,6 +1465,16 @@ ddxProcessArgument(int argc, char **argv, int i) - return 1; - } - -+ if (!strcmp(argv[i], "-wayland")) { -+ xorgWayland = TRUE; -+ return 1; -+ } -+ -+ if (!strcmp(argv[i], "-rootless")) { -+ xorgRootless = TRUE; -+ return 1; -+ } -+ - /* OS-specific processing */ - return xf86ProcessArgument(argc, argv, i); - } -diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h -index 58cfe0a..3dd2697 100644 ---- a/hw/xfree86/common/xf86Priv.h -+++ b/hw/xfree86/common/xf86Priv.h -@@ -91,6 +91,8 @@ extern _X_EXPORT int xf86NumScreens; - extern _X_EXPORT const char *xf86VisualNames[]; - extern _X_EXPORT int xf86Verbose; /* verbosity level */ - extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */ -+extern _X_EXPORT Bool xorgWayland; -+extern _X_EXPORT Bool xorgRootless; - - extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable; - -diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c -index efdcd66..483d630 100644 ---- a/hw/xfree86/dri2/dri2.c -+++ b/hw/xfree86/dri2/dri2.c -@@ -1332,13 +1332,16 @@ DRI2Connect(ClientPtr client, ScreenPtr pScreen, - } - - static int --DRI2AuthMagic (ScreenPtr pScreen, uint32_t magic) -+DRI2AuthMagic (ClientPtr client, ScreenPtr pScreen, uint32_t magic) - { - DRI2ScreenPtr ds = DRI2GetScreen(pScreen); - if (ds == NULL) - return -EINVAL; - -- return (*ds->LegacyAuthMagic) (ds->fd, magic); -+ if (ds->LegacyAuthMagic2) -+ return (*ds->LegacyAuthMagic2) (pScreen, magic); -+ else -+ return (*ds->LegacyAuthMagic) (ds->fd, magic); - } - - Bool -diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h -index 38b4f58..ed67d01 100644 ---- a/hw/xfree86/dri2/dri2.h -+++ b/hw/xfree86/dri2/dri2.h -@@ -207,7 +207,7 @@ typedef int (*DRI2GetParamProcPtr) (ClientPtr client, - /** - * Version of the DRI2InfoRec structure defined in this header - */ --#define DRI2INFOREC_VERSION 9 -+#define DRI2INFOREC_VERSION 10 - - typedef struct { - unsigned int version; /**< Version of this struct */ -diff --git a/hw/xfree86/xwayland/Makefile.am b/hw/xfree86/xwayland/Makefile.am -new file mode 100644 -index 0000000..b739145 ---- /dev/null -+++ b/hw/xfree86/xwayland/Makefile.am -@@ -0,0 +1,44 @@ -+AM_CPPFLAGS = \ -+ $(XORG_INCS) \ -+ -I$(srcdir)/../ddc \ -+ -I$(srcdir)/../ramdac \ -+ -I$(srcdir)/../i2c \ -+ -I$(srcdir)/../parser \ -+ -I$(srcdir)/../modes -+ -+libxwayland_la_LTLIBRARIES = libxwayland.la -+libxwayland_la_CFLAGS = \ -+ -DHAVE_XORG_CONFIG_H \ -+ @DIX_CFLAGS@ @XORG_CFLAGS@ @LIBDRM_CFLAGS@ \ -+ -I$(top_srcdir)/hw/xfree86/common \ -+ -I$(top_srcdir)/hw/xfree86/os-support/bus -+ -+libxwayland_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -lwayland-client -+libxwayland_ladir = $(moduledir)/extensions -+libxwayland_la_SOURCES = \ -+ xwayland.c \ -+ xwayland-input.c \ -+ xwayland-output.c \ -+ xwayland-cursor.c \ -+ xwayland-window.c \ -+ xwayland-private.h \ -+ drm-client-protocol.h \ -+ drm-protocol.c \ -+ xserver-client-protocol.h \ -+ xserver-protocol.c -+ -+if DRM -+libxwayland_la_SOURCES += xwayland-drm.c -+endif -+ -+sdk_HEADERS = xwayland.h -+ -+BUILT_SOURCES = \ -+ drm-client-protocol.h \ -+ drm-protocol.c \ -+ xserver-client-protocol.h \ -+ xserver-protocol.c -+ -+CLEANFILES = $(BUILT_SOURCES) -+ -+@wayland_scanner_rules@ -diff --git a/hw/xfree86/xwayland/drm.xml b/hw/xfree86/xwayland/drm.xml -new file mode 100644 -index 0000000..89fd8f0 ---- /dev/null -+++ b/hw/xfree86/xwayland/drm.xml -@@ -0,0 +1,139 @@ -+ -+ -+ -+ -+ Copyright © 2008-2011 Kristian Høgsberg -+ Copyright © 2010-2011 Intel Corporation -+ -+ Permission to use, copy, modify, distribute, and sell this -+ software and its documentation for any purpose is hereby granted -+ without fee, provided that\n the above copyright notice appear in -+ all copies and that both that copyright notice and this permission -+ notice appear in supporting documentation, and that the name of -+ the copyright holders not be used in advertising or publicity -+ pertaining to distribution of the software without specific, -+ written prior permission. The copyright holders make no -+ representations about the suitability of this software for any -+ purpose. It is provided "as is" without express or implied -+ warranty. -+ -+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -+ THIS SOFTWARE. -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/hw/xfree86/xwayland/xserver.xml b/hw/xfree86/xwayland/xserver.xml -new file mode 100644 -index 0000000..9e25f5c ---- /dev/null -+++ b/hw/xfree86/xwayland/xserver.xml -@@ -0,0 +1,18 @@ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c -new file mode 100644 -index 0000000..f8860bd ---- /dev/null -+++ b/hw/xfree86/xwayland/xwayland-cursor.c -@@ -0,0 +1,241 @@ -+/* -+ * Copyright © 2011 Kristian Høgsberg -+ * -+ * Permission to use, copy, modify, distribute, and sell this software -+ * and its documentation for any purpose is hereby granted without -+ * fee, provided that the above copyright notice appear in all copies -+ * and that both that copyright notice and this permission notice -+ * appear in supporting documentation, and that the name of the -+ * copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -+ * SOFTWARE. -+ */ -+ -+#ifdef HAVE_XORG_CONFIG_H -+#include "xorg-config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "xwayland.h" -+#include "xwayland-private.h" -+#include "xserver-client-protocol.h" -+ -+static DevPrivateKeyRec xwl_cursor_private_key; -+ -+static void -+expand_source_and_mask(CursorPtr cursor, void *data) -+{ -+ CARD32 *argb, *p, d, fg, bg; -+ CursorBitsPtr bits = cursor->bits; -+ int size; -+ int x, y, stride, i, bit; -+ -+ size = bits->width * bits->height * 4; -+ argb = malloc(size); -+ if (argb == NULL) -+ return; -+ -+ p = argb; -+ fg = ((cursor->foreRed & 0xff00) << 8) | -+ (cursor->foreGreen & 0xff00) | (cursor->foreGreen >> 8); -+ bg = ((cursor->backRed & 0xff00) << 8) | -+ (cursor->backGreen & 0xff00) | (cursor->backGreen >> 8); -+ stride = (bits->width / 8 + 3) & ~3; -+ for (y = 0; y < bits->height; y++) -+ for (x = 0; x < bits->width; x++) { -+ i = y * stride + x / 8; -+ bit = 1 << (x & 7); -+ if (bits->source[i] & bit) -+ d = fg; -+ else -+ d = bg; -+ if (bits->mask[i] & bit) -+ d |= 0xff000000; -+ else -+ d = 0x00000000; -+ -+ *p++ = d; -+ } -+ -+ memcpy(data, argb, size); -+ free(argb); -+} -+ -+static Bool -+xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) -+{ -+ struct xwl_screen *xwl_screen; -+ int size; -+ char filename[] = "/tmp/wayland-shm-XXXXXX"; -+ int fd; -+ struct wl_shm_pool *pool; -+ struct wl_buffer *buffer; -+ void *data; -+ -+ xwl_screen = xwl_screen_get(screen); -+ size = cursor->bits->width * cursor->bits->height * 4; -+ -+ fd = mkstemp(filename); -+ if (fd < 0) { -+ ErrorF("open %s failed: %s", filename, strerror(errno)); -+ return FALSE; -+ } -+ if (ftruncate(fd, size) < 0) { -+ ErrorF("ftruncate failed: %s", strerror(errno)); -+ close(fd); -+ return FALSE; -+ } -+ -+ data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); -+ unlink(filename); -+ -+ if (data == MAP_FAILED) { -+ ErrorF("mmap failed: %s", strerror(errno)); -+ close(fd); -+ return FALSE; -+ } -+ -+ if (cursor->bits->argb) -+ memcpy(data, cursor->bits->argb, size); -+ else -+ expand_source_and_mask(cursor, data); -+ munmap(data, size); -+ -+ pool = wl_shm_create_pool(xwl_screen->shm, fd, size); -+ close(fd); -+ buffer = wl_shm_pool_create_buffer(pool, 0, -+ cursor->bits->width, cursor->bits->height, -+ cursor->bits->width * 4, -+ WL_SHM_FORMAT_ARGB8888); -+ wl_shm_pool_destroy(pool); -+ -+ dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, buffer); -+ -+ return TRUE; -+} -+ -+static Bool -+xwl_unrealize_cursor(DeviceIntPtr device, -+ ScreenPtr screen, CursorPtr cursor) -+{ -+ struct wl_buffer *buffer; -+ -+ buffer = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); -+ wl_buffer_destroy(buffer); -+ -+ return TRUE; -+} -+ -+void -+xwl_seat_set_cursor(struct xwl_seat *xwl_seat) -+{ -+ struct wl_buffer *buffer; -+ -+ if (!xwl_seat->x_cursor || !xwl_seat->wl_pointer) -+ return; -+ -+ buffer = dixGetPrivate(&xwl_seat->x_cursor->devPrivates, -+ &xwl_cursor_private_key); -+ -+ wl_pointer_set_cursor(xwl_seat->wl_pointer, -+ xwl_seat->pointer_enter_serial, -+ xwl_seat->cursor, -+ xwl_seat->x_cursor->bits->xhot, -+ xwl_seat->x_cursor->bits->yhot); -+ wl_surface_attach(xwl_seat->cursor, buffer, 0, 0); -+ wl_surface_damage(xwl_seat->cursor, 0, 0, -+ xwl_seat->x_cursor->bits->width, -+ xwl_seat->x_cursor->bits->height); -+ wl_surface_commit(xwl_seat->cursor); -+} -+ -+static void -+xwl_set_cursor(DeviceIntPtr device, -+ ScreenPtr screen, CursorPtr cursor, int x, int y) -+{ -+ struct xwl_screen *xwl_screen; -+ struct xwl_seat *xwl_seat; -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ if (!xwl_screen || xorg_list_is_empty(&xwl_screen->seat_list)) -+ return; -+ -+ xwl_seat = xorg_list_first_entry(&xwl_screen->seat_list, -+ struct xwl_seat, link); -+ -+ xwl_seat->x_cursor = cursor; -+ xwl_seat_set_cursor(xwl_seat); -+} -+ -+static void -+xwl_move_cursor(DeviceIntPtr device, ScreenPtr screen, int x, int y) -+{ -+} -+ -+static Bool -+xwl_device_cursor_initialize(DeviceIntPtr device, ScreenPtr screen) -+{ -+ struct xwl_screen *xwl_screen; -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ return xwl_screen->sprite_funcs->DeviceCursorInitialize(device, -+ screen); -+} -+ -+static void -+xwl_device_cursor_cleanup(DeviceIntPtr device, ScreenPtr screen) -+{ -+ struct xwl_screen *xwl_screen; -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ xwl_screen->sprite_funcs->DeviceCursorCleanup(device, screen); -+} -+ -+static miPointerSpriteFuncRec xwl_pointer_sprite_funcs = -+{ -+ xwl_realize_cursor, -+ xwl_unrealize_cursor, -+ xwl_set_cursor, -+ xwl_move_cursor, -+ xwl_device_cursor_initialize, -+ xwl_device_cursor_cleanup -+}; -+ -+int -+xwl_screen_init_cursor(struct xwl_screen *xwl_screen, ScreenPtr screen) -+{ -+ miPointerScreenPtr pointer_priv; -+ -+ if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR, 0)) -+ return BadAlloc; -+ -+ pointer_priv = dixLookupPrivate(&screen->devPrivates, miPointerScreenKey); -+ xwl_screen->sprite_funcs = pointer_priv->spriteFuncs; -+ pointer_priv->spriteFuncs = &xwl_pointer_sprite_funcs; -+ -+ return Success; -+} -diff --git a/hw/xfree86/xwayland/xwayland-drm.c b/hw/xfree86/xwayland/xwayland-drm.c -new file mode 100644 -index 0000000..ce56e4c ---- /dev/null -+++ b/hw/xfree86/xwayland/xwayland-drm.c -@@ -0,0 +1,235 @@ -+/* -+ * Copyright © 2011 Kristian Høgsberg -+ * -+ * Permission to use, copy, modify, distribute, and sell this software -+ * and its documentation for any purpose is hereby granted without -+ * fee, provided that the above copyright notice appear in all copies -+ * and that both that copyright notice and this permission notice -+ * appear in supporting documentation, and that the name of the -+ * copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -+ * SOFTWARE. -+ */ -+ -+#ifdef HAVE_XORG_CONFIG_H -+#include "xorg-config.h" -+#endif -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "xwayland.h" -+#include "xwayland-private.h" -+#include "../dri2/dri2.h" -+ -+struct xwl_auth_req { -+ struct xorg_list link; -+ -+ ClientPtr client; -+ struct xwl_screen *xwl_screen; -+ uint32_t magic; -+}; -+ -+static void -+drm_handle_device (void *data, struct wl_drm *drm, const char *device) -+{ -+ struct xwl_screen *xwl_screen = data; -+ -+ xwl_screen->device_name = strdup (device); -+} -+ -+static void -+drm_handle_format(void *data, struct wl_drm *wl_drm, uint32_t format) -+{ -+} -+ -+static void -+drm_handle_authenticated (void *data, struct wl_drm *drm) -+{ -+ struct xwl_screen *xwl_screen = data; -+ struct xwl_auth_req *req; -+ -+ xwl_screen->authenticated = 1; -+ -+ /* it does one authentication transaction at a time, so if there's an -+ * element in the list, we call DRI2SendAuthReply for that client, remove -+ * the head and free the struct. If there are still elements in the list, -+ * it means that we have one or more clients waiting to be authenticated -+ * and we send out a wl_drm authenticate request for the first client in -+ * the list */ -+ if (xorg_list_is_empty(&xwl_screen->authenticate_client_list)) -+ return; -+ -+ req = xorg_list_first_entry(&xwl_screen->authenticate_client_list, -+ struct xwl_auth_req, link); -+ DRI2SendAuthReply(req->client, TRUE); -+ AttendClient(req->client); -+ xorg_list_del(&req->link); -+ free(req); -+ -+ xorg_list_for_each_entry(req, &xwl_screen->authenticate_client_list, -+ link) { -+ wl_drm_authenticate (xwl_screen->drm, req->magic); -+ return; -+ } -+} -+ -+static const struct wl_drm_listener xwl_drm_listener = -+{ -+ drm_handle_device, -+ drm_handle_format, -+ drm_handle_authenticated -+}; -+ -+static void -+drm_handler(void *data, struct wl_registry *registry, uint32_t id, -+ const char *interface, uint32_t version) -+{ -+ struct xwl_screen *xwl_screen = data; -+ -+ if (strcmp (interface, "wl_drm") == 0) { -+ xwl_screen->drm = wl_registry_bind(xwl_screen->registry, id, -+ &wl_drm_interface, 1); -+ wl_drm_add_listener(xwl_screen->drm, &xwl_drm_listener, xwl_screen); -+ } -+} -+ -+static const struct wl_registry_listener drm_listener = { -+ drm_handler, -+}; -+ -+int -+xwl_drm_pre_init(struct xwl_screen *xwl_screen) -+{ -+ uint32_t magic; -+ -+ xwl_screen->drm_registry = wl_display_get_registry(xwl_screen->display); -+ wl_registry_add_listener(xwl_screen->drm_registry, &drm_listener, -+ xwl_screen); -+ -+ /* Ensure drm_handler has seen all the interfaces */ -+ wl_display_roundtrip(xwl_screen->display); -+ /* Ensure the xwl_drm_listener has seen the drm device, if any */ -+ wl_display_roundtrip(xwl_screen->display); -+ -+ ErrorF("wayland_drm_screen_init, device name %s\n", -+ xwl_screen->device_name); -+ -+ xwl_screen->drm_fd = open(xwl_screen->device_name, O_RDWR); -+ if (xwl_screen->drm_fd < 0) { -+ ErrorF("failed to open the drm fd\n"); -+ return BadAccess; -+ } -+ -+ if (drmGetMagic(xwl_screen->drm_fd, &magic)) { -+ ErrorF("failed to get drm magic"); -+ return BadAccess; -+ } -+ -+ wl_drm_authenticate(xwl_screen->drm, magic); -+ -+ wl_display_roundtrip(xwl_screen->display); -+ -+ ErrorF("opened drm fd: %d\n", xwl_screen->drm_fd); -+ -+ if (!xwl_screen->authenticated) { -+ ErrorF("Failed to auth drm fd\n"); -+ return BadAccess; -+ } -+ -+ return Success; -+} -+ -+Bool xwl_drm_initialised(struct xwl_screen *xwl_screen) -+{ -+ return xwl_screen->authenticated; -+} -+ -+int xwl_screen_get_drm_fd(struct xwl_screen *xwl_screen) -+{ -+ return xwl_screen->drm_fd; -+} -+ -+int xwl_drm_authenticate(ClientPtr client, struct xwl_screen *xwl_screen, -+ uint32_t magic) -+{ -+ struct xwl_auth_req *req; -+ -+ if (!xwl_screen->drm) -+ return BadAccess; -+ -+ req = malloc (sizeof *req); -+ if (req == NULL) -+ return BadAlloc; -+ -+ req->client = client; -+ req->xwl_screen = xwl_screen; -+ req->magic = magic; -+ -+ if (xorg_list_is_empty(&xwl_screen->authenticate_client_list)) -+ wl_drm_authenticate (xwl_screen->drm, magic); -+ -+ xorg_list_append(&req->link, &xwl_screen->authenticate_client_list); -+ -+ IgnoreClient(req->client); -+ xwl_screen->authenticated = 0; -+ -+ return Success; -+} -+ -+ -+int -+xwl_create_window_buffer_drm(struct xwl_window *xwl_window, -+ PixmapPtr pixmap, uint32_t name) -+{ -+ VisualID visual; -+ WindowPtr window = xwl_window->window; -+ ScreenPtr screen = window->drawable.pScreen; -+ uint32_t format; -+ int i; -+ -+ visual = wVisual(window); -+ for (i = 0; i < screen->numVisuals; i++) -+ if (screen->visuals[i].vid == visual) -+ break; -+ -+ if (screen->visuals[i].nplanes == 32) -+ format = WL_DRM_FORMAT_ARGB8888; -+ else -+ format = WL_DRM_FORMAT_XRGB8888; -+ -+ xwl_window->buffer = -+ wl_drm_create_buffer(xwl_window->xwl_screen->drm, -+ name, -+ pixmap->drawable.width, -+ pixmap->drawable.height, -+ pixmap->devKind, -+ format); -+ -+ return xwl_window->buffer ? Success : BadDrawable; -+} -diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c -new file mode 100644 -index 0000000..2f8e0c7 ---- /dev/null -+++ b/hw/xfree86/xwayland/xwayland-input.c -@@ -0,0 +1,610 @@ -+/* -+ * Copyright © 2008 Kristian Høgsberg -+ * -+ * Permission to use, copy, modify, distribute, and sell this software -+ * and its documentation for any purpose is hereby granted without -+ * fee, provided that the above copyright notice appear in all copies -+ * and that both that copyright notice and this permission notice -+ * appear in supporting documentation, and that the name of the -+ * copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -+ * SOFTWARE. -+ */ -+ -+#ifdef HAVE_XORG_CONFIG_H -+#include "xorg-config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "xwayland.h" -+#include "xwayland-private.h" -+#include "xserver-client-protocol.h" -+ -+static void -+xwl_pointer_control(DeviceIntPtr device, PtrCtrl *ctrl) -+{ -+ /* Nothing to do, dix handles all settings */ -+} -+ -+static int -+xwl_pointer_proc(DeviceIntPtr device, int what) -+{ -+#define NBUTTONS 10 -+#define NAXES 2 -+ BYTE map[NBUTTONS + 1]; -+ int i = 0; -+ Atom btn_labels[NBUTTONS] = {0}; -+ Atom axes_labels[NAXES] = {0}; -+ -+ switch (what) { -+ case DEVICE_INIT: -+ device->public.on = FALSE; -+ -+ for (i = 1; i <= NBUTTONS; i++) -+ map[i] = i; -+ -+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); -+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); -+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); -+ btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); -+ btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); -+ btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT); -+ btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT); -+ /* don't know about the rest */ -+ -+ axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); -+ axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); -+ -+ if (!InitValuatorClassDeviceStruct(device, 2, btn_labels, -+ GetMotionHistorySize(), Absolute)) -+ return BadValue; -+ -+ /* Valuators */ -+ InitValuatorAxisStruct(device, 0, axes_labels[0], -+ 0, 0xFFFF, 10000, 0, 10000, Absolute); -+ InitValuatorAxisStruct(device, 1, axes_labels[1], -+ 0, 0xFFFF, 10000, 0, 10000, Absolute); -+ -+ if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control)) -+ return BadValue; -+ -+ if (!InitButtonClassDeviceStruct(device, 3, btn_labels, map)) -+ return BadValue; -+ -+ return Success; -+ -+ case DEVICE_ON: -+ device->public.on = TRUE; -+ return Success; -+ -+ case DEVICE_OFF: -+ case DEVICE_CLOSE: -+ device->public.on = FALSE; -+ return Success; -+ } -+ -+ return BadMatch; -+ -+#undef NBUTTONS -+#undef NAXES -+} -+ -+static void -+xwl_keyboard_control(DeviceIntPtr device, KeybdCtrl *ctrl) -+{ -+ /* FIXME: Set keyboard leds based on CAPSFLAG etc being set in -+ * ctrl->leds - needs private protocol. */ -+} -+ -+static int -+xwl_keyboard_proc(DeviceIntPtr device, int what) -+{ -+ InputInfoPtr pInfo = device->public.devicePrivate; -+ struct xwl_seat *xwl_seat = pInfo->private; -+ int len; -+ -+ switch (what) { -+ case DEVICE_INIT: -+ device->public.on = FALSE; -+ len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size); -+ if (!InitKeyboardDeviceStructFromString(device, xwl_seat->keymap, -+ len, -+ NULL, xwl_keyboard_control)) -+ return BadValue; -+ -+ return Success; -+ case DEVICE_ON: -+ device->public.on = TRUE; -+ return Success; -+ -+ case DEVICE_OFF: -+ case DEVICE_CLOSE: -+ device->public.on = FALSE; -+ return Success; -+ } -+ -+ return BadMatch; -+} -+ -+static void -+xwl_keyboard_uninit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) -+{ -+} -+ -+static int -+xwl_keyboard_init(InputDriverPtr drv, InputInfoPtr pInfo, int flags) -+{ -+ pInfo->type_name = "xwayland-keyboard"; -+ pInfo->device_control = xwl_keyboard_proc; -+ pInfo->read_input = NULL; -+ pInfo->control_proc = NULL; -+ pInfo->switch_mode = NULL; -+ pInfo->fd = -1; -+ -+ return Success; -+} -+ -+_X_EXPORT InputDriverRec xwl_keyboard_driver = { -+ 1, -+ "xwayland-keyboard", -+ NULL, -+ xwl_keyboard_init, -+ xwl_keyboard_uninit, -+ NULL, -+}; -+ -+static void -+xwl_pointer_uninit(InputDriverPtr drv, InputInfoPtr pInfo, int flags) -+{ -+} -+ -+static int -+xwl_pointer_init(InputDriverPtr drv, InputInfoPtr pInfo, int flags) -+{ -+ pInfo->type_name = "xwayland-pointer"; -+ pInfo->device_control = xwl_pointer_proc; -+ pInfo->read_input = NULL; -+ pInfo->control_proc = NULL; -+ pInfo->switch_mode = NULL; -+ pInfo->fd = -1; -+ -+ return Success; -+} -+ -+_X_EXPORT InputDriverRec xwl_pointer_driver = { -+ 1, -+ "xwayland-pointer", -+ NULL, -+ xwl_pointer_init, -+ xwl_pointer_uninit, -+ NULL, -+}; -+ -+void -+xwl_input_teardown(pointer p) -+{ -+} -+ -+pointer -+xwl_input_setup(pointer module, pointer opts, int *errmaj, int *errmin) -+{ -+ xf86AddInputDriver(&xwl_keyboard_driver, module, 0); -+ xf86AddInputDriver(&xwl_pointer_driver, module, 0); -+ -+ return module; -+} -+ -+static DeviceIntPtr -+device_added(struct xwl_seat *xwl_seat, const char *driver) -+{ -+ DeviceIntPtr dev = NULL; -+ InputInfoPtr pInfo; -+ int rc; -+ -+ pInfo = xf86AllocateInput(); -+ if (!pInfo) -+ return NULL; -+ -+ pInfo->driver = xstrdup(driver); -+ -+ if (asprintf(&pInfo->name, "%s:%d", pInfo->driver, xwl_seat->id) == -1) { -+ free(pInfo); -+ return NULL; -+ } -+ -+ pInfo->private = xwl_seat; -+ -+ rc = xf86NewInputDevice(pInfo, &dev, 1); -+ if (rc != Success) { -+ free(pInfo); -+ return NULL; -+ } -+ -+ LogMessage(X_INFO, "config/xwayland: Adding input device %s\n", -+ pInfo->name); -+ -+ return dev; -+} -+ -+static void -+pointer_handle_enter(void *data, struct wl_pointer *pointer, -+ uint32_t serial, struct wl_surface *surface, -+ wl_fixed_t sx_w, wl_fixed_t sy_w) -+ -+{ -+ struct xwl_seat *xwl_seat = data; -+ DeviceIntPtr dev = xwl_seat->pointer; -+ int i; -+ int sx = wl_fixed_to_int(sx_w); -+ int sy = wl_fixed_to_int(sy_w); -+ ScreenPtr pScreen = xwl_seat->xwl_screen->screen; -+ -+ xwl_seat->xwl_screen->serial = serial; -+ xwl_seat->pointer_enter_serial = serial; -+ -+ xwl_seat->focus_window = wl_surface_get_user_data(surface); -+ -+ (*pScreen->SetCursorPosition) (dev, pScreen, sx, sy, TRUE); -+ -+ SetDeviceRedirectWindow(xwl_seat->pointer, xwl_seat->focus_window->window); -+ -+ /* Ideally, X clients shouldn't see these button releases. When -+ * the pointer leaves a window with buttons down, it means that -+ * the wayland compositor has grabbed the pointer. The button -+ * release event is consumed by whatever grab in the compositor -+ * and won't be sent to clients (the X server is a client). -+ * However, we need to reset X's idea of which buttons are up and -+ * down, and they're all up (by definition) when the pointer -+ * enters a window. We should figure out a way to swallow these -+ * events, perhaps using an X grab whenever the pointer is not in -+ * any X window, but for now just send the events. */ -+ for (i = 0; i < dev->button->numButtons; i++) -+ if (BitIsOn(dev->button->down, i)) -+ xf86PostButtonEvent(dev, TRUE, i, 0, 0, 0); -+ -+ (*pScreen->DisplayCursor)(dev, pScreen, dev->spriteInfo->sprite->current); -+} -+ -+static void -+pointer_handle_leave(void *data, struct wl_pointer *pointer, -+ uint32_t serial, struct wl_surface *surface) -+{ -+ struct xwl_seat *xwl_seat = data; -+ DeviceIntPtr dev = xwl_seat->pointer; -+ ScreenPtr pScreen = xwl_seat->xwl_screen->screen; -+ -+ xwl_seat->xwl_screen->serial = serial; -+ -+ xwl_seat->focus_window = NULL; -+ SetDeviceRedirectWindow(xwl_seat->pointer, PointerRootWin); -+ (*pScreen->DisplayCursor)(dev, pScreen, NullCursor); -+} -+ -+static void -+pointer_handle_motion(void *data, struct wl_pointer *pointer, -+ uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w) -+{ -+ struct xwl_seat *xwl_seat = data; -+ int32_t dx, dy; -+ int sx = wl_fixed_to_int(sx_w); -+ int sy = wl_fixed_to_int(sy_w); -+ ValuatorMask mask; -+ -+ if (!xwl_seat->focus_window) -+ return ; -+ -+ dx = xwl_seat->focus_window->window->drawable.x; -+ dy = xwl_seat->focus_window->window->drawable.y; -+ -+ valuator_mask_zero(&mask); -+ valuator_mask_set(&mask, 0, dx + sx); -+ valuator_mask_set(&mask, 1, dy + sy); -+ -+ QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, -+ POINTER_ABSOLUTE | POINTER_SCREEN, &mask); -+} -+ -+static void -+pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, -+ uint32_t time, uint32_t button, uint32_t state) -+{ -+ struct xwl_seat *xwl_seat = data; -+ int index; -+ -+ xwl_seat->xwl_screen->serial = serial; -+ -+ switch (button) { -+ case BTN_MIDDLE: -+ index = 2; -+ break; -+ case BTN_RIGHT: -+ index = 3; -+ break; -+ default: -+ index = button - BTN_LEFT + 1; -+ break; -+ } -+ -+ xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, state, 0, 0); -+} -+ -+static void -+pointer_handle_axis(void *data, struct wl_pointer *pointer, -+ uint32_t time, uint32_t axis, wl_fixed_t value) -+{ -+ struct xwl_seat *xwl_seat = data; -+ int index, count; -+ int i, val; -+ const int divisor = 10; -+ -+ if (time - xwl_seat->scroll_time > 2000) { -+ xwl_seat->vertical_scroll = 0; -+ xwl_seat->horizontal_scroll = 0; -+ } -+ xwl_seat->scroll_time = time; -+ -+ /* FIXME: Need to do proper smooth scrolling here! */ -+ switch (axis) { -+ case WL_POINTER_AXIS_VERTICAL_SCROLL: -+ xwl_seat->vertical_scroll += value / divisor; -+ val = wl_fixed_to_int(xwl_seat->vertical_scroll); -+ xwl_seat->vertical_scroll -= wl_fixed_from_int(val); -+ -+ if (val <= -1) -+ index = 4; -+ else if (val >= 1) -+ index = 5; -+ else -+ return; -+ break; -+ case WL_POINTER_AXIS_HORIZONTAL_SCROLL: -+ xwl_seat->horizontal_scroll += value / divisor; -+ val = wl_fixed_to_int(xwl_seat->horizontal_scroll); -+ xwl_seat->horizontal_scroll -= wl_fixed_from_int(val); -+ -+ if (val <= -1) -+ index = 6; -+ else if (val >= 1) -+ index = 7; -+ else -+ return; -+ break; -+ default: -+ return; -+ } -+ -+ count = abs(val); -+ for (i = 0; i < count; i++) { -+ xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, 1, 0, 0); -+ xf86PostButtonEvent(xwl_seat->pointer, TRUE, index, 0, 0, 0); -+ } -+} -+ -+static const struct wl_pointer_listener pointer_listener = { -+ pointer_handle_enter, -+ pointer_handle_leave, -+ pointer_handle_motion, -+ pointer_handle_button, -+ pointer_handle_axis, -+}; -+ -+static void -+keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, -+ uint32_t time, uint32_t key, uint32_t state) -+{ -+ struct xwl_seat *xwl_seat = data; -+ uint32_t *k, *end; -+ -+ xwl_seat->xwl_screen->serial = serial; -+ -+ end = xwl_seat->keys.data + xwl_seat->keys.size; -+ for (k = xwl_seat->keys.data; k < end; k++) { -+ if (*k == key) -+ *k = *--end; -+ } -+ xwl_seat->keys.size = (void *) end - xwl_seat->keys.data; -+ if (state) { -+ k = wl_array_add(&xwl_seat->keys, sizeof *k); -+ *k = key; -+ } -+ -+ xf86PostKeyboardEvent(xwl_seat->keyboard, key + 8, state); -+} -+ -+static void -+keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, -+ uint32_t format, int fd, uint32_t size) -+{ -+ struct xwl_seat *xwl_seat = data; -+ -+ xwl_seat->keymap_size = size; -+ xwl_seat->keymap = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); -+ if (xwl_seat->keymap == MAP_FAILED) -+ ; /* wah wah */ -+ -+ close(fd); -+} -+ -+static void -+keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, -+ uint32_t serial, -+ struct wl_surface *surface, struct wl_array *keys) -+{ -+ struct xwl_seat *xwl_seat = data; -+ uint32_t *k; -+ -+ xwl_seat->xwl_screen->serial = serial; -+ -+ wl_array_copy(&xwl_seat->keys, keys); -+ wl_array_for_each(k, &xwl_seat->keys) -+ xf86PostKeyboardEvent(xwl_seat->keyboard, *k + 8, 1); -+} -+ -+static void -+keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, -+ uint32_t serial, struct wl_surface *surface) -+{ -+ struct xwl_seat *xwl_seat = data; -+ uint32_t *k; -+ -+ xwl_seat->xwl_screen->serial = serial; -+ -+ wl_array_for_each(k, &xwl_seat->keys) -+ xf86PostKeyboardEvent(xwl_seat->keyboard, *k + 8, 0); -+} -+ -+static void -+keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, -+ uint32_t serial, uint32_t mods_depressed, -+ uint32_t mods_latched, uint32_t mods_locked, -+ uint32_t group) -+{ -+ /* FIXME: Need more server XKB API here. */ -+} -+ -+static const struct wl_keyboard_listener keyboard_listener = { -+ keyboard_handle_keymap, -+ keyboard_handle_enter, -+ keyboard_handle_leave, -+ keyboard_handle_key, -+ keyboard_handle_modifiers, -+}; -+ -+static void -+add_devices(void *data, struct wl_callback *callback, uint32_t time) -+{ -+ struct xwl_seat *xwl_seat = data; -+ -+ wl_callback_destroy(callback); -+ -+ if (xwl_seat->wl_pointer) -+ xwl_seat->pointer = device_added(xwl_seat, "xwayland-pointer"); -+ if (xwl_seat->wl_keyboard) -+ xwl_seat->keyboard = device_added(xwl_seat, "xwayland-keyboard"); -+} -+ -+static const struct wl_callback_listener add_devices_listener = { -+ add_devices -+}; -+ -+static void -+seat_handle_capabilities(void *data, struct wl_seat *seat, -+ enum wl_seat_capability caps) -+{ -+ struct xwl_seat *xwl_seat = data; -+ struct wl_callback *callback; -+ -+ if (caps & WL_SEAT_CAPABILITY_POINTER) { -+ xwl_seat->wl_pointer = wl_seat_get_pointer(seat); -+ wl_pointer_add_listener(xwl_seat->wl_pointer, -+ &pointer_listener, xwl_seat); -+ xwl_seat_set_cursor(xwl_seat); -+ } -+ -+ if (caps & WL_SEAT_CAPABILITY_KEYBOARD) { -+ xwl_seat->wl_keyboard = wl_seat_get_keyboard(seat); -+ wl_keyboard_add_listener(xwl_seat->wl_keyboard, -+ &keyboard_listener, xwl_seat); -+ -+ } -+ /* FIXME: Touch ... */ -+ -+ /* Add devices after we've received keymaps. */ -+ if (caps) { -+ callback = wl_display_sync(xwl_seat->xwl_screen->display); -+ wl_callback_add_listener(callback, -+ &add_devices_listener, xwl_seat); -+ } -+} -+ -+static const struct wl_seat_listener seat_listener = { -+ seat_handle_capabilities, -+}; -+ -+static void -+create_input_device(struct xwl_screen *xwl_screen, uint32_t id) -+{ -+ struct xwl_seat *xwl_seat; -+ -+ xwl_seat = calloc(sizeof *xwl_seat, 1); -+ if (xwl_seat == NULL) { -+ ErrorF("create_input ENOMEM"); -+ return ; -+ } -+ -+ xwl_seat->xwl_screen = xwl_screen; -+ xorg_list_add(&xwl_seat->link, &xwl_screen->seat_list); -+ -+ xwl_seat->seat = -+ wl_registry_bind(xwl_screen->registry, id, &wl_seat_interface, 1); -+ xwl_seat->id = id; -+ -+ xwl_seat->cursor = wl_compositor_create_surface(xwl_screen->compositor); -+ wl_seat_add_listener(xwl_seat->seat, &seat_listener, xwl_seat); -+ wl_array_init(&xwl_seat->keys); -+} -+ -+static void -+input_handler(void *data, struct wl_registry *registry, uint32_t id, -+ const char *interface, uint32_t version) -+{ -+ struct xwl_screen *xwl_screen = data; -+ -+ if (strcmp (interface, "wl_seat") == 0) { -+ create_input_device(xwl_screen, id); -+ } else if (strcmp(interface, "xserver") == 0) { -+ xwl_screen->xorg_server = -+ wl_registry_bind(registry, id, &xserver_interface, 1); -+ xserver_add_listener(xwl_screen->xorg_server, &xwl_server_listener, -+ xwl_screen); -+ } -+} -+ -+static const struct wl_registry_listener input_listener = { -+ input_handler, -+}; -+ -+void -+xwl_input_init(struct xwl_screen *xwl_screen) -+{ -+ xwl_screen->input_registry = wl_display_get_registry(xwl_screen->display); -+ wl_registry_add_listener(xwl_screen->input_registry, &input_listener, -+ xwl_screen); -+} -diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c -new file mode 100644 -index 0000000..8f087f6 ---- /dev/null -+++ b/hw/xfree86/xwayland/xwayland-output.c -@@ -0,0 +1,309 @@ -+/* -+ * Copyright © 2011 Intel Corporation -+ * -+ * Permission to use, copy, modify, distribute, and sell this software -+ * and its documentation for any purpose is hereby granted without -+ * fee, provided that the above copyright notice appear in all copies -+ * and that both that copyright notice and this permission notice -+ * appear in supporting documentation, and that the name of the -+ * copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -+ * SOFTWARE. -+ */ -+ -+#ifdef HAVE_XORG_CONFIG_H -+#include "xorg-config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "xwayland.h" -+#include "xwayland-private.h" -+#include "xserver-client-protocol.h" -+ -+static void -+crtc_dpms(xf86CrtcPtr drmmode_crtc, int mode) -+{ -+} -+ -+static Bool -+crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, -+ Rotation rotation, int x, int y) -+{ -+ return TRUE; -+} -+ -+static void -+crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg) -+{ -+} -+ -+static void -+crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) -+{ -+} -+ -+static void -+crtc_show_cursor (xf86CrtcPtr crtc) -+{ -+} -+ -+static void -+crtc_hide_cursor (xf86CrtcPtr crtc) -+{ -+} -+ -+static void -+crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) -+{ -+} -+ -+static PixmapPtr -+crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height) -+{ -+ return NULL; -+} -+ -+static void * -+crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height) -+{ -+ return NULL; -+} -+ -+static void -+crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) -+{ -+} -+ -+static const xf86CrtcFuncsRec crtc_funcs = { -+ .dpms = crtc_dpms, -+ .set_mode_major = crtc_set_mode_major, -+ .set_cursor_colors = crtc_set_cursor_colors, -+ .set_cursor_position = crtc_set_cursor_position, -+ .show_cursor = crtc_show_cursor, -+ .hide_cursor = crtc_hide_cursor, -+ .load_cursor_argb = crtc_load_cursor_argb, -+ .shadow_create = crtc_shadow_create, -+ .shadow_allocate = crtc_shadow_allocate, -+ .shadow_destroy = crtc_shadow_destroy, -+ .destroy = NULL, /* XXX */ -+}; -+ -+static void -+output_dpms(xf86OutputPtr output, int mode) -+{ -+ return; -+} -+ -+static xf86OutputStatus -+output_detect(xf86OutputPtr output) -+{ -+ return XF86OutputStatusConnected; -+} -+ -+static Bool -+output_mode_valid(xf86OutputPtr output, DisplayModePtr pModes) -+{ -+ return MODE_OK; -+} -+ -+static DisplayModePtr -+output_get_modes(xf86OutputPtr xf86output) -+{ -+ struct xwl_output *output = xf86output->driver_private; -+ struct monitor_ranges *ranges; -+ DisplayModePtr modes; -+ -+ modes = xf86CVTMode(output->width, output->height, 60, TRUE, FALSE); -+ output->xf86monitor.det_mon[0].type = DS_RANGES; -+ ranges = &output->xf86monitor.det_mon[0].section.ranges; -+ ranges->min_h = modes->HSync - 10; -+ ranges->max_h = modes->HSync + 10; -+ ranges->min_v = modes->VRefresh - 10; -+ ranges->max_v = modes->VRefresh + 10; -+ ranges->max_clock = modes->Clock + 100; -+ output->xf86monitor.det_mon[1].type = DT; -+ output->xf86monitor.det_mon[2].type = DT; -+ output->xf86monitor.det_mon[3].type = DT; -+ output->xf86monitor.no_sections = 0; -+ -+ xf86output->MonInfo = &output->xf86monitor; -+ -+ return modes; -+} -+ -+static void -+output_destroy(xf86OutputPtr xf86output) -+{ -+ struct xwl_output *output = xf86output->driver_private; -+ -+ free(output); -+} -+ -+static const xf86OutputFuncsRec output_funcs = { -+ .dpms = output_dpms, -+ .detect = output_detect, -+ .mode_valid = output_mode_valid, -+ .get_modes = output_get_modes, -+ .destroy = output_destroy -+}; -+ -+struct xwl_output * -+xwl_output_create(struct xwl_screen *xwl_screen) -+{ -+ struct xwl_output *xwl_output; -+ xf86OutputPtr xf86output; -+ xf86CrtcPtr xf86crtc; -+ -+ xwl_output = calloc(sizeof *xwl_output, 1); -+ if (xwl_output == NULL) { -+ ErrorF("create_output ENOMEM"); -+ return NULL; -+ } -+ -+ xwl_output->xwl_screen = xwl_screen; -+ -+ xf86output = xf86OutputCreate(xwl_screen->scrninfo, -+ &output_funcs, "XWAYLAND-1"); -+ xf86output->driver_private = xwl_output; -+ xf86output->possible_crtcs = 1; -+ xf86output->possible_clones = 1; -+ -+ xf86crtc = xf86CrtcCreate(xwl_screen->scrninfo, &crtc_funcs); -+ xf86crtc->driver_private = xwl_output; -+ -+ xwl_output->xf86output = xf86output; -+ xwl_output->xf86crtc = xf86crtc; -+ -+ return xwl_output; -+} -+ -+static Bool -+resize(ScrnInfoPtr scrn, int width, int height) -+{ -+ if (scrn->virtualX == width && scrn->virtualY == height) -+ return TRUE; -+ /* We don't handle resize at all, we must match the compositor size */ -+ return FALSE; -+} -+ -+static const xf86CrtcConfigFuncsRec config_funcs = { -+ resize -+}; -+ -+static void -+display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, -+ int physical_width, int physical_height, int subpixel, -+ const char *make, const char *model, int transform) -+{ -+ struct xwl_output *xwl_output = data; -+ struct xwl_screen *xwl_screen = xwl_output->xwl_screen; -+ -+ xwl_output->xf86output->mm_width = physical_width; -+ xwl_output->xf86output->mm_height = physical_height; -+ -+ switch (subpixel) { -+ case WL_OUTPUT_SUBPIXEL_UNKNOWN: -+ xwl_output->xf86output->subpixel_order = SubPixelUnknown; -+ break; -+ case WL_OUTPUT_SUBPIXEL_NONE: -+ xwl_output->xf86output->subpixel_order = SubPixelNone; -+ break; -+ case WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: -+ xwl_output->xf86output->subpixel_order = SubPixelHorizontalRGB; -+ break; -+ case WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: -+ xwl_output->xf86output->subpixel_order = SubPixelHorizontalBGR; -+ break; -+ case WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: -+ xwl_output->xf86output->subpixel_order = SubPixelVerticalRGB; -+ break; -+ case WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: -+ xwl_output->xf86output->subpixel_order = SubPixelVerticalBGR; -+ break; -+ } -+ -+ xwl_output->x = x; -+ xwl_output->y = y; -+ -+ xwl_screen->xwl_output = xwl_output; -+} -+ -+static void -+display_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, -+ int width, int height, int refresh) -+{ -+ struct xwl_output *xwl_output = data; -+ -+ if (flags & WL_OUTPUT_MODE_CURRENT) { -+ xwl_output->width = width; -+ xwl_output->height = height; -+ } -+} -+ -+static const struct wl_output_listener output_listener = { -+ display_handle_geometry, -+ display_handle_mode -+}; -+ -+static void -+global_handler(void *data, struct wl_registry *registry, uint32_t id, -+ const char *interface, uint32_t version) -+{ -+ struct xwl_screen *xwl_screen = data; -+ struct xwl_output *xwl_output; -+ -+ if (strcmp (interface, "wl_output") == 0) { -+ xwl_output = xwl_output_create(xwl_screen); -+ xwl_output->output = wl_registry_bind(registry, id, -+ &wl_output_interface, 1); -+ wl_output_add_listener(xwl_output->output, -+ &output_listener, xwl_output); -+ } -+} -+ -+static const struct wl_registry_listener global_listener = { -+ global_handler, -+}; -+ -+void -+xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrninfo) -+{ -+ int ret; -+ -+ xf86CrtcConfigInit(scrninfo, &config_funcs); -+ -+ xf86CrtcSetSizeRange(scrninfo, 320, 200, 8192, 8192); -+ -+ xwl_screen->output_registry = wl_display_get_registry(xwl_screen->display); -+ wl_registry_add_listener(xwl_screen->output_registry, &global_listener, -+ xwl_screen); -+ -+ while (!xwl_screen->xwl_output) { -+ ret = wl_display_roundtrip(xwl_screen->display); -+ if (ret == -1) -+ FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); -+ } -+ -+ xf86InitialConfiguration(scrninfo, TRUE); -+} -diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h -new file mode 100644 -index 0000000..e427316 ---- /dev/null -+++ b/hw/xfree86/xwayland/xwayland-private.h -@@ -0,0 +1,132 @@ -+/* -+ * Copyright © 2010 Kristian Høgsberg -+ * -+ * Permission to use, copy, modify, distribute, and sell this software -+ * and its documentation for any purpose is hereby granted without -+ * fee, provided that the above copyright notice appear in all copies -+ * and that both that copyright notice and this permission notice -+ * appear in supporting documentation, and that the name of the -+ * copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -+ * SOFTWARE. -+ */ -+ -+#ifndef _XWAYLAND_PRIVATE_H_ -+#define _XWAYLAND_PRIVATE_H_ -+ -+struct xwl_window { -+ struct xwl_screen *xwl_screen; -+ struct wl_surface *surface; -+ struct wl_buffer *buffer; -+ WindowPtr window; -+ DamagePtr damage; -+ struct xorg_list link; -+ struct xorg_list link_damage; -+}; -+ -+struct xwl_output; -+ -+struct xwl_screen { -+ struct xwl_driver *driver; -+ ScreenPtr screen; -+ ScrnInfoPtr scrninfo; -+ int drm_fd; -+ int wayland_fd; -+ struct xwl_output *xwl_output; -+ struct wl_display *display; -+ struct wl_registry *registry; -+ struct wl_registry *drm_registry; -+ struct wl_registry *input_registry; -+ struct wl_registry *output_registry; -+ struct wl_compositor *compositor; -+ struct wl_drm *drm; -+ struct wl_shm *shm; -+ struct xserver *xorg_server; -+ uint32_t mask; -+ uint32_t flags; -+ char *device_name; -+ uint32_t authenticated; -+ struct xorg_list seat_list; -+ struct xorg_list damage_window_list; -+ struct xorg_list window_list; -+ struct xorg_list authenticate_client_list; -+ uint32_t serial; -+ -+ CreateWindowProcPtr CreateWindow; -+ DestroyWindowProcPtr DestroyWindow; -+ RealizeWindowProcPtr RealizeWindow; -+ UnrealizeWindowProcPtr UnrealizeWindow; -+ SetWindowPixmapProcPtr SetWindowPixmap; -+ MoveWindowProcPtr MoveWindow; -+ miPointerSpriteFuncPtr sprite_funcs; -+}; -+ -+struct xwl_output { -+ struct wl_output *output; -+ struct xwl_screen *xwl_screen; -+ int32_t x, y, width, height; -+ xf86Monitor xf86monitor; -+ xf86OutputPtr xf86output; -+ xf86CrtcPtr xf86crtc; -+}; -+ -+ -+#define MODIFIER_META 0x01 -+ -+struct xwl_seat { -+ DeviceIntPtr pointer; -+ DeviceIntPtr keyboard; -+ struct xwl_screen *xwl_screen; -+ struct wl_seat *seat; -+ struct wl_pointer *wl_pointer; -+ struct wl_keyboard *wl_keyboard; -+ struct wl_array keys; -+ struct wl_surface *cursor; -+ struct xwl_window *focus_window; -+ uint32_t id; -+ uint32_t pointer_enter_serial; -+ struct xorg_list link; -+ CursorPtr x_cursor; -+ -+ wl_fixed_t horizontal_scroll; -+ wl_fixed_t vertical_scroll; -+ uint32_t scroll_time; -+ -+ size_t keymap_size; -+ char *keymap; -+ -+}; -+ -+ -+struct xwl_screen *xwl_screen_get(ScreenPtr screen); -+ -+void xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrninfo); -+ -+int xwl_screen_init_cursor(struct xwl_screen *xwl_screen, ScreenPtr screen); -+int xwl_screen_init_window(struct xwl_screen *xwl_screen, ScreenPtr screen); -+ -+struct xwl_output *xwl_output_create(struct xwl_screen *xwl_screen); -+ -+void xwl_input_teardown(pointer p); -+pointer xwl_input_setup(pointer module, pointer opts, int *errmaj, int *errmin); -+void xwl_input_init(struct xwl_screen *screen); -+ -+Bool xwl_drm_initialised(struct xwl_screen *screen); -+ -+void xwl_seat_set_cursor(struct xwl_seat *xwl_seat); -+ -+extern const struct xserver_listener xwl_server_listener; -+ -+#endif /* _XWAYLAND_PRIVATE_H_ */ -diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c -new file mode 100644 -index 0000000..925d63c ---- /dev/null -+++ b/hw/xfree86/xwayland/xwayland-window.c -@@ -0,0 +1,316 @@ -+/* -+ * Copyright © 2011 Intel Corporation -+ * -+ * Permission to use, copy, modify, distribute, and sell this software -+ * and its documentation for any purpose is hereby granted without -+ * fee, provided that the above copyright notice appear in all copies -+ * and that both that copyright notice and this permission notice -+ * appear in supporting documentation, and that the name of the -+ * copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -+ * SOFTWARE. -+ */ -+ -+#ifdef HAVE_XORG_CONFIG_H -+#include "xorg-config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "xwayland.h" -+#include "xwayland-private.h" -+#include "xserver-client-protocol.h" -+ -+static DevPrivateKeyRec xwl_window_private_key; -+ -+static void -+free_pixmap(void *data, struct wl_callback *callback, uint32_t time) -+{ -+ PixmapPtr pixmap = data; -+ ScreenPtr screen = pixmap->drawable.pScreen; -+ -+ (*screen->DestroyPixmap)(pixmap); -+ wl_callback_destroy(callback); -+} -+ -+static const struct wl_callback_listener free_pixmap_listener = { -+ free_pixmap, -+}; -+ -+static void -+xwl_window_attach(struct xwl_window *xwl_window, PixmapPtr pixmap) -+{ -+ struct xwl_screen *xwl_screen = xwl_window->xwl_screen; -+ struct wl_callback *callback; -+ -+ /* We can safely destroy the buffer because we only use one buffer -+ * per surface in xwayland model */ -+ if (xwl_window->buffer) -+ wl_buffer_destroy(xwl_window->buffer); -+ -+ xwl_screen->driver->create_window_buffer(xwl_window, pixmap); -+ -+ if (!xwl_window->buffer) { -+ ErrorF("failed to create buffer\n"); -+ return; -+ } -+ -+ wl_surface_attach(xwl_window->surface, xwl_window->buffer, 0, 0); -+ wl_surface_damage(xwl_window->surface, 0, 0, -+ pixmap->drawable.width, -+ pixmap->drawable.height); -+ wl_surface_commit(xwl_window->surface); -+ -+ callback = wl_display_sync(xwl_screen->display); -+ wl_callback_add_listener(callback, &free_pixmap_listener, pixmap); -+ pixmap->refcnt++; -+} -+ -+static Bool -+xwl_create_window(WindowPtr window) -+{ -+ ScreenPtr screen = window->drawable.pScreen; -+ struct xwl_screen *xwl_screen; -+ char buffer[32]; -+ int len, rc; -+ Atom name; -+ Bool ret; -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ screen->CreateWindow = xwl_screen->CreateWindow; -+ ret = (*screen->CreateWindow)(window); -+ xwl_screen->CreateWindow = screen->CreateWindow; -+ screen->CreateWindow = xwl_create_window; -+ -+ if (!(xwl_screen->flags & XWL_FLAGS_ROOTLESS) || -+ window->parent != NULL) -+ return ret; -+ -+ CompositeRedirectSubwindows(window, CompositeRedirectManual); -+ -+ return ret; -+} -+ -+static int -+xwl_destroy_window (WindowPtr window) -+{ -+ ScreenPtr screen = window->drawable.pScreen; -+ struct xwl_screen *xwl_screen; -+ Bool ret; -+ -+ if (window->parent == NULL) -+ CompositeUnRedirectSubwindows (window, CompositeRedirectManual); -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ screen->DestroyWindow = xwl_screen->DestroyWindow; -+ ret = (*screen->DestroyWindow)(window); -+ xwl_screen->DestroyWindow = screen->DestroyWindow; -+ screen->DestroyWindow = xwl_destroy_window; -+ -+ return ret; -+} -+ -+static void -+damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) -+{ -+ struct xwl_window *xwl_window = data; -+ struct xwl_screen *xwl_screen = xwl_window->xwl_screen; -+ -+ xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list); -+} -+ -+static void -+damage_destroy(DamagePtr pDamage, void *data) -+{ -+} -+ -+static Bool -+xwl_realize_window(WindowPtr window) -+{ -+ ScreenPtr screen = window->drawable.pScreen; -+ struct xwl_screen *xwl_screen; -+ struct xwl_window *xwl_window; -+ Bool ret; -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ screen->RealizeWindow = xwl_screen->RealizeWindow; -+ ret = (*screen->RealizeWindow)(window); -+ xwl_screen->RealizeWindow = xwl_screen->RealizeWindow; -+ screen->RealizeWindow = xwl_realize_window; -+ -+ if (xwl_screen->flags & XWL_FLAGS_ROOTLESS) { -+ if (window->redirectDraw != RedirectDrawManual) -+ return ret; -+ } else { -+ if (window->parent) -+ return ret; -+ } -+ -+ xwl_window = calloc(sizeof *xwl_window, 1); -+ xwl_window->xwl_screen = xwl_screen; -+ xwl_window->window = window; -+ xwl_window->surface = -+ wl_compositor_create_surface(xwl_screen->compositor); -+ if (xwl_window->surface == NULL) { -+ ErrorF("wl_display_create_surface failed\n"); -+ return FALSE; -+ } -+ -+ if (xwl_screen->xorg_server) -+ xserver_set_window_id(xwl_screen->xorg_server, -+ xwl_window->surface, window->drawable.id); -+ -+ wl_surface_set_user_data(xwl_window->surface, xwl_window); -+ xwl_window_attach(xwl_window, (*screen->GetWindowPixmap)(window)); -+ -+ dixSetPrivate(&window->devPrivates, -+ &xwl_window_private_key, xwl_window); -+ -+ xwl_window->damage = -+ DamageCreate(damage_report, damage_destroy, DamageReportNonEmpty, -+ FALSE, screen, xwl_window); -+ DamageRegister(&window->drawable, xwl_window->damage); -+ DamageSetReportAfterOp(xwl_window->damage, TRUE); -+ -+ xorg_list_add(&xwl_window->link, &xwl_screen->window_list); -+ xorg_list_init(&xwl_window->link_damage); -+ -+ return ret; -+} -+ -+static Bool -+xwl_unrealize_window(WindowPtr window) -+{ -+ ScreenPtr screen = window->drawable.pScreen; -+ struct xwl_screen *xwl_screen; -+ struct xwl_window *xwl_window; -+ struct xwl_seat *xwl_seat; -+ Bool ret; -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ xorg_list_for_each_entry(xwl_seat, -+ &xwl_screen->seat_list, link) { -+ if (!xwl_seat->focus_window) -+ continue ; -+ if (xwl_seat->focus_window->window == window) { -+ xwl_seat->focus_window = NULL; -+ SetDeviceRedirectWindow(xwl_seat->pointer, PointerRootWin); -+ } -+ } -+ -+ screen->UnrealizeWindow = xwl_screen->UnrealizeWindow; -+ ret = (*screen->UnrealizeWindow)(window); -+ xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; -+ screen->UnrealizeWindow = xwl_unrealize_window; -+ -+ xwl_window = -+ dixLookupPrivate(&window->devPrivates, &xwl_window_private_key); -+ if (!xwl_window) -+ return ret; -+ -+ if (xwl_window->buffer) -+ wl_buffer_destroy(xwl_window->buffer); -+ wl_surface_destroy(xwl_window->surface); -+ xorg_list_del(&xwl_window->link); -+ if (RegionNotEmpty(DamageRegion(xwl_window->damage))) -+ xorg_list_del(&xwl_window->link_damage); -+ DamageDestroy(xwl_window->damage); -+ free(xwl_window); -+ dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL); -+ -+ return ret; -+} -+ -+static void -+xwl_set_window_pixmap(WindowPtr window, PixmapPtr pixmap) -+{ -+ ScreenPtr screen = window->drawable.pScreen; -+ struct xwl_screen *xwl_screen; -+ struct xwl_window *xwl_window; -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ screen->SetWindowPixmap = xwl_screen->SetWindowPixmap; -+ (*screen->SetWindowPixmap)(window, pixmap); -+ xwl_screen->SetWindowPixmap = screen->SetWindowPixmap; -+ screen->SetWindowPixmap = xwl_set_window_pixmap; -+ -+ xwl_window = -+ dixLookupPrivate(&window->devPrivates, &xwl_window_private_key); -+ if (xwl_window) -+ xwl_window_attach(xwl_window, pixmap); -+} -+ -+static void -+xwl_move_window(WindowPtr window, int x, int y, -+ WindowPtr sibling, VTKind kind) -+{ -+ ScreenPtr screen = window->drawable.pScreen; -+ struct xwl_screen *xwl_screen; -+ struct xwl_window *xwl_window; -+ -+ xwl_screen = xwl_screen_get(screen); -+ -+ screen->MoveWindow = xwl_screen->MoveWindow; -+ (*screen->MoveWindow)(window, x, y, sibling, kind); -+ xwl_screen->MoveWindow = screen->MoveWindow; -+ screen->MoveWindow = xwl_move_window; -+ -+ xwl_window = -+ dixLookupPrivate(&window->devPrivates, &xwl_window_private_key); -+ if (xwl_window == NULL) -+ return; -+} -+ -+int -+xwl_screen_init_window(struct xwl_screen *xwl_screen, ScreenPtr screen) -+{ -+ if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0)) -+ return BadAlloc; -+ -+ xwl_screen->CreateWindow = screen->CreateWindow; -+ screen->CreateWindow = xwl_create_window; -+ -+ xwl_screen->DestroyWindow = screen->DestroyWindow; -+ screen->DestroyWindow = xwl_destroy_window; -+ -+ xwl_screen->RealizeWindow = screen->RealizeWindow; -+ screen->RealizeWindow = xwl_realize_window; -+ -+ xwl_screen->UnrealizeWindow = screen->UnrealizeWindow; -+ screen->UnrealizeWindow = xwl_unrealize_window; -+ -+ xwl_screen->SetWindowPixmap = screen->SetWindowPixmap; -+ screen->SetWindowPixmap = xwl_set_window_pixmap; -+ -+ xwl_screen->MoveWindow = screen->MoveWindow; -+ screen->MoveWindow = xwl_move_window; -+ -+ return Success; -+} -diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c -new file mode 100644 -index 0000000..f59bfe4 ---- /dev/null -+++ b/hw/xfree86/xwayland/xwayland.c -@@ -0,0 +1,392 @@ -+/* -+ * Copyright © 2008-2011 Kristian Høgsberg -+ * -+ * Permission to use, copy, modify, distribute, and sell this software -+ * and its documentation for any purpose is hereby granted without -+ * fee, provided that the above copyright notice appear in all copies -+ * and that both that copyright notice and this permission notice -+ * appear in supporting documentation, and that the name of the -+ * copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -+ * SOFTWARE. -+ */ -+ -+#ifdef HAVE_XORG_CONFIG_H -+#include "xorg-config.h" -+#endif -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "xwayland.h" -+#include "xwayland-private.h" -+#include "xserver-client-protocol.h" -+ -+/* -+ * TODO: -+ * - lose X kb focus when wayland surface loses it -+ * - active grabs, grab owner crack -+ */ -+ -+static DevPrivateKeyRec xwl_screen_private_key; -+static Atom xdnd_atom; -+ -+static void -+xserver_client(void *data, struct xserver *xserver, int fd) -+{ -+ AddClientOnOpenFD(fd); -+} -+ -+static void -+xserver_listen_socket(void *data, struct xserver *xserver, int fd) -+{ -+ ListenOnOpenFD(fd, TRUE); -+} -+ -+const struct xserver_listener xwl_server_listener = { -+ xserver_client, -+ xserver_listen_socket -+}; -+ -+static void -+xwl_input_delayed_init(void *data, struct wl_callback *callback, uint32_t time) -+{ -+ struct xwl_screen *xwl_screen = data; -+ -+ ErrorF("xwl_input_delayed_init\n"); -+ -+ wl_callback_destroy(callback); -+ xwl_input_init(xwl_screen); -+} -+ -+static const struct wl_callback_listener delayed_init_listner = { -+ xwl_input_delayed_init -+}; -+ -+static void -+registry_global(void *data, struct wl_registry *registry, uint32_t id, -+ const char *interface, uint32_t version) -+{ -+ struct xwl_screen *xwl_screen = data; -+ -+ if (strcmp (interface, "wl_compositor") == 0) { -+ xwl_screen->compositor = -+ wl_registry_bind(registry, id, &wl_compositor_interface, 1); -+ } else if (strcmp(interface, "wl_shm") == 0) { -+ xwl_screen->shm = -+ wl_registry_bind(registry, id, &wl_shm_interface, 1); -+ } -+} -+ -+static const struct wl_registry_listener registry_listener = { -+ registry_global, -+}; -+ -+static void -+wakeup_handler(pointer data, int err, pointer read_mask) -+{ -+ struct xwl_screen *xwl_screen = data; -+ int ret; -+ -+ if (err < 0) -+ return; -+ -+ if (!FD_ISSET(xwl_screen->wayland_fd, (fd_set *) read_mask)) -+ return; -+ -+ ret = wl_display_dispatch(xwl_screen->display); -+ if (ret == -1) -+ FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); -+} -+ -+static void -+block_handler(pointer data, struct timeval **tv, pointer read_mask) -+{ -+ struct xwl_screen *xwl_screen = data; -+ int ret; -+ -+ ret = wl_display_dispatch_pending(xwl_screen->display); -+ if (ret == -1) -+ FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); -+ -+ ret = wl_display_flush(xwl_screen->display); -+ if (ret == -1) -+ FatalError("failed to write to XWayland fd: %s\n", strerror(errno)); -+} -+ -+int -+xwl_screen_init(struct xwl_screen *xwl_screen, ScreenPtr screen) -+{ -+ struct wl_callback *callback; -+ -+ xwl_screen->screen = screen; -+ -+ if (!dixRegisterPrivateKey(&xwl_screen_private_key, PRIVATE_SCREEN, 0)) -+ return BadAlloc; -+ -+ dixSetPrivate(&screen->devPrivates, -+ &xwl_screen_private_key, xwl_screen); -+ -+ xwl_screen_init_window(xwl_screen, screen); -+ -+ xwl_screen_init_cursor(xwl_screen, screen); -+ -+ AddGeneralSocket(xwl_screen->wayland_fd); -+ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen); -+ -+ callback = wl_display_sync(xwl_screen->display); -+ wl_callback_add_listener(callback, &delayed_init_listner, xwl_screen); -+ -+ return Success; -+} -+ -+struct xwl_screen * -+xwl_screen_get(ScreenPtr screen) -+{ -+ return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key); -+} -+ -+static void -+xwayland_selection_callback(CallbackListPtr *callbacks, -+ pointer data, pointer args) -+{ -+ SelectionInfoRec *info = (SelectionInfoRec *) args; -+ Selection *selection = info->selection; -+ -+ switch (info->kind) { -+ case SelectionSetOwner: -+ if (selection->selection == xdnd_atom) { -+ if (selection->window != None) -+ ErrorF("client %p starts dnd\n", info->client); -+ else -+ ErrorF("client %p stops dnd\n", info->client); -+ } -+ break; -+ case SelectionWindowDestroy: -+ ErrorF("selection window destroy\n"); -+ break; -+ case SelectionClientClose: -+ ErrorF("selection client close\n"); -+ break; -+ } -+} -+ -+struct xwl_screen * -+xwl_screen_create(void) -+{ -+ struct xwl_screen *xwl_screen; -+ -+ xwl_screen = calloc(sizeof *xwl_screen, 1); -+ if (xwl_screen == NULL) { -+ ErrorF("calloc failed\n"); -+ return NULL; -+ } -+ -+ xwl_screen->display = wl_display_connect(NULL); -+ if (xwl_screen->display == NULL) { -+ ErrorF("wl_display_create failed\n"); -+ return NULL; -+ } -+ -+ return xwl_screen; -+} -+ -+Bool -+xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen, -+ uint32_t flags, struct xwl_driver *driver) -+{ -+ int ret; -+ -+ noScreenSaverExtension = TRUE; -+ -+ xdnd_atom = MakeAtom("XdndSelection", 13, 1); -+ if (!AddCallback(&SelectionCallback, -+ xwayland_selection_callback, xwl_screen)) { -+ return FALSE; -+ } -+ -+ xorg_list_init(&xwl_screen->seat_list); -+ xorg_list_init(&xwl_screen->damage_window_list); -+ xorg_list_init(&xwl_screen->window_list); -+ xorg_list_init(&xwl_screen->authenticate_client_list); -+ xwl_screen->scrninfo = scrninfo; -+ xwl_screen->driver = driver; -+ xwl_screen->flags = flags; -+ xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display); -+ -+ if (xorgRootless) -+ xwl_screen->flags |= XWL_FLAGS_ROOTLESS; -+ -+ /* Set up listener so we'll catch all events. */ -+ xwl_screen->registry = wl_display_get_registry(xwl_screen->display); -+ wl_registry_add_listener(xwl_screen->registry, ®istry_listener, -+ xwl_screen); -+ ret = wl_display_roundtrip(xwl_screen->display); -+ if (ret == -1) { -+ xf86DrvMsg(scrninfo->scrnIndex, X_ERROR, -+ "failed to dispatch Wayland events: %s\n", strerror(errno)); -+ return FALSE; -+ } -+ -+#ifdef WITH_LIBDRM -+ if (xwl_screen->driver->use_drm && !xwl_drm_initialised(xwl_screen)) -+ if (xwl_drm_pre_init(xwl_screen) != Success) -+ return FALSE; -+#endif -+ -+ xwayland_screen_preinit_output(xwl_screen, scrninfo); -+ -+ return TRUE; -+} -+ -+int -+xwl_create_window_buffer_shm(struct xwl_window *xwl_window, -+ PixmapPtr pixmap, int fd) -+{ -+ struct wl_shm_pool *pool; -+ int size, stride; -+ -+ stride = pixmap->drawable.width * 4; -+ -+ size = pixmap->drawable.width * pixmap->drawable.height * 4; -+ pool = wl_shm_create_pool(xwl_window->xwl_screen->shm, fd, size); -+ xwl_window->buffer = wl_shm_pool_create_buffer(pool, 0, -+ pixmap->drawable.width, -+ pixmap->drawable.height, -+ stride, WL_SHM_FORMAT_ARGB8888); -+ wl_shm_pool_destroy(pool); -+ -+ return xwl_window->buffer ? Success : BadDrawable; -+} -+ -+void xwl_screen_close(struct xwl_screen *xwl_screen) -+{ -+ struct xwl_seat *xwl_seat, *itmp; -+ struct xwl_window *xwl_window, *wtmp; -+ -+ if (xwl_screen->registry) -+ wl_registry_destroy(xwl_screen->registry); -+ xwl_screen->registry = NULL; -+ -+ xorg_list_for_each_entry_safe(xwl_seat, itmp, -+ &xwl_screen->seat_list, link) { -+ wl_seat_destroy(xwl_seat->seat); -+ free(xwl_seat); -+ } -+ xorg_list_for_each_entry_safe(xwl_window, wtmp, -+ &xwl_screen->window_list, link) { -+ wl_buffer_destroy(xwl_window->buffer); -+ wl_surface_destroy(xwl_window->surface); -+ free(xwl_window); -+ } -+ -+ xorg_list_init(&xwl_screen->seat_list); -+ xorg_list_init(&xwl_screen->damage_window_list); -+ xorg_list_init(&xwl_screen->window_list); -+ xorg_list_init(&xwl_screen->authenticate_client_list); -+ -+ wl_display_roundtrip(xwl_screen->display); -+} -+ -+void xwl_screen_destroy(struct xwl_screen *xwl_screen) -+{ -+ if (xwl_screen->xwl_output) { -+ xf86OutputDestroy(xwl_screen->xwl_output->xf86output); -+ xf86CrtcDestroy(xwl_screen->xwl_output->xf86crtc); -+ } -+ -+ free(xwl_screen->xwl_output); -+ free(xwl_screen); -+} -+ -+/* DDX driver must call this after submitting the rendering */ -+void xwl_screen_post_damage(struct xwl_screen *xwl_screen) -+{ -+ struct xwl_window *xwl_window; -+ RegionPtr region; -+ BoxPtr box; -+ int count, i; -+ -+ xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list, -+ link_damage) { -+ -+ region = DamageRegion(xwl_window->damage); -+ count = RegionNumRects(region); -+ for (i = 0; i < count; i++) { -+ box = &RegionRects(region)[i]; -+ wl_surface_damage(xwl_window->surface, -+ box->x1, box->y1, -+ box->x2 - box->x1 + 1, -+ box->y2 - box->y1 + 1); -+ } -+ wl_surface_attach(xwl_window->surface, -+ xwl_window->buffer, -+ 0, 0); -+ wl_surface_commit(xwl_window->surface); -+ DamageEmpty(xwl_window->damage); -+ } -+ -+ xorg_list_init(&xwl_screen->damage_window_list); -+} -+ -+static pointer -+xwl_setup(pointer module, pointer opts, int *errmaj, int *errmin) -+{ -+ return xwl_input_setup(module, opts, errmaj, errmin); -+} -+ -+static void -+xwl_teardown(pointer p) -+{ -+ xwl_input_teardown(p); -+} -+ -+static XF86ModuleVersionInfo xwl_version_info = { -+ "xwayland", -+ MODULEVENDORSTRING, -+ MODINFOSTRING1, -+ MODINFOSTRING2, -+ XORG_VERSION_CURRENT, -+ 1, 0, 0, -+ ABI_CLASS_EXTENSION, -+ ABI_EXTENSION_VERSION, -+ MOD_CLASS_NONE, -+ { 0, 0, 0, 0 } -+}; -+ -+_X_EXPORT const XF86ModuleData xwaylandModuleData = { -+ &xwl_version_info, -+ &xwl_setup, -+ &xwl_teardown -+}; -+ -+int -+xwl_version(void) -+{ -+ return xwl_version_info.minorversion; -+} -diff --git a/hw/xfree86/xwayland/xwayland.h b/hw/xfree86/xwayland/xwayland.h -new file mode 100644 -index 0000000..f268366 ---- /dev/null -+++ b/hw/xfree86/xwayland/xwayland.h -@@ -0,0 +1,83 @@ -+/* -+ * Copyright © 2008 Kristian Høgsberg -+ * -+ * Permission to use, copy, modify, distribute, and sell this software -+ * and its documentation for any purpose is hereby granted without -+ * fee, provided that the above copyright notice appear in all copies -+ * and that both that copyright notice and this permission notice -+ * appear in supporting documentation, and that the name of the -+ * copyright holders not be used in advertising or publicity -+ * pertaining to distribution of the software without specific, -+ * written prior permission. The copyright holders make no -+ * representations about the suitability of this software for any -+ * purpose. It is provided "as is" without express or implied -+ * warranty. -+ * -+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS -+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY -+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN -+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING -+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -+ * SOFTWARE. -+ */ -+ -+#ifndef _XWAYLAND_H_ -+#define _XWAYLAND_H_ -+ -+#define XWL_VERSION 2 -+ -+struct xwl_window; -+struct xwl_screen; -+ -+struct xwl_driver { -+ int version; -+ int use_drm; -+ int (*create_window_buffer)(struct xwl_window *xwl_window, -+ PixmapPtr pixmap); -+}; -+ -+#define XWL_FLAGS_ROOTLESS 0x01 -+ -+extern _X_EXPORT int -+xwl_version(void); -+ -+extern _X_EXPORT struct xwl_screen * -+xwl_screen_create(void); -+ -+extern _X_EXPORT Bool -+xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen, -+ uint32_t flags, struct xwl_driver *driver); -+ -+extern _X_EXPORT int -+xwl_screen_init(struct xwl_screen *xwl_screen, ScreenPtr screen); -+ -+extern _X_EXPORT int -+xwl_drm_pre_init(struct xwl_screen *xwl_screen); -+ -+extern _X_EXPORT int -+xwl_screen_get_drm_fd(struct xwl_screen *xwl_screen); -+ -+extern _X_EXPORT void -+xwl_screen_close(struct xwl_screen *xwl_screen); -+ -+extern _X_EXPORT void -+xwl_screen_destroy(struct xwl_screen *xwl_screen); -+ -+extern _X_EXPORT void -+xwl_screen_post_damage(struct xwl_screen *xwl_screen); -+ -+extern _X_EXPORT int -+xwl_drm_authenticate(ClientPtr client, struct xwl_screen *xwl_screen, -+ uint32_t magic); -+ -+extern _X_EXPORT int -+xwl_create_window_buffer_drm(struct xwl_window *xwl_window, -+ PixmapPtr pixmap, uint32_t name); -+ -+extern _X_EXPORT int -+xwl_create_window_buffer_shm(struct xwl_window *xwl_window, -+ PixmapPtr pixmap, int fd); -+ -+#endif /* _XWAYLAND_H_ */ -diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in -index 960817e..ec43ff7 100644 ---- a/include/xorg-server.h.in -+++ b/include/xorg-server.h.in -@@ -221,4 +221,7 @@ - /* Have support for X shared memory fence library (xshmfence) */ - #undef HAVE_XSHMFENCE - -+/* Building Xorg server. */ -+#undef XORG_WAYLAND -+ - #endif /* _XORG_SERVER_H_ */ --- -1.8.3.1 - diff --git a/SOURCES/0011-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch b/SOURCES/0011-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch new file mode 100644 index 0000000..91869bc --- /dev/null +++ b/SOURCES/0011-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch @@ -0,0 +1,31 @@ +From 341f2f5de09e59c3498d5f4e626b8fd86f4a0dcd Mon Sep 17 00:00:00 2001 +From: Giovanni Campagna +Date: Wed, 21 Aug 2013 09:53:25 +0200 +Subject: [PATCH 11/38] xwayland-shm: don't create alpha buffers if the window + doesn't have alpha + +If the window is using a 24 bit visual, we must request a buffer +format without alpha, or garbage is rendered. +--- + hw/xfree86/xwayland/xwayland.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c +index f59bfe4..880b7ec 100644 +--- a/hw/xfree86/xwayland/xwayland.c ++++ b/hw/xfree86/xwayland/xwayland.c +@@ -278,7 +278,10 @@ xwl_create_window_buffer_shm(struct xwl_window *xwl_window, + xwl_window->buffer = wl_shm_pool_create_buffer(pool, 0, + pixmap->drawable.width, + pixmap->drawable.height, +- stride, WL_SHM_FORMAT_ARGB8888); ++ stride, ++ pixmap->drawable.depth == 32 ? ++ WL_SHM_FORMAT_ARGB8888 : ++ WL_SHM_FORMAT_XRGB8888); + wl_shm_pool_destroy(pool); + + return xwl_window->buffer ? Success : BadDrawable; +-- +1.8.4.2 + diff --git a/SOURCES/0012-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch b/SOURCES/0012-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch deleted file mode 100644 index 3a66a7b..0000000 --- a/SOURCES/0012-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 201d8504ebaa1de7be149089281a7f40cd57bb38 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Wed, 21 Aug 2013 23:02:58 -0700 -Subject: [PATCH 12/39] xwayland: Add a HW_WAYLAND flag to let drivers - explicitly opt-in - ---- - hw/xfree86/common/xf86Init.c | 11 +++++++---- - hw/xfree86/common/xf86str.h | 1 + - 2 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c -index 98adaab..2d3bb01 100644 ---- a/hw/xfree86/common/xf86Init.c -+++ b/hw/xfree86/common/xf86Init.c -@@ -547,11 +547,14 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) - if (!(flags & HW_SKIP_CONSOLE)) - xorgHWOpenConsole = TRUE; - -- if (xorgWayland && -- (NEED_IO_ENABLED(flags) || !(flags & HW_SKIP_CONSOLE))) { -+ if (xorgWayland) { -+ if (flags != HW_WAYLAND) { -+ xf86DeleteDriver(i); -+ continue; -+ } - -- xf86DeleteDriver(i); -- continue; -+ want_hw_access = FALSE; -+ xorgHWOpenConsole = FALSE; - } - } - -diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h -index 4c2d147..976fa30 100644 ---- a/hw/xfree86/common/xf86str.h -+++ b/hw/xfree86/common/xf86str.h -@@ -288,6 +288,7 @@ typedef struct { - #define HW_MMIO 2 - #define HW_SKIP_CONSOLE 4 - #define NEED_IO_ENABLED(x) (x & HW_IO) -+#define HW_WAYLAND 8 - - typedef CARD32 xorgHWFlags; - --- -1.8.3.1 - diff --git a/SOURCES/0012-xwayland-handle-global-object-destruction.patch b/SOURCES/0012-xwayland-handle-global-object-destruction.patch new file mode 100644 index 0000000..e844d5a --- /dev/null +++ b/SOURCES/0012-xwayland-handle-global-object-destruction.patch @@ -0,0 +1,234 @@ +From 1e37681072a69decce7441e762cb5f4ce1a80d73 Mon Sep 17 00:00:00 2001 +From: Giovanni Campagna +Date: Wed, 21 Aug 2013 09:53:26 +0200 +Subject: [PATCH 12/38] xwayland: handle global object destruction + +Certain global objects, such as outputs, can be destroyed during +the session. We must handle that and not crash. +--- + hw/xfree86/xwayland/xwayland-drm.c | 7 ++++++ + hw/xfree86/xwayland/xwayland-input.c | 7 ++++++ + hw/xfree86/xwayland/xwayland-output.c | 40 +++++++++++++++++++++++++++++++--- + hw/xfree86/xwayland/xwayland-private.h | 6 ++++- + hw/xfree86/xwayland/xwayland.c | 17 +++++++++++---- + 5 files changed, 69 insertions(+), 8 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland-drm.c b/hw/xfree86/xwayland/xwayland-drm.c +index ce56e4c..6e4c778 100644 +--- a/hw/xfree86/xwayland/xwayland-drm.c ++++ b/hw/xfree86/xwayland/xwayland-drm.c +@@ -119,8 +119,15 @@ drm_handler(void *data, struct wl_registry *registry, uint32_t id, + } + } + ++static void ++global_remove(void *data, struct wl_registry *registry, uint32_t name) ++{ ++ /* Nothing to do here, wl_drm should not be removed */ ++} ++ + static const struct wl_registry_listener drm_listener = { + drm_handler, ++ global_remove + }; + + int +diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c +index 2f8e0c7..d031b34 100644 +--- a/hw/xfree86/xwayland/xwayland-input.c ++++ b/hw/xfree86/xwayland/xwayland-input.c +@@ -597,8 +597,15 @@ input_handler(void *data, struct wl_registry *registry, uint32_t id, + } + } + ++static void ++global_remove(void *data, struct wl_registry *registry, uint32_t name) ++{ ++ /* FIXME */ ++} ++ + static const struct wl_registry_listener input_listener = { + input_handler, ++ global_remove, + }; + + void +diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c +index 8f087f6..46238f4 100644 +--- a/hw/xfree86/xwayland/xwayland-output.c ++++ b/hw/xfree86/xwayland/xwayland-output.c +@@ -95,6 +95,14 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) + { + } + ++static void ++crtc_destroy(xf86CrtcPtr crtc) ++{ ++ /* Nothing to do here, we only destroy CRTCs when instructed to do ++ so by wl_output changes ++ */ ++} ++ + static const xf86CrtcFuncsRec crtc_funcs = { + .dpms = crtc_dpms, + .set_mode_major = crtc_set_mode_major, +@@ -106,7 +114,7 @@ static const xf86CrtcFuncsRec crtc_funcs = { + .shadow_create = crtc_shadow_create, + .shadow_allocate = crtc_shadow_allocate, + .shadow_destroy = crtc_shadow_destroy, +- .destroy = NULL, /* XXX */ ++ .destroy = crtc_destroy, + }; + + static void +@@ -246,7 +254,7 @@ display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, + xwl_output->x = x; + xwl_output->y = y; + +- xwl_screen->xwl_output = xwl_output; ++ xorg_list_append (&xwl_output->link, &xwl_screen->output_list); + } + + static void +@@ -277,13 +285,39 @@ global_handler(void *data, struct wl_registry *registry, uint32_t id, + xwl_output = xwl_output_create(xwl_screen); + xwl_output->output = wl_registry_bind(registry, id, + &wl_output_interface, 1); ++ xwl_output->name = id; + wl_output_add_listener(xwl_output->output, + &output_listener, xwl_output); + } + } + ++void ++xwl_output_remove(struct xwl_output *xwl_output) ++{ ++ xorg_list_del (&xwl_output->link); ++ xf86OutputDestroy (xwl_output->xf86output); ++ xf86CrtcDestroy (xwl_output->xf86crtc); ++ ++ wl_output_destroy (xwl_output->output); ++} ++ ++static void ++global_remove(void *data, struct wl_registry *registry, uint32_t name) ++{ ++ struct xwl_screen *xwl_screen = data; ++ struct xwl_output *xwl_output, *tmp; ++ ++ xorg_list_for_each_entry_safe (xwl_output, tmp, &xwl_screen->output_list, link) { ++ if (xwl_output->name == name) { ++ xwl_output_remove(xwl_output); ++ break; ++ } ++ } ++} ++ + static const struct wl_registry_listener global_listener = { + global_handler, ++ global_remove + }; + + void +@@ -299,7 +333,7 @@ xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrnin + wl_registry_add_listener(xwl_screen->output_registry, &global_listener, + xwl_screen); + +- while (!xwl_screen->xwl_output) { ++ while (xwl_screen->output_list.next == &xwl_screen->output_list) { + ret = wl_display_roundtrip(xwl_screen->display); + if (ret == -1) + FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); +diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h +index e427316..7005db2 100644 +--- a/hw/xfree86/xwayland/xwayland-private.h ++++ b/hw/xfree86/xwayland/xwayland-private.h +@@ -44,7 +44,6 @@ struct xwl_screen { + ScrnInfoPtr scrninfo; + int drm_fd; + int wayland_fd; +- struct xwl_output *xwl_output; + struct wl_display *display; + struct wl_registry *registry; + struct wl_registry *drm_registry; +@@ -58,6 +57,7 @@ struct xwl_screen { + uint32_t flags; + char *device_name; + uint32_t authenticated; ++ struct xorg_list output_list; + struct xorg_list seat_list; + struct xorg_list damage_window_list; + struct xorg_list window_list; +@@ -74,12 +74,14 @@ struct xwl_screen { + }; + + struct xwl_output { ++ struct xorg_list link; + struct wl_output *output; + struct xwl_screen *xwl_screen; + int32_t x, y, width, height; + xf86Monitor xf86monitor; + xf86OutputPtr xf86output; + xf86CrtcPtr xf86crtc; ++ int32_t name; + }; + + +@@ -127,6 +129,8 @@ Bool xwl_drm_initialised(struct xwl_screen *screen); + + void xwl_seat_set_cursor(struct xwl_seat *xwl_seat); + ++void xwl_output_remove(struct xwl_output *output); ++ + extern const struct xserver_listener xwl_server_listener; + + #endif /* _XWAYLAND_PRIVATE_H_ */ +diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c +index 880b7ec..2047a85 100644 +--- a/hw/xfree86/xwayland/xwayland.c ++++ b/hw/xfree86/xwayland/xwayland.c +@@ -103,8 +103,15 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, + } + } + ++static void ++global_remove(void *data, struct wl_registry *registry, uint32_t name) ++{ ++ /* Nothing to do here, wl_compositor and wl_shm should not be removed */ ++} ++ + static const struct wl_registry_listener registry_listener = { + registry_global, ++ global_remove + }; + + static void +@@ -230,6 +237,7 @@ xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen, + return FALSE; + } + ++ xorg_list_init(&xwl_screen->output_list); + xorg_list_init(&xwl_screen->seat_list); + xorg_list_init(&xwl_screen->damage_window_list); + xorg_list_init(&xwl_screen->window_list); +@@ -318,12 +326,13 @@ void xwl_screen_close(struct xwl_screen *xwl_screen) + + void xwl_screen_destroy(struct xwl_screen *xwl_screen) + { +- if (xwl_screen->xwl_output) { +- xf86OutputDestroy(xwl_screen->xwl_output->xf86output); +- xf86CrtcDestroy(xwl_screen->xwl_output->xf86crtc); ++ struct xwl_output *xwl_output, *tmp; ++ ++ xorg_list_for_each_entry_safe (xwl_output, tmp, &xwl_screen->output_list, link) { ++ xwl_output_remove(xwl_output); ++ break; + } + +- free(xwl_screen->xwl_output); + free(xwl_screen); + } + +-- +1.8.4.2 + diff --git a/SOURCES/0013-xwayland-add-support-for-multiple-outputs.patch b/SOURCES/0013-xwayland-add-support-for-multiple-outputs.patch new file mode 100644 index 0000000..ba72b97 --- /dev/null +++ b/SOURCES/0013-xwayland-add-support-for-multiple-outputs.patch @@ -0,0 +1,215 @@ +From c22c7d4062b24f10a1d841629cc1e1822cad1f45 Mon Sep 17 00:00:00 2001 +From: Giovanni Campagna +Date: Thu, 22 Aug 2013 16:23:48 +0200 +Subject: [PATCH 13/38] xwayland: add support for multiple outputs + +Drop xf86InitialConfiguration, which just gets in the way +of the compositor doing its own output arrangement, and transform +wayland events into the appropriate low-level xf86 calls to +keep the screen size updated. + +Kristian: after the rebase it was crashing for me too, had to fix +the patch a bit. This one should work, and also gives sensible (though +not perfect) results for xrandr clients. +Tested with weston/x11 and mutter-wayland/kms. +--- + hw/xfree86/xwayland/xwayland-output.c | 112 ++++++++++++++++++++++++++++++--- + hw/xfree86/xwayland/xwayland-private.h | 2 + + 2 files changed, 105 insertions(+), 9 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c +index 46238f4..66c7d48 100644 +--- a/hw/xfree86/xwayland/xwayland-output.c ++++ b/hw/xfree86/xwayland/xwayland-output.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "xwayland.h" + #include "xwayland-private.h" +@@ -182,6 +183,10 @@ xwl_output_create(struct xwl_screen *xwl_screen) + struct xwl_output *xwl_output; + xf86OutputPtr xf86output; + xf86CrtcPtr xf86crtc; ++ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(xwl_screen->scrninfo); ++ int crtcId, outputId; ++ static int nameId; ++ char *name; + + xwl_output = calloc(sizeof *xwl_output, 1); + if (xwl_output == NULL) { +@@ -189,19 +194,41 @@ xwl_output_create(struct xwl_screen *xwl_screen) + return NULL; + } + ++ nameId++; ++ if (asprintf(&name, "XWAYLAND-%d", nameId) < 0) { ++ ErrorF("create_output ENOMEM"); ++ free(xwl_output); ++ return NULL; ++ } ++ + xwl_output->xwl_screen = xwl_screen; + ++ xf86crtc = xf86CrtcCreate(xwl_screen->scrninfo, &crtc_funcs); ++ xf86crtc->enabled = TRUE; ++ xf86crtc->driver_private = xwl_output; ++ ++ for (crtcId = 0; crtcId < xf86_config->num_crtc; crtcId++) { ++ if (xf86_config->crtc[crtcId] == xf86crtc) ++ break; ++ } ++ + xf86output = xf86OutputCreate(xwl_screen->scrninfo, +- &output_funcs, "XWAYLAND-1"); ++ &output_funcs, name); + xf86output->driver_private = xwl_output; +- xf86output->possible_crtcs = 1; +- xf86output->possible_clones = 1; ++ xf86output->possible_crtcs = 1 << crtcId; + +- xf86crtc = xf86CrtcCreate(xwl_screen->scrninfo, &crtc_funcs); +- xf86crtc->driver_private = xwl_output; ++ for (outputId = 0; outputId < xf86_config->num_output; outputId++) { ++ if (xf86_config->output[outputId] == xf86output) ++ break; ++ } ++ ++ xf86output->possible_clones = 1 << outputId; + + xwl_output->xf86output = xf86output; + xwl_output->xf86crtc = xf86crtc; ++ xwl_output->xf86output->crtc = xf86crtc; ++ ++ free(name); + + return xwl_output; + } +@@ -219,6 +246,32 @@ static const xf86CrtcConfigFuncsRec config_funcs = { + resize + }; + ++static Rotation ++wl_transform_to_xrandr (enum wl_output_transform transform) ++{ ++ switch (transform) ++ { ++ case WL_OUTPUT_TRANSFORM_NORMAL: ++ return RR_Rotate_0; ++ case WL_OUTPUT_TRANSFORM_90: ++ return RR_Rotate_90; ++ case WL_OUTPUT_TRANSFORM_180: ++ return RR_Rotate_180; ++ case WL_OUTPUT_TRANSFORM_270: ++ return RR_Rotate_270; ++ case WL_OUTPUT_TRANSFORM_FLIPPED: ++ return RR_Reflect_X | RR_Rotate_0; ++ case WL_OUTPUT_TRANSFORM_FLIPPED_90: ++ return RR_Reflect_X | RR_Rotate_90; ++ case WL_OUTPUT_TRANSFORM_FLIPPED_180: ++ return RR_Reflect_X | RR_Rotate_180; ++ case WL_OUTPUT_TRANSFORM_FLIPPED_270: ++ return RR_Reflect_X | RR_Rotate_270; ++ } ++ ++ return RR_Rotate_0; ++} ++ + static void + display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, + int physical_width, int physical_height, int subpixel, +@@ -253,6 +306,7 @@ display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, + + xwl_output->x = x; + xwl_output->y = y; ++ xwl_output->rotation = wl_transform_to_xrandr (transform); + + xorg_list_append (&xwl_output->link, &xwl_screen->output_list); + } +@@ -262,11 +316,49 @@ display_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, + int width, int height, int refresh) + { + struct xwl_output *xwl_output = data; ++ struct xwl_screen *xwl_screen = xwl_output->xwl_screen; ++ ScreenPtr pScreen = xwl_screen->screen; ++ ScrnInfoPtr scrn = xwl_screen->scrninfo; ++ CARD16 width_mm, height_mm; ++ DisplayModePtr mode; ++ rrScrPrivPtr rp; + +- if (flags & WL_OUTPUT_MODE_CURRENT) { +- xwl_output->width = width; +- xwl_output->height = height; ++ if (!(flags & WL_OUTPUT_MODE_CURRENT)) ++ return; ++ ++ xwl_output->width = width; ++ xwl_output->height = height; ++ ++ if (xwl_output->x + xwl_output->width > scrn->virtualX || ++ xwl_output->y + xwl_output->height > scrn->virtualY) { ++ /* Fake a RandR request to resize the screen. It will bounce ++ back to our crtc_resize, which does nothing. ++ */ ++ /* Preupdate virtualX / virtualY, so that crtc_resize returns TRUE */ ++ scrn->virtualX = xwl_output->x + xwl_output->width; ++ scrn->virtualY = xwl_output->y + xwl_output->height; ++ ++ /* Ignore the compositor provided values for mm_width/mm_height, ++ as it doesn't make sense to sum the values of different outputs. ++ Just make the DPI 96 */ ++ width_mm = (scrn->virtualX / 96.0) * 25.4 + 0.5; ++ height_mm = (scrn->virtualY / 96.0) * 25.4 + 0.5; ++ ++ /* But! When the server starts, the RandR stuff is not initialized, ++ so we can't call rrGetScrPriv. We updated virtualX/Y anyway, let's ++ hope it's enough. ++ */ ++ if (xwl_screen->outputs_initialized) { ++ rp = rrGetScrPriv(pScreen); ++ if (rp->rrScreenSetSize) ++ rp->rrScreenSetSize(pScreen, scrn->virtualX, scrn->virtualY, width_mm, height_mm); ++ } + } ++ ++ xwl_output->xf86crtc->enabled = TRUE; ++ mode = xf86CVTMode(width, height, refresh, TRUE, FALSE); ++ xf86CrtcSetModeTransform(xwl_output->xf86crtc, mode, xwl_output->rotation, ++ NULL, xwl_output->x, xwl_output->y); + } + + static const struct wl_output_listener output_listener = { +@@ -339,5 +431,7 @@ xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrnin + FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); + } + +- xf86InitialConfiguration(scrninfo, TRUE); ++ xwl_screen->outputs_initialized = TRUE; ++ ++ xf86SetScrnInfoModes(scrninfo); + } +diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h +index 7005db2..b0b2201 100644 +--- a/hw/xfree86/xwayland/xwayland-private.h ++++ b/hw/xfree86/xwayland/xwayland-private.h +@@ -63,6 +63,7 @@ struct xwl_screen { + struct xorg_list window_list; + struct xorg_list authenticate_client_list; + uint32_t serial; ++ Bool outputs_initialized; + + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; +@@ -82,6 +83,7 @@ struct xwl_output { + xf86OutputPtr xf86output; + xf86CrtcPtr xf86crtc; + int32_t name; ++ Rotation rotation; + }; + + +-- +1.8.4.2 + diff --git a/SOURCES/0013-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch b/SOURCES/0013-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch deleted file mode 100644 index f49b5c8..0000000 --- a/SOURCES/0013-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a8f7359014b9e604998a2da53764fe99e5c7b784 Mon Sep 17 00:00:00 2001 -From: Giovanni Campagna -Date: Wed, 21 Aug 2013 09:53:25 +0200 -Subject: [PATCH 13/39] xwayland-shm: don't create alpha buffers if the window - doesn't have alpha - -If the window is using a 24 bit visual, we must request a buffer -format without alpha, or garbage is rendered. ---- - hw/xfree86/xwayland/xwayland.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c -index f59bfe4..880b7ec 100644 ---- a/hw/xfree86/xwayland/xwayland.c -+++ b/hw/xfree86/xwayland/xwayland.c -@@ -278,7 +278,10 @@ xwl_create_window_buffer_shm(struct xwl_window *xwl_window, - xwl_window->buffer = wl_shm_pool_create_buffer(pool, 0, - pixmap->drawable.width, - pixmap->drawable.height, -- stride, WL_SHM_FORMAT_ARGB8888); -+ stride, -+ pixmap->drawable.depth == 32 ? -+ WL_SHM_FORMAT_ARGB8888 : -+ WL_SHM_FORMAT_XRGB8888); - wl_shm_pool_destroy(pool); - - return xwl_window->buffer ? Success : BadDrawable; --- -1.8.3.1 - diff --git a/SOURCES/0014-xwayland-Probe-outputs-on-preinit.patch b/SOURCES/0014-xwayland-Probe-outputs-on-preinit.patch new file mode 100644 index 0000000..4c168f6 --- /dev/null +++ b/SOURCES/0014-xwayland-Probe-outputs-on-preinit.patch @@ -0,0 +1,34 @@ +From 21d9ed2b2ad45c7c363194a4c4fe2306bb26b130 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Sun, 1 Sep 2013 23:14:43 +0200 +Subject: [PATCH 14/38] xwayland: Probe outputs on preinit +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When running xwayland, calls to xf86SetDesiredModes() would fail due to +the probed modes list not being populated. This was previously done +indirectly by calling xf86InitialConfiguration() and now needs to be +done explicitly instead. + +Signed-off-by: Jonas Ådahl +--- + hw/xfree86/xwayland/xwayland-output.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c +index 66c7d48..691b5f0 100644 +--- a/hw/xfree86/xwayland/xwayland-output.c ++++ b/hw/xfree86/xwayland/xwayland-output.c +@@ -431,6 +431,8 @@ xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrnin + FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); + } + ++ xf86ProbeOutputModes(scrninfo, 0, 0); ++ + xwl_screen->outputs_initialized = TRUE; + + xf86SetScrnInfoModes(scrninfo); +-- +1.8.4.2 + diff --git a/SOURCES/0014-xwayland-handle-global-object-destruction.patch b/SOURCES/0014-xwayland-handle-global-object-destruction.patch deleted file mode 100644 index f28dd1b..0000000 --- a/SOURCES/0014-xwayland-handle-global-object-destruction.patch +++ /dev/null @@ -1,234 +0,0 @@ -From a7da07002daaa1e1397a3fe32ea3c77df4f15071 Mon Sep 17 00:00:00 2001 -From: Giovanni Campagna -Date: Wed, 21 Aug 2013 09:53:26 +0200 -Subject: [PATCH 14/39] xwayland: handle global object destruction - -Certain global objects, such as outputs, can be destroyed during -the session. We must handle that and not crash. ---- - hw/xfree86/xwayland/xwayland-drm.c | 7 ++++++ - hw/xfree86/xwayland/xwayland-input.c | 7 ++++++ - hw/xfree86/xwayland/xwayland-output.c | 40 +++++++++++++++++++++++++++++++--- - hw/xfree86/xwayland/xwayland-private.h | 6 ++++- - hw/xfree86/xwayland/xwayland.c | 17 +++++++++++---- - 5 files changed, 69 insertions(+), 8 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland-drm.c b/hw/xfree86/xwayland/xwayland-drm.c -index ce56e4c..6e4c778 100644 ---- a/hw/xfree86/xwayland/xwayland-drm.c -+++ b/hw/xfree86/xwayland/xwayland-drm.c -@@ -119,8 +119,15 @@ drm_handler(void *data, struct wl_registry *registry, uint32_t id, - } - } - -+static void -+global_remove(void *data, struct wl_registry *registry, uint32_t name) -+{ -+ /* Nothing to do here, wl_drm should not be removed */ -+} -+ - static const struct wl_registry_listener drm_listener = { - drm_handler, -+ global_remove - }; - - int -diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c -index 2f8e0c7..d031b34 100644 ---- a/hw/xfree86/xwayland/xwayland-input.c -+++ b/hw/xfree86/xwayland/xwayland-input.c -@@ -597,8 +597,15 @@ input_handler(void *data, struct wl_registry *registry, uint32_t id, - } - } - -+static void -+global_remove(void *data, struct wl_registry *registry, uint32_t name) -+{ -+ /* FIXME */ -+} -+ - static const struct wl_registry_listener input_listener = { - input_handler, -+ global_remove, - }; - - void -diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c -index 8f087f6..46238f4 100644 ---- a/hw/xfree86/xwayland/xwayland-output.c -+++ b/hw/xfree86/xwayland/xwayland-output.c -@@ -95,6 +95,14 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) - { - } - -+static void -+crtc_destroy(xf86CrtcPtr crtc) -+{ -+ /* Nothing to do here, we only destroy CRTCs when instructed to do -+ so by wl_output changes -+ */ -+} -+ - static const xf86CrtcFuncsRec crtc_funcs = { - .dpms = crtc_dpms, - .set_mode_major = crtc_set_mode_major, -@@ -106,7 +114,7 @@ static const xf86CrtcFuncsRec crtc_funcs = { - .shadow_create = crtc_shadow_create, - .shadow_allocate = crtc_shadow_allocate, - .shadow_destroy = crtc_shadow_destroy, -- .destroy = NULL, /* XXX */ -+ .destroy = crtc_destroy, - }; - - static void -@@ -246,7 +254,7 @@ display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, - xwl_output->x = x; - xwl_output->y = y; - -- xwl_screen->xwl_output = xwl_output; -+ xorg_list_append (&xwl_output->link, &xwl_screen->output_list); - } - - static void -@@ -277,13 +285,39 @@ global_handler(void *data, struct wl_registry *registry, uint32_t id, - xwl_output = xwl_output_create(xwl_screen); - xwl_output->output = wl_registry_bind(registry, id, - &wl_output_interface, 1); -+ xwl_output->name = id; - wl_output_add_listener(xwl_output->output, - &output_listener, xwl_output); - } - } - -+void -+xwl_output_remove(struct xwl_output *xwl_output) -+{ -+ xorg_list_del (&xwl_output->link); -+ xf86OutputDestroy (xwl_output->xf86output); -+ xf86CrtcDestroy (xwl_output->xf86crtc); -+ -+ wl_output_destroy (xwl_output->output); -+} -+ -+static void -+global_remove(void *data, struct wl_registry *registry, uint32_t name) -+{ -+ struct xwl_screen *xwl_screen = data; -+ struct xwl_output *xwl_output, *tmp; -+ -+ xorg_list_for_each_entry_safe (xwl_output, tmp, &xwl_screen->output_list, link) { -+ if (xwl_output->name == name) { -+ xwl_output_remove(xwl_output); -+ break; -+ } -+ } -+} -+ - static const struct wl_registry_listener global_listener = { - global_handler, -+ global_remove - }; - - void -@@ -299,7 +333,7 @@ xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrnin - wl_registry_add_listener(xwl_screen->output_registry, &global_listener, - xwl_screen); - -- while (!xwl_screen->xwl_output) { -+ while (xwl_screen->output_list.next == &xwl_screen->output_list) { - ret = wl_display_roundtrip(xwl_screen->display); - if (ret == -1) - FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); -diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h -index e427316..7005db2 100644 ---- a/hw/xfree86/xwayland/xwayland-private.h -+++ b/hw/xfree86/xwayland/xwayland-private.h -@@ -44,7 +44,6 @@ struct xwl_screen { - ScrnInfoPtr scrninfo; - int drm_fd; - int wayland_fd; -- struct xwl_output *xwl_output; - struct wl_display *display; - struct wl_registry *registry; - struct wl_registry *drm_registry; -@@ -58,6 +57,7 @@ struct xwl_screen { - uint32_t flags; - char *device_name; - uint32_t authenticated; -+ struct xorg_list output_list; - struct xorg_list seat_list; - struct xorg_list damage_window_list; - struct xorg_list window_list; -@@ -74,12 +74,14 @@ struct xwl_screen { - }; - - struct xwl_output { -+ struct xorg_list link; - struct wl_output *output; - struct xwl_screen *xwl_screen; - int32_t x, y, width, height; - xf86Monitor xf86monitor; - xf86OutputPtr xf86output; - xf86CrtcPtr xf86crtc; -+ int32_t name; - }; - - -@@ -127,6 +129,8 @@ Bool xwl_drm_initialised(struct xwl_screen *screen); - - void xwl_seat_set_cursor(struct xwl_seat *xwl_seat); - -+void xwl_output_remove(struct xwl_output *output); -+ - extern const struct xserver_listener xwl_server_listener; - - #endif /* _XWAYLAND_PRIVATE_H_ */ -diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c -index 880b7ec..2047a85 100644 ---- a/hw/xfree86/xwayland/xwayland.c -+++ b/hw/xfree86/xwayland/xwayland.c -@@ -103,8 +103,15 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, - } - } - -+static void -+global_remove(void *data, struct wl_registry *registry, uint32_t name) -+{ -+ /* Nothing to do here, wl_compositor and wl_shm should not be removed */ -+} -+ - static const struct wl_registry_listener registry_listener = { - registry_global, -+ global_remove - }; - - static void -@@ -230,6 +237,7 @@ xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen, - return FALSE; - } - -+ xorg_list_init(&xwl_screen->output_list); - xorg_list_init(&xwl_screen->seat_list); - xorg_list_init(&xwl_screen->damage_window_list); - xorg_list_init(&xwl_screen->window_list); -@@ -318,12 +326,13 @@ void xwl_screen_close(struct xwl_screen *xwl_screen) - - void xwl_screen_destroy(struct xwl_screen *xwl_screen) - { -- if (xwl_screen->xwl_output) { -- xf86OutputDestroy(xwl_screen->xwl_output->xf86output); -- xf86CrtcDestroy(xwl_screen->xwl_output->xf86crtc); -+ struct xwl_output *xwl_output, *tmp; -+ -+ xorg_list_for_each_entry_safe (xwl_output, tmp, &xwl_screen->output_list, link) { -+ xwl_output_remove(xwl_output); -+ break; - } - -- free(xwl_screen->xwl_output); - free(xwl_screen); - } - --- -1.8.3.1 - diff --git a/SOURCES/0015-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch b/SOURCES/0015-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch new file mode 100644 index 0000000..3da2eb6 --- /dev/null +++ b/SOURCES/0015-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch @@ -0,0 +1,73 @@ +From 4e8eb23a03e14ce149e302e4dfc6e6af6fa61424 Mon Sep 17 00:00:00 2001 +From: Daniel Stone +Date: Fri, 16 Aug 2013 13:21:21 +0100 +Subject: [PATCH 15/38] XFree86: Load wlshm driver as fallback for Wayland + +Since fbdev or vesa are unlikely to be too useful there ... + +Signed-off-by: Daniel Stone +--- + hw/xfree86/common/xf86AutoConfig.c | 9 +++++++-- + hw/xfree86/common/xf86Config.c | 16 +++++++++++++--- + 2 files changed, 20 insertions(+), 5 deletions(-) + +diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c +index af2b7f8..a3e1fa7 100644 +--- a/hw/xfree86/common/xf86AutoConfig.c ++++ b/hw/xfree86/common/xf86AutoConfig.c +@@ -275,10 +275,15 @@ listPossibleVideoDrivers(char *matches[], int nmatches) + #if !defined(sun) + /* Fallback to platform default frame buffer driver */ + if (i < (nmatches - 1)) { ++#ifdef XORG_WAYLAND ++ if (xorgWayland) ++ matches[i++] = xnfstrdup("wlshm"); ++ else ++#endif + #if !defined(__linux__) && defined(__sparc__) +- matches[i++] = xnfstrdup("wsfb"); ++ matches[i++] = xnfstrdup("wsfb"); + #else +- matches[i++] = xnfstrdup("fbdev"); ++ matches[i++] = xnfstrdup("fbdev"); + #endif + } + #endif /* !sun */ +diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c +index 3b0bb89..aebfc1b 100644 +--- a/hw/xfree86/common/xf86Config.c ++++ b/hw/xfree86/common/xf86Config.c +@@ -519,7 +519,11 @@ xf86InputDriverlistFromConfig(void) + static void + fixup_video_driver_list(char **drivers) + { +- static const char *fallback[4] = { "fbdev", "vesa", "wsfb", NULL }; ++ static const char *fallback_hw[4] = { "fbdev", "vesa", "wsfb", NULL }; ++#ifdef XORG_WAYLAND ++ static const char *fallback_wayland[2] = { "wlshm", NULL }; ++#endif ++ const char **fallbacks; + char **end, **drv; + char *x; + int i; +@@ -532,9 +536,15 @@ fixup_video_driver_list(char **drivers) + * for each of the fallback drivers, if we find it in the list, + * swap it with the last available non-fallback driver. + */ +- for (i = 0; fallback[i]; i++) { ++#ifdef XORG_WAYLAND ++ if (xorgWayland) ++ fallbacks = fallback_wl; ++ else ++#endif ++ fallbacks = fallback_hw; ++ for (i = 0; fallbacks[i]; i++) { + for (drv = drivers; drv != end; drv++) { +- if (strstr(*drv, fallback[i])) { ++ if (strstr(*drv, fallbacks[i])) { + x = *drv; + *drv = *end; + *end = x; +-- +1.8.4.2 + diff --git a/SOURCES/0015-xwayland-add-support-for-multiple-outputs.patch b/SOURCES/0015-xwayland-add-support-for-multiple-outputs.patch deleted file mode 100644 index 27652e7..0000000 --- a/SOURCES/0015-xwayland-add-support-for-multiple-outputs.patch +++ /dev/null @@ -1,215 +0,0 @@ -From b4354c5a6d8587c079f52e3363b339558f5832a7 Mon Sep 17 00:00:00 2001 -From: Giovanni Campagna -Date: Thu, 22 Aug 2013 16:23:48 +0200 -Subject: [PATCH 15/39] xwayland: add support for multiple outputs - -Drop xf86InitialConfiguration, which just gets in the way -of the compositor doing its own output arrangement, and transform -wayland events into the appropriate low-level xf86 calls to -keep the screen size updated. - -Kristian: after the rebase it was crashing for me too, had to fix -the patch a bit. This one should work, and also gives sensible (though -not perfect) results for xrandr clients. -Tested with weston/x11 and mutter-wayland/kms. ---- - hw/xfree86/xwayland/xwayland-output.c | 112 ++++++++++++++++++++++++++++++--- - hw/xfree86/xwayland/xwayland-private.h | 2 + - 2 files changed, 105 insertions(+), 9 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c -index 46238f4..66c7d48 100644 ---- a/hw/xfree86/xwayland/xwayland-output.c -+++ b/hw/xfree86/xwayland/xwayland-output.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - #include "xwayland.h" - #include "xwayland-private.h" -@@ -182,6 +183,10 @@ xwl_output_create(struct xwl_screen *xwl_screen) - struct xwl_output *xwl_output; - xf86OutputPtr xf86output; - xf86CrtcPtr xf86crtc; -+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(xwl_screen->scrninfo); -+ int crtcId, outputId; -+ static int nameId; -+ char *name; - - xwl_output = calloc(sizeof *xwl_output, 1); - if (xwl_output == NULL) { -@@ -189,19 +194,41 @@ xwl_output_create(struct xwl_screen *xwl_screen) - return NULL; - } - -+ nameId++; -+ if (asprintf(&name, "XWAYLAND-%d", nameId) < 0) { -+ ErrorF("create_output ENOMEM"); -+ free(xwl_output); -+ return NULL; -+ } -+ - xwl_output->xwl_screen = xwl_screen; - -+ xf86crtc = xf86CrtcCreate(xwl_screen->scrninfo, &crtc_funcs); -+ xf86crtc->enabled = TRUE; -+ xf86crtc->driver_private = xwl_output; -+ -+ for (crtcId = 0; crtcId < xf86_config->num_crtc; crtcId++) { -+ if (xf86_config->crtc[crtcId] == xf86crtc) -+ break; -+ } -+ - xf86output = xf86OutputCreate(xwl_screen->scrninfo, -- &output_funcs, "XWAYLAND-1"); -+ &output_funcs, name); - xf86output->driver_private = xwl_output; -- xf86output->possible_crtcs = 1; -- xf86output->possible_clones = 1; -+ xf86output->possible_crtcs = 1 << crtcId; - -- xf86crtc = xf86CrtcCreate(xwl_screen->scrninfo, &crtc_funcs); -- xf86crtc->driver_private = xwl_output; -+ for (outputId = 0; outputId < xf86_config->num_output; outputId++) { -+ if (xf86_config->output[outputId] == xf86output) -+ break; -+ } -+ -+ xf86output->possible_clones = 1 << outputId; - - xwl_output->xf86output = xf86output; - xwl_output->xf86crtc = xf86crtc; -+ xwl_output->xf86output->crtc = xf86crtc; -+ -+ free(name); - - return xwl_output; - } -@@ -219,6 +246,32 @@ static const xf86CrtcConfigFuncsRec config_funcs = { - resize - }; - -+static Rotation -+wl_transform_to_xrandr (enum wl_output_transform transform) -+{ -+ switch (transform) -+ { -+ case WL_OUTPUT_TRANSFORM_NORMAL: -+ return RR_Rotate_0; -+ case WL_OUTPUT_TRANSFORM_90: -+ return RR_Rotate_90; -+ case WL_OUTPUT_TRANSFORM_180: -+ return RR_Rotate_180; -+ case WL_OUTPUT_TRANSFORM_270: -+ return RR_Rotate_270; -+ case WL_OUTPUT_TRANSFORM_FLIPPED: -+ return RR_Reflect_X | RR_Rotate_0; -+ case WL_OUTPUT_TRANSFORM_FLIPPED_90: -+ return RR_Reflect_X | RR_Rotate_90; -+ case WL_OUTPUT_TRANSFORM_FLIPPED_180: -+ return RR_Reflect_X | RR_Rotate_180; -+ case WL_OUTPUT_TRANSFORM_FLIPPED_270: -+ return RR_Reflect_X | RR_Rotate_270; -+ } -+ -+ return RR_Rotate_0; -+} -+ - static void - display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, - int physical_width, int physical_height, int subpixel, -@@ -253,6 +306,7 @@ display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, - - xwl_output->x = x; - xwl_output->y = y; -+ xwl_output->rotation = wl_transform_to_xrandr (transform); - - xorg_list_append (&xwl_output->link, &xwl_screen->output_list); - } -@@ -262,11 +316,49 @@ display_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, - int width, int height, int refresh) - { - struct xwl_output *xwl_output = data; -+ struct xwl_screen *xwl_screen = xwl_output->xwl_screen; -+ ScreenPtr pScreen = xwl_screen->screen; -+ ScrnInfoPtr scrn = xwl_screen->scrninfo; -+ CARD16 width_mm, height_mm; -+ DisplayModePtr mode; -+ rrScrPrivPtr rp; - -- if (flags & WL_OUTPUT_MODE_CURRENT) { -- xwl_output->width = width; -- xwl_output->height = height; -+ if (!(flags & WL_OUTPUT_MODE_CURRENT)) -+ return; -+ -+ xwl_output->width = width; -+ xwl_output->height = height; -+ -+ if (xwl_output->x + xwl_output->width > scrn->virtualX || -+ xwl_output->y + xwl_output->height > scrn->virtualY) { -+ /* Fake a RandR request to resize the screen. It will bounce -+ back to our crtc_resize, which does nothing. -+ */ -+ /* Preupdate virtualX / virtualY, so that crtc_resize returns TRUE */ -+ scrn->virtualX = xwl_output->x + xwl_output->width; -+ scrn->virtualY = xwl_output->y + xwl_output->height; -+ -+ /* Ignore the compositor provided values for mm_width/mm_height, -+ as it doesn't make sense to sum the values of different outputs. -+ Just make the DPI 96 */ -+ width_mm = (scrn->virtualX / 96.0) * 25.4 + 0.5; -+ height_mm = (scrn->virtualY / 96.0) * 25.4 + 0.5; -+ -+ /* But! When the server starts, the RandR stuff is not initialized, -+ so we can't call rrGetScrPriv. We updated virtualX/Y anyway, let's -+ hope it's enough. -+ */ -+ if (xwl_screen->outputs_initialized) { -+ rp = rrGetScrPriv(pScreen); -+ if (rp->rrScreenSetSize) -+ rp->rrScreenSetSize(pScreen, scrn->virtualX, scrn->virtualY, width_mm, height_mm); -+ } - } -+ -+ xwl_output->xf86crtc->enabled = TRUE; -+ mode = xf86CVTMode(width, height, refresh, TRUE, FALSE); -+ xf86CrtcSetModeTransform(xwl_output->xf86crtc, mode, xwl_output->rotation, -+ NULL, xwl_output->x, xwl_output->y); - } - - static const struct wl_output_listener output_listener = { -@@ -339,5 +431,7 @@ xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrnin - FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); - } - -- xf86InitialConfiguration(scrninfo, TRUE); -+ xwl_screen->outputs_initialized = TRUE; -+ -+ xf86SetScrnInfoModes(scrninfo); - } -diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h -index 7005db2..b0b2201 100644 ---- a/hw/xfree86/xwayland/xwayland-private.h -+++ b/hw/xfree86/xwayland/xwayland-private.h -@@ -63,6 +63,7 @@ struct xwl_screen { - struct xorg_list window_list; - struct xorg_list authenticate_client_list; - uint32_t serial; -+ Bool outputs_initialized; - - CreateWindowProcPtr CreateWindow; - DestroyWindowProcPtr DestroyWindow; -@@ -82,6 +83,7 @@ struct xwl_output { - xf86OutputPtr xf86output; - xf86CrtcPtr xf86crtc; - int32_t name; -+ Rotation rotation; - }; - - --- -1.8.3.1 - diff --git a/SOURCES/0016-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch b/SOURCES/0016-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch new file mode 100644 index 0000000..026f22e --- /dev/null +++ b/SOURCES/0016-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch @@ -0,0 +1,37 @@ +From 6cfe64769a4f8e9646e4d6766ffdf689a0963ffd Mon Sep 17 00:00:00 2001 +From: Daniel Stone +Date: Wed, 7 Nov 2012 17:22:42 +1100 +Subject: [PATCH 16/38] XWayland: Don't send out-of-bounds damage co-ordinates + +Make sure we don't send damage regions larger than the buffer. + +Signed-off-by: Daniel Stone +--- + hw/xfree86/xwayland/xwayland.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c +index 2047a85..6a515f5 100644 +--- a/hw/xfree86/xwayland/xwayland.c ++++ b/hw/xfree86/xwayland/xwayland.c +@@ -346,15 +346,14 @@ void xwl_screen_post_damage(struct xwl_screen *xwl_screen) + + xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list, + link_damage) { +- + region = DamageRegion(xwl_window->damage); + count = RegionNumRects(region); + for (i = 0; i < count; i++) { + box = &RegionRects(region)[i]; + wl_surface_damage(xwl_window->surface, + box->x1, box->y1, +- box->x2 - box->x1 + 1, +- box->y2 - box->y1 + 1); ++ box->x2 - box->x1, ++ box->y2 - box->y1); + } + wl_surface_attach(xwl_window->surface, + xwl_window->buffer, +-- +1.8.4.2 + diff --git a/SOURCES/0016-xwayland-Probe-outputs-on-preinit.patch b/SOURCES/0016-xwayland-Probe-outputs-on-preinit.patch deleted file mode 100644 index 8311b67..0000000 --- a/SOURCES/0016-xwayland-Probe-outputs-on-preinit.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 6c0e4bfda0aca061d51b8f29ad01cadc963c42f6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jonas=20=C3=85dahl?= -Date: Sun, 1 Sep 2013 23:14:43 +0200 -Subject: [PATCH 16/39] xwayland: Probe outputs on preinit -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When running xwayland, calls to xf86SetDesiredModes() would fail due to -the probed modes list not being populated. This was previously done -indirectly by calling xf86InitialConfiguration() and now needs to be -done explicitly instead. - -Signed-off-by: Jonas Ådahl ---- - hw/xfree86/xwayland/xwayland-output.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c -index 66c7d48..691b5f0 100644 ---- a/hw/xfree86/xwayland/xwayland-output.c -+++ b/hw/xfree86/xwayland/xwayland-output.c -@@ -431,6 +431,8 @@ xwayland_screen_preinit_output(struct xwl_screen *xwl_screen, ScrnInfoPtr scrnin - FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); - } - -+ xf86ProbeOutputModes(scrninfo, 0, 0); -+ - xwl_screen->outputs_initialized = TRUE; - - xf86SetScrnInfoModes(scrninfo); --- -1.8.3.1 - diff --git a/SOURCES/0017-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch b/SOURCES/0017-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch deleted file mode 100644 index 32534ba..0000000 --- a/SOURCES/0017-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 11a0bb26adf1a5daf6805c0973bc3bef009c53b1 Mon Sep 17 00:00:00 2001 -From: Daniel Stone -Date: Fri, 16 Aug 2013 13:21:21 +0100 -Subject: [PATCH 17/39] XFree86: Load wlshm driver as fallback for Wayland - -Since fbdev or vesa are unlikely to be too useful there ... - -Signed-off-by: Daniel Stone ---- - hw/xfree86/common/xf86AutoConfig.c | 9 +++++++-- - hw/xfree86/common/xf86Config.c | 16 +++++++++++++--- - 2 files changed, 20 insertions(+), 5 deletions(-) - -diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c -index 95d58fe..d5a3370 100644 ---- a/hw/xfree86/common/xf86AutoConfig.c -+++ b/hw/xfree86/common/xf86AutoConfig.c -@@ -283,10 +283,15 @@ listPossibleVideoDrivers(char *matches[], int nmatches) - #if !defined(sun) - /* Fallback to platform default frame buffer driver */ - if (i < (nmatches - 1)) { -+#ifdef XORG_WAYLAND -+ if (xorgWayland) -+ matches[i++] = xnfstrdup("wlshm"); -+ else -+#endif - #if !defined(__linux__) && defined(__sparc__) -- matches[i++] = xnfstrdup("wsfb"); -+ matches[i++] = xnfstrdup("wsfb"); - #else -- matches[i++] = xnfstrdup("fbdev"); -+ matches[i++] = xnfstrdup("fbdev"); - #endif - } - #endif /* !sun */ -diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c -index 39cd58c..c65cb80 100644 ---- a/hw/xfree86/common/xf86Config.c -+++ b/hw/xfree86/common/xf86Config.c -@@ -519,7 +519,11 @@ xf86InputDriverlistFromConfig(void) - static void - fixup_video_driver_list(char **drivers) - { -- static const char *fallback[4] = { "vesa", "fbdev", "wsfb", NULL }; -+ static const char *fallback_hw[4] = { "vesa", "fbdev", "wsfb", NULL }; -+#ifdef XORG_WAYLAND -+ static const char *fallback_wayland[2] = { "wlshm", NULL }; -+#endif -+ const char **fallbacks; - char **end, **drv; - char *x; - int i; -@@ -532,9 +536,15 @@ fixup_video_driver_list(char **drivers) - * for each of the fallback drivers, if we find it in the list, - * swap it with the last available non-fallback driver. - */ -- for (i = 0; fallback[i]; i++) { -+#ifdef XORG_WAYLAND -+ if (xorgWayland) -+ fallbacks = fallback_wl; -+ else -+#endif -+ fallbacks = fallback_hw; -+ for (i = 0; fallbacks[i]; i++) { - for (drv = drivers; drv != end; drv++) { -- if (strstr(*drv, fallback[i])) { -+ if (strstr(*drv, fallbacks[i])) { - x = *drv; - *drv = *end; - *end = x; --- -1.8.3.1 - diff --git a/SOURCES/0017-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch b/SOURCES/0017-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch new file mode 100644 index 0000000..b09a6ca --- /dev/null +++ b/SOURCES/0017-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch @@ -0,0 +1,45 @@ +From 70bf99f09cac43a9016039f762e5186c6ca2b6c6 Mon Sep 17 00:00:00 2001 +From: Daniel Stone +Date: Tue, 16 Oct 2012 17:14:01 +1100 +Subject: [PATCH 17/38] xwayland: Introduce an auto mode for --enable-wayland + +Signed-off-by: Daniel Stone +--- + configure.ac | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 8078846..c60fd44 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -629,7 +629,7 @@ AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg + AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes]) + AC_ARG_ENABLE(linux_acpi, AC_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes]) + AC_ARG_ENABLE(linux_apm, AC_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes]) +-AC_ARG_ENABLE(wayland, AS_HELP_STRING([--disable-wayland], [Build Wayland extension (default: enabled)]), [WAYLAND=$enableval], [WAYLAND=yes]) ++AC_ARG_ENABLE(wayland, AS_HELP_STRING([--disable-wayland], [Build Wayland extension (default: auto)]), [WAYLAND=$enableval], [WAYLAND=auto]) + + dnl DDXes. + AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto]) +@@ -1020,12 +1020,16 @@ if test "x$MITSHM" = xauto; then + MITSHM="$ac_cv_sysv_ipc" + fi + +-AM_CONDITIONAL(WAYLAND, [test "x$WAYLAND" = xyes]) ++WAYLAND_MODULES="wayland-client libdrm" ++if test "x$WAYLAND" = xauto; then ++ PKG_CHECK_MODULES(XWAYLAND, $WAYLAND_MODULES, [WAYLAND=yes], [WAYLAND=no]) ++fi + if test "x$WAYLAND" = xyes; then ++ PKG_CHECK_MODULES(XWAYLAND, $WAYLAND_MODULES) + AC_DEFINE(XORG_WAYLAND, 1, [Support wayland mode]) +- REQUIRED_MODULES="$REQUIRED_MODULES wayland-client" + WAYLAND_SCANNER_RULES(['$(top_srcdir)/hw/xfree86/xwayland']) + fi ++AM_CONDITIONAL(WAYLAND, [test "x$WAYLAND" = xyes]) + + AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes]) + if test "x$MITSHM" = xyes; then +-- +1.8.4.2 + diff --git a/SOURCES/0018-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch b/SOURCES/0018-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch new file mode 100644 index 0000000..7453d09 --- /dev/null +++ b/SOURCES/0018-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch @@ -0,0 +1,46 @@ +From c7d56befef2111c82e6720643824b9a46ae36670 Mon Sep 17 00:00:00 2001 +From: Daniel Stone +Date: Wed, 7 Nov 2012 17:15:13 +1100 +Subject: [PATCH 18/38] XWayland: Don't hardcode DRM libs and -lwayland-client + +Take -lwayland-client from configure.ac, and only use DRM if we've +actually asked for it. + +Signed-off-by: Daniel Stone +--- + hw/xfree86/xwayland/Makefile.am | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/hw/xfree86/xwayland/Makefile.am b/hw/xfree86/xwayland/Makefile.am +index b739145..22ab154 100644 +--- a/hw/xfree86/xwayland/Makefile.am ++++ b/hw/xfree86/xwayland/Makefile.am +@@ -7,13 +7,13 @@ AM_CPPFLAGS = \ + -I$(srcdir)/../modes + + libxwayland_la_LTLIBRARIES = libxwayland.la +-libxwayland_la_CFLAGS = \ ++AM_CFLAGS = \ + -DHAVE_XORG_CONFIG_H \ +- @DIX_CFLAGS@ @XORG_CFLAGS@ @LIBDRM_CFLAGS@ \ ++ @DIX_CFLAGS@ @XORG_CFLAGS@ @XWAYLAND_CFLAGS@ \ + -I$(top_srcdir)/hw/xfree86/common \ + -I$(top_srcdir)/hw/xfree86/os-support/bus + +-libxwayland_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -lwayland-client ++libxwayland_la_LDFLAGS = -module -avoid-version @XWAYLAND_LIBS@ + libxwayland_ladir = $(moduledir)/extensions + libxwayland_la_SOURCES = \ + xwayland.c \ +@@ -28,6 +28,8 @@ libxwayland_la_SOURCES = \ + xserver-protocol.c + + if DRM ++AM_CFLAGS += @LIBDRM_CFLAGS@ ++libxwayland_la_LDFLAGS += @LIBDRM_LIBS@ + libxwayland_la_SOURCES += xwayland-drm.c + endif + +-- +1.8.4.2 + diff --git a/SOURCES/0018-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch b/SOURCES/0018-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch deleted file mode 100644 index 559ead6..0000000 --- a/SOURCES/0018-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch +++ /dev/null @@ -1,37 +0,0 @@ -From c8cd8d2f034af7d390f721484e340e66cdcf0ec0 Mon Sep 17 00:00:00 2001 -From: Daniel Stone -Date: Wed, 7 Nov 2012 17:22:42 +1100 -Subject: [PATCH 18/39] XWayland: Don't send out-of-bounds damage co-ordinates - -Make sure we don't send damage regions larger than the buffer. - -Signed-off-by: Daniel Stone ---- - hw/xfree86/xwayland/xwayland.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c -index 2047a85..6a515f5 100644 ---- a/hw/xfree86/xwayland/xwayland.c -+++ b/hw/xfree86/xwayland/xwayland.c -@@ -346,15 +346,14 @@ void xwl_screen_post_damage(struct xwl_screen *xwl_screen) - - xorg_list_for_each_entry(xwl_window, &xwl_screen->damage_window_list, - link_damage) { -- - region = DamageRegion(xwl_window->damage); - count = RegionNumRects(region); - for (i = 0; i < count; i++) { - box = &RegionRects(region)[i]; - wl_surface_damage(xwl_window->surface, - box->x1, box->y1, -- box->x2 - box->x1 + 1, -- box->y2 - box->y1 + 1); -+ box->x2 - box->x1, -+ box->y2 - box->y1); - } - wl_surface_attach(xwl_window->surface, - xwl_window->buffer, --- -1.8.3.1 - diff --git a/SOURCES/0019-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch b/SOURCES/0019-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch new file mode 100644 index 0000000..b96174a --- /dev/null +++ b/SOURCES/0019-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch @@ -0,0 +1,97 @@ +From c6da90b55546748d3f4a2f536f94751da3abcd77 Mon Sep 17 00:00:00 2001 +From: Daniel Stone +Date: Fri, 16 Aug 2013 13:51:08 +0100 +Subject: [PATCH 19/38] XWayland: Support 16bpp X surfaces in DRM/SHM + +Properly look at the window's visual to determine which format we should +use for allocation. + +Signed-off-by: Daniel Stone +--- + hw/xfree86/xwayland/xwayland-drm.c | 12 ++++++++++-- + hw/xfree86/xwayland/xwayland.c | 38 +++++++++++++++++++++++++++++++------- + 2 files changed, 41 insertions(+), 9 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland-drm.c b/hw/xfree86/xwayland/xwayland-drm.c +index 6e4c778..5250857 100644 +--- a/hw/xfree86/xwayland/xwayland-drm.c ++++ b/hw/xfree86/xwayland/xwayland-drm.c +@@ -225,10 +225,18 @@ xwl_create_window_buffer_drm(struct xwl_window *xwl_window, + if (screen->visuals[i].vid == visual) + break; + +- if (screen->visuals[i].nplanes == 32) ++ switch (screen->visuals[i].nplanes) { ++ case 32: + format = WL_DRM_FORMAT_ARGB8888; +- else ++ break; ++ case 24: ++ default: + format = WL_DRM_FORMAT_XRGB8888; ++ break; ++ case 16: ++ format = WL_DRM_FORMAT_RGB565; ++ break; ++ } + + xwl_window->buffer = + wl_drm_create_buffer(xwl_window->xwl_screen->drm, +diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c +index 6a515f5..36f7cbf 100644 +--- a/hw/xfree86/xwayland/xwayland.c ++++ b/hw/xfree86/xwayland/xwayland.c +@@ -277,19 +277,43 @@ xwl_create_window_buffer_shm(struct xwl_window *xwl_window, + PixmapPtr pixmap, int fd) + { + struct wl_shm_pool *pool; +- int size, stride; ++ WindowPtr window = xwl_window->window; ++ ScreenPtr screen = window->drawable.pScreen; ++ VisualID visual = wVisual(window); ++ uint32_t format; ++ int size, stride, bpp, i; ++ ++ for (i = 0; i < screen->numVisuals; i++) ++ if (screen->visuals[i].vid == visual) ++ break; ++ ++ switch (screen->visuals[i].nplanes) { ++ case 32: ++ format = WL_SHM_FORMAT_ARGB8888; ++ bpp = 4; ++ break; ++ case 24: ++ default: ++ format = WL_SHM_FORMAT_XRGB8888; ++ bpp = 4; ++ break; ++#ifdef WL_SHM_FORMAT_RGB565 ++ case 16: ++ /* XXX: Check run-time protocol version too */ ++ format = WL_SHM_FORMAT_RGB565; ++ bpp = 2; ++ break; ++#endif ++ } + +- stride = pixmap->drawable.width * 4; ++ stride = pixmap->drawable.width * bpp; ++ size = stride * pixmap->drawable.height; + +- size = pixmap->drawable.width * pixmap->drawable.height * 4; + pool = wl_shm_create_pool(xwl_window->xwl_screen->shm, fd, size); + xwl_window->buffer = wl_shm_pool_create_buffer(pool, 0, + pixmap->drawable.width, + pixmap->drawable.height, +- stride, +- pixmap->drawable.depth == 32 ? +- WL_SHM_FORMAT_ARGB8888 : +- WL_SHM_FORMAT_XRGB8888); ++ stride, format); + wl_shm_pool_destroy(pool); + + return xwl_window->buffer ? Success : BadDrawable; +-- +1.8.4.2 + diff --git a/SOURCES/0019-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch b/SOURCES/0019-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch deleted file mode 100644 index 64eb4a6..0000000 --- a/SOURCES/0019-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 4950f4b3973a9391a674fedd02dc364abe0f121e Mon Sep 17 00:00:00 2001 -From: Daniel Stone -Date: Tue, 16 Oct 2012 17:14:01 +1100 -Subject: [PATCH 19/39] xwayland: Introduce an auto mode for --enable-wayland - -Signed-off-by: Daniel Stone ---- - configure.ac | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/configure.ac b/configure.ac -index c146b7b..5cb4f5d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -635,7 +635,7 @@ AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg - AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=yes]) - AC_ARG_ENABLE(linux_acpi, AC_HELP_STRING([--disable-linux-acpi], [Disable building ACPI support on Linux (if available).]), [enable_linux_acpi=$enableval], [enable_linux_acpi=yes]) - AC_ARG_ENABLE(linux_apm, AC_HELP_STRING([--disable-linux-apm], [Disable building APM support on Linux (if available).]), [enable_linux_apm=$enableval], [enable_linux_apm=yes]) --AC_ARG_ENABLE(wayland, AS_HELP_STRING([--disable-wayland], [Build Wayland extension (default: enabled)]), [WAYLAND=$enableval], [WAYLAND=yes]) -+AC_ARG_ENABLE(wayland, AS_HELP_STRING([--disable-wayland], [Build Wayland extension (default: auto)]), [WAYLAND=$enableval], [WAYLAND=auto]) - - dnl DDXes. - AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto]) -@@ -1025,12 +1025,16 @@ if test "x$MITSHM" = xauto; then - MITSHM="$ac_cv_sysv_ipc" - fi - --AM_CONDITIONAL(WAYLAND, [test "x$WAYLAND" = xyes]) -+WAYLAND_MODULES="wayland-client libdrm" -+if test "x$WAYLAND" = xauto; then -+ PKG_CHECK_MODULES(XWAYLAND, $WAYLAND_MODULES, [WAYLAND=yes], [WAYLAND=no]) -+fi - if test "x$WAYLAND" = xyes; then -+ PKG_CHECK_MODULES(XWAYLAND, $WAYLAND_MODULES) - AC_DEFINE(XORG_WAYLAND, 1, [Support wayland mode]) -- REQUIRED_MODULES="$REQUIRED_MODULES wayland-client" - WAYLAND_SCANNER_RULES(['$(top_srcdir)/hw/xfree86/xwayland']) - fi -+AM_CONDITIONAL(WAYLAND, [test "x$WAYLAND" = xyes]) - - AM_CONDITIONAL(MITSHM, [test "x$MITSHM" = xyes]) - if test "x$MITSHM" = xyes; then -@@ -1127,7 +1131,6 @@ case "$DRI2,$HAVE_DRI2PROTO" in - esac - AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes) - --<<<<<<< HEAD - PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO, - [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no]) - -@@ -1186,10 +1189,7 @@ esac - - AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes) - --if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then --======= --if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$CONFIG_UDEV_KMS" = xyes || test "x$WAYLAND" = xyes ; then -->>>>>>> Add xwayland module -+if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes || test "x$WAYLAND" = xyes ; then - if test "x$DRM" = xyes; then - AC_DEFINE(WITH_LIBDRM, 1, [Building with libdrm support]) - PKG_CHECK_MODULES([LIBDRM], $LIBDRM) --- -1.8.3.1 - diff --git a/SOURCES/0020-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch b/SOURCES/0020-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch deleted file mode 100644 index cca46a9..0000000 --- a/SOURCES/0020-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 7e4dd0de5b558a4a93ca9572c74af10117a9f50e Mon Sep 17 00:00:00 2001 -From: Daniel Stone -Date: Wed, 7 Nov 2012 17:15:13 +1100 -Subject: [PATCH 20/39] XWayland: Don't hardcode DRM libs and -lwayland-client - -Take -lwayland-client from configure.ac, and only use DRM if we've -actually asked for it. - -Signed-off-by: Daniel Stone ---- - hw/xfree86/xwayland/Makefile.am | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/hw/xfree86/xwayland/Makefile.am b/hw/xfree86/xwayland/Makefile.am -index b739145..22ab154 100644 ---- a/hw/xfree86/xwayland/Makefile.am -+++ b/hw/xfree86/xwayland/Makefile.am -@@ -7,13 +7,13 @@ AM_CPPFLAGS = \ - -I$(srcdir)/../modes - - libxwayland_la_LTLIBRARIES = libxwayland.la --libxwayland_la_CFLAGS = \ -+AM_CFLAGS = \ - -DHAVE_XORG_CONFIG_H \ -- @DIX_CFLAGS@ @XORG_CFLAGS@ @LIBDRM_CFLAGS@ \ -+ @DIX_CFLAGS@ @XORG_CFLAGS@ @XWAYLAND_CFLAGS@ \ - -I$(top_srcdir)/hw/xfree86/common \ - -I$(top_srcdir)/hw/xfree86/os-support/bus - --libxwayland_la_LDFLAGS = -module -avoid-version @LIBDRM_LIBS@ -lwayland-client -+libxwayland_la_LDFLAGS = -module -avoid-version @XWAYLAND_LIBS@ - libxwayland_ladir = $(moduledir)/extensions - libxwayland_la_SOURCES = \ - xwayland.c \ -@@ -28,6 +28,8 @@ libxwayland_la_SOURCES = \ - xserver-protocol.c - - if DRM -+AM_CFLAGS += @LIBDRM_CFLAGS@ -+libxwayland_la_LDFLAGS += @LIBDRM_LIBS@ - libxwayland_la_SOURCES += xwayland-drm.c - endif - --- -1.8.3.1 - diff --git a/SOURCES/0020-xwayland-Remove-Xdnd-selection-watching-code.patch b/SOURCES/0020-xwayland-Remove-Xdnd-selection-watching-code.patch new file mode 100644 index 0000000..018cc5e --- /dev/null +++ b/SOURCES/0020-xwayland-Remove-Xdnd-selection-watching-code.patch @@ -0,0 +1,70 @@ +From caf0c07852843440139fcd23e621fe2e9522775f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Wed, 11 Sep 2013 11:15:18 -0700 +Subject: [PATCH 20/38] xwayland: Remove Xdnd selection watching code + +We don't need this in the server, the wm can manage dnd proxying. +--- + hw/xfree86/xwayland/xwayland.c | 32 -------------------------------- + 1 file changed, 32 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c +index 36f7cbf..e8c58fd 100644 +--- a/hw/xfree86/xwayland/xwayland.c ++++ b/hw/xfree86/xwayland/xwayland.c +@@ -54,7 +54,6 @@ + */ + + static DevPrivateKeyRec xwl_screen_private_key; +-static Atom xdnd_atom; + + static void + xserver_client(void *data, struct xserver *xserver, int fd) +@@ -178,31 +177,6 @@ xwl_screen_get(ScreenPtr screen) + return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key); + } + +-static void +-xwayland_selection_callback(CallbackListPtr *callbacks, +- pointer data, pointer args) +-{ +- SelectionInfoRec *info = (SelectionInfoRec *) args; +- Selection *selection = info->selection; +- +- switch (info->kind) { +- case SelectionSetOwner: +- if (selection->selection == xdnd_atom) { +- if (selection->window != None) +- ErrorF("client %p starts dnd\n", info->client); +- else +- ErrorF("client %p stops dnd\n", info->client); +- } +- break; +- case SelectionWindowDestroy: +- ErrorF("selection window destroy\n"); +- break; +- case SelectionClientClose: +- ErrorF("selection client close\n"); +- break; +- } +-} +- + struct xwl_screen * + xwl_screen_create(void) + { +@@ -231,12 +205,6 @@ xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen, + + noScreenSaverExtension = TRUE; + +- xdnd_atom = MakeAtom("XdndSelection", 13, 1); +- if (!AddCallback(&SelectionCallback, +- xwayland_selection_callback, xwl_screen)) { +- return FALSE; +- } +- + xorg_list_init(&xwl_screen->output_list); + xorg_list_init(&xwl_screen->seat_list); + xorg_list_init(&xwl_screen->damage_window_list); +-- +1.8.4.2 + diff --git a/SOURCES/0021-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch b/SOURCES/0021-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch deleted file mode 100644 index e6a43d9..0000000 --- a/SOURCES/0021-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch +++ /dev/null @@ -1,97 +0,0 @@ -From d99536639333fb9d90a296196395ba96ffe22d96 Mon Sep 17 00:00:00 2001 -From: Daniel Stone -Date: Fri, 16 Aug 2013 13:51:08 +0100 -Subject: [PATCH 21/39] XWayland: Support 16bpp X surfaces in DRM/SHM - -Properly look at the window's visual to determine which format we should -use for allocation. - -Signed-off-by: Daniel Stone ---- - hw/xfree86/xwayland/xwayland-drm.c | 12 ++++++++++-- - hw/xfree86/xwayland/xwayland.c | 38 +++++++++++++++++++++++++++++++------- - 2 files changed, 41 insertions(+), 9 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland-drm.c b/hw/xfree86/xwayland/xwayland-drm.c -index 6e4c778..5250857 100644 ---- a/hw/xfree86/xwayland/xwayland-drm.c -+++ b/hw/xfree86/xwayland/xwayland-drm.c -@@ -225,10 +225,18 @@ xwl_create_window_buffer_drm(struct xwl_window *xwl_window, - if (screen->visuals[i].vid == visual) - break; - -- if (screen->visuals[i].nplanes == 32) -+ switch (screen->visuals[i].nplanes) { -+ case 32: - format = WL_DRM_FORMAT_ARGB8888; -- else -+ break; -+ case 24: -+ default: - format = WL_DRM_FORMAT_XRGB8888; -+ break; -+ case 16: -+ format = WL_DRM_FORMAT_RGB565; -+ break; -+ } - - xwl_window->buffer = - wl_drm_create_buffer(xwl_window->xwl_screen->drm, -diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c -index 6a515f5..36f7cbf 100644 ---- a/hw/xfree86/xwayland/xwayland.c -+++ b/hw/xfree86/xwayland/xwayland.c -@@ -277,19 +277,43 @@ xwl_create_window_buffer_shm(struct xwl_window *xwl_window, - PixmapPtr pixmap, int fd) - { - struct wl_shm_pool *pool; -- int size, stride; -+ WindowPtr window = xwl_window->window; -+ ScreenPtr screen = window->drawable.pScreen; -+ VisualID visual = wVisual(window); -+ uint32_t format; -+ int size, stride, bpp, i; -+ -+ for (i = 0; i < screen->numVisuals; i++) -+ if (screen->visuals[i].vid == visual) -+ break; -+ -+ switch (screen->visuals[i].nplanes) { -+ case 32: -+ format = WL_SHM_FORMAT_ARGB8888; -+ bpp = 4; -+ break; -+ case 24: -+ default: -+ format = WL_SHM_FORMAT_XRGB8888; -+ bpp = 4; -+ break; -+#ifdef WL_SHM_FORMAT_RGB565 -+ case 16: -+ /* XXX: Check run-time protocol version too */ -+ format = WL_SHM_FORMAT_RGB565; -+ bpp = 2; -+ break; -+#endif -+ } - -- stride = pixmap->drawable.width * 4; -+ stride = pixmap->drawable.width * bpp; -+ size = stride * pixmap->drawable.height; - -- size = pixmap->drawable.width * pixmap->drawable.height * 4; - pool = wl_shm_create_pool(xwl_window->xwl_screen->shm, fd, size); - xwl_window->buffer = wl_shm_pool_create_buffer(pool, 0, - pixmap->drawable.width, - pixmap->drawable.height, -- stride, -- pixmap->drawable.depth == 32 ? -- WL_SHM_FORMAT_ARGB8888 : -- WL_SHM_FORMAT_XRGB8888); -+ stride, format); - wl_shm_pool_destroy(pool); - - return xwl_window->buffer ? Success : BadDrawable; --- -1.8.3.1 - diff --git a/SOURCES/0021-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch b/SOURCES/0021-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch new file mode 100644 index 0000000..b9a1e21 --- /dev/null +++ b/SOURCES/0021-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch @@ -0,0 +1,34 @@ +From d40219f38a33845d8a9850de47ff5d458a3d8209 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Fri, 13 Sep 2013 17:17:16 -0400 +Subject: [PATCH 21/38] xf86Init: trim out non-wayland capable servers from + drive list + +Otherwise they'll cause the server to crash when run in wayland mode. +--- + hw/xfree86/common/xf86Init.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index 2d3bb01..6282252 100644 +--- a/hw/xfree86/common/xf86Init.c ++++ b/hw/xfree86/common/xf86Init.c +@@ -558,6 +558,15 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) + } + } + ++ for (i = 0; i < xf86NumDrivers; i++) { ++ if (xf86DriverList[i] == NULL) { ++ for (j = i; j < xf86NumDrivers; j++) { ++ xf86DriverList[j] = xf86DriverList[j + 1]; ++ } ++ xf86NumDrivers--; ++ } ++ } ++ + if (xorgHWOpenConsole) + xf86OpenConsole(); + else +-- +1.8.4.2 + diff --git a/SOURCES/0022-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch b/SOURCES/0022-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch new file mode 100644 index 0000000..6b522ef --- /dev/null +++ b/SOURCES/0022-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch @@ -0,0 +1,29 @@ +From a575da27027b91e44df75318f3b570bf8291fe7c Mon Sep 17 00:00:00 2001 +From: Giovanni Campagna +Date: Fri, 13 Sep 2013 15:52:29 +0200 +Subject: [PATCH 22/38] Add XORG_WAYLAND symbol to xorg-config.h.in + +We manually duplicate symbols that we want in both xorg-server.h and +xorg-config.h. XORG_WAYLAND is one such symbol, but it was missing from +xorg-config.h.in. +--- + include/xorg-config.h.in | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in +index 487d7ad..8aec1d8 100644 +--- a/include/xorg-config.h.in ++++ b/include/xorg-config.h.in +@@ -142,7 +142,7 @@ + /* Define to 1 if you have the `seteuid' function. */ + #undef HAVE_SETEUID + +-/* Support APM/ACPI power management in the server */ +-#undef XF86PM ++/* Building Xorg server. */ ++#undef XORG_WAYLAND + + #endif /* _XORG_CONFIG_H_ */ +-- +1.8.4.2 + diff --git a/SOURCES/0022-xwayland-Remove-Xdnd-selection-watching-code.patch b/SOURCES/0022-xwayland-Remove-Xdnd-selection-watching-code.patch deleted file mode 100644 index 548de11..0000000 --- a/SOURCES/0022-xwayland-Remove-Xdnd-selection-watching-code.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 8157fe1fecd6696a534fef89bc4a1c12ff8f2818 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Wed, 11 Sep 2013 11:15:18 -0700 -Subject: [PATCH 22/39] xwayland: Remove Xdnd selection watching code - -We don't need this in the server, the wm can manage dnd proxying. ---- - hw/xfree86/xwayland/xwayland.c | 32 -------------------------------- - 1 file changed, 32 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c -index 36f7cbf..e8c58fd 100644 ---- a/hw/xfree86/xwayland/xwayland.c -+++ b/hw/xfree86/xwayland/xwayland.c -@@ -54,7 +54,6 @@ - */ - - static DevPrivateKeyRec xwl_screen_private_key; --static Atom xdnd_atom; - - static void - xserver_client(void *data, struct xserver *xserver, int fd) -@@ -178,31 +177,6 @@ xwl_screen_get(ScreenPtr screen) - return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key); - } - --static void --xwayland_selection_callback(CallbackListPtr *callbacks, -- pointer data, pointer args) --{ -- SelectionInfoRec *info = (SelectionInfoRec *) args; -- Selection *selection = info->selection; -- -- switch (info->kind) { -- case SelectionSetOwner: -- if (selection->selection == xdnd_atom) { -- if (selection->window != None) -- ErrorF("client %p starts dnd\n", info->client); -- else -- ErrorF("client %p stops dnd\n", info->client); -- } -- break; -- case SelectionWindowDestroy: -- ErrorF("selection window destroy\n"); -- break; -- case SelectionClientClose: -- ErrorF("selection client close\n"); -- break; -- } --} -- - struct xwl_screen * - xwl_screen_create(void) - { -@@ -231,12 +205,6 @@ xwl_screen_pre_init(ScrnInfoPtr scrninfo, struct xwl_screen *xwl_screen, - - noScreenSaverExtension = TRUE; - -- xdnd_atom = MakeAtom("XdndSelection", 13, 1); -- if (!AddCallback(&SelectionCallback, -- xwayland_selection_callback, xwl_screen)) { -- return FALSE; -- } -- - xorg_list_init(&xwl_screen->output_list); - xorg_list_init(&xwl_screen->seat_list); - xorg_list_init(&xwl_screen->damage_window_list); --- -1.8.3.1 - diff --git a/SOURCES/0023-Fix-fallback-loading-of-the-wayland-driver.patch b/SOURCES/0023-Fix-fallback-loading-of-the-wayland-driver.patch new file mode 100644 index 0000000..a64ad92 --- /dev/null +++ b/SOURCES/0023-Fix-fallback-loading-of-the-wayland-driver.patch @@ -0,0 +1,41 @@ +From 7e1b4d2a4853e7a6c31e0ab0c1fe3405ec61c914 Mon Sep 17 00:00:00 2001 +From: Giovanni Campagna +Date: Fri, 13 Sep 2013 15:52:30 +0200 +Subject: [PATCH 23/38] Fix fallback loading of the wayland driver + +Fix the array name to actually compile, and fix the driver name +with the new upstream. +--- + hw/xfree86/common/xf86AutoConfig.c | 2 +- + hw/xfree86/common/xf86Config.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c +index a3e1fa7..51a7960 100644 +--- a/hw/xfree86/common/xf86AutoConfig.c ++++ b/hw/xfree86/common/xf86AutoConfig.c +@@ -277,7 +277,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches) + if (i < (nmatches - 1)) { + #ifdef XORG_WAYLAND + if (xorgWayland) +- matches[i++] = xnfstrdup("wlshm"); ++ matches[i++] = xnfstrdup("wayland"); + else + #endif + #if !defined(__linux__) && defined(__sparc__) +diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c +index aebfc1b..66f98b2 100644 +--- a/hw/xfree86/common/xf86Config.c ++++ b/hw/xfree86/common/xf86Config.c +@@ -521,7 +521,7 @@ fixup_video_driver_list(char **drivers) + { + static const char *fallback_hw[4] = { "fbdev", "vesa", "wsfb", NULL }; + #ifdef XORG_WAYLAND +- static const char *fallback_wayland[2] = { "wlshm", NULL }; ++ static const char *fallback_wl[2] = { "wayland", NULL }; + #endif + const char **fallbacks; + char **end, **drv; +-- +1.8.4.2 + diff --git a/SOURCES/0023-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch b/SOURCES/0023-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch deleted file mode 100644 index 75badd3..0000000 --- a/SOURCES/0023-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0d8af023c8037f9d6a219ec38da11e5e473a9610 Mon Sep 17 00:00:00 2001 -From: Ray Strode -Date: Fri, 13 Sep 2013 17:17:16 -0400 -Subject: [PATCH 23/39] xf86Init: trim out non-wayland capable servers from - drive list - -Otherwise they'll cause the server to crash when run in wayland mode. ---- - hw/xfree86/common/xf86Init.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c -index 2d3bb01..6282252 100644 ---- a/hw/xfree86/common/xf86Init.c -+++ b/hw/xfree86/common/xf86Init.c -@@ -558,6 +558,15 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) - } - } - -+ for (i = 0; i < xf86NumDrivers; i++) { -+ if (xf86DriverList[i] == NULL) { -+ for (j = i; j < xf86NumDrivers; j++) { -+ xf86DriverList[j] = xf86DriverList[j + 1]; -+ } -+ xf86NumDrivers--; -+ } -+ } -+ - if (xorgHWOpenConsole) - xf86OpenConsole(); - else --- -1.8.3.1 - diff --git a/SOURCES/0024-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch b/SOURCES/0024-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch deleted file mode 100644 index 157da15..0000000 --- a/SOURCES/0024-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch +++ /dev/null @@ -1,27 +0,0 @@ -From ef4f0c33441998d31776b4e05ac637c8e2571219 Mon Sep 17 00:00:00 2001 -From: Giovanni Campagna -Date: Fri, 13 Sep 2013 15:52:29 +0200 -Subject: [PATCH 24/39] Add XORG_WAYLAND symbol to xorg-config.h.in - -We manually duplicate symbols that we want in both xorg-server.h and -xorg-config.h. XORG_WAYLAND is one such symbol, but it was missing from -xorg-config.h.in. ---- - include/xorg-config.h.in | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in -index e3444da..a35a9b0 100644 ---- a/include/xorg-config.h.in -+++ b/include/xorg-config.h.in -@@ -148,4 +148,7 @@ - /* Have support for X shared memory fence library (xshmfence) */ - #undef HAVE_XSHMFENCE - -+/* Building Xorg server. */ -+#undef XORG_WAYLAND -+ - #endif /* _XORG_CONFIG_H_ */ --- -1.8.3.1 - diff --git a/SOURCES/0024-xwayland-Don-t-include-xorg-server.h.patch b/SOURCES/0024-xwayland-Don-t-include-xorg-server.h.patch new file mode 100644 index 0000000..eb23738 --- /dev/null +++ b/SOURCES/0024-xwayland-Don-t-include-xorg-server.h.patch @@ -0,0 +1,64 @@ +From b468fcfc1733feb014ef976fef29939f9f1dfc98 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Fri, 13 Sep 2013 14:52:13 -0700 +Subject: [PATCH 24/38] xwayland: Don't include xorg-server.h + +xorg-config.h now has the XORG_WAYLAND define. +--- + hw/xfree86/xwayland/xwayland-cursor.c | 1 - + hw/xfree86/xwayland/xwayland-output.c | 1 - + hw/xfree86/xwayland/xwayland-window.c | 1 - + hw/xfree86/xwayland/xwayland.c | 1 - + 4 files changed, 4 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c +index f8860bd..1cd6457 100644 +--- a/hw/xfree86/xwayland/xwayland-cursor.c ++++ b/hw/xfree86/xwayland/xwayland-cursor.c +@@ -32,7 +32,6 @@ + #include + #include + +-#include + #include + #include + #include +diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c +index 691b5f0..7004b9b 100644 +--- a/hw/xfree86/xwayland/xwayland-output.c ++++ b/hw/xfree86/xwayland/xwayland-output.c +@@ -32,7 +32,6 @@ + #include + #include + +-#include + #include + #include + #include +diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c +index d56e0d0..88f57ce 100644 +--- a/hw/xfree86/xwayland/xwayland-window.c ++++ b/hw/xfree86/xwayland/xwayland-window.c +@@ -33,7 +33,6 @@ + #include + #include + +-#include + #include + #include + #include +diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c +index e8c58fd..c70a52d 100644 +--- a/hw/xfree86/xwayland/xwayland.c ++++ b/hw/xfree86/xwayland/xwayland.c +@@ -34,7 +34,6 @@ + #include + #include + +-#include + #include + + #include +-- +1.8.4.2 + diff --git a/SOURCES/0025-Fix-fallback-loading-of-the-wayland-driver.patch b/SOURCES/0025-Fix-fallback-loading-of-the-wayland-driver.patch deleted file mode 100644 index dec5d4c..0000000 --- a/SOURCES/0025-Fix-fallback-loading-of-the-wayland-driver.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 3b4990d5042c9e6520fa1bd6ff2be696243b3792 Mon Sep 17 00:00:00 2001 -From: Giovanni Campagna -Date: Fri, 13 Sep 2013 15:52:30 +0200 -Subject: [PATCH 25/39] Fix fallback loading of the wayland driver - -Fix the array name to actually compile, and fix the driver name -with the new upstream. ---- - hw/xfree86/common/xf86AutoConfig.c | 2 +- - hw/xfree86/common/xf86Config.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c -index d5a3370..b35cb96 100644 ---- a/hw/xfree86/common/xf86AutoConfig.c -+++ b/hw/xfree86/common/xf86AutoConfig.c -@@ -285,7 +285,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches) - if (i < (nmatches - 1)) { - #ifdef XORG_WAYLAND - if (xorgWayland) -- matches[i++] = xnfstrdup("wlshm"); -+ matches[i++] = xnfstrdup("wayland"); - else - #endif - #if !defined(__linux__) && defined(__sparc__) -diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c -index c65cb80..8255d8d 100644 ---- a/hw/xfree86/common/xf86Config.c -+++ b/hw/xfree86/common/xf86Config.c -@@ -521,7 +521,7 @@ fixup_video_driver_list(char **drivers) - { - static const char *fallback_hw[4] = { "vesa", "fbdev", "wsfb", NULL }; - #ifdef XORG_WAYLAND -- static const char *fallback_wayland[2] = { "wlshm", NULL }; -+ static const char *fallback_wl[2] = { "wayland", NULL }; - #endif - const char **fallbacks; - char **end, **drv; --- -1.8.3.1 - diff --git a/SOURCES/0025-os-Don-t-include-xorg-server.h.patch b/SOURCES/0025-os-Don-t-include-xorg-server.h.patch new file mode 100644 index 0000000..5fe6791 --- /dev/null +++ b/SOURCES/0025-os-Don-t-include-xorg-server.h.patch @@ -0,0 +1,40 @@ +From 6e6f302a5bfa72b195021c0053aab3286d12f87a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Fri, 13 Sep 2013 14:53:16 -0700 +Subject: [PATCH 25/38] os: Don't include xorg-server.h + +Just always compile in ListenOnOpenFD and AddClientOnOpenFD, they +don't depend on anything from Quartz or Wayland. +--- + os/connection.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/os/connection.c b/os/connection.c +index a95e7da..0a858b7 100644 +--- a/os/connection.c ++++ b/os/connection.c +@@ -64,7 +64,6 @@ SOFTWARE. + #include + #endif + +-#include + #ifdef WIN32 + #include + #endif +@@ -1259,7 +1258,6 @@ MakeClientGrabPervious(ClientPtr client) + } + } + +-#if defined(XQUARTZ) || defined(XORG_WAYLAND) + /* Add a fd (from launchd) to our listeners */ + void + ListenOnOpenFD(int fd, int noxauth) +@@ -1334,5 +1332,3 @@ AddClientOnOpenFD(int fd) + return; + } + } +- +-#endif +-- +1.8.4.2 + diff --git a/SOURCES/0026-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch b/SOURCES/0026-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch new file mode 100644 index 0000000..b986bc7 --- /dev/null +++ b/SOURCES/0026-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch @@ -0,0 +1,30 @@ +From 7f1df88e3c86e900fa22075aed41c5c3b3f36b75 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Fri, 13 Sep 2013 15:16:31 -0700 +Subject: [PATCH 26/38] os: Also define ListenOnOpenFD and AddClientOnOpenFD + unconditionally + +Remove the #ifdef from the header file as well. +--- + include/os.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/include/os.h b/include/os.h +index c36d09a..8deb413 100644 +--- a/include/os.h ++++ b/include/os.h +@@ -166,10 +166,9 @@ extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ ); + + extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ ); + +-#if defined(XQUARTZ) || defined(XORG_WAYLAND) + extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); ++ + extern _X_EXPORT void AddClientOnOpenFD(int /* fd */ ); +-#endif + + extern _X_EXPORT CARD32 GetTimeInMillis(void); + extern _X_EXPORT CARD64 GetTimeInMicros(void); +-- +1.8.4.2 + diff --git a/SOURCES/0026-xwayland-Don-t-include-xorg-server.h.patch b/SOURCES/0026-xwayland-Don-t-include-xorg-server.h.patch deleted file mode 100644 index bf535f7..0000000 --- a/SOURCES/0026-xwayland-Don-t-include-xorg-server.h.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 2ee348cc8b94f823f84eea4024b26beb16d49f22 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 13 Sep 2013 14:52:13 -0700 -Subject: [PATCH 26/39] xwayland: Don't include xorg-server.h - -xorg-config.h now has the XORG_WAYLAND define. ---- - hw/xfree86/xwayland/xwayland-cursor.c | 1 - - hw/xfree86/xwayland/xwayland-output.c | 1 - - hw/xfree86/xwayland/xwayland-window.c | 1 - - hw/xfree86/xwayland/xwayland.c | 1 - - 4 files changed, 4 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c -index f8860bd..1cd6457 100644 ---- a/hw/xfree86/xwayland/xwayland-cursor.c -+++ b/hw/xfree86/xwayland/xwayland-cursor.c -@@ -32,7 +32,6 @@ - #include - #include - --#include - #include - #include - #include -diff --git a/hw/xfree86/xwayland/xwayland-output.c b/hw/xfree86/xwayland/xwayland-output.c -index 691b5f0..7004b9b 100644 ---- a/hw/xfree86/xwayland/xwayland-output.c -+++ b/hw/xfree86/xwayland/xwayland-output.c -@@ -32,7 +32,6 @@ - #include - #include - --#include - #include - #include - #include -diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c -index 925d63c..b7677ed 100644 ---- a/hw/xfree86/xwayland/xwayland-window.c -+++ b/hw/xfree86/xwayland/xwayland-window.c -@@ -33,7 +33,6 @@ - #include - #include - --#include - #include - #include - #include -diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c -index e8c58fd..c70a52d 100644 ---- a/hw/xfree86/xwayland/xwayland.c -+++ b/hw/xfree86/xwayland/xwayland.c -@@ -34,7 +34,6 @@ - #include - #include - --#include - #include - - #include --- -1.8.3.1 - diff --git a/SOURCES/0027-os-Don-t-include-xorg-server.h.patch b/SOURCES/0027-os-Don-t-include-xorg-server.h.patch deleted file mode 100644 index 7b129de..0000000 --- a/SOURCES/0027-os-Don-t-include-xorg-server.h.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 064a8d7f03e8576be8d581a197efe12d319304e6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 13 Sep 2013 14:53:16 -0700 -Subject: [PATCH 27/39] os: Don't include xorg-server.h - -Just always compile in ListenOnOpenFD and AddClientOnOpenFD, they -don't depend on anything from Quartz or Wayland. ---- - os/connection.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/os/connection.c b/os/connection.c -index a95e7da..0a858b7 100644 ---- a/os/connection.c -+++ b/os/connection.c -@@ -64,7 +64,6 @@ SOFTWARE. - #include - #endif - --#include - #ifdef WIN32 - #include - #endif -@@ -1259,7 +1258,6 @@ MakeClientGrabPervious(ClientPtr client) - } - } - --#if defined(XQUARTZ) || defined(XORG_WAYLAND) - /* Add a fd (from launchd) to our listeners */ - void - ListenOnOpenFD(int fd, int noxauth) -@@ -1334,5 +1332,3 @@ AddClientOnOpenFD(int fd) - return; - } - } -- --#endif --- -1.8.3.1 - diff --git a/SOURCES/0027-xwayland-Remove-unused-variables.patch b/SOURCES/0027-xwayland-Remove-unused-variables.patch new file mode 100644 index 0000000..19fea33 --- /dev/null +++ b/SOURCES/0027-xwayland-Remove-unused-variables.patch @@ -0,0 +1,26 @@ +From b2520bd345339bbf74ab0ee4e2194206f80f4d2f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Mon, 16 Sep 2013 11:51:57 -0700 +Subject: [PATCH 27/38] xwayland: Remove unused variables + +--- + hw/xfree86/xwayland/xwayland-window.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c +index 88f57ce..20db80c 100644 +--- a/hw/xfree86/xwayland/xwayland-window.c ++++ b/hw/xfree86/xwayland/xwayland-window.c +@@ -92,9 +92,6 @@ xwl_create_window(WindowPtr window) + { + ScreenPtr screen = window->drawable.pScreen; + struct xwl_screen *xwl_screen; +- char buffer[32]; +- int len, rc; +- Atom name; + Bool ret; + + xwl_screen = xwl_screen_get(screen); +-- +1.8.4.2 + diff --git a/SOURCES/0028-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch b/SOURCES/0028-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch deleted file mode 100644 index 421bcff..0000000 --- a/SOURCES/0028-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch +++ /dev/null @@ -1,30 +0,0 @@ -From cc29e0dc978c1aea7b989c69a6512a80e2acf071 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 13 Sep 2013 15:16:31 -0700 -Subject: [PATCH 28/39] os: Also define ListenOnOpenFD and AddClientOnOpenFD - unconditionally - -Remove the #ifdef from the header file as well. ---- - include/os.h | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/include/os.h b/include/os.h -index 4d4a0d6..4752d15 100644 ---- a/include/os.h -+++ b/include/os.h -@@ -164,10 +164,9 @@ extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ ); - - extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ ); - --#if defined(XQUARTZ) || defined(XORG_WAYLAND) - extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ ); -+ - extern _X_EXPORT void AddClientOnOpenFD(int /* fd */ ); --#endif - - extern _X_EXPORT CARD32 GetTimeInMillis(void); - extern _X_EXPORT CARD64 GetTimeInMicros(void); --- -1.8.3.1 - diff --git a/SOURCES/0028-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch b/SOURCES/0028-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch new file mode 100644 index 0000000..3b2dff7 --- /dev/null +++ b/SOURCES/0028-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch @@ -0,0 +1,85 @@ +From 2890dca70f04c3961578062207c5354d48730da3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Mon, 16 Sep 2013 12:05:19 -0700 +Subject: [PATCH 28/38] xwayland: Use a per-screen private key for cursor + privates + +The cursor is a per-display object, so we need to set private data on it +using a per-screen private key to avoid stepping on privates from other +screens. +--- + hw/xfree86/xwayland/xwayland-cursor.c | 15 +++++++++------ + hw/xfree86/xwayland/xwayland-private.h | 2 ++ + 2 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c +index 1cd6457..2cdd248 100644 +--- a/hw/xfree86/xwayland/xwayland-cursor.c ++++ b/hw/xfree86/xwayland/xwayland-cursor.c +@@ -40,8 +40,6 @@ + #include "xwayland-private.h" + #include "xserver-client-protocol.h" + +-static DevPrivateKeyRec xwl_cursor_private_key; +- + static void + expand_source_and_mask(CursorPtr cursor, void *data) + { +@@ -129,7 +127,8 @@ xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) + WL_SHM_FORMAT_ARGB8888); + wl_shm_pool_destroy(pool); + +- dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, buffer); ++ dixSetPrivate(&cursor->devPrivates, ++ &xwl_screen->cursor_private_key, buffer); + + return TRUE; + } +@@ -139,8 +138,11 @@ xwl_unrealize_cursor(DeviceIntPtr device, + ScreenPtr screen, CursorPtr cursor) + { + struct wl_buffer *buffer; ++ struct xwl_screen *xwl_screen; + +- buffer = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); ++ xwl_screen = xwl_screen_get(screen); ++ buffer = dixGetPrivate(&cursor->devPrivates, ++ &xwl_screen->cursor_private_key); + wl_buffer_destroy(buffer); + + return TRUE; +@@ -155,7 +157,7 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat) + return; + + buffer = dixGetPrivate(&xwl_seat->x_cursor->devPrivates, +- &xwl_cursor_private_key); ++ &xwl_seat->xwl_screen->cursor_private_key); + + wl_pointer_set_cursor(xwl_seat->wl_pointer, + xwl_seat->pointer_enter_serial, +@@ -229,7 +231,8 @@ xwl_screen_init_cursor(struct xwl_screen *xwl_screen, ScreenPtr screen) + { + miPointerScreenPtr pointer_priv; + +- if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR, 0)) ++ if (!dixRegisterPrivateKey(&xwl_screen->cursor_private_key, ++ PRIVATE_CURSOR, 0)) + return BadAlloc; + + pointer_priv = dixLookupPrivate(&screen->devPrivates, miPointerScreenKey); +diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h +index b0b2201..aa9fc03 100644 +--- a/hw/xfree86/xwayland/xwayland-private.h ++++ b/hw/xfree86/xwayland/xwayland-private.h +@@ -65,6 +65,8 @@ struct xwl_screen { + uint32_t serial; + Bool outputs_initialized; + ++ DevPrivateKeyRec cursor_private_key; ++ + CreateWindowProcPtr CreateWindow; + DestroyWindowProcPtr DestroyWindow; + RealizeWindowProcPtr RealizeWindow; +-- +1.8.4.2 + diff --git a/SOURCES/0029-XWayland-Don-t-commit-empty-surfaces.patch b/SOURCES/0029-XWayland-Don-t-commit-empty-surfaces.patch new file mode 100644 index 0000000..5228c5a --- /dev/null +++ b/SOURCES/0029-XWayland-Don-t-commit-empty-surfaces.patch @@ -0,0 +1,32 @@ +From 1cac327a6ef9c0ca44ec32c7146da37ecb930dca Mon Sep 17 00:00:00 2001 +From: Daniel Stone +Date: Thu, 12 Sep 2013 16:58:00 -0400 +Subject: [PATCH 29/38] XWayland: Don't commit empty surfaces + +Instead of attaching, damaging and then committing a new buffer as soon +as we allocate a pixmap, just attach and damage the entire buffer. When +the buffer is changed, we'll commit the changes. + +This avoids an ugly black (on SHM) flash when a window is mapped or +resized. + +Signed-off-by: Daniel Stone +--- + hw/xfree86/xwayland/xwayland-window.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c +index 20db80c..5045e65 100644 +--- a/hw/xfree86/xwayland/xwayland-window.c ++++ b/hw/xfree86/xwayland/xwayland-window.c +@@ -80,7 +80,6 @@ xwl_window_attach(struct xwl_window *xwl_window, PixmapPtr pixmap) + wl_surface_damage(xwl_window->surface, 0, 0, + pixmap->drawable.width, + pixmap->drawable.height); +- wl_surface_commit(xwl_window->surface); + + callback = wl_display_sync(xwl_screen->display); + wl_callback_add_listener(callback, &free_pixmap_listener, pixmap); +-- +1.8.4.2 + diff --git a/SOURCES/0029-xwayland-Remove-unused-variables.patch b/SOURCES/0029-xwayland-Remove-unused-variables.patch deleted file mode 100644 index f1c83b3..0000000 --- a/SOURCES/0029-xwayland-Remove-unused-variables.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 74f9b7e691aef5e3f340cddd8acb2a5e20be7f42 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Mon, 16 Sep 2013 11:51:57 -0700 -Subject: [PATCH 29/39] xwayland: Remove unused variables - ---- - hw/xfree86/xwayland/xwayland-window.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c -index b7677ed..3c85630 100644 ---- a/hw/xfree86/xwayland/xwayland-window.c -+++ b/hw/xfree86/xwayland/xwayland-window.c -@@ -92,9 +92,6 @@ xwl_create_window(WindowPtr window) - { - ScreenPtr screen = window->drawable.pScreen; - struct xwl_screen *xwl_screen; -- char buffer[32]; -- int len, rc; -- Atom name; - Bool ret; - - xwl_screen = xwl_screen_get(screen); --- -1.8.3.1 - diff --git a/SOURCES/0030-xwayland-Also-look-for-wlglamor.patch b/SOURCES/0030-xwayland-Also-look-for-wlglamor.patch new file mode 100644 index 0000000..206df01 --- /dev/null +++ b/SOURCES/0030-xwayland-Also-look-for-wlglamor.patch @@ -0,0 +1,24 @@ +From f3df4c8caf96cce10d7bd646f34df9c3bba4daa9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Fri, 11 Oct 2013 16:14:54 -0700 +Subject: [PATCH 30/38] xwayland: Also look for wlglamor + +--- + hw/xfree86/common/xf86AutoConfig.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c +index 51a7960..523ddb7 100644 +--- a/hw/xfree86/common/xf86AutoConfig.c ++++ b/hw/xfree86/common/xf86AutoConfig.c +@@ -277,6 +277,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches) + if (i < (nmatches - 1)) { + #ifdef XORG_WAYLAND + if (xorgWayland) ++ matches[i++] = xnfstrdup("wlglamor"); + matches[i++] = xnfstrdup("wayland"); + else + #endif +-- +1.8.4.2 + diff --git a/SOURCES/0030-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch b/SOURCES/0030-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch deleted file mode 100644 index cd87aa2..0000000 --- a/SOURCES/0030-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 4587f79c2b5b191d450a97c8951771e98f237316 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Mon, 16 Sep 2013 12:05:19 -0700 -Subject: [PATCH 30/39] xwayland: Use a per-screen private key for cursor - privates - -The cursor is a per-display object, so we need to set private data on it -using a per-screen private key to avoid stepping on privates from other -screens. ---- - hw/xfree86/xwayland/xwayland-cursor.c | 15 +++++++++------ - hw/xfree86/xwayland/xwayland-private.h | 2 ++ - 2 files changed, 11 insertions(+), 6 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c -index 1cd6457..2cdd248 100644 ---- a/hw/xfree86/xwayland/xwayland-cursor.c -+++ b/hw/xfree86/xwayland/xwayland-cursor.c -@@ -40,8 +40,6 @@ - #include "xwayland-private.h" - #include "xserver-client-protocol.h" - --static DevPrivateKeyRec xwl_cursor_private_key; -- - static void - expand_source_and_mask(CursorPtr cursor, void *data) - { -@@ -129,7 +127,8 @@ xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) - WL_SHM_FORMAT_ARGB8888); - wl_shm_pool_destroy(pool); - -- dixSetPrivate(&cursor->devPrivates, &xwl_cursor_private_key, buffer); -+ dixSetPrivate(&cursor->devPrivates, -+ &xwl_screen->cursor_private_key, buffer); - - return TRUE; - } -@@ -139,8 +138,11 @@ xwl_unrealize_cursor(DeviceIntPtr device, - ScreenPtr screen, CursorPtr cursor) - { - struct wl_buffer *buffer; -+ struct xwl_screen *xwl_screen; - -- buffer = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); -+ xwl_screen = xwl_screen_get(screen); -+ buffer = dixGetPrivate(&cursor->devPrivates, -+ &xwl_screen->cursor_private_key); - wl_buffer_destroy(buffer); - - return TRUE; -@@ -155,7 +157,7 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat) - return; - - buffer = dixGetPrivate(&xwl_seat->x_cursor->devPrivates, -- &xwl_cursor_private_key); -+ &xwl_seat->xwl_screen->cursor_private_key); - - wl_pointer_set_cursor(xwl_seat->wl_pointer, - xwl_seat->pointer_enter_serial, -@@ -229,7 +231,8 @@ xwl_screen_init_cursor(struct xwl_screen *xwl_screen, ScreenPtr screen) - { - miPointerScreenPtr pointer_priv; - -- if (!dixRegisterPrivateKey(&xwl_cursor_private_key, PRIVATE_CURSOR, 0)) -+ if (!dixRegisterPrivateKey(&xwl_screen->cursor_private_key, -+ PRIVATE_CURSOR, 0)) - return BadAlloc; - - pointer_priv = dixLookupPrivate(&screen->devPrivates, miPointerScreenKey); -diff --git a/hw/xfree86/xwayland/xwayland-private.h b/hw/xfree86/xwayland/xwayland-private.h -index b0b2201..aa9fc03 100644 ---- a/hw/xfree86/xwayland/xwayland-private.h -+++ b/hw/xfree86/xwayland/xwayland-private.h -@@ -65,6 +65,8 @@ struct xwl_screen { - uint32_t serial; - Bool outputs_initialized; - -+ DevPrivateKeyRec cursor_private_key; -+ - CreateWindowProcPtr CreateWindow; - DestroyWindowProcPtr DestroyWindow; - RealizeWindowProcPtr RealizeWindow; --- -1.8.3.1 - diff --git a/SOURCES/0031-XWayland-Don-t-commit-empty-surfaces.patch b/SOURCES/0031-XWayland-Don-t-commit-empty-surfaces.patch deleted file mode 100644 index 80eb9aa..0000000 --- a/SOURCES/0031-XWayland-Don-t-commit-empty-surfaces.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 274388f6055f0fe33654113b6c2eb09551f20c2b Mon Sep 17 00:00:00 2001 -From: Daniel Stone -Date: Thu, 12 Sep 2013 16:58:00 -0400 -Subject: [PATCH 31/39] XWayland: Don't commit empty surfaces - -Instead of attaching, damaging and then committing a new buffer as soon -as we allocate a pixmap, just attach and damage the entire buffer. When -the buffer is changed, we'll commit the changes. - -This avoids an ugly black (on SHM) flash when a window is mapped or -resized. - -Signed-off-by: Daniel Stone ---- - hw/xfree86/xwayland/xwayland-window.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c -index 3c85630..fb9c64a 100644 ---- a/hw/xfree86/xwayland/xwayland-window.c -+++ b/hw/xfree86/xwayland/xwayland-window.c -@@ -80,7 +80,6 @@ xwl_window_attach(struct xwl_window *xwl_window, PixmapPtr pixmap) - wl_surface_damage(xwl_window->surface, 0, 0, - pixmap->drawable.width, - pixmap->drawable.height); -- wl_surface_commit(xwl_window->surface); - - callback = wl_display_sync(xwl_screen->display); - wl_callback_add_listener(callback, &free_pixmap_listener, pixmap); --- -1.8.3.1 - diff --git a/SOURCES/0031-xwayland-Add-wlglamor-the-right-way.patch b/SOURCES/0031-xwayland-Add-wlglamor-the-right-way.patch new file mode 100644 index 0000000..25126ce --- /dev/null +++ b/SOURCES/0031-xwayland-Add-wlglamor-the-right-way.patch @@ -0,0 +1,33 @@ +From a7f4b0f1a49abdb79f7a787e582096af152382c2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Fri, 11 Oct 2013 16:29:02 -0700 +Subject: [PATCH 31/38] xwayland: Add wlglamor the right way + +Defeated by #ifdefs. +--- + hw/xfree86/common/xf86AutoConfig.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c +index 523ddb7..4c5d1d5 100644 +--- a/hw/xfree86/common/xf86AutoConfig.c ++++ b/hw/xfree86/common/xf86AutoConfig.c +@@ -274,12 +274,12 @@ listPossibleVideoDrivers(char *matches[], int nmatches) + + #if !defined(sun) + /* Fallback to platform default frame buffer driver */ +- if (i < (nmatches - 1)) { ++ if (i < (nmatches - 2)) { + #ifdef XORG_WAYLAND +- if (xorgWayland) ++ if (xorgWayland) { + matches[i++] = xnfstrdup("wlglamor"); + matches[i++] = xnfstrdup("wayland"); +- else ++ } else + #endif + #if !defined(__linux__) && defined(__sparc__) + matches[i++] = xnfstrdup("wsfb"); +-- +1.8.4.2 + diff --git a/SOURCES/0032-xwayland-Also-look-for-wlglamor.patch b/SOURCES/0032-xwayland-Also-look-for-wlglamor.patch deleted file mode 100644 index 253ec06..0000000 --- a/SOURCES/0032-xwayland-Also-look-for-wlglamor.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 8742e0ca22257c2c028fbe434ba81a3859a9bf94 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 11 Oct 2013 16:14:54 -0700 -Subject: [PATCH 32/39] xwayland: Also look for wlglamor - ---- - hw/xfree86/common/xf86AutoConfig.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c -index b35cb96..9576b86 100644 ---- a/hw/xfree86/common/xf86AutoConfig.c -+++ b/hw/xfree86/common/xf86AutoConfig.c -@@ -285,6 +285,7 @@ listPossibleVideoDrivers(char *matches[], int nmatches) - if (i < (nmatches - 1)) { - #ifdef XORG_WAYLAND - if (xorgWayland) -+ matches[i++] = xnfstrdup("wlglamor"); - matches[i++] = xnfstrdup("wayland"); - else - #endif --- -1.8.3.1 - diff --git a/SOURCES/0032-xwayland-Don-t-redirect-windows-leave-it-to-the-wm.patch b/SOURCES/0032-xwayland-Don-t-redirect-windows-leave-it-to-the-wm.patch new file mode 100644 index 0000000..1615503 --- /dev/null +++ b/SOURCES/0032-xwayland-Don-t-redirect-windows-leave-it-to-the-wm.patch @@ -0,0 +1,91 @@ +From 067752476a9c2bac9e01c3c923fa94b4bf0ec0c1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Fri, 11 Oct 2013 15:41:59 -0700 +Subject: [PATCH 32/38] xwayland: Don't redirect windows, leave it to the wm + +--- + hw/xfree86/xwayland/xwayland-window.c | 51 ----------------------------------- + 1 file changed, 51 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c +index 5045e65..c03855c 100644 +--- a/hw/xfree86/xwayland/xwayland-window.c ++++ b/hw/xfree86/xwayland/xwayland-window.c +@@ -31,11 +31,9 @@ + #include + #include + #include +-#include + + #include + #include +-#include + #include + + #include "xwayland.h" +@@ -86,49 +84,6 @@ xwl_window_attach(struct xwl_window *xwl_window, PixmapPtr pixmap) + pixmap->refcnt++; + } + +-static Bool +-xwl_create_window(WindowPtr window) +-{ +- ScreenPtr screen = window->drawable.pScreen; +- struct xwl_screen *xwl_screen; +- Bool ret; +- +- xwl_screen = xwl_screen_get(screen); +- +- screen->CreateWindow = xwl_screen->CreateWindow; +- ret = (*screen->CreateWindow)(window); +- xwl_screen->CreateWindow = screen->CreateWindow; +- screen->CreateWindow = xwl_create_window; +- +- if (!(xwl_screen->flags & XWL_FLAGS_ROOTLESS) || +- window->parent != NULL) +- return ret; +- +- CompositeRedirectSubwindows(window, CompositeRedirectManual); +- +- return ret; +-} +- +-static int +-xwl_destroy_window (WindowPtr window) +-{ +- ScreenPtr screen = window->drawable.pScreen; +- struct xwl_screen *xwl_screen; +- Bool ret; +- +- if (window->parent == NULL) +- CompositeUnRedirectSubwindows (window, CompositeRedirectManual); +- +- xwl_screen = xwl_screen_get(screen); +- +- screen->DestroyWindow = xwl_screen->DestroyWindow; +- ret = (*screen->DestroyWindow)(window); +- xwl_screen->DestroyWindow = screen->DestroyWindow; +- screen->DestroyWindow = xwl_destroy_window; +- +- return ret; +-} +- + static void + damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) + { +@@ -290,12 +245,6 @@ xwl_screen_init_window(struct xwl_screen *xwl_screen, ScreenPtr screen) + if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0)) + return BadAlloc; + +- xwl_screen->CreateWindow = screen->CreateWindow; +- screen->CreateWindow = xwl_create_window; +- +- xwl_screen->DestroyWindow = screen->DestroyWindow; +- screen->DestroyWindow = xwl_destroy_window; +- + xwl_screen->RealizeWindow = screen->RealizeWindow; + screen->RealizeWindow = xwl_realize_window; + +-- +1.8.4.2 + diff --git a/SOURCES/0033-xwayland-Add-wlglamor-the-right-way.patch b/SOURCES/0033-xwayland-Add-wlglamor-the-right-way.patch deleted file mode 100644 index 0188dea..0000000 --- a/SOURCES/0033-xwayland-Add-wlglamor-the-right-way.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 4a8be9e6f0b389d6e2c883dbf9bceb1f8403ac75 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 11 Oct 2013 16:29:02 -0700 -Subject: [PATCH 33/39] xwayland: Add wlglamor the right way - -Defeated by #ifdefs. ---- - hw/xfree86/common/xf86AutoConfig.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c -index 9576b86..cc6dcce 100644 ---- a/hw/xfree86/common/xf86AutoConfig.c -+++ b/hw/xfree86/common/xf86AutoConfig.c -@@ -282,12 +282,12 @@ listPossibleVideoDrivers(char *matches[], int nmatches) - - #if !defined(sun) - /* Fallback to platform default frame buffer driver */ -- if (i < (nmatches - 1)) { -+ if (i < (nmatches - 2)) { - #ifdef XORG_WAYLAND -- if (xorgWayland) -+ if (xorgWayland) { - matches[i++] = xnfstrdup("wlglamor"); - matches[i++] = xnfstrdup("wayland"); -- else -+ } else - #endif - #if !defined(__linux__) && defined(__sparc__) - matches[i++] = xnfstrdup("wsfb"); --- -1.8.3.1 - diff --git a/SOURCES/0033-xwayland-Fix-hidden-cursor.patch b/SOURCES/0033-xwayland-Fix-hidden-cursor.patch new file mode 100644 index 0000000..dd28a43 --- /dev/null +++ b/SOURCES/0033-xwayland-Fix-hidden-cursor.patch @@ -0,0 +1,38 @@ +From 844a73a64081044710d2f22ba5a52513c2cce708 Mon Sep 17 00:00:00 2001 +From: Trevor McCort +Date: Tue, 15 Oct 2013 19:41:12 -0500 +Subject: [PATCH 33/38] xwayland: Fix hidden cursor + +If a cursor is set when bits->emptyMask is true, the xserver +sets a NULL cursor instead. + +Signed-off-by: Trevor McCort +--- + hw/xfree86/xwayland/xwayland-cursor.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c +index 2cdd248..2b3cb5e 100644 +--- a/hw/xfree86/xwayland/xwayland-cursor.c ++++ b/hw/xfree86/xwayland/xwayland-cursor.c +@@ -153,9 +153,16 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat) + { + struct wl_buffer *buffer; + +- if (!xwl_seat->x_cursor || !xwl_seat->wl_pointer) ++ if (!xwl_seat->wl_pointer) + return; + ++ if (!xwl_seat->x_cursor) { ++ wl_pointer_set_cursor(xwl_seat->wl_pointer, ++ xwl_seat->pointer_enter_serial, ++ NULL, 0, 0); ++ return; ++ } ++ + buffer = dixGetPrivate(&xwl_seat->x_cursor->devPrivates, + &xwl_seat->xwl_screen->cursor_private_key); + +-- +1.8.4.2 + diff --git a/SOURCES/0034-xkb-Repurpose-XkbCopyDeviceKeymap-to-apply-a-given-k.patch b/SOURCES/0034-xkb-Repurpose-XkbCopyDeviceKeymap-to-apply-a-given-k.patch new file mode 100644 index 0000000..6339734 --- /dev/null +++ b/SOURCES/0034-xkb-Repurpose-XkbCopyDeviceKeymap-to-apply-a-given-k.patch @@ -0,0 +1,99 @@ +From 3c9434f3f70420780e1fc606175a7436f6fdbb15 Mon Sep 17 00:00:00 2001 +From: Rui Matos +Date: Tue, 22 Oct 2013 16:50:29 +0200 +Subject: [PATCH 34/38] xkb: Repurpose XkbCopyDeviceKeymap to apply a given + keymap to a device + +This will also make it useful for cases when we have a new keymap to +apply to a device but don't have a source device. +--- + Xi/exevents.c | 2 +- + include/xkbsrv.h | 4 ++-- + xkb/xkb.c | 2 +- + xkb/xkbUtils.c | 14 +++++++------- + 4 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/Xi/exevents.c b/Xi/exevents.c +index 69b4038..028bdb4 100644 +--- a/Xi/exevents.c ++++ b/Xi/exevents.c +@@ -230,7 +230,7 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master) + + mk->sourceid = device->id; + +- if (!XkbCopyDeviceKeymap(master, device)) ++ if (!XkbDeviceApplyKeymap(master, device->key->xkbInfo->desc)) + FatalError("Couldn't pivot keymap from device to core!\n"); + } + +diff --git a/include/xkbsrv.h b/include/xkbsrv.h +index bef98ef..83ee1d0 100644 +--- a/include/xkbsrv.h ++++ b/include/xkbsrv.h +@@ -812,8 +812,8 @@ extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ , + extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ , + XkbDescPtr /* src */ ); + +-extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */ , +- DeviceIntPtr /* src */ ); ++extern _X_EXPORT Bool XkbDeviceApplyKeymap(DeviceIntPtr /* dst */ , ++ XkbDescPtr /* src */ ); + + extern void XkbFilterEvents(ClientPtr /* pClient */ , + int /* nEvents */ , +diff --git a/xkb/xkb.c b/xkb/xkb.c +index c78aceb..7a631b8 100644 +--- a/xkb/xkb.c ++++ b/xkb/xkb.c +@@ -5991,7 +5991,7 @@ ProcXkbGetKbdByName(ClientPtr client) + continue; + + if (tmpd != dev) +- XkbCopyDeviceKeymap(tmpd, dev); ++ XkbDeviceApplyKeymap(tmpd, xkb); + + if (tmpd->kbdfeed && tmpd->kbdfeed->xkb_sli) { + old_sli = tmpd->kbdfeed->xkb_sli; +diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c +index 6c6af60..1f8a839 100644 +--- a/xkb/xkbUtils.c ++++ b/xkb/xkbUtils.c +@@ -1999,28 +1999,28 @@ XkbCopyKeymap(XkbDescPtr dst, XkbDescPtr src) + } + + Bool +-XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) ++XkbDeviceApplyKeymap(DeviceIntPtr dst, XkbDescPtr desc) + { + xkbNewKeyboardNotify nkn; + Bool ret; + +- if (!dst->key || !src->key) ++ if (!dst->key || !desc) + return FALSE; + + memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); + nkn.oldMinKeyCode = dst->key->xkbInfo->desc->min_key_code; + nkn.oldMaxKeyCode = dst->key->xkbInfo->desc->max_key_code; + nkn.deviceID = dst->id; +- nkn.oldDeviceID = dst->id; /* maybe src->id? */ +- nkn.minKeyCode = src->key->xkbInfo->desc->min_key_code; +- nkn.maxKeyCode = src->key->xkbInfo->desc->max_key_code; ++ nkn.oldDeviceID = dst->id; ++ nkn.minKeyCode = desc->min_key_code; ++ nkn.maxKeyCode = desc->max_key_code; + nkn.requestMajor = XkbReqCode; + nkn.requestMinor = X_kbSetMap; /* Near enough's good enough. */ + nkn.changed = XkbNKN_KeycodesMask; +- if (src->key->xkbInfo->desc->geom) ++ if (desc->geom) + nkn.changed |= XkbNKN_GeometryMask; + +- ret = XkbCopyKeymap(dst->key->xkbInfo->desc, src->key->xkbInfo->desc); ++ ret = XkbCopyKeymap(dst->key->xkbInfo->desc, desc); + if (ret) + XkbSendNewKeyboardNotify(dst, &nkn); + +-- +1.8.4.2 + diff --git a/SOURCES/0034-xwayland-Don-t-redirect-windows-leave-it-to-the-wm.patch b/SOURCES/0034-xwayland-Don-t-redirect-windows-leave-it-to-the-wm.patch deleted file mode 100644 index a2edef4..0000000 --- a/SOURCES/0034-xwayland-Don-t-redirect-windows-leave-it-to-the-wm.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 52668595cb7e52612944a77276eb71f29d037738 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 11 Oct 2013 15:41:59 -0700 -Subject: [PATCH 34/39] xwayland: Don't redirect windows, leave it to the wm - ---- - hw/xfree86/xwayland/xwayland-window.c | 51 ----------------------------------- - 1 file changed, 51 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c -index fb9c64a..0cb4f28 100644 ---- a/hw/xfree86/xwayland/xwayland-window.c -+++ b/hw/xfree86/xwayland/xwayland-window.c -@@ -31,11 +31,9 @@ - #include - #include - #include --#include - - #include - #include --#include - #include - - #include "xwayland.h" -@@ -86,49 +84,6 @@ xwl_window_attach(struct xwl_window *xwl_window, PixmapPtr pixmap) - pixmap->refcnt++; - } - --static Bool --xwl_create_window(WindowPtr window) --{ -- ScreenPtr screen = window->drawable.pScreen; -- struct xwl_screen *xwl_screen; -- Bool ret; -- -- xwl_screen = xwl_screen_get(screen); -- -- screen->CreateWindow = xwl_screen->CreateWindow; -- ret = (*screen->CreateWindow)(window); -- xwl_screen->CreateWindow = screen->CreateWindow; -- screen->CreateWindow = xwl_create_window; -- -- if (!(xwl_screen->flags & XWL_FLAGS_ROOTLESS) || -- window->parent != NULL) -- return ret; -- -- CompositeRedirectSubwindows(window, CompositeRedirectManual); -- -- return ret; --} -- --static int --xwl_destroy_window (WindowPtr window) --{ -- ScreenPtr screen = window->drawable.pScreen; -- struct xwl_screen *xwl_screen; -- Bool ret; -- -- if (window->parent == NULL) -- CompositeUnRedirectSubwindows (window, CompositeRedirectManual); -- -- xwl_screen = xwl_screen_get(screen); -- -- screen->DestroyWindow = xwl_screen->DestroyWindow; -- ret = (*screen->DestroyWindow)(window); -- xwl_screen->DestroyWindow = screen->DestroyWindow; -- screen->DestroyWindow = xwl_destroy_window; -- -- return ret; --} -- - static void - damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data) - { -@@ -289,12 +244,6 @@ xwl_screen_init_window(struct xwl_screen *xwl_screen, ScreenPtr screen) - if (!dixRegisterPrivateKey(&xwl_window_private_key, PRIVATE_WINDOW, 0)) - return BadAlloc; - -- xwl_screen->CreateWindow = screen->CreateWindow; -- screen->CreateWindow = xwl_create_window; -- -- xwl_screen->DestroyWindow = screen->DestroyWindow; -- screen->DestroyWindow = xwl_destroy_window; -- - xwl_screen->RealizeWindow = screen->RealizeWindow; - screen->RealizeWindow = xwl_realize_window; - --- -1.8.3.1 - diff --git a/SOURCES/0035-Revert-Export-CompositeRedirectSubwindows-and-Compos.patch b/SOURCES/0035-Revert-Export-CompositeRedirectSubwindows-and-Compos.patch deleted file mode 100644 index 452b478..0000000 --- a/SOURCES/0035-Revert-Export-CompositeRedirectSubwindows-and-Compos.patch +++ /dev/null @@ -1,68 +0,0 @@ -From f7a01c6db6f3aaf161b1c057633a4e53adf8b62b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= -Date: Fri, 11 Oct 2013 16:40:39 -0700 -Subject: [PATCH 35/39] Revert "Export CompositeRedirectSubwindows and - CompositeUnRedirectSubwindows" - -This reverts commit 15a7e62a9848f2089180c49b02887565d29bb896. - -Now that we don't redirect windows on behalf of the wm, we don't need this. ---- - composite/compalloc.c | 11 ----------- - composite/compositeext.h | 4 ---- - 2 files changed, 15 deletions(-) - -diff --git a/composite/compalloc.c b/composite/compalloc.c -index 98b27b1..b7d731e 100644 ---- a/composite/compalloc.c -+++ b/composite/compalloc.c -@@ -46,7 +46,6 @@ - #endif - - #include "compint.h" --#include "compositeext.h" - - static void - compScreenUpdate(ScreenPtr pScreen) -@@ -412,11 +411,6 @@ compRedirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update) - return Success; - } - --int CompositeRedirectSubwindows (WindowPtr pWin, int update) --{ -- return compRedirectSubwindows (serverClient, pWin, update); --} -- - /* - * Free one of the per-client per-subwindows resources, - * which frees one redirect per subwindow -@@ -488,11 +482,6 @@ compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update) - return BadValue; - } - --int CompositeUnRedirectSubwindows (WindowPtr pWin, int update) --{ -- return compUnredirectSubwindows (serverClient, pWin, update); --} -- - /* - * Add redirection information for one subwindow (during reparent) - */ -diff --git a/composite/compositeext.h b/composite/compositeext.h -index a072966..0b148f0 100644 ---- a/composite/compositeext.h -+++ b/composite/compositeext.h -@@ -34,10 +34,6 @@ - extern _X_EXPORT Bool CompositeRegisterAlternateVisuals(ScreenPtr pScreen, - VisualID * vids, - int nVisuals); --extern _X_EXPORT int CompositeRedirectSubwindows(WindowPtr pWin, -- int update); --extern _X_EXPORT int CompositeUnRedirectSubwindows (WindowPtr pWin, -- int update); - - extern _X_EXPORT RESTYPE CompositeClientWindowType; - --- -1.8.3.1 - diff --git a/SOURCES/0035-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch b/SOURCES/0035-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch new file mode 100644 index 0000000..caf2696 --- /dev/null +++ b/SOURCES/0035-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch @@ -0,0 +1,91 @@ +From 260ca040db20c397af0803da5c1bf15bc3bc08f2 Mon Sep 17 00:00:00 2001 +From: Rui Matos +Date: Mon, 21 Oct 2013 14:41:53 +0200 +Subject: [PATCH 35/38] xkb: Factor out a function to copy a keymap's controls + unto another + +--- + include/xkbsrv.h | 3 +++ + xkb/xkb.c | 14 +------------- + xkb/xkbUtils.c | 23 +++++++++++++++++++++++ + 3 files changed, 27 insertions(+), 13 deletions(-) + +diff --git a/include/xkbsrv.h b/include/xkbsrv.h +index 83ee1d0..6a2e96e 100644 +--- a/include/xkbsrv.h ++++ b/include/xkbsrv.h +@@ -829,6 +829,9 @@ extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ , + int /* press */ , + int /* button */ ); + ++extern _X_EXPORT void XkbCopyControls(XkbDescPtr /* dst */ , ++ XkbDescPtr /* src */ ); ++ + #include "xkbfile.h" + #include "xkbrules.h" + +diff --git a/xkb/xkb.c b/xkb/xkb.c +index 7a631b8..6a68e81 100644 +--- a/xkb/xkb.c ++++ b/xkb/xkb.c +@@ -5950,25 +5950,13 @@ ProcXkbGetKbdByName(ClientPtr client) + if (rep.loaded) { + XkbDescPtr old_xkb; + xkbNewKeyboardNotify nkn; +- int i, nG, nTG; + + old_xkb = xkb; + xkb = new; + dev->key->xkbInfo->desc = xkb; + new = old_xkb; /* so it'll get freed automatically */ + +- *xkb->ctrls = *old_xkb->ctrls; +- for (nG = nTG = 0, i = xkb->min_key_code; i <= xkb->max_key_code; i++) { +- nG = XkbKeyNumGroups(xkb, i); +- if (nG >= XkbNumKbdGroups) { +- nTG = XkbNumKbdGroups; +- break; +- } +- if (nG > nTG) { +- nTG = nG; +- } +- } +- xkb->ctrls->num_groups = nTG; ++ XkbCopyControls(xkb, old_xkb); + + nkn.deviceID = nkn.oldDeviceID = dev->id; + nkn.minKeyCode = new->min_key_code; +diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c +index 1f8a839..6cf6e79 100644 +--- a/xkb/xkbUtils.c ++++ b/xkb/xkbUtils.c +@@ -2090,3 +2090,26 @@ XkbMergeLockedPtrBtns(DeviceIntPtr master) + xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons; + } + } ++ ++void ++XkbCopyControls(XkbDescPtr dst, XkbDescPtr src) ++{ ++ int i, nG, nTG; ++ ++ if (!dst || !src) ++ return; ++ ++ *dst->ctrls = *src->ctrls; ++ ++ for (nG = nTG = 0, i = dst->min_key_code; i <= dst->max_key_code; i++) { ++ nG = XkbKeyNumGroups(dst, i); ++ if (nG >= XkbNumKbdGroups) { ++ nTG = XkbNumKbdGroups; ++ break; ++ } ++ if (nG > nTG) { ++ nTG = nG; ++ } ++ } ++ dst->ctrls->num_groups = nTG; ++} +-- +1.8.4.2 + diff --git a/SOURCES/0036-xwayland-Fix-hidden-cursor.patch b/SOURCES/0036-xwayland-Fix-hidden-cursor.patch deleted file mode 100644 index aaaca8f..0000000 --- a/SOURCES/0036-xwayland-Fix-hidden-cursor.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 48552ee6143a7fd576b746cce1ed2580d25a5bce Mon Sep 17 00:00:00 2001 -From: Trevor McCort -Date: Tue, 15 Oct 2013 19:41:12 -0500 -Subject: [PATCH 36/39] xwayland: Fix hidden cursor - -If a cursor is set when bits->emptyMask is true, the xserver -sets a NULL cursor instead. - -Signed-off-by: Trevor McCort ---- - hw/xfree86/xwayland/xwayland-cursor.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/hw/xfree86/xwayland/xwayland-cursor.c b/hw/xfree86/xwayland/xwayland-cursor.c -index 2cdd248..2b3cb5e 100644 ---- a/hw/xfree86/xwayland/xwayland-cursor.c -+++ b/hw/xfree86/xwayland/xwayland-cursor.c -@@ -153,9 +153,16 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat) - { - struct wl_buffer *buffer; - -- if (!xwl_seat->x_cursor || !xwl_seat->wl_pointer) -+ if (!xwl_seat->wl_pointer) - return; - -+ if (!xwl_seat->x_cursor) { -+ wl_pointer_set_cursor(xwl_seat->wl_pointer, -+ xwl_seat->pointer_enter_serial, -+ NULL, 0, 0); -+ return; -+ } -+ - buffer = dixGetPrivate(&xwl_seat->x_cursor->devPrivates, - &xwl_seat->xwl_screen->cursor_private_key); - --- -1.8.3.1 - diff --git a/SOURCES/0036-xwayland-Handle-keymap-changes.patch b/SOURCES/0036-xwayland-Handle-keymap-changes.patch new file mode 100644 index 0000000..2d31062 --- /dev/null +++ b/SOURCES/0036-xwayland-Handle-keymap-changes.patch @@ -0,0 +1,87 @@ +From 6240dcadc8f51b00abe7d1fc4e682b442809fb91 Mon Sep 17 00:00:00 2001 +From: Rui Matos +Date: Mon, 21 Oct 2013 14:41:54 +0200 +Subject: [PATCH 36/38] xwayland: Handle keymap changes + +--- + hw/xfree86/xwayland/xwayland-input.c | 39 +++++++++++++++++++++++++++++++++--- + include/input.h | 2 +- + 2 files changed, 37 insertions(+), 4 deletions(-) + +diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c +index d031b34..ebf1af1 100644 +--- a/hw/xfree86/xwayland/xwayland-input.c ++++ b/hw/xfree86/xwayland/xwayland-input.c +@@ -143,7 +143,10 @@ xwl_keyboard_proc(DeviceIntPtr device, int what) + switch (what) { + case DEVICE_INIT: + device->public.on = FALSE; +- len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size); ++ if (xwl_seat->keymap) ++ len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size); ++ else ++ len = 0; + if (!InitKeyboardDeviceStructFromString(device, xwl_seat->keymap, + len, + NULL, xwl_keyboard_control)) +@@ -453,12 +456,42 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, + uint32_t format, int fd, uint32_t size) + { + struct xwl_seat *xwl_seat = data; ++ DeviceIntPtr master; ++ XkbDescPtr xkb; ++ XkbChangesRec changes = { 0 }; ++ ++ if (xwl_seat->keymap) ++ munmap(xwl_seat->keymap, xwl_seat->keymap_size); + + xwl_seat->keymap_size = size; + xwl_seat->keymap = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); +- if (xwl_seat->keymap == MAP_FAILED) +- ; /* wah wah */ ++ if (xwl_seat->keymap == MAP_FAILED) { ++ xwl_seat->keymap_size = 0; ++ xwl_seat->keymap = NULL; ++ goto out; ++ } ++ ++ if (!xwl_seat->keyboard) ++ goto out; ++ ++ xkb = XkbCompileKeymapFromString(xwl_seat->keyboard, xwl_seat->keymap, ++ strnlen(xwl_seat->keymap, xwl_seat->keymap_size)); ++ if (!xkb) ++ goto out; ++ ++ XkbUpdateDescActions(xkb, xkb->min_key_code, XkbNumKeys(xkb), &changes); ++ /* Keep the current controls */ ++ XkbCopyControls(xkb, xwl_seat->keyboard->key->xkbInfo->desc); ++ ++ XkbDeviceApplyKeymap(xwl_seat->keyboard, xkb); ++ ++ master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD); ++ if (master && master->lastSlave == xwl_seat->keyboard) ++ XkbDeviceApplyKeymap(master, xkb); ++ ++ XkbFreeKeyboard(xkb, XkbAllComponentsMask, TRUE); + ++ out: + close(fd); + } + +diff --git a/include/input.h b/include/input.h +index b1cc3ff..6a814c2 100644 +--- a/include/input.h ++++ b/include/input.h +@@ -508,7 +508,7 @@ extern int AttachDevice(ClientPtr client, + DeviceIntPtr slave, DeviceIntPtr master); + + extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); +-extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); ++extern _X_EXPORT DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); + + extern _X_EXPORT int AllocDevicePair(ClientPtr client, + const char *name, +-- +1.8.4.2 + diff --git a/SOURCES/0037-xkb-Repurpose-XkbCopyDeviceKeymap-to-apply-a-given-k.patch b/SOURCES/0037-xkb-Repurpose-XkbCopyDeviceKeymap-to-apply-a-given-k.patch deleted file mode 100644 index 2c666d1..0000000 --- a/SOURCES/0037-xkb-Repurpose-XkbCopyDeviceKeymap-to-apply-a-given-k.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 2a58c1c5cc8db21252838b6aacb14986850f1ddd Mon Sep 17 00:00:00 2001 -From: Rui Matos -Date: Tue, 22 Oct 2013 16:50:29 +0200 -Subject: [PATCH 37/39] xkb: Repurpose XkbCopyDeviceKeymap to apply a given - keymap to a device - -This will also make it useful for cases when we have a new keymap to -apply to a device but don't have a source device. ---- - Xi/exevents.c | 2 +- - include/xkbsrv.h | 4 ++-- - xkb/xkb.c | 2 +- - xkb/xkbUtils.c | 14 +++++++------- - 4 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/Xi/exevents.c b/Xi/exevents.c -index 69b4038..028bdb4 100644 ---- a/Xi/exevents.c -+++ b/Xi/exevents.c -@@ -230,7 +230,7 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master) - - mk->sourceid = device->id; - -- if (!XkbCopyDeviceKeymap(master, device)) -+ if (!XkbDeviceApplyKeymap(master, device->key->xkbInfo->desc)) - FatalError("Couldn't pivot keymap from device to core!\n"); - } - -diff --git a/include/xkbsrv.h b/include/xkbsrv.h -index bef98ef..83ee1d0 100644 ---- a/include/xkbsrv.h -+++ b/include/xkbsrv.h -@@ -812,8 +812,8 @@ extern _X_EXPORT void XkbSendNewKeyboardNotify(DeviceIntPtr /* kbd */ , - extern Bool XkbCopyKeymap(XkbDescPtr /* dst */ , - XkbDescPtr /* src */ ); - --extern _X_EXPORT Bool XkbCopyDeviceKeymap(DeviceIntPtr /* dst */ , -- DeviceIntPtr /* src */ ); -+extern _X_EXPORT Bool XkbDeviceApplyKeymap(DeviceIntPtr /* dst */ , -+ XkbDescPtr /* src */ ); - - extern void XkbFilterEvents(ClientPtr /* pClient */ , - int /* nEvents */ , -diff --git a/xkb/xkb.c b/xkb/xkb.c -index c78aceb..7a631b8 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5991,7 +5991,7 @@ ProcXkbGetKbdByName(ClientPtr client) - continue; - - if (tmpd != dev) -- XkbCopyDeviceKeymap(tmpd, dev); -+ XkbDeviceApplyKeymap(tmpd, xkb); - - if (tmpd->kbdfeed && tmpd->kbdfeed->xkb_sli) { - old_sli = tmpd->kbdfeed->xkb_sli; -diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c -index 6c6af60..1f8a839 100644 ---- a/xkb/xkbUtils.c -+++ b/xkb/xkbUtils.c -@@ -1999,28 +1999,28 @@ XkbCopyKeymap(XkbDescPtr dst, XkbDescPtr src) - } - - Bool --XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) -+XkbDeviceApplyKeymap(DeviceIntPtr dst, XkbDescPtr desc) - { - xkbNewKeyboardNotify nkn; - Bool ret; - -- if (!dst->key || !src->key) -+ if (!dst->key || !desc) - return FALSE; - - memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); - nkn.oldMinKeyCode = dst->key->xkbInfo->desc->min_key_code; - nkn.oldMaxKeyCode = dst->key->xkbInfo->desc->max_key_code; - nkn.deviceID = dst->id; -- nkn.oldDeviceID = dst->id; /* maybe src->id? */ -- nkn.minKeyCode = src->key->xkbInfo->desc->min_key_code; -- nkn.maxKeyCode = src->key->xkbInfo->desc->max_key_code; -+ nkn.oldDeviceID = dst->id; -+ nkn.minKeyCode = desc->min_key_code; -+ nkn.maxKeyCode = desc->max_key_code; - nkn.requestMajor = XkbReqCode; - nkn.requestMinor = X_kbSetMap; /* Near enough's good enough. */ - nkn.changed = XkbNKN_KeycodesMask; -- if (src->key->xkbInfo->desc->geom) -+ if (desc->geom) - nkn.changed |= XkbNKN_GeometryMask; - -- ret = XkbCopyKeymap(dst->key->xkbInfo->desc, src->key->xkbInfo->desc); -+ ret = XkbCopyKeymap(dst->key->xkbInfo->desc, desc); - if (ret) - XkbSendNewKeyboardNotify(dst, &nkn); - --- -1.8.3.1 - diff --git a/SOURCES/0037-xwayland-Fix-re-wrapping-of-RealizeWindow.patch b/SOURCES/0037-xwayland-Fix-re-wrapping-of-RealizeWindow.patch new file mode 100644 index 0000000..18a0a2f --- /dev/null +++ b/SOURCES/0037-xwayland-Fix-re-wrapping-of-RealizeWindow.patch @@ -0,0 +1,25 @@ +From 408c17759542df3c906fc6fd0c01a3963ac0f345 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= +Date: Wed, 4 Dec 2013 10:27:07 -0800 +Subject: [PATCH 37/38] xwayland: Fix re-wrapping of RealizeWindow + +--- + hw/xfree86/xwayland/xwayland-window.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c +index c03855c..ee95371 100644 +--- a/hw/xfree86/xwayland/xwayland-window.c ++++ b/hw/xfree86/xwayland/xwayland-window.c +@@ -110,7 +110,7 @@ xwl_realize_window(WindowPtr window) + + screen->RealizeWindow = xwl_screen->RealizeWindow; + ret = (*screen->RealizeWindow)(window); +- xwl_screen->RealizeWindow = xwl_screen->RealizeWindow; ++ xwl_screen->RealizeWindow = screen->RealizeWindow; + screen->RealizeWindow = xwl_realize_window; + + if (xwl_screen->flags & XWL_FLAGS_ROOTLESS) { +-- +1.8.4.2 + diff --git a/SOURCES/0038-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch b/SOURCES/0038-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch deleted file mode 100644 index d118949..0000000 --- a/SOURCES/0038-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch +++ /dev/null @@ -1,91 +0,0 @@ -From bcbc8bf3a7ed433cb6424deca845f49d3b744339 Mon Sep 17 00:00:00 2001 -From: Rui Matos -Date: Mon, 21 Oct 2013 14:41:53 +0200 -Subject: [PATCH 38/39] xkb: Factor out a function to copy a keymap's controls - unto another - ---- - include/xkbsrv.h | 3 +++ - xkb/xkb.c | 14 +------------- - xkb/xkbUtils.c | 23 +++++++++++++++++++++++ - 3 files changed, 27 insertions(+), 13 deletions(-) - -diff --git a/include/xkbsrv.h b/include/xkbsrv.h -index 83ee1d0..6a2e96e 100644 ---- a/include/xkbsrv.h -+++ b/include/xkbsrv.h -@@ -829,6 +829,9 @@ extern void XkbFakeDeviceButton(DeviceIntPtr /* dev */ , - int /* press */ , - int /* button */ ); - -+extern _X_EXPORT void XkbCopyControls(XkbDescPtr /* dst */ , -+ XkbDescPtr /* src */ ); -+ - #include "xkbfile.h" - #include "xkbrules.h" - -diff --git a/xkb/xkb.c b/xkb/xkb.c -index 7a631b8..6a68e81 100644 ---- a/xkb/xkb.c -+++ b/xkb/xkb.c -@@ -5950,25 +5950,13 @@ ProcXkbGetKbdByName(ClientPtr client) - if (rep.loaded) { - XkbDescPtr old_xkb; - xkbNewKeyboardNotify nkn; -- int i, nG, nTG; - - old_xkb = xkb; - xkb = new; - dev->key->xkbInfo->desc = xkb; - new = old_xkb; /* so it'll get freed automatically */ - -- *xkb->ctrls = *old_xkb->ctrls; -- for (nG = nTG = 0, i = xkb->min_key_code; i <= xkb->max_key_code; i++) { -- nG = XkbKeyNumGroups(xkb, i); -- if (nG >= XkbNumKbdGroups) { -- nTG = XkbNumKbdGroups; -- break; -- } -- if (nG > nTG) { -- nTG = nG; -- } -- } -- xkb->ctrls->num_groups = nTG; -+ XkbCopyControls(xkb, old_xkb); - - nkn.deviceID = nkn.oldDeviceID = dev->id; - nkn.minKeyCode = new->min_key_code; -diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c -index 1f8a839..6cf6e79 100644 ---- a/xkb/xkbUtils.c -+++ b/xkb/xkbUtils.c -@@ -2090,3 +2090,26 @@ XkbMergeLockedPtrBtns(DeviceIntPtr master) - xkbi->lockedPtrButtons |= d->key->xkbInfo->lockedPtrButtons; - } - } -+ -+void -+XkbCopyControls(XkbDescPtr dst, XkbDescPtr src) -+{ -+ int i, nG, nTG; -+ -+ if (!dst || !src) -+ return; -+ -+ *dst->ctrls = *src->ctrls; -+ -+ for (nG = nTG = 0, i = dst->min_key_code; i <= dst->max_key_code; i++) { -+ nG = XkbKeyNumGroups(dst, i); -+ if (nG >= XkbNumKbdGroups) { -+ nTG = XkbNumKbdGroups; -+ break; -+ } -+ if (nG > nTG) { -+ nTG = nG; -+ } -+ } -+ dst->ctrls->num_groups = nTG; -+} --- -1.8.3.1 - diff --git a/SOURCES/0038-xwayland-Adapt-to-1.15-Damage-API.patch b/SOURCES/0038-xwayland-Adapt-to-1.15-Damage-API.patch new file mode 100644 index 0000000..876cb66 --- /dev/null +++ b/SOURCES/0038-xwayland-Adapt-to-1.15-Damage-API.patch @@ -0,0 +1,24 @@ +From 76e317e6e80465ecdda849931789f1b606ff75ae Mon Sep 17 00:00:00 2001 +From: Adam Jackson +Date: Thu, 12 Dec 2013 09:47:12 -0500 +Subject: [PATCH 38/38] xwayland: Adapt to 1.15 Damage API + +--- + hw/xfree86/xwayland/xwayland-window.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/hw/xfree86/xwayland/xwayland-window.c b/hw/xfree86/xwayland/xwayland-window.c +index ee95371..9a6724e 100644 +--- a/hw/xfree86/xwayland/xwayland-window.c ++++ b/hw/xfree86/xwayland/xwayland-window.c +@@ -190,7 +190,6 @@ xwl_unrealize_window(WindowPtr window) + xorg_list_del(&xwl_window->link); + if (RegionNotEmpty(DamageRegion(xwl_window->damage))) + xorg_list_del(&xwl_window->link_damage); +- DamageUnregister(&window->drawable, xwl_window->damage); + DamageDestroy(xwl_window->damage); + free(xwl_window); + dixSetPrivate(&window->devPrivates, &xwl_window_private_key, NULL); +-- +1.8.4.2 + diff --git a/SOURCES/0039-xwayland-Handle-keymap-changes.patch b/SOURCES/0039-xwayland-Handle-keymap-changes.patch deleted file mode 100644 index dcbb345..0000000 --- a/SOURCES/0039-xwayland-Handle-keymap-changes.patch +++ /dev/null @@ -1,87 +0,0 @@ -From d43a01c9cb622ea7300614dce3d0752e21ca180a Mon Sep 17 00:00:00 2001 -From: Rui Matos -Date: Mon, 21 Oct 2013 14:41:54 +0200 -Subject: [PATCH 39/39] xwayland: Handle keymap changes - ---- - hw/xfree86/xwayland/xwayland-input.c | 39 +++++++++++++++++++++++++++++++++--- - include/input.h | 2 +- - 2 files changed, 37 insertions(+), 4 deletions(-) - -diff --git a/hw/xfree86/xwayland/xwayland-input.c b/hw/xfree86/xwayland/xwayland-input.c -index d031b34..ebf1af1 100644 ---- a/hw/xfree86/xwayland/xwayland-input.c -+++ b/hw/xfree86/xwayland/xwayland-input.c -@@ -143,7 +143,10 @@ xwl_keyboard_proc(DeviceIntPtr device, int what) - switch (what) { - case DEVICE_INIT: - device->public.on = FALSE; -- len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size); -+ if (xwl_seat->keymap) -+ len = strnlen(xwl_seat->keymap, xwl_seat->keymap_size); -+ else -+ len = 0; - if (!InitKeyboardDeviceStructFromString(device, xwl_seat->keymap, - len, - NULL, xwl_keyboard_control)) -@@ -453,12 +456,42 @@ keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, - uint32_t format, int fd, uint32_t size) - { - struct xwl_seat *xwl_seat = data; -+ DeviceIntPtr master; -+ XkbDescPtr xkb; -+ XkbChangesRec changes = { 0 }; -+ -+ if (xwl_seat->keymap) -+ munmap(xwl_seat->keymap, xwl_seat->keymap_size); - - xwl_seat->keymap_size = size; - xwl_seat->keymap = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0); -- if (xwl_seat->keymap == MAP_FAILED) -- ; /* wah wah */ -+ if (xwl_seat->keymap == MAP_FAILED) { -+ xwl_seat->keymap_size = 0; -+ xwl_seat->keymap = NULL; -+ goto out; -+ } -+ -+ if (!xwl_seat->keyboard) -+ goto out; -+ -+ xkb = XkbCompileKeymapFromString(xwl_seat->keyboard, xwl_seat->keymap, -+ strnlen(xwl_seat->keymap, xwl_seat->keymap_size)); -+ if (!xkb) -+ goto out; -+ -+ XkbUpdateDescActions(xkb, xkb->min_key_code, XkbNumKeys(xkb), &changes); -+ /* Keep the current controls */ -+ XkbCopyControls(xkb, xwl_seat->keyboard->key->xkbInfo->desc); -+ -+ XkbDeviceApplyKeymap(xwl_seat->keyboard, xkb); -+ -+ master = GetMaster(xwl_seat->keyboard, MASTER_KEYBOARD); -+ if (master && master->lastSlave == xwl_seat->keyboard) -+ XkbDeviceApplyKeymap(master, xkb); -+ -+ XkbFreeKeyboard(xkb, XkbAllComponentsMask, TRUE); - -+ out: - close(fd); - } - -diff --git a/include/input.h b/include/input.h -index 6573a3a..1edcedc 100644 ---- a/include/input.h -+++ b/include/input.h -@@ -508,7 +508,7 @@ extern int AttachDevice(ClientPtr client, - DeviceIntPtr slave, DeviceIntPtr master); - - extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); --extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); -+extern _X_EXPORT DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); - - extern _X_EXPORT int AllocDevicePair(ClientPtr client, - const char *name, --- -1.8.3.1 - diff --git a/SOURCES/0040-xfree86-Keep-a-non-seat0-X-server-from-touching-VTs-.patch b/SOURCES/0040-xfree86-Keep-a-non-seat0-X-server-from-touching-VTs-.patch new file mode 100644 index 0000000..b403737 --- /dev/null +++ b/SOURCES/0040-xfree86-Keep-a-non-seat0-X-server-from-touching-VTs-.patch @@ -0,0 +1,50 @@ +From e84714bc6aa80435b3934b6ab3047ac2808111db Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?= +Date: Thu, 12 Dec 2013 14:22:48 -0200 +Subject: [PATCH] xfree86: Keep a non-seat0 X server from touching VTs (#71258) + +Updated patch following Hans de Goede's advice. + +If -seat option is passed with a value different from seat0, +X server won't call xf86OpenConsole(). + +This is needed to avoid any race condition between seat0 and +non-seat0 X servers. If a non-seat0 X server opens a given VT +before a seat0 one which expects to open the same VT, one can +get an inactive systemd-logind graphical session for seat0. + +This patch was first tested in a multiseat setup with multiple +video cards and works quite well. + +I suppose it can also make things like DontVTSwitch and -sharevts +meaningless for non-seat0 seats, so it may fix bug #69477, too. + +Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=71258 + https://bugs.freedesktop.org/show_bug.cgi?id=69477 (maybe) + +See also: http://lists.x.org/archives/xorg-devel/2013-October/038391.html + https://bugzilla.redhat.com/show_bug.cgi?id=1018196 + +Signed-off-by: Hans de Goede +Reviewed-by: Hans de Goede +--- + hw/xfree86/common/xf86Init.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c +index 788f808..ae482dd 100644 +--- a/hw/xfree86/common/xf86Init.c ++++ b/hw/xfree86/common/xf86Init.c +@@ -563,7 +563,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) + if (NEED_IO_ENABLED(flags)) + want_hw_access = TRUE; + +- if (!(flags & HW_SKIP_CONSOLE)) ++ /* Non-seat0 X servers should not open console */ ++ if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0()) + xorgHWOpenConsole = TRUE; + } + } +-- +1.8.3.1 + diff --git a/SOURCES/commitid b/SOURCES/commitid deleted file mode 100644 index e493f49..0000000 --- a/SOURCES/commitid +++ /dev/null @@ -1 +0,0 @@ -90642948cc78834d95f7a3bddaac7ff77b68ed7e diff --git a/SOURCES/driver-abi-rebuild.sh b/SOURCES/driver-abi-rebuild.sh index e8f2d3c..cf0d065 100755 --- a/SOURCES/driver-abi-rebuild.sh +++ b/SOURCES/driver-abi-rebuild.sh @@ -31,7 +31,7 @@ driverlist=$(grep ^Requires *.spec | awk '{ print $2 }') popd # Things not in -drivers for whatever reason... -extradrivers="xorg-x11-drv-ivtv" +extradrivers="xorg-x11-glamor xorg-x11-drv-ivtv" rm -rf xorg-x11-drivers echo $driverlist $extradrivers | xargs -n1 $pkg co $branch @@ -39,12 +39,17 @@ echo $driverlist $extradrivers | xargs -n1 $pkg co $branch for i in xorg-x11-drv-*/ ; do [ -e $i/dead.package ] && continue pushd $i - rpmdev-bumpspec -c "- 1.15RC1 ABI rebuild" *.spec + rpmdev-bumpspec -c "- 1.15 ABI rebuild" *.spec $pkg commit -c -p && $pkg build --nowait #$pkg mockbuild #$pkg srpm #mockchain -r fedora-20-x86_64 -l $OLDPWD #mockchain -r rhel-7.0-candidate-x86_64 -l $OLDPWD + + if [ $i = "xorg-x11-glamor" ]; then + koji wait-repo f21-build --build $($pkg verrel) + fi + popd done diff --git a/SOURCES/exa-only-draw-valid-trapezoids.patch b/SOURCES/exa-only-draw-valid-trapezoids.patch new file mode 100644 index 0000000..59cc5d6 --- /dev/null +++ b/SOURCES/exa-only-draw-valid-trapezoids.patch @@ -0,0 +1,48 @@ +From patchwork Wed Oct 2 13:47:54 2013 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +Subject: exa: only draw valid trapezoids +From: Maarten Lankhorst +X-Patchwork-Id: 14769 +Message-Id: <524C240A.9010607@canonical.com> +To: "X.Org Devel List" +Date: Wed, 02 Oct 2013 15:47:54 +0200 + +Fixes freedesktop.org bug https://bugs.freedesktop.org/show_bug.cgi?id=67484 + +If t->bottom is close to MIN_INT, removing top can wraparound, so do the check properly. +A similar fix should also be applied to pixman. + +Signed-off-by: Maarten Lankhorst + +--- + + +diff --git a/exa/exa_render.c b/exa/exa_render.c +index 172e2b5..807eeba 100644 +--- a/exa/exa_render.c ++++ b/exa/exa_render.c +@@ -1141,7 +1141,8 @@ exaTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + + exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST); + for (; ntrap; ntrap--, traps++) +- (*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1); ++ if (xTrapezoidValid(traps)) ++ (*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1); + exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST); + + xRel = bounds.x1 + xSrc - xDst; +diff --git a/render/picture.h b/render/picture.h +index c85353a..fcd6401 100644 +--- a/render/picture.h ++++ b/render/picture.h +@@ -211,7 +211,7 @@ typedef pixman_fixed_t xFixed; + /* whether 't' is a well defined not obviously empty trapezoid */ + #define xTrapezoidValid(t) ((t)->left.p1.y != (t)->left.p2.y && \ + (t)->right.p1.y != (t)->right.p2.y && \ +- (int) ((t)->bottom - (t)->top) > 0) ++ ((t)->bottom > (t)->top)) + + /* + * Standard NTSC luminance conversions: diff --git a/SOURCES/gitignore b/SOURCES/gitignore new file mode 100644 index 0000000..524cfc6 --- /dev/null +++ b/SOURCES/gitignore @@ -0,0 +1,306 @@ +Makefile +Makefile.in +.deps +.libs +.msg +*.lo +*.la +*.a +*.o +*~ +.*sw? +*.pbxuser +*.mode1v3 +obj* +build* +local +aclocal.m4 +autom4te.cache +compile +config.guess +config.log +config.status +config.sub +configure +configure.lineno +depcomp +install-sh +libtool +ltmain.sh +missing +TAGS +tags +ylwrap +xorg-server.pc +stamp-h? +do-not-use-config.h +do-not-use-config.h.in +afb/afbbltC.c +afb/afbbltCI.c +afb/afbbltG.c +afb/afbbltO.c +afb/afbbltX.c +afb/afbseg.c +afb/afbtileC.c +afb/afbtileG.c +cfb/cfb8lineCO.c +cfb/cfb8lineCP.c +cfb/cfb8lineG.c +cfb/cfb8lineX.c +cfb/cfb8segC.c +cfb/cfb8segCS.c +cfb/cfb8segX.c +cfb/cfb8setG.c +cfb/cfbbltC.c +cfb/cfbbltG.c +cfb/cfbbltO.c +cfb/cfbbltX.c +cfb/cfbfillarcC.c +cfb/cfbfillarcG.c +cfb/cfbglrop8.c +cfb/cfbply1rctC.c +cfb/cfbply1rctG.c +cfb/cfbseg.c +cfb/cfbsolidC.c +cfb/cfbsolidG.c +cfb/cfbsolidX.c +cfb/cfbtile32C.c +cfb/cfbtile32G.c +cfb/cfbtileoddC.c +cfb/cfbtileoddG.c +cfb/cfbzerarcC.c +cfb/cfbzerarcG.c +cfb/cfbzerarcX.c +cfb32/cfb8lineCO.c +cfb32/cfb8lineCP.c +cfb32/cfb8lineG.c +cfb32/cfb8lineX.c +cfb32/cfb8segC.c +cfb32/cfb8segCS.c +cfb32/cfb8segX.c +cfb32/cfb8setG.c +cfb32/cfbbltC.c +cfb32/cfbbltG.c +cfb32/cfbbltO.c +cfb32/cfbbltX.c +cfb32/cfbfillarcC.c +cfb32/cfbfillarcG.c +cfb32/cfbply1rctC.c +cfb32/cfbply1rctG.c +cfb32/cfbseg.c +cfb32/cfbsolidC.c +cfb32/cfbsolidG.c +cfb32/cfbsolidX.c +cfb32/cfbtile32C.c +cfb32/cfbtile32G.c +cfb32/cfbtileoddC.c +cfb32/cfbtileoddG.c +cfb32/cfbzerarcC.c +cfb32/cfbzerarcG.c +cfb32/cfbzerarcX.c +doc/Xserver.1x +doc/Xserver.man +hw/dmx/Xdmx +hw/dmx/Xdmx.1x +hw/dmx/config/dmxtodmx +hw/dmx/config/dmxtodmx.1x +hw/dmx/config/parser.c +hw/dmx/config/parser.h +hw/dmx/config/scanner.c +hw/dmx/config/vdltodmx +hw/dmx/config/vdltodmx.1x +hw/dmx/config/xdmxconfig +hw/dmx/config/xdmxconfig.1x +hw/dmx/examples/dmxaddinput +hw/dmx/examples/dmxaddscreen +hw/dmx/examples/dmxreconfig +hw/dmx/examples/dmxresize +hw/dmx/examples/dmxrminput +hw/dmx/examples/dmxrmscreen +hw/dmx/examples/dmxwininfo +hw/dmx/examples/ev +hw/dmx/examples/evi +hw/dmx/examples/res +hw/dmx/examples/xbell +hw/dmx/examples/xdmx +hw/dmx/examples/xinput +hw/dmx/examples/xled +hw/dmx/examples/xtest +hw/kdrive/ati/Xati +hw/kdrive/chips/Xchips +hw/kdrive/ephyr/Xephyr +hw/kdrive/epson/Xepson +hw/kdrive/fake/Xfake +hw/kdrive/fbdev/Xfbdev +hw/kdrive/i810/Xi810 +hw/kdrive/mach64/Xmach64 +hw/kdrive/mga/Xmga +hw/kdrive/neomagic/Xneomagic +hw/kdrive/nvidia/Xnvidia +hw/kdrive/pm2/Xpm2 +hw/kdrive/r128/Xr128 +hw/kdrive/sdl/Xsdl +hw/kdrive/sis300/Xsis +hw/kdrive/smi/Xsmi +hw/kdrive/vesa/Xvesa +hw/kdrive/via/Xvia +hw/vfb/Xvfb +hw/vfb/Xvfb.1x +hw/vfb/Xvfb.man +hw/xfree86/Xorg +hw/xfree86/common/xf86Build.h +hw/xfree86/common/xf86DefModeSet.c +hw/xfree86/doc/man/Xorg.1x +hw/xfree86/doc/man/Xorg.man +hw/xfree86/doc/man/xorg.conf.5x +hw/xfree86/doc/man/xorg.conf.man +hw/xfree86/exa/exa.4 +hw/xfree86/exa/exa.4x +hw/xfree86/exa/exa.man +hw/xfree86/fbdevhw/fbdevhw.4x +hw/xfree86/fbdevhw/fbdevhw.man +hw/xfree86/getconfig/cfg.man +hw/xfree86/getconfig/getconfig.1x +hw/xfree86/getconfig/getconfig.5x +hw/xfree86/getconfig/getconfig.man +hw/xfree86/os-support/xorgos.c +hw/xfree86/osandcommon.c +hw/xfree86/ramdac/xf86BitOrder.c +hw/xfree86/scanpci/xf86PciData.c +hw/xfree86/scanpci/xf86PciIds.h +hw/xfree86/utils/cvt/cvt +hw/xfree86/utils/cvt/cvt.man +hw/xfree86/utils/gtf/gtf +hw/xfree86/utils/gtf/gtf.1x +hw/xfree86/utils/gtf/gtf.man +hw/xfree86/utils/ioport/inb +hw/xfree86/utils/ioport/inl +hw/xfree86/utils/ioport/inw +hw/xfree86/utils/ioport/ioport +hw/xfree86/utils/ioport/outb +hw/xfree86/utils/ioport/outl +hw/xfree86/utils/ioport/outw +hw/xfree86/utils/pcitweak/pcitweak +hw/xfree86/utils/pcitweak/pcitweak.1x +hw/xfree86/utils/pcitweak/pcitweak.man +hw/xfree86/utils/scanpci/scanpci +hw/xfree86/utils/scanpci/scanpci.1x +hw/xfree86/utils/scanpci/scanpci.man +hw/xfree86/utils/xorgcfg/XOrgCfg +hw/xfree86/utils/xorgcfg/xorgcfg +hw/xfree86/utils/xorgcfg/xorgcfg.1x +hw/xfree86/utils/xorgcfg/xorgcfg.man +hw/xfree86/utils/xorgconfig/xorgconfig +hw/xfree86/utils/xorgconfig/xorgconfig.1x +hw/xfree86/utils/xorgconfig/xorgconfig.man +hw/xfree86/xaa/l-xaaBitmap.c +hw/xfree86/xaa/l-xaaStipple.c +hw/xfree86/xaa/l-xaaTEGlyph.c +hw/xfree86/xaa/l3-xaaBitmap.c +hw/xfree86/xaa/l3-xaaStipple.c +hw/xfree86/xaa/lf-xaaBitmap.c +hw/xfree86/xaa/lf-xaaStipple.c +hw/xfree86/xaa/lf-xaaTEGlyph.c +hw/xfree86/xaa/lf3-xaaBitmap.c +hw/xfree86/xaa/lf3-xaaStipple.c +hw/xfree86/xaa/m-xaaBitmap.c +hw/xfree86/xaa/m-xaaStipple.c +hw/xfree86/xaa/m-xaaTEGlyph.c +hw/xfree86/xaa/m3-xaaBitmap.c +hw/xfree86/xaa/m3-xaaStipple.c +hw/xfree86/xaa/mf-xaaBitmap.c +hw/xfree86/xaa/mf-xaaStipple.c +hw/xfree86/xaa/mf-xaaTEGlyph.c +hw/xfree86/xaa/mf3-xaaBitmap.c +hw/xfree86/xaa/mf3-xaaStipple.c +hw/xfree86/xaa/s-xaaDashLine.c +hw/xfree86/xaa/s-xaaLine.c +hw/xfree86/xf1bpp/maskbits.c +hw/xfree86/xf1bpp/mfbbitblt.c +hw/xfree86/xf1bpp/mfbbltC.c +hw/xfree86/xf1bpp/mfbbltCI.c +hw/xfree86/xf1bpp/mfbbltG.c +hw/xfree86/xf1bpp/mfbbltO.c +hw/xfree86/xf1bpp/mfbbltX.c +hw/xfree86/xf1bpp/mfbbres.c +hw/xfree86/xf1bpp/mfbbresd.c +hw/xfree86/xf1bpp/mfbclip.c +hw/xfree86/xf1bpp/mfbcmap.c +hw/xfree86/xf1bpp/mfbfillarc.c +hw/xfree86/xf1bpp/mfbfillrct.c +hw/xfree86/xf1bpp/mfbfillsp.c +hw/xfree86/xf1bpp/mfbfont.c +hw/xfree86/xf1bpp/mfbgc.c +hw/xfree86/xf1bpp/mfbgetsp.c +hw/xfree86/xf1bpp/mfbigbblak.c +hw/xfree86/xf1bpp/mfbigbwht.c +hw/xfree86/xf1bpp/mfbhrzvert.c +hw/xfree86/xf1bpp/mfbimage.c +hw/xfree86/xf1bpp/mfbline.c +hw/xfree86/xf1bpp/mfbmisc.c +hw/xfree86/xf1bpp/mfbpablack.c +hw/xfree86/xf1bpp/mfbpainv.c +hw/xfree86/xf1bpp/mfbpawhite.c +hw/xfree86/xf1bpp/mfbpgbblak.c +hw/xfree86/xf1bpp/mfbpgbinv.c +hw/xfree86/xf1bpp/mfbpgbwht.c +hw/xfree86/xf1bpp/mfbpixmap.c +hw/xfree86/xf1bpp/mfbplyblack.c +hw/xfree86/xf1bpp/mfbplyinv.c +hw/xfree86/xf1bpp/mfbplywhite.c +hw/xfree86/xf1bpp/mfbpntwin.c +hw/xfree86/xf1bpp/mfbpolypnt.c +hw/xfree86/xf1bpp/mfbpushpxl.c +hw/xfree86/xf1bpp/mfbscrclse.c +hw/xfree86/xf1bpp/mfbscrinit.c +hw/xfree86/xf1bpp/mfbseg.c +hw/xfree86/xf1bpp/mfbsetsp.c +hw/xfree86/xf1bpp/mfbteblack.c +hw/xfree86/xf1bpp/mfbtewhite.c +hw/xfree86/xf1bpp/mfbtileC.c +hw/xfree86/xf1bpp/mfbtileG.c +hw/xfree86/xf1bpp/mfbwindow.c +hw/xfree86/xf1bpp/mfbzerarc.c +hw/xfree86/xf4bpp/mfbseg.c +hw/xfree86/xf8_32bpp/cfbgc32.c +hw/xfree86/xf8_32bpp/cfbgc8.c +hw/xfree86/xorg.c +hw/xfree86/xorg.conf.example +hw/xfree86/xorg.conf.example.pre +hw/xnest/Xnest +hw/xnest/Xnest.1x +hw/xnest/Xnest.man +hw/xprint/Xprt +hw/xprint/config/C/print/Xprinters.ghostscript +hw/xprint/doc/Xprt.1x +hw/xprint/doc/Xprt.man +hw/xprint/dpmsstubs-wrapper.c +hw/xprint/miinitext-wrapper.c +include/dix-config.h +include/kdrive-config.h +include/xgl-config.h +include/xkb-config.h +include/xorg-config.h +include/xorg-server.h +include/xwin-config.h +mfb/mfbbltC.c +mfb/mfbbltCI.c +mfb/mfbbltG.c +mfb/mfbbltO.c +mfb/mfbbltX.c +mfb/mfbigbblak.c +mfb/mfbigbwht.c +mfb/mfbpablack.c +mfb/mfbpainv.c +mfb/mfbpawhite.c +mfb/mfbpgbblak.c +mfb/mfbpgbinv.c +mfb/mfbpgbwht.c +mfb/mfbplyblack.c +mfb/mfbplyinv.c +mfb/mfbplywhite.c +mfb/mfbseg.c +mfb/mfbteblack.c +mfb/mfbtewhite.c +mfb/mfbtileC.c +mfb/mfbtileG.c diff --git a/SOURCES/make-git-snapshot.sh b/SOURCES/make-git-snapshot.sh deleted file mode 100755 index 0d9b2ad..0000000 --- a/SOURCES/make-git-snapshot.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -DIRNAME=xorg-server-$( date +%Y%m%d ) - -rm -rf $DIRNAME -git clone git://git.freedesktop.org/git/xorg/xserver $DIRNAME -cd $DIRNAME -if [ -z "$1" ]; then - git log | head -1 -else - git checkout $1 -fi -git log | head -1 | awk '{ print $2 }' > ../commitid -git repack -a -d -cd .. -tar cf - $DIRNAME | xz -c9 > $DIRNAME.tar.xz -rm -rf $DIRNAME diff --git a/SOURCES/xserver-1.12-Xext-fix-selinux-build-failure.patch b/SOURCES/xserver-1.12-Xext-fix-selinux-build-failure.patch deleted file mode 100644 index a48a013..0000000 --- a/SOURCES/xserver-1.12-Xext-fix-selinux-build-failure.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 5d16c39108c72b08478b6bd548494d6c675495ee Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Wed, 4 Jan 2012 09:31:51 +1000 -Subject: [PATCH 6/7] Xext: fix selinux build failure - -The server builds with -Werror=missing-braces, causing - -xselinux_hooks.c: In function 'SELinuxFlaskInit': -xselinux_hooks.c:851:12: error: missing braces around initializer -[-Werror=missing-braces] -xselinux_hooks.c:851:12: error: (near initialization for -'avc_option.') [-Werror=missing-braces] -cc1: some warnings being treated as errors - -Source is libselinux' libselinux-rhat.patch which changes struct selinux_opt -from { int, char * } to { int, union { char*, char** }}. - -Signed-off-by: Peter Hutterer ---- - Xext/xselinux_hooks.c | 2 +- - Xext/xselinux_label.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c -index e9c7e93..0302f2f 100644 ---- a/Xext/xselinux_hooks.c -+++ b/Xext/xselinux_hooks.c -@@ -851,7 +851,7 @@ SELinuxFlaskReset(void) - void - SELinuxFlaskInit(void) - { -- struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, (char *) 0 }; -+ struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, { (char *) 0 } }; - security_context_t ctx; - int ret = TRUE; - -diff --git a/Xext/xselinux_label.c b/Xext/xselinux_label.c -index 2c33d1c..81f2f36 100644 ---- a/Xext/xselinux_label.c -+++ b/Xext/xselinux_label.c -@@ -361,7 +361,7 @@ SELinuxDefaultClientLabel(void) - void - SELinuxLabelInit(void) - { -- struct selinux_opt selabel_option = { SELABEL_OPT_VALIDATE, (char *) 1 }; -+ struct selinux_opt selabel_option = { SELABEL_OPT_VALIDATE, { (char *)1 } }; - - label_hnd = selabel_open(SELABEL_CTX_X, &selabel_option, 1); - if (!label_hnd) --- -1.7.10.1 - diff --git a/SOURCES/xserver-1.12.2-xorg-touch-test.patch b/SOURCES/xserver-1.12.2-xorg-touch-test.patch deleted file mode 100644 index b3daca5..0000000 --- a/SOURCES/xserver-1.12.2-xorg-touch-test.patch +++ /dev/null @@ -1,31 +0,0 @@ -From cb26473121e35fed89050f1514bb37aa48b452ad Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20Hor=C3=A1k?= -Date: Fri, 15 Jun 2012 06:25:58 -0400 -Subject: [PATCH] build the touch test only when building Xorg - -Signed-off-by: Fedora X Ninjas ---- - test/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/test/Makefile.am b/test/Makefile.am -index aa018c9..b323a40 100644 ---- a/test/Makefile.am -+++ b/test/Makefile.am -@@ -1,11 +1,11 @@ - if ENABLE_UNIT_TESTS - SUBDIRS= . --noinst_PROGRAMS = list string touch -+noinst_PROGRAMS = list string - if XORG - # Tests that require at least some DDX functions in order to fully link - # For now, requires xf86 ddx, could be adjusted to use another - SUBDIRS += xi2 --noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging -+noinst_PROGRAMS += xkb input xtest misc fixes xfree86 hashtabletest os signal-logging touch - endif - check_LTLIBRARIES = libxservertest.la - --- -1.7.10.4 - diff --git a/SPECS/xorg-x11-server.spec b/SPECS/xorg-x11-server.spec index 96a00fb..9a9219d 100644 --- a/SPECS/xorg-x11-server.spec +++ b/SPECS/xorg-x11-server.spec @@ -8,19 +8,19 @@ # format, and add a PatchN: line. If you want to push something upstream, # check out the master branch, pull, cherry-pick, and push. -%global gitdate 20131101 -%global stable_abi 0 +#global gitdate 20131118 +%global stable_abi 1 %if !0%{?gitdate} || %{stable_abi} # Released ABI versions. Have to keep these manually in sync with the # source because rpm is a terrible language. %global ansic_major 0 %global ansic_minor 4 -%global videodrv_major 14 -%global videodrv_minor 1 -%global xinput_major 19 -%global xinput_minor 2 -%global extension_major 7 +%global videodrv_major 15 +%global videodrv_minor 0 +%global xinput_major 20 +%global xinput_minor 0 +%global extension_major 8 %global extension_minor 0 %endif @@ -41,8 +41,8 @@ Summary: X.Org X11 X server Name: xorg-x11-server -Version: 1.14.99.901 -Release: 5%{?gitdate:.%{gitdate}}%{dist} +Version: 1.15.0 +Release: 7%{?gitdate:.%{gitdate}}%{?dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -74,54 +74,46 @@ Source31: xserver-sdk-abi-requires.git # maintainer convenience script Source40: driver-abi-rebuild.sh -# sync with tip -Patch0001: 0001-Disable-DRI3-and-sync-fence-FD-functions-if-xshmfenc.patch -Patch0002: 0002-hw-xfree86-Link-libdri3-only-when-DRI3-is-defined.patch -Patch0003: 0003-os-Actually-use-the-computed-clockid-in-GetTimeInMic.patch -Patch0004: 0004-Link-with-xshmfence-reference-miSyncShmScreenInit-in.patch -Patch0005: 0005-Use-GL_LIBS-instead-of-lGL-for-linking.patch - # xwayland. trivial rebase onto master: -# http://cgit.freedesktop.org/~ajax/xserver/log/?h=wl-rebase-for-f20 +# http://cgit.freedesktop.org/~ajax/xserver/log/?h=wayland-f21 Patch0101: 0001-dbe-Cleanup-in-CloseScreen-hook-not-ext-CloseDown.patch Patch0102: 0002-xkb-Add-struct-XkbCompContext.patch Patch0103: 0003-xkb-Split-out-code-to-start-and-finish-xkbcomp.patch Patch0104: 0004-xkb-Add-XkbCompileKeymapFromString.patch -Patch0105: 0005-configure-Track-updated-version-of-libxtrans.patch -Patch0106: 0006-os-Add-a-function-to-create-a-client-for-an-fd.patch -Patch0107: 0007-Export-xf86NewInputDevice-and-xf86AllocateInput.patch -Patch0108: 0008-Export-CompositeRedirectSubwindows-and-CompositeUnRe.patch -Patch0109: 0009-Add-redirect-window-for-input-device-feature.patch -Patch0110: 0010-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch -Patch0111: 0011-Add-xwayland-module.patch -Patch0112: 0012-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch -Patch0113: 0013-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch -Patch0114: 0014-xwayland-handle-global-object-destruction.patch -Patch0115: 0015-xwayland-add-support-for-multiple-outputs.patch -Patch0116: 0016-xwayland-Probe-outputs-on-preinit.patch -Patch0117: 0017-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch -Patch0118: 0018-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch -Patch0119: 0019-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch -Patch0120: 0020-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch -Patch0121: 0021-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch -Patch0122: 0022-xwayland-Remove-Xdnd-selection-watching-code.patch -Patch0123: 0023-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch -Patch0124: 0024-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch -Patch0125: 0025-Fix-fallback-loading-of-the-wayland-driver.patch -Patch0126: 0026-xwayland-Don-t-include-xorg-server.h.patch -Patch0127: 0027-os-Don-t-include-xorg-server.h.patch -Patch0128: 0028-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch -Patch0129: 0029-xwayland-Remove-unused-variables.patch -Patch0130: 0030-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch -Patch0131: 0031-XWayland-Don-t-commit-empty-surfaces.patch -Patch0132: 0032-xwayland-Also-look-for-wlglamor.patch -Patch0133: 0033-xwayland-Add-wlglamor-the-right-way.patch -Patch0134: 0034-xwayland-Don-t-redirect-windows-leave-it-to-the-wm.patch -Patch0135: 0035-Revert-Export-CompositeRedirectSubwindows-and-Compos.patch -Patch0136: 0036-xwayland-Fix-hidden-cursor.patch -Patch0137: 0037-xkb-Repurpose-XkbCopyDeviceKeymap-to-apply-a-given-k.patch -Patch0138: 0038-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch -Patch0139: 0039-xwayland-Handle-keymap-changes.patch +Patch0105: 0005-os-Add-a-function-to-create-a-client-for-an-fd.patch +Patch0106: 0006-Export-xf86NewInputDevice-and-xf86AllocateInput.patch +Patch0107: 0007-Add-redirect-window-for-input-device-feature.patch +Patch0108: 0008-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch +Patch0109: 0009-Add-xwayland-module.patch +Patch0110: 0010-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch +Patch0111: 0011-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch +Patch0112: 0012-xwayland-handle-global-object-destruction.patch +Patch0113: 0013-xwayland-add-support-for-multiple-outputs.patch +Patch0114: 0014-xwayland-Probe-outputs-on-preinit.patch +Patch0115: 0015-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch +Patch0116: 0016-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch +Patch0117: 0017-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch +Patch0118: 0018-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch +Patch0119: 0019-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch +Patch0120: 0020-xwayland-Remove-Xdnd-selection-watching-code.patch +Patch0121: 0021-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch +Patch0122: 0022-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch +Patch0123: 0023-Fix-fallback-loading-of-the-wayland-driver.patch +Patch0124: 0024-xwayland-Don-t-include-xorg-server.h.patch +Patch0125: 0025-os-Don-t-include-xorg-server.h.patch +Patch0126: 0026-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch +Patch0127: 0027-xwayland-Remove-unused-variables.patch +Patch0128: 0028-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch +Patch0129: 0029-XWayland-Don-t-commit-empty-surfaces.patch +Patch0130: 0030-xwayland-Also-look-for-wlglamor.patch +Patch0131: 0031-xwayland-Add-wlglamor-the-right-way.patch +Patch0132: 0032-xwayland-Don-t-redirect-windows-leave-it-to-the-wm.patch +Patch0133: 0033-xwayland-Fix-hidden-cursor.patch +Patch0134: 0034-xkb-Repurpose-XkbCopyDeviceKeymap-to-apply-a-given-k.patch +Patch0135: 0035-xkb-Factor-out-a-function-to-copy-a-keymap-s-control.patch +Patch0136: 0036-xwayland-Handle-keymap-changes.patch +Patch0137: 0037-xwayland-Fix-re-wrapping-of-RealizeWindow.patch +Patch0138: 0038-xwayland-Adapt-to-1.15-Damage-API.patch # restore ABI Patch0200: 0001-mustard-Restore-XkbCopyDeviceKeymap.patch @@ -133,23 +125,11 @@ Patch5002: xserver-1.4.99-ssh-isnt-local.patch Patch6030: xserver-1.6.99-right-of.patch #Patch6044: xserver-1.6.99-hush-prerelease-warning.patch -# Fix libselinux-triggered build error -# RedHat/Fedora-specific patch -Patch7013: xserver-1.12-Xext-fix-selinux-build-failure.patch - -# needed when building without xorg (aka s390x) -Patch7017: xserver-1.12.2-xorg-touch-test.patch - Patch7025: 0001-Always-install-vbe-and-int10-sdk-headers.patch # do not upstream - do not even use here yet Patch7027: xserver-autobind-hotplug.patch -Patch7052: 0001-xf86-return-NULL-for-compat-output-if-no-outputs.patch - -# mustard: make the default queue length bigger to calm abrt down -Patch7064: 0001-mieq-Bump-default-queue-size-to-512.patch - # Fix multiple monitors in reverse optimus configurations Patch8040: 0001-rrcrtc-brackets-are-hard-lets-go-shopping.patch Patch8041: 0001-pixmap-fix-reverse-optimus-support-with-multiple-hea.patch @@ -157,17 +137,15 @@ Patch8041: 0001-pixmap-fix-reverse-optimus-support-with-multiple-hea.patch # extra magic to be upstreamed Patch9001: 0001-xfree86-Only-look-at-wayland-capable-drivers-when-wa.patch Patch9002: 0001-xwayland-Just-send-the-bounding-box-of-the-damage.patch +Patch9003: 0001-link-with-z-now.patch -# submitted: http://lists.x.org/archives/xorg-devel/2013-November/038768.html -Patch9003: 0001-present-Don-t-try-to-initialize-when-building-withou.patch +# submitted: http://lists.x.org/archives/xorg-devel/2013-October/037996.html +Patch9100: exa-only-draw-valid-trapezoids.patch +Patch9101: 0001-configure-Don-t-add-GLX_SYS_LIBS-to-Xorg-s-SYS_LIBS.patch +Patch9102: 0001-dix-fix-button-state-check-before-changing-a-button-.patch +Patch9103: 0001-randr-attempt-to-fix-primary-on-slave-output.patch -# also submitted -Patch9011: 0001-xinerama-Export-the-screen-region.patch -Patch9012: 0002-dix-Add-PostDispatchCallback.patch -Patch9013: 0003-damageext-Xineramify-v6.patch -Patch9014: 0004-composite-Fix-COW-creation-for-Xinerama.patch -Patch9015: 0005-fixes-Fix-PanoramiXSetPictureClipRegion-for-window-p.patch -Patch9016: 0006-fixes-Fix-PanoramiXSetWindowShapeRegion.patch +Patch9200: 0040-xfree86-Keep-a-non-seat0-X-server-from-touching-VTs-.patch %global moduledir %{_libdir}/xorg/modules %global drimoduledir %{_libdir}/dri @@ -185,7 +163,7 @@ Patch9016: 0006-fixes-Fix-PanoramiXSetWindowShapeRegion.patch %global enable_xorg --disable-xorg %endif -%ifnarch %{ix86} x86_64 %{arm} +%ifnarch %{ix86} x86_64 %global no_int10 --disable-vbe --disable-int10-module %endif @@ -197,10 +175,10 @@ BuildRequires: git-core BuildRequires: automake autoconf libtool pkgconfig BuildRequires: xorg-x11-util-macros >= 1.17 -BuildRequires: xorg-x11-proto-devel >= 7.7-6 +BuildRequires: xorg-x11-proto-devel >= 7.7-8 BuildRequires: xorg-x11-font-utils >= 7.2-11 -BuildRequires: xorg-x11-xtrans-devel >= 1.2.7 +BuildRequires: xorg-x11-xtrans-devel >= 1.3.2 BuildRequires: libXfont-devel libXau-devel libxkbfile-devel libXres-devel BuildRequires: libfontenc-devel libXtst-devel libXdmcp-devel BuildRequires: libX11-devel libXext-devel @@ -212,6 +190,7 @@ BuildRequires: libXi-devel libXpm-devel libXaw-devel libXfixes-devel %if !0%{?rhel} BuildRequires: wayland-devel pkgconfig(wayland-client) +BuildRequires: pkgconfig(xshmfence) >= 1.1 %endif BuildRequires: libXv-devel BuildRequires: pixman-devel >= 0.30.0 @@ -224,15 +203,13 @@ BuildRequires: audit-libs-devel libselinux-devel >= 2.0.86-1 BuildRequires: libudev-devel %if !0%{?rhel} # libunwind is Exclusive for the following arches -%ifarch %{arm} hppa ia64 mips ppc ppc64 %{ix86} x86_64 +%ifarch aarch64 %{arm} hppa ia64 mips ppc ppc64 %{ix86} x86_64 BuildRequires: libunwind-devel %endif %endif BuildRequires: pkgconfig(xcb-aux) pkgconfig(xcb-image) pkgconfig(xcb-icccm) BuildRequires: pkgconfig(xcb-keysyms) -# blocking on https://bugzilla.redhat.com/show_bug.cgi?id=1027380 -#BuildRequires: pkgconfig(xshmfence) # All server subpackages have a virtual provide for the name of the server # they deliver. The Xorg one is versioned, the others are intentionally @@ -303,7 +280,7 @@ Requires: xorg-x11-server-common >= %{version}-%{release} Provides: Xnest %description Xnest -Xnest is an X server, which has been implemented as an ordinary +Xnest is an X server which has been implemented as an ordinary X application. It runs in a window just like other X applications, but it is an X server itself in which you can run other software. It is a very useful tool for developers who wish to test their @@ -350,7 +327,7 @@ Requires: xorg-x11-server-common >= %{version}-%{release} Provides: Xephyr %description Xephyr -Xephyr is an X server, which has been implemented as an ordinary +Xephyr is an X server which has been implemented as an ordinary X application. It runs in a window just like other X applications, but it is an X server itself in which you can run other software. It is a very useful tool for developers who wish to test their @@ -439,7 +416,7 @@ test `getminor extension` == %{extension_minor} %global default_font_path "catalogue:/etc/X11/fontpath.d,built-ins" %if %{with_hw_servers} -%global dri_flags --with-dri-driver-path=%{drimoduledir} --enable-dri2 +%global dri_flags --with-dri-driver-path=%{drimoduledir} --enable-dri2 %{?!rhel:--enable-dri3} %else %global dri_flags --disable-dri %endif @@ -457,6 +434,7 @@ sed -i 's/WAYLAND_SCANNER_RULES.*//g' configure.ac # --with-pie ? autoreconf -f -v --install || exit 1 # export CFLAGS="${RPM_OPT_FLAGS}" +# XXX without dtrace %configure --enable-maintainer-mode %{xservers} \ --disable-static \ @@ -467,9 +445,9 @@ autoreconf -f -v --install || exit 1 --with-builderstring="Build ID: %{name} %{version}-%{release}" \ --with-os-name="$(hostname -s) $(uname -r)" \ --with-xkb-output=%{_localstatedir}/lib/xkb \ - --with-dtrace \ + --without-dtrace \ --disable-linux-acpi --disable-linux-apm \ - --enable-xselinux --enable-record \ + --enable-xselinux --enable-record --enable-present \ --enable-config-udev \ --disable-unit-tests \ %{?wayland} \ @@ -543,7 +521,7 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete rm -rf $RPM_BUILD_ROOT%{_defaultdocdir}/xorg-server %endif # wtf -%ifnarch %{ix86} x86_64 %{arm} +%ifnarch %{ix86} x86_64 rm -f $RPM_BUILD_ROOT%{_libdir}/xorg/modules/lib{int10,vbe}.so %endif } @@ -591,7 +569,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/xorg/modules/libshadowfb.so %{_libdir}/xorg/modules/libvgahw.so %{_libdir}/xorg/modules/libwfb.so -%ifarch %{ix86} x86_64 %{arm} +%ifarch %{ix86} x86_64 %{_libdir}/xorg/modules/libint10.so %{_libdir}/xorg/modules/libvbe.so %endif @@ -648,9 +626,9 @@ rm -rf $RPM_BUILD_ROOT %if %{with_hw_servers} %files devel -%defattr(-,root,root,-) %doc COPYING -%{_docdir}/xorg-server +%defattr(-,root,root,-) +#{_docdir}/xorg-server %{_bindir}/xserver-sdk-abi-requires %{_libdir}/pkgconfig/xorg-server.pc %dir %{_includedir}/xorg @@ -664,6 +642,44 @@ rm -rf $RPM_BUILD_ROOT %{xserver_source_dir} %changelog +* Thu Feb 27 2014 Jérôme Glisse 1.15.0-7 +- Do not open tty on non seat0 (#1053063) + +* Tue Feb 25 2014 Adam Jackson 1.15.0-6 +- Fix dist tag +- Link Xorg with -z now + +* Sat Feb 22 2014 Dave Airlie 1.15.0-5 +- fix slave outputs being set as primary (#1067786) + +* Thu Feb 13 2014 Peter Hutterer 1.15.0-4 +- Fix button state check (#1061541) + +* Wed Feb 12 2014 Adam Jackson 1.15.0-3.1 +- Mass rebuild + +* Wed Feb 05 2014 Adam Jackson 1.15.0-3 +- Be sure to not link Xorg against libGL, just libglx. + +* Tue Jan 14 2014 Adam Jackson 1.15.0-2 +- exa-only-draw-valid-trapezoids.patch: Fix crash in exa. + +* Mon Jan 13 2014 Adam Jackson 1.15.0-1 +- xserver 1.15.0 + +* Tue Dec 17 2013 Adam Jackson 1.14.99.904-1 +- 1.15RC4 +- Re-disable int10 on arm + +* Mon Dec 2 2013 Peter Robinson 1.14.99.902-2 +- Add aarch64 to platforms that have libunwind + +* Wed Nov 20 2013 Adam Jackson 1.14.99.902-1 +- 1.15RC2 + +* Mon Nov 18 2013 Adam Jackson 1.14.99.901-6 +- Prefer fbdev to vesa, fixes fallback path on UEFI + * Fri Nov 08 2013 Adam Jackson 1.14.99.901-5 - Restore XkbCopyDeviceKeymap for (older) tigervnc