From 6829d4c672fc05f4d3d993ac1bfde21d4b6c1200 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Sat, 14 Mar 2015 11:58:12 +0100 Subject: Make the ddx load with platform devices Signed-off-by: Maarten Lankhorst --- src/nv_driver.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/nv_driver.c b/src/nv_driver.c index e726292..8e2ae03 100644 --- a/src/nv_driver.c +++ b/src/nv_driver.c @@ -21,6 +21,7 @@ */ #include +#include #include "nv_include.h" @@ -299,21 +300,21 @@ NVOpenNouveauDevice(struct pci_device *pci_dev, char *busid; int ret, fd = -1; +#ifdef ODEV_ATTRIB_PATH + if (platform_dev) + busid = NULL; + else +#endif + { #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,9,99,901,0) - XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d", - pci_dev->domain, pci_dev->bus, pci_dev->dev, pci_dev->func); + XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d", + pci_dev->domain, pci_dev->bus, + pci_dev->dev, pci_dev->func); #else - busid = XNFprintf("pci:%04x:%02x:%02x.%d", - pci_dev->domain, pci_dev->bus, pci_dev->dev, pci_dev->func); + busid = XNFprintf("pci:%04x:%02x:%02x.%d", + pci_dev->domain, pci_dev->bus, + pci_dev->dev, pci_dev->func); #endif - - if (probe) { - ret = drmCheckModesettingSupported(busid); - if (ret) { - xf86DrvMsg(scrnIndex, X_ERROR, "[drm] KMS not enabled\n"); - free(busid); - return NULL; - } } #if defined(ODEV_ATTRIB_FD) @@ -323,6 +324,19 @@ NVOpenNouveauDevice(struct pci_device *pci_dev, #endif if (fd != -1) ret = nouveau_device_wrap(fd, 0, &dev); +#ifdef ODEV_ATTRIB_PATH + else if (platform_dev) { + const char *path; + + path = xf86_get_platform_device_attrib(platform_dev, + ODEV_ATTRIB_PATH); + + fd = open(path, O_RDWR | O_CLOEXEC); + ret = nouveau_device_wrap(fd, 1, &dev); + if (ret) + close(fd); + } +#endif else ret = nouveau_device_open(busid, &dev); if (ret) @@ -417,9 +431,6 @@ NVPlatformProbe(DriverPtr driver, ScrnInfoPtr scrn = NULL; uint32_t scr_flags = 0; - if (!dev->pdev) - return FALSE; - if (!NVHasKMS(dev->pdev, dev)) return FALSE; -- cgit v1.2.3