diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-06-08 09:55:40 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-06-12 16:19:49 -0400 |
commit | 14be93ddff61eb196382aeaa3ac86f4db844aeb0 (patch) | |
tree | 0cfde7c3f444899508e2d07adb4245d4eb33216b /drivers/gpu/drm/i915/i915_dma.c | |
parent | 7e8f6306fe155d6fc3fe99d666be95b4ed24427d (diff) |
drm/i915 + agp/intel-gtt: prep work for direct setup
To be able to directly set up the intel-gtt code from drm/i915 and
avoid setting up the fake-agp driver we need to prepare a few things:
- pass both the bridge and gpu pci_dev to the probe function and add
code to handle the gpu pdev both being present (for drm/i915) and
not present (fake agp).
- add refcounting to the remove function so that unloading drm/i915
doesn't kill the fake agp driver
v2: Fix up the cleanup and refcount, noticed by Jani Nikula.
Reviewed-by: Jani Nikula <jani.nikula@linux.intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index c639d431ad66..cf512e7178b4 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1474,11 +1474,18 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1474 | goto put_bridge; | 1474 | goto put_bridge; |
1475 | } | 1475 | } |
1476 | 1476 | ||
1477 | ret = intel_gmch_probe(dev_priv->bridge_dev, dev->pdev, NULL); | ||
1478 | if (!ret) { | ||
1479 | DRM_ERROR("failed to set up gmch\n"); | ||
1480 | ret = -EIO; | ||
1481 | goto out_rmmap; | ||
1482 | } | ||
1483 | |||
1477 | dev_priv->mm.gtt = intel_gtt_get(); | 1484 | dev_priv->mm.gtt = intel_gtt_get(); |
1478 | if (!dev_priv->mm.gtt) { | 1485 | if (!dev_priv->mm.gtt) { |
1479 | DRM_ERROR("Failed to initialize GTT\n"); | 1486 | DRM_ERROR("Failed to initialize GTT\n"); |
1480 | ret = -ENODEV; | 1487 | ret = -ENODEV; |
1481 | goto out_rmmap; | 1488 | goto put_gmch; |
1482 | } | 1489 | } |
1483 | 1490 | ||
1484 | aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | 1491 | aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; |
@@ -1489,7 +1496,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1489 | aperture_size); | 1496 | aperture_size); |
1490 | if (dev_priv->mm.gtt_mapping == NULL) { | 1497 | if (dev_priv->mm.gtt_mapping == NULL) { |
1491 | ret = -EIO; | 1498 | ret = -EIO; |
1492 | goto out_rmmap; | 1499 | goto put_gmch; |
1493 | } | 1500 | } |
1494 | 1501 | ||
1495 | i915_mtrr_setup(dev_priv, dev_priv->mm.gtt_base_addr, | 1502 | i915_mtrr_setup(dev_priv, dev_priv->mm.gtt_base_addr, |
@@ -1611,6 +1618,8 @@ out_mtrrfree: | |||
1611 | dev_priv->mm.gtt_mtrr = -1; | 1618 | dev_priv->mm.gtt_mtrr = -1; |
1612 | } | 1619 | } |
1613 | io_mapping_free(dev_priv->mm.gtt_mapping); | 1620 | io_mapping_free(dev_priv->mm.gtt_mapping); |
1621 | put_gmch: | ||
1622 | intel_gmch_remove(); | ||
1614 | out_rmmap: | 1623 | out_rmmap: |
1615 | pci_iounmap(dev->pdev, dev_priv->regs); | 1624 | pci_iounmap(dev->pdev, dev_priv->regs); |
1616 | put_bridge: | 1625 | put_bridge: |