[Nouveau] [PATCHv2] nouveau: call drmCheckModesettingSupported after opening the device

Emil Velikov emil.l.velikov at gmail.com
Mon Feb 18 14:14:55 PST 2013


If the kernel module is not yet loaded X will fail to load with
"[drm] KMS not enabled". Some of the cases which may lead to this are

* using hotplug
* blacklisted nouveau

The issue was caused by commit

    commit e34cfbd5bd23f7f15372af52d8a39a5715ce7310
    Author: Emil Velikov <emil.l.velikov at gmail.com>
    Date:   Fri Nov 2 03:57:41 2012 +0000

        nouveau: Factor out common code to NVHasKMS()

        As the name suggests checks if it has kernel mode setting,
        prints out the interface version and checkes if the chipset
        is supported

        Function is used in NVPciProbe and NVPlatformProbe

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60772
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
v2: More sensible commit message

 src/nv_driver.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/nv_driver.c b/src/nv_driver.c
index 9f62fe2..b1410f5 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -260,17 +260,10 @@ NVHasKMS(struct pci_device *pci_dev)
 	}
 	busid = DRICreatePCIBusID(pci_dev);
 
-	ret = drmCheckModesettingSupported(busid);
-	if (ret) {
-		xf86DrvMsg(-1, X_ERROR, "[drm] KMS not enabled\n");
-		free(busid);
-		return FALSE;
-	}
-
 	ret = nouveau_device_open(busid, &dev);
-	free(busid);
 	if (ret) {
 		xf86DrvMsg(-1, X_ERROR, "[drm] failed to open device\n");
+		free(busid);
 		return FALSE;
 	}
 
@@ -288,6 +281,12 @@ NVHasKMS(struct pci_device *pci_dev)
 	chipset = dev->chipset;
 	nouveau_device_del(&dev);
 
+	ret = drmCheckModesettingSupported(busid);
+	free(busid);
+	if (ret) {
+		xf86DrvMsg(-1, X_ERROR, "[drm] KMS not enabled\n");
+		return FALSE;
+	}
 
 	switch (chipset & 0xf0) {
 	case 0x00:
-- 
1.8.1.3



More information about the Nouveau mailing list