Blame SOURCES/0001-Disable-DRI3-and-sync-fence-FD-functions-if-xshmfenc.patch

70130e
From aaf0e29619196a283fee7ead2020a91032d84f48 Mon Sep 17 00:00:00 2001
70130e
From: Keith Packard <keithp@keithp.com>
70130e
Date: Sun, 3 Nov 2013 09:56:02 -0800
70130e
Subject: [PATCH 1/5] Disable DRI3 and sync fence FD functions if xshmfence
70130e
 isn't available
70130e
70130e
Make sure the server can build when the xshmfence library isn't present
70130e
70130e
Signed-off-by: Keith Packard <keithp@keithp.com>
70130e
---
70130e
 Xext/sync.c              |  8 ++++++++
70130e
 configure.ac             | 46 ++++++++++++++++++++++++++++++++++++++++++++--
70130e
 dri3/dri3.h              |  6 ++++++
70130e
 include/xorg-server.h.in |  3 +++
70130e
 miext/sync/Makefile.am   |  7 ++++++-
70130e
 5 files changed, 67 insertions(+), 3 deletions(-)
70130e
70130e
diff --git a/Xext/sync.c b/Xext/sync.c
70130e
index a04c383..dd18cde 100644
70130e
--- a/Xext/sync.c
70130e
+++ b/Xext/sync.c
70130e
@@ -919,6 +919,7 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
70130e
 int
70130e
 SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL initially_triggered)
70130e
 {
70130e
+#if HAVE_XSHMFENCE
70130e
     SyncFence  *pFence;
70130e
     int         status;
70130e
 
70130e
@@ -936,12 +937,19 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
70130e
         return BadAlloc;
70130e
 
70130e
     return Success;
70130e
+#else
70130e
+    return BadImplementation;
70130e
+#endif
70130e
 }
70130e
 
70130e
 int
70130e
 SyncFDFromFence(ClientPtr client, DrawablePtr pDraw, SyncFence *pFence)
70130e
 {
70130e
+#if HAVE_XSHMFENCE
70130e
     return miSyncFDFromFence(pDraw, pFence);
70130e
+#else
70130e
+    return BadImplementation;
70130e
+#endif
70130e
 }
70130e
 
70130e
 static SyncCounter *
70130e
diff --git a/configure.ac b/configure.ac
70130e
index 0d855f2..a7515a3 100644
70130e
--- a/configure.ac
70130e
+++ b/configure.ac
70130e
@@ -792,6 +792,7 @@ DMXPROTO="dmxproto >= 2.2.99.1"
70130e
 VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
70130e
 WINDOWSWMPROTO="windowswmproto"
70130e
 APPLEWMPROTO="applewmproto >= 1.4"
70130e
+XSHMFENCE="xshmfence"
70130e
 
70130e
 dnl Required modules
70130e
 XPROTO="xproto >= 7.0.22"
70130e
@@ -1119,17 +1120,59 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
70130e
 
70130e
 PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO,
70130e
                   [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no])
70130e
+
70130e
 case "$DRI3,$HAVE_DRI3PROTO" in
70130e
+	yes,yes | auto,yes)
70130e
+		;;
70130e
 	yes,no)
70130e
 		AC_MSG_ERROR([DRI3 requested, but dri3proto not found.])
70130e
+		DRI3=no
70130e
+		;;
70130e
+	no,*)
70130e
+		;;
70130e
+	*)
70130e
+		AC_MSG_NOTICE([DRI3 disabled because dri3proto not found.])
70130e
+		DRI3=no
70130e
 		;;
70130e
+esac
70130e
+
70130e
+PKG_CHECK_MODULES([XSHMFENCE], $XSHMFENCE,
70130e
+		  [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])
70130e
+
70130e
+AM_CONDITIONAL(XSHMFENCE, test "x$HAVE_XSHMFENCE" = xyes)
70130e
+
70130e
+case x"$HAVE_XSHMFENCE" in
70130e
+	xyes)
70130e
+		AC_DEFINE(HAVE_XSHMFENCE, 1, [Have X Shared Memory Fence library])
70130e
+		;;
70130e
+esac
70130e
+
70130e
+
70130e
+case "$DRI3,$HAVE_XSHMFENCE" in
70130e
 	yes,yes | auto,yes)
