Sync with Linux 2.4.0-test4 kernel
authorRik Faith <faith@alephnull.com>
Wed, 19 Jul 2000 18:38:41 +0000 (18:38 +0000)
committerRik Faith <faith@alephnull.com>
Wed, 19 Jul 2000 18:38:41 +0000 (18:38 +0000)
18 files changed:
linux-core/Makefile.kernel
linux-core/i810_drv.c
linux-core/mga_drv.c
linux-core/r128_drv.c
linux-core/tdfx_drv.c
linux/Makefile.kernel
linux/Makefile.linux
linux/bufs.c
linux/fops.c
linux/gamma_drv.c
linux/gamma_drv.h
linux/i810_drv.c
linux/init.c
linux/mga_drv.c
linux/proc.c
linux/r128_drv.c
linux/tdfx_drv.c
linux/tdfx_drv.h

index e262213..9039da8 100644 (file)
@@ -9,9 +9,8 @@
 # Note 2! The CFLAGS definitions are now inherited from the
 # parent makes..
 #
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.6 2000/06/17 00:03:34 martin Exp $
 
-L_TARGET        := libdrm.a
+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 \
@@ -19,35 +18,92 @@ L_OBJS              := init.o memory.o proc.o auth.o context.o drawable.o bufs.o \
 
 M_OBJS         := 
 
-ifdef CONFIG_DRM_GAMMA
-M_OBJS          += gamma.o
+ifeq ($(CONFIG_DRM_GAMMA),y)
+ OX_OBJS += gamma_drv.o
+ O_OBJS += gamma_dma.o
+else
+  ifeq ($(CONFIG_DRM_GAMMA),m)
+    MIX_OBJS += gamma_drv.o
+    MI_OBJS += gamma_dma.o
+    M_OBJS += gamma.o
+  endif
 endif
 
-ifdef CONFIG_DRM_TDFX
-M_OBJS          += tdfx.o
+ifeq ($(CONFIG_DRM_TDFX),y)
+ OX_OBJS += tdfx_drv.o
+ O_OBJS += tdfx_context.o
+else
+  ifeq ($(CONFIG_DRM_TDFX),m)
+    MIX_OBJS += tdfx_drv.o
+    MI_OBJS += tdfx_context.o
+    M_OBJS += tdfx.o
+  endif
 endif
 
-ifdef CONFIG_DRM_MGA
-M_OBJS         += mga.o
+ifeq ($(CONFIG_DRM_MGA),y)
+ OX_OBJS += mga_drv.o
+ O_OBJS += mga_context.o mga_dma.o mga_bufs.o mga_state.o
+else
+  ifeq ($(CONFIG_DRM_MGA),m)
+    MIX_OBJS += mga_drv.o
+    MI_OBJS += mga_context.o mga_dma.o mga_bufs.o mga_state.o
+    M_OBJS += mga.o
+  endif
 endif
 
-ifdef CONFIG_DRM_R128
-M_OBJS         += r128.o
+ifeq ($(CONFIG_DRM_I810),y)
+ OX_OBJS += i810_drv.o
+ O_OBJS += i810_context.o i810_bufs.o i810_dma.o
+else
+  ifeq ($(CONFIG_DRM_I810),m)
+    MIX_OBJS += i810_drv.o
+    MI_OBJS += i810_context.o i810_bufs.o i810_dma.o
+    M_OBJS += i810.o
+  endif
 endif
 
+ifeq ($(CONFIG_DRM_R128),y)
+ OX_OBJS += r128_drv.o
+ O_OBJS += r128_context.o
+else
+  ifeq ($(CONFIG_DRM_I810),m)
+    MIX_OBJS += r128_drv.o
+    MI_OBJS += r128_context.o
+    M_OBJS += r128.o
+  endif
+endif
+
+ifeq ($(CONFIG_DRM_FFB),y)
+ OX_OBJS += ffb_drv.o
+ O_OBJS += ffb_context.o
+else
+  ifeq ($(CONFIG_DRM_FFB),m)
+    MIX_OBJC += ffb_drv.o
+    MI_OBJS += ffb_context.o
+    M_OBJS += ffb.o
+  endif
+endif
+
+O_OBJS += $(L_OBJS)
+
 include $(TOPDIR)/Rules.make
 
-gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET)
-       $(LD) $(LD_RFLAG) -r -o $@ gamma_drv.o gamma_dma.o -L. -ldrm
+gamma.o : gamma_drv.o gamma_dma.o $(L_OBJS)
+       $(LD) $(LD_RFLAG) -r -o $@ gamma_drv.o gamma_dma.o $(L_OBJS)
 
-tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET)
-       $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm
+tdfx.o: tdfx_drv.o tdfx_context.o $(L_OBJS)
+       $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o $(L_OBJS)
 
-i810.o: i810_drv.o i810_context.o $(L_TARGET)
-       $(LD) $(LD_RFLAG) -r -o $@ i810_drv.o i810_bufs.o i810_dma.o i810_context.o -L. -ldrm
+mga.o: mga_drv.o mga_context.o mga_dma.o mga_bufs.o mga_state.o $(L_OBJS)
+       $(LD) $(LD_RFLAG) -r -o $@ mga_drv.o mga_bufs.o mga_dma.o \
+               mga_context.o mga_state.o $(L_OBJS)
 
-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_bufs.o mga_dma.o mga_context.o mga_state.o -L. -ldrm
+i810.o: i810_drv.o i810_context.o i810_bufs.o i810_dma.o $(L_TARGET)
+       $(LD) $(LD_RFLAG) -r -o $@ i810_drv.o i810_bufs.o i810_dma.o \
+               i810_context.o $(L_OBJS)
 
 r128.o: r128_drv.o r128_context.o $(L_TARGET)
-       $(LD) $(LD_RFLAG) -r -o $@ r128_drv.o r128_context.o -L. -ldrm
+       $(LD) $(LD_RFLAG) -r -o $@ r128_drv.o r128_context.o $(L_OBJS)
+
+ffb.o: ffb_drv.o ffb_context.o $(L_OBJS)
+       $(LD) $(LD_RFLAG) -r -o $@ ffb_drv.o ffb_context.o $(L_OBJS)
index d7fa9d8..44b0321 100644 (file)
@@ -49,6 +49,10 @@ static drm_device_t        i810_device;
 drm_ctx_t                    i810_res_ctx;
 
 static struct file_operations i810_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    i810_open,
        flush:   drm_flush,
        release: i810_release,
index e77d827..1cc23fb 100644 (file)
@@ -48,6 +48,10 @@ static drm_device_t        mga_device;
 drm_ctx_t                    mga_res_ctx;
 
 static struct file_operations mga_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    mga_open,
        flush:   drm_flush,
        release: mga_release,
index 8b66988..54c6e47 100644 (file)
@@ -47,6 +47,10 @@ static drm_device_t        r128_device;
 drm_ctx_t                    r128_res_ctx;
 
 static struct file_operations r128_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    r128_open,
        flush:   drm_flush,
        release: r128_release,
@@ -369,6 +373,13 @@ int r128_init(void)
 
 #ifdef DRM_AGP
        dev->agp    = drm_agp_init();
+       if (dev->agp == NULL) {
+               DRM_ERROR("Cannot initialize agpgart module.\n");
+               drm_proc_cleanup();
+               misc_deregister(&r128_misc);
+               r128_takedown(dev);
+               return -ENOMEM;
+       }
 
 #ifdef CONFIG_MTRR
        dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base,
@@ -664,19 +675,11 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
                }
         }
 
-#if 0
-       DRM_ERROR("pid = %5d, old counter = %5ld\n",
-               current->pid, current->counter);
-#endif
+#if LINUX_VERSION_CODE < 0x020400
        if (lock.context != r128_res_ctx.handle) {
                current->counter = 5;
                current->priority = DEF_PRIORITY/4;
        }
-#if 0
-       while (current->counter > 25)
-               current->counter >>= 1; /* decrease time slice */
-       DRM_ERROR("pid = %5d, new counter = %5ld\n",
-                current->pid, current->counter);
 #endif
         DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
 
@@ -718,19 +721,11 @@ int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
                }
        }
 
-#if 0
-       current->policy |= SCHED_YIELD;
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(1000);
-#endif
-
+#if LINUX_VERSION_CODE < 0x020400
        if (lock.context != r128_res_ctx.handle) {
                current->counter = 5;
                current->priority = DEF_PRIORITY;
        }
-#if 0
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(10);
 #endif
 
        return 0;
index 582832b..e0a31c5 100644 (file)
@@ -48,6 +48,10 @@ static drm_device_t        tdfx_device;
 drm_ctx_t                    tdfx_res_ctx;
 
 static struct file_operations tdfx_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    tdfx_open,
        flush:   drm_flush,
        release: tdfx_release,
@@ -625,19 +629,11 @@ int tdfx_lock(struct inode *inode, struct file *filp, unsigned int cmd,
                }
         }
 
-#if 0
-       DRM_ERROR("pid = %5d, old counter = %5ld\n", 
-               current->pid, current->counter);
-#endif
+#if LINUX_VERSION_CODE < 0x020400
        if (lock.context != tdfx_res_ctx.handle) {
                current->counter = 5;
                current->priority = DEF_PRIORITY/4;
        }
-#if 0
-       while (current->counter > 25)
-               current->counter >>= 1; /* decrease time slice */
-       DRM_ERROR("pid = %5d, new counter = %5ld\n",
-                current->pid, current->counter);
 #endif
         DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
 
@@ -679,19 +675,11 @@ int tdfx_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
                }
        }
 
-#if 0
-       current->policy |= SCHED_YIELD;
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(1000);
-#endif
-
+#if LINUX_VERSION_CODE < 0x020400
        if (lock.context != tdfx_res_ctx.handle) {
                current->counter = 5;
                current->priority = DEF_PRIORITY;
        }
-#if 0
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(10);
 #endif
        
        return 0;
index e262213..9039da8 100644 (file)
@@ -9,9 +9,8 @@
 # Note 2! The CFLAGS definitions are now inherited from the
 # parent makes..
 #
-# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel,v 1.6 2000/06/17 00:03:34 martin Exp $
 
-L_TARGET        := libdrm.a
+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 \
@@ -19,35 +18,92 @@ L_OBJS              := init.o memory.o proc.o auth.o context.o drawable.o bufs.o \
 
 M_OBJS         := 
 
-ifdef CONFIG_DRM_GAMMA
-M_OBJS          += gamma.o
+ifeq ($(CONFIG_DRM_GAMMA),y)
+ OX_OBJS += gamma_drv.o
+ O_OBJS += gamma_dma.o
+else
+  ifeq ($(CONFIG_DRM_GAMMA),m)
+    MIX_OBJS += gamma_drv.o
+    MI_OBJS += gamma_dma.o
+    M_OBJS += gamma.o
+  endif
 endif
 
-ifdef CONFIG_DRM_TDFX
-M_OBJS          += tdfx.o
+ifeq ($(CONFIG_DRM_TDFX),y)
+ OX_OBJS += tdfx_drv.o
+ O_OBJS += tdfx_context.o
+else
+  ifeq ($(CONFIG_DRM_TDFX),m)
+    MIX_OBJS += tdfx_drv.o
+    MI_OBJS += tdfx_context.o
+    M_OBJS += tdfx.o
+  endif
 endif
 
-ifdef CONFIG_DRM_MGA
-M_OBJS         += mga.o
+ifeq ($(CONFIG_DRM_MGA),y)
+ OX_OBJS += mga_drv.o
+ O_OBJS += mga_context.o mga_dma.o mga_bufs.o mga_state.o
+else
+  ifeq ($(CONFIG_DRM_MGA),m)
+    MIX_OBJS += mga_drv.o
+    MI_OBJS += mga_context.o mga_dma.o mga_bufs.o mga_state.o
+    M_OBJS += mga.o
+  endif
 endif
 
-ifdef CONFIG_DRM_R128
-M_OBJS         += r128.o
+ifeq ($(CONFIG_DRM_I810),y)
+ OX_OBJS += i810_drv.o
+ O_OBJS += i810_context.o i810_bufs.o i810_dma.o
+else
+  ifeq ($(CONFIG_DRM_I810),m)
+    MIX_OBJS += i810_drv.o
+    MI_OBJS += i810_context.o i810_bufs.o i810_dma.o
+    M_OBJS += i810.o
+  endif
 endif
 
+ifeq ($(CONFIG_DRM_R128),y)
+ OX_OBJS += r128_drv.o
+ O_OBJS += r128_context.o
+else
+  ifeq ($(CONFIG_DRM_I810),m)
+    MIX_OBJS += r128_drv.o
+    MI_OBJS += r128_context.o
+    M_OBJS += r128.o
+  endif
+endif
+
+ifeq ($(CONFIG_DRM_FFB),y)
+ OX_OBJS += ffb_drv.o
+ O_OBJS += ffb_context.o
+else
+  ifeq ($(CONFIG_DRM_FFB),m)
+    MIX_OBJC += ffb_drv.o
+    MI_OBJS += ffb_context.o
+    M_OBJS += ffb.o
+  endif
+endif
+
+O_OBJS += $(L_OBJS)
+
 include $(TOPDIR)/Rules.make
 
-gamma.o: gamma_drv.o gamma_dma.o $(L_TARGET)
-       $(LD) $(LD_RFLAG) -r -o $@ gamma_drv.o gamma_dma.o -L. -ldrm
+gamma.o : gamma_drv.o gamma_dma.o $(L_OBJS)
+       $(LD) $(LD_RFLAG) -r -o $@ gamma_drv.o gamma_dma.o $(L_OBJS)
 
-tdfx.o: tdfx_drv.o tdfx_context.o $(L_TARGET)
-       $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o -L. -ldrm
+tdfx.o: tdfx_drv.o tdfx_context.o $(L_OBJS)
+       $(LD) $(LD_RFLAG) -r -o $@ tdfx_drv.o tdfx_context.o $(L_OBJS)
 
-i810.o: i810_drv.o i810_context.o $(L_TARGET)
-       $(LD) $(LD_RFLAG) -r -o $@ i810_drv.o i810_bufs.o i810_dma.o i810_context.o -L. -ldrm
+mga.o: mga_drv.o mga_context.o mga_dma.o mga_bufs.o mga_state.o $(L_OBJS)
+       $(LD) $(LD_RFLAG) -r -o $@ mga_drv.o mga_bufs.o mga_dma.o \
+               mga_context.o mga_state.o $(L_OBJS)
 
-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_bufs.o mga_dma.o mga_context.o mga_state.o -L. -ldrm
+i810.o: i810_drv.o i810_context.o i810_bufs.o i810_dma.o $(L_TARGET)
+       $(LD) $(LD_RFLAG) -r -o $@ i810_drv.o i810_bufs.o i810_dma.o \
+               i810_context.o $(L_OBJS)
 
 r128.o: r128_drv.o r128_context.o $(L_TARGET)
-       $(LD) $(LD_RFLAG) -r -o $@ r128_drv.o r128_context.o -L. -ldrm
+       $(LD) $(LD_RFLAG) -r -o $@ r128_drv.o r128_context.o $(L_OBJS)
+
+ffb.o: ffb_drv.o ffb_context.o $(L_OBJS)
+       $(LD) $(LD_RFLAG) -r -o $@ ffb_drv.o ffb_context.o $(L_OBJS)
index ecc196b..35aee3f 100644 (file)
@@ -188,7 +188,9 @@ drmstat: $(PROGOBJS)
 ChangeLog:
        @rm -f Changelog
        @rcs2log -i 2 -r -l \
-               | sed 's,@.*alephnull.com,@precisioninsight.com,' > ChangeLog
+               | sed 's,@.*light,,' \
+               | sed 's,/cvsroot/.*/drm/kernel/,,g' \
+               > ChangeLog
 
 
 # .o files are used for modules
index 011e424..fd3b124 100644 (file)
@@ -72,12 +72,14 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd,
 
        switch (map->type) {
        case _DRM_REGISTERS:
-       case _DRM_FRAME_BUFFER: 
+       case _DRM_FRAME_BUFFER:
+#ifndef __sparc__
                if (map->offset + map->size < map->offset
                    || map->offset < virt_to_phys(high_memory)) {
                        drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                        return -EINVAL;
                }
+#endif
 #ifdef CONFIG_MTRR
                if (map->type == _DRM_FRAME_BUFFER
                    || (map->flags & _DRM_WRITE_COMBINING)) {
@@ -484,8 +486,10 @@ int drm_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd,
                           -EFAULT);
 
        if (request.count >= dma->buf_count) {
+               down(&current->mm->mmap_sem);
                virtual = do_mmap(filp, 0, dma->byte_count,
                                  PROT_READ|PROT_WRITE, MAP_SHARED, 0);
+               up(&current->mm->mmap_sem);
                if (virtual > -1024UL) {
                                /* Real error */
                        retcode = (signed long)virtual;
index 4ade7aa..f3966d9 100644 (file)
@@ -94,7 +94,8 @@ int drm_release(struct inode *inode, struct file *filp)
        DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n",
                  current->pid, dev->device, dev->open_count);
 
-       if (_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
+       if (dev->lock.hw_lock
+           && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
            && dev->lock.pid == current->pid) {
                DRM_ERROR("Process %d dead, freeing lock for context %d\n",
                          current->pid,
@@ -222,8 +223,15 @@ int drm_write_string(drm_device_t *dev, const char *s)
            KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */
        if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO);
 #else
-       /* Parameter added in 2.3.21 */
+
+                               /* Parameter added in 2.3.21. */
+#if LINUX_VERSION_CODE < 0x020400
        if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN);
+#else
+                               /* Type of first parameter changed in
+                                   Linux 2.4.0-test2... */
+       if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN);
+#endif
 #endif
        DRM_DEBUG("waking\n");
        wake_up_interruptible(&dev->buf_readers);
index 987c903..fd811f1 100644 (file)
@@ -34,6 +34,7 @@
 #include "drmP.h"
 #include "gamma_drv.h"
 #include <linux/pci.h>
+#include <linux/smp_lock.h>    /* For (un)lock_kernel */
 EXPORT_SYMBOL(gamma_init);
 EXPORT_SYMBOL(gamma_cleanup);
 
@@ -54,6 +55,10 @@ EXPORT_SYMBOL(gamma_cleanup);
 static drm_device_t          gamma_device;
 
 static struct file_operations gamma_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    gamma_open,
        flush:   drm_flush,
        release: gamma_release,
@@ -284,12 +289,12 @@ static int gamma_takedown(drm_device_t *dev)
                                               - PAGE_SHIFT,
                                               DRM_MEM_SAREA);
                                break;
-#ifdef DRM_AGP
                        case _DRM_AGP:
+#ifdef DRM_AGP
                                /* Do nothing here, because this is all
                                    handled in the AGP/GART driver. */
-                               break;
 #endif
+                               break;
                        }
                        drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                }
