From: Emil Velikov Subject: [PATCHv2] nouveau: call drmCheckModesettingSupported after opening the device Date: Mon, 18 Feb 2013 22:14:55 +0000 Message-ID: <1361225695-6797-1-git-send-email-emil.l.velikov@gmail.com> References: <1361047727-740-2-git-send-email-emil.l.velikov@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1361047727-740-2-git-send-email-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: nouveau-bounces+gcfxn-nouveau=m.gmane.org-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org 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 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 --- 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