summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Hartmann <jhartmann@valinux.com>2000-03-13 21:43:36 +0000
committerJeff Hartmann <jhartmann@valinux.com>2000-03-13 21:43:36 +0000
commit355f98bf25b6f8aed82934f8970b9d333d484ea8 (patch)
tree88f944c683f6d126dfc7ef8d45e60c1d4121c117
parenta63f6b168ceb0866e0a51519fb70d3bb73ba3ef0 (diff)
Better use of agp config option, and compile fixes when agp is not detected
-rw-r--r--linux-core/tdfx_drv.c9
-rw-r--r--linux/Makefile.linux31
-rw-r--r--linux/bufs.c2
-rw-r--r--linux/picker.c7
-rw-r--r--linux/tdfx_drv.c9
5 files changed, 41 insertions, 17 deletions
diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c
index bbddf859..95b40be5 100644
--- a/linux-core/tdfx_drv.c
+++ b/linux-core/tdfx_drv.c
@@ -86,7 +86,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 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},
@@ -95,6 +95,7 @@ static drm_ioctl_desc_t tdfx_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free, 1, 1},
[DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_unbind, 1, 1},
[DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_bind, 1, 1},
+#endif
};
#define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls)
@@ -238,6 +239,7 @@ static int tdfx_takedown(drm_device_t *dev)
}
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
+#ifdef DRM_AGP
/* Clear AGP information */
if (dev->agp) {
drm_agp_mem_t *temp;
@@ -254,7 +256,7 @@ static int tdfx_takedown(drm_device_t *dev)
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
dev->agp = NULL;
}
-
+#endif
/* Clear vma list (only built for debugging) */
if (dev->vmalist) {
for (vma = dev->vmalist; vma; vma = vma_next) {
@@ -339,8 +341,9 @@ int tdfx_init(void)
drm_mem_init();
drm_proc_init(dev);
+#ifdef DRM_AGP
dev->agp = drm_agp_init();
-
+#endif
if((retcode = drm_ctxbitmap_init(dev))) {
DRM_ERROR("Cannot allocate memory for context bitmap.\n");
drm_proc_cleanup();
diff --git a/linux/Makefile.linux b/linux/Makefile.linux
index 4c2b4003..2f22fe64 100644
--- a/linux/Makefile.linux
+++ b/linux/Makefile.linux
@@ -34,13 +34,12 @@
# **** End of SMP/MODVERSIONS detection
-MODS= gamma.o tdfx.o mga.o i810.o
+MODS= gamma.o tdfx.o
LIBS= libdrm.a
PROGS= drmstat
DRMOBJS= 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
DRMHEADERS= drm.h drmP.h
GAMMAOBJS= gamma_drv.o gamma_dma.o
@@ -49,12 +48,6 @@ GAMMAHEADERS= gamma_drv.h $(DRMHEADERS)
TDFXOBJS= tdfx_drv.o tdfx_context.o
TDFXHEADERS= tdfx_drv.h $(DRMHEADERS)
-MGAOBJS= mga_drv.o mga_dma.o mga_bufs.o mga_state.o mga_context.o
-MGAHEADERS= mga_drv.h mga_drm_public.h $(DRMHEADERS)
-
-I810OBJS= i810_drv.o i810_dma.o i810_bufs.o i810_context.o
-I810HEADERS= i810_drv.h i810_drm_public.h $(DRMHEADERS)
-
PROGOBJS= drmstat.po xf86drm.po xf86drmHash.po xf86drmRandom.po sigio.po
PROGHEADERS= xf86drm.h $(DRMHEADERS)
@@ -116,9 +109,13 @@ MODVERSIONS := $(shell gcc -E -I $(TREE) picker.c 2>/dev/null \
| grep -s 'MODVERSIONS = ' | cut -d' ' -f3)
AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'AGP = ' | cut -d' ' -f3)
+ifeq ($(AGP),0)
+AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
+ | grep -s 'AGP_MODULE = ' | cut -d' ' -f3)
+endif
all::;@echo KERNEL HEADERS IN $(TREE): SMP=${SMP} MODVERSIONS=${MODVERSIONS} \
AGP=${AGP}
-all:: $(LIBS) $(MODS) $(PROGS)
+all:: $(LIBS) $(MODS)
endif
# **** End of SMP/MODVERSIONS detection
@@ -132,8 +129,18 @@ MODCFLAGS += -DMODVERSIONS -include $(TREE)/linux/modversions.h
endif
ifeq ($(AGP),1)
MODCFLAGS += -DDRM_AGP
+DRMOBJS += agpsupport.o
+MODS += mga.o i810.o
+
+MGAOBJS= mga_drv.o mga_dma.o mga_bufs.o mga_state.o mga_context.o
+MGAHEADERS= mga_drv.h mga_drm_public.h $(DRMHEADERS)
+
+I810OBJS= i810_drv.o i810_dma.o i810_bufs.o i810_context.o
+I810HEADERS= i810_drv.h i810_drm_public.h $(DRMHEADERS)
endif
+all:: $(LIBS) $(MODS) $(PROGS)
+
# **** End of configuration
libdrm.a: $(DRMOBJS)
@@ -146,11 +153,13 @@ gamma.o: $(GAMMAOBJS) $(LIBS)
tdfx.o: $(TDFXOBJS) $(LIBS)
$(LD) -r $^ -o $@
+ifeq ($(AGP),1)
mga.o: $(MGAOBJS) $(LIBS)
$(LD) -r $^ -o $@
i810.o: $(I810OBJS) $(LIBS)
$(LD) -r $^ -o $@
+endif
drmstat: $(PROGOBJS)
$(CC) $(PRGCFLAGS) $^ $(PRGLIBS) -o $@
@@ -173,8 +182,10 @@ ChangeLog:
$(DRMOBJS): $(DRMHEADERS)
$(GAMMAOBJS): $(GAMMAHEADERS)
$(TDFXOBJS): $(TDFXHEADERS)
+ifeq ($(AGP),1)
$(MGAOBJS): $(MGAHEADERS)
$(I810OBJS): $(I810HEADERS)
+endif
$(PROGOBJS): $(PROGHEADERS)
clean:
diff --git a/linux/bufs.c b/linux/bufs.c
index 6a5a7d8d..d7a44875 100644
--- a/linux/bufs.c
+++ b/linux/bufs.c
@@ -103,9 +103,11 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd,
dev->lock.hw_lock = map->handle; /* Pointer to lock */
}
break;
+#ifdef DRM_AGP
case _DRM_AGP:
map->offset = map->offset + dev->agp->base;
break;
+#endif
default:
drm_free(map, sizeof(*map), DRM_MEM_MAPS);
return -EINVAL;
diff --git a/linux/picker.c b/linux/picker.c
index 54549110..0bd8bfd5 100644
--- a/linux/picker.c
+++ b/linux/picker.c
@@ -13,7 +13,12 @@
#define CONFIG_AGP_MODULE 0
#endif
+#ifndef CONFIG_AGP
+#define CONFIG_AGP 0
+#endif
+
SMP = CONFIG_SMP
MODVERSIONS = CONFIG_MODVERSIONS
-AGP = CONFIG_AGP_MODULE
+AGP = CONFIG_AGP
+AGP_MODULE = CONFIG_AGP_MODULE
RELEASE = UTS_RELEASE
diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c
index bbddf859..95b40be5 100644
--- a/linux/tdfx_drv.c
+++ b/linux/tdfx_drv.c
@@ -86,7 +86,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 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},
@@ -95,6 +95,7 @@ static drm_ioctl_desc_t tdfx_ioctls[] = {
[DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free, 1, 1},
[DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_unbind, 1, 1},
[DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_bind, 1, 1},
+#endif
};
#define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls)
@@ -238,6 +239,7 @@ static int tdfx_takedown(drm_device_t *dev)
}
dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
}
+#ifdef DRM_AGP
/* Clear AGP information */
if (dev->agp) {
drm_agp_mem_t *temp;
@@ -254,7 +256,7 @@ static int tdfx_takedown(drm_device_t *dev)
drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
dev->agp = NULL;
}
-
+#endif
/* Clear vma list (only built for debugging) */
if (dev->vmalist) {
for (vma = dev->vmalist; vma; vma = vma_next) {
@@ -339,8 +341,9 @@ int tdfx_init(void)
drm_mem_init();
drm_proc_init(dev);
+#ifdef DRM_AGP
dev->agp = drm_agp_init();
-
+#endif
if((retcode = drm_ctxbitmap_init(dev))) {
DRM_ERROR("Cannot allocate memory for context bitmap.\n");
drm_proc_cleanup();