summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2005-05-27 23:42:11 +0000
committerIan Romanick <idr@us.ibm.com>2005-05-27 23:42:11 +0000
commit4a84416c458027462ee6112a5fa442415597f6c2 (patch)
treecd39aea11afea9b04442e5a818b220e40b3c70b9
parentc9abd2fec509c271339d1ca3addd95df884df80a (diff)
Modify drm_driver::device_is_agp to return a tri-state value to indicate
that a device absolutely is, absolutely is not, or may or may not be AGP. Modify the i915 DRM to use this to force all i9x5 devices to be "AGP" (even the PCI-e devices). Reported by: Lukas Hejtmanek
-rw-r--r--bsd-core/drmP.h6
-rw-r--r--bsd-core/drm_agpsupport.c9
-rw-r--r--bsd-core/i915_drv.c1
-rw-r--r--linux-core/drmP.h15
-rw-r--r--linux-core/i915_drv.c1
-rw-r--r--linux-core/mga_drv.c5
-rw-r--r--shared-core/i915_dma.c16
-rw-r--r--shared-core/i915_drv.h1
8 files changed, 41 insertions, 13 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 9943a4f6..8d648f65 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -644,8 +644,10 @@ struct drm_device {
*
* \param dev DRM device handle
*
- * \returns true if the card really is attached to AGP, false
- * otherwise.
+ * \returns
+ * One of three values is returned depending on whether or not the
+ * card is absolutely \b not AGP (return of 0), absolutely \b is AGP
+ * (return of 1), or may or may not be AGP (return of 2).
*/
int (*device_is_agp) (struct drm_device * dev);
diff --git a/bsd-core/drm_agpsupport.c b/bsd-core/drm_agpsupport.c
index 33fb3f0c..540cb402 100644
--- a/bsd-core/drm_agpsupport.c
+++ b/bsd-core/drm_agpsupport.c
@@ -47,9 +47,12 @@ drm_device_is_agp(drm_device_t *dev)
u_int8_t ptr, next;
- if ( (dev->driver->device_is_agp != NULL)
- && ! (*dev->driver->device_is_agp)( dev ) ) {
- return 0;
+ if ( dev->driver->device_is_agp != NULL ) {
+ int err = (*dev->driver->device_is_agp)( dev );
+
+ if (err != 2) {
+ return err;
+ }
}
/*
diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c
index bb674fa6..e2c58c7f 100644
--- a/bsd-core/i915_drv.c
+++ b/bsd-core/i915_drv.c
@@ -48,6 +48,7 @@ static void i915_configure(drm_device_t *dev)
dev->dev_priv_size = 1; /* No dev_priv */
dev->prerelease = i915_driver_prerelease;
dev->pretakedown = i915_driver_pretakedown;
+ dev->device_is_agp = i915_driver_device_is_agp,
dev->irq_preinstall = i915_driver_irq_preinstall;
dev->irq_postinstall = i915_driver_irq_postinstall;
dev->irq_uninstall = i915_driver_irq_uninstall;
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 167bef0f..24d8a23b 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -548,8 +548,10 @@ struct drm_driver {
*
* \param dev DRM device handle
*
- * \returns true if the card really is attached to AGP, false
- * otherwise.
+ * \returns
+ * One of three values is returned depending on whether or not the
+ * card is absolutely \b not AGP (return of 0), absolutely \b is AGP
+ * (return of 1), or may or may not be AGP (return of 2).
*/
int (*device_is_agp) (struct drm_device * dev);
@@ -1028,9 +1030,12 @@ static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev,
static __inline__ int drm_device_is_agp(drm_device_t *dev)
{
- if ( (dev->driver->device_is_agp != NULL)
- && ! (*dev->driver->device_is_agp)( dev ) ) {
- return 0;
+ if ( dev->driver->device_is_agp != NULL ) {
+ int err = (*dev->driver->device_is_agp)( dev );
+
+ if (err != 2) {
+ return err;
+ }
}
return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP);
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index 7256cb3c..d09b9d43 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -60,6 +60,7 @@ static struct drm_driver driver = {
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
.pretakedown = i915_driver_pretakedown,
.prerelease = i915_driver_prerelease,
+ .device_is_agp = i915_driver_device_is_agp,
.irq_preinstall = i915_driver_irq_preinstall,
.irq_postinstall = i915_driver_irq_postinstall,
.irq_uninstall = i915_driver_irq_uninstall,
diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c
index c04de5a3..c8bb042d 100644
--- a/linux-core/mga_drv.c
+++ b/linux-core/mga_drv.c
@@ -148,8 +148,7 @@ MODULE_LICENSE("GPL and additional rights");
* \param dev The device to be tested.
*
* \returns
- * If the device is a PCI G450, zero is returned. Otherwise non-zero is
- * returned.
+ * If the device is a PCI G450, zero is returned. Otherwise 2 is returned.
*/
int mga_driver_device_is_agp(drm_device_t * dev)
{
@@ -176,5 +175,5 @@ int mga_driver_device_is_agp(drm_device_t * dev)
return 0;
}
- return 1;
+ return 2;
}
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c
index 9c27706b..03ee2394 100644
--- a/shared-core/i915_dma.c
+++ b/shared-core/i915_dma.c
@@ -726,3 +726,19 @@ drm_ioctl_desc_t i915_ioctls[] = {
};
int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);
+
+/**
+ * Determine if the device really is AGP or not.
+ *
+ * All Intel graphics chipsets are treated as AGP, even if they are really
+ * PCI-e.
+ *
+ * \param dev The device to be tested.
+ *
+ * \returns
+ * A value of 1 is always retured to indictate every i9x5 is AGP.
+ */
+int i915_driver_device_is_agp(drm_device_t * dev)
+{
+ return 1;
+}
diff --git a/shared-core/i915_drv.h b/shared-core/i915_drv.h
index b9615341..75480c16 100644
--- a/shared-core/i915_drv.h
+++ b/shared-core/i915_drv.h
@@ -80,6 +80,7 @@ typedef struct drm_i915_private {
extern void i915_kernel_lost_context(drm_device_t * dev);
extern void i915_driver_pretakedown(drm_device_t * dev);
extern void i915_driver_prerelease(drm_device_t * dev, DRMFILE filp);
+extern int i915_driver_device_is_agp(drm_device_t * dev);
/* i915_irq.c */
extern int i915_irq_emit(DRM_IOCTL_ARGS);