From 3c384a9ad5f964709a237cfe035ea5d6df2da5fa Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Wed, 11 Apr 2007 12:51:52 -0700 Subject: Add new buffer object type for kernel allocations that don't initially have a user mapping. (cherry picked from commit 2e21779992bd5026d8ec4dea52466377dbe5a0ed) --- linux-core/drm_bo.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'linux-core') diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 450e448c..9501ba6e 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -89,6 +89,9 @@ static int drm_bo_vm_pre_move(drm_buffer_object_t * bo, int old_is_pci) #ifdef DRM_ODD_MM_COMPAT int ret; + if (!bo->map_list.map) + return 0; + ret = drm_bo_lock_kmm(bo); if (ret) return ret; @@ -96,6 +99,9 @@ static int drm_bo_vm_pre_move(drm_buffer_object_t * bo, int old_is_pci) if (old_is_pci) drm_bo_finish_unmap(bo); #else + if (!bo->map_list.map) + return 0; + drm_bo_unmap_virtual(bo); #endif return 0; @@ -106,6 +112,9 @@ static void drm_bo_vm_post_move(drm_buffer_object_t * bo) #ifdef DRM_ODD_MM_COMPAT int ret; + if (!bo->map_list.map) + return; + ret = drm_bo_remap_bound(bo); if (ret) { DRM_ERROR("Failed to remap a bound buffer object.\n" @@ -131,6 +140,11 @@ static int drm_bo_add_ttm(drm_buffer_object_t * bo) if (!bo->ttm) ret = -ENOMEM; break; + case drm_bo_type_kernel: + bo->ttm = drm_ttm_init(dev, bo->mem.num_pages << PAGE_SHIFT); + if (!bo->ttm) + ret = -ENOMEM; + break; case drm_bo_type_user: case drm_bo_type_fake: break; -- cgit v1.2.3 From 71d44cda52f239b543cb1fad93ef35adc3093d38 Mon Sep 17 00:00:00 2001 From: Jesse Barnes Date: Thu, 26 Apr 2007 16:09:24 +1000 Subject: drm/ttm: allow drm_buffer_object_create to be used in-kernel --- linux-core/drm_bo.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'linux-core') diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 9501ba6e..1c7013b3 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -1540,7 +1540,7 @@ static int drm_bo_handle_wait(drm_file_t * priv, uint32_t handle, return ret; } -int drm_buffer_object_create(drm_file_t * priv, +int drm_buffer_object_create(drm_device_t *dev, unsigned long size, drm_bo_type_t type, uint32_t mask, @@ -1549,7 +1549,6 @@ int drm_buffer_object_create(drm_file_t * priv, unsigned long buffer_start, drm_buffer_object_t ** buf_obj) { - drm_device_t *dev = priv->head->dev; drm_buffer_manager_t *bm = &dev->bm; drm_buffer_object_t *bo; int ret = 0; @@ -1683,7 +1682,8 @@ int drm_bo_ioctl(DRM_IOCTL_ARGS) if (rep.ret) break; rep.ret = - drm_buffer_object_create(priv, req->size, + drm_buffer_object_create(priv->head->dev, + req->size, req->type, req->mask, req->hint, @@ -2306,6 +2306,9 @@ void drm_bo_unmap_virtual(drm_buffer_object_t * bo) loff_t offset = ((loff_t) bo->map_list.hash.key) << PAGE_SHIFT; loff_t holelen = ((loff_t) bo->mem.num_pages) << PAGE_SHIFT; + if (!dev->dev_mapping) + return; + unmap_mapping_range(dev->dev_mapping, offset, holelen, 1); } -- cgit v1.2.3 From 4b72759b307f046d71c08d9008b7467e0b3bb0ba Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 26 Apr 2007 16:22:11 +1000 Subject: drm: nopfn warning on 64-bit --- linux-core/drm_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-core') diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index 1f905fba..d39dfc77 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -739,7 +739,7 @@ static unsigned long drm_bo_vm_nopfn(struct vm_area_struct *vma, unsigned long bus_base; unsigned long bus_offset; unsigned long bus_size; - int ret = NOPFN_REFAULT; + unsigned long ret = NOPFN_REFAULT; if (address > vma->vm_end) return NOPFN_SIGBUS; -- cgit v1.2.3 From e5c1f1caa2a6b8c63aa6d0f8a70372eaf72f1840 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 26 Apr 2007 16:22:28 +1000 Subject: remove some whitespace violation --- linux-core/drm_objects.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux-core') diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h index fa26e915..737f0f5d 100644 --- a/linux-core/drm_objects.h +++ b/linux-core/drm_objects.h @@ -248,9 +248,9 @@ typedef struct drm_ttm_backend_func { typedef struct drm_ttm_backend { - uint32_t flags; - int mem_type; - drm_ttm_backend_func_t *func; + uint32_t flags; + int mem_type; + drm_ttm_backend_func_t *func; } drm_ttm_backend_t; typedef struct drm_ttm { -- cgit v1.2.3 From afc029e935a8f4667aff786c51818712487d185d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 26 Apr 2007 16:25:43 +1000 Subject: whitespace cleanup --- linux-core/drm_fence.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'linux-core') diff --git a/linux-core/drm_fence.c b/linux-core/drm_fence.c index 088c50d6..ce161dc3 100644 --- a/linux-core/drm_fence.c +++ b/linux-core/drm_fence.c @@ -1,8 +1,8 @@ /************************************************************************** - * + * * Copyright (c) 2006-2007 Tungsten Graphics, Inc., Cedar Park, TX., USA * All Rights Reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -10,17 +10,17 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ @@ -49,8 +49,6 @@ void drm_fence_handler(drm_device_t * dev, uint32_t class, int is_exe = (type & DRM_FENCE_TYPE_EXE); int ge_last_exe; - - diff = (sequence - fc->exe_flush_sequence) & driver->sequence_mask; if (fc->pending_exe_flush && is_exe && diff < driver->wrap_diff) @@ -59,13 +57,13 @@ void drm_fence_handler(drm_device_t * dev, uint32_t class, diff = (sequence - fc->last_exe_flush) & driver->sequence_mask; ge_last_exe = diff < driver->wrap_diff; - if (ge_last_exe) + if (ge_last_exe) fc->pending_flush &= ~type; if (is_exe && ge_last_exe) { fc->last_exe_flush = sequence; } - + if (list_empty(&fc->ring)) return; @@ -107,9 +105,8 @@ void drm_fence_handler(drm_device_t * dev, uint32_t class, fence->base.hash.key); list_del_init(&fence->ring); } - } - + if (wake) { DRM_WAKEUP(&fc->fence_queue); } @@ -266,7 +263,7 @@ void drm_fence_flush_old(drm_device_t * dev, uint32_t class, uint32_t sequence) fc->exe_flush_sequence = sequence - (driver->flush_diff / 2); } write_unlock_irqrestore(&fm->lock, flags); - + mutex_lock(&dev->struct_mutex); read_lock_irqsave(&fm->lock, flags); @@ -413,7 +410,7 @@ int drm_fence_object_emit(drm_device_t * dev, drm_fence_object_t * fence, fence->signaled = 0x00; fence->sequence = sequence; fence->native_type = native_type; - if (list_empty(&fc->ring)) + if (list_empty(&fc->ring)) fc->last_exe_flush = sequence - 1; list_add_tail(&fence->ring, &fc->ring); write_unlock_irqrestore(&fm->lock, flags); @@ -498,7 +495,6 @@ void drm_fence_manager_init(drm_device_t * dev) drm_fence_driver_t *fed = dev->driver->fence_driver; int i; - rwlock_init(&fm->lock); write_lock(&fm->lock); fm->initialized = 0; -- cgit v1.2.3 From 3a2c9f46212328a44533a45523d2a9f9b72a15da Mon Sep 17 00:00:00 2001 From: George Sapountzis Date: Thu, 26 Apr 2007 14:16:28 +0300 Subject: linux: minor indent. --- linux-core/drm_vm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'linux-core') diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c index d39dfc77..b8871539 100644 --- a/linux-core/drm_vm.c +++ b/linux-core/drm_vm.c @@ -516,8 +516,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) return -EINVAL; } - if (!capable(CAP_SYS_ADMIN) && - (dma->flags & _DRM_DMA_USE_PCI_RO)) { + if (!capable(CAP_SYS_ADMIN) && (dma->flags & _DRM_DMA_USE_PCI_RO)) { vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE); #if defined(__i386__) || defined(__x86_64__) pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; -- cgit v1.2.3 From 9f9c19065cecde16aa2994b6f777336a6e5f3409 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 28 Apr 2007 14:49:27 +1000 Subject: remove DRM_GETSAREA and replace with drm_getsarea function --- linux-core/drmP.h | 2 ++ linux-core/drm_drv.c | 14 ++++++++++++++ linux-core/drm_os_linux.h | 18 ------------------ 3 files changed, 16 insertions(+), 18 deletions(-) (limited to 'linux-core') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 271c6c8e..37b93525 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1128,6 +1128,8 @@ extern drm_head_t **drm_heads; extern struct drm_sysfs_class *drm_class; extern struct proc_dir_entry *drm_proc_root; +extern drm_local_map_t *drm_getsarea(struct drm_device *dev); + /* Proc support (drm_proc.h) */ extern int drm_proc_init(drm_device_t * dev, int minor, diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index b95f796f..3dc4d53c 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -622,3 +622,17 @@ err_i1: return retcode; } EXPORT_SYMBOL(drm_ioctl); + +drm_local_map_t *drm_getsarea(struct drm_device *dev) +{ + drm_map_list_t *entry; + + list_for_each_entry(entry, &dev->maplist->head, head) { + if (entry->map && entry->map->type == _DRM_SHM && + (entry->map->flags & _DRM_CONTAINS_LOCK)) { + return entry->map; + } + } + return NULL; +} +EXPORT_SYMBOL(drm_getsarea); diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h index 816959e8..2ea105c5 100644 --- a/linux-core/drm_os_linux.h +++ b/linux-core/drm_os_linux.h @@ -119,24 +119,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size) #define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data -/** - * Get the pointer to the SAREA. - * - * Searches the SAREA on the mapping lists and points drm_device::sarea to it. - */ -#define DRM_GETSAREA() \ -do { \ - drm_map_list_t *entry; \ - list_for_each_entry( entry, &dev->maplist->head, head ) { \ - if ( entry->map && \ - entry->map->type == _DRM_SHM && \ - (entry->map->flags & _DRM_CONTAINS_LOCK) ) { \ - dev_priv->sarea = entry->map; \ - break; \ - } \ - } \ -} while (0) - #define DRM_HZ HZ #define DRM_WAIT_ON( ret, queue, timeout, condition ) \ -- cgit v1.2.3 From e9b3acd25733517420f7b9fea01cfd529d909348 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 28 Apr 2007 15:04:49 +1000 Subject: remove register usage --- linux-core/drm_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-core') diff --git a/linux-core/drm_memory.c b/linux-core/drm_memory.c index 86c869f1..759e1f15 100644 --- a/linux-core/drm_memory.c +++ b/linux-core/drm_memory.c @@ -47,7 +47,7 @@ static struct { static inline size_t drm_size_align(size_t size) { - register size_t tmpSize = 4; + size_t tmpSize = 4; if (size > PAGE_SIZE) return PAGE_ALIGN(size); -- cgit v1.2.3 From 6e860d08d0f5b1e9a2d711aaf9fd6b982aa8039e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 28 Apr 2007 15:05:20 +1000 Subject: drm: add new drm_wait_on function to replace macro --- linux-core/drmP.h | 4 +++- linux-core/drm_drv.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) (limited to 'linux-core') diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 37b93525..a3f9ca86 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1129,7 +1129,9 @@ extern struct drm_sysfs_class *drm_class; extern struct proc_dir_entry *drm_proc_root; extern drm_local_map_t *drm_getsarea(struct drm_device *dev); - +extern int drm_wait_on(drm_device_t *dev, wait_queue_head_t *queue, + int timeout, int (*fn)(drm_device_t *dev, void *priv), + void *priv); /* Proc support (drm_proc.h) */ extern int drm_proc_init(drm_device_t * dev, int minor, diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c index 3dc4d53c..e5788d76 100644 --- a/linux-core/drm_drv.c +++ b/linux-core/drm_drv.c @@ -623,6 +623,34 @@ err_i1: } EXPORT_SYMBOL(drm_ioctl); +int drm_wait_on(drm_device_t *dev, wait_queue_head_t *queue, int timeout, + int (*fn)(drm_device_t *dev, void *priv), void *priv) +{ + DECLARE_WAITQUEUE(entry, current); + unsigned long end = jiffies + (timeout); + int ret = 0; + add_wait_queue(queue, &entry); + + for (;;) { + __set_current_state(TASK_INTERRUPTIBLE); + if ((*fn)(dev, priv)) + break; + if (time_after_eq(jiffies, end)) { + ret = -EBUSY; + break; + } + schedule_timeout((HZ/100 > 1) ? HZ/100 : 1); + if (signal_pending(current)) { + ret = -EINTR; + break; + } + } + __set_current_state(TASK_RUNNING); + remove_wait_queue(queue, &entry); + return ret; +} +EXPORT_SYMBOL(drm_wait_on); + drm_local_map_t *drm_getsarea(struct drm_device *dev) { drm_map_list_t *entry; -- cgit v1.2.3 From c9cd2c768bd37adadb87476f55f95e7b2336bc6b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 6 May 2007 10:50:10 +1000 Subject: drm: remove unused define DRM_HAS_TTM --- linux-core/drm_objects.h | 1 - 1 file changed, 1 deletion(-) (limited to 'linux-core') diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h index 737f0f5d..ea300c18 100644 --- a/linux-core/drm_objects.h +++ b/linux-core/drm_objects.h @@ -30,7 +30,6 @@ #ifndef _DRM_OBJECTS_H #define _DRM_OJBECTS_H -#define DRM_HAS_TTM struct drm_device; -- cgit v1.2.3 From c4e2caec44c5c1837d676ff0f5ad0747b2e570a7 Mon Sep 17 00:00:00 2001 From: Brian Date: Sun, 6 May 2007 10:09:59 -0600 Subject: s/OJBECTS/OBJECTS/ --- linux-core/drm_objects.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux-core') diff --git a/linux-core/drm_objects.h b/linux-core/drm_objects.h index ea300c18..03ea927e 100644 --- a/linux-core/drm_objects.h +++ b/linux-core/drm_objects.h @@ -29,7 +29,7 @@ */ #ifndef _DRM_OBJECTS_H -#define _DRM_OJBECTS_H +#define _DRM_OBJECTS_H struct drm_device; -- cgit v1.2.3 From ea98d7e79657469545b865a353784d79fc8cff9d Mon Sep 17 00:00:00 2001 From: Stephane Marchesin Date: Thu, 17 May 2007 17:35:14 +0200 Subject: nouveau: don't build the module by default --- linux-core/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'linux-core') diff --git a/linux-core/Makefile b/linux-core/Makefile index af29bd6a..1758777c 100644 --- a/linux-core/Makefile +++ b/linux-core/Makefile @@ -283,6 +283,7 @@ CONFIG_DRM_SAVAGE := n CONFIG_DRM_VIA := n CONFIG_DRM_MACH64 := n CONFIG_DRM_NV := n +CONFIG_DRM_NOUVEAU := n # Enable module builds for the modules requested/supported. -- cgit v1.2.3