prefbusid patch for 4.3, builds fine
here is a patch i use for my multi-user workstation with multiple
monitors/mice/keyboards. it limits the reset of the pci bus to
one card with a given busID, if a busID is specified with the
-prefbusid X:X:X option. if no such option is given, everything
behaves as allways.
the patch was written by Aivils Stoss <Aivils.Stoss@unibanka.lv>.
and can be downloaded here:
http://www.schuldei.org/aivils/xf86-430-prefbusid.diff
i attache the same file with a debian-X patch names. it applies
cleanly to the X in experimental and builds fine.
diff -Nurp xc/programs/Xserver/hw/xfree86/common/xf86Globals.c xc-chg-prefbusid/programs/Xserver/hw/xfree86/common/xf86Globals.c
--- xc/programs/Xserver/hw/xfree86/common/xf86Globals.c 2003-02-20 04:05:14.000000000 +0000
+++ xc-chg-prefbusid/programs/Xserver/hw/xfree86/common/xf86Globals.c 2003-04-01 16:28:14.000000000 +0100
@@ -215,6 +215,7 @@ Bool xf86MiscModInDevAllowNonLocal = FAL
#endif
PropertyPtr *xf86RegisteredPropertiesTable = NULL;
Bool xf86inSuspend = FALSE;
+PciBusId xf86PrefBusId;
#ifdef DLOPEN_HACK
/*
diff -Nurp xc/programs/Xserver/hw/xfree86/common/xf86Init.c xc-chg-prefbusid/programs/Xserver/hw/xfree86/common/xf86Init.c
--- xc/programs/Xserver/hw/xfree86/common/xf86Init.c 2003-02-26 09:21:38.000000000 +0000
+++ xc-chg-prefbusid/programs/Xserver/hw/xfree86/common/xf86Init.c 2003-04-01 17:54:13.000000000 +0100
@@ -1553,6 +1553,24 @@ ddxProcessArgument(int argc, char **argv
xf86AllowMouseOpenFail = TRUE;
return 1;
}
+ if (!strcmp(argv[i], "-prefbusid"))
+ {
+ int bus, device, func;
+ if (++i >= argc)
+ return 0;
+ if (sscanf(argv[i], "%d:%d:%d", &bus, &device, &func) == 3)
+ {
+ xf86PrefBusId.bus = bus;
+ xf86PrefBusId.device = device;
+ xf86PrefBusId.func = func;
+ return 2;
+ }
+ else
+ {
+ ErrorF("Invalid preferred PCI BusId\n");
+ return 0;
+ }
+ }
/* OS-specific processing */
return xf86ProcessArgument(argc, argv, i);
}
diff -Nurp xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c xc-chg-prefbusid/programs/Xserver/hw/xfree86/common/xf86pciBus.c
--- xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2003-02-18 15:42:11.000000000 +0000
+++ xc-chg-prefbusid/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2003-04-01 17:29:10.000000000 +0100
@@ -160,7 +160,10 @@ FindPCIVideoInfo(void)
int num = 0;
pciVideoPtr info;
Bool mem64 = FALSE;
+ int DoPrefBusIdCheck = 0;
+ if( xf86PrefBusId.bus || xf86PrefBusId.device || xf86PrefBusId.func )
+ DoPrefBusIdCheck = 1;
pcrpp = xf86PciInfo = xf86scanpci(0);
getPciClassFlags(pcrpp);
@@ -182,7 +185,11 @@ FindPCIVideoInfo(void)
subclass = pcrp->pci_sub_class;
}
- if (PCIINFOCLASSES(baseclass, subclass)) {
+ if (PCIINFOCLASSES(baseclass, subclass) &&
+ (DoPrefBusIdCheck ?
+ (xf86PrefBusId.bus == pcrp->busnum &&
+ xf86PrefBusId.device == pcrp->devnum &&
+ xf86PrefBusId.func == pcrp->funcnum):1)) {
num++;
xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo,
sizeof(pciVideoPtr) * (num + 1));
diff -Nurp xc/programs/Xserver/hw/xfree86/common/xf86Priv.h xc-chg-prefbusid/programs/Xserver/hw/xfree86/common/xf86Priv.h
--- xc/programs/Xserver/hw/xfree86/common/xf86Priv.h 2002-12-12 18:29:10.000000000 +0000
+++ xc-chg-prefbusid/programs/Xserver/hw/xfree86/common/xf86Priv.h 2003-04-01 16:28:42.000000000 +0100
@@ -53,6 +53,7 @@ extern Bool xf86BestRefresh;
extern Gamma xf86Gamma;
extern char *xf86ServerName;
extern Bool xf86ShowUnresolved;
+extern PciBusId xf86PrefBusId;
/* Other parameters */
Reply to: