Skip to contentSkip to conversation

config: fix GPUDevice fail when AutoAddGPU off + BusID

PATCH In review Qiang Yu 2 participants 2 messages Sep 8, 2016 – Sep 14, 2016 1 message not in the archive

lore
Share & tools
lore

Qiang Yu

author
#0 lore raw

PATCH 1/1 config: fix GPUDevice fail when AutoAddGPU off + BusID

This fix is for the following xorg.conf can work:

Section "ServerFlags"
Option "AutoAddGPU" "off"
EndSection

Section "Device"

        Identifier "Amd"
        Driver "ati"
        BusID "PCI:1:0:0"

EndSection

Section "Device"

        Identifier "Intel"
        Driver "modesetting"
        BusID "pci:0:2:0"

EndSection

Section "Screen"
Identifier "Screen0"
Device "Intel"
GPUDevice "Amd"
EndSection

Without AutoAddGPU off, modesetting DDX will also be loaded for GPUDevice.

---
 hw/xfree86/common/xf86platformBus.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
hw/xfree86/common/xf86platformBus.c +15 -3
index 96895a6..03fd931 100644
@@ -418,6 +418,19 @@ probeSingleDevice(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev
     return foundScreen;
 }
 
+static Bool
+isGPUDevice(GDevPtr gdev)
+{
+    int i;
+
+    for (i = 0; i < gdev->myScreenSection->num_gpu_devices; i++) {
+        if (gdev == gdev->myScreenSection->gpu_devices[i])
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
 int
 xf86platformProbeDev(DriverPtr drvp)
 {
@@ -450,9 +463,8 @@ xf86platformProbeDev(DriverPtr drvp)
         if (j == xf86_num_platform_devices)
              continue;
 
-        foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i], 0);
-        if (!foundScreen)
-            continue;
+        foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i],
+                                        isGPUDevice(devList[i]) ? PLATFORM_PROBE_GPU_SCREEN : 0);
     }
 
     /* if autoaddgpu devices is enabled then go find any unclaimed platform
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1473341098-23457-1-git-send-email-Qiang.Yu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 57 lines · Qiang Yu

This fix is for the following xorg.conf can work:

Section "ServerFlags"
Option "AutoAddGPU" "off"
EndSection

Section "Device"

        Identifier "Amd"
        Driver "ati"
        BusID "PCI:1:0:0"

EndSection

Section "Device"

        Identifier "Intel"
        Driver "modesetting"
        BusID "pci:0:2:0"

EndSection

Section "Screen"
Identifier "Screen0"
Device "Intel"
GPUDevice "Amd"
EndSection

Without AutoAddGPU off, modesetting DDX will also be loaded for GPUDevice.

---
 hw/xfree86/common/xf86platformBus.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
hw/xfree86/common/xf86platformBus.c +13 -0
index 96895a6..03fd931 100644
@@ -418,6 +418,19 @@ probeSingleDevice(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev
     return foundScreen;
 }
 
+static Bool
+isGPUDevice(GDevPtr gdev)
+{
+    int i;
+
+    for (i = 0; i < gdev->myScreenSection->num_gpu_devices; i++) {
+        if (gdev == gdev->myScreenSection->gpu_devices[i])
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
 int
 xf86platformProbeDev(DriverPtr drvp)
 {

hw/xfree86/common/xf86platformBus.c xf86platformProbeDev(DriverPtr drvp) · line 467

Quoted 8 lines
hw/xfree86/common/xf86platformBus.c +2 -3
@@ -450,9 +463,8 @@ xf86platformProbeDev(DriverPtr drvp)
         if (j == xf86_num_platform_devices)
              continue;
 
-        foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i], 0);
-        if (!foundScreen)
-            continue;
+        foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i],
+                                        isGPUDevice(devList[i]) ? PLATFORM_PROBE_GPU_SCREEN : 0);

The last line is a bit long, maybe move "PLATFORM_PROBE_GPU_SCREEN : 0" to the next line. Either way,

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx