diff options
author | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2001-10-22 19:15:04 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@fairlite.demon.co.uk> | 2001-10-22 19:15:04 +0000 |
commit | 92ad1b60e109170e1fa7d22a4627efa7fa77aa71 (patch) | |
tree | ff97ad9ac80db45e800080adf71b7ba54fd925ef | |
parent | 87ec138e1421f408c0fa86fa3567544dd488711e (diff) |
merge kernel 2.4.13-pre6.
-rw-r--r-- | linux-core/drmP.h | 5 | ||||
-rw-r--r-- | linux-core/drm_drv.c | 20 | ||||
-rw-r--r-- | linux-core/drm_vm.c | 12 | ||||
-rw-r--r-- | linux/drmP.h | 5 | ||||
-rw-r--r-- | linux/drm_drv.h | 20 | ||||
-rw-r--r-- | linux/drm_vm.h | 12 |
6 files changed, 58 insertions, 16 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 4786ba9e..7557fdc9 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -71,11 +71,6 @@ #include <asm/pgalloc.h> #include "drm.h" -/* page_to_bus for earlier kernels, not optimal in all cases */ -#ifndef page_to_bus -#define page_to_bus(page) ((unsigned int)(virt_to_bus(page_address(page)))) -#endif - /* DRM template customization defaults */ #ifndef __HAVE_AGP diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 1ae3ec25..61c6cdd2 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -1027,6 +1027,25 @@ int DRM(unlock)( struct inode *inode, struct file *filp, atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); +#if __HAVE_KERNEL_CTX_SWITCH + /* We no longer really hold it, but if we are the next + * agent to request it then we should just be able to + * take it immediately and not eat the ioctl. + */ + dev->lock.pid = 0; + { + __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock; + unsigned int old, new, prev, ctx; + + ctx = lock.context; + do { + old = *plock; + new = ctx; + prev = cmpxchg(plock, old, new); + } while (prev != old); + } + wake_up_interruptible(&dev->lock.lock_queue); +#else DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT ); #if __HAVE_DMA_SCHEDULE @@ -1041,6 +1060,7 @@ int DRM(unlock)( struct inode *inode, struct file *filp, DRM_ERROR( "\n" ); } } +#endif /* !__HAVE_KERNEL_CTX_SWITCH */ unblock_all_signals(); return 0; diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index ce66f908..30b5b226 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -153,7 +153,7 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, page = pte_page(*pte); get_page(page); - DRM_DEBUG("0x%08lx => 0x%08x\n", address, page_to_bus(page)); + DRM_DEBUG("shm_nopage 0x%lx\n", address); return page; } @@ -255,8 +255,7 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, get_page(page); - DRM_DEBUG("0x%08lx (page %lu) => 0x%08x\n", address, page_nr, - page_to_bus(page)); + DRM_DEBUG("dma_nopage 0x%lx (page %lu)\n", address, page_nr); return page; } @@ -457,10 +456,17 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) vma->vm_flags |= VM_IO; /* not in core dump */ } offset = DRIVER_GET_REG_OFS(); +#ifdef __sparc__ + if (io_remap_page_range(vma->vm_start, + VM_OFFSET(vma) + offset, + vma->vm_end - vma->vm_start, + vma->vm_page_prot, 0)) +#else if (remap_page_range(vma->vm_start, VM_OFFSET(vma) + offset, vma->vm_end - vma->vm_start, vma->vm_page_prot)) +#endif return -EAGAIN; DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," " offset = 0x%lx\n", diff --git a/linux/drmP.h b/linux/drmP.h index 4786ba9e..7557fdc9 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -71,11 +71,6 @@ #include <asm/pgalloc.h> #include "drm.h" -/* page_to_bus for earlier kernels, not optimal in all cases */ -#ifndef page_to_bus -#define page_to_bus(page) ((unsigned int)(virt_to_bus(page_address(page)))) -#endif - /* DRM template customization defaults */ #ifndef __HAVE_AGP diff --git a/linux/drm_drv.h b/linux/drm_drv.h index 1ae3ec25..61c6cdd2 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -1027,6 +1027,25 @@ int DRM(unlock)( struct inode *inode, struct file *filp, atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); +#if __HAVE_KERNEL_CTX_SWITCH + /* We no longer really hold it, but if we are the next + * agent to request it then we should just be able to + * take it immediately and not eat the ioctl. + */ + dev->lock.pid = 0; + { + __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock; + unsigned int old, new, prev, ctx; + + ctx = lock.context; + do { + old = *plock; + new = ctx; + prev = cmpxchg(plock, old, new); + } while (prev != old); + } + wake_up_interruptible(&dev->lock.lock_queue); +#else DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT ); #if __HAVE_DMA_SCHEDULE @@ -1041,6 +1060,7 @@ int DRM(unlock)( struct inode *inode, struct file *filp, DRM_ERROR( "\n" ); } } +#endif /* !__HAVE_KERNEL_CTX_SWITCH */ unblock_all_signals(); return 0; diff --git a/linux/drm_vm.h b/linux/drm_vm.h index ce66f908..30b5b226 100644 --- a/linux/drm_vm.h +++ b/linux/drm_vm.h @@ -153,7 +153,7 @@ struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, page = pte_page(*pte); get_page(page); - DRM_DEBUG("0x%08lx => 0x%08x\n", address, page_to_bus(page)); + DRM_DEBUG("shm_nopage 0x%lx\n", address); return page; } @@ -255,8 +255,7 @@ struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, get_page(page); - DRM_DEBUG("0x%08lx (page %lu) => 0x%08x\n", address, page_nr, - page_to_bus(page)); + DRM_DEBUG("dma_nopage 0x%lx (page %lu)\n", address, page_nr); return page; } @@ -457,10 +456,17 @@ int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) vma->vm_flags |= VM_IO; /* not in core dump */ } offset = DRIVER_GET_REG_OFS(); +#ifdef __sparc__ + if (io_remap_page_range(vma->vm_start, + VM_OFFSET(vma) + offset, + vma->vm_end - vma->vm_start, + vma->vm_page_prot, 0)) +#else if (remap_page_range(vma->vm_start, VM_OFFSET(vma) + offset, vma->vm_end - vma->vm_start, vma->vm_page_prot)) +#endif return -EAGAIN; DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," " offset = 0x%lx\n", |