@@ -476,6 +481,7 @@ int gamma_release(struct inode *inode, struct file *filp)
        int           retcode = 0;
 
        DRM_DEBUG("open_count = %d\n", dev->open_count);
+       lock_kernel();
        if (!(retcode = drm_release(inode, filp))) {
                MOD_DEC_USE_COUNT;
                atomic_inc(&dev->total_close);
@@ -486,13 +492,17 @@ int gamma_release(struct inode *inode, struct file *filp)
                                          atomic_read(&dev->ioctl_count),
                                          dev->blocked);
                                spin_unlock(&dev->count_lock);
+                               unlock_kernel();
                                return -EBUSY;
                        }
                        spin_unlock(&dev->count_lock);
-                       return gamma_takedown(dev);
+                       retcode = gamma_takedown(dev);
+                       unlock_kernel();
+                       return retcode;
                }
                spin_unlock(&dev->count_lock);
        }
+       unlock_kernel();
        return retcode;
 }
 
index d7e70f7..2cfbf6c 100644 (file)
@@ -25,7 +25,7 @@
  * DEALINGS IN THE SOFTWARE.
  * 
  * Authors:
- *    Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ *    Rickard E. (Rik) Faith <faith@valinux.com>
  * 
  */
 
index d7fa9d8..44b0321 100644 (file)
@@ -49,6 +49,10 @@ static drm_device_t        i810_device;
 drm_ctx_t                    i810_res_ctx;
 
 static struct file_operations i810_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    i810_open,
        flush:   drm_flush,
        release: i810_release,
index aefc884..8de3dac 100644 (file)
@@ -97,10 +97,17 @@ void drm_parse_options(char *s)
        }
 }
 
+/* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0
+ * otherwise. */
+
 int drm_cpu_valid(void)
 {
 #if defined(__i386__)
        if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */
 #endif
+#if defined(__sparc__) && !defined(__sparc_v9__)
+       if (1)
+               return 0; /* No cmpxchg before v9 sparc. */
+#endif
        return 1;
 }
index e77d827..1cc23fb 100644 (file)
@@ -48,6 +48,10 @@ static drm_device_t        mga_device;
 drm_ctx_t                    mga_res_ctx;
 
 static struct file_operations mga_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    mga_open,
        flush:   drm_flush,
        release: mga_release,
index ba6dee0..24dfe5f 100644 (file)
@@ -228,7 +228,7 @@ static int _drm_queues_info(char *buf, char **start, off_t offset, int len,
                atomic_inc(&q->use_count);
                DRM_PROC_PRINT_RET(atomic_dec(&q->use_count),
                                   "%5d/0x%03x %5d %5d"
-                                  " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n",
+                                  " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n",
                                   i,
                                   q->flags,
                                   atomic_read(&q->use_count),
@@ -351,17 +351,21 @@ static int drm_clients_info(char *buf, char **start, off_t offset, int len,
 
 #if DRM_DEBUG_CODE
 
+#define DRM_VMA_VERBOSE 0
+
 static int _drm_vma_info(char *buf, char **start, off_t offset, int len,
                         int *eof, void *data)
 {
        drm_device_t          *dev = (drm_device_t *)data;
        drm_vma_entry_t       *pt;
+       struct vm_area_struct *vma;
+#if DRM_VMA_VERBOSE
+       unsigned long         i;
+       unsigned long         address;
        pgd_t                 *pgd;
        pmd_t                 *pmd;
        pte_t                 *pte;
-       unsigned long         i;
-       struct vm_area_struct *vma;
-       unsigned long         address;
+#endif
 #if defined(__i386__)
        unsigned int          pgprot;
 #endif
index 8b66988..54c6e47 100644 (file)
@@ -47,6 +47,10 @@ static drm_device_t        r128_device;
 drm_ctx_t                    r128_res_ctx;
 
 static struct file_operations r128_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    r128_open,
        flush:   drm_flush,
        release: r128_release,
@@ -369,6 +373,13 @@ int r128_init(void)
 
 #ifdef DRM_AGP
        dev->agp    = drm_agp_init();
+       if (dev->agp == NULL) {
+               DRM_ERROR("Cannot initialize agpgart module.\n");
+               drm_proc_cleanup();
+               misc_deregister(&r128_misc);
+               r128_takedown(dev);
+               return -ENOMEM;
+       }
 
 #ifdef CONFIG_MTRR
        dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base,
@@ -664,19 +675,11 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd,
                }
         }
 
-#if 0
-       DRM_ERROR("pid = %5d, old counter = %5ld\n",
-               current->pid, current->counter);
-#endif
+#if LINUX_VERSION_CODE < 0x020400
        if (lock.context != r128_res_ctx.handle) {
                current->counter = 5;
                current->priority = DEF_PRIORITY/4;
        }
-#if 0
-       while (current->counter > 25)
-               current->counter >>= 1; /* decrease time slice */
-       DRM_ERROR("pid = %5d, new counter = %5ld\n",
-                current->pid, current->counter);
 #endif
         DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
 
@@ -718,19 +721,11 @@ int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
                }
        }
 
