6c7b302
From ab1a65b7755d081b41188104b21f4d21eaa3187b Mon Sep 17 00:00:00 2001
6c7b302
From: Hans De Goede <hdegoede@redhat.com>
6c7b302
Date: Mon, 12 Dec 2016 17:03:15 +0100
6c7b302
Subject: [PATCH xserver 4/6] xfree86: xf86platformProbe: split finding
6c7b302
 pci-info and setting primary GPU
6c7b302
6c7b302
This is a preparation patch for allowing an OutputClass section to
6c7b302
override the default primary GPU device selection.
6c7b302
6c7b302
Reviewed-by: Adam Jackson <ajax@redhat.com>
6c7b302
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
6c7b302
---
6c7b302
 hw/xfree86/common/xf86platformBus.c | 23 +++++++++++++++--------
6c7b302
 1 file changed, 15 insertions(+), 8 deletions(-)
6c7b302
6c7b302
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
6c7b302
index a698c6c..39b3248 100644
6c7b302
--- a/hw/xfree86/common/xf86platformBus.c
6c7b302
+++ b/hw/xfree86/common/xf86platformBus.c
6c7b302
@@ -145,16 +145,9 @@ platform_find_pci_info(struct xf86_platform_device *pd, char *busid)
6c7b302
 
6c7b302
     iter = pci_slot_match_iterator_create(&devmatch);
6c7b302
     info = pci_device_next(iter);
6c7b302
-    if (info) {
6c7b302
+    if (info)
6c7b302
         pd->pdev = info;
6c7b302
-        pci_device_probe(info);
6c7b302
-        if (pci_device_is_boot_vga(info)) {
6c7b302
-            primaryBus.type = BUS_PLATFORM;
6c7b302
-            primaryBus.id.plat = pd;
6c7b302
-        }
6c7b302
-    }
6c7b302
     pci_iterator_destroy(iter);
6c7b302
-
6c7b302
 }
6c7b302
 
6c7b302
 static Bool
6c7b302
@@ -307,6 +300,20 @@ xf86platformProbe(void)
6c7b302
             platform_find_pci_info(&xf86_platform_devices[i], busid);
6c7b302
         }
6c7b302
     }
6c7b302
+
6c7b302
+    for (i = 0; i < xf86_num_platform_devices; i++) {
6c7b302
+        struct xf86_platform_device *dev = &xf86_platform_devices[i];
6c7b302
+
6c7b302
+        if (!dev->pdev)
6c7b302
+            continue;
6c7b302
+
6c7b302
+        pci_device_probe(dev->pdev);
6c7b302
+        if (pci_device_is_boot_vga(dev->pdev)) {
6c7b302
+            primaryBus.type = BUS_PLATFORM;
6c7b302
+            primaryBus.id.plat = dev;
6c7b302
+        }
6c7b302
+    }
6c7b302
+
6c7b302
     return 0;
6c7b302
 }
6c7b302
 
6c7b302
-- 
6c7b302
2.9.3
6c7b302