[PATCH] drm fixes and improvements for 2.4.0-test5 (pre6)

From: Christoph Hellwig (hch@caldera.de)
Date: Thu Jul 27 2000 - 11:59:36 EST


This patches fix the dri support layer in the current kernels,
following changes are included:
 - restore the locking changes done by Al Viro in 2.4.0-test series
   in old drivers and add them in new drivers.
 - readd some portability and security fixes done in the kernel
   tree that were lost after the last merge from XFree
 - allow builing the drm core as it's own module instead of linking
   them into every drm driver
 - cleaned up Makfile and Config.in
 - let mga and i810 drivers depend on CONFIG_AGP
 - removed unnessesary EXPORT_SYMBOL from the init_*/clenup_* functions
 - s/#ifdef DRM_AGP/#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE)/g
   to not end up be as crappy as __SMP__

Christoph

-- 
Always remember that you are unique.  Just like everyone else.

diff -uNr --exclude-from=exclude linux.orig/drivers/char/Config.in linux/drivers/char/Config.in --- linux.orig/drivers/char/Config.in Thu Jul 27 09:36:34 2000 +++ linux/drivers/char/Config.in Thu Jul 27 18:09:43 2000 @@ -257,15 +257,6 @@ fi endmenu -bool 'Direct Rendering Manager (XFree86 DRI support)' CONFIG_DRM -if [ "$CONFIG_DRM" = "y" ]; then - tristate ' 3dfx Banshee/Voodoo3+' CONFIG_DRM_TDFX - tristate ' 3dlabs GMX 2000' CONFIG_DRM_GAMMA - tristate ' ATI Rage 128' CONFIG_DRM_R128 - tristate ' Intel I810' CONFIG_DRM_I810 - tristate ' Matrox g200/g400' CONFIG_DRM_MGA -fi - tristate '/dev/agpgart (AGP Support)' CONFIG_AGP $CONFIG_DRM_AGP if [ "$CONFIG_AGP" != "n" ]; then bool ' Intel 440LX/BX/GX support' CONFIG_AGP_INTEL @@ -276,6 +267,8 @@ bool ' ALI M1541 support' CONFIG_AGP_ALI fi +source drivers/char/drm/Config.in + if [ "$CONFIG_HOTPLUG" = "y" -a "$CONFIG_PCMCIA" != "n" ]; then source drivers/char/pcmcia/Config.in fi diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/Config.in linux/drivers/char/drm/Config.in --- linux.orig/drivers/char/drm/Config.in Thu Jan 1 01:00:00 1970 +++ linux/drivers/char/drm/Config.in Thu Jul 27 18:09:43 2000 @@ -0,0 +1,15 @@ +# +# drm device configuration +# +# This driver provides support for the +# Direct Rendering Infrastructure (DRI) in XFree86 4.x. +# + +tristate 'Direct Rendering Manager (XFree86 DRI support)' CONFIG_DRM +if [ "$CONFIG_DRM" = "y" ]; then + tristate ' 3dfx Banshee/Voodoo3+' CONFIG_DRM_TDFX + tristate ' 3dlabs GMX 2000' CONFIG_DRM_GAMMA + tristate ' ATI Rage 128' CONFIG_DRM_R128 + dep_tristate ' Intel I810' CONFIG_DRM_I810 $CONFIG_AGP + dep_tristate ' Matrox g200/g400' CONFIG_DRM_MGA $CONFIG_AGP +fi diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/Makefile linux/drivers/char/drm/Makefile --- linux.orig/drivers/char/drm/Makefile Thu Jul 27 09:36:34 2000 +++ linux/drivers/char/drm/Makefile Thu Jul 27 18:09:43 2000 @@ -2,88 +2,79 @@ # Makefile for the drm device driver. This driver provides support for # the Direct Rendering Infrastructure (DRI) in XFree86 4.x. # -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# -# Note 2! The CFLAGS definitions are now inherited from the -# parent makes.. -# -O_OBJS := -OX_OBJS := -M_OBJS := -MX_OBJS := - -# Object file lists. - -obj-y := -obj-m := -obj-n := -obj- := - -SUB_DIRS := -MOD_SUB_DIRS := $(SUB_DIRS) -ALL_SUB_DIRS := $(SUB_DIRS) - -O_TARGET := drm.o -module-list := gamma.o tdfx.o r128.o ffb.o mga.o i810.o -export-objs := $(patsubst %.o,%_drv.o,$(module-list)) +O_TARGET = drm.o -lib-objs := init.o memory.o proc.o auth.o context.o drawable.o bufs.o -lib-objs += lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o - -ifneq ($(CONFIG_AGP),) - lib-objs += agpsupport.o +export-objs = drm_syms.o +list-multi = drm.o gamma.o tdfx.o r128.o ffb.o mga.o i810.o +drm-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 drm_syms.o +gamma-objs = gamma_drv.o gamma_dma.o +tdfx-objs = tdfx_drv.o tdfx_context.o +r128-objs = r128_drv.o r128_context.o r128_dma.o r128_bufs.o +ffb-objs = ffb_drv.o ffb_context.o +mga-objs = mga_drv.o mga_context.o mga_dma.o mga_bufs.o mga_state.o +i810-objs = i810_drv.o i810_context.o i810_dma.o i810_bufs.o + +ifeq ($(CONFIG_AGP), y) + drm-objs += agpsupport.o +else + ifeq ($(CONFIG_AGP), m) + drm-objs += agpsupport.o + endif endif -gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o -tdfx-objs := $(lib-objs) tdfx_drv.o tdfx_context.o -r128-objs := $(lib-objs) r128_drv.o r128_dma.o r128_context.o r128_bufs.o -ffb-objs := $(lib-objs) ffb_drv.o ffb_context.o -mga-objs := $(lib-objs) mga_drv.o mga_dma.o mga_context.o mga_bufs.o \ - mga_state.o -i810-objs := $(lib-objs) i810_drv.o i810_dma.o i810_context.o i810_bufs.o - -obj-$(CONFIG_DRM_GAMMA) += gamma.o $(gamma-objs) -obj-$(CONFIG_DRM_TDFX) += tdfx.o $(tdfx-objs) -obj-$(CONFIG_DRM_R128) += r128.o $(r128-objs) -obj-$(CONFIG_DRM_FFB) += ffb.o $(ffb-objs) - -ifneq ($CONFIG_AGP),) -obj-$(CONFIG_DRM_MGA) += mga.o $(mga-objs) -obj-$(CONFIG_DRM_I810) += i810.o $(i810-objs) -endif +obj-$(CONFIG_DRM) += drm.o +obj-$(CONFIG_DRM_GAMMA) += gamma.o +obj-$(CONFIG_DRM_TDFX) += tdfx.o +obj-$(CONFIG_DRM_R128) += r128.o +obj-$(CONFIG_DRM_FFB) += ffb.o +obj-$(CONFIG_DRM_MGA) += mga.o +obj-$(CONFIG_DRM_I810) += i810.o + + +# Extract lists of the multi-part drivers. +# The 'int-*' lists are the intermediate files used to build the multi's. +multi-y := $(filter $(list-multi), $(obj-y)) +multi-m := $(filter $(list-multi), $(obj-m)) +int-y := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs))) +int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs))) + +# Files that are both resident and modular: remove from modular. +obj-m := $(filter-out $(obj-y), $(obj-m)) +int-m := $(filter-out $(int-y), $(int-m)) -# Take module names out of obj-y and int-m - -obj-y := $(filter-out $(module-list), $(obj-y)) -int-m := $(filter-out $(module-list), $(obj-m)) +# Take multi-part drivers out of obj-y and put components in. +obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y) # Translate to Rules.make lists. - -O_OBJS := $(filter-out $(export-objs), $(obj-y)) -OX_OBJS := $(filter $(export-objs), $(obj-y)) -M_OBJS := $(sort $(filter $(module-list), $(obj-m))) -MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m))) -MIX_OBJS := $(sort $(filter $(export-objs), $(int-m))) +O_OBJS := $(filter-out $(export-objs), $(obj-y)) +OX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) +MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m))) +MIX_OBJS := $(sort $(filter $(export-objs), $(int-m))) include $(TOPDIR)/Rules.make +drm.o: $(drm-objs) + $(LD) -r -o $@ $(drm-objs) + gamma.o: $(gamma-objs) - $(LD) $(LD_RFLAG) -r -o $@ $(gamma-objs) + $(LD) -r -o $@ $(gamma-objs) tdfx.o: $(tdfx-objs) - $(LD) $(LD_RFLAG) -r -o $@ $(tdfx-objs) + $(LD) -r -o $@ $(tdfx-objs) mga.o: $(mga-objs) - $(LD) $(LD_RFLAG) -r -o $@ $(mga-objs) + $(LD) -r -o $@ $(mga-objs) i810.o: $(i810-objs) - $(LD) $(LD_RFLAG) -r -o $@ $(i810-objs) + $(LD) -r -o $@ $(i810-objs) r128.o: $(r128-objs) - $(LD) $(LD_RFLAG) -r -o $@ $(r128-objs) + $(LD) -r -o $@ $(r128-objs) ffb.o: $(ffb-objs) - $(LD) $(LD_RFLAG) -r -o $@ $(ffb-objs) + $(LD) -r -o $@ $(ffb-objs) diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/auth.c linux/drivers/char/drm/auth.c --- linux.orig/drivers/char/drm/auth.c Thu Jul 27 09:36:34 2000 +++ linux/drivers/char/drm/auth.c Thu Jul 27 18:09:43 2000 @@ -45,6 +45,8 @@ down(&dev->struct_sem); for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { + if (pt->priv->authenticated) + continue; if (pt->magic == magic) { retval = pt->priv; break; diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/bufs.c linux/drivers/char/drm/bufs.c --- linux.orig/drivers/char/drm/bufs.c Thu Jul 27 09:36:34 2000 +++ linux/drivers/char/drm/bufs.c Thu Jul 27 18:09:43 2000 @@ -106,7 +106,7 @@ dev->lock.hw_lock = map->handle; /* Pointer to lock */ } break; -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) case _DRM_AGP: map->offset = map->offset + dev->agp->base; break; diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/drmP.h linux/drivers/char/drm/drmP.h --- linux.orig/drivers/char/drm/drmP.h Thu Jul 27 09:36:34 2000 +++ linux/drivers/char/drm/drmP.h Thu Jul 27 18:17:57 2000 @@ -51,9 +51,6 @@ #include <asm/mtrr.h> #endif #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) -#define DRM_AGP -#endif -#ifdef DRM_AGP #include <linux/types.h> #include <linux/agp_backend.h> #endif @@ -410,7 +407,7 @@ wait_queue_head_t waiting; /* Processes waiting on free bufs */ } drm_device_dma_t; -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) typedef struct drm_agp_mem { unsigned long handle; agp_memory *memory; @@ -499,9 +496,9 @@ /* Context support */ int irq; /* Interrupt used by board */ - __volatile__ int context_flag; /* Context swapping flag */ - __volatile__ int interrupt_flag;/* Interruption handler flag */ - __volatile__ int dma_flag; /* DMA dispatch flag */ + __volatile__ long context_flag; /* Context swapping flag */ + __volatile__ long interrupt_flag; /* Interruption handler flag */ + __volatile__ long dma_flag; /* DMA dispatch flag */ struct timer_list timer; /* Timer for delaying ctx switch */ wait_queue_head_t context_wait; /* Processes waiting on ctx switch */ int last_checked; /* Last context checked for DMA */ @@ -524,7 +521,7 @@ wait_queue_head_t buf_readers; /* Processes waiting to read */ wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) drm_agp_head_t *agp; #endif unsigned long *ctx_bitmap; @@ -601,7 +598,7 @@ extern void *drm_ioremap(unsigned long offset, unsigned long size); extern void drm_ioremapfree(void *pt, unsigned long size); -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) 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); @@ -644,7 +641,6 @@ extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid); extern int drm_context_switch(drm_device_t *dev, int old, int new); extern int drm_context_switch_complete(drm_device_t *dev, int new); -extern void drm_wakeup(drm_device_t *dev, drm_buf_t *buf); extern void drm_clear_next_buffer(drm_device_t *dev); extern int drm_select_queue(drm_device_t *dev, void (*wrapper)(unsigned long)); @@ -725,7 +721,7 @@ extern int drm_ctxbitmap_next(drm_device_t *dev); extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle); -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) /* AGP/GART support (agpsupport.c) */ extern drm_agp_head_t *drm_agp_init(void); extern void drm_agp_uninit(void); diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/drm_syms.c linux/drivers/char/drm/drm_syms.c --- linux.orig/drivers/char/drm/drm_syms.c Thu Jan 1 01:00:00 1970 +++ linux/drivers/char/drm/drm_syms.c Thu Jul 27 18:09:43 2000 @@ -0,0 +1,146 @@ + +#include "drmP.h" + +/* Misc. support (init.c) */ +EXPORT_SYMBOL(drm_flags); +EXPORT_SYMBOL(drm_parse_options); +EXPORT_SYMBOL(drm_cpu_valid); + +/* Device support (fops.c) */ +EXPORT_SYMBOL(drm_open_helper); +EXPORT_SYMBOL(drm_flush); +EXPORT_SYMBOL(drm_release); +EXPORT_SYMBOL(drm_fasync); +EXPORT_SYMBOL(drm_read); +EXPORT_SYMBOL(drm_write_string); +EXPORT_SYMBOL(drm_poll); + +/* Mapping support (vm.c) */ +#if LINUX_VERSION_CODE < 0x020317 +EXPORT_SYMBOL(drm_vm_nopage); +EXPORT_SYMBOL(drm_vm_shm_nopage); +EXPORT_SYMBOL(drm_vm_dma_nopage); +#else +/* Return type changed in 2.3.23 */ +EXPORT_SYMBOL(drm_vm_nopage); +EXPORT_SYMBOL(drm_vm_shm_nopage); +EXPORT_SYMBOL(drm_vm_dma_nopage); +#endif + +EXPORT_SYMBOL(drm_vm_open); +EXPORT_SYMBOL(drm_vm_close); +EXPORT_SYMBOL(drm_mmap_dma); +EXPORT_SYMBOL(drm_mmap); + +/* Proc support (proc.c) */ +EXPORT_SYMBOL(drm_proc_init); +EXPORT_SYMBOL(drm_proc_cleanup); + +/* Memory management support (memory.c) */ +EXPORT_SYMBOL(drm_mem_init); +EXPORT_SYMBOL(drm_mem_info); +EXPORT_SYMBOL(drm_alloc); +EXPORT_SYMBOL(drm_realloc); +EXPORT_SYMBOL(drm_strdup); +EXPORT_SYMBOL(drm_strfree); +EXPORT_SYMBOL(drm_free); +EXPORT_SYMBOL(drm_alloc_pages); +EXPORT_SYMBOL(drm_free_pages); +EXPORT_SYMBOL(drm_ioremap); +EXPORT_SYMBOL(drm_ioremapfree); +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) +EXPORT_SYMBOL(drm_alloc_agp); +EXPORT_SYMBOL(drm_free_agp); +EXPORT_SYMBOL(drm_bind_agp); +EXPORT_SYMBOL(drm_unbind_agp); +#endif + +/* Buffer management support (bufs.c) */ +EXPORT_SYMBOL(drm_order); +EXPORT_SYMBOL(drm_addmap); +EXPORT_SYMBOL(drm_addbufs); +EXPORT_SYMBOL(drm_infobufs); +EXPORT_SYMBOL(drm_markbufs); +EXPORT_SYMBOL(drm_freebufs); +EXPORT_SYMBOL(drm_mapbufs); + +/* Buffer list management support (lists.c) */ +EXPORT_SYMBOL(drm_waitlist_create); +EXPORT_SYMBOL(drm_waitlist_destroy); +EXPORT_SYMBOL(drm_waitlist_put); +EXPORT_SYMBOL(drm_waitlist_get); +EXPORT_SYMBOL(drm_freelist_create); +EXPORT_SYMBOL(drm_freelist_destroy); +EXPORT_SYMBOL(drm_freelist_put); +EXPORT_SYMBOL(drm_freelist_get); + +/* DMA support (gen_dma.c) */ +EXPORT_SYMBOL(drm_dma_setup); +EXPORT_SYMBOL(drm_dma_takedown); +EXPORT_SYMBOL(drm_free_buffer); +EXPORT_SYMBOL(drm_reclaim_buffers); +EXPORT_SYMBOL(drm_context_switch); +EXPORT_SYMBOL(drm_context_switch_complete); +EXPORT_SYMBOL(drm_clear_next_buffer); +EXPORT_SYMBOL(drm_select_queue); +EXPORT_SYMBOL(drm_dma_enqueue); +EXPORT_SYMBOL(drm_dma_get_buffers); +#if DRM_DMA_HISTOGRAM +EXPORT_SYMBOL(drm_histogram_slot); +EXPORT_SYMBOL(drm_histogram_compute); +#endif + +/* Misc. IOCTL support (ioctl.c) */ +EXPORT_SYMBOL(drm_irq_busid); +EXPORT_SYMBOL(drm_getunique); +EXPORT_SYMBOL(drm_setunique); + +/* Context IOCTL support (context.c) */ +EXPORT_SYMBOL(drm_resctx); +EXPORT_SYMBOL(drm_addctx); +EXPORT_SYMBOL(drm_modctx); +EXPORT_SYMBOL(drm_getctx); +EXPORT_SYMBOL(drm_switchctx); +EXPORT_SYMBOL(drm_newctx); +EXPORT_SYMBOL(drm_rmctx); + +/* Drawable IOCTL support (drawable.c) */ +EXPORT_SYMBOL(drm_adddraw); +EXPORT_SYMBOL(drm_rmdraw); + +/* Authentication IOCTL support (auth.c) */ +EXPORT_SYMBOL(drm_add_magic); +EXPORT_SYMBOL(drm_remove_magic); +EXPORT_SYMBOL(drm_getmagic); +EXPORT_SYMBOL(drm_authmagic); + +/* Locking IOCTL support (lock.c) */ +EXPORT_SYMBOL(drm_block); +EXPORT_SYMBOL(drm_unblock); +EXPORT_SYMBOL(drm_lock_take); +EXPORT_SYMBOL(drm_lock_transfer); +EXPORT_SYMBOL(drm_lock_free); +EXPORT_SYMBOL(drm_finish); +EXPORT_SYMBOL(drm_flush_unblock); +EXPORT_SYMBOL(drm_flush_block_and_flush); + +/* Context Bitmap support (ctxbitmap.c) */ +EXPORT_SYMBOL(drm_ctxbitmap_init); +EXPORT_SYMBOL(drm_ctxbitmap_cleanup); +EXPORT_SYMBOL(drm_ctxbitmap_next); +EXPORT_SYMBOL(drm_ctxbitmap_free); + +/* AGP/GART support (agpsupport.c) */ +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) +EXPORT_SYMBOL(drm_agp); +EXPORT_SYMBOL(drm_agp_init); +EXPORT_SYMBOL(drm_agp_uninit); +EXPORT_SYMBOL(drm_agp_acquire); +EXPORT_SYMBOL(drm_agp_release); +EXPORT_SYMBOL(drm_agp_enable); +EXPORT_SYMBOL(drm_agp_info); +EXPORT_SYMBOL(drm_agp_alloc); +EXPORT_SYMBOL(drm_agp_free); +EXPORT_SYMBOL(drm_agp_unbind); +EXPORT_SYMBOL(drm_agp_bind); +#endif diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/gamma_drv.c linux/drivers/char/drm/gamma_drv.c --- linux.orig/drivers/char/drm/gamma_drv.c Thu Jul 27 09:36:34 2000 +++ linux/drivers/char/drm/gamma_drv.c Thu Jul 27 18:09:43 2000 @@ -30,15 +30,11 @@ */ #include <linux/config.h> -#ifndef EXPORT_SYMTAB -#define EXPORT_SYMTAB -#endif -#include "drmP.h" -#include "gamma_drv.h" +#include <linux/sched.h> #include <linux/pci.h> #include <linux/smp_lock.h> /* For (un)lock_kernel */ -EXPORT_SYMBOL(gamma_init); -EXPORT_SYMBOL(gamma_cleanup); +#include "drmP.h" +#include "gamma_drv.h" #ifndef PCI_DEVICE_ID_3DLABS_GAMMA #define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008 @@ -122,10 +118,6 @@ MODULE_PARM(devices, "i"); MODULE_PARM_DESC(devices, "devices=x, where x is the number of MX chips on card\n"); - -module_init(gamma_init); -module_exit(gamma_cleanup); - #ifndef MODULE /* gamma_options is called by the kernel to parse command-line options * passed via the boot-loader (e.g., LILO). It calls the insmod option @@ -406,6 +398,10 @@ gamma_takedown(dev); } +module_init(gamma_init); +module_exit(gamma_cleanup); + + int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -447,7 +443,6 @@ DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { - MOD_INC_USE_COUNT; atomic_inc(&dev->total_open); spin_lock(&dev->count_lock); if (!dev->open_count++) { @@ -462,13 +457,14 @@ int gamma_release(struct inode *inode, struct file *filp) { drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; + drm_device_t *dev; int retcode = 0; - DRM_DEBUG("open_count = %d\n", dev->open_count); lock_kernel(); + dev = priv->dev; + + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_release(inode, filp))) { - MOD_DEC_USE_COUNT; atomic_inc(&dev->total_close); spin_lock(&dev->count_lock); if (!--dev->open_count) { diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/gamma_drv.h linux/drivers/char/drm/gamma_drv.h --- linux.orig/drivers/char/drm/gamma_drv.h Thu Jul 27 09:36:34 2000 +++ linux/drivers/char/drm/gamma_drv.h Thu Jul 27 18:09:43 2000 @@ -33,8 +33,6 @@ #define _GAMMA_DRV_H_ /* gamma_drv.c */ -extern int gamma_init(void); -extern void gamma_cleanup(void); extern int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int gamma_open(struct inode *inode, struct file *filp); diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/i810_drv.c linux/drivers/char/drm/i810_drv.c --- linux.orig/drivers/char/drm/i810_drv.c Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/i810_drv.c Thu Jul 27 18:09:43 2000 @@ -30,18 +30,11 @@ */ #include <linux/config.h> -#ifndef EXPORT_SYMTAB -#define EXPORT_SYMTAB -#endif #include "drmP.h" #include "i810_drv.h" #include <linux/sched.h> #include <linux/smp_lock.h> - -EXPORT_SYMBOL(i810_init); -EXPORT_SYMBOL(i810_cleanup); - #define I810_NAME "i810" #define I810_DESC "Intel I810" #define I810_DATE "20000719" @@ -134,9 +127,6 @@ MODULE_DESCRIPTION("Intel I810"); MODULE_PARM(i810, "s"); -module_init(i810_init); -module_exit(i810_cleanup); - #ifndef MODULE /* i810_options is called by the kernel to parse command-line options * passed via the boot-loader (e.g., LILO). It calls the insmod option @@ -430,6 +420,10 @@ } } +module_init(i810_init); +module_exit(i810_cleanup); + + int i810_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -471,7 +465,6 @@ DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { - MOD_INC_USE_COUNT; atomic_inc(&dev->total_open); spin_lock(&dev->count_lock); if (!dev->open_count++) { @@ -552,7 +545,6 @@ up(&dev->struct_sem); drm_free(priv, sizeof(*priv), DRM_MEM_FILES); - MOD_DEC_USE_COUNT; atomic_inc(&dev->total_close); spin_lock(&dev->count_lock); if (!--dev->open_count) { diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/i810_drv.h linux/drivers/char/drm/i810_drv.h --- linux.orig/drivers/char/drm/i810_drv.h Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/i810_drv.h Thu Jul 27 18:09:43 2000 @@ -77,8 +77,6 @@ } drm_i810_private_t; /* i810_drv.c */ -extern int i810_init(void); -extern void i810_cleanup(void); extern int i810_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int i810_open(struct inode *inode, struct file *filp); diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/memory.c linux/drivers/char/drm/memory.c --- linux.orig/drivers/char/drm/memory.c Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/memory.c Thu Jul 27 18:09:43 2000 @@ -330,7 +330,7 @@ } } -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) agp_memory *drm_alloc_agp(int pages, u32 type) { agp_memory *handle; diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/mga_drv.c linux/drivers/char/drm/mga_drv.c --- linux.orig/drivers/char/drm/mga_drv.c Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/mga_drv.c Thu Jul 27 18:09:43 2000 @@ -31,15 +31,10 @@ */ #include <linux/config.h> -#ifndef EXPORT_SYMTAB -#define EXPORT_SYMTAB -#endif #include "drmP.h" #include "mga_drv.h" #include <linux/sched.h> #include <linux/smp_lock.h> -EXPORT_SYMBOL(mga_init); -EXPORT_SYMBOL(mga_cleanup); #define MGA_NAME "mga" #define MGA_DESC "Matrox g200/g400" @@ -133,9 +128,6 @@ MODULE_DESCRIPTION("Matrox g200/g400"); MODULE_PARM(mga, "s"); -module_init(mga_init); -module_exit(mga_cleanup); - #ifndef MODULE /* mga_options is called by the kernel to parse command-line options passed * via the boot-loader (e.g., LILO). It calls the insmod option routine, @@ -444,6 +436,10 @@ } } +module_init(mga_init); +module_exit(mga_cleanup); + + int mga_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -485,7 +481,6 @@ DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { - MOD_INC_USE_COUNT; atomic_inc(&dev->total_open); spin_lock(&dev->count_lock); if (!dev->open_count++) { @@ -566,7 +561,6 @@ up(&dev->struct_sem); drm_free(priv, sizeof(*priv), DRM_MEM_FILES); - MOD_DEC_USE_COUNT; atomic_inc(&dev->total_close); spin_lock(&dev->count_lock); if (!--dev->open_count) { diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/mga_drv.h linux/drivers/char/drm/mga_drv.h --- linux.orig/drivers/char/drm/mga_drv.h Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/mga_drv.h Thu Jul 27 18:09:43 2000 @@ -102,8 +102,6 @@ } drm_mga_private_t; /* mga_drv.c */ -extern int mga_init(void); -extern void mga_cleanup(void); extern int mga_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int mga_open(struct inode *inode, struct file *filp); diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/r128_bufs.c linux/drivers/char/drm/r128_bufs.c --- linux.orig/drivers/char/drm/r128_bufs.c Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/r128_bufs.c Thu Jul 27 18:09:43 2000 @@ -36,7 +36,7 @@ #include "linux/un.h" -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -199,7 +199,7 @@ sizeof(request), -EFAULT); -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) if (request.flags & _DRM_AGP_BUFFER) return r128_addbufs_agp(inode, filp, cmd, arg); else diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/r128_drv.c linux/drivers/char/drm/r128_drv.c --- linux.orig/drivers/char/drm/r128_drv.c Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/r128_drv.c Thu Jul 27 18:09:43 2000 @@ -30,15 +30,10 @@ */ #include <linux/config.h> -#ifndef EXPORT_SYMTAB -#define EXPORT_SYMTAB -#endif #include "drmP.h" #include "r128_drv.h" #include <linux/sched.h> #include <linux/smp_lock.h> -EXPORT_SYMBOL(r128_init); -EXPORT_SYMBOL(r128_cleanup); #define R128_NAME "r128" #define R128_DESC "ATI Rage 128" @@ -101,7 +96,7 @@ [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) [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 }, @@ -129,9 +124,6 @@ MODULE_DESCRIPTION("r128"); MODULE_PARM(r128, "s"); -module_init(r128_init); -module_exit(r128_cleanup); - #ifndef MODULE /* r128_options is called by the kernel to parse command-line options * passed via the boot-loader (e.g., LILO). It calls the insmod option @@ -246,7 +238,7 @@ dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) /* Clear AGP information */ if (dev->agp) { drm_agp_mem_t *entry; @@ -358,7 +350,7 @@ drm_mem_init(); drm_proc_init(dev); -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) dev->agp = drm_agp_init(); if (dev->agp == NULL) { DRM_ERROR("Cannot initialize agpgart module.\n"); @@ -411,7 +403,7 @@ } drm_ctxbitmap_cleanup(dev); r128_takedown(dev); -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) if (dev->agp) { drm_agp_uninit(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); @@ -420,6 +412,10 @@ #endif } +module_init(r128_init); +module_exit(r128_cleanup); + + int r128_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -461,7 +457,6 @@ DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { - MOD_INC_USE_COUNT; atomic_inc(&dev->total_open); spin_lock(&dev->count_lock); if (!dev->open_count++) { @@ -470,6 +465,9 @@ } spin_unlock(&dev->count_lock); } + + unlock_kernel(); + return retcode; } @@ -666,12 +664,10 @@ } } -#if LINUX_VERSION_CODE < 0x020400 if (lock.context != r128_res_ctx.handle) { current->counter = 5; - current->priority = DEF_PRIORITY/4; + current->nice = 15; } -#endif DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); #if DRM_DMA_HISTOGRAM @@ -712,12 +708,10 @@ } } -#if LINUX_VERSION_CODE < 0x020400 if (lock.context != r128_res_ctx.handle) { current->counter = 5; - current->priority = DEF_PRIORITY; + current->nice = 0; } -#endif return 0; } diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/r128_drv.h linux/drivers/char/drm/r128_drv.h --- linux.orig/drivers/char/drm/r128_drv.h Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/r128_drv.h Thu Jul 27 18:09:43 2000 @@ -69,8 +69,6 @@ } drm_r128_buf_priv_t; /* r128_drv.c */ -extern int r128_init(void); -extern void r128_cleanup(void); extern int r128_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int r128_open(struct inode *inode, struct file *filp); diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/tdfx_drv.c linux/drivers/char/drm/tdfx_drv.c --- linux.orig/drivers/char/drm/tdfx_drv.c Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/tdfx_drv.c Thu Jul 27 18:09:43 2000 @@ -31,13 +31,10 @@ */ #include <linux/config.h> -#ifndef EXPORT_SYMTAB -#define EXPORT_SYMTAB -#endif +#include <linux/sched.h> +#include <linux/smp_lock.h> #include "drmP.h" #include "tdfx_drv.h" -EXPORT_SYMBOL(tdfx_init); -EXPORT_SYMBOL(tdfx_cleanup); #define TDFX_NAME "tdfx" #define TDFX_DESC "3dfx Banshee/Voodoo3+" @@ -94,7 +91,7 @@ [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 +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) [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}, @@ -115,9 +112,6 @@ MODULE_DESCRIPTION("tdfx"); MODULE_PARM(tdfx, "s"); -module_init(tdfx_init); -module_exit(tdfx_cleanup); - #ifndef MODULE /* tdfx_options is called by the kernel to parse command-line options * passed via the boot-loader (e.g., LILO). It calls the insmod option @@ -230,7 +224,7 @@ } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) /* Clear AGP information */ if (dev->agp) { drm_agp_mem_t *temp; @@ -330,7 +324,7 @@ drm_mem_init(); drm_proc_init(dev); -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) dev->agp = drm_agp_init(); #endif if((retcode = drm_ctxbitmap_init(dev))) { @@ -368,7 +362,7 @@ } drm_ctxbitmap_cleanup(dev); tdfx_takedown(dev); -#ifdef DRM_AGP +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) if (dev->agp) { drm_agp_uninit(); drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); @@ -377,6 +371,10 @@ #endif } +module_init(tdfx_init); +module_exit(tdfx_cleanup); + + int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -418,7 +416,6 @@ DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_open_helper(inode, filp, dev))) { - MOD_INC_USE_COUNT; atomic_inc(&dev->total_open); spin_lock(&dev->count_lock); if (!dev->open_count++) { @@ -433,12 +430,14 @@ int tdfx_release(struct inode *inode, struct file *filp) { drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; + drm_device_t *dev; int retcode = 0; + lock_kernel(); + dev = priv->dev; + DRM_DEBUG("open_count = %d\n", dev->open_count); if (!(retcode = drm_release(inode, filp))) { - MOD_DEC_USE_COUNT; atomic_inc(&dev->total_close); spin_lock(&dev->count_lock); if (!--dev->open_count) { @@ -454,6 +453,8 @@ } spin_unlock(&dev->count_lock); } + + unlock_kernel(); return retcode; } @@ -622,7 +623,7 @@ #if LINUX_VERSION_CODE < 0x020400 if (lock.context != tdfx_res_ctx.handle) { current->counter = 5; - current->priority = DEF_PRIORITY/4; + current->nice = 15; } #endif DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); @@ -668,7 +669,7 @@ #if LINUX_VERSION_CODE < 0x020400 if (lock.context != tdfx_res_ctx.handle) { current->counter = 5; - current->priority = DEF_PRIORITY; + current->nice = 0; } #endif diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/tdfx_drv.h linux/drivers/char/drm/tdfx_drv.h --- linux.orig/drivers/char/drm/tdfx_drv.h Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/tdfx_drv.h Thu Jul 27 18:09:43 2000 @@ -34,8 +34,6 @@ #define _TDFX_DRV_H_ /* tdfx_drv.c */ -extern int tdfx_init(void); -extern void tdfx_cleanup(void); extern int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int tdfx_open(struct inode *inode, struct file *filp); diff -uNr --exclude-from=exclude linux.orig/drivers/char/drm/vm.c linux/drivers/char/drm/vm.c --- linux.orig/drivers/char/drm/vm.c Thu Jul 27 09:36:35 2000 +++ linux/drivers/char/drm/vm.c Thu Jul 27 18:09:43 2000 @@ -147,7 +147,6 @@ DRM_DEBUG("0x%08lx,0x%08lx\n", vma->vm_start, vma->vm_end - vma->vm_start); atomic_inc(&dev->vma_count); - MOD_INC_USE_COUNT; #if DRM_DEBUG_CODE vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); @@ -172,7 +171,6 @@ DRM_DEBUG("0x%08lx,0x%08lx\n", vma->vm_start, vma->vm_end - vma->vm_start); - MOD_DEC_USE_COUNT; atomic_dec(&dev->vma_count); #if DRM_DEBUG_CODE

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:26 EST