aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drmP.h
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-04-14 08:22:37 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-04-14 08:22:37 -0400
commit6967963d6d5cac40a091d075326f0e3ccb95c58a (patch)
treea9c29ac6450a7d1dc815f9d97f726ecd59271812 /include/drm/drmP.h
parent9b1a88c7105f593cc61a7acd3c51fcf4bf7b8038 (diff)
parent34e51ce60a210094bd66cf0a75dd8512247618ca (diff)
Merge branch 'for-2.6.30' into for-2.6.31
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r--include/drm/drmP.h156
1 files changed, 118 insertions, 38 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index afb7858c068d..c8c422151431 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -281,16 +281,16 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
281 281
282struct drm_ioctl_desc { 282struct drm_ioctl_desc {
283 unsigned int cmd; 283 unsigned int cmd;
284 drm_ioctl_t *func;
285 int flags; 284 int flags;
285 drm_ioctl_t *func;
286}; 286};
287 287
288/** 288/**
289 * Creates a driver or general drm_ioctl_desc array entry for the given 289 * Creates a driver or general drm_ioctl_desc array entry for the given
290 * ioctl, for use by drm_ioctl(). 290 * ioctl, for use by drm_ioctl().
291 */ 291 */
292#define DRM_IOCTL_DEF(ioctl, func, flags) \ 292#define DRM_IOCTL_DEF(ioctl, _func, _flags) \
293 [DRM_IOCTL_NR(ioctl)] = {ioctl, func, flags} 293 [DRM_IOCTL_NR(ioctl)] = {.cmd = ioctl, .func = _func, .flags = _flags}
294 294
295struct drm_magic_entry { 295struct drm_magic_entry {
296 struct list_head head; 296 struct list_head head;
@@ -523,19 +523,32 @@ struct drm_mm {
523 523
524 524
525/** 525/**
526 * Kernel side of a mapping
527 */
528struct drm_local_map {
529 resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
530 unsigned long size; /**< Requested physical size (bytes) */
531 enum drm_map_type type; /**< Type of memory to map */
532 enum drm_map_flags flags; /**< Flags */
533 void *handle; /**< User-space: "Handle" to pass to mmap() */
534 /**< Kernel-space: kernel-virtual address */
535 int mtrr; /**< MTRR slot used */
536};
537
538typedef struct drm_local_map drm_local_map_t;
539
540/**
526 * Mappings list 541 * Mappings list
527 */ 542 */
528struct drm_map_list { 543struct drm_map_list {
529 struct list_head head; /**< list head */ 544 struct list_head head; /**< list head */
530 struct drm_hash_item hash; 545 struct drm_hash_item hash;
531 struct drm_map *map; /**< mapping */ 546 struct drm_local_map *map; /**< mapping */
532 uint64_t user_token; 547 uint64_t user_token;
533 struct drm_master *master; 548 struct drm_master *master;
534 struct drm_mm_node *file_offset_node; /**< fake offset */ 549 struct drm_mm_node *file_offset_node; /**< fake offset */
535}; 550};
536 551
537typedef struct drm_map drm_local_map_t;
538
539/** 552/**
540 * Context handle list 553 * Context handle list
541 */ 554 */
@@ -545,13 +558,6 @@ struct drm_ctx_list {
545 struct drm_file *tag; /**< associated fd private data */ 558 struct drm_file *tag; /**< associated fd private data */
546}; 559};
547 560
548struct drm_vbl_sig {
549 struct list_head head;
550 unsigned int sequence;
551 struct siginfo info;
552 struct task_struct *task;
553};
554
555/* location of GART table */ 561/* location of GART table */
556#define DRM_ATI_GART_MAIN 1 562#define DRM_ATI_GART_MAIN 1
557#define DRM_ATI_GART_FB 2 563#define DRM_ATI_GART_FB 2
@@ -567,7 +573,7 @@ struct drm_ati_pcigart_info {
567 dma_addr_t bus_addr; 573 dma_addr_t bus_addr;
568 dma_addr_t table_mask; 574 dma_addr_t table_mask;
569 struct drm_dma_handle *table_handle; 575 struct drm_dma_handle *table_handle;
570 drm_local_map_t mapping; 576 struct drm_local_map mapping;
571 int table_size; 577 int table_size;
572}; 578};
573 579
@@ -682,7 +688,6 @@ struct drm_driver {
682 int (*kernel_context_switch) (struct drm_device *dev, int old, 688 int (*kernel_context_switch) (struct drm_device *dev, int old,
683 int new); 689 int new);
684 void (*kernel_context_switch_unlock) (struct drm_device *dev); 690 void (*kernel_context_switch_unlock) (struct drm_device *dev);
685 int (*dri_library_name) (struct drm_device *dev, char *buf);
686 691
687 /** 692 /**
688 * get_vblank_counter - get raw hardware vblank counter 693 * get_vblank_counter - get raw hardware vblank counter
@@ -754,8 +759,8 @@ struct drm_driver {
754 struct drm_file *file_priv); 759 struct drm_file *file_priv);
755 void (*reclaim_buffers_idlelocked) (struct drm_device *dev, 760 void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
756 struct drm_file *file_priv); 761 struct drm_file *file_priv);
757 unsigned long (*get_map_ofs) (struct drm_map * map); 762 resource_size_t (*get_map_ofs) (struct drm_local_map * map);
758 unsigned long (*get_reg_ofs) (struct drm_device *dev); 763 resource_size_t (*get_reg_ofs) (struct drm_device *dev);
759 void (*set_version) (struct drm_device *dev, 764 void (*set_version) (struct drm_device *dev,
760 struct drm_set_version *sv); 765 struct drm_set_version *sv);
761 766
@@ -765,6 +770,8 @@ struct drm_driver {
765 770
766 int (*proc_init)(struct drm_minor *minor); 771 int (*proc_init)(struct drm_minor *minor);
767 void (*proc_cleanup)(struct drm_minor *minor); 772 void (*proc_cleanup)(struct drm_minor *minor);
773 int (*debugfs_init)(struct drm_minor *minor);
774 void (*debugfs_cleanup)(struct drm_minor *minor);
768 775
769 /** 776 /**
770 * Driver-specific constructor for drm_gem_objects, to set up 777 * Driver-specific constructor for drm_gem_objects, to set up
@@ -800,6 +807,48 @@ struct drm_driver {
800#define DRM_MINOR_CONTROL 2 807#define DRM_MINOR_CONTROL 2
801#define DRM_MINOR_RENDER 3 808#define DRM_MINOR_RENDER 3
802 809
810
811/**
812 * debugfs node list. This structure represents a debugfs file to
813 * be created by the drm core
814 */
815struct drm_debugfs_list {
816 const char *name; /** file name */
817 int (*show)(struct seq_file*, void*); /** show callback */
818 u32 driver_features; /**< Required driver features for this entry */
819};
820
821/**
822 * debugfs node structure. This structure represents a debugfs file.
823 */
824struct drm_debugfs_node {
825 struct list_head list;
826 struct drm_minor *minor;
827 struct drm_debugfs_list *debugfs_ent;
828 struct dentry *dent;
829};
830
831/**
832 * Info file list entry. This structure represents a debugfs or proc file to
833 * be created by the drm core
834 */
835struct drm_info_list {
836 const char *name; /** file name */
837 int (*show)(struct seq_file*, void*); /** show callback */
838 u32 driver_features; /**< Required driver features for this entry */
839 void *data;
840};
841
842/**
843 * debugfs node structure. This structure represents a debugfs file.
844 */
845struct drm_info_node {
846 struct list_head list;
847 struct drm_minor *minor;
848 struct drm_info_list *info_ent;
849 struct dentry *dent;
850};
851
803/** 852/**
804 * DRM minor structure. This structure represents a drm minor number. 853 * DRM minor structure. This structure represents a drm minor number.
805 */ 854 */
@@ -809,7 +858,12 @@ struct drm_minor {
809 dev_t device; /**< Device number for mknod */ 858 dev_t device; /**< Device number for mknod */
810 struct device kdev; /**< Linux device */ 859 struct device kdev; /**< Linux device */
811 struct drm_device *dev; 860 struct drm_device *dev;
812 struct proc_dir_entry *dev_root; /**< proc directory entry */ 861
862 struct proc_dir_entry *proc_root; /**< proc directory entry */
863 struct drm_info_node proc_nodes;
864 struct dentry *debugfs_root;
865 struct drm_info_node debugfs_nodes;
866
813 struct drm_master *master; /* currently active master for this node */ 867 struct drm_master *master; /* currently active master for this node */
814 struct list_head master_list; 868 struct list_head master_list;
815 struct drm_mode_group mode_group; 869 struct drm_mode_group mode_group;
@@ -903,8 +957,6 @@ struct drm_device {
903 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ 957 wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */
904 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ 958 atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */
905 spinlock_t vbl_lock; 959 spinlock_t vbl_lock;
906 struct list_head *vbl_sigs; /**< signal list to send on VBLANK */
907 atomic_t vbl_signal_pending; /* number of signals pending on all crtcs*/
908 atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ 960 atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */
909 u32 *last_vblank; /* protected by dev->vbl_lock, used */ 961 u32 *last_vblank; /* protected by dev->vbl_lock, used */
910 /* for wraparound handling */ 962 /* for wraparound handling */
@@ -941,7 +993,7 @@ struct drm_device {
941 sigset_t sigmask; 993 sigset_t sigmask;
942 994
943 struct drm_driver *driver; 995 struct drm_driver *driver;
944 drm_local_map_t *agp_buffer_map; 996 struct drm_local_map *agp_buffer_map;
945 unsigned int agp_buffer_token; 997 unsigned int agp_buffer_token;
946 struct drm_minor *control; /**< Control node for card */ 998 struct drm_minor *control; /**< Control node for card */
947 struct drm_minor *primary; /**< render type primary screen head */ 999 struct drm_minor *primary; /**< render type primary screen head */
@@ -1058,8 +1110,8 @@ extern int drm_release(struct inode *inode, struct file *filp);
1058extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); 1110extern int drm_mmap(struct file *filp, struct vm_area_struct *vma);
1059extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); 1111extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma);
1060extern void drm_vm_open_locked(struct vm_area_struct *vma); 1112extern void drm_vm_open_locked(struct vm_area_struct *vma);
1061extern unsigned long drm_core_get_map_ofs(struct drm_map * map); 1113extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map);
1062extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev); 1114extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev);
1063extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); 1115extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
1064 1116
1065 /* Memory management support (drm_memory.h) */ 1117 /* Memory management support (drm_memory.h) */
@@ -1162,13 +1214,13 @@ extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv
1162 /* Buffer management support (drm_bufs.h) */ 1214 /* Buffer management support (drm_bufs.h) */
1163extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request); 1215extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request);
1164extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request); 1216extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request);
1165extern int drm_addmap(struct drm_device *dev, unsigned int offset, 1217extern int drm_addmap(struct drm_device *dev, resource_size_t offset,
1166 unsigned int size, enum drm_map_type type, 1218 unsigned int size, enum drm_map_type type,
1167 enum drm_map_flags flags, drm_local_map_t ** map_ptr); 1219 enum drm_map_flags flags, struct drm_local_map **map_ptr);
1168extern int drm_addmap_ioctl(struct drm_device *dev, void *data, 1220extern int drm_addmap_ioctl(struct drm_device *dev, void *data,
1169 struct drm_file *file_priv); 1221 struct drm_file *file_priv);
1170extern int drm_rmmap(struct drm_device *dev, drm_local_map_t *map); 1222extern int drm_rmmap(struct drm_device *dev, struct drm_local_map *map);
1171extern int drm_rmmap_locked(struct drm_device *dev, drm_local_map_t *map); 1223extern int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map);
1172extern int drm_rmmap_ioctl(struct drm_device *dev, void *data, 1224extern int drm_rmmap_ioctl(struct drm_device *dev, void *data,
1173 struct drm_file *file_priv); 1225 struct drm_file *file_priv);
1174extern int drm_addbufs(struct drm_device *dev, void *data, 1226extern int drm_addbufs(struct drm_device *dev, void *data,
@@ -1182,10 +1234,10 @@ extern int drm_freebufs(struct drm_device *dev, void *data,
1182extern int drm_mapbufs(struct drm_device *dev, void *data, 1234extern int drm_mapbufs(struct drm_device *dev, void *data,
1183 struct drm_file *file_priv); 1235 struct drm_file *file_priv);
1184extern int drm_order(unsigned long size); 1236extern int drm_order(unsigned long size);
1185extern unsigned long drm_get_resource_start(struct drm_device *dev, 1237extern resource_size_t drm_get_resource_start(struct drm_device *dev,
1238 unsigned int resource);
1239extern resource_size_t drm_get_resource_len(struct drm_device *dev,
1186 unsigned int resource); 1240 unsigned int resource);
1187extern unsigned long drm_get_resource_len(struct drm_device *dev,
1188 unsigned int resource);
1189 1241
1190 /* DMA support (drm_dma.h) */ 1242 /* DMA support (drm_dma.h) */
1191extern int drm_dma_setup(struct drm_device *dev); 1243extern int drm_dma_setup(struct drm_device *dev);
@@ -1261,22 +1313,48 @@ extern struct drm_master *drm_master_get(struct drm_master *master);
1261extern void drm_master_put(struct drm_master **master); 1313extern void drm_master_put(struct drm_master **master);
1262extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent, 1314extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
1263 struct drm_driver *driver); 1315 struct drm_driver *driver);
1264extern int drm_put_dev(struct drm_device *dev); 1316extern void drm_put_dev(struct drm_device *dev);
1265extern int drm_put_minor(struct drm_minor **minor); 1317extern int drm_put_minor(struct drm_minor **minor);
1266extern unsigned int drm_debug; 1318extern unsigned int drm_debug;
1267 1319
1268extern struct class *drm_class; 1320extern struct class *drm_class;
1269extern struct proc_dir_entry *drm_proc_root; 1321extern struct proc_dir_entry *drm_proc_root;
1322extern struct dentry *drm_debugfs_root;
1270 1323
1271extern struct idr drm_minors_idr; 1324extern struct idr drm_minors_idr;
1272 1325
1273extern drm_local_map_t *drm_getsarea(struct drm_device *dev); 1326extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
1274 1327
1275 /* Proc support (drm_proc.h) */ 1328 /* Proc support (drm_proc.h) */
1276extern int drm_proc_init(struct drm_minor *minor, int minor_id, 1329extern int drm_proc_init(struct drm_minor *minor, int minor_id,
1277 struct proc_dir_entry *root); 1330 struct proc_dir_entry *root);
1278extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root); 1331extern int drm_proc_cleanup(struct drm_minor *minor, struct proc_dir_entry *root);
1279 1332
1333 /* Debugfs support */
1334#if defined(CONFIG_DEBUG_FS)
1335extern int drm_debugfs_init(struct drm_minor *minor, int minor_id,
1336 struct dentry *root);
1337extern int drm_debugfs_create_files(struct drm_info_list *files, int count,
1338 struct dentry *root, struct drm_minor *minor);
1339extern int drm_debugfs_remove_files(struct drm_info_list *files, int count,
1340 struct drm_minor *minor);
1341extern int drm_debugfs_cleanup(struct drm_minor *minor);
1342#endif
1343
1344 /* Info file support */
1345extern int drm_name_info(struct seq_file *m, void *data);
1346extern int drm_vm_info(struct seq_file *m, void *data);
1347extern int drm_queues_info(struct seq_file *m, void *data);
1348extern int drm_bufs_info(struct seq_file *m, void *data);
1349extern int drm_vblank_info(struct seq_file *m, void *data);
1350extern int drm_clients_info(struct seq_file *m, void* data);
1351extern int drm_gem_name_info(struct seq_file *m, void *data);
1352extern int drm_gem_object_info(struct seq_file *m, void* data);
1353
1354#if DRM_DEBUG_CODE
1355extern int drm_vma_info(struct seq_file *m, void *data);
1356#endif
1357
1280 /* Scatter Gather Support (drm_scatter.h) */ 1358 /* Scatter Gather Support (drm_scatter.h) */
1281extern void drm_sg_cleanup(struct drm_sg_mem * entry); 1359extern void drm_sg_cleanup(struct drm_sg_mem * entry);
1282extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data, 1360extern int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
@@ -1330,6 +1408,8 @@ void drm_gem_object_free(struct kref *kref);
1330struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev, 1408struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
1331 size_t size); 1409 size_t size);
1332void drm_gem_object_handle_free(struct kref *kref); 1410void drm_gem_object_handle_free(struct kref *kref);
1411void drm_gem_vm_open(struct vm_area_struct *vma);
1412void drm_gem_vm_close(struct vm_area_struct *vma);
1333int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 1413int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
1334 1414
1335static inline void 1415static inline void
@@ -1385,12 +1465,12 @@ int drm_gem_open_ioctl(struct drm_device *dev, void *data,
1385void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); 1465void drm_gem_open(struct drm_device *dev, struct drm_file *file_private);
1386void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); 1466void drm_gem_release(struct drm_device *dev, struct drm_file *file_private);
1387 1467
1388extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev); 1468extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev);
1389extern void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev); 1469extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev);
1390extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev); 1470extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev);
1391 1471
1392static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, 1472static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev,
1393 unsigned int token) 1473 unsigned int token)
1394{ 1474{
1395 struct drm_map_list *_entry; 1475 struct drm_map_list *_entry;
1396 list_for_each_entry(_entry, &dev->maplist, head) 1476 list_for_each_entry(_entry, &dev->maplist, head)
@@ -1417,7 +1497,7 @@ static __inline__ int drm_device_is_pcie(struct drm_device *dev)
1417 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); 1497 return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP);
1418} 1498}
1419 1499
1420static __inline__ void drm_core_dropmap(struct drm_map *map) 1500static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1421{ 1501{
1422} 1502}
1423 1503