xwayland support

This commit is contained in:
Adam Jackson 2013-09-23 11:10:24 -07:00
parent 05e96c7953
commit 15e2ab311c
31 changed files with 9744 additions and 3 deletions

View File

@ -0,0 +1,129 @@
From 33cd04abaa651e90537cc15a1c743f35f8eebce6 Mon Sep 17 00:00:00 2001
From: Robert Bragg <robert@linux.intel.com>
Date: Thu, 12 Jan 2012 18:16:08 +0000
Subject: [PATCH 01/30] 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
of pScreen->DestroyWindow hooks remains valid until all windows have
been destroyed. Previously it was possible for DbeResetProc to be called
before the root window had been destroyed and the unwrapping of
pScreen->DestroyWindow would clobber the chain of callbacks.
This is needed for xwayland to be able to know when the root window is
destroyed so it can unredirect root sub-windows.
---
dbe/dbe.c | 43 ++++++++++++++++++++++---------------------
dbe/dbestruct.h | 1 +
2 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 9039d80..379feb1 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -292,8 +292,8 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
/* malloc/realloc a new array and initialize all elements to 0. */
pDbeWindowPriv->IDs = (XID *) realloc(pIDs,
- (pDbeWindowPriv->
- maxAvailableIDs +
+ (pDbeWindowPriv->maxAvailableIDs
+ +
DBE_INCR_MAX_IDS) *
sizeof(XID));
if (!pDbeWindowPriv->IDs) {
@@ -468,7 +468,7 @@ ProcDbeSwapBuffers(ClientPtr client)
return BadAlloc;
/* Get to the swap info appended to the end of the request. */
- dbeSwapInfo = (xDbeSwapInfo *) &stuff[1];
+ dbeSwapInfo = (xDbeSwapInfo *) & stuff[1];
/* Allocate array to record swap information. */
swapInfo = (DbeSwapInfoPtr) malloc(nStuff * sizeof(DbeSwapInfoRec));
@@ -1298,7 +1298,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
/******************************************************************************
*
- * DBE DIX Procedure: DbeResetProc
+ * DBE DIX Procedure: DbeCloseScreen
*
* Description:
*
@@ -1307,28 +1307,26 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
* other tasks related to shutting down the extension.
*
*****************************************************************************/
-static void
-DbeResetProc(ExtensionEntry * extEntry)
+static Bool
+DbeCloseScreen(ScreenPtr pScreen)
{
- int i;
- ScreenPtr pScreen;
- DbeScreenPrivPtr pDbeScreenPriv;
+ DbeScreenPrivPtr pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
- for (i = 0; i < screenInfo.numScreens; i++) {
- pScreen = screenInfo.screens[i];
- pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
+ if (pDbeScreenPriv) {
+ /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
+ pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
- if (pDbeScreenPriv) {
- /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
- pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
+ /* Unwrap CloseScreen, which was wrapped in DbeExtensionInit(). */
+ pScreen->CloseScreen = pDbeScreenPriv->CloseScreen;
- if (pDbeScreenPriv->ResetProc)
- (*pDbeScreenPriv->ResetProc) (pScreen);
+ if (pDbeScreenPriv->ResetProc)
+ (*pDbeScreenPriv->ResetProc) (pScreen);
- free(pDbeScreenPriv);
- }
+ free(pDbeScreenPriv);
}
-} /* DbeResetProc() */
+
+ return (*pScreen->CloseScreen) (pScreen);
+} /* DbeCloseScreen */
/******************************************************************************
*
@@ -1498,6 +1496,9 @@ DbeExtensionInit(void)
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DbeDestroyWindow;
+
+ pDbeScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = DbeCloseScreen;
}
else {
/* DDX initialization failed. Stub the screen. */
@@ -1525,7 +1526,7 @@ DbeExtensionInit(void)
/* Now add the extension. */
extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch,
- DbeResetProc, StandardMinorOpcode);
+ NULL, StandardMinorOpcode);
dbeErrorBase = extEntry->errorBase;
SetResourceTypeErrorValue(dbeWindowPrivResType,
diff --git a/dbe/dbestruct.h b/dbe/dbestruct.h
index f9d938a..4b88d25 100644
--- a/dbe/dbestruct.h
+++ b/dbe/dbestruct.h
@@ -162,6 +162,7 @@ typedef struct _DbeScreenPrivRec {
*/
PositionWindowProcPtr PositionWindow;
DestroyWindowProcPtr DestroyWindow;
+ CloseScreenProcPtr CloseScreen;
/* Per-screen DIX routines */
Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
--
1.8.3.1

View File

@ -0,0 +1,190 @@
From 0620164c0ef62eea27f429f7a670c9bf9df2c23c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Tue, 9 Apr 2013 16:54:55 -0400
Subject: [PATCH 02/30] xkb: Add struct XkbCompContext
This commit adds a struct that contains most of the context for starting,
running and cleaning up after xkbcomp.
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
---
xkb/ddxLoad.c | 76 +++++++++++++++++++++++++++++------------------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index d462957..5da3a35 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -90,14 +90,21 @@ OutputDirectory(char *outdir, size_t size)
}
}
+typedef struct XkbCompContext {
+ char keymap[PATH_MAX];
+ FILE *out;
+ char *buf;
+ char tmpname[PATH_MAX];
+ const char *xkmfile;
+} XkbCompContextRec, *XkbCompContextPtr;
+
static Bool
XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
XkbComponentNamesPtr names,
unsigned want,
- unsigned need, char *nameRtrn, int nameRtrnLen)
+ unsigned need, XkbCompContextPtr ctx)
{
- FILE *out;
- char *buf = NULL, keymap[PATH_MAX], xkm_output_dir[PATH_MAX];
+ char xkm_output_dir[PATH_MAX];
const char *emptystring = "";
char *xkbbasedirflag = NULL;
@@ -105,22 +112,19 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
const char *xkbbindirsep = emptystring;
#ifdef WIN32
- /* WIN32 has no popen. The input must be stored in a file which is
- used as input for xkbcomp. xkbcomp does not read from stdin. */
- char tmpname[PATH_MAX];
- const char *xkmfile = tmpname;
+ ctx->xkmfile = ctx->tmpname;
#else
- const char *xkmfile = "-";
+ ctx->xkmfile = "-";
#endif
- snprintf(keymap, sizeof(keymap), "server-%s", display);
+ snprintf(ctx->keymap, sizeof(ctx->keymap), "server-%s", display);
OutputDirectory(xkm_output_dir, sizeof(xkm_output_dir));
#ifdef WIN32
- strcpy(tmpname, Win32TempDir());
- strcat(tmpname, "\\xkb_XXXXXX");
- (void) mktemp(tmpname);
+ strcpy(ctx->tmpname, Win32TempDir());
+ strcat(ctx->tmpname, "\\xkb_XXXXXX");
+ (void) mktemp(ctx->tmpname);
#endif
if (XkbBaseDirectory != NULL) {
@@ -139,73 +143,69 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
}
}
- if (asprintf(&buf,
+ if (asprintf(&ctx->buf,
"\"%s%sxkbcomp\" -w %d %s -xkm \"%s\" "
"-em1 %s -emp %s -eml %s \"%s%s.xkm\"",
xkbbindir, xkbbindirsep,
((xkbDebugFlags < 2) ? 1 :
((xkbDebugFlags > 10) ? 10 : (int) xkbDebugFlags)),
- xkbbasedirflag ? xkbbasedirflag : "", xkmfile,
+ xkbbasedirflag ? xkbbasedirflag : "", ctx->xkmfile,
PRE_ERROR_MSG, ERROR_PREFIX, POST_ERROR_MSG1,
- xkm_output_dir, keymap) == -1)
- buf = NULL;
+ xkm_output_dir, ctx->keymap) == -1)
+ ctx->buf = NULL;
free(xkbbasedirflag);
- if (!buf) {
+ if (!ctx->buf) {
LogMessage(X_ERROR,
"XKB: Could not invoke xkbcomp: not enough memory\n");
return FALSE;
}
#ifndef WIN32
- out = Popen(buf, "w");
+ ctx->out = Popen(ctx->buf, "w");
#else
- out = fopen(tmpname, "w");
+ ctx->out = fopen(ctx->tmpname, "w");
#endif
- if (out != NULL) {
+ if (ctx->out != NULL) {
#ifdef DEBUG
if (xkbDebugFlags) {
ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
XkbWriteXKBKeymapForNames(stderr, names, xkb, want, need);
}
#endif
- XkbWriteXKBKeymapForNames(out, names, xkb, want, need);
+ XkbWriteXKBKeymapForNames(ctx->out, names, xkb, want, need);
#ifndef WIN32
- if (Pclose(out) == 0)
+ if (Pclose(ctx->out) == 0)
#else
- if (fclose(out) == 0 && System(buf) >= 0)
+ if (fclose(ctx->out) == 0 && System(ctx->buf) >= 0)
#endif
{
if (xkbDebugFlags)
- DebugF("[xkb] xkb executes: %s\n", buf);
- if (nameRtrn) {
- strlcpy(nameRtrn, keymap, nameRtrnLen);
- }
- free(buf);
+ DebugF("[xkb] xkb executes: %s\n", ctx->buf);
+ free(ctx->buf);
#ifdef WIN32
- unlink(tmpname);
+ unlink(ctx->tmpname);
#endif
return TRUE;
}
else
- LogMessage(X_ERROR, "Error compiling keymap (%s)\n", keymap);
+ LogMessage(X_ERROR, "Error compiling keymap (%s)\n", ctx->keymap);
#ifdef WIN32
/* remove the temporary file */
- unlink(tmpname);
+ unlink(ctx->tmpname);
#endif
}
else {
#ifndef WIN32
LogMessage(X_ERROR, "XKB: Could not invoke xkbcomp\n");
#else
- LogMessage(X_ERROR, "Could not open file %s\n", tmpname);
+ LogMessage(X_ERROR, "Could not open file %s\n", ctx->tmpname);
#endif
}
- if (nameRtrn)
- nameRtrn[0] = '\0';
- free(buf);
+ ctx->keymap[0] = '\0';
+ free(ctx->buf);
return FALSE;
}
@@ -256,6 +256,7 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
FILE *file;
char fileName[PATH_MAX];
unsigned missing;
+ XkbCompContextRec ctx;
*xkbRtrn = NULL;
if ((keybd == NULL) || (keybd->key == NULL) ||
@@ -270,12 +271,11 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
keybd->name ? keybd->name : "(unnamed keyboard)");
return 0;
}
- else if (!XkbDDXCompileKeymapByNames(xkb, names, want, need,
- nameRtrn, nameRtrnLen)) {
+ else if (!XkbDDXCompileKeymapByNames(xkb, names, want, need, &ctx)) {
LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
return 0;
}
- file = XkbDDXOpenConfigFile(nameRtrn, fileName, PATH_MAX);
+ file = XkbDDXOpenConfigFile(ctx.keymap, fileName, PATH_MAX);
if (file == NULL) {
LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
fileName);
--
1.8.3.1

View File

@ -0,0 +1,81 @@
From 0a6e38c446258060bd49536f0ddad165c6fd367e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Tue, 9 Apr 2013 17:11:03 -0400
Subject: [PATCH 03/30] 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.
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
---
xkb/ddxLoad.c | 39 ++++++++++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 11 deletions(-)
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 5da3a35..001ff46 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -99,10 +99,7 @@ typedef struct XkbCompContext {
} XkbCompContextRec, *XkbCompContextPtr;
static Bool
-XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
- XkbComponentNamesPtr names,
- unsigned want,
- unsigned need, XkbCompContextPtr ctx)
+StartXkbComp(XkbCompContextPtr ctx)
{
char xkm_output_dir[PATH_MAX];
@@ -168,14 +165,15 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
ctx->out = fopen(ctx->tmpname, "w");
#endif
+ return ctx->out != NULL;
+}
+
+static Bool
+FinishXkbComp(XkbCompContextPtr ctx)
+{
+ if (!ctx->buf)
+ return FALSE;
if (ctx->out != NULL) {
-#ifdef DEBUG
- if (xkbDebugFlags) {
- ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
- XkbWriteXKBKeymapForNames(stderr, names, xkb, want, need);
- }
-#endif
- XkbWriteXKBKeymapForNames(ctx->out, names, xkb, want, need);
#ifndef WIN32
if (Pclose(ctx->out) == 0)
#else
@@ -209,6 +207,25 @@ XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
return FALSE;
}
+static Bool
+XkbDDXCompileKeymapByNames(XkbDescPtr xkb,
+ XkbComponentNamesPtr names,
+ unsigned want,
+ unsigned need, XkbCompContextPtr ctx)
+{
+ if (StartXkbComp(ctx)) {
+#ifdef DEBUG
+ if (xkbDebugFlags) {
+ ErrorF("[xkb] XkbDDXCompileKeymapByNames compiling keymap:\n");
+ XkbWriteXKBKeymapForNames(stderr, names, xkb, want, need);
+ }
+#endif
+ XkbWriteXKBKeymapForNames(ctx->out, names, xkb, want, need);
+ }
+
+ return FinishXkbComp(ctx);
+}
+
static FILE *
XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
{
--
1.8.3.1

View File

@ -0,0 +1,319 @@
From 927cff328c2b920a04c78c4ee23bd6908ad46ea5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Tue, 9 Apr 2013 17:45:08 -0400
Subject: [PATCH 04/30] 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,
InitKeyboardDeviceStructFromString(), which inits a keyboard device with
a keymap specified as a string instead of a rmlvo set.
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
---
include/input.h | 6 +++
include/xkbsrv.h | 4 ++
xkb/ddxLoad.c | 129 ++++++++++++++++++++++++++++++++++++++++++-------------
xkb/xkbInit.c | 44 +++++++++++++++----
4 files changed, 144 insertions(+), 39 deletions(-)
diff --git a/include/input.h b/include/input.h
index 7eed60b..9e98e1c 100644
--- a/include/input.h
+++ b/include/input.h
@@ -385,6 +385,12 @@ extern _X_EXPORT Bool InitKeyboardDeviceStruct(DeviceIntPtr /*device */ ,
KbdCtrlProcPtr /*controlProc */
);
+extern _X_EXPORT Bool InitKeyboardDeviceStructFromString(DeviceIntPtr dev,
+ const char *keymap,
+ int keymap_length,
+ BellProcPtr bell_func,
+ KbdCtrlProcPtr ctrl_func);
+
extern int ApplyPointerMapping(DeviceIntPtr /* pDev */ ,
CARD8 * /* map */ ,
int /* len */ ,
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index 45e2e8c..38cdd7b 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -858,4 +858,8 @@ extern _X_EXPORT XkbDescPtr XkbCompileKeymap(DeviceIntPtr /* dev */ ,
XkbRMLVOSet * /* rmlvo */
);
+extern _X_EXPORT XkbDescPtr XkbCompileKeymapFromString(DeviceIntPtr dev,
+ const char *keymap,
+ int keymap_length);
+
#endif /* _XKBSRV_H_ */
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 001ff46..7a7cf1e 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -262,6 +262,35 @@ XkbDDXOpenConfigFile(char *mapName, char *fileNameRtrn, int fileNameRtrnLen)
return file;
}
+static unsigned
+LoadXKM(unsigned want, unsigned need, XkbCompContextPtr ctx, XkbDescPtr *xkbRtrn)
+{
+ FILE *file;
+ char fileName[PATH_MAX];
+ unsigned missing;
+
+ file = XkbDDXOpenConfigFile(ctx->keymap, fileName, PATH_MAX);
+ if (file == NULL) {
+ LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
+ fileName);
+ return 0;
+ }
+ missing = XkmReadFile(file, need, want, xkbRtrn);
+ if (*xkbRtrn == NULL) {
+ LogMessage(X_ERROR, "Error loading keymap %s\n", fileName);
+ fclose(file);
+ (void) unlink(fileName);
+ return 0;
+ }
+ else {
+ DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName,
+ (*xkbRtrn)->defined);
+ }
+ fclose(file);
+ (void) unlink(fileName);
+ return (need | want) & (~missing);
+}
+
unsigned
XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
XkbComponentNamesPtr names,
@@ -270,9 +299,6 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
XkbDescPtr *xkbRtrn, char *nameRtrn, int nameRtrnLen)
{
XkbDescPtr xkb;
- FILE *file;
- char fileName[PATH_MAX];
- unsigned missing;
XkbCompContextRec ctx;
*xkbRtrn = NULL;
@@ -292,26 +318,30 @@ XkbDDXLoadKeymapByNames(DeviceIntPtr keybd,
LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
return 0;
}
- file = XkbDDXOpenConfigFile(ctx.keymap, fileName, PATH_MAX);
- if (file == NULL) {
- LogMessage(X_ERROR, "Couldn't open compiled keymap file %s\n",
- fileName);
- return 0;
- }
- missing = XkmReadFile(file, need, want, xkbRtrn);
- if (*xkbRtrn == NULL) {
- LogMessage(X_ERROR, "Error loading keymap %s\n", fileName);
- fclose(file);
- (void) unlink(fileName);
+
+ return LoadXKM(want, need, &ctx, xkbRtrn);
+}
+
+static unsigned
+XkbDDXLoadKeymapFromString(DeviceIntPtr keybd,
+ const char *keymap, int keymap_length,
+ unsigned want,
+ unsigned need,
+ XkbDescPtr *xkbRtrn)
+{
+ XkbCompContextRec ctx;
+
+ *xkbRtrn = NULL;
+
+ if (StartXkbComp(&ctx))
+ fwrite(keymap, keymap_length, 1, ctx.out);
+
+ if (!FinishXkbComp(&ctx)) {
+ LogMessage(X_ERROR, "XKB: Couldn't compile keymap\n");
return 0;
}
- else {
- DebugF("Loaded XKB keymap %s, defined=0x%x\n", fileName,
- (*xkbRtrn)->defined);
- }
- fclose(file);
- (void) unlink(fileName);
- return (need | want) & (~missing);
+
+ return LoadXKM(want, need, &ctx, xkbRtrn);
}
Bool
@@ -407,6 +437,29 @@ XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet * rmlvo, int need)
return xkb;
}
+static XkbDescPtr
+KeymapOrDefaults(DeviceIntPtr dev, XkbDescPtr xkb)
+{
+ XkbRMLVOSet dflts;
+
+ if (xkb)
+ return xkb;
+
+ /* we didn't get what we really needed. And that will likely leave
+ * us with a keyboard that doesn't work. Use the defaults instead */
+ LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default "
+ "keymap instead.\n");
+
+ XkbGetRulesDflts(&dflts);
+
+ xkb = XkbCompileKeymapForDevice(dev, &dflts, 0);
+
+ XkbFreeRMLVOSet(&dflts, FALSE);
+
+ return xkb;
+}
+
+
XkbDescPtr
XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
{
@@ -424,20 +477,34 @@ XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet * rmlvo)
xkb = XkbCompileKeymapForDevice(dev, rmlvo, need);
- if (!xkb) {
- XkbRMLVOSet dflts;
+ return KeymapOrDefaults(dev, xkb);
+}
- /* we didn't get what we really needed. And that will likely leave
- * us with a keyboard that doesn't work. Use the defaults instead */
- LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default "
- "keymap instead.\n");
+XkbDescPtr
+XkbCompileKeymapFromString(DeviceIntPtr dev,
+ const char *keymap, int keymap_length)
+{
+ XkbDescPtr xkb;
+ unsigned int need, provided;
- XkbGetRulesDflts(&dflts);
+ if (!dev || !keymap) {
+ LogMessage(X_ERROR, "XKB: No device or keymap specified\n");
+ return NULL;
+ }
- xkb = XkbCompileKeymapForDevice(dev, &dflts, 0);
+ /* These are the components we really really need */
+ need = XkmSymbolsMask | XkmCompatMapMask | XkmTypesMask |
+ XkmKeyNamesMask | XkmVirtualModsMask;
- XkbFreeRMLVOSet(&dflts, FALSE);
+ provided =
+ XkbDDXLoadKeymapFromString(dev, keymap, keymap_length,
+ XkmAllIndicesMask, need, &xkb);
+ if ((need & provided) != need) {
+ if (xkb) {
+ XkbFreeKeyboard(xkb, 0, TRUE);
+ xkb = NULL;
+ }
}
- return xkb;
+ return KeymapOrDefaults(dev, xkb);
}
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index ed01114..7d06fa7 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -475,9 +475,10 @@ XkbInitControls(DeviceIntPtr pXDev, XkbSrvInfoPtr xkbi)
return Success;
}
-_X_EXPORT Bool
-InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
- BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+static Bool
+InitKeyboardDeviceStructInternal(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
+ const char *keymap, int keymap_length,
+ BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
{
int i;
unsigned int check;
@@ -491,7 +492,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
if (dev->key || dev->kbdfeed)
return FALSE;
- if (!rmlvo) {
+ if (!rmlvo && !keymap) {
rmlvo = &rmlvo_dflts;
XkbGetRulesDflts(rmlvo);
}
@@ -519,19 +520,26 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
}
dev->key->xkbInfo = xkbi;
- if (xkb_cached_map && !XkbCompareUsedRMLVO(rmlvo)) {
+ if (xkb_cached_map && (keymap || (rmlvo && !XkbCompareUsedRMLVO(rmlvo)))) {
XkbFreeKeyboard(xkb_cached_map, XkbAllComponentsMask, TRUE);
xkb_cached_map = NULL;
}
if (xkb_cached_map)
LogMessageVerb(X_INFO, 4, "XKB: Reusing cached keymap\n");
- else {
+ else if (rmlvo) {
xkb_cached_map = XkbCompileKeymap(dev, rmlvo);
if (!xkb_cached_map) {
ErrorF("XKB: Failed to compile keymap\n");
goto unwind_info;
}
+ } else {
+ xkb_cached_map = XkbCompileKeymapFromString(dev,
+ keymap, keymap_length);
+ if (!xkb_cached_map) {
+ ErrorF("XKB: Failed to compile keymap from string\n");
+ goto unwind_info;
+ }
}
xkb = XkbAllocKeyboard();
@@ -596,8 +604,10 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
dev->kbdfeed->CtrlProc(dev, &dev->kbdfeed->ctrl);
- XkbSetRulesDflts(rmlvo);
- XkbSetRulesUsed(rmlvo);
+ if (rmlvo) {
+ XkbSetRulesDflts(rmlvo);
+ XkbSetRulesUsed(rmlvo);
+ }
XkbFreeRMLVOSet(&rmlvo_dflts, FALSE);
return TRUE;
@@ -616,6 +626,24 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
return FALSE;
}
+_X_EXPORT Bool
+InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
+ BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+{
+ return InitKeyboardDeviceStructInternal(dev, rmlvo,
+ NULL, 0, bell_func, ctrl_func);
+}
+
+_X_EXPORT Bool
+InitKeyboardDeviceStructFromString(DeviceIntPtr dev,
+ const char *keymap, int keymap_length,
+ BellProcPtr bell_func, KbdCtrlProcPtr ctrl_func)
+{
+ return InitKeyboardDeviceStructInternal(dev, NULL,
+ keymap, keymap_length,
+ bell_func, ctrl_func);
+}
+
/***====================================================================***/
/*
--
1.8.3.1

View File

@ -0,0 +1,35 @@
From 3e23ef6269cfbcd2a3fb7e56bfed347ad6c1f3b9 Mon Sep 17 00:00:00 2001
From: Tiago Vignatti <tiago.vignatti@intel.com>
Date: Thu, 22 Nov 2012 20:22:56 -0200
Subject: [PATCH 05/30] 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 <robert@linux.intel.com>
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 <tiago.vignatti@intel.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index ac24cb6..737025c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -802,7 +802,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"
dnl List of libraries that require a specific version
LIBAPPLEWM="applewm >= 1.4"
--
1.8.3.1

View File

@ -0,0 +1,137 @@
From e6d9ba7d490a08ffc553192e229d2488d7abbc9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Tue, 21 Jun 2011 21:28:31 -0400
Subject: [PATCH 06/30] 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 c7108a5..32e5b96 100644
--- a/include/os.h
+++ b/include/os.h
@@ -160,8 +160,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 6cd8bcf..499a4dd 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -64,6 +64,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
+#include <xorg-server.h>
#ifdef WIN32
#include <X11/Xwinsock.h>
#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 60e828e..e56e4a4 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -780,7 +780,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

View File

@ -0,0 +1,44 @@
From a097d8905dcfeb799b003faf6aeea3826b5bb35b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Thu, 21 Jul 2011 09:55:46 -0700
Subject: [PATCH 07/30] 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

View File

@ -0,0 +1,65 @@
From e56c222b8e6e7f48e928770b1bd4dff20ad627a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@redhat.com>
Date: Fri, 18 Sep 2009 22:02:43 -0400
Subject: [PATCH 08/30] 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 cc69c68..edee499 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

View File

@ -0,0 +1,89 @@
From d2fcacc2ce6da5348a1ac519cac845270a658669 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@redhat.com>
Date: Fri, 18 Sep 2009 22:09:03 -0400
Subject: [PATCH 09/30] 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 067e6b3..6dd182a 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -2029,6 +2029,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 c079f97..a0c7060 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2820,7 +2820,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 2da72c1..2ae6f5b 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

View File

@ -0,0 +1,144 @@
From 5c3fe524e192c878278c650c337b52044daf144a Mon Sep 17 00:00:00 2001
From: Tiago Vignatti <tiago.vignatti@intel.com>
Date: Wed, 21 Aug 2013 21:23:09 -0700
Subject: [PATCH 10/30] 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 40963c3..8bf0392 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -122,8 +122,9 @@ typedef struct _DRI2Screen {
DRI2ScheduleSwapProcPtr ScheduleSwap;
DRI2GetMSCProcPtr GetMSC;
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
- DRI2AuthMagic2ProcPtr AuthMagic;
DRI2AuthMagicProcPtr LegacyAuthMagic;
+ DRI2AuthMagic2ProcPtr LegacyAuthMagic2;
+ DRI2AuthMagic3ProcPtr AuthMagic;
DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify;
DRI2SwapLimitValidateProcPtr SwapLimitValidate;
DRI2GetParamProcPtr GetParam;
@@ -1369,7 +1370,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;
}
@@ -1474,8 +1475,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;
@@ -1514,7 +1518,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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
From 69def850b10580bcb3b67b5bfcb1d8bc0cb188f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Wed, 21 Aug 2013 23:02:58 -0700
Subject: [PATCH 12/30] 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 629d892..5ac97cc 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -557,11 +557,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 f1dbfc5..14b013f 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

View File

@ -0,0 +1,31 @@
From ef9f67ee52b6a49e3a4901704e51f2f6cde9698a Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagn@redhat.com>
Date: Wed, 21 Aug 2013 09:53:25 +0200
Subject: [PATCH 13/30] 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

View File

@ -0,0 +1,234 @@
From 5ec1f1446acf1bb7ed04c2844ac62325fc125b91 Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagn@redhat.com>
Date: Wed, 21 Aug 2013 09:53:26 +0200
Subject: [PATCH 14/30] 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

View File

@ -0,0 +1,215 @@
From cf0293df1032b3646ed77b5c1981d6346577f678 Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagn@redhat.com>
Date: Thu, 22 Aug 2013 16:23:48 +0200
Subject: [PATCH 15/30] 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 <cursorstr.h>
#include <xf86Crtc.h>
#include <mipointrst.h>
+#include <randrstr.h>
#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

View File

@ -0,0 +1,34 @@
From 20a6f974f413757da649dcc984fd6c759096dd54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Sun, 1 Sep 2013 23:14:43 +0200
Subject: [PATCH 16/30] 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 <jadahl@gmail.com>
---
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

View File

@ -0,0 +1,73 @@
From 2ef0364d48a6be3ef69328045ab85d3167840402 Mon Sep 17 00:00:00 2001
From: Daniel Stone <daniel@fooishbar.org>
Date: Fri, 16 Aug 2013 13:21:21 +0100
Subject: [PATCH 17/30] XFree86: Load wlshm driver as fallback for Wayland
Since fbdev or vesa are unlikely to be too useful there ...
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
---
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 55f9883..434249b 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -518,7 +518,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;
@@ -531,9 +535,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

View File

@ -0,0 +1,37 @@
From 007b3b673d7bef6138b3e8a6c2342c1f569c8de8 Mon Sep 17 00:00:00 2001
From: Daniel Stone <daniel@fooishbar.org>
Date: Wed, 7 Nov 2012 17:22:42 +1100
Subject: [PATCH 18/30] 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 <daniel@fooishbar.org>
---
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

View File

@ -0,0 +1,45 @@
From ee97e732bcb1b2eafdaa6339a177ec2bbb6bd574 Mon Sep 17 00:00:00 2001
From: Daniel Stone <daniel@fooishbar.org>
Date: Tue, 16 Oct 2012 17:14:01 +1100
Subject: [PATCH 19/30] xwayland: Introduce an auto mode for --enable-wayland
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
---
configure.ac | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index c65e1a7..4637c41 100644
--- a/configure.ac
+++ b/configure.ac
@@ -635,7 +635,7 @@ AC_ARG_ENABLE(windowswm, AS_HELP_STRING([--enable-windowswm], [Build XWin w
AC_ARG_ENABLE(libdrm, AS_HELP_STRING([--enable-libdrm], [Build Xorg with libdrm support (default: enabled)]), [DRM=$enableval],[DRM=yes])
AC_ARG_ENABLE(clientids, AS_HELP_STRING([--disable-clientids], [Build Xorg with client ID tracking (default: enabled)]), [CLIENTIDS=$enableval], [CLIENTIDS=yes])
AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess], [Build Xorg with pciaccess library (default: enabled)]), [PCI=$enableval], [PCI=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.3.1

View File

@ -0,0 +1,46 @@
From ee550427e188cad38ed5c77899372bf3cc782ece Mon Sep 17 00:00:00 2001
From: Daniel Stone <daniel@fooishbar.org>
Date: Wed, 7 Nov 2012 17:15:13 +1100
Subject: [PATCH 20/30] 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 <daniel@fooishbar.org>
---
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

View File

@ -0,0 +1,97 @@
From b5d5a1cdb7454f6ed33ba68c79da79504846e568 Mon Sep 17 00:00:00 2001
From: Daniel Stone <daniel@fooishbar.org>
Date: Fri, 16 Aug 2013 13:51:08 +0100
Subject: [PATCH 21/30] 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 <daniel@fooishbar.org>
---
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

View File

@ -0,0 +1,70 @@
From 555c7ef6ca7846f68ec8d2ac680e50558b043f39 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Wed, 11 Sep 2013 11:15:18 -0700
Subject: [PATCH 22/30] 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

View File

@ -0,0 +1,34 @@
From 1173a0b6937bda0e684d75111242c2f513b3d072 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 13 Sep 2013 17:17:16 -0400
Subject: [PATCH 23/30] 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 5ac97cc..a5a7daf 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -568,6 +568,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

View File

@ -0,0 +1,27 @@
From 6c2b9647f370b0381756b2b2438c4d69d3327c92 Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagn@redhat.com>
Date: Fri, 13 Sep 2013 15:52:29 +0200
Subject: [PATCH 24/30] 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 a71b25d..b77e72c 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -139,4 +139,7 @@
/* Have X server platform bus support */
#undef XSERVER_PLATFORM_BUS
+/* Building Xorg server. */
+#undef XORG_WAYLAND
+
#endif /* _XORG_CONFIG_H_ */
--
1.8.3.1

View File

@ -0,0 +1,41 @@
From ba1428dcb8cdeb22f93c1e3739a7bb8384ec705a Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagn@redhat.com>
Date: Fri, 13 Sep 2013 15:52:30 +0200
Subject: [PATCH 25/30] 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 434249b..ffbea8f 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -520,7 +520,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

View File

@ -0,0 +1,64 @@
From cf5cf51ba3c19b2a736aa30eaf6f43c6f0b971f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Fri, 13 Sep 2013 14:52:13 -0700
Subject: [PATCH 26/30] 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 <sys/mman.h>
#include <wayland-client.h>
-#include <xorg-server.h>
#include <cursorstr.h>
#include <xf86Crtc.h>
#include <mipointrst.h>
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 <sys/mman.h>
#include <wayland-client.h>
-#include <xorg-server.h>
#include <cursorstr.h>
#include <xf86Crtc.h>
#include <mipointrst.h>
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 <wayland-client.h>
#include <X11/extensions/compositeproto.h>
-#include <xorg-server.h>
#include <xf86Crtc.h>
#include <selection.h>
#include <compositeext.h>
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 <wayland-util.h>
#include <wayland-client.h>
-#include <xorg-server.h>
#include <extinit.h>
#include <xf86Xinput.h>
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From 9e3f213572e83f38cc86dc4b68c5ccb547a6b0fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Fri, 13 Sep 2013 14:53:16 -0700
Subject: [PATCH 27/30] 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 499a4dd..65ca01b 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -64,7 +64,6 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include <xorg-server.h>
#ifdef WIN32
#include <X11/Xwinsock.h>
#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

View File

@ -0,0 +1,30 @@
From cc086626e1e02a0639f6107ae10fdbffc9640551 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Fri, 13 Sep 2013 15:16:31 -0700
Subject: [PATCH 28/30] 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 32e5b96..5d845b0 100644
--- a/include/os.h
+++ b/include/os.h
@@ -160,10 +160,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);
--
1.8.3.1

View File

@ -0,0 +1,26 @@
From ad867da0bccaf1b1d0c726e0e44721ea9cb299bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Mon, 16 Sep 2013 11:51:57 -0700
Subject: [PATCH 29/30] 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.3.1

View File

@ -0,0 +1,85 @@
From 696902dbd5a87b09e2972066d9d87928fdc2f61d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Mon, 16 Sep 2013 12:05:19 -0700
Subject: [PATCH 30/30] 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

View File

@ -42,7 +42,7 @@
Summary: X.Org X11 X server
Name: xorg-x11-server
Version: 1.14.3
Release: 1%{?gitdate:.%{gitdate}}%{dist}
Release: 2%{?gitdate:.%{gitdate}}%{dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X
@ -120,6 +120,39 @@ Patch8041: 0001-pixmap-fix-reverse-optimus-support-with-multiple-hea.patch
Patch7071: 0001-os-use-libunwind-to-generate-backtraces.patch
%endif
# xwayland. trivial backport from master to 1.14:
# http://cgit.freedesktop.org/~ajax/xserver/log/?h=xwayland-1.14
Patch9001: 0001-dbe-Cleanup-in-CloseScreen-hook-not-ext-CloseDown.patch
Patch9002: 0002-xkb-Add-struct-XkbCompContext.patch
Patch9003: 0003-xkb-Split-out-code-to-start-and-finish-xkbcomp.patch
Patch9004: 0004-xkb-Add-XkbCompileKeymapFromString.patch
Patch9005: 0005-configure-Track-updated-version-of-libxtrans.patch
Patch9006: 0006-os-Add-a-function-to-create-a-client-for-an-fd.patch
Patch9007: 0007-Export-xf86NewInputDevice-and-xf86AllocateInput.patch
Patch9008: 0008-Export-CompositeRedirectSubwindows-and-CompositeUnRe.patch
Patch9009: 0009-Add-redirect-window-for-input-device-feature.patch
Patch9010: 0010-dri2-Introduce-a-third-version-of-the-AuthMagic-func.patch
Patch9011: 0011-Add-xwayland-module.patch
Patch9012: 0012-xwayland-Add-a-HW_WAYLAND-flag-to-let-drivers-explic.patch
Patch9013: 0013-xwayland-shm-don-t-create-alpha-buffers-if-the-windo.patch
Patch9014: 0014-xwayland-handle-global-object-destruction.patch
Patch9015: 0015-xwayland-add-support-for-multiple-outputs.patch
Patch9016: 0016-xwayland-Probe-outputs-on-preinit.patch
Patch9017: 0017-XFree86-Load-wlshm-driver-as-fallback-for-Wayland.patch
Patch9018: 0018-XWayland-Don-t-send-out-of-bounds-damage-co-ordinate.patch
Patch9019: 0019-xwayland-Introduce-an-auto-mode-for-enable-wayland.patch
Patch9020: 0020-XWayland-Don-t-hardcode-DRM-libs-and-lwayland-client.patch
Patch9021: 0021-XWayland-Support-16bpp-X-surfaces-in-DRM-SHM.patch
Patch9022: 0022-xwayland-Remove-Xdnd-selection-watching-code.patch
Patch9023: 0023-xf86Init-trim-out-non-wayland-capable-servers-from-d.patch
Patch9024: 0024-Add-XORG_WAYLAND-symbol-to-xorg-config.h.in.patch
Patch9025: 0025-Fix-fallback-loading-of-the-wayland-driver.patch
Patch9026: 0026-xwayland-Don-t-include-xorg-server.h.patch
Patch9027: 0027-os-Don-t-include-xorg-server.h.patch
Patch9028: 0028-os-Also-define-ListenOnOpenFD-and-AddClientOnOpenFD-.patch
Patch9029: 0029-xwayland-Remove-unused-variables.patch
Patch9030: 0030-xwayland-Use-a-per-screen-private-key-for-cursor-pri.patch
%global moduledir %{_libdir}/xorg/modules
%global drimoduledir %{_libdir}/dri
%global sdkdir %{_includedir}/xorg
@ -161,9 +194,8 @@ BuildRequires: libXinerama-devel libXi-devel
BuildRequires: libXt-devel libdmx-devel libXmu-devel libXrender-devel
BuildRequires: libXi-devel libXpm-devel libXaw-devel libXfixes-devel
# Broken, this is global, should be Xephyr-only
BuildRequires: libXv-devel
BuildRequires: wayland-devel pkgconfig(wayland-client)
BuildRequires: pixman-devel >= 0.21.8
BuildRequires: libpciaccess-devel >= 0.12.901-1 openssl-devel byacc flex
BuildRequires: mesa-libGL-devel >= 7.6-0.6
@ -213,6 +245,10 @@ Provides: xserver-abi(videodrv-%{git_videodrv_major}) = %{git_videodrv_minor}
Provides: xserver-abi(xinput-%{git_xinput_major}) = %{git_xinput_minor}
Provides: xserver-abi(extension-%{git_extension_major}) = %{git_extension_minor}
%endif
# this is expected to be temporary, since eventually it will be implied by
# the server version. the serial number here is just paranoia in case we
# need to do something lockstep between now and upstream merge
Provides: xserver-abi(xwayland) = 1
# Dropped from F17, use evdev
Obsoletes: xorg-x11-drv-acecad <= 1.5.0-2.fc16
@ -408,6 +444,7 @@ autoreconf -f -v --install || exit 1
--with-dtrace \
--enable-xselinux --enable-record \
--enable-config-udev \
--enable-wayland \
%{dri_flags} %{?bodhi_flags} \
${CONFIGURE}
@ -512,6 +549,7 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_libdir}/xorg/modules/drivers
%dir %{_libdir}/xorg/modules/extensions
%{_libdir}/xorg/modules/extensions/libglx.so
%{_libdir}/xorg/modules/extensions/libxwayland.so
%dir %{_libdir}/xorg/modules/input
%{_libdir}/xorg/modules/libfbdevhw.so
%{_libdir}/xorg/modules/libexa.so
@ -593,6 +631,9 @@ rm -rf $RPM_BUILD_ROOT
%{xserver_source_dir}
%changelog
* Mon Sep 23 2013 Adam Jackson <ajax@redhat.com> 1.14.3-2
- xwayland support
* Mon Sep 16 2013 Peter Hutterer <peter.hutterer@redhat.com> 1.14.3-1
- xserver 1.14.3