70130e
-		AC_DEFINE(DRI3, 1, [Build DRI3 extension])
70130e
+		;;
70130e
+	yes,no)
70130e
+		AC_MSG_ERROR("DRI3 requested, but xshmfence not found.])
70130e
+		DRI3=no
70130e
+		;;
70130e
+	no,*)
70130e
+		;;
70130e
+	*)
70130e
+		AC_MSG_NOTICE([DRI3 disabled because xshmfence not found.])
70130e
+		DRI3=no
70130e
+		;;
70130e
+esac
70130e
+
70130e
+case x"$DRI3" in
70130e
+	xyes|xauto)
70130e
 		DRI3=yes
70130e
+		AC_DEFINE(DRI3, 1, [Build DRI3 extension])
70130e
 		DRI3_LIB='$(top_builddir)/dri3/libdri3.la'
70130e
 		SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO"
70130e
+		AC_MSG_NOTICE([DRI3 enabled]);
70130e
 		;;
70130e
 esac
70130e
+
70130e
 AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes)
70130e
 
70130e
 if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then
70130e
@@ -1333,7 +1376,6 @@ if test "x$XDMAUTH" = xyes; then
70130e
 		XDMCP_MODULES="xdmcp"
70130e
 	fi
70130e
 fi
70130e
-REQUIRED_LIBS="$REQUIRED_LIBS xshmfence"
70130e
 
70130e
 AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
70130e
 AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
70130e
diff --git a/dri3/dri3.h b/dri3/dri3.h
70130e
index 7774c87..7c0c330 100644
70130e
--- a/dri3/dri3.h
70130e
+++ b/dri3/dri3.h
70130e
@@ -23,6 +23,10 @@
70130e
 #ifndef _DRI3_H_
70130e
 #define _DRI3_H_
70130e
 
70130e
+#include <xorg-server.h>
70130e
+
70130e
+#ifdef DRI3
70130e
+
70130e
 #include <X11/extensions/dri3proto.h>
70130e
 #include <randrstr.h>
70130e
 
70130e
@@ -56,4 +60,6 @@ typedef struct dri3_screen_info {
70130e
 extern _X_EXPORT Bool
70130e
 dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info);
70130e
 
70130e
+#endif
70130e
+
70130e
 #endif /* _DRI3_H_ */
70130e
diff --git a/include/xorg-server.h.in b/include/xorg-server.h.in
70130e
index 1281b3e..960817e 100644
70130e
--- a/include/xorg-server.h.in
70130e
+++ b/include/xorg-server.h.in
70130e
@@ -218,4 +218,7 @@
70130e
 #define _XSERVER64 1
70130e
 #endif
70130e
 
70130e
+/* Have support for X shared memory fence library (xshmfence) */
70130e
+#undef HAVE_XSHMFENCE
70130e
+
70130e
 #endif /* _XORG_SERVER_H_ */
70130e
diff --git a/miext/sync/Makefile.am b/miext/sync/Makefile.am
70130e
index e25ceac..ac13c52 100644
70130e
--- a/miext/sync/Makefile.am
70130e
+++ b/miext/sync/Makefile.am
70130e
@@ -8,8 +8,13 @@ if XORG
70130e
 sdk_HEADERS = misync.h misyncstr.h misyncshm.h
70130e
 endif
70130e
 
70130e
+XSHMFENCE_SRCS = misyncshm.c
70130e
+
70130e
 libsync_la_SOURCES =	\
70130e
 	misync.c	\
70130e
 	misync.h	\
70130e
-	misyncshm.c	\
70130e
 	misyncstr.h
70130e
+
70130e
+if XSHMFENCE
70130e
+libsync_la_SOURCES += $(XSHMFENCE_SRCS)
70130e
+endif
70130e
-- 
70130e
1.8.3.1
70130e