[Intel-gfx] [PATCH 02/12] drm: kill the REQUIRE_AGP driver flag

Daniel Vetter daniel.vetter at ffwll.ch
Thu Jun 7 15:55:54 CEST 2012


Only i810 and i915 use this. But now that the driver's ->load function
is responsible for setting up agp, we can simply move this check in
there.

Signed-Off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/drm_pci.c       |    6 +-----
 drivers/gpu/drm/i810/i810_dma.c |    5 +++++
 drivers/gpu/drm/i810/i810_drv.c |    2 +-
 drivers/gpu/drm/i915/i915_dma.c |    5 +++++
 drivers/gpu/drm/i915/i915_drv.c |    2 +-
 include/drm/drmP.h              |    1 -
 6 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
index 833e599..59e11e4 100644
--- a/drivers/gpu/drm/drm_pci.c
+++ b/drivers/gpu/drm/drm_pci.c
@@ -271,11 +271,7 @@ int drm_pci_agp_init(struct drm_device *dev)
 	if (drm_core_has_AGP(dev)) {
 		if (drm_pci_device_is_agp(dev))
 			dev->agp = drm_agp_init(dev);
-		if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP)
-		    && (dev->agp == NULL)) {
-			DRM_ERROR("Cannot initialize the agpgart module.\n");
-			return -EINVAL;
-		}
+
 		if (drm_core_has_MTRR(dev)) {
 			if (dev->agp)
 				dev->agp->agp_mtrr =
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index eed1126..751d767 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -1204,6 +1204,11 @@ int i810_driver_load(struct drm_device *dev, unsigned long flags)
 	if (ret)
 		return ret;
 
+	if (!dev->agp) {
+		DRM_ERROR("Cannot initialize the agpgart module.\n");
+		return -EINVAL;
+	}
+
 	/* i810 has 4 more counters */
 	dev->counters += 4;
 	dev->types[6] = _DRM_STAT_IRQ;
diff --git a/drivers/gpu/drm/i810/i810_drv.c b/drivers/gpu/drm/i810/i810_drv.c
index ec12f7d..6419182 100644
--- a/drivers/gpu/drm/i810/i810_drv.c
+++ b/drivers/gpu/drm/i810/i810_drv.c
@@ -56,7 +56,7 @@ static const struct file_operations i810_driver_fops = {
 
 static struct drm_driver driver = {
 	.driver_features =
-	    DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
+	    DRIVER_USE_AGP | DRIVER_USE_MTRR |
 	    DRIVER_HAVE_DMA | DRIVER_DMA_QUEUE,
 	.dev_priv_size = sizeof(drm_i810_buf_priv_t),
 	.load = i810_driver_load,
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index b97ef73..494b9cb 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1426,6 +1426,11 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	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. */
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 238a521..e98501d 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1038,7 +1038,7 @@ static struct drm_driver driver = {
 	 * deal with them for Intel hardware.
 	 */
 	.driver_features =
-	    DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | /* DRIVER_USE_MTRR |*/
+	    DRIVER_USE_AGP | /* DRIVER_USE_MTRR |*/
 	    DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME,
 	.load = i915_driver_load,
 	.unload = i915_driver_unload,
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index e3437da..9906487 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -138,7 +138,6 @@ int drm_err(const char *func, const char *format, ...);
 
 /* driver capabilities and requirements mask */
 #define DRIVER_USE_AGP     0x1
-#define DRIVER_REQUIRE_AGP 0x2
 #define DRIVER_USE_MTRR    0x4
 #define DRIVER_PCI_DMA     0x8
 #define DRIVER_SG          0x10
-- 
1.7.7.6




More information about the Intel-gfx mailing list