diff options
-rw-r--r-- | linux-core/Makefile.kernel | 10 | ||||
-rw-r--r-- | linux-core/drmP.h | 2 | ||||
-rw-r--r-- | linux-core/mga_drv.c | 15 | ||||
-rw-r--r-- | linux-core/r128_drv.c | 21 | ||||
-rw-r--r-- | linux-core/tdfx_drv.c | 21 | ||||
-rw-r--r-- | linux/Makefile.kernel | 10 | ||||
-rw-r--r-- | linux/Makefile.linux | 14 | ||||
-rw-r--r-- | linux/ctxbitmap.c | 3 | ||||
-rw-r--r-- | linux/drmP.h | 2 | ||||
-rw-r--r-- | linux/mga_drv.c | 15 | ||||
-rw-r--r-- | linux/r128_drv.c | 21 | ||||
-rw-r--r-- | linux/tdfx_context.c | 2 | ||||
-rw-r--r-- | linux/tdfx_drv.c | 21 |
13 files changed, 146 insertions, 11 deletions
diff --git a/linux-core/Makefile.kernel b/linux-core/Makefile.kernel index 73b9a918..db3f8a1b 100644 --- a/linux-core/Makefile.kernel +++ b/linux-core/Makefile.kernel @@ -13,7 +13,8 @@ L_TARGET := libdrm.a 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 + lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o \ + agpsupport.o M_OBJS := @@ -29,6 +30,10 @@ ifdef CONFIG_DRM_MGA M_OBJS += mga.o endif +ifdef CONFIG_DRM_R128 +M_OBJS += r128.o +endif + include $(TOPDIR)/Rules.make gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET) @@ -37,6 +42,9 @@ gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET) tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET) $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm +r128.o: r128_drv.o r128_context.o $(L_TARGET) + $(LD) $(LD_RFLAG) -r -o $@ r128_drv.o r128_context.o -L. -ldrm + mga.o: mga_drv.o mga_context.o mga_dma.o mga_bufs.o $(L_TARGET) $(LD) $(LD_RFLAG) -r -o $@ mga_drv.o mga_context.o mga_bufs.o mga_dma.o -L. -ldrm diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 01994a36..a88ce0c9 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -32,6 +32,8 @@ #ifndef _DRM_P_H_ #define _DRM_P_H_ +#define DRM_AGP 1 + #ifdef __KERNEL__ #include <linux/module.h> #include <linux/kernel.h> diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c index 802c20eb..96c4f8cc 100644 --- a/linux-core/mga_drv.c +++ b/linux-core/mga_drv.c @@ -44,6 +44,7 @@ EXPORT_SYMBOL(mga_cleanup); #define MGA_PATCHLEVEL 1 static drm_device_t mga_device; +drm_ctx_t mga_res_ctx; static struct file_operations mga_fops = { open: mga_open, @@ -88,7 +89,9 @@ static drm_ioctl_desc_t mga_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { mga_resctx, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, +#if 0 [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma, 1, 0 }, +#endif [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { mga_lock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { mga_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, @@ -250,7 +253,17 @@ static int mga_takedown(drm_device_t *dev) } /* Clear AGP information */ if (dev->agp) { - /* FIXME -- free other information, too */ + drm_agp_mem_t *temp; + drm_agp_mem_t *temp_next; + + temp = dev->agp->memory; + while(temp != NULL) { + temp_next = temp->next; + drm_free_agp(temp->memory, temp->pages); + drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); + temp = temp_next; + } + if(dev->agp->acquired) (*drm_agp.release)(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); dev->agp = NULL; } diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c index 18005420..cf120ee8 100644 --- a/linux-core/r128_drv.c +++ b/linux-core/r128_drv.c @@ -85,6 +85,15 @@ static drm_ioctl_desc_t r128_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { r128_lock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, + + [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}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1}, + [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}, }; #define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls) @@ -231,7 +240,17 @@ static int r128_takedown(drm_device_t *dev) /* Clear AGP information */ if (dev->agp) { - /* FIXME -- free other information, too */ + drm_agp_mem_t *temp; + drm_agp_mem_t *temp_next; + + temp = dev->agp->memory; + while(temp != NULL) { + temp_next = temp->next; + drm_free_agp(temp->memory, temp->pages); + drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); + temp = temp_next; + } + if(dev->agp->acquired) (*drm_agp.release)(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); dev->agp = NULL; } diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c index dc7533d4..c5f63aa5 100644 --- a/linux-core/tdfx_drv.c +++ b/linux-core/tdfx_drv.c @@ -86,6 +86,15 @@ 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 }, + + [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}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1}, + [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}, }; #define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls) @@ -231,7 +240,17 @@ static int tdfx_takedown(drm_device_t *dev) } /* Clear AGP information */ if (dev->agp) { - /* FIXME -- free other information, too */ + drm_agp_mem_t *temp; + drm_agp_mem_t *temp_next; + + temp = dev->agp->memory; + while(temp != NULL) { + temp_next = temp->next; + drm_free_agp(temp->memory, temp->pages); + drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); + temp = temp_next; + } + if(dev->agp->acquired) (*drm_agp.release)(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); dev->agp = NULL; } diff --git a/linux/Makefile.kernel b/linux/Makefile.kernel index 73b9a918..db3f8a1b 100644 --- a/linux/Makefile.kernel +++ b/linux/Makefile.kernel @@ -13,7 +13,8 @@ L_TARGET := libdrm.a 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 + lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o \ + agpsupport.o M_OBJS := @@ -29,6 +30,10 @@ ifdef CONFIG_DRM_MGA M_OBJS += mga.o endif +ifdef CONFIG_DRM_R128 +M_OBJS += r128.o +endif + include $(TOPDIR)/Rules.make gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET) @@ -37,6 +42,9 @@ gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET) tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET) $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm +r128.o: r128_drv.o r128_context.o $(L_TARGET) + $(LD) $(LD_RFLAG) -r -o $@ r128_drv.o r128_context.o -L. -ldrm + mga.o: mga_drv.o mga_context.o mga_dma.o mga_bufs.o $(L_TARGET) $(LD) $(LD_RFLAG) -r -o $@ mga_drv.o mga_context.o mga_bufs.o mga_dma.o -L. -ldrm diff --git a/linux/Makefile.linux b/linux/Makefile.linux index 0ca6748d..c8c87c0a 100644 --- a/linux/Makefile.linux +++ b/linux/Makefile.linux @@ -56,12 +56,13 @@ MODVERSIONS := $(shell \ # **** End of SMP/MODVERSIONS detection -MODS= gamma.o tdfx.o mga.o +MODS= gamma.o tdfx.o mga.o r128.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.c + lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o \ + agpsupport.o DRMHEADERS= drm.h drmP.h GAMMAOBJS= gamma_drv.o gamma_dma.o @@ -70,9 +71,12 @@ GAMMAHEADERS= gamma_drv.h $(DRMHEADERS) TDFXOBJS= tdfx_drv.o tdfx_context.o TDFXHEADERS= tdfx_drv.h $(DRMHEADERS) -MGAOBJS= mga_drv.o mga_context.o mga_dma.o mga_bufs.o +MGAOBJS= mga_drv.o mga_context.o mga_bufs.o MGAHEADERS= mga_drv.h $(DRMHEADERS) +R128OBJS= r128_drv.o r128_context.o +R128HEADERS= r128_drv.h $(DRMHEADERS) + PROGOBJS= drmstat.po xf86drm.po xf86drmHash.po xf86drmRandom.po sigio.po PROGHEADERS= xf86drm.h $(DRMHEADERS) @@ -114,6 +118,9 @@ tdfx.o: $(TDFXOBJS) $(LIBS) mga.o: $(MGAOBJS) $(LIBS) $(LD) -r $^ -o $@ +r128.o: $(R128OBJS) $(LIBS) + $(LD) -r $^ -o $@ + drmstat: $(PROGOBJS) $(CC) $(PRGCFLAGS) $^ $(PRGLIBS) -o $@ @@ -136,6 +143,7 @@ $(DRMOBJS): $(DRMHEADERS) $(GAMMAOBJS): $(GAMMAHEADERS) $(TDFXOBJS): $(TDFXHEADERS) $(MGAOBJS): $(MGAHEADERS) +$(R128OBJS): $(R128HEADERS) $(PROGOBJS): $(PROGHEADERS) clean: diff --git a/linux/ctxbitmap.c b/linux/ctxbitmap.c index c9b7da0e..ad23331c 100644 --- a/linux/ctxbitmap.c +++ b/linux/ctxbitmap.c @@ -29,6 +29,7 @@ * */ +#define __NO_VERSION__ #include "drmP.h" void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle) @@ -59,6 +60,8 @@ int drm_ctxbitmap_next(drm_device_t *dev) int drm_ctxbitmap_init(drm_device_t *dev) { + int i; + dev->ctx_bitmap = (unsigned long *) drm_alloc(PAGE_SIZE * 4, DRM_MEM_CTXBITMAP); if(dev->ctx_bitmap == NULL) { diff --git a/linux/drmP.h b/linux/drmP.h index 01994a36..a88ce0c9 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -32,6 +32,8 @@ #ifndef _DRM_P_H_ #define _DRM_P_H_ +#define DRM_AGP 1 + #ifdef __KERNEL__ #include <linux/module.h> #include <linux/kernel.h> diff --git a/linux/mga_drv.c b/linux/mga_drv.c index 802c20eb..96c4f8cc 100644 --- a/linux/mga_drv.c +++ b/linux/mga_drv.c @@ -44,6 +44,7 @@ EXPORT_SYMBOL(mga_cleanup); #define MGA_PATCHLEVEL 1 static drm_device_t mga_device; +drm_ctx_t mga_res_ctx; static struct file_operations mga_fops = { open: mga_open, @@ -88,7 +89,9 @@ static drm_ioctl_desc_t mga_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { mga_resctx, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, +#if 0 [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma, 1, 0 }, +#endif [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { mga_lock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { mga_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, @@ -250,7 +253,17 @@ static int mga_takedown(drm_device_t *dev) } /* Clear AGP information */ if (dev->agp) { - /* FIXME -- free other information, too */ + drm_agp_mem_t *temp; + drm_agp_mem_t *temp_next; + + temp = dev->agp->memory; + while(temp != NULL) { + temp_next = temp->next; + drm_free_agp(temp->memory, temp->pages); + drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); + temp = temp_next; + } + if(dev->agp->acquired) (*drm_agp.release)(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); dev->agp = NULL; } diff --git a/linux/r128_drv.c b/linux/r128_drv.c index 18005420..cf120ee8 100644 --- a/linux/r128_drv.c +++ b/linux/r128_drv.c @@ -85,6 +85,15 @@ static drm_ioctl_desc_t r128_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { r128_lock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, + + [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}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1}, + [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}, }; #define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls) @@ -231,7 +240,17 @@ static int r128_takedown(drm_device_t *dev) /* Clear AGP information */ if (dev->agp) { - /* FIXME -- free other information, too */ + drm_agp_mem_t *temp; + drm_agp_mem_t *temp_next; + + temp = dev->agp->memory; + while(temp != NULL) { + temp_next = temp->next; + drm_free_agp(temp->memory, temp->pages); + drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); + temp = temp_next; + } + if(dev->agp->acquired) (*drm_agp.release)(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); dev->agp = NULL; } diff --git a/linux/tdfx_context.c b/linux/tdfx_context.c index 598bf772..b98d754a 100644 --- a/linux/tdfx_context.c +++ b/linux/tdfx_context.c @@ -199,6 +199,8 @@ int tdfx_newctx(struct inode *inode, struct file *filp, unsigned int cmd, int tdfx_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; drm_ctx_t ctx; copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c index dc7533d4..c5f63aa5 100644 --- a/linux/tdfx_drv.c +++ b/linux/tdfx_drv.c @@ -86,6 +86,15 @@ 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 }, + + [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}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1}, + [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}, }; #define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls) @@ -231,7 +240,17 @@ static int tdfx_takedown(drm_device_t *dev) } /* Clear AGP information */ if (dev->agp) { - /* FIXME -- free other information, too */ + drm_agp_mem_t *temp; + drm_agp_mem_t *temp_next; + + temp = dev->agp->memory; + while(temp != NULL) { + temp_next = temp->next; + drm_free_agp(temp->memory, temp->pages); + drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); + temp = temp_next; + } + if(dev->agp->acquired) (*drm_agp.release)(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); dev->agp = NULL; } |