Disable DRI3 and sync fence FD functions if xshmfence isn't available

Make sure the server can build when the xshmfence library isn't present

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2013-11-03 09:56:02 -08:00
parent 33c85beed5
commit aaf0e29619
5 changed files with 71 additions and 7 deletions

View File

@ -919,6 +919,7 @@ SyncCreate(ClientPtr client, XID id, unsigned char type)
int int
SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL initially_triggered) SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL initially_triggered)
{ {
#if HAVE_XSHMFENCE
SyncFence *pFence; SyncFence *pFence;
int status; int status;
@ -936,12 +937,19 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
return BadAlloc; return BadAlloc;
return Success; return Success;
#else
return BadImplementation;
#endif
} }
int int
SyncFDFromFence(ClientPtr client, DrawablePtr pDraw, SyncFence *pFence) SyncFDFromFence(ClientPtr client, DrawablePtr pDraw, SyncFence *pFence)
{ {
#if HAVE_XSHMFENCE
return miSyncFDFromFence(pDraw, pFence); return miSyncFDFromFence(pDraw, pFence);
#else
return BadImplementation;
#endif
} }
static SyncCounter * static SyncCounter *

View File

@ -792,6 +792,7 @@ DMXPROTO="dmxproto >= 2.2.99.1"
VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1" VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1"
WINDOWSWMPROTO="windowswmproto" WINDOWSWMPROTO="windowswmproto"
APPLEWMPROTO="applewmproto >= 1.4" APPLEWMPROTO="applewmproto >= 1.4"
XSHMFENCE="xshmfence"
dnl Required modules dnl Required modules
XPROTO="xproto >= 7.0.22" XPROTO="xproto >= 7.0.22"
@ -1119,17 +1120,59 @@ AM_CONDITIONAL(DRI2, test "x$DRI2" = xyes)
PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO, PKG_CHECK_MODULES([DRI3PROTO], $DRI3PROTO,
[HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no]) [HAVE_DRI3PROTO=yes], [HAVE_DRI3PROTO=no])
case "$DRI3,$HAVE_DRI3PROTO" in case "$DRI3,$HAVE_DRI3PROTO" in
yes,yes | auto,yes)
;;
yes,no) yes,no)
AC_MSG_ERROR([DRI3 requested, but dri3proto not found.]) AC_MSG_ERROR([DRI3 requested, but dri3proto not found.])
DRI3=no
;; ;;
yes,yes | auto,yes) no,*)
AC_DEFINE(DRI3, 1, [Build DRI3 extension]) ;;
DRI3=yes *)
DRI3_LIB='$(top_builddir)/dri3/libdri3.la' AC_MSG_NOTICE([DRI3 disabled because dri3proto not found.])
SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO" DRI3=no
;; ;;
esac esac
PKG_CHECK_MODULES([XSHMFENCE], $XSHMFENCE,
[HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no])
AM_CONDITIONAL(XSHMFENCE, test "x$HAVE_XSHMFENCE" = xyes)
case x"$HAVE_XSHMFENCE" in
xyes)
AC_DEFINE(HAVE_XSHMFENCE, 1, [Have X Shared Memory Fence library])
;;
esac
case "$DRI3,$HAVE_XSHMFENCE" in
yes,yes | auto,yes)
;;
yes,no)
AC_MSG_ERROR("DRI3 requested, but xshmfence not found.])
DRI3=no
;;
no,*)
;;
*)
AC_MSG_NOTICE([DRI3 disabled because xshmfence not found.])
DRI3=no
;;
esac
case x"$DRI3" in
xyes|xauto)
DRI3=yes
AC_DEFINE(DRI3, 1, [Build DRI3 extension])
DRI3_LIB='$(top_builddir)/dri3/libdri3.la'
SDK_REQUIRED_MODULES="$SDK_REQUIRED_MODULES $DRI3PROTO"
AC_MSG_NOTICE([DRI3 enabled]);
;;
esac
AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes) AM_CONDITIONAL(DRI3, test "x$DRI3" = xyes)
if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then if test "x$DRI" = xyes || test "x$DRI2" = xyes || test "x$DRI3" = xyes || test "x$CONFIG_UDEV_KMS" = xyes; then
@ -1333,7 +1376,6 @@ if test "x$XDMAUTH" = xyes; then
XDMCP_MODULES="xdmcp" XDMCP_MODULES="xdmcp"
fi fi
fi fi
REQUIRED_LIBS="$REQUIRED_LIBS xshmfence"
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path]) AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path]) AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])

View File

@ -23,6 +23,10 @@
#ifndef _DRI3_H_ #ifndef _DRI3_H_
#define _DRI3_H_ #define _DRI3_H_
#include <xorg-server.h>
#ifdef DRI3
#include <X11/extensions/dri3proto.h> #include <X11/extensions/dri3proto.h>
#include <randrstr.h> #include <randrstr.h>
@ -56,4 +60,6 @@ typedef struct dri3_screen_info {
extern _X_EXPORT Bool extern _X_EXPORT Bool
dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info); dri3_screen_init(ScreenPtr screen, dri3_screen_info_ptr info);
#endif
#endif /* _DRI3_H_ */ #endif /* _DRI3_H_ */

View File

@ -218,4 +218,7 @@
#define _XSERVER64 1 #define _XSERVER64 1
#endif #endif
/* Have support for X shared memory fence library (xshmfence) */
#undef HAVE_XSHMFENCE
#endif /* _XORG_SERVER_H_ */ #endif /* _XORG_SERVER_H_ */

View File

@ -8,8 +8,13 @@ if XORG
sdk_HEADERS = misync.h misyncstr.h misyncshm.h sdk_HEADERS = misync.h misyncstr.h misyncshm.h
endif endif
XSHMFENCE_SRCS = misyncshm.c
libsync_la_SOURCES = \ libsync_la_SOURCES = \
misync.c \ misync.c \
misync.h \ misync.h \
misyncshm.c \
misyncstr.h misyncstr.h
if XSHMFENCE
libsync_la_SOURCES += $(XSHMFENCE_SRCS)
endif