]> Pileus Git - ~andy/linux/commitdiff
drm/i915: disable drm agp support for !gen3 with kms enabled
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 25 Jun 2012 13:58:49 +0000 (15:58 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 25 Jun 2012 19:10:14 +0000 (21:10 +0200)
This is the quick&dirty way Dave Airlie suggested to workaround the
midlayer drm agp brain-damange. Note that i915_probe is only called
when the driver has ksm enabled, so no need to check for that.

We also need to move the intel_agp_enabled check at the right place.
Note that the only thing this does is enforce the correct module load
order (by using a symbol from intel-agp.ko) to ensure that the fake
agp driver is ready before the drm core tries to set up the agp stuff.

v2: Add a comment to explain why gen3 needs all this legacy fake agp
stuff - we've shipped an XvMC library with a kms-enabled ddx that
requires it (but only on gen3).

v3: Make it clear that this is only a gen3 issue in the comment.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_drv.c

index a378c0800304fbafd6b925312d3914763ca2d177..79be8799ea6ca6794b945eb2eb047c1e923c4a5c 100644 (file)
@@ -930,10 +930,12 @@ int i915_reset(struct drm_device *dev)
        return 0;
 }
 
-
 static int __devinit
 i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
+       struct intel_device_info *intel_info =
+               (struct intel_device_info *) ent->driver_data;
+
        /* Only bind to function 0 of the device. Early generations
         * used function 1 as a placeholder for multi-head. This causes
         * us confusion instead, especially on the systems where both
@@ -942,6 +944,18 @@ i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (PCI_FUNC(pdev->devfn))
                return -ENODEV;
 
+       /* We've managed to ship a kms-enabled ddx that shipped with an XvMC
+        * implementation for gen3 (and only gen3) that used legacy drm maps
+        * (gasp!) to share buffers between X and the client. Hence we need to
+        * keep around the fake agp stuff for gen3, even when kms is enabled. */
+       if (intel_info->gen != 3) {
+               driver.driver_features &=
+                       ~(DRIVER_USE_AGP | DRIVER_REQUIRE_AGP);
+       } else if (!intel_agp_enabled) {
+               DRM_ERROR("drm/i915 can't work without intel_agp module!\n");
+               return -ENODEV;
+       }
+
        return drm_get_pci_dev(pdev, ent, &driver);
 }
 
@@ -1102,11 +1116,6 @@ static struct pci_driver i915_pci_driver = {
 
 static int __init i915_init(void)
 {
-       if (!intel_agp_enabled) {
-               DRM_ERROR("drm/i915 can't work without intel_agp module!\n");
-               return -ENODEV;
-       }
-
        driver.num_ioctls = i915_max_ioctl;
 
        /*