Commit 31707aec authored by Ian Romanick's avatar Ian Romanick

Add conditional support for pci-rework branch.

To build VESA driver for use with pci-rework Xserver, add --enable-pciacces
to the configure command line.  Otherwise, the "traditional" VESA driver will
be built.
parent b17f9256
......@@ -46,6 +46,9 @@ AC_ARG_WITH(xorg-module-dir,
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
[moduledir="$withval"],
[moduledir="$libdir/xorg/modules"])
AC_ARG_ENABLE(pciaccess, AS_HELP_STRING([--enable-pciaccess],
[Enable use of libpciaccess (default: disabled)]),
[PCIACCESS=$enableval], [PCIACCESS=no])
# Checks for extensions
XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
......@@ -56,6 +59,13 @@ XORG_DRIVER_CHECK_EXT(XV, videoproto)
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.99.901 xproto fontsproto $REQUIRED_MODULES])
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
AM_CONDITIONAL(PCIACCESS, [test "x$PCIACCESS" = xyes])
if test "x$PCIACCESS" = xyes; then
AC_DEFINE(PCIACCESS, 1, [Use libpciaccess])
PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
fi
# Checks for libraries.
# Checks for header files.
......
......@@ -34,6 +34,10 @@
#include "xf86xv.h"
#ifdef PCIACCESS
#include <pciaccess.h>
#endif
static Bool debug = 0;
#define TRACE_ENTER(str) \
......@@ -49,6 +53,10 @@ static Bool debug = 0;
static const OptionInfoRec * FBDevAvailableOptions(int chipid, int busid);
static void FBDevIdentify(int flags);
static Bool FBDevProbe(DriverPtr drv, int flags);
#ifdef PCIACCESS
static Bool FBDevPciProbe(DriverPtr drv, int entity_num,
struct pci_device *dev, intptr_t match_data);
#endif
static Bool FBDevPreInit(ScrnInfoPtr pScrn, int flags);
static Bool FBDevScreenInit(int Index, ScreenPtr pScreen, int argc,
char **argv);
......@@ -76,6 +84,17 @@ static int pix24bpp = 0;
#define FBDEV_NAME "FBDEV"
#define FBDEV_DRIVER_NAME "fbdev"
#ifdef PCIACCESS
static const struct pci_id_match fbdev_device_match[] = {
{
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
0x00030000, 0x00ffffff, 0
},
{ 0, 0, 0 },
};
#endif
_X_EXPORT DriverRec FBDEV = {
FBDEV_VERSION,
FBDEV_DRIVER_NAME,
......@@ -87,7 +106,12 @@ _X_EXPORT DriverRec FBDEV = {
FBDevAvailableOptions,
NULL,
0,
FBDevDriverFunc
FBDevDriverFunc,
#ifdef PCIACCESS
fbdev_device_match,
FBDevPciProbe
#endif
};
/* Supported "chipsets" */
......@@ -273,6 +297,55 @@ FBDevIdentify(int flags)
xf86PrintChipsets(FBDEV_NAME, "driver for framebuffer", FBDevChipsets);
}
#ifdef PCIACCESS
static Bool FBDevPciProbe(DriverPtr drv, int entity_num,
struct pci_device *dev, intptr_t match_data)
{
ScrnInfoPtr pScrn = NULL;
if (!xf86LoadDrvSubModule(drv, "fbdevhw"))
return FALSE;
xf86LoaderReqSymLists(fbdevHWSymbols, NULL);
pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL, NULL,
NULL, NULL, NULL, NULL);
if (pScrn) {
char *device;
GDevPtr devSection = xf86GetDevFromEntity(pScrn->entityList[0],
pScrn->entityInstanceList[0]);
device = xf86FindOptionValue(devSection->options, "fbdev");
if (fbdevHWProbe(NULL, device, NULL)) {
pScrn->driverVersion = FBDEV_VERSION;
pScrn->driverName = FBDEV_DRIVER_NAME;
pScrn->name = FBDEV_NAME;
pScrn->Probe = FBDevProbe;
pScrn->PreInit = FBDevPreInit;
pScrn->ScreenInit = FBDevScreenInit;
pScrn->SwitchMode = fbdevHWSwitchModeWeak();
pScrn->AdjustFrame = fbdevHWAdjustFrameWeak();
pScrn->EnterVT = fbdevHWEnterVTWeak();
pScrn->LeaveVT = fbdevHWLeaveVTWeak();
pScrn->ValidMode = fbdevHWValidModeWeak();
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"claimed PCI slot %d@%d:%d:%d\n",
dev->bus, dev->domain, dev->dev, dev->func);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"using %s\n", device ? device : "default device");
}
else {
pScrn = NULL;
}
}
return (pScrn != NULL);
}
#endif
static Bool
FBDevProbe(DriverPtr drv, int flags)
{
......@@ -300,21 +373,27 @@ FBDevProbe(DriverPtr drv, int flags)
for (i = 0; i < numDevSections; i++) {
Bool isIsa = FALSE;
#ifndef PCIACCESS
Bool isPci = FALSE;
#endif
dev = xf86FindOptionValue(devSections[i]->options,"fbdev");
if (devSections[i]->busID) {
#ifndef PCIACCESS
if (xf86ParsePciBusString(devSections[i]->busID,&bus,&device,
&func)) {
if (!xf86CheckPciSlot(bus,device,func))
continue;
isPci = TRUE;
} else if (xf86ParseIsaBusString(devSections[i]->busID))
} else
#endif
if (xf86ParseIsaBusString(devSections[i]->busID))
isIsa = TRUE;
}
if (fbdevHWProbe(NULL,dev,NULL)) {
pScrn = NULL;
#ifndef PCIACCESS
if (isPci) {
/* XXX what about when there's no busID set? */
int entity;
......@@ -331,7 +410,9 @@ FBDevProbe(DriverPtr drv, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"claimed PCI slot %d:%d:%d\n",bus,device,func);
} else if (isIsa) {
} else
#endif
if (isIsa) {
int entity;
entity = xf86ClaimIsaSlot(drv, 0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment