From 6dd96a15ed329f26565bb971877f03e15801f3f5 Mon Sep 17 00:00:00 2001 From: Rik Faith Date: Fri, 21 Jul 2000 16:57:00 +0000 Subject: Revert some changes and try alternative way to clean up AGP handling. --- linux-core/Makefile.kernel | 9 ++++++--- linux-core/drmP.h | 13 ++++++++----- linux-core/r128_drv.c | 8 ++++---- linux-core/tdfx_drv.c | 8 ++++---- linux/Makefile.kernel | 9 ++++++--- linux/Makefile.linux | 2 +- linux/drmP.h | 13 ++++++++----- linux/memory.c | 2 +- linux/r128_bufs.c | 4 ++-- linux/r128_drv.c | 8 ++++---- linux/tdfx_drv.c | 8 ++++---- 11 files changed, 48 insertions(+), 36 deletions(-) diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel index b19f77c6..b756c950 100644 --- a/linux-core/Makefile.kernel +++ b/linux-core/Makefile.kernel @@ -13,12 +13,11 @@ O_TARGET := drm.o L_OBJS := init.o memory.o proc.o auth.o context.o drawable.o bufs.o \ - lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o \ - agpsupport.o + lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o M_OBJS := -ifdef CONFIG_DRM_AGP +ifneq ($(CONFIG_AGP),n) L_OBJS += agpsupport.o endif @@ -44,6 +43,7 @@ else endif endif +ifneq ($(CONFIG_AGP),n) ifeq ($(CONFIG_DRM_MGA),y) OX_OBJS += mga_drv.o O_OBJS += mga_context.o mga_dma.o mga_bufs.o mga_state.o @@ -54,7 +54,9 @@ else M_OBJS += mga.o endif endif +endif +ifneq ($(CONFIG_AGP),n) ifeq ($(CONFIG_DRM_I810),y) OX_OBJS += i810_drv.o O_OBJS += i810_context.o i810_bufs.o i810_dma.o @@ -65,6 +67,7 @@ else M_OBJS += i810.o endif endif +endif ifeq ($(CONFIG_DRM_R128),y) OX_OBJS += r128_drv.o diff --git a/linux-core/drmP.h b/linux-core/drmP.h index ce55c15b..d8791bf9 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -50,7 +50,10 @@ #ifdef CONFIG_MTRR #include #endif -#ifdef CONFIG_DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) +#define DRM_AGP +#endif +#ifdef DRM_AGP #include #include #endif @@ -407,7 +410,7 @@ typedef struct drm_device_dma { wait_queue_head_t waiting; /* Processes waiting on free bufs */ } drm_device_dma_t; -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP typedef struct drm_agp_mem { unsigned long handle; agp_memory *memory; @@ -521,7 +524,7 @@ typedef struct drm_device { wait_queue_head_t buf_readers; /* Processes waiting to read */ wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP drm_agp_head_t *agp; #endif unsigned long *ctx_bitmap; @@ -598,7 +601,7 @@ extern void drm_free_pages(unsigned long address, int order, extern void *drm_ioremap(unsigned long offset, unsigned long size); extern void drm_ioremapfree(void *pt, unsigned long size); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP extern agp_memory *drm_alloc_agp(int pages, u32 type); extern int drm_free_agp(agp_memory *handle, int pages); extern int drm_bind_agp(agp_memory *handle, unsigned int start); @@ -722,7 +725,7 @@ extern void drm_ctxbitmap_cleanup(drm_device_t *dev); extern int drm_ctxbitmap_next(drm_device_t *dev); extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP /* AGP/GART support (agpsupport.c) */ extern drm_agp_head_t *drm_agp_init(void); extern void drm_agp_uninit(void); diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c index 18df1d83..e78d0231 100644 --- a/linux-core/r128_drv.c +++ b/linux-core/r128_drv.c @@ -99,7 +99,7 @@ static drm_ioctl_desc_t r128_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, @@ -244,7 +244,7 @@ static int r128_takedown(drm_device_t *dev) dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP /* Clear AGP information */ if (dev->agp) { drm_agp_mem_t *entry; @@ -356,7 +356,7 @@ int r128_init(void) drm_mem_init(); drm_proc_init(dev); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP dev->agp = drm_agp_init(); if (dev->agp == NULL) { DRM_ERROR("Cannot initialize agpgart module.\n"); @@ -409,7 +409,7 @@ void r128_cleanup(void) } drm_ctxbitmap_cleanup(dev); r128_takedown(dev); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP if (dev->agp) { drm_agp_uninit(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c index 47039cd6..97bd4180 100644 --- a/linux-core/tdfx_drv.c +++ b/linux-core/tdfx_drv.c @@ -94,7 +94,7 @@ static drm_ioctl_desc_t tdfx_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1}, [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1}, [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1}, @@ -230,7 +230,7 @@ static int tdfx_takedown(drm_device_t *dev) } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP /* Clear AGP information */ if (dev->agp) { drm_agp_mem_t *temp; @@ -330,7 +330,7 @@ int tdfx_init(void) drm_mem_init(); drm_proc_init(dev); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP dev->agp = drm_agp_init(); #endif if((retcode = drm_ctxbitmap_init(dev))) { @@ -368,7 +368,7 @@ void tdfx_cleanup(void) } drm_ctxbitmap_cleanup(dev); tdfx_takedown(dev); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP if (dev->agp) { drm_agp_uninit(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); diff --git a/linux/Makefile.kernel b/linux/Makefile.kernel index b19f77c6..b756c950 100644 --- a/linux/Makefile.kernel +++ b/linux/Makefile.kernel @@ -13,12 +13,11 @@ O_TARGET := drm.o L_OBJS := init.o memory.o proc.o auth.o context.o drawable.o bufs.o \ - lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o \ - agpsupport.o + lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o M_OBJS := -ifdef CONFIG_DRM_AGP +ifneq ($(CONFIG_AGP),n) L_OBJS += agpsupport.o endif @@ -44,6 +43,7 @@ else endif endif +ifneq ($(CONFIG_AGP),n) ifeq ($(CONFIG_DRM_MGA),y) OX_OBJS += mga_drv.o O_OBJS += mga_context.o mga_dma.o mga_bufs.o mga_state.o @@ -54,7 +54,9 @@ else M_OBJS += mga.o endif endif +endif +ifneq ($(CONFIG_AGP),n) ifeq ($(CONFIG_DRM_I810),y) OX_OBJS += i810_drv.o O_OBJS += i810_context.o i810_bufs.o i810_dma.o @@ -65,6 +67,7 @@ else M_OBJS += i810.o endif endif +endif ifeq ($(CONFIG_DRM_R128),y) OX_OBJS += r128_drv.o diff --git a/linux/Makefile.linux b/linux/Makefile.linux index 2fcb0eec..35aee3f0 100644 --- a/linux/Makefile.linux +++ b/linux/Makefile.linux @@ -128,7 +128,7 @@ AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ endif ifeq ($(AGP),1) -MODCFLAGS += -DCONFIG_DRM_AGP +MODCFLAGS += -DDRM_AGP DRMOBJS += agpsupport.o MODS += mga.o i810.o diff --git a/linux/drmP.h b/linux/drmP.h index ce55c15b..d8791bf9 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -50,7 +50,10 @@ #ifdef CONFIG_MTRR #include #endif -#ifdef CONFIG_DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) +#define DRM_AGP +#endif +#ifdef DRM_AGP #include #include #endif @@ -407,7 +410,7 @@ typedef struct drm_device_dma { wait_queue_head_t waiting; /* Processes waiting on free bufs */ } drm_device_dma_t; -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP typedef struct drm_agp_mem { unsigned long handle; agp_memory *memory; @@ -521,7 +524,7 @@ typedef struct drm_device { wait_queue_head_t buf_readers; /* Processes waiting to read */ wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP drm_agp_head_t *agp; #endif unsigned long *ctx_bitmap; @@ -598,7 +601,7 @@ extern void drm_free_pages(unsigned long address, int order, extern void *drm_ioremap(unsigned long offset, unsigned long size); extern void drm_ioremapfree(void *pt, unsigned long size); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP extern agp_memory *drm_alloc_agp(int pages, u32 type); extern int drm_free_agp(agp_memory *handle, int pages); extern int drm_bind_agp(agp_memory *handle, unsigned int start); @@ -722,7 +725,7 @@ extern void drm_ctxbitmap_cleanup(drm_device_t *dev); extern int drm_ctxbitmap_next(drm_device_t *dev); extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP /* AGP/GART support (agpsupport.c) */ extern drm_agp_head_t *drm_agp_init(void); extern void drm_agp_uninit(void); diff --git a/linux/memory.c b/linux/memory.c index d03e214e..f342bb4f 100644 --- a/linux/memory.c +++ b/linux/memory.c @@ -330,7 +330,7 @@ void drm_ioremapfree(void *pt, unsigned long size) } } -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP agp_memory *drm_alloc_agp(int pages, u32 type) { agp_memory *handle; diff --git a/linux/r128_bufs.c b/linux/r128_bufs.c index 7256147b..e8ff4df4 100644 --- a/linux/r128_bufs.c +++ b/linux/r128_bufs.c @@ -36,7 +36,7 @@ #include "linux/un.h" -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -199,7 +199,7 @@ int r128_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, sizeof(request), -EFAULT); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP if (request.flags & _DRM_AGP_BUFFER) return r128_addbufs_agp(inode, filp, cmd, arg); else diff --git a/linux/r128_drv.c b/linux/r128_drv.c index 18df1d83..e78d0231 100644 --- a/linux/r128_drv.c +++ b/linux/r128_drv.c @@ -99,7 +99,7 @@ static drm_ioctl_desc_t r128_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, @@ -244,7 +244,7 @@ static int r128_takedown(drm_device_t *dev) dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP /* Clear AGP information */ if (dev->agp) { drm_agp_mem_t *entry; @@ -356,7 +356,7 @@ int r128_init(void) drm_mem_init(); drm_proc_init(dev); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP dev->agp = drm_agp_init(); if (dev->agp == NULL) { DRM_ERROR("Cannot initialize agpgart module.\n"); @@ -409,7 +409,7 @@ void r128_cleanup(void) } drm_ctxbitmap_cleanup(dev); r128_takedown(dev); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP if (dev->agp) { drm_agp_uninit(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c index 47039cd6..97bd4180 100644 --- a/linux/tdfx_drv.c +++ b/linux/tdfx_drv.c @@ -94,7 +94,7 @@ static drm_ioctl_desc_t tdfx_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1}, [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1}, [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1}, @@ -230,7 +230,7 @@ static int tdfx_takedown(drm_device_t *dev) } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP /* Clear AGP information */ if (dev->agp) { drm_agp_mem_t *temp; @@ -330,7 +330,7 @@ int tdfx_init(void) drm_mem_init(); drm_proc_init(dev); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP dev->agp = drm_agp_init(); #endif if((retcode = drm_ctxbitmap_init(dev))) { @@ -368,7 +368,7 @@ void tdfx_cleanup(void) } drm_ctxbitmap_cleanup(dev); tdfx_takedown(dev); -#ifdef CONFIG_DRM_AGP +#ifdef DRM_AGP if (dev->agp) { drm_agp_uninit(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); -- cgit v1.2.3