On Wed, 2010-06-02 at 12:07 -0700, Aaron Plattner wrote:
> On Wed, Jun 02, 2010 at 09:20:47AM -0700, Marcin Slusarz wrote:
> > On Fri, May 28, 2010 at 11:45:17AM -0700, Aaron Plattner wrote:
> > > On Sun, May 23, 2010 at 03:37:03PM -0700, Ben Skeggs wrote:
> > > > On Sun, 2010-05-23 at 21:46 +0200, Marcin Slusarz wrote:
> > > > > 1) DRICreatePCIBusID belongs to xserver dri module, so when it's
> > > > >    unavailable we can't format string for 
> > > > > drmCheckModesettingSupported.
> > > > >    (This situation happened to me with KMS enabled and dri module 
> > > > > moved
> > > > >    somewhere else by Gentoo's "eselect opengl set nvidia" switcher)
> > > > >    Open code DRICreatePCIBusID to drop dri dependency.
> > > > > 2) Once we dropped dependency on dri module (which linked to libdrm),
> > > > >    we have to link directly to libdrm.
> > > > An alternative, which we use in Fedora for nv/vesa is to use
> > > > pci_device_has_kernel_driver() from libpciaccess.
> > > 
> > > That seems better than open-coding it, and avoids a dependency on libdrm
> > > which is nice.
> > 
> > Well, you are trading one dependency for other. It doesn't really matter...
> > Ben, are you going to send your patch to Aaron?
> 
> Yeah, but the server already has a dependency on libpciaccess, while the
> libdrm dependency is just for a module, and I think might be optional (I
> haven't kept up with the dri2 patches on the list).
Exactly.  Patch is attached, but it was readily available in Fedora CVS
anyway.

Ben.
> 
> -- Aaron

>From ee544c2b11ab327abab6e205425e6eafe961de2e Mon Sep 17 00:00:00 2001
From: Ben Skeggs <bske...@redhat.com>
Date: Fri, 28 Aug 2009 09:43:16 +1000
Subject: [PATCH] nv: refuse to load if there's a kernel driver bound to the device already

---
 src/nv_driver.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/nv_driver.c b/src/nv_driver.c
index a7cf2dc..6f7fc0e 100644
--- a/src/nv_driver.c
+++ b/src/nv_driver.c
@@ -780,6 +780,12 @@ NVPciProbe(DriverPtr drv, int entity, struct pci_device *dev, intptr_t data)
                       NVGetPCIXpressChip(dev) : dev->vendor_id << 16 | dev->device_id;
     const char *name = xf86TokenToString(NVKnownChipsets, id);
 
+    if (pci_device_has_kernel_driver(dev)) {
+	ErrorF("The PCI device has a kernel module claiming it.\n");
+	ErrorF("This driver cannot operate until it has been unloaded\n");
+	return FALSE;
+    }
+
     if(dev->vendor_id == PCI_VENDOR_NVIDIA && !name &&
        !NVIsSupported(id) && !NVIsG80(id)) {
         /* See if pci.ids knows what the heck this thing is */
-- 
1.6.4

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

Reply via email to