Loading drivers/char/drm/ati_pcigart.c +86 −66 Original line number Diff line number Diff line /** * \file ati_pcigart.h * \file ati_pcigart.c * ATI PCI GART support * * \author Gareth Hughes <gareth@valinux.com> Loading Loading @@ -92,8 +92,7 @@ static void drm_ati_free_pcigart_table( unsigned long address ) } int drm_ati_pcigart_cleanup(drm_device_t * dev, unsigned long addr, dma_addr_t bus_addr) drm_ati_pcigart_info * gart_info) { drm_sg_mem_t *entry = dev->sg; unsigned long pages; Loading @@ -105,32 +104,39 @@ int drm_ati_pcigart_cleanup( drm_device_t *dev, return 0; } if ( bus_addr ) { pci_unmap_single(dev->pdev, bus_addr, if (gart_info->bus_addr) { if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { pci_unmap_single(dev->pdev, gart_info->bus_addr, ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, PCI_DMA_TODEVICE); } pages = (entry->pages <= ATI_MAX_PCIGART_PAGES) ? entry->pages : ATI_MAX_PCIGART_PAGES; for (i = 0; i < pages; i++) { if ( !entry->busaddr[i] ) break; if (!entry->busaddr[i]) break; pci_unmap_single(dev->pdev, entry->busaddr[i], PAGE_SIZE, PCI_DMA_TODEVICE); } if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) gart_info->bus_addr = 0; } if ( addr ) { drm_ati_free_pcigart_table( addr ); if (gart_info->gart_table_location == DRM_ATI_GART_MAIN && gart_info->addr) { drm_ati_free_pcigart_table(gart_info->addr); gart_info->addr = 0; } return 1; } EXPORT_SYMBOL(drm_ati_pcigart_cleanup); int drm_ati_pcigart_init( drm_device_t *dev, unsigned long *addr, dma_addr_t *bus_addr) int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) { drm_sg_mem_t *entry = dev->sg; unsigned long address = 0; Loading @@ -143,6 +149,9 @@ int drm_ati_pcigart_init( drm_device_t *dev, goto done; } if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); address = drm_ati_alloc_pcigart_table(); if (!address) { DRM_ERROR("cannot allocate PCI GART page!\n"); Loading @@ -155,14 +164,20 @@ int drm_ati_pcigart_init( drm_device_t *dev, } bus_address = pci_map_single(dev->pdev, (void *)address, ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, PCI_DMA_TODEVICE); ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, PCI_DMA_TODEVICE); if (bus_address == 0) { DRM_ERROR("unable to map PCIGART pages!\n"); drm_ati_free_pcigart_table(address); address = 0; goto done; } } else { address = gart_info->addr; bus_address = gart_info->bus_addr; DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n", bus_address, address); } pci_gart = (u32 *) address; Loading @@ -174,12 +189,12 @@ int drm_ati_pcigart_init( drm_device_t *dev, for (i = 0; i < pages; i++) { /* we need to support large memory configurations */ entry->busaddr[i] = pci_map_single(dev->pdev, page_address( entry->pagelist[i] ), PAGE_SIZE, PCI_DMA_TODEVICE); page_address(entry-> pagelist[i]), PAGE_SIZE, PCI_DMA_TODEVICE); if (entry->busaddr[i] == 0) { DRM_ERROR("unable to map PCIGART pages!\n"); drm_ati_pcigart_cleanup( dev, address, bus_address ); drm_ati_pcigart_cleanup(dev, gart_info); address = 0; bus_address = 0; goto done; Loading @@ -187,7 +202,11 @@ int drm_ati_pcigart_init( drm_device_t *dev, page_base = (u32) entry->busaddr[i]; for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { *pci_gart++ = cpu_to_le32( page_base ); if (gart_info->is_pcie) *pci_gart = (cpu_to_le32(page_base) >> 8) | 0xc; else *pci_gart = cpu_to_le32(page_base); *pci_gart++; page_base += ATI_PCIGART_PAGE_SIZE; } } Loading @@ -201,8 +220,9 @@ int drm_ati_pcigart_init( drm_device_t *dev, #endif done: *addr = address; *bus_addr = bus_address; gart_info->addr = address; gart_info->bus_addr = bus_address; return ret; } EXPORT_SYMBOL(drm_ati_pcigart_init); drivers/char/drm/drm.h +126 −169 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DRM_H_ #define _DRM_H_ Loading Loading @@ -97,13 +96,11 @@ #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) typedef unsigned int drm_handle_t; typedef unsigned int drm_context_t; typedef unsigned int drm_drawable_t; typedef unsigned int drm_magic_t; /** * Cliprect. * Loading @@ -120,7 +117,6 @@ typedef struct drm_clip_rect { unsigned short y2; } drm_clip_rect_t; /** * Texture region, */ Loading @@ -144,7 +140,6 @@ typedef struct drm_hw_lock { char padding[60]; /**< Pad to cache line */ } drm_hw_lock_t; /** * DRM_IOCTL_VERSION ioctl argument type. * Loading @@ -162,7 +157,6 @@ typedef struct drm_version { char __user *desc; /**< User-space buffer to hold desc */ } drm_version_t; /** * DRM_IOCTL_GET_UNIQUE ioctl argument type. * Loading @@ -173,18 +167,15 @@ typedef struct drm_unique { char __user *unique; /**< Unique name for driver instantiation */ } drm_unique_t; typedef struct drm_list { int count; /**< Length of user-space structures */ drm_version_t __user *version; } drm_list_t; typedef struct drm_block { int unused; } drm_block_t; /** * DRM_IOCTL_CONTROL ioctl argument type. * Loading @@ -200,7 +191,6 @@ typedef struct drm_control { int irq; } drm_control_t; /** * Type of memory to map. */ Loading @@ -213,7 +203,6 @@ typedef enum drm_map_type { _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ } drm_map_type_t; /** * Memory mapping flags. */ Loading @@ -227,13 +216,11 @@ typedef enum drm_map_flags { _DRM_REMOVABLE = 0x40 /**< Removable mapping */ } drm_map_flags_t; typedef struct drm_ctx_priv_map { unsigned int ctx_id; /**< Context requesting private mapping */ void *handle; /**< Handle of map */ } drm_ctx_priv_map_t; /** * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls * argument type. Loading @@ -251,7 +238,6 @@ typedef struct drm_map { /* Private data */ } drm_map_t; /** * DRM_IOCTL_GET_CLIENT ioctl argument type. */ Loading @@ -264,7 +250,6 @@ typedef struct drm_client { unsigned long iocs; /**< Ioctl count */ } drm_client_t; typedef enum { _DRM_STAT_LOCK, _DRM_STAT_OPENS, Loading @@ -282,11 +267,9 @@ typedef enum { _DRM_STAT_DMA, /**< DMA */ _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ _DRM_STAT_MISSED /**< Missed DMA opportunity */ /* Add to the *END* of the list */ } drm_stat_type_t; /** * DRM_IOCTL_GET_STATS ioctl argument type. */ Loading @@ -298,7 +281,6 @@ typedef struct drm_stats { } data[15]; } drm_stats_t; /** * Hardware locking flags. */ Loading @@ -314,7 +296,6 @@ typedef enum drm_lock_flags { _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ } drm_lock_flags_t; /** * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. * Loading @@ -325,7 +306,6 @@ typedef struct drm_lock { drm_lock_flags_t flags; } drm_lock_t; /** * DMA flags * Loading Loading @@ -355,7 +335,6 @@ typedef enum drm_dma_flags { _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ } drm_dma_flags_t; /** * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. * Loading @@ -378,7 +357,6 @@ typedef struct drm_buf_desc { */ } drm_buf_desc_t; /** * DRM_IOCTL_INFO_BUFS ioctl argument type. */ Loading @@ -387,7 +365,6 @@ typedef struct drm_buf_info { drm_buf_desc_t __user *list; } drm_buf_info_t; /** * DRM_IOCTL_FREE_BUFS ioctl argument type. */ Loading @@ -396,7 +373,6 @@ typedef struct drm_buf_free { int __user *list; } drm_buf_free_t; /** * Buffer information * Loading @@ -409,7 +385,6 @@ typedef struct drm_buf_pub { void __user *address; /**< Address of buffer */ } drm_buf_pub_t; /** * DRM_IOCTL_MAP_BUFS ioctl argument type. */ Loading @@ -419,7 +394,6 @@ typedef struct drm_buf_map { drm_buf_pub_t __user *list; /**< Buffer information */ } drm_buf_map_t; /** * DRM_IOCTL_DMA ioctl argument type. * Loading @@ -440,13 +414,11 @@ typedef struct drm_dma { int granted_count; /**< Number of buffers granted */ } drm_dma_t; typedef enum { _DRM_CONTEXT_PRESERVED = 0x01, _DRM_CONTEXT_2DONLY = 0x02 } drm_ctx_flags_t; /** * DRM_IOCTL_ADD_CTX ioctl argument type. * Loading @@ -457,7 +429,6 @@ typedef struct drm_ctx { drm_ctx_flags_t flags; } drm_ctx_t; /** * DRM_IOCTL_RES_CTX ioctl argument type. */ Loading @@ -466,7 +437,6 @@ typedef struct drm_ctx_res { drm_ctx_t __user *contexts; } drm_ctx_res_t; /** * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. */ Loading @@ -474,7 +444,6 @@ typedef struct drm_draw { drm_drawable_t handle; } drm_draw_t; /** * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. */ Loading @@ -482,7 +451,6 @@ typedef struct drm_auth { drm_magic_t magic; } drm_auth_t; /** * DRM_IOCTL_IRQ_BUSID ioctl argument type. * Loading @@ -495,24 +463,20 @@ typedef struct drm_irq_busid { int funcnum; /**< function number */ } drm_irq_busid_t; typedef enum { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ } drm_vblank_seq_type_t; #define _DRM_VBLANK_FLAGS_MASK _DRM_VBLANK_SIGNAL struct drm_wait_vblank_request { drm_vblank_seq_type_t type; unsigned int sequence; unsigned long signal; }; struct drm_wait_vblank_reply { drm_vblank_seq_type_t type; unsigned int sequence; Loading @@ -520,7 +484,6 @@ struct drm_wait_vblank_reply { long tval_usec; }; /** * DRM_IOCTL_WAIT_VBLANK ioctl argument type. * Loading @@ -531,7 +494,6 @@ typedef union drm_wait_vblank { struct drm_wait_vblank_reply reply; } drm_wait_vblank_t; /** * DRM_IOCTL_AGP_ENABLE ioctl argument type. * Loading @@ -541,7 +503,6 @@ typedef struct drm_agp_mode { unsigned long mode; /**< AGP mode */ } drm_agp_mode_t; /** * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. * Loading @@ -554,7 +515,6 @@ typedef struct drm_agp_buffer { unsigned long physical; /**< Physical used by i810 */ } drm_agp_buffer_t; /** * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. * Loading @@ -565,7 +525,6 @@ typedef struct drm_agp_binding { unsigned long offset; /**< In bytes -- will round to page boundary */ } drm_agp_binding_t; /** * DRM_IOCTL_AGP_INFO ioctl argument type. * Loading @@ -587,7 +546,6 @@ typedef struct drm_agp_info { unsigned short id_device; } drm_agp_info_t; /** * DRM_IOCTL_SG_ALLOC ioctl argument type. */ Loading @@ -606,7 +564,6 @@ typedef struct drm_set_version { int drm_dd_minor; } drm_set_version_t; #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) Loading drivers/char/drm/drmP.h +446 −440 Original line number Diff line number Diff line Loading @@ -108,7 +108,6 @@ #define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */ #define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */ #define DRM_LOOPING_LIMIT 5000000 #define DRM_BSZ 1024 /**< Buffer size for /dev/drm? output */ #define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */ #define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */ Loading Loading @@ -141,7 +140,6 @@ /*@}*/ /***********************************************************************/ /** \name Backward compatibility section */ /*@{*/ Loading @@ -166,7 +164,6 @@ /*@}*/ /***********************************************************************/ /** \name Macros to make printk easier */ /*@{*/ Loading Loading @@ -223,14 +220,13 @@ /*@}*/ /***********************************************************************/ /** \name Internal types and structures */ /*@{*/ #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define DRM_MIN(a,b) ((a)<(b)?(a):(b)) #define DRM_MAX(a,b) ((a)>(b)?(a):(b)) #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x) #define DRM_MIN(a,b) min(a,b) #define DRM_MAX(a,b) max(a,b) #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) Loading Loading @@ -348,7 +344,6 @@ typedef struct drm_buf { void *dev_private; /**< Per-buffer private storage */ } drm_buf_t; /** bufs is one longer than it has to be */ typedef struct drm_waitlist { int count; /**< Number of possible buffers */ Loading Loading @@ -523,7 +518,6 @@ typedef struct drm_ctx_list { drm_file_t *tag; /**< associated fd private data */ } drm_ctx_list_t; typedef struct drm_vbl_sig { struct list_head head; unsigned int sequence; Loading @@ -531,6 +525,16 @@ typedef struct drm_vbl_sig { struct task_struct *task; } drm_vbl_sig_t; /* location of GART table */ #define DRM_ATI_GART_MAIN 1 #define DRM_ATI_GART_FB 2 typedef struct ati_pcigart_info { int gart_table_location; int is_pcie; unsigned long addr; dma_addr_t bus_addr; } drm_ati_pcigart_info; /** * DRM driver structure. This structure represent the common code for Loading @@ -554,8 +558,10 @@ struct drm_driver { int (*dma_quiescent) (struct drm_device *); int (*context_ctor) (struct drm_device * dev, int context); int (*context_dtor) (struct drm_device * dev, int context); int (*kernel_context_switch)(struct drm_device *dev, int old, int new); void (*kernel_context_switch_unlock)(struct drm_device *dev, drm_lock_t *lock); int (*kernel_context_switch) (struct drm_device * dev, int old, int new); void (*kernel_context_switch_unlock) (struct drm_device * dev, drm_lock_t * lock); int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); /** Loading Loading @@ -700,10 +706,6 @@ typedef struct drm_device { cycles_t ctx_start; cycles_t lck_start; char buf[DRM_BSZ]; /**< Output buffer */ char *buf_rp; /**< Read pointer */ char *buf_wp; /**< Write pointer */ char *buf_end; /**< End pointer */ struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ wait_queue_head_t buf_readers; /**< Processes waiting to read */ wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ Loading @@ -730,7 +732,8 @@ typedef struct drm_device { drm_head_t primary; /**< primary screen head */ } drm_device_t; static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) { return ((dev->driver->driver_features & feature) ? 1 : 0); } Loading Loading @@ -787,12 +790,11 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) extern void drm_mem_init(void); extern int drm_mem_info(char *buf, char **start, off_t offset, int request, int *eof, void *data); extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); extern unsigned long drm_alloc_pages(int order, int area); extern void drm_free_pages(unsigned long address, int order, int area); extern void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev); extern void drm_free_pages(unsigned long address, int order, int area); extern void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t * dev); extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, drm_device_t * dev); extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t * dev); Loading Loading @@ -849,7 +851,6 @@ extern int drm_adddraw(struct inode *inode, struct file *filp, extern int drm_rmdraw(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Authentication IOCTL support (drm_auth.h) */ extern int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); Loading @@ -865,11 +866,9 @@ extern int drm_lock(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_unlock(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); extern int drm_lock_free(drm_device_t * dev, __volatile__ unsigned int *lock, unsigned int context); __volatile__ unsigned int *lock, unsigned int context); /* Buffer management support (drm_bufs.h) */ extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); Loading Loading @@ -942,7 +941,8 @@ extern int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type); extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type); extern int drm_agp_free_memory(DRM_AGP_MEM * handle); extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start); extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle); Loading Loading @@ -976,11 +976,9 @@ extern int drm_sg_free(struct inode *inode, struct file *filp, /* ATI PCIGART support (ati_pcigart.h) */ extern int drm_ati_pcigart_init(drm_device_t * dev, unsigned long *addr, dma_addr_t *bus_addr); drm_ati_pcigart_info * gart_info); extern int drm_ati_pcigart_cleanup(drm_device_t * dev, unsigned long addr, dma_addr_t bus_addr); drm_ati_pcigart_info * gart_info); extern drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align, dma_addr_t maxaddr); Loading @@ -998,25 +996,28 @@ extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, const char *fmt, ...); extern void drm_sysfs_device_remove(dev_t dev); /* Inline replacements for DRM_IOREMAP macros */ static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev) static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev) { map->handle = drm_ioremap(map->offset, map->size, dev); } static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev) static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev) { map->handle = drm_ioremap_nocache(map->offset, map->size, dev); } static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev) static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev) { if (map->handle && map->size) drm_ioremapfree(map->handle, map->size, dev); } static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned int token) static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned int token) { drm_map_list_t *_entry; list_for_each_entry(_entry, &dev->maplist->head, head) Loading @@ -1038,6 +1039,11 @@ static __inline__ int drm_device_is_agp(drm_device_t *dev) return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); } static __inline__ int drm_device_is_pcie(drm_device_t * dev) { return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); } static __inline__ void drm_core_dropmap(struct drm_map *map) { } Loading drivers/char/drm/drm_agpsupport.c +79 −71 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ int drm_agp_info(drm_device_t *dev, drm_agp_info_t *info) return 0; } EXPORT_SYMBOL(drm_agp_info); int drm_agp_info_ioctl(struct inode *inode, struct file *filp, Loading Loading @@ -107,6 +108,7 @@ int drm_agp_acquire(drm_device_t *dev) dev->agp->acquired = 1; return 0; } EXPORT_SYMBOL(drm_agp_acquire); /** Loading Loading @@ -145,6 +147,7 @@ int drm_agp_release(drm_device_t *dev) dev->agp->acquired = 0; return 0; } EXPORT_SYMBOL(drm_agp_release); int drm_agp_release_ioctl(struct inode *inode, struct file *filp, Loading Loading @@ -177,6 +180,7 @@ int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode) dev->agp->enabled = 1; return 0; } EXPORT_SYMBOL(drm_agp_enable); int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, Loading @@ -186,7 +190,6 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, drm_device_t *dev = priv->head->dev; drm_agp_mode_t mode; if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode))) return -EFAULT; Loading Loading @@ -301,7 +304,8 @@ int drm_agp_unbind(struct inode *inode, struct file *filp, if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request))) if (copy_from_user (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) return -EFAULT; if (!(entry = drm_agp_lookup_entry(dev, request.handle))) return -EINVAL; Loading Loading @@ -338,7 +342,8 @@ int drm_agp_bind(struct inode *inode, struct file *filp, if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request))) if (copy_from_user (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) return -EFAULT; if (!(entry = drm_agp_lookup_entry(dev, request.handle))) return -EINVAL; Loading Loading @@ -377,7 +382,8 @@ int drm_agp_free(struct inode *inode, struct file *filp, if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_buffer_t __user *)arg, sizeof(request))) if (copy_from_user (&request, (drm_agp_buffer_t __user *) arg, sizeof(request))) return -EFAULT; if (!(entry = drm_agp_lookup_entry(dev, request.handle))) return -EINVAL; Loading Loading @@ -433,7 +439,8 @@ drm_agp_head_t *drm_agp_init(drm_device_t *dev) } /** Calls agp_allocate_memory() */ DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type) DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data * bridge, size_t pages, u32 type) { return agp_allocate_memory(bridge, pages, type); } Loading @@ -454,6 +461,7 @@ int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start) return -EINVAL; return agp_bind_memory(handle, start); } EXPORT_SYMBOL(drm_agp_bind_memory); /** Calls agp_unbind_memory() */ Loading drivers/char/drm/drm_auth.c +35 −33 Original line number Diff line number Diff line /** * \file drm_auth.h * \file drm_auth.c * IOCTLs for authentication * * \author Rickard E. (Rik) Faith <faith@valinux.com> Loading Loading @@ -87,7 +87,8 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) * associated the magic number hash key in drm_device::magiclist, while holding * the drm_device::struct_sem lock. */ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, drm_magic_t magic) { int hash; drm_magic_entry_t *entry; Loading @@ -96,7 +97,8 @@ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) hash = drm_hash_magic(magic); entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC); if (!entry) return -ENOMEM; if (!entry) return -ENOMEM; memset(entry, 0, sizeof(*entry)); entry->magic = magic; entry->priv = priv; Loading Loading @@ -130,7 +132,6 @@ static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) drm_magic_entry_t *pt; int hash; DRM_DEBUG("%d\n", magic); hash = drm_hash_magic(magic); Loading Loading @@ -185,7 +186,8 @@ int drm_getmagic(struct inode *inode, struct file *filp, } else { do { spin_lock(&lock); if (!sequence) ++sequence; /* reserve 0 */ if (!sequence) ++sequence; /* reserve 0 */ auth.magic = sequence++; spin_unlock(&lock); } while (drm_find_file(dev, auth.magic)); Loading Loading
drivers/char/drm/ati_pcigart.c +86 −66 Original line number Diff line number Diff line /** * \file ati_pcigart.h * \file ati_pcigart.c * ATI PCI GART support * * \author Gareth Hughes <gareth@valinux.com> Loading Loading @@ -92,8 +92,7 @@ static void drm_ati_free_pcigart_table( unsigned long address ) } int drm_ati_pcigart_cleanup(drm_device_t * dev, unsigned long addr, dma_addr_t bus_addr) drm_ati_pcigart_info * gart_info) { drm_sg_mem_t *entry = dev->sg; unsigned long pages; Loading @@ -105,32 +104,39 @@ int drm_ati_pcigart_cleanup( drm_device_t *dev, return 0; } if ( bus_addr ) { pci_unmap_single(dev->pdev, bus_addr, if (gart_info->bus_addr) { if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { pci_unmap_single(dev->pdev, gart_info->bus_addr, ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, PCI_DMA_TODEVICE); } pages = (entry->pages <= ATI_MAX_PCIGART_PAGES) ? entry->pages : ATI_MAX_PCIGART_PAGES; for (i = 0; i < pages; i++) { if ( !entry->busaddr[i] ) break; if (!entry->busaddr[i]) break; pci_unmap_single(dev->pdev, entry->busaddr[i], PAGE_SIZE, PCI_DMA_TODEVICE); } if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) gart_info->bus_addr = 0; } if ( addr ) { drm_ati_free_pcigart_table( addr ); if (gart_info->gart_table_location == DRM_ATI_GART_MAIN && gart_info->addr) { drm_ati_free_pcigart_table(gart_info->addr); gart_info->addr = 0; } return 1; } EXPORT_SYMBOL(drm_ati_pcigart_cleanup); int drm_ati_pcigart_init( drm_device_t *dev, unsigned long *addr, dma_addr_t *bus_addr) int drm_ati_pcigart_init(drm_device_t * dev, drm_ati_pcigart_info * gart_info) { drm_sg_mem_t *entry = dev->sg; unsigned long address = 0; Loading @@ -143,6 +149,9 @@ int drm_ati_pcigart_init( drm_device_t *dev, goto done; } if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) { DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n"); address = drm_ati_alloc_pcigart_table(); if (!address) { DRM_ERROR("cannot allocate PCI GART page!\n"); Loading @@ -155,14 +164,20 @@ int drm_ati_pcigart_init( drm_device_t *dev, } bus_address = pci_map_single(dev->pdev, (void *)address, ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, PCI_DMA_TODEVICE); ATI_PCIGART_TABLE_PAGES * PAGE_SIZE, PCI_DMA_TODEVICE); if (bus_address == 0) { DRM_ERROR("unable to map PCIGART pages!\n"); drm_ati_free_pcigart_table(address); address = 0; goto done; } } else { address = gart_info->addr; bus_address = gart_info->bus_addr; DRM_DEBUG("PCI: Gart Table: VRAM %08X mapped at %08lX\n", bus_address, address); } pci_gart = (u32 *) address; Loading @@ -174,12 +189,12 @@ int drm_ati_pcigart_init( drm_device_t *dev, for (i = 0; i < pages; i++) { /* we need to support large memory configurations */ entry->busaddr[i] = pci_map_single(dev->pdev, page_address( entry->pagelist[i] ), PAGE_SIZE, PCI_DMA_TODEVICE); page_address(entry-> pagelist[i]), PAGE_SIZE, PCI_DMA_TODEVICE); if (entry->busaddr[i] == 0) { DRM_ERROR("unable to map PCIGART pages!\n"); drm_ati_pcigart_cleanup( dev, address, bus_address ); drm_ati_pcigart_cleanup(dev, gart_info); address = 0; bus_address = 0; goto done; Loading @@ -187,7 +202,11 @@ int drm_ati_pcigart_init( drm_device_t *dev, page_base = (u32) entry->busaddr[i]; for (j = 0; j < (PAGE_SIZE / ATI_PCIGART_PAGE_SIZE); j++) { *pci_gart++ = cpu_to_le32( page_base ); if (gart_info->is_pcie) *pci_gart = (cpu_to_le32(page_base) >> 8) | 0xc; else *pci_gart = cpu_to_le32(page_base); *pci_gart++; page_base += ATI_PCIGART_PAGE_SIZE; } } Loading @@ -201,8 +220,9 @@ int drm_ati_pcigart_init( drm_device_t *dev, #endif done: *addr = address; *bus_addr = bus_address; gart_info->addr = address; gart_info->bus_addr = bus_address; return ret; } EXPORT_SYMBOL(drm_ati_pcigart_init);
drivers/char/drm/drm.h +126 −169 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ #ifndef _DRM_H_ #define _DRM_H_ Loading Loading @@ -97,13 +96,11 @@ #define _DRM_LOCK_IS_CONT(lock) ((lock) & _DRM_LOCK_CONT) #define _DRM_LOCKING_CONTEXT(lock) ((lock) & ~(_DRM_LOCK_HELD|_DRM_LOCK_CONT)) typedef unsigned int drm_handle_t; typedef unsigned int drm_context_t; typedef unsigned int drm_drawable_t; typedef unsigned int drm_magic_t; /** * Cliprect. * Loading @@ -120,7 +117,6 @@ typedef struct drm_clip_rect { unsigned short y2; } drm_clip_rect_t; /** * Texture region, */ Loading @@ -144,7 +140,6 @@ typedef struct drm_hw_lock { char padding[60]; /**< Pad to cache line */ } drm_hw_lock_t; /** * DRM_IOCTL_VERSION ioctl argument type. * Loading @@ -162,7 +157,6 @@ typedef struct drm_version { char __user *desc; /**< User-space buffer to hold desc */ } drm_version_t; /** * DRM_IOCTL_GET_UNIQUE ioctl argument type. * Loading @@ -173,18 +167,15 @@ typedef struct drm_unique { char __user *unique; /**< Unique name for driver instantiation */ } drm_unique_t; typedef struct drm_list { int count; /**< Length of user-space structures */ drm_version_t __user *version; } drm_list_t; typedef struct drm_block { int unused; } drm_block_t; /** * DRM_IOCTL_CONTROL ioctl argument type. * Loading @@ -200,7 +191,6 @@ typedef struct drm_control { int irq; } drm_control_t; /** * Type of memory to map. */ Loading @@ -213,7 +203,6 @@ typedef enum drm_map_type { _DRM_CONSISTENT = 5, /**< Consistent memory for PCI DMA */ } drm_map_type_t; /** * Memory mapping flags. */ Loading @@ -227,13 +216,11 @@ typedef enum drm_map_flags { _DRM_REMOVABLE = 0x40 /**< Removable mapping */ } drm_map_flags_t; typedef struct drm_ctx_priv_map { unsigned int ctx_id; /**< Context requesting private mapping */ void *handle; /**< Handle of map */ } drm_ctx_priv_map_t; /** * DRM_IOCTL_GET_MAP, DRM_IOCTL_ADD_MAP and DRM_IOCTL_RM_MAP ioctls * argument type. Loading @@ -251,7 +238,6 @@ typedef struct drm_map { /* Private data */ } drm_map_t; /** * DRM_IOCTL_GET_CLIENT ioctl argument type. */ Loading @@ -264,7 +250,6 @@ typedef struct drm_client { unsigned long iocs; /**< Ioctl count */ } drm_client_t; typedef enum { _DRM_STAT_LOCK, _DRM_STAT_OPENS, Loading @@ -282,11 +267,9 @@ typedef enum { _DRM_STAT_DMA, /**< DMA */ _DRM_STAT_SPECIAL, /**< Special DMA (e.g., priority or polled) */ _DRM_STAT_MISSED /**< Missed DMA opportunity */ /* Add to the *END* of the list */ } drm_stat_type_t; /** * DRM_IOCTL_GET_STATS ioctl argument type. */ Loading @@ -298,7 +281,6 @@ typedef struct drm_stats { } data[15]; } drm_stats_t; /** * Hardware locking flags. */ Loading @@ -314,7 +296,6 @@ typedef enum drm_lock_flags { _DRM_HALT_CUR_QUEUES = 0x20 /**< Halt all current queues */ } drm_lock_flags_t; /** * DRM_IOCTL_LOCK, DRM_IOCTL_UNLOCK and DRM_IOCTL_FINISH ioctl argument type. * Loading @@ -325,7 +306,6 @@ typedef struct drm_lock { drm_lock_flags_t flags; } drm_lock_t; /** * DMA flags * Loading Loading @@ -355,7 +335,6 @@ typedef enum drm_dma_flags { _DRM_DMA_LARGER_OK = 0x40 /**< Larger-than-requested buffers OK */ } drm_dma_flags_t; /** * DRM_IOCTL_ADD_BUFS and DRM_IOCTL_MARK_BUFS ioctl argument type. * Loading @@ -378,7 +357,6 @@ typedef struct drm_buf_desc { */ } drm_buf_desc_t; /** * DRM_IOCTL_INFO_BUFS ioctl argument type. */ Loading @@ -387,7 +365,6 @@ typedef struct drm_buf_info { drm_buf_desc_t __user *list; } drm_buf_info_t; /** * DRM_IOCTL_FREE_BUFS ioctl argument type. */ Loading @@ -396,7 +373,6 @@ typedef struct drm_buf_free { int __user *list; } drm_buf_free_t; /** * Buffer information * Loading @@ -409,7 +385,6 @@ typedef struct drm_buf_pub { void __user *address; /**< Address of buffer */ } drm_buf_pub_t; /** * DRM_IOCTL_MAP_BUFS ioctl argument type. */ Loading @@ -419,7 +394,6 @@ typedef struct drm_buf_map { drm_buf_pub_t __user *list; /**< Buffer information */ } drm_buf_map_t; /** * DRM_IOCTL_DMA ioctl argument type. * Loading @@ -440,13 +414,11 @@ typedef struct drm_dma { int granted_count; /**< Number of buffers granted */ } drm_dma_t; typedef enum { _DRM_CONTEXT_PRESERVED = 0x01, _DRM_CONTEXT_2DONLY = 0x02 } drm_ctx_flags_t; /** * DRM_IOCTL_ADD_CTX ioctl argument type. * Loading @@ -457,7 +429,6 @@ typedef struct drm_ctx { drm_ctx_flags_t flags; } drm_ctx_t; /** * DRM_IOCTL_RES_CTX ioctl argument type. */ Loading @@ -466,7 +437,6 @@ typedef struct drm_ctx_res { drm_ctx_t __user *contexts; } drm_ctx_res_t; /** * DRM_IOCTL_ADD_DRAW and DRM_IOCTL_RM_DRAW ioctl argument type. */ Loading @@ -474,7 +444,6 @@ typedef struct drm_draw { drm_drawable_t handle; } drm_draw_t; /** * DRM_IOCTL_GET_MAGIC and DRM_IOCTL_AUTH_MAGIC ioctl argument type. */ Loading @@ -482,7 +451,6 @@ typedef struct drm_auth { drm_magic_t magic; } drm_auth_t; /** * DRM_IOCTL_IRQ_BUSID ioctl argument type. * Loading @@ -495,24 +463,20 @@ typedef struct drm_irq_busid { int funcnum; /**< function number */ } drm_irq_busid_t; typedef enum { _DRM_VBLANK_ABSOLUTE = 0x0, /**< Wait for specific vblank sequence number */ _DRM_VBLANK_RELATIVE = 0x1, /**< Wait for given number of vblanks */ _DRM_VBLANK_SIGNAL = 0x40000000 /**< Send signal instead of blocking */ } drm_vblank_seq_type_t; #define _DRM_VBLANK_FLAGS_MASK _DRM_VBLANK_SIGNAL struct drm_wait_vblank_request { drm_vblank_seq_type_t type; unsigned int sequence; unsigned long signal; }; struct drm_wait_vblank_reply { drm_vblank_seq_type_t type; unsigned int sequence; Loading @@ -520,7 +484,6 @@ struct drm_wait_vblank_reply { long tval_usec; }; /** * DRM_IOCTL_WAIT_VBLANK ioctl argument type. * Loading @@ -531,7 +494,6 @@ typedef union drm_wait_vblank { struct drm_wait_vblank_reply reply; } drm_wait_vblank_t; /** * DRM_IOCTL_AGP_ENABLE ioctl argument type. * Loading @@ -541,7 +503,6 @@ typedef struct drm_agp_mode { unsigned long mode; /**< AGP mode */ } drm_agp_mode_t; /** * DRM_IOCTL_AGP_ALLOC and DRM_IOCTL_AGP_FREE ioctls argument type. * Loading @@ -554,7 +515,6 @@ typedef struct drm_agp_buffer { unsigned long physical; /**< Physical used by i810 */ } drm_agp_buffer_t; /** * DRM_IOCTL_AGP_BIND and DRM_IOCTL_AGP_UNBIND ioctls argument type. * Loading @@ -565,7 +525,6 @@ typedef struct drm_agp_binding { unsigned long offset; /**< In bytes -- will round to page boundary */ } drm_agp_binding_t; /** * DRM_IOCTL_AGP_INFO ioctl argument type. * Loading @@ -587,7 +546,6 @@ typedef struct drm_agp_info { unsigned short id_device; } drm_agp_info_t; /** * DRM_IOCTL_SG_ALLOC ioctl argument type. */ Loading @@ -606,7 +564,6 @@ typedef struct drm_set_version { int drm_dd_minor; } drm_set_version_t; #define DRM_IOCTL_BASE 'd' #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) #define DRM_IOR(nr,type) _IOR(DRM_IOCTL_BASE,nr,type) Loading
drivers/char/drm/drmP.h +446 −440 Original line number Diff line number Diff line Loading @@ -108,7 +108,6 @@ #define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */ #define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */ #define DRM_LOOPING_LIMIT 5000000 #define DRM_BSZ 1024 /**< Buffer size for /dev/drm? output */ #define DRM_TIME_SLICE (HZ/20) /**< Time slice for GLXContexts */ #define DRM_LOCK_SLICE 1 /**< Time slice for lock, in jiffies */ Loading Loading @@ -141,7 +140,6 @@ /*@}*/ /***********************************************************************/ /** \name Backward compatibility section */ /*@{*/ Loading @@ -166,7 +164,6 @@ /*@}*/ /***********************************************************************/ /** \name Macros to make printk easier */ /*@{*/ Loading Loading @@ -223,14 +220,13 @@ /*@}*/ /***********************************************************************/ /** \name Internal types and structures */ /*@{*/ #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define DRM_MIN(a,b) ((a)<(b)?(a):(b)) #define DRM_MAX(a,b) ((a)>(b)?(a):(b)) #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x) #define DRM_MIN(a,b) min(a,b) #define DRM_MAX(a,b) max(a,b) #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) Loading Loading @@ -348,7 +344,6 @@ typedef struct drm_buf { void *dev_private; /**< Per-buffer private storage */ } drm_buf_t; /** bufs is one longer than it has to be */ typedef struct drm_waitlist { int count; /**< Number of possible buffers */ Loading Loading @@ -523,7 +518,6 @@ typedef struct drm_ctx_list { drm_file_t *tag; /**< associated fd private data */ } drm_ctx_list_t; typedef struct drm_vbl_sig { struct list_head head; unsigned int sequence; Loading @@ -531,6 +525,16 @@ typedef struct drm_vbl_sig { struct task_struct *task; } drm_vbl_sig_t; /* location of GART table */ #define DRM_ATI_GART_MAIN 1 #define DRM_ATI_GART_FB 2 typedef struct ati_pcigart_info { int gart_table_location; int is_pcie; unsigned long addr; dma_addr_t bus_addr; } drm_ati_pcigart_info; /** * DRM driver structure. This structure represent the common code for Loading @@ -554,8 +558,10 @@ struct drm_driver { int (*dma_quiescent) (struct drm_device *); int (*context_ctor) (struct drm_device * dev, int context); int (*context_dtor) (struct drm_device * dev, int context); int (*kernel_context_switch)(struct drm_device *dev, int old, int new); void (*kernel_context_switch_unlock)(struct drm_device *dev, drm_lock_t *lock); int (*kernel_context_switch) (struct drm_device * dev, int old, int new); void (*kernel_context_switch_unlock) (struct drm_device * dev, drm_lock_t * lock); int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); /** Loading Loading @@ -700,10 +706,6 @@ typedef struct drm_device { cycles_t ctx_start; cycles_t lck_start; char buf[DRM_BSZ]; /**< Output buffer */ char *buf_rp; /**< Read pointer */ char *buf_wp; /**< Write pointer */ char *buf_end; /**< End pointer */ struct fasync_struct *buf_async;/**< Processes waiting for SIGIO */ wait_queue_head_t buf_readers; /**< Processes waiting to read */ wait_queue_head_t buf_writers; /**< Processes waiting to ctx switch */ Loading @@ -730,7 +732,8 @@ typedef struct drm_device { drm_head_t primary; /**< primary screen head */ } drm_device_t; static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) { return ((dev->driver->driver_features & feature) ? 1 : 0); } Loading Loading @@ -787,12 +790,11 @@ extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) extern void drm_mem_init(void); extern int drm_mem_info(char *buf, char **start, off_t offset, int request, int *eof, void *data); extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); extern unsigned long drm_alloc_pages(int order, int area); extern void drm_free_pages(unsigned long address, int order, int area); extern void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t *dev); extern void drm_free_pages(unsigned long address, int order, int area); extern void *drm_ioremap(unsigned long offset, unsigned long size, drm_device_t * dev); extern void *drm_ioremap_nocache(unsigned long offset, unsigned long size, drm_device_t * dev); extern void drm_ioremapfree(void *pt, unsigned long size, drm_device_t * dev); Loading Loading @@ -849,7 +851,6 @@ extern int drm_adddraw(struct inode *inode, struct file *filp, extern int drm_rmdraw(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); /* Authentication IOCTL support (drm_auth.h) */ extern int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); Loading @@ -865,11 +866,9 @@ extern int drm_lock(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_unlock(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); extern int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context); extern int drm_lock_free(drm_device_t * dev, __volatile__ unsigned int *lock, unsigned int context); __volatile__ unsigned int *lock, unsigned int context); /* Buffer management support (drm_bufs.h) */ extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); Loading Loading @@ -942,7 +941,8 @@ extern int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type); extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type); extern int drm_agp_free_memory(DRM_AGP_MEM * handle); extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start); extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle); Loading Loading @@ -976,11 +976,9 @@ extern int drm_sg_free(struct inode *inode, struct file *filp, /* ATI PCIGART support (ati_pcigart.h) */ extern int drm_ati_pcigart_init(drm_device_t * dev, unsigned long *addr, dma_addr_t *bus_addr); drm_ati_pcigart_info * gart_info); extern int drm_ati_pcigart_cleanup(drm_device_t * dev, unsigned long addr, dma_addr_t bus_addr); drm_ati_pcigart_info * gart_info); extern drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align, dma_addr_t maxaddr); Loading @@ -998,25 +996,28 @@ extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, const char *fmt, ...); extern void drm_sysfs_device_remove(dev_t dev); /* Inline replacements for DRM_IOREMAP macros */ static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev) static __inline__ void drm_core_ioremap(struct drm_map *map, struct drm_device *dev) { map->handle = drm_ioremap(map->offset, map->size, dev); } static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev) static __inline__ void drm_core_ioremap_nocache(struct drm_map *map, struct drm_device *dev) { map->handle = drm_ioremap_nocache(map->offset, map->size, dev); } static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev) static __inline__ void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev) { if (map->handle && map->size) drm_ioremapfree(map->handle, map->size, dev); } static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned int token) static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsigned int token) { drm_map_list_t *_entry; list_for_each_entry(_entry, &dev->maplist->head, head) Loading @@ -1038,6 +1039,11 @@ static __inline__ int drm_device_is_agp(drm_device_t *dev) return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); } static __inline__ int drm_device_is_pcie(drm_device_t * dev) { return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); } static __inline__ void drm_core_dropmap(struct drm_map *map) { } Loading
drivers/char/drm/drm_agpsupport.c +79 −71 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ int drm_agp_info(drm_device_t *dev, drm_agp_info_t *info) return 0; } EXPORT_SYMBOL(drm_agp_info); int drm_agp_info_ioctl(struct inode *inode, struct file *filp, Loading Loading @@ -107,6 +108,7 @@ int drm_agp_acquire(drm_device_t *dev) dev->agp->acquired = 1; return 0; } EXPORT_SYMBOL(drm_agp_acquire); /** Loading Loading @@ -145,6 +147,7 @@ int drm_agp_release(drm_device_t *dev) dev->agp->acquired = 0; return 0; } EXPORT_SYMBOL(drm_agp_release); int drm_agp_release_ioctl(struct inode *inode, struct file *filp, Loading Loading @@ -177,6 +180,7 @@ int drm_agp_enable(drm_device_t *dev, drm_agp_mode_t mode) dev->agp->enabled = 1; return 0; } EXPORT_SYMBOL(drm_agp_enable); int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, Loading @@ -186,7 +190,6 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, drm_device_t *dev = priv->head->dev; drm_agp_mode_t mode; if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode))) return -EFAULT; Loading Loading @@ -301,7 +304,8 @@ int drm_agp_unbind(struct inode *inode, struct file *filp, if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request))) if (copy_from_user (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) return -EFAULT; if (!(entry = drm_agp_lookup_entry(dev, request.handle))) return -EINVAL; Loading Loading @@ -338,7 +342,8 @@ int drm_agp_bind(struct inode *inode, struct file *filp, if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request))) if (copy_from_user (&request, (drm_agp_binding_t __user *) arg, sizeof(request))) return -EFAULT; if (!(entry = drm_agp_lookup_entry(dev, request.handle))) return -EINVAL; Loading Loading @@ -377,7 +382,8 @@ int drm_agp_free(struct inode *inode, struct file *filp, if (!dev->agp || !dev->agp->acquired) return -EINVAL; if (copy_from_user(&request, (drm_agp_buffer_t __user *)arg, sizeof(request))) if (copy_from_user (&request, (drm_agp_buffer_t __user *) arg, sizeof(request))) return -EFAULT; if (!(entry = drm_agp_lookup_entry(dev, request.handle))) return -EINVAL; Loading Loading @@ -433,7 +439,8 @@ drm_agp_head_t *drm_agp_init(drm_device_t *dev) } /** Calls agp_allocate_memory() */ DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type) DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data * bridge, size_t pages, u32 type) { return agp_allocate_memory(bridge, pages, type); } Loading @@ -454,6 +461,7 @@ int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start) return -EINVAL; return agp_bind_memory(handle, start); } EXPORT_SYMBOL(drm_agp_bind_memory); /** Calls agp_unbind_memory() */ Loading
drivers/char/drm/drm_auth.c +35 −33 Original line number Diff line number Diff line /** * \file drm_auth.h * \file drm_auth.c * IOCTLs for authentication * * \author Rickard E. (Rik) Faith <faith@valinux.com> Loading Loading @@ -87,7 +87,8 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) * associated the magic number hash key in drm_device::magiclist, while holding * the drm_device::struct_sem lock. */ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) static int drm_add_magic(drm_device_t * dev, drm_file_t * priv, drm_magic_t magic) { int hash; drm_magic_entry_t *entry; Loading @@ -96,7 +97,8 @@ static int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) hash = drm_hash_magic(magic); entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC); if (!entry) return -ENOMEM; if (!entry) return -ENOMEM; memset(entry, 0, sizeof(*entry)); entry->magic = magic; entry->priv = priv; Loading Loading @@ -130,7 +132,6 @@ static int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) drm_magic_entry_t *pt; int hash; DRM_DEBUG("%d\n", magic); hash = drm_hash_magic(magic); Loading Loading @@ -185,7 +186,8 @@ int drm_getmagic(struct inode *inode, struct file *filp, } else { do { spin_lock(&lock); if (!sequence) ++sequence; /* reserve 0 */ if (!sequence) ++sequence; /* reserve 0 */ auth.magic = sequence++; spin_unlock(&lock); } while (drm_find_file(dev, auth.magic)); Loading