aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-11-13 08:07:38 +0100
committermarha <marha@users.sourceforge.net>2013-11-13 08:07:38 +0100
commit8fbb807d1029b012d2f45cb0f3ea0c6a6ebded6d (patch)
tree064121d82e7edce83e6d4809d6e4a92b1a3e84d6 /xorg-server
parent4bdf8409331f44417c3622bc5ec0e42c0e68afb6 (diff)
downloadvcxsrv-8fbb807d1029b012d2f45cb0f3ea0c6a6ebded6d.tar.gz
vcxsrv-8fbb807d1029b012d2f45cb0f3ea0c6a6ebded6d.tar.bz2
vcxsrv-8fbb807d1029b012d2f45cb0f3ea0c6a6ebded6d.zip
mesa xserver pixman git update 9 nov 2013
xserver commit 4a251f5883b042cd902c192060a0be2b11148f2b pixman commit 8487dfbcd056eff066939dc253fcf361b391592a mesa commit e0489531455623aa21aa565b2c890362d8437f23
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/Xext/shm.c51
-rw-r--r--xorg-server/Xext/shmint.h22
-rw-r--r--xorg-server/configure.ac118
-rw-r--r--xorg-server/hw/xfree86/common/xf86Bus.c5
-rw-r--r--xorg-server/hw/xfree86/x86emu/decode.c10
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/regs.h9
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h12
-rw-r--r--xorg-server/hw/xquartz/X11Controller.m2
-rw-r--r--xorg-server/hw/xquartz/bundle/Info.plist.cpp4
-rw-r--r--xorg-server/include/Makefile.am1
-rw-r--r--xorg-server/include/busfault.h48
-rw-r--r--xorg-server/include/dix-config.h.in14
-rw-r--r--xorg-server/include/dixstruct.h4
-rw-r--r--xorg-server/include/os.h2
-rw-r--r--xorg-server/include/protocol-versions.h4
-rw-r--r--xorg-server/include/xorg-config.h.in3
-rw-r--r--xorg-server/include/xorg-server.h.in3
-rw-r--r--xorg-server/mi/miinitext.c2
-rw-r--r--xorg-server/os/Makefile.am5
-rw-r--r--xorg-server/os/WaitFor.c5
-rw-r--r--xorg-server/os/busfault.c150
-rw-r--r--xorg-server/os/io.c4
-rw-r--r--xorg-server/os/osinit.c5
-rw-r--r--xorg-server/present/present.c16
-rw-r--r--xorg-server/record/record.c4
25 files changed, 455 insertions, 48 deletions
diff --git a/xorg-server/Xext/shm.c b/xorg-server/Xext/shm.c
index 1a70260fb..46ce521af 100644
--- a/xorg-server/Xext/shm.c
+++ b/xorg-server/Xext/shm.c
@@ -384,7 +384,7 @@ ProcShmAttach(ClientPtr client)
return BadValue;
}
for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next) {
- if (!shmdesc->is_fd && shmdesc->shmid == stuff->shmid)
+ if (!SHMDESC_IS_FD(shmdesc) && shmdesc->shmid == stuff->shmid)
break;
}
if (shmdesc) {
@@ -396,7 +396,9 @@ ProcShmAttach(ClientPtr client)
shmdesc = malloc(sizeof(ShmDescRec));
if (!shmdesc)
return BadAlloc;
+#ifdef SHM_FD_PASSING
shmdesc->is_fd = FALSE;
+#endif
shmdesc->addr = shmat(stuff->shmid, 0,
stuff->readOnly ? SHM_RDONLY : 0);
if ((shmdesc->addr == ((char *) -1)) || SHMSTAT(stuff->shmid, &buf)) {
@@ -435,9 +437,13 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */
if (--shmdesc->refcnt)
return TRUE;
- if (shmdesc->is_fd)
+#if SHM_FD_PASSING
+ if (shmdesc->is_fd) {
+ if (shmdesc->busfault)
+ busfault_unregister(shmdesc->busfault);
munmap(shmdesc->addr, shmdesc->size);
- else
+ } else
+#endif
shmdt(shmdesc->addr);
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next);
*prev = shmdesc->next;
@@ -1094,6 +1100,20 @@ ProcShmCreatePixmap(ClientPtr client)
return BadAlloc;
}
+#ifdef SHM_FD_PASSING
+
+static void
+ShmBusfaultNotify(void *context)
+{
+ ShmDescPtr shmdesc = context;
+
+ ErrorF("shared memory 0x%x truncated by client\n",
+ (unsigned int) shmdesc->resource);
+ busfault_unregister(shmdesc->busfault);
+ shmdesc->busfault = NULL;
+ FreeResource (shmdesc->resource, RT_NONE);
+}
+
static int
ProcShmAttachFd(ClientPtr client)
{
@@ -1138,6 +1158,15 @@ ProcShmAttachFd(ClientPtr client)
shmdesc->refcnt = 1;
shmdesc->writable = !stuff->readOnly;
shmdesc->size = statb.st_size;
+ shmdesc->resource = stuff->shmseg;
+
+ shmdesc->busfault = busfault_register_mmap(shmdesc->addr, shmdesc->size, ShmBusfaultNotify, shmdesc);
+ if (!shmdesc->busfault) {
+ munmap(shmdesc->addr, shmdesc->size);
+ free(shmdesc);
+ return BadAlloc;
+ }
+
shmdesc->next = Shmsegs;
Shmsegs = shmdesc;
@@ -1193,6 +1222,15 @@ ProcShmCreateSegment(ClientPtr client)
shmdesc->refcnt = 1;
shmdesc->writable = !stuff->readOnly;
shmdesc->size = stuff->size;
+
+ shmdesc->busfault = busfault_register_mmap(shmdesc->addr, shmdesc->size, ShmBusfaultNotify, shmdesc);
+ if (!shmdesc->busfault) {
+ close(fd);
+ munmap(shmdesc->addr, shmdesc->size);
+ free(shmdesc);
+ return BadAlloc;
+ }
+
shmdesc->next = Shmsegs;
Shmsegs = shmdesc;
@@ -1209,6 +1247,7 @@ ProcShmCreateSegment(ClientPtr client)
WriteToClient(client, sizeof (xShmCreateSegmentReply), &rep);
return Success;
}
+#endif /* SHM_FD_PASSING */
static int
ProcShmDispatch(ClientPtr client)
@@ -1239,10 +1278,12 @@ ProcShmDispatch(ClientPtr client)
return ProcPanoramiXShmCreatePixmap(client);
#endif
return ProcShmCreatePixmap(client);
+#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
return ProcShmAttachFd(client);
case X_ShmCreateSegment:
return ProcShmCreateSegment(client);
+#endif
default:
return BadRequest;
}
@@ -1343,6 +1384,7 @@ SProcShmCreatePixmap(ClientPtr client)
return ProcShmCreatePixmap(client);
}
+#ifdef SHM_FD_PASSING
static int
SProcShmAttachFd(ClientPtr client)
{
@@ -1364,6 +1406,7 @@ SProcShmCreateSegment(ClientPtr client)
swapl(&stuff->size);
return ProcShmCreateSegment(client);
}
+#endif /* SHM_FD_PASSING */
static int
SProcShmDispatch(ClientPtr client)
@@ -1382,10 +1425,12 @@ SProcShmDispatch(ClientPtr client)
return SProcShmGetImage(client);
case X_ShmCreatePixmap:
return SProcShmCreatePixmap(client);
+#ifdef SHM_FD_PASSING
case X_ShmAttachFd:
return SProcShmAttachFd(client);
case X_ShmCreateSegment:
return SProcShmCreateSegment(client);
+#endif
default:
return BadRequest;
}
diff --git a/xorg-server/Xext/shmint.h b/xorg-server/Xext/shmint.h
index db35fbbbe..21d6cc4ee 100644
--- a/xorg-server/Xext/shmint.h
+++ b/xorg-server/Xext/shmint.h
@@ -56,16 +56,36 @@ typedef struct _ShmFuncs {
void (*PutImage) (XSHM_PUT_IMAGE_ARGS);
} ShmFuncs, *ShmFuncsPtr;
+#include <protocol-versions.h>
+
+#if SERVER_SHM_MAJOR_VERSION == 1 && SERVER_SHM_MINOR_VERSION >= 2
+#define SHM_FD_PASSING 1
+#endif
+
+#ifdef SHM_FD_PASSING
+#include "busfault.h"
+#endif
+
typedef struct _ShmDesc {
struct _ShmDesc *next;
int shmid;
int refcnt;
char *addr;
- Bool is_fd;
Bool writable;
unsigned long size;
+#ifdef SHM_FD_PASSING
+ Bool is_fd;
+ struct busfault *busfault;
+ XID resource;
+#endif
} ShmDescRec, *ShmDescPtr;
+#ifdef SHM_FD_PASSING
+#define SHMDESC_IS_FD(shmdesc) ((shmdesc)->is_fd)
+#else
+#define SHMDESC_IS_FD(shmdesc) (0)
+#endif
+
extern _X_EXPORT void
ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs);
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 6925df814..eb90b1ae0 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -31,6 +31,7 @@ RELEASE_DATE="2013-10-31"
RELEASE_NAME="Bom Retiro"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AC_USE_SYSTEM_EXTENSIONS
# Require xorg-macros minimum of 1.14 for XORG_COMPILER_BRAND in XORG_DEFAULT_OPTIONS
m4_ifndef([XORG_MACROS_VERSION],
@@ -798,7 +799,7 @@ dnl Required modules
XPROTO="xproto >= 7.0.22"
RANDRPROTO="randrproto >= 1.4.0"
RENDERPROTO="renderproto >= 0.11"
-XEXTPROTO="xextproto >= 7.1.99"
+XEXTPROTO="xextproto >= 7.2.99.901"
INPUTPROTO="inputproto >= 2.3"
KBPROTO="kbproto >= 1.0.3"
FONTSPROTO="fontsproto"
@@ -806,7 +807,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.3.2"
PRESENTPROTO="presentproto >= 1.0"
dnl List of libraries that require a specific version
@@ -814,7 +815,7 @@ LIBAPPLEWM="applewm >= 1.4"
LIBDMX="dmx >= 1.0.99.1"
LIBDRI="dri >= 7.8.0"
LIBDRM="libdrm >= 2.3.0"
-LIBGL="gl >= 9.2.0"
+LIBGL="gl >= 7.1.0"
LIBXEXT="xext >= 1.0.99.4"
LIBXFONT="xfont >= 1.4.2"
LIBXI="xi >= 1.2.99.1"
@@ -1069,34 +1070,6 @@ fi
AC_MSG_RESULT([$CLIENTIDS])
AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes])
-if test "x$GLX" = xyes; then
- PKG_CHECK_MODULES([XLIB], [x11])
- PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
- AC_SUBST(XLIB_CFLAGS)
- AC_DEFINE(GLXEXT, 1, [Build GLX extension])
- GLX_LIBS='$(top_builddir)/glx/libglx.la'
- GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS"
-else
- GLX=no
-fi
-AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
-
-if test "x$GLX" = xno; then
- AIGLX=no
-fi
-
-if test "x$AIGLX" = xyes -a \( "x$DRI2" = xyes \); then
- AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
-fi
-AM_CONDITIONAL(AIGLX_DRI_LOADER, { test "x$DRI2" = xyes; } && test "x$AIGLX" = xyes)
-
-if test "x$GLX_USE_TLS" = xyes ; then
- GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
- GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
-fi
-AC_SUBST([GLX_DEFINES])
-AC_SUBST([GLX_SYS_LIBS])
-
AM_CONDITIONAL(DRI, test "x$DRI" = xyes)
if test "x$DRI" = xyes; then
AC_DEFINE(XF86DRI, 1, [Build DRI extension])
@@ -1113,11 +1086,47 @@ case "$DRI2,$HAVE_DRI2PROTO" in
yes,yes | auto,yes)
AC_DEFINE(DRI2, 1, [Build DRI2 extension])
DRI2=yes
+ LIBGL="gl >= 9.2.0"
SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI2PROTO"
;;
esac
AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
+AC_ARG_ENABLE(xtrans-send-fds, AS_HELP_STRING([--disable-xtrans-send-fds], [Use Xtrans support for fd passing (default: auto)]), [XTRANS_SEND_FDS=$enableval], [XTRANS_SEND_FDS=auto])
+
+case "x$XTRANS_SEND_FDS" in
+xauto)
+ case "$host_os" in
+ linux*|solaris*)
+ XTRANS_SEND_FDS=yes
+ ;;
+ *)
+ XTRANS_SEND_FDS=no
+ ;;
+ esac
+esac
+
+case "x$XTRANS_SEND_FDS" in
+xyes)
+ AC_DEFINE(XTRANS_SEND_FDS, 1, [Enable xtrans fd passing support])
+ ;;
+esac
+
+case "$DRI3,$XTRANS_SEND_FDS" in
+ yes,yes | auto,yes)
+ ;;
+ yes,no)
+ AC_MSG_ERROR([DRI3 requested, but xtrans fd passing support not found.])
+ DRI3=no
+ ;;
+ no,*)
+ ;;
+ *)
+ AC_MSG_NOTICE([DRI3 disabled because xtrans fd passing support not found.])
+ DRI3=no
+ ;;
+esac
+
PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO,
[HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no])
@@ -1136,6 +1145,25 @@ case "$DRI3,$HAVE_DRI3PROTO" in
;;
esac
+AC_CHECK_FUNCS([sigaction])
+
+BUSFAULT=no
+
+case x"$ac_cv_func_sigaction" in
+ xyes)
+ AC_DEFINE(HAVE_SIGACTION, 1, [Have sigaction function])
+ BUSFAULT=yes
+ ;;
+esac
+
+case x"$BUSFAULT" in
+ xyes)
+ AC_DEFINE(BUSFAULT, 1, [Include busfault OS API])
+ ;;
+esac
+
+AM_CONDITIONAL(BUSFAULT, test x"$BUSFAULT" = xyes)
+
PKG_CHECK_MODULES([XSHMFENCE], $XSHMFENCE,
[HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])
@@ -1204,6 +1232,34 @@ if test "x$DRI2" = xyes; then
fi
AM_CONDITIONAL(DRI2_AIGLX, test "x$DRI2_AIGLX" = xyes)
+if test "x$GLX" = xyes; then
+ PKG_CHECK_MODULES([XLIB], [x11])
+ PKG_CHECK_MODULES([GL], $GLPROTO $LIBGL)
+ AC_SUBST(XLIB_CFLAGS)
+ AC_DEFINE(GLXEXT, 1, [Build GLX extension])
+ GLX_LIBS='$(top_builddir)/glx/libglx.la'
+ GLX_SYS_LIBS="$GLX_SYS_LIBS $GL_LIBS"
+else
+ GLX=no
+fi
+AM_CONDITIONAL(GLX, test "x$GLX" = xyes)
+
+if test "x$GLX" = xno; then
+ AIGLX=no
+fi
+
+if test "x$AIGLX" = xyes -a \( "x$DRI2" = xyes \); then
+ AC_DEFINE(AIGLX, 1, [Build AIGLX loader])
+fi
+AM_CONDITIONAL(AIGLX_DRI_LOADER, { test "x$DRI2" = xyes; } && test "x$AIGLX" = xyes)
+
+if test "x$GLX_USE_TLS" = xyes ; then
+ GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS"
+ GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread"
+fi
+AC_SUBST([GLX_DEFINES])
+AC_SUBST([GLX_SYS_LIBS])
+
AM_CONDITIONAL(PRESENT, [test "x$PRESENT" = xyes])
if test "x$PRESENT" = xyes; then
AC_DEFINE(PRESENT, 1, [Support Present extension])
diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c
index 329d0b3d5..d463e9196 100644
--- a/xorg-server/hw/xfree86/common/xf86Bus.c
+++ b/xorg-server/hw/xfree86/common/xf86Bus.c
@@ -266,9 +266,12 @@ xf86IsEntityPrimary(int entityIndex)
{
EntityPtr pEnt = xf86Entities[entityIndex];
+#ifdef XSERVER_LIBPCIACCESS
if (primaryBus.type == BUS_PLATFORM && pEnt->bus.type == BUS_PCI)
return MATCH_PCI_DEVICES(pEnt->bus.id.pci, primaryBus.id.plat->pdev);
- else if (primaryBus.type != pEnt->bus.type)
+#endif
+
+ if (primaryBus.type != pEnt->bus.type)
return FALSE;
switch (pEnt->bus.type) {
diff --git a/xorg-server/hw/xfree86/x86emu/decode.c b/xorg-server/hw/xfree86/x86emu/decode.c
index 12f8fb84b..08a07b1bb 100644
--- a/xorg-server/hw/xfree86/x86emu/decode.c
+++ b/xorg-server/hw/xfree86/x86emu/decode.c
@@ -38,6 +38,16 @@
****************************************************************************/
#include <stdlib.h>
+
+#if defined(__sun) && defined(CS) /* avoid conflicts with Solaris sys/regset.h */
+# undef CS
+# undef DS
+# undef SS
+# undef ES
+# undef FS
+# undef GS
+#endif
+
#include "x86emu/x86emui.h"
/*----------------------------- Implementation ----------------------------*/
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/regs.h b/xorg-server/hw/xfree86/x86emu/x86emu/regs.h
index 6bd061166..2ecafa047 100644
--- a/xorg-server/hw/xfree86/x86emu/x86emu/regs.h
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/regs.h
@@ -112,6 +112,15 @@ struct i386_special_regs {
* CS, DS, ES, SS.
*/
+#if defined(__sun) && defined(CS) /* avoid conflicts with Solaris sys/regset.h */
+# undef CS
+# undef DS
+# undef SS
+# undef ES
+# undef FS
+# undef GS
+#endif
+
struct i386_segment_regs {
u16 CS, DS, SS, ES, FS, GS;
};
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h b/xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h
index f11dc102f..5e20d9705 100644
--- a/xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/x86emui.h
@@ -73,7 +73,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
+/* avoid conflicts with Solaris sys/regset.h */
+# if defined(__sun) && defined(CS)
+# undef CS
+# undef DS
+# undef SS
+# undef ES
+# undef FS
+# undef GS
+# endif
+#endif /* NO_SYS_HEADERS */
+
/*--------------------------- Inline Functions ----------------------------*/
#ifdef __cplusplus
diff --git a/xorg-server/hw/xquartz/X11Controller.m b/xorg-server/hw/xquartz/X11Controller.m
index 737db42e7..3d094bfc7 100644
--- a/xorg-server/hw/xquartz/X11Controller.m
+++ b/xorg-server/hw/xquartz/X11Controller.m
@@ -936,7 +936,7 @@ extern char *bundle_id_prefix;
- (void) applicationWillTerminate:(NSNotification *)aNotification
{
- unsigned remain;
+ int remain;
[X11App prefs_synchronize];
/* shutdown the X server, it will exit () for us. */
diff --git a/xorg-server/hw/xquartz/bundle/Info.plist.cpp b/xorg-server/hw/xquartz/bundle/Info.plist.cpp
index b99e417aa..5fbb0ad55 100644
--- a/xorg-server/hw/xquartz/bundle/Info.plist.cpp
+++ b/xorg-server/hw/xquartz/bundle/Info.plist.cpp
@@ -39,9 +39,9 @@
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>
- <string>© 2003-2012 Apple Inc.
+ <string>© 2003-2013 Apple Inc.
© 2003 XFree86 Project, Inc.
-© 2003-2012 X.org Foundation, Inc.
+© 2003-2013 X.org Foundation, Inc.
</string>
<key>NSMainNibFile</key>
<string>main</string>
diff --git a/xorg-server/include/Makefile.am b/xorg-server/include/Makefile.am
index 5cdea1d15..13d91e22c 100644
--- a/xorg-server/include/Makefile.am
+++ b/xorg-server/include/Makefile.am
@@ -2,6 +2,7 @@ if XORG
sdk_HEADERS = \
XIstubs.h \
Xprintf.h \
+ busfault.h \
callback.h \
client.h \
closestr.h \
diff --git a/xorg-server/include/busfault.h b/xorg-server/include/busfault.h
new file mode 100644
index 000000000..3b668818d
--- /dev/null
+++ b/xorg-server/include/busfault.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright © 2013 Keith Packard
+ *
+ * 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 _BUSFAULT_H_
+#define _BUSFAULT_H_
+
+#include <dix-config.h>
+
+#ifdef BUSFAULT
+
+#include <sys/types.h>
+
+typedef void (*busfault_notify_ptr) (void *context);
+
+struct busfault *
+busfault_register_mmap(void *addr, size_t size, busfault_notify_ptr notify, void *context);
+
+void
+busfault_unregister(struct busfault *busfault);
+
+void
+busfault_check(void);
+
+Bool
+busfault_init(void);
+
+#endif
+
+#endif /* _BUSFAULT_H_ */
diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in
index 156383bf8..d4fbe99fa 100644
--- a/xorg-server/include/dix-config.h.in
+++ b/xorg-server/include/dix-config.h.in
@@ -449,7 +449,21 @@
#include "dix-config-apple-verbatim.h"
#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+/* Defined if needed to expose struct msghdr.msg_control */
+#undef _XOPEN_SOURCE
+
/* Have support for X shared memory fence library (xshmfence) */
#undef HAVE_XSHMFENCE
+/* Use XTrans FD passing support */
+#undef XTRANS_SEND_FDS
+
+/* Wrap SIGBUS to catch MIT-SHM faults */
+#undef BUSFAULT
+
#endif /* _DIX_CONFIG_H_ */
diff --git a/xorg-server/include/dixstruct.h b/xorg-server/include/dixstruct.h
index 456e63360..6f5667fcb 100644
--- a/xorg-server/include/dixstruct.h
+++ b/xorg-server/include/dixstruct.h
@@ -110,15 +110,19 @@ typedef struct _Client {
DeviceIntPtr clientPtr;
ClientIdPtr clientIds;
+#if XTRANS_SEND_FDS
int req_fds;
+#endif
} ClientRec;
+#if XTRANS_SEND_FDS
static inline void
SetReqFds(ClientPtr client, int req_fds) {
if (client->req_fds != 0 && req_fds != client->req_fds)
LogMessage(X_ERROR, "Mismatching number of request fds %d != %d\n", req_fds, client->req_fds);
client->req_fds = req_fds;
}
+#endif
/*
* Scheduling interface
diff --git a/xorg-server/include/os.h b/xorg-server/include/os.h
index 11b219845..450e1a8e8 100644
--- a/xorg-server/include/os.h
+++ b/xorg-server/include/os.h
@@ -98,9 +98,11 @@ extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */
extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
+#if XTRANS_SEND_FDS
extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close);
+#endif
extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
char * /*data */ ,
diff --git a/xorg-server/include/protocol-versions.h b/xorg-server/include/protocol-versions.h
index 5ceaeb012..95df8ce1a 100644
--- a/xorg-server/include/protocol-versions.h
+++ b/xorg-server/include/protocol-versions.h
@@ -93,7 +93,11 @@
/* SHM */
#define SERVER_SHM_MAJOR_VERSION 1
+#if XTRANS_SEND_FDS
+#define SERVER_SHM_MINOR_VERSION 2
+#else
#define SERVER_SHM_MINOR_VERSION 1
+#endif
/* Sync */
#define SERVER_SYNC_MAJOR_VERSION 3
diff --git a/xorg-server/include/xorg-config.h.in b/xorg-server/include/xorg-config.h.in
index e3444da91..487d7addb 100644
--- a/xorg-server/include/xorg-config.h.in
+++ b/xorg-server/include/xorg-config.h.in
@@ -145,7 +145,4 @@
/* 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_ */
diff --git a/xorg-server/include/xorg-server.h.in b/xorg-server/include/xorg-server.h.in
index 960817e68..0c651bfab 100644
--- a/xorg-server/include/xorg-server.h.in
+++ b/xorg-server/include/xorg-server.h.in
@@ -221,4 +221,7 @@
/* Have support for X shared memory fence library (xshmfence) */
#undef HAVE_XSHMFENCE
+/* Use XTrans FD passing support */
+#undef XTRANS_SEND_FDS
+
#endif /* _XORG_SERVER_H_ */
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index 636618282..67511b8d0 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/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
diff --git a/xorg-server/os/Makefile.am b/xorg-server/os/Makefile.am
index 364b6da2d..a1bbb4d1e 100644
--- a/xorg-server/os/Makefile.am
+++ b/xorg-server/os/Makefile.am
@@ -5,6 +5,7 @@ AM_CFLAGS = $(DIX_CFLAGS) $(SHA1_CFLAGS)
SECURERPC_SRCS = rpcauth.c
XDMCP_SRCS = xdmcp.c
XORG_SRCS = log.c
+BUSFAULT_SRCS = busfault.c
libos_la_SOURCES = \
WaitFor.c \
@@ -39,6 +40,10 @@ AM_CFLAGS += $(LIBUNWIND_CFLAGS)
libos_la_LIBADD += $(LIBUNWIND_LIBS)
endif
+if BUSFAULT
+libos_la_SOURCES += $(BUSFAULT_SRCS)
+endif
+
EXTRA_DIST = $(SECURERPC_SRCS) $(XDMCP_SRCS)
if SPECIAL_DTRACE_OBJECTS
diff --git a/xorg-server/os/WaitFor.c b/xorg-server/os/WaitFor.c
index c5f4cd78b..39fedd9a2 100644
--- a/xorg-server/os/WaitFor.c
+++ b/xorg-server/os/WaitFor.c
@@ -72,6 +72,7 @@ SOFTWARE.
#ifdef DPMSExtension
#include "dpmsproc.h"
#endif
+#include "busfault.h"
#ifdef WIN32
/* Error codes from windows sockets differ from fileio error codes */
@@ -162,6 +163,10 @@ WaitForSomething(int *pClientsReady)
SmartScheduleStopTimer();
nready = 0;
+#ifdef BUSFAULT
+ busfault_check();
+#endif
+
/* We need a while loop here to handle
crashed connections and the screen saver timeout */
while (1) {
diff --git a/xorg-server/os/busfault.c b/xorg-server/os/busfault.c
new file mode 100644
index 000000000..43bb6ea8a
--- /dev/null
+++ b/xorg-server/os/busfault.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright © 2013 Keith Packard
+ *
+ * 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <X11/Xos.h>
+#include <X11/Xdefs.h>
+#include "misc.h"
+#include <busfault.h>
+#include <list.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <sys/mman.h>
+#include <signal.h>
+
+struct busfault {
+ struct xorg_list list;
+
+ void *addr;
+ size_t size;
+
+ Bool valid;
+
+ busfault_notify_ptr notify;
+ void *context;
+};
+
+static Bool busfaulted;
+static struct xorg_list busfaults;
+
+struct busfault *
+busfault_register_mmap(void *addr, size_t size, busfault_notify_ptr notify, void *context)
+{
+ struct busfault *busfault;
+
+ busfault = calloc(1, sizeof (struct busfault));
+ if (!busfault)
+ return NULL;
+
+ busfault->addr = addr;
+ busfault->size = size;
+ busfault->notify = notify;
+ busfault->context = context;
+ busfault->valid = TRUE;
+
+ xorg_list_add(&busfault->list, &busfaults);
+ return busfault;
+}
+
+void
+busfault_unregister(struct busfault *busfault)
+{
+ xorg_list_del(&busfault->list);
+ free(busfault);
+}
+
+void
+busfault_check(void)
+{
+ struct busfault *busfault, *tmp;
+
+ if (!busfaulted)
+ return;
+
+ busfaulted = FALSE;
+
+ xorg_list_for_each_entry_safe(busfault, tmp, &busfaults, list) {
+ if (!busfault->valid)
+ (*busfault->notify)(busfault->context);
+ }
+}
+
+static void (*previous_busfault_sigaction)(int sig, siginfo_t *info, void *param);
+
+static void
+busfault_sigaction(int sig, siginfo_t *info, void *param)
+{
+ void *fault = info->si_addr;
+ struct busfault *busfault = NULL;
+ void *new_addr;
+
+ /* Locate the faulting address in our list of shared segments
+ */
+ xorg_list_for_each_entry(busfault, &busfaults, list) {
+ if ((char *) busfault->addr <= (char *) fault && (char *) fault < (char *) busfault->addr + busfault->size) {
+ break;
+ }
+ }
+ if (!busfault)
+ goto panic;
+
+ if (!busfault->valid)
+ goto panic;
+
+ busfault->valid = FALSE;
+ busfaulted = TRUE;
+
+ /* The client truncated the file; unmap the shared file, map
+ * /dev/zero over that area and keep going
+ */
+
+ new_addr = mmap(busfault->addr, busfault->size, PROT_READ|PROT_WRITE,
+ MAP_ANON|MAP_PRIVATE|MAP_FIXED, -1, 0);
+
+ if (new_addr == MAP_FAILED)
+ goto panic;
+
+ return;
+panic:
+ if (previous_busfault_sigaction)
+ (*previous_busfault_sigaction)(sig, info, param);
+ else
+ FatalError("bus error");
+}
+
+Bool
+busfault_init(void)
+{
+ struct sigaction act, old_act;
+
+ act.sa_sigaction = busfault_sigaction;
+ act.sa_flags = SA_SIGINFO;
+ if (sigaction(SIGBUS, &act, &old_act) < 0)
+ return FALSE;
+ previous_busfault_sigaction = old_act.sa_sigaction;
+ xorg_list_init(&busfaults);
+ return TRUE;
+}
diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c
index a20faa56f..922a8eb02 100644
--- a/xorg-server/os/io.c
+++ b/xorg-server/os/io.c
@@ -259,12 +259,14 @@ ReadRequestFromClient(ClientPtr client)
oc->input = oci;
}
+#if XTRANS_SEND_FDS
/* Discard any unused file descriptors */
while (client->req_fds > 0) {
int req_fd = ReadFdFromClient(client);
if (req_fd >= 0)
close(req_fd);
}
+#endif
/* advance to start of next request */
oci->bufptr += oci->lenLastReq;
@@ -491,6 +493,7 @@ ReadRequestFromClient(ClientPtr client)
return needed;
}
+#if XTRANS_SEND_FDS
int
ReadFdFromClient(ClientPtr client)
{
@@ -513,6 +516,7 @@ WriteFdToClient(ClientPtr client, int fd, Bool do_close)
return _XSERVTransSendFd(oc->trans_conn, fd, do_close);
}
+#endif
/*****************************************************************
* InsertFakeRequest
diff --git a/xorg-server/os/osinit.c b/xorg-server/os/osinit.c
index 6c66f9c12..60d10694b 100644
--- a/xorg-server/os/osinit.c
+++ b/xorg-server/os/osinit.c
@@ -149,6 +149,8 @@ OsSigHandler(int signo)
}
#endif /* !WIN32 || __CYGWIN__ */
+#include "busfault.h"
+
void
OsInit(void)
{
@@ -185,6 +187,9 @@ OsInit(void)
}
}
#endif /* !WIN32 || __CYGWIN__ */
+#ifdef BUSFAULT
+ busfault_init();
+#endif
#ifdef HAVE_BACKTRACE
/*
diff --git a/xorg-server/present/present.c b/xorg-server/present/present.c
index 4c97ce40c..228d43a20 100644
--- a/xorg-server/present/present.c
+++ b/xorg-server/present/present.c
@@ -184,8 +184,10 @@ present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_
static void
present_pixmap_idle(PixmapPtr pixmap, WindowPtr window, CARD32 serial, struct present_fence *present_fence)
{
- present_fence_set_triggered(present_fence);
- present_send_idle_notify(window, serial, pixmap, present_fence);
+ if (present_fence)
+ present_fence_set_triggered(present_fence);
+ if (window)
+ present_send_idle_notify(window, serial, pixmap, present_fence);
}
RRCrtcPtr
@@ -297,7 +299,8 @@ present_flip_idle(ScreenPtr screen)
if (screen_priv->flip_pixmap) {
present_pixmap_idle(screen_priv->flip_pixmap, screen_priv->flip_window,
screen_priv->flip_serial, screen_priv->flip_idle_fence);
- present_fence_destroy(screen_priv->flip_idle_fence);
+ if (screen_priv->flip_idle_fence)
+ present_fence_destroy(screen_priv->flip_idle_fence);
dixDestroyPixmap(screen_priv->flip_pixmap, screen_priv->flip_pixmap->drawable.id);
screen_priv->flip_crtc = NULL;
screen_priv->flip_window = NULL;
@@ -371,6 +374,7 @@ present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
present_vblank_ptr vblank, tmp;
int s;
+ DebugPresent(("\te %lld ust %lld msc %lld\n", event_id, ust, msc));
xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
if (vblank->event_id == event_id) {
xorg_list_del(&vblank->event_queue);
@@ -655,8 +659,10 @@ present_pixmap(WindowPtr window,
}
if (pixmap)
- DebugPresent(("q %p %8lld: %08lx -> %08lx (crtc %d)\n",
- vblank, target_msc, vblank->pixmap->drawable.id, vblank->window->drawable.id, target_crtc ? 1 : 0));
+ DebugPresent(("q %lld %p %8lld: %08lx -> %08lx (crtc %p)\n",
+ vblank->event_id, vblank, target_msc,
+ vblank->pixmap->drawable.id, vblank->window->drawable.id,
+ target_crtc));
xorg_list_add(&vblank->event_queue, &present_exec_queue);
if (target_msc >= crtc_msc) {
diff --git a/xorg-server/record/record.c b/xorg-server/record/record.c
index f3a26a732..2c70460e8 100644
--- a/xorg-server/record/record.c
+++ b/xorg-server/record/record.c
@@ -1393,6 +1393,10 @@ typedef struct {
short first, last; /* if for extension, major opcode interval */
} SetInfoRec, *SetInfoPtr;
+#if defined(ERR) && defined(__sun)
+#undef ERR /* Avoid conflict with Solaris <sys/regset.h> */
+#endif
+
/* These constant are used to index into an array of SetInfoRec. */
enum { REQ, /* set info for requests */
REP, /* set info for replies */