-#if 0
-       current->policy |= SCHED_YIELD;
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(1000);
-#endif
-
+#if LINUX_VERSION_CODE < 0x020400
        if (lock.context != r128_res_ctx.handle) {
                current->counter = 5;
                current->priority = DEF_PRIORITY;
        }
-#if 0
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(10);
 #endif
 
        return 0;
index 582832b..e0a31c5 100644 (file)
@@ -48,6 +48,10 @@ static drm_device_t        tdfx_device;
 drm_ctx_t                    tdfx_res_ctx;
 
 static struct file_operations tdfx_fops = {
+#if LINUX_VERSION_CODE >= 0x020322
+                               /* This started being used approx. 2.3.34 */
+       owner:   THIS_MODULE,
+#endif
        open:    tdfx_open,
        flush:   drm_flush,
        release: tdfx_release,
@@ -625,19 +629,11 @@ int tdfx_lock(struct inode *inode, struct file *filp, unsigned int cmd,
                }
         }
 
-#if 0
-       DRM_ERROR("pid = %5d, old counter = %5ld\n", 
-               current->pid, current->counter);
-#endif
+#if LINUX_VERSION_CODE < 0x020400
        if (lock.context != tdfx_res_ctx.handle) {
                current->counter = 5;
                current->priority = DEF_PRIORITY/4;
        }
-#if 0
-       while (current->counter > 25)
-               current->counter >>= 1; /* decrease time slice */
-       DRM_ERROR("pid = %5d, new counter = %5ld\n",
-                current->pid, current->counter);
 #endif
         DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
 
@@ -679,19 +675,11 @@ int tdfx_unlock(struct inode *inode, struct file *filp, unsigned int cmd,
                }
        }
 
-#if 0
-       current->policy |= SCHED_YIELD;
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(1000);
-#endif
-
+#if LINUX_VERSION_CODE < 0x020400
        if (lock.context != tdfx_res_ctx.handle) {
                current->counter = 5;
                current->priority = DEF_PRIORITY;
        }
-#if 0
-       current->state = TASK_INTERRUPTIBLE;
-       schedule_timeout(10);
 #endif
        
        return 0;
index 879e6d3..6bfcef1 100644 (file)
@@ -25,8 +25,8 @@
  * DEALINGS IN THE SOFTWARE.
  * 
  * Authors:
- *    Rickard E. (Rik) Faith <faith@precisioninsight.com>
- *    Daryll Strauss <daryll@precisioninsight.com>
+ *    Rickard E. (Rik) Faith <faith@valinux.com>
+ *    Daryll Strauss <daryll@valinux.com>
  * 
  */