From 01a41e6186c20cb2e5a52f651627ac75119962e6 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sat, 16 Feb 2013 18:06:58 +0000 Subject: [PATCH] nouveau: Check if the device supports modesetting, after opening it "Regression" caused by commit e34cfbd5bd23f7f15372af52d8a39a5715ce7310 Author: Emil Velikov 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 Without this change X will fail with '[drm] KMS not enabled' if the kernel module is not loaded Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60772 Signed-off-by: Emil Velikov --- 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