diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2012-09-08 16:42:21 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2012-09-08 16:42:21 +0000 |
commit | bd21f3cf09e5fa9b2898a5d693c6469975a13ba3 (patch) | |
tree | 0e9a9d1f15b2c9bada05e75e4c881f235afc036e /sys/dev/pci/drm/drm_agpsupport.c | |
parent | 552991e0fbce97e30bfb0c246e098119f4775fef (diff) |
Instead of having yet an other option to compile the drm code without agp
support, wrap all the agp glue with 'if __OS_HAS_AGP' in such form that it
is true if the agp(4) driver is present.
ok kettenis@
Diffstat (limited to 'sys/dev/pci/drm/drm_agpsupport.c')
-rw-r--r-- | sys/dev/pci/drm/drm_agpsupport.c | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/sys/dev/pci/drm/drm_agpsupport.c b/sys/dev/pci/drm/drm_agpsupport.c index ba110030d03..4539f5070ad 100644 --- a/sys/dev/pci/drm/drm_agpsupport.c +++ b/sys/dev/pci/drm/drm_agpsupport.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_agpsupport.c,v 1.21 2012/08/22 15:17:05 mpi Exp $ */ +/* $OpenBSD: drm_agpsupport.c,v 1.22 2012/09/08 16:42:20 mpi Exp $ */ /*- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. @@ -36,6 +36,8 @@ #include "drmP.h" +#if __OS_HAS_AGP + struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device *, void *); void drm_agp_remove_entry(struct drm_device *, struct drm_agp_mem *); @@ -49,9 +51,7 @@ drm_agp_info(struct drm_device * dev, struct drm_agp_info *info) return (EINVAL); kern = &dev->agp->info; -#ifndef DRM_NO_AGP agp_get_info(dev->agp->agpdev, kern); -#endif info->agp_version_major = 1; info->agp_version_minor = 0; info->mode = kern->ai_mode; @@ -84,7 +84,6 @@ drm_agp_acquire_ioctl(struct drm_device *dev, void *data, int drm_agp_acquire(struct drm_device *dev) { -#ifndef DRM_NO_AGP int retcode; if (dev->agp == NULL || dev->agp->acquired) @@ -95,7 +94,7 @@ drm_agp_acquire(struct drm_device *dev) return (retcode); dev->agp->acquired = 1; -#endif + return (0); } @@ -109,12 +108,11 @@ drm_agp_release_ioctl(struct drm_device *dev, void *data, int drm_agp_release(struct drm_device * dev) { -#ifndef DRM_NO_AGP if (dev->agp == NULL || !dev->agp->acquired) return (EINVAL); agp_release(dev->agp->agpdev); dev->agp->acquired = 0; -#endif + return (0); } @@ -122,14 +120,13 @@ int drm_agp_enable(struct drm_device *dev, drm_agp_mode_t mode) { int retcode = 0; -#ifndef DRM_NO_AGP + if (dev->agp == NULL || !dev->agp->acquired) return (EINVAL); - + dev->agp->mode = mode.mode; if ((retcode = agp_enable(dev->agp->agpdev, mode.mode)) == 0) dev->agp->enabled = 1; -#endif return (retcode); } @@ -145,7 +142,6 @@ drm_agp_enable_ioctl(struct drm_device *dev, void *data, int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) { -#ifndef DRM_NO_AGP struct drm_agp_mem *entry; void *handle; struct agp_memory_info info; @@ -168,7 +164,7 @@ drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) drm_free(entry); return (ENOMEM); } - + entry->handle = handle; entry->bound = 0; entry->pages = pages; @@ -180,7 +176,6 @@ drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) DRM_LOCK(); TAILQ_INSERT_HEAD(&dev->agp->memory, entry, link); DRM_UNLOCK(); -#endif return (0); } @@ -212,7 +207,6 @@ drm_agp_lookup_entry(struct drm_device *dev, void *handle) int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) { -#ifndef DRM_NO_AGP struct drm_agp_mem *entry; int retcode; @@ -233,9 +227,6 @@ drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) DRM_UNLOCK(); return (retcode); -#else - return (0); -#endif } int @@ -250,7 +241,6 @@ drm_agp_unbind_ioctl(struct drm_device *dev, void *data, int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) { -#ifndef DRM_NO_AGP struct drm_agp_mem *entry; int retcode, page; @@ -275,9 +265,6 @@ drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) DRM_UNLOCK(); return (retcode); -#else - return (0); -#endif } int @@ -295,14 +282,12 @@ drm_agp_bind_ioctl(struct drm_device *dev, void *data, void drm_agp_remove_entry(struct drm_device *dev, struct drm_agp_mem *entry) { -#ifndef DRM_NO_AGP TAILQ_REMOVE(&dev->agp->memory, entry, link); if (entry->bound) agp_unbind_memory(dev->agp->agpdev, entry->handle); agp_free_memory(dev->agp->agpdev, entry->handle); drm_free(entry); -#endif } void @@ -330,7 +315,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) { struct drm_agp_mem *entry; - + if (dev->agp == NULL || !dev->agp->acquired) return (EINVAL); @@ -343,7 +328,7 @@ drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) drm_agp_remove_entry(dev, entry); DRM_UNLOCK(); - + return (0); } @@ -359,11 +344,10 @@ drm_agp_free_ioctl(struct drm_device *dev, void *data, struct drm_agp_head * drm_agp_init(void) { -#ifndef DRM_NO_AGP struct device *agpdev; struct drm_agp_head *head = NULL; int agp_available = 1; - + agpdev = agp_find_device(0); if (agpdev == NULL) agp_available = 0; @@ -380,7 +364,6 @@ drm_agp_init(void) TAILQ_INIT(&head->memory); } return (head); -#else - return (NULL); -#endif } + +#endif /* __OS_HAS_AGP */ |