diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-11-17 00:30:42 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-11-17 00:30:42 +0000 |
commit | ff5bdf079bc6c6ab983e821b29ad19d5ab111242 (patch) | |
tree | dcea4e9b90778ed2ff6838e5d64bd17f9286b728 /sys | |
parent | 7a61cb25c577af4a36ec5b27e1455727d0089e69 (diff) |
Instead of using a width-1 bitfield for storing the driver capabilities
in the callback structure, just use a bunch of ORed together bits. This
has been annoying me for ages.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 24 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_bufs.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_irq.c | 2 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_lock.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/drm/i915_drv.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/drm/mach64_drv.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/drm/mga_drv.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/drm/r128_drv.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/drm/radeon_drv.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/drm/savage_drv.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/drm/sis_drv.c | 3 | ||||
-rw-r--r-- | sys/dev/pci/drm/tdfx_drv.c | 2 |
13 files changed, 35 insertions, 64 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 7e27de574f6..cc67e60ac3f 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -278,12 +278,6 @@ typedef struct drm_ioctl_desc { int (*func)(struct drm_device *, void *, struct drm_file *); int flags; } drm_ioctl_desc_t; -/** - * Creates a driver or general drm_ioctl_desc array entry for the given - * ioctl, for use by drm_ioctl(). - */ -#define DRM_IOCTL_DEF(ioctl, func, flags) \ - [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags} struct drm_magic_entry { drm_magic_t magic; @@ -494,15 +488,15 @@ struct drm_driver_info { const char *desc; /* Longer driver name */ const char *date; /* Date of last major changes. */ - unsigned use_agp :1; - unsigned require_agp :1; - unsigned use_sg :1; - unsigned use_dma :1; - unsigned use_pci_dma :1; - unsigned use_dma_queue :1; - unsigned use_irq :1; - unsigned use_vbl_irq :1; - unsigned use_mtrr :1; +#define DRIVER_AGP 0x1 +#define DRIVER_AGP_REQUIRE 0x2 +#define DRIVER_MTRR 0x4 +#define DRIVER_DMA 0x8 +#define DRIVER_PCI_DMA 0x10 +#define DRIVER_SG 0x20 +#define DRIVER_IRQ 0x40 + + u_int flags; }; /* Length for the array of resource pointers for drm_get_resource_*. */ diff --git a/sys/dev/pci/drm/drm_bufs.c b/sys/dev/pci/drm/drm_bufs.c index 93adb5af7bd..94208d556b2 100644 --- a/sys/dev/pci/drm/drm_bufs.c +++ b/sys/dev/pci/drm/drm_bufs.c @@ -968,8 +968,10 @@ drm_mapbufs(struct drm_device *dev, void *data, struct drm_file *file_priv) if (request->count < dma->buf_count) goto done; - if ((dev->driver->use_agp && (dma->flags & _DRM_DMA_USE_AGP)) || - (dev->driver->use_sg && (dma->flags & _DRM_DMA_USE_SG))) { + if ((dev->driver->flags & DRIVER_AGP && + (dma->flags & _DRM_DMA_USE_AGP)) || + (dev->driver->flags & DRIVER_SG && + (dma->flags & _DRM_DMA_USE_SG))) { drm_local_map_t *map = dev->agp_buffer_map; if (map == NULL) { diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index f8c9bb48ac3..34e24c8a90c 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -145,11 +145,12 @@ drm_attach(struct device *parent, struct device *kdev, goto error; } - if (dev->driver->use_agp) { + if (dev->driver->flags & DRIVER_AGP) { if (drm_device_is_agp(dev)) dev->agp = drm_agp_init(); - if (dev->driver->require_agp && dev->agp == NULL) { - printf(":couldn't find agp\n"); + if (dev->driver->flags & DRIVER_AGP_REQUIRE && + dev->agp == NULL) { + printf(": couldn't find agp\n"); goto error; } if (dev->agp != NULL) { @@ -244,7 +245,7 @@ drm_firstopen(struct drm_device *dev) if (dev->driver->firstopen) dev->driver->firstopen(dev); - if (dev->driver->use_dma) { + if (dev->driver->flags & DRIVER_DMA) { i = drm_dma_setup(dev); if (i != 0) return i; @@ -480,7 +481,8 @@ drmclose(dev_t kdev, int flags, int fmt, struct proc *p) } } - if (dev->driver->use_dma && !dev->driver->reclaim_buffers_locked) + if (dev->driver->flags & DRIVER_DMA && + !dev->driver->reclaim_buffers_locked) drm_reclaim_buffers(dev, file_priv); dev->buf_pgid = 0; diff --git a/sys/dev/pci/drm/drm_irq.c b/sys/dev/pci/drm/drm_irq.c index 84ac280662d..bb03f79a2b3 100644 --- a/sys/dev/pci/drm/drm_irq.c +++ b/sys/dev/pci/drm/drm_irq.c @@ -153,7 +153,7 @@ drm_control(struct drm_device *dev, void *data, struct drm_file *file_priv) struct drm_control *ctl = data; /* Handle drivers who used to require IRQ setup no longer does. */ - if (!dev->driver->use_irq) + if (!(dev->driver->flags & DRIVER_IRQ)) return (0); switch (ctl->func) { diff --git a/sys/dev/pci/drm/drm_lock.c b/sys/dev/pci/drm/drm_lock.c index d949de2ef38..d5cff72b0e2 100644 --- a/sys/dev/pci/drm/drm_lock.c +++ b/sys/dev/pci/drm/drm_lock.c @@ -118,9 +118,6 @@ drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) lock->context, DRM_CURRENTPID, dev->lock.hw_lock->lock, lock->flags); - if (dev->driver->use_dma_queue && lock->context < 0) - return EINVAL; - mtx_enter(&dev->lock.spinlock); for (;;) { if (drm_lock_take(&dev->lock, lock->context)) { diff --git a/sys/dev/pci/drm/i915_drv.c b/sys/dev/pci/drm/i915_drv.c index e13790f372e..0e6d416519a 100644 --- a/sys/dev/pci/drm/i915_drv.c +++ b/sys/dev/pci/drm/i915_drv.c @@ -66,11 +66,8 @@ static const struct drm_driver_info i915_driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - .use_agp = 1, - .require_agp = 1, - .use_mtrr = 1, - .use_irq = 1, - .use_vbl_irq = 1, + .flags = DRIVER_AGP | DRIVER_AGP_REQUIRE | + DRIVER_MTRR | DRIVER_IRQ, }; int diff --git a/sys/dev/pci/drm/mach64_drv.c b/sys/dev/pci/drm/mach64_drv.c index 16ac8ed35e5..a5077bf7e74 100644 --- a/sys/dev/pci/drm/mach64_drv.c +++ b/sys/dev/pci/drm/mach64_drv.c @@ -68,12 +68,8 @@ static const struct drm_driver_info mach64_driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - .use_agp = 1, - .use_mtrr = 1, - .use_pci_dma = 1, - .use_dma = 1, - .use_irq = 1, - .use_vbl_irq = 1, + .flags = DRIVER_AGP | DRIVER_MTRR | DRIVER_PCI_DMA | + DRIVER_DMA | DRIVER_SG | DRIVER_IRQ, }; int diff --git a/sys/dev/pci/drm/mga_drv.c b/sys/dev/pci/drm/mga_drv.c index 9b1bd1bfd70..b93659f4ac8 100644 --- a/sys/dev/pci/drm/mga_drv.c +++ b/sys/dev/pci/drm/mga_drv.c @@ -117,12 +117,8 @@ static const struct drm_driver_info mga_driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - .use_agp = 1, - .require_agp = 1, - .use_mtrr = 1, - .use_dma = 1, - .use_irq = 1, - .use_vbl_irq = 1, + .flags = DRIVER_AGP | DRIVER_AGP_REQUIRE | + DRIVER_MTRR | DRIVER_DMA | DRIVER_IRQ, }; int diff --git a/sys/dev/pci/drm/r128_drv.c b/sys/dev/pci/drm/r128_drv.c index 95d086b95ad..955b0ddf1b1 100644 --- a/sys/dev/pci/drm/r128_drv.c +++ b/sys/dev/pci/drm/r128_drv.c @@ -67,13 +67,8 @@ static const struct drm_driver_info r128_driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - .use_agp = 1, - .use_mtrr = 1, - .use_pci_dma = 1, - .use_sg = 1, - .use_dma = 1, - .use_irq = 1, - .use_vbl_irq = 1, + .flags = DRIVER_AGP | DRIVER_MTRR | DRIVER_SG | + DRIVER_DMA | DRIVER_IRQ, }; int diff --git a/sys/dev/pci/drm/radeon_drv.c b/sys/dev/pci/drm/radeon_drv.c index c3e12d2e56f..7687e44396a 100644 --- a/sys/dev/pci/drm/radeon_drv.c +++ b/sys/dev/pci/drm/radeon_drv.c @@ -72,13 +72,8 @@ static const struct drm_driver_info radeon_driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - .use_agp = 1, - .use_mtrr = 1, - .use_pci_dma = 1, - .use_sg = 1, - .use_dma = 1, - .use_irq = 1, - .use_vbl_irq = 1, + .flags = DRIVER_AGP | DRIVER_MTRR | DRIVER_SG | + DRIVER_DMA | DRIVER_IRQ, }; int diff --git a/sys/dev/pci/drm/savage_drv.c b/sys/dev/pci/drm/savage_drv.c index 4772f381614..446b0b5fc0e 100644 --- a/sys/dev/pci/drm/savage_drv.c +++ b/sys/dev/pci/drm/savage_drv.c @@ -57,10 +57,8 @@ static const struct drm_driver_info savage_driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - .use_agp = 1, - .use_mtrr = 1, - .use_pci_dma = 1, - .use_dma = 1, + .flags = DRIVER_AGP | DRIVER_MTRR | DRIVER_PCI_DMA | + DRIVER_DMA, }; int diff --git a/sys/dev/pci/drm/sis_drv.c b/sys/dev/pci/drm/sis_drv.c index 5a5924becd1..5bc975f25d4 100644 --- a/sys/dev/pci/drm/sis_drv.c +++ b/sys/dev/pci/drm/sis_drv.c @@ -53,8 +53,7 @@ static const struct drm_driver_info sis_driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - .use_agp = 1, - .use_mtrr = 1, + .flags = DRIVER_AGP | DRIVER_MTRR, }; int diff --git a/sys/dev/pci/drm/tdfx_drv.c b/sys/dev/pci/drm/tdfx_drv.c index 3308621eb0a..6b884aafc76 100644 --- a/sys/dev/pci/drm/tdfx_drv.c +++ b/sys/dev/pci/drm/tdfx_drv.c @@ -51,7 +51,7 @@ static const struct drm_driver_info tdfx_driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, - .use_mtrr = 1, + .flags = DRIVER_MTRR, }; int tdfxdrm_probe(struct device *, void *, void *); |