[Nouveau] [PATCH 3/4] nouveau: Check for kms in NvPlatformProbe

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 1 07:40:57 PDT 2012


Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/nv_driver.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/nv_driver.c b/src/nv_driver.c
index 911b05d..c1a50cd 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -57,6 +57,8 @@ static void    NVFreeScreen(FREE_SCREEN_ARGS_DECL);
 
 static Bool	NVMapMem(ScrnInfoPtr pScrn);
 static Bool	NVUnmapMem(ScrnInfoPtr pScrn);
+static Bool	nouveau_kernel_mode_enabled(ScrnInfoPtr pScrn,
+				   struct pci_device *pci_dev);
 
 #define NOUVEAU_PCI_DEVICE(_vendor_id, _device_id)                             \
 	{ (_vendor_id), (_device_id), PCI_MATCH_ANY, PCI_MATCH_ANY,            \
@@ -76,7 +78,9 @@ static Bool NVPciProbe (	DriverPtr 		drv,
 #ifdef XSERVER_PLATFORM_BUS
 static Bool
 NVPlatformProbe(DriverPtr driver,
-            int entity_num, int flags, struct xf86_platform_device *dev, intptr_t dev_match_data)
+		   int entity_num, int flags,
+		   struct xf86_platform_device *dev,
+		   intptr_t dev_match_data)
 {
 	ScrnInfoPtr scrn = NULL;
 	uint32_t scr_flags = 0;
@@ -84,12 +88,17 @@ NVPlatformProbe(DriverPtr driver,
 	if (!dev->pdev)
 		return FALSE;
 
-        if (flags & PLATFORM_PROBE_GPU_SCREEN)
-               scr_flags = XF86_ALLOCATE_GPU_SCREEN;
+	if (flags & PLATFORM_PROBE_GPU_SCREEN)
+		scr_flags = XF86_ALLOCATE_GPU_SCREEN;
 
 	scrn = xf86AllocateScreen(driver, scr_flags);
+	if (!scrn)
+		return FALSE;
 	xf86AddEntityToScreen(scrn, entity_num);
 
+	if (!nouveau_kernel_mode_enabled(scrn, dev->pdev))
+		return FALSE;
+
 	scrn->driverVersion    = NV_VERSION;
 	scrn->driverName       = NV_DRIVER_NAME;
 	scrn->name             = NV_NAME;
@@ -102,7 +111,8 @@ NVPlatformProbe(DriverPtr driver,
 	scrn->EnterVT          = NVEnterVT;
 	scrn->LeaveVT          = NVLeaveVT;
 	scrn->FreeScreen       = NVFreeScreen;
-	return scrn != NULL;
+
+	return TRUE;
 }
 #endif
 
-- 
1.8.0



More information about the Nouveau mailing list