summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-02-28 16:24:17 +1000
committerDave Airlie <airlied@redhat.com>2008-02-28 16:24:17 +1000
commit01dcc47d895997f77c9457558e974d41c23ed4e1 (patch)
tree0550c9f9675b7dbcffa65583e4e866a36bf58057 /linux-core
parent132ba667f4a88bb182e2d2abc7c4e60699398380 (diff)
drm: add modesetting as a driver feature.
This change adds a driver feature that for i915 is controlled by a module parameter. You now need to do insmod i915.ko modeset=1 to enable it the modesetting paths. It also fixes up lots of X paths. I can run my new DDX driver on this code with and without modesetting enabled
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drmP.h1
-rw-r--r--linux-core/drm_drv.c3
-rw-r--r--linux-core/drm_fops.c3
-rw-r--r--linux-core/drm_irq.c5
-rw-r--r--linux-core/drm_stub.c9
-rw-r--r--linux-core/i915_drv.c10
6 files changed, 24 insertions, 7 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 51b02dc8..1a0a5659 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -106,6 +106,7 @@ struct drm_file;
#define DRIVER_IRQ_SHARED 0x80
#define DRIVER_DMA_QUEUE 0x100
#define DRIVER_FB_DMA 0x200
+#define DRIVER_MODESET 0x400
/*@}*/
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 4932ea59..dd76421f 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -414,7 +414,8 @@ static void drm_cleanup(struct drm_device * dev)
drm_ht_remove(&dev->object_hash);
drm_put_minor(&dev->primary);
- drm_put_minor(&dev->control);
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ drm_put_minor(&dev->control);
if (drm_put_dev(dev))
DRM_ERROR("Cannot unload module\n");
}
diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c
index 5a74f424..fcadc544 100644
--- a/linux-core/drm_fops.c
+++ b/linux-core/drm_fops.c
@@ -481,7 +481,8 @@ int drm_release(struct inode *inode, struct file *filp)
}
mutex_unlock(&dev->ctxlist_mutex);
- drm_fb_release(filp);
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ drm_fb_release(filp);
file_priv->master = NULL;
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index 637f5e1d..7dddbe19 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -261,6 +261,9 @@ int drm_irq_uninstall(struct drm_device * dev)
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL;
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ return 0;
+
mutex_lock(&dev->struct_mutex);
irq_enabled = dev->irq_enabled;
dev->irq_enabled = 0;
@@ -306,6 +309,8 @@ int drm_control(struct drm_device *dev, void *data,
case DRM_INST_HANDLER:
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return 0;
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ return 0;
if (dev->if_version < DRM_IF_VERSION(1, 2) &&
ctl->irq != dev->irq)
return -EINVAL;
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 334c8f03..6856075b 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -343,8 +343,10 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
goto err_g3;
}
- if ((ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL)))
- goto err_g3;
+ /* only add the control node on a modesetting platform */
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ if ((ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL)))
+ goto err_g3;
if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY)))
goto err_g4;
@@ -361,7 +363,8 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
err_g5:
drm_put_minor(&dev->primary);
err_g4:
- drm_put_minor(&dev->control);
+ if (drm_core_check_feature(dev, DRIVER_MODESET))
+ drm_put_minor(&dev->control);
err_g3:
if (!drm_fb_loaded)
pci_disable_device(pdev);
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index 6c12f1a1..b844dfe6 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -39,6 +39,9 @@ static struct pci_device_id pciidlist[] = {
i915_PCI_IDS
};
+unsigned int i915_modeset = 0;
+module_param_named(modeset, i915_modeset, int, 0400);
+
#ifdef I915_HAVE_FENCE
extern struct drm_fence_driver i915_fence_driver;
#endif
@@ -563,8 +566,8 @@ static struct drm_driver driver = {
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
.load = i915_driver_load,
.unload = i915_driver_unload,
-/* .lastclose = i915_driver_lastclose,
- .preclose = i915_driver_preclose, */
+ .lastclose = i915_driver_lastclose,
+ .preclose = i915_driver_preclose,
.suspend = i915_suspend,
.resume = i915_resume,
.device_is_agp = i915_driver_device_is_agp,
@@ -624,6 +627,9 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
static int __init i915_init(void)
{
driver.num_ioctls = i915_max_ioctl;
+ if (i915_modeset == 1)
+ driver.driver_features |= DRIVER_MODESET;
+
return drm_init(&driver, pciidlist);
}