xorg-server:

- add patch from debian: primary vga hack
This commit is contained in:
Stephan Raue 2009-09-28 14:40:37 +02:00
parent d25fcf4d69
commit 083e043518

View File

@ -0,0 +1,91 @@
diff -Naur xorg-server-1.6.99.902.orig/hw/xfree86/common/xf86pciBus.c xorg-server-1.6.99.902/hw/xfree86/common/xf86pciBus.c
--- xorg-server-1.6.99.902.orig/hw/xfree86/common/xf86pciBus.c 2009-09-26 14:12:03.000000000 +0200
+++ xorg-server-1.6.99.902/hw/xfree86/common/xf86pciBus.c 2009-09-26 19:11:42.000000000 +0200
@@ -52,13 +52,7 @@
/* Bus-specific globals */
Bool pciSlotClaimed = FALSE;
-#define PCIINFOCLASSES(c) \
- ( (((c) & 0x00ff0000) == (PCI_CLASS_PREHISTORIC << 16)) \
- || (((c) & 0x00ff0000) == (PCI_CLASS_DISPLAY << 16)) \
- || ((((c) & 0x00ffff00) \
- == ((PCI_CLASS_MULTIMEDIA << 16) | (PCI_SUBCLASS_MULTIMEDIA_VIDEO << 8)))) \
- || ((((c) & 0x00ffff00) \
- == ((PCI_CLASS_PROCESSOR << 16) | (PCI_SUBCLASS_PROCESSOR_COPROC << 8)))) )
+#define PCIINFOCLASSES(c) (((c) & 0x00ffff00) == (PCI_CLASS_DISPLAY << 16))
/*
* PCI classes that have messages printed always. The others are only
@@ -85,6 +79,40 @@
sprintf(buffer, "%d@%d", busnum & 0x00ff, busnum >> 8);
}
+/* oh god what have i done */
+static Bool
+looks_like_bios_primary(struct pci_device *info)
+{
+ unsigned char *bios;
+ unsigned short vendor, device;
+ int offset;
+ Bool ret = FALSE;
+
+ bios = xf86MapVidMem(-1, VIDMEM_MMIO, 0xc0000, 0x10000);
+ if (!bios)
+ return FALSE;
+
+ if (bios[0] != 0x55 || bios[1] != 0xAA)
+ goto out;
+
+ offset = (bios[0x19] << 8) + bios[0x18];
+
+ if (bios[offset] != 'P' ||
+ bios[offset+1] != 'C' ||
+ bios[offset+2] != 'I' ||
+ bios[offset+3] != 'R')
+ goto out;
+
+ vendor = (bios[offset+5] << 8) + bios[offset+4];
+ device = (bios[offset+7] << 8) + bios[offset+6];
+
+ ret = (info->vendor_id == vendor) && (info->device_id == device);
+
+out:
+ xf86UnMapVidMem(-1, bios, 0x10000);
+ return ret;
+}
+
/*
* xf86Bus.c interface
*/
@@ -132,17 +160,25 @@
uint16_t command;
info = xf86PciVideoInfo[i];
+ if (!IS_VGA(info->device_class))
+ continue;
+
pci_device_cfg_read_u16(info, & command, 4);
- if ((command & PCI_CMD_MEM_ENABLE)
- && ((num == 1) || IS_VGA(info->device_class))) {
- if (primaryBus.type == BUS_NONE) {
+ if ((command & PCI_CMD_MEM_ENABLE)) {
+ if (num == 1) {
primaryBus.type = BUS_PCI;
primaryBus.id.pci = info;
- } else {
- xf86Msg(X_NOTICE,
+ break;
+ } else if (looks_like_bios_primary(info)) {
+ if (primaryBus.type == BUS_NONE) {
+ primaryBus.type = BUS_PCI;
+ primaryBus.id.pci = info;
+ } else {
+ xf86Msg(X_NOTICE,
"More than one possible primary device found\n");
- primaryBus.type ^= (BusType)(-1);
+ primaryBus.type ^= (BusType)(-1);
+ }
}
}
}