aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:24:07 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:24:07 -0400
commit5f757f91e70a97eda8f0cc13bddc853209b2d173 (patch)
treee2e97796f5145b5d6eb3fee6ec93050d90f2bd7d
parent9fa0853a85a3a4067e4ad0aaa5d90984c2dd21b5 (diff)
parentce7dd06372058f9e3e57ee4c0aeba694a43a80ad (diff)
Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6: drm/i915: Add 965GM pci id update drm: just use io_remap_pfn_range on all archs.. drm: fix DRM_CONSISTENT mapping drm: fix up mmap locking in preparation for ttm changes drm: fix driver deadlock with AIGLX and reclaim_buffers_locked drm: fix warning in drm_fops.c drm: allow for more generic drm ioctls drm: fix alpha domain handling via: fix CX700 pci id drm: make drm_io_prot static. drm: remove via_mm.h drm: add missing NULL assignment drm/radeon: Fix u32 overflows when determining AGP base address in card space. drm: port over use_vmalloc code from git hashtab drm: fix crash with fops lock and fixup sarea/page size locking drm: bring bufs code from git tree. drm: move protection stuff into separate function drm: Use ARRAY_SIZE macro when appropriate drm: update README.drm (bugzilla #7933) drm: remove unused exports
-rw-r--r--drivers/char/drm/README.drm16
-rw-r--r--drivers/char/drm/drm.h4
-rw-r--r--drivers/char/drm/drmP.h23
-rw-r--r--drivers/char/drm/drm_bufs.c75
-rw-r--r--drivers/char/drm/drm_drv.c9
-rw-r--r--drivers/char/drm/drm_fops.c96
-rw-r--r--drivers/char/drm/drm_hashtab.c17
-rw-r--r--drivers/char/drm/drm_hashtab.h1
-rw-r--r--drivers/char/drm/drm_irq.c4
-rw-r--r--drivers/char/drm/drm_lock.c134
-rw-r--r--drivers/char/drm/drm_mm.c2
-rw-r--r--drivers/char/drm/drm_pciids.h3
-rw-r--r--drivers/char/drm/drm_proc.c2
-rw-r--r--drivers/char/drm/drm_stub.c1
-rw-r--r--drivers/char/drm/drm_vm.c102
-rw-r--r--drivers/char/drm/i915_dma.c3
-rw-r--r--drivers/char/drm/radeon_cp.c8
-rw-r--r--drivers/char/drm/sis_drv.c2
-rw-r--r--drivers/char/drm/via_drv.c3
-rw-r--r--drivers/char/drm/via_mm.h40
20 files changed, 349 insertions, 196 deletions
diff --git a/drivers/char/drm/README.drm b/drivers/char/drm/README.drm
index 6441e01e58..af74cd79a2 100644
--- a/drivers/char/drm/README.drm
+++ b/drivers/char/drm/README.drm
@@ -1,6 +1,6 @@
1************************************************************ 1************************************************************
2* For the very latest on DRI development, please see: * 2* For the very latest on DRI development, please see: *
3* http://dri.sourceforge.net/ * 3* http://dri.freedesktop.org/ *
4************************************************************ 4************************************************************
5 5
6The Direct Rendering Manager (drm) is a device-independent kernel-level 6The Direct Rendering Manager (drm) is a device-independent kernel-level
@@ -26,21 +26,19 @@ ways:
26 26
27 27
28Documentation on the DRI is available from: 28Documentation on the DRI is available from:
29 http://precisioninsight.com/piinsights.html 29 http://dri.freedesktop.org/wiki/Documentation
30 http://sourceforge.net/project/showfiles.php?group_id=387
31 http://dri.sourceforge.net/doc/
30 32
31For specific information about kernel-level support, see: 33For specific information about kernel-level support, see:
32 34
33 The Direct Rendering Manager, Kernel Support for the Direct Rendering 35 The Direct Rendering Manager, Kernel Support for the Direct Rendering
34 Infrastructure 36 Infrastructure
35 http://precisioninsight.com/dr/drm.html 37 http://dri.sourceforge.net/doc/drm_low_level.html
36 38
37 Hardware Locking for the Direct Rendering Infrastructure 39 Hardware Locking for the Direct Rendering Infrastructure
38 http://precisioninsight.com/dr/locking.html 40 http://dri.sourceforge.net/doc/hardware_locking_low_level.html
39 41
40 A Security Analysis of the Direct Rendering Infrastructure 42 A Security Analysis of the Direct Rendering Infrastructure
41 http://precisioninsight.com/dr/security.html 43 http://dri.sourceforge.net/doc/security_low_level.html
42 44
43************************************************************
44* For the very latest on DRI development, please see: *
45* http://dri.sourceforge.net/ *
46************************************************************
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h
index 8db9041e30..089198491f 100644
--- a/drivers/char/drm/drm.h
+++ b/drivers/char/drm/drm.h
@@ -654,11 +654,13 @@ typedef struct drm_set_version {
654 654
655/** 655/**
656 * Device specific ioctls should only be in their respective headers 656 * Device specific ioctls should only be in their respective headers
657 * The device specific ioctl range is from 0x40 to 0x79. 657 * The device specific ioctl range is from 0x40 to 0x99.
658 * Generic IOCTLS restart at 0xA0.
658 * 659 *
659 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and 660 * \sa drmCommandNone(), drmCommandRead(), drmCommandWrite(), and
660 * drmCommandReadWrite(). 661 * drmCommandReadWrite().
661 */ 662 */
662#define DRM_COMMAND_BASE 0x40 663#define DRM_COMMAND_BASE 0x40
664#define DRM_COMMAND_END 0xA0
663 665
664#endif 666#endif
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 85d99e21e1..80041d5b79 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -414,6 +414,10 @@ typedef struct drm_lock_data {
414 struct file *filp; /**< File descr of lock holder (0=kernel) */ 414 struct file *filp; /**< File descr of lock holder (0=kernel) */
415 wait_queue_head_t lock_queue; /**< Queue of blocked processes */ 415 wait_queue_head_t lock_queue; /**< Queue of blocked processes */
416 unsigned long lock_time; /**< Time of last lock in jiffies */ 416 unsigned long lock_time; /**< Time of last lock in jiffies */
417 spinlock_t spinlock;
418 uint32_t kernel_waiters;
419 uint32_t user_waiters;
420 int idle_has_lock;
417} drm_lock_data_t; 421} drm_lock_data_t;
418 422
419/** 423/**
@@ -590,6 +594,8 @@ struct drm_driver {
590 void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); 594 void (*reclaim_buffers) (struct drm_device * dev, struct file * filp);
591 void (*reclaim_buffers_locked) (struct drm_device *dev, 595 void (*reclaim_buffers_locked) (struct drm_device *dev,
592 struct file *filp); 596 struct file *filp);
597 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
598 struct file * filp);
593 unsigned long (*get_map_ofs) (drm_map_t * map); 599 unsigned long (*get_map_ofs) (drm_map_t * map);
594 unsigned long (*get_reg_ofs) (struct drm_device * dev); 600 unsigned long (*get_reg_ofs) (struct drm_device * dev);
595 void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); 601 void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
@@ -764,7 +770,7 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
764} 770}
765 771
766#ifdef __alpha__ 772#ifdef __alpha__
767#define drm_get_pci_domain(dev) dev->hose->bus->number 773#define drm_get_pci_domain(dev) dev->hose->index
768#else 774#else
769#define drm_get_pci_domain(dev) 0 775#define drm_get_pci_domain(dev) 0
770#endif 776#endif
@@ -915,9 +921,18 @@ extern int drm_lock(struct inode *inode, struct file *filp,
915 unsigned int cmd, unsigned long arg); 921 unsigned int cmd, unsigned long arg);
916extern int drm_unlock(struct inode *inode, struct file *filp, 922extern int drm_unlock(struct inode *inode, struct file *filp,
917 unsigned int cmd, unsigned long arg); 923 unsigned int cmd, unsigned long arg);
918extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); 924extern int drm_lock_take(drm_lock_data_t *lock_data, unsigned int context);
919extern int drm_lock_free(drm_device_t * dev, 925extern int drm_lock_free(drm_lock_data_t *lock_data, unsigned int context);
920 __volatile__ unsigned int *lock, unsigned int context); 926extern void drm_idlelock_take(drm_lock_data_t *lock_data);
927extern void drm_idlelock_release(drm_lock_data_t *lock_data);
928
929/*
930 * These are exported to drivers so that they can implement fencing using
931 * DMA quiscent + idle. DMA quiescent usually requires the hardware lock.
932 */
933
934extern int drm_i_have_hw_lock(struct file *filp);
935extern int drm_kernel_take_hw_lock(struct file *filp);
921 936
922 /* Buffer management support (drm_bufs.h) */ 937 /* Buffer management support (drm_bufs.h) */
923extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); 938extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request);
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c
index a6828cc14e..c11345856f 100644
--- a/drivers/char/drm/drm_bufs.c
+++ b/drivers/char/drm/drm_bufs.c
@@ -57,7 +57,8 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
57 list_for_each(list, &dev->maplist->head) { 57 list_for_each(list, &dev->maplist->head) {
58 drm_map_list_t *entry = list_entry(list, drm_map_list_t, head); 58 drm_map_list_t *entry = list_entry(list, drm_map_list_t, head);
59 if (entry->map && map->type == entry->map->type && 59 if (entry->map && map->type == entry->map->type &&
60 entry->map->offset == map->offset) { 60 ((entry->map->offset == map->offset) ||
61 (map->type == _DRM_SHM && map->flags==_DRM_CONTAINS_LOCK))) {
61 return entry; 62 return entry;
62 } 63 }
63 } 64 }
@@ -180,8 +181,20 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
180 if (map->type == _DRM_REGISTERS) 181 if (map->type == _DRM_REGISTERS)
181 map->handle = ioremap(map->offset, map->size); 182 map->handle = ioremap(map->offset, map->size);
182 break; 183 break;
183
184 case _DRM_SHM: 184 case _DRM_SHM:
185 list = drm_find_matching_map(dev, map);
186 if (list != NULL) {
187 if(list->map->size != map->size) {
188 DRM_DEBUG("Matching maps of type %d with "
189 "mismatched sizes, (%ld vs %ld)\n",
190 map->type, map->size, list->map->size);
191 list->map->size = map->size;
192 }
193
194 drm_free(map, sizeof(*map), DRM_MEM_MAPS);
195 *maplist = list;
196 return 0;
197 }
185 map->handle = vmalloc_user(map->size); 198 map->handle = vmalloc_user(map->size);
186 DRM_DEBUG("%lu %d %p\n", 199 DRM_DEBUG("%lu %d %p\n",
187 map->size, drm_order(map->size), map->handle); 200 map->size, drm_order(map->size), map->handle);
@@ -200,15 +213,45 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
200 dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */ 213 dev->sigdata.lock = dev->lock.hw_lock = map->handle; /* Pointer to lock */
201 } 214 }