[Intel-gfx] [PATCH] drm/i915: only enable drm agp support when required

Daniel Vetter daniel.vetter at ffwll.ch
Tue Jun 12 13:19:56 CEST 2012


We need it for all things ums (which essentially only means up to
gen5) and to support b0rked XvMC userspace on gen3.

v2: Fixup error paths as noticed by Jani Nikula.

Signed-Off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/i915/i915_dma.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index e4203df..1f6a36a 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1422,15 +1422,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	int ret = 0, mmio_bar;
 	uint32_t aperture_size;
 
-	ret = drm_pci_agp_init(dev);
-	if (ret)
-		return ret;
-
-	if (!dev->agp) {
-		DRM_ERROR("Cannot initialize the agpgart module.\n");
-		return -EINVAL;
-	}
-
 	info = (struct intel_device_info *) flags;
 
 	/* Refuse to load on gen6+ without kms enabled. */
@@ -1453,6 +1444,19 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	dev_priv->dev = dev;
 	dev_priv->info = info;
 
+	if (!drm_core_check_feature(dev, DRIVER_MODESET) ||
+	    IS_GEN3(dev)) {
+		ret = drm_pci_agp_init(dev);
+		if (ret)
+			goto free_priv;
+
+		if (!dev->agp) {
+			DRM_ERROR("Cannot initialize the agpgart module.\n");
+			ret = -EINVAL;
+			goto free_priv;
+		}
+	}
+
 	if (i915_get_bridge_dev(dev)) {
 		ret = -EIO;
 		goto free_priv;
-- 
1.7.7.6




More information about the Intel-gfx mailing list