summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2012-05-02 15:02:41 +0100
committerDave Airlie <airlied@redhat.com>2012-05-02 15:02:41 +0100
commit89a2627052f5d5c5ab4e7f53c77a789ef9459722 (patch)
tree6d5226763617d5f8f7dcf885b4c8bf5ee3d1150f
parent072f3462d0424dd8a6c560c7de9a793a11ce764c (diff)
add udev probe
-rw-r--r--src/nv_driver.c50
-rw-r--r--src/nv_include.h2
2 files changed, 49 insertions, 3 deletions
diff --git a/src/nv_driver.c b/src/nv_driver.c
index f021d17..81358db 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -73,6 +73,51 @@ static Bool NVPciProbe ( DriverPtr drv,
struct pci_device *dev,
intptr_t match_data );
+static Bool nouveau_driver_func(ScrnInfoPtr pScrn,
+ xorgDriverFuncOp op,
+ pointer ptr)
+{
+ xorgHWFlags *flag;
+
+ switch (op) {
+ case GET_REQUIRED_HW_INTERFACES:
+ flag = (CARD32*)ptr;
+ (*flag) = 0;
+ return TRUE;
+ case GET_DRV_MODEL_V2_SUPPORT:
+ return TRUE;
+ default:
+ /* Unknown or deprecated function */
+ return FALSE;
+ }
+}
+
+static Bool
+NVUdevProbe(DriverPtr driver,
+ int entity_num, struct xf86_udev_device *dev, intptr_t dev_match_data)
+{
+ ScrnInfoPtr scrn = NULL;
+ if (dev->pdev)
+ return FALSE;
+
+ scrn = xf86AllocateGPUScreen(driver, 0);
+ xf86AddEntityToScreen(scrn, entity_num);
+
+ scrn->driverVersion = NV_VERSION;
+ scrn->driverName = NV_DRIVER_NAME;
+ scrn->name = NV_NAME;
+
+ scrn->Probe = NULL;
+ scrn->PreInit = NVPreInit;
+ scrn->ScreenInit = NVScreenInit;
+ scrn->SwitchMode = NVSwitchMode;
+ scrn->AdjustFrame = NVAdjustFrame;
+ scrn->EnterVT = NVEnterVT;
+ scrn->LeaveVT = NVLeaveVT;
+ scrn->FreeScreen = NVFreeScreen;
+
+ return scrn != NULL;
+}
/*
* This contains the functions needed by the server after loading the
* driver module. It must be supplied, and gets added the driver list by
@@ -89,9 +134,10 @@ _X_EXPORT DriverRec NV = {
NVAvailableOptions,
NULL,
0,
- NULL,
+ nouveau_driver_func,
nouveau_device_match,
- NVPciProbe
+ NVPciProbe,
+ NVUdevProbe,
};
struct NvFamily
diff --git a/src/nv_include.h b/src/nv_include.h
index 0d104a3..24aa574 100644
--- a/src/nv_include.h
+++ b/src/nv_include.h
@@ -19,7 +19,7 @@
/* Drivers that need to access the PCI config space directly need this */
#include "xf86Pci.h"
-
+#include "xf86udev.h"
/* All drivers initialising the SW cursor need this */
#include "mipointer.h"