summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorRik Faith <faith@alephnull.com>2000-07-19 18:38:41 +0000
committerRik Faith <faith@alephnull.com>2000-07-19 18:38:41 +0000
commitaed8549e91ade1582505ebce50e4a79d99b4436f (patch)
tree75fae913a2327facdbd944b373a7e9ebe4ec9c8c /linux
parent7b888f87fa5ec559df97a7e911dd5a3328895f6f (diff)
Sync with Linux 2.4.0-test4 kernel
Diffstat (limited to 'linux')
-rw-r--r--linux/Makefile.kernel94
-rw-r--r--linux/Makefile.linux4
-rw-r--r--linux/bufs.c6
-rw-r--r--linux/fops.c12
-rw-r--r--linux/gamma_drv.c16
-rw-r--r--linux/gamma_drv.h2
-rw-r--r--linux/i810_drv.c4
-rw-r--r--linux/init.c7
-rw-r--r--linux/mga_drv.c4
-rw-r--r--linux/proc.c12
-rw-r--r--linux/r128_drv.c31
-rw-r--r--linux/tdfx_drv.c24
-rw-r--r--linux/tdfx_drv.h4
13 files changed, 151 insertions, 69 deletions
diff --git a/linux/Makefile.kernel b/linux/Makefile.kernel
index e262213a..9039da81 100644
--- a/linux/Makefile.kernel
+++ b/linux/Makefile.kernel
@@ -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)
diff --git a/linux/Makefile.linux b/linux/Makefile.linux
index ecc196bd..35aee3f0 100644
--- a/linux/Makefile.linux
+++ b/linux/Makefile.linux
@@ -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
diff --git a/linux/bufs.c b/linux/bufs.c
index 011e4241..fd3b1248 100644
--- a/linux/bufs.c
+++ b/linux/bufs.c
@@ -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;
diff --git a/linux/fops.c b/linux/fops.c
index 4ade7aa1..f3966d96 100644
--- a/linux/fops.c
+++ b/linux/fops.c
@@ -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);
diff --git a/linux/gamma_drv.c b/linux/gamma_drv.c
index 987c903d..fd811f1d 100644
--- a/linux/gamma_drv.c
+++ b/linux/gamma_drv.c
@@ -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;
}
diff --git a/linux/gamma_drv.h b/linux/gamma_drv.h
index d7e70f7f..2cfbf6c8 100644
--- a/linux/gamma_drv.h
+++ b/linux/gamma_drv.h
@@ -25,7 +25,7 @@
* DEALINGS IN THE SOFTWARE.
*
* Authors:
- * Rickard E. (Rik) Faith <faith@precisioninsight.com>
+ * Rickard E. (Rik) Faith <faith@valinux.com>
*
*/
diff --git a/linux/i810_drv.c b/linux/i810_drv.c
index d7fa9d88..44b03217 100644
--- a/linux/i810_drv.c
+++ b/linux/i810_drv.c
@@ -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,
diff --git a/linux/init.c b/linux/init.c
index aefc884e..8de3dac9 100644
--- a/linux/init.c
+++ b/linux/init.c
@@ -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;
}
diff --git a/linux/mga_drv.c b/linux/mga_drv.c
index e77d827b..1cc23fb8 100644
--- a/linux/mga_drv.c
+++ b/linux/mga_drv.c
@@ -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,
diff --git a/linux/proc.c b/linux/proc.c
index ba6dee00..24dfe5f3 100644
--- a/linux/proc.c
+++ b/linux/proc.c
@@ -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
diff --git a/linux/r128_drv.c b/linux/r128_drv.c
index 8b669888..54c6e473 100644
--- a/linux/r128_drv.c
+++ b/linux/r128_drv.c
@@ -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;
diff --git a/linux/tdfx_drv.c b/linux/tdfx_drv.c
index 582832b5..e0a31c50 100644
--- a/linux/tdfx_drv.c
+++ b/linux/tdfx_drv.c
@@ -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;
diff --git a/linux/tdfx_drv.h b/linux/tdfx_drv.h
index 879e6d37..6bfcef1d 100644
--- a/linux/tdfx_drv.h
+++ b/linux/tdfx_drv.h
@@ -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>
*
*/