configure: wrap PCI code with macro and set it at build time

--disable-pciaccess, used together with --disable-module-int10, can be used to
disable all pci code inside the server.

Note that XSERVER_LIBPCIACCESS was previously used only in the driver side and
now it defines also whether the library is used inside the server. Also,
XORG_BUS_PCI automake variable is introduced to track PCI code needs.

Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
Tiago Vignatti 2010-06-01 13:05:47 +03:00 committed by Jeremy Huddleston
parent 5c12399b6c
commit 6817050f31
15 changed files with 74 additions and 23 deletions

View File

@ -638,6 +638,7 @@ AC_ARG_ENABLE(int10-module, AS_HELP_STRING([--enable-int10-module], [Build X
AC_ARG_ENABLE(windowswm, AS_HELP_STRING([--enable-windowswm], [Build XWin with WindowsWM extension (default: no)]), [WINDOWSWM=$enableval], [WINDOWSWM=no])
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])
dnl DDXes.
AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto])
@ -1573,6 +1574,9 @@ if test "x$XORG" = xyes; then
xorg_bus_bsdpci=no
xorg_bus_sparc=no
AC_MSG_CHECKING([whether to build Xorg PCI functions])
if test "x$PCI" = xyes; then
PKG_CHECK_MODULES([PCIACCESS], $LIBPCIACCESS)
XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $GLX_SYS_LIBS"
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
@ -1589,6 +1593,9 @@ if test "x$XORG" = xyes; then
xorg_bus_sparc="yes"
;;
esac
fi
AC_MSG_RESULT([$PCI])
dnl ===================================================================
dnl ==================== end of PCI configuration =====================
dnl ===================================================================
@ -1768,6 +1775,7 @@ if test "x$XORG" = xyes; then
AC_SUBST([abi_extension])
fi
AM_CONDITIONAL([XORG], [test "x$XORG" = xyes])
AM_CONDITIONAL([XORG_BUS_PCI], [test "x$PCI" = xyes])
AM_CONDITIONAL([XORG_BUS_BSDPCI], [test "x$xorg_bus_bsdpci" = xyes])
AM_CONDITIONAL([XORG_BUS_SPARC], [test "x$xorg_bus_sparc" = xyes])
AM_CONDITIONAL([LINUX_ALPHA], [test "x$linux_alpha" = xyes])

View File

@ -1,5 +1,10 @@
noinst_LTLIBRARIES = libcommon.la
if XORG_BUS_PCI
PCI_SOURCES = xf86pciBus.c xf86VGAarbiter.c xf86VGAarbiter.h \
xf86VGAarbiterPriv.h
endif
if XORG_BUS_SPARC
SBUS_SOURCES = xf86sbusBus.c
endif
@ -19,7 +24,7 @@ endif
RANDRSOURCES = xf86RandR.c
BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
BUSSOURCES = xf86fbBus.c xf86noBus.c $(PCI_SOURCES) $(SBUS_SOURCES)
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
@ -33,7 +38,7 @@ AM_LDFLAGS = -r
libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
xf86Events.c xf86Globals.c xf86AutoConfig.c \
xf86Option.c xf86Init.c xf86VGAarbiter.c \
xf86Option.c xf86Init.c \
xf86VidMode.c xf86fbman.c xf86cmap.c \
xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
xf86Mode.c xorgHelper.c \

View File

@ -92,6 +92,7 @@ extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
#ifndef _NO_XF86_PROTOTYPES
/* PCI related */
#ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h>
extern _X_EXPORT Bool pciSlotClaimed;
@ -118,6 +119,15 @@ extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
int entityIndex,PciChipsets *p_chip, void *dummy, EntityProc init,
EntityProc enter, EntityProc leave, pointer private);
#else
#define xf86VGAarbiterInit() do {} while (0)
#define xf86VGAarbiterFini() do {} while (0)
#define xf86VGAarbiterLock(x) do {} while (0)
#define xf86VGAarbiterUnlock(x) do {} while (0)
#define xf86VGAarbiterScrnInit(x) do {} while (0)
#define xf86VGAarbiterDeviceDecodes() do {} while (0)
#define xf86VGAarbiterWrapFunctions() do {} while (0)
#endif
/* xf86Bus.c */

View File

@ -255,9 +255,9 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
matches[i++] = xnfstrdup(sbusDriver);
}
#endif
#ifdef XSERVER_LIBPCIACCESS
i = xf86PciMatchDriver(matches, nmatches);
#endif
/* Fallback to platform default hardware */
if (i < (nmatches - 1)) {
#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)

View File

@ -47,8 +47,9 @@
#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
#ifdef XSERVER_LIBPCIACCESS
#include "xf86VGAarbiter.h"
#endif
/* Entity data */
EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
int xf86NumEntities = 0;
@ -75,7 +76,7 @@ Bool
xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
{
Bool foundScreen = FALSE;
#ifdef XSERVER_LIBPCIACCESS
if (drv->PciProbe != NULL) {
if (xf86DoConfigure && xf86DoConfigurePass1) {
assert(detect_only);
@ -86,7 +87,7 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
foundScreen = xf86PciProbeDev(drv);
}
}
#endif
if (!foundScreen && (drv->Probe != NULL)) {
xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
drv->driverName);
@ -195,7 +196,9 @@ xf86BusConfig(void)
void
xf86BusProbe(void)
{
#ifdef XSERVER_LIBPCIACCESS
xf86PciProbe();
#endif
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
xf86SbusProbe();
#endif
@ -504,9 +507,14 @@ xf86PostProbe(void)
{
int i;
if (fbSlotClaimed && (pciSlotClaimed
if (fbSlotClaimed && (
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
|| sbusSlotClaimed
sbusSlotClaimed ||
#endif
#ifdef XSERVER_LIBPCIACCESS
pciSlotClaimed
#else
TRUE
#endif
))
FatalError("Cannot run in framebuffer mode. Please specify busIDs "

View File

@ -2398,7 +2398,7 @@ xf86HandleConfigFile(Bool autoconfig)
}
xf86ProcessOptions(-1, xf86ConfigLayout.options, LayoutOptions);
#ifdef XSERVER_LIBPCIACCESS
if ((scanptr = xf86GetOptValString(LayoutOptions, LAYOUT_ISOLATEDEVICE))) {
; /* IsolateDevice specified; overrides SingleCard */
} else {
@ -2413,7 +2413,7 @@ xf86HandleConfigFile(Bool autoconfig)
} else
xf86PciIsolateDevice(scanptr);
}
#endif
/* Now process everything else */
if (!configServerFlags(xf86configptr->conf_flags,xf86ConfigLayout.options)){
ErrorF ("Problem when converting the config data structures\n");

View File

@ -87,9 +87,11 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
/* Check for duplicates */
for (i = 0; i < nDevToConfig; i++) {
switch (bus) {
#ifdef XSERVER_LIBPCIACCESS
case BUS_PCI:
ret = xf86PciConfigure(busData, DevToConfig[i].pVideo);
break;
break;
#endif
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
case BUS_SBUS:
ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo);
@ -118,10 +120,12 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int
for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++);
switch (bus) {
#ifdef XSERVER_LIBPCIACCESS
case BUS_PCI:
xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
&DevToConfig[i].GDev, &chipset);
break;
#endif
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
case BUS_SBUS:
xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,

View File

@ -42,8 +42,9 @@
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#ifdef XSERVER_LIBPCIACCESS
#include "xf86VGAarbiter.h"
#endif
#ifdef DPMSExtension
static DevPrivateKeyRec DPMSKeyRec;

View File

@ -78,7 +78,9 @@
#include "picturestr.h"
#include "xf86Bus.h"
#ifdef XSERVER_LIBPCIACCESS
#include "xf86VGAarbiter.h"
#endif
#include "globals.h"
#include "xserver-properties.h"
@ -88,7 +90,6 @@
#endif
#include <hotplug.h>
#ifdef XF86PM
void (*xf86OSPMClose)(void) = NULL;
#endif
@ -1355,6 +1356,7 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86DoShowOptions = TRUE;
return 1;
}
#ifdef XSERVER_LIBPCIACCESS
if (!strcmp(argv[i], "-isolateDevice"))
{
CHECK_FOR_REQUIRED_ARGUMENT();
@ -1364,6 +1366,7 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86PciIsolateDevice(argv[i]);
return 2;
}
#endif
/* Notice cmdline xkbdir, but pass to dix as well */
if (!strcmp(argv[i], "-xkbdir"))
{
@ -1432,7 +1435,9 @@ ddxUseMsg(void)
#endif
ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
#ifdef XSERVER_LIBPCIACCESS
ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
#endif
ErrorF("-version show the server version\n");
ErrorF("-showDefaultModulePath show the server default module path\n");
ErrorF("-showDefaultLibPath show the server default library path\n");

View File

@ -54,8 +54,10 @@ xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
EntityPtr p;
int num;
#ifdef XSERVER_LIBPCIACCESS
if (pciSlotClaimed)
return -1;
#endif
#if defined(__sparc__) || defined (__sparc64__)
if (sbusSlotClaimed)
return -1;

View File

@ -41,9 +41,6 @@
#include "colormapst.h"
#include "xf86Module.h"
#include "xf86Opt.h"
#include "xf86Pci.h"
#include <pciaccess.h>
/**
* Integer type that is of the size of the addressable memory (machine size).
@ -309,6 +306,8 @@ typedef struct {
struct _SymTabRec;
struct _PciChipsets;
struct pci_device;
typedef struct _DriverRec {
int driverVersion;
char * driverName;
@ -350,8 +349,6 @@ typedef enum {
BUS_last /* Keep last */
} BusType;
struct pci_device;
typedef struct {
int fbNum;
} SbusBusId;

View File

@ -33,6 +33,7 @@
#include <string.h>
#include <stdio.h>
#include <X11/Xarch.h>
#include "xf86.h"
#include "xf86DDC.h"
#include "xf86Crtc.h"

View File

@ -1,7 +1,10 @@
noinst_LTLIBRARIES = libbus.la
sdk_HEADERS = xf86Pci.h
PCI_SOURCES = Pci.c Pci.h
PCI_SOURCES =
if XORG_BUS_PCI
PCI_SOURCES += Pci.c Pci.h
endif
if XORG_BUS_BSDPCI
PCI_SOURCES += bsd_pci.c

View File

@ -120,14 +120,16 @@ cat > sdksyms.c << EOF
#include "xf86.h"
#include "xf86Module.h"
#include "xf86Opt.h"
#include "xf86PciInfo.h"
#ifdef XSERVER_LIBPCIACCESS
#include "xf86PciInfo.h"
#include "xf86VGAarbiter.h"
#endif
#include "xf86Priv.h"
#include "xf86Privstr.h"
#include "xf86cmap.h"
#include "xf86fbman.h"
#include "xf86str.h"
#include "xf86Xinput.h"
#include "xf86VGAarbiter.h"
#include "xisb.h"
#if XV
# include "xf86xv.h"
@ -172,7 +174,9 @@ cat > sdksyms.c << EOF
/* hw/xfree86/os-support/bus/Makefile.am */
#include "xf86Pci.h"
#ifdef XSERVER_LIBPCIACCESS
# include "xf86Pci.h"
#endif
#if defined(__sparc__) || defined(__sparc)
# include "xf86Sbus.h"
#endif

View File

@ -127,4 +127,7 @@
/* Build with libdrm support */
#undef WITH_LIBDRM
/* Use libpciaccess */
#undef XSERVER_LIBPCIACCESS
#endif /* _XORG_CONFIG_H_ */