Package: xserver-xfree86 Version: 4.3.0-0pre1v1 Severity: wishlist Tags: experimental patch
this patch makes it possibel to select which busid the xserver should operate on. this is handy if two or more graphic cards in a box run independent xservers and need to reset the card independently from the other xserver. this patch features the requested clean up configuration interface via the XF86Config file. then one can write stuff like this in ones config: Section "ServerLayout" Identifier "X0" Screen 0 "Screen0" 0 0 InputDevice "Mouse2" "CorePointer" InputDevice "Keyboard0" "CoreKeyboard" Option "PrefBusID" "1:0:0" EndSection diff -Nurp xc/programs/Xserver/hw/xfree86/common/xf86Config.c xc-changed/programs/Xserver/hw/xfree86/common/xf86Config.c --- xc/programs/Xserver/hw/xfree86/common/xf86Config.c 2003-02-20 04:36:07.000000000 +0000 +++ xc-changed/programs/Xserver/hw/xfree86/common/xf86Config.c 2003-08-26 14:59:47.000000000 +0100 @@ -2213,6 +2213,7 @@ xf86HandleConfigFile(void) const char *filename; char *searchpath; MessageType from = X_DEFAULT; + char *layopt; if (getuid() == 0) searchpath = ROOT_CONFIGPATH; @@ -2282,6 +2283,19 @@ xf86HandleConfigFile(void) } } } + + layopt = xf86FindOptionValue(xf86ConfigLayout.options, "PrefBusID"); + if (layopt) { + int bus, device, func; + if (sscanf(layopt, "%d:%d:%d", &bus, &device, &func) == 3) { + xf86PrefBusId.bus = bus; + xf86PrefBusId.device = device; + xf86PrefBusId.func = func; + xf86Msg(X_INFO, + "Preferred PCI BusID set to \"%d:%d:%d\"\n",bus,device,func); + } + } + /* Now process everything else */ diff -Nurp xc/programs/Xserver/hw/xfree86/common/xf86Globals.c xc-changed/programs/Xserver/hw/xfree86/common/xf86Globals.c --- xc/programs/Xserver/hw/xfree86/common/xf86Globals.c 2003-02-20 04:05:14.000000000 +0000 +++ xc-changed/programs/Xserver/hw/xfree86/common/xf86Globals.c 2003-04-02 13:03:00.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-changed/programs/Xserver/hw/xfree86/common/xf86Init.c --- xc/programs/Xserver/hw/xfree86/common/xf86Init.c 2003-02-26 09:21:38.000000000 +0000 +++ xc-changed/programs/Xserver/hw/xfree86/common/xf86Init.c 2003-08-26 14:55:22.000000000 +0100 @@ -1553,6 +1553,22 @@ 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-changed/programs/Xserver/hw/xfree86/common/xf86pciBus.c --- xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2003-02-18 15:42:11.000000000 +0000 +++ xc-changed/programs/Xserver/hw/xfree86/common/xf86pciBus.c 2003-04-02 13:03:00.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-changed/programs/Xserver/hw/xfree86/common/xf86Priv.h --- xc/programs/Xserver/hw/xfree86/common/xf86Priv.h 2002-12-12 18:29:10.000000000 +0000 +++ xc-changed/programs/Xserver/hw/xfree86/common/xf86Priv.h 2003-04-02 13:03:00.000000000 +0100 @@ -53,6 +53,7 @@ extern Bool xf86BestRefresh; extern Gamma xf86Gamma; extern char *xf86ServerName; extern Bool xf86ShowUnresolved; +extern PciBusId xf86PrefBusId; /* Other parameters */