diff options
Diffstat (limited to 'drivers/char/drm/drmP.h')
-rw-r--r-- | drivers/char/drm/drmP.h | 122 |
1 files changed, 72 insertions, 50 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h index 3dc3c9d79ae4..54b561e69486 100644 --- a/drivers/char/drm/drmP.h +++ b/drivers/char/drm/drmP.h | |||
@@ -144,20 +144,6 @@ | |||
144 | /** \name Backward compatibility section */ | 144 | /** \name Backward compatibility section */ |
145 | /*@{*/ | 145 | /*@{*/ |
146 | 146 | ||
147 | #ifndef MODULE_LICENSE | ||
148 | #define MODULE_LICENSE(x) | ||
149 | #endif | ||
150 | |||
151 | #ifndef preempt_disable | ||
152 | #define preempt_disable() | ||
153 | #define preempt_enable() | ||
154 | #endif | ||
155 | |||
156 | #ifndef pte_offset_map | ||
157 | #define pte_offset_map pte_offset | ||
158 | #define pte_unmap(pte) | ||
159 | #endif | ||
160 | |||
161 | #define DRM_RPR_ARG(vma) vma, | 147 | #define DRM_RPR_ARG(vma) vma, |
162 | 148 | ||
163 | #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) | 149 | #define VM_OFFSET(vma) ((vma)->vm_pgoff << PAGE_SHIFT) |
@@ -286,10 +272,13 @@ typedef int drm_ioctl_t(struct inode *inode, struct file *filp, | |||
286 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, | 272 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, |
287 | unsigned long arg); | 273 | unsigned long arg); |
288 | 274 | ||
275 | #define DRM_AUTH 0x1 | ||
276 | #define DRM_MASTER 0x2 | ||
277 | #define DRM_ROOT_ONLY 0x4 | ||
278 | |||
289 | typedef struct drm_ioctl_desc { | 279 | typedef struct drm_ioctl_desc { |
290 | drm_ioctl_t *func; | 280 | drm_ioctl_t *func; |
291 | int auth_needed; | 281 | int flags; |
292 | int root_only; | ||
293 | } drm_ioctl_desc_t; | 282 | } drm_ioctl_desc_t; |
294 | 283 | ||
295 | typedef struct drm_devstate { | 284 | typedef struct drm_devstate { |
@@ -384,6 +373,7 @@ typedef struct drm_buf_entry { | |||
384 | /** File private data */ | 373 | /** File private data */ |
385 | typedef struct drm_file { | 374 | typedef struct drm_file { |
386 | int authenticated; | 375 | int authenticated; |
376 | int master; | ||
387 | int minor; | 377 | int minor; |
388 | pid_t pid; | 378 | pid_t pid; |
389 | uid_t uid; | 379 | uid_t uid; |
@@ -532,8 +522,9 @@ typedef struct drm_vbl_sig { | |||
532 | typedef struct ati_pcigart_info { | 522 | typedef struct ati_pcigart_info { |
533 | int gart_table_location; | 523 | int gart_table_location; |
534 | int is_pcie; | 524 | int is_pcie; |
535 | unsigned long addr; | 525 | void *addr; |
536 | dma_addr_t bus_addr; | 526 | dma_addr_t bus_addr; |
527 | drm_local_map_t mapping; | ||
537 | } drm_ati_pcigart_info; | 528 | } drm_ati_pcigart_info; |
538 | 529 | ||
539 | /** | 530 | /** |
@@ -544,16 +535,14 @@ typedef struct ati_pcigart_info { | |||
544 | struct drm_device; | 535 | struct drm_device; |
545 | 536 | ||
546 | struct drm_driver { | 537 | struct drm_driver { |
547 | int (*preinit) (struct drm_device *, unsigned long flags); | 538 | int (*load) (struct drm_device *, unsigned long flags); |
548 | void (*prerelease) (struct drm_device *, struct file * filp); | 539 | int (*firstopen) (struct drm_device *); |
549 | void (*pretakedown) (struct drm_device *); | 540 | int (*open) (struct drm_device *, drm_file_t *); |
550 | int (*postcleanup) (struct drm_device *); | 541 | void (*preclose) (struct drm_device *, struct file * filp); |
551 | int (*presetup) (struct drm_device *); | 542 | void (*postclose) (struct drm_device *, drm_file_t *); |
552 | int (*postsetup) (struct drm_device *); | 543 | void (*lastclose) (struct drm_device *); |
544 | int (*unload) (struct drm_device *); | ||
553 | int (*dma_ioctl) (DRM_IOCTL_ARGS); | 545 | int (*dma_ioctl) (DRM_IOCTL_ARGS); |
554 | int (*open_helper) (struct drm_device *, drm_file_t *); | ||
555 | void (*free_filp_priv) (struct drm_device *, drm_file_t *); | ||
556 | void (*release) (struct drm_device *, struct file * filp); | ||
557 | void (*dma_ready) (struct drm_device *); | 546 | void (*dma_ready) (struct drm_device *); |
558 | int (*dma_quiescent) (struct drm_device *); | 547 | int (*dma_quiescent) (struct drm_device *); |
559 | int (*context_ctor) (struct drm_device * dev, int context); | 548 | int (*context_ctor) (struct drm_device * dev, int context); |
@@ -561,8 +550,9 @@ struct drm_driver { | |||
561 | int (*kernel_context_switch) (struct drm_device * dev, int old, | 550 | int (*kernel_context_switch) (struct drm_device * dev, int old, |
562 | int new); | 551 | int new); |
563 | void (*kernel_context_switch_unlock) (struct drm_device * dev, | 552 | void (*kernel_context_switch_unlock) (struct drm_device * dev, |
564 | drm_lock_t * lock); | 553 | drm_lock_t *lock); |
565 | int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); | 554 | int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence); |
555 | int (*dri_library_name) (struct drm_device *dev, char *buf); | ||
566 | 556 | ||
567 | /** | 557 | /** |
568 | * Called by \c drm_device_is_agp. Typically used to determine if a | 558 | * Called by \c drm_device_is_agp. Typically used to determine if a |
@@ -579,16 +569,24 @@ struct drm_driver { | |||
579 | 569 | ||
580 | /* these have to be filled in */ | 570 | /* these have to be filled in */ |
581 | 571 | ||
582 | int (*postinit) (struct drm_device *, unsigned long flags); | 572 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
583 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); | ||
584 | void (*irq_preinstall) (struct drm_device * dev); | 573 | void (*irq_preinstall) (struct drm_device * dev); |
585 | void (*irq_postinstall) (struct drm_device * dev); | 574 | void (*irq_postinstall) (struct drm_device * dev); |
586 | void (*irq_uninstall) (struct drm_device * dev); | 575 | void (*irq_uninstall) (struct drm_device * dev); |
587 | void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); | 576 | void (*reclaim_buffers) (struct drm_device * dev, struct file * filp); |
577 | void (*reclaim_buffers_locked) (struct drm_device *dev, | ||
578 | struct file *filp); | ||
588 | unsigned long (*get_map_ofs) (drm_map_t * map); | 579 | unsigned long (*get_map_ofs) (drm_map_t * map); |
589 | unsigned long (*get_reg_ofs) (struct drm_device * dev); | 580 | unsigned long (*get_reg_ofs) (struct drm_device * dev); |
590 | void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); | 581 | void (*set_version) (struct drm_device * dev, drm_set_version_t * sv); |
591 | int (*version) (drm_version_t * version); | 582 | |
583 | int major; | ||
584 | int minor; | ||
585 | int patchlevel; | ||
586 | char *name; | ||
587 | char *desc; | ||
588 | char *date; | ||
589 | |||
592 | u32 driver_features; | 590 | u32 driver_features; |
593 | int dev_priv_size; | 591 | int dev_priv_size; |
594 | drm_ioctl_desc_t *ioctls; | 592 | drm_ioctl_desc_t *ioctls; |
@@ -752,19 +750,43 @@ static inline int drm_core_has_MTRR(struct drm_device *dev) | |||
752 | { | 750 | { |
753 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); | 751 | return drm_core_check_feature(dev, DRIVER_USE_MTRR); |
754 | } | 752 | } |
753 | |||
754 | #define DRM_MTRR_WC MTRR_TYPE_WRCOMB | ||
755 | |||
756 | static inline int drm_mtrr_add(unsigned long offset, unsigned long size, | ||
757 | unsigned int flags) | ||
758 | { | ||
759 | return mtrr_add(offset, size, flags, 1); | ||
760 | } | ||
761 | |||
762 | static inline int drm_mtrr_del(int handle, unsigned long offset, | ||
763 | unsigned long size, unsigned int flags) | ||
764 | { | ||
765 | return mtrr_del(handle, offset, size); | ||
766 | } | ||
767 | |||
755 | #else | 768 | #else |
756 | #define drm_core_has_MTRR(dev) (0) | 769 | #define drm_core_has_MTRR(dev) (0) |
770 | |||
771 | #define DRM_MTRR_WC 0 | ||
772 | |||
773 | static inline int drm_mtrr_add(unsigned long offset, unsigned long size, | ||
774 | unsigned int flags) | ||
775 | { | ||
776 | return 0; | ||
777 | } | ||
778 | |||
779 | static inline int drm_mtrr_del(int handle, unsigned long offset, | ||
780 | unsigned long size, unsigned int flags) | ||
781 | { | ||
782 | return 0; | ||
783 | } | ||
757 | #endif | 784 | #endif |
758 | 785 | ||
759 | /******************************************************************/ | 786 | /******************************************************************/ |
760 | /** \name Internal function definitions */ | 787 | /** \name Internal function definitions */ |
761 | /*@{*/ | 788 | /*@{*/ |
762 | 789 | ||
763 | /* Misc. support (drm_init.h) */ | ||
764 | extern int drm_flags; | ||
765 | extern void drm_parse_options(char *s); | ||
766 | extern int drm_cpu_valid(void); | ||
767 | |||
768 | /* Driver support (drm_drv.h) */ | 790 | /* Driver support (drm_drv.h) */ |
769 | extern int drm_init(struct drm_driver *driver); | 791 | extern int drm_init(struct drm_driver *driver); |
770 | extern void drm_exit(struct drm_driver *driver); | 792 | extern void drm_exit(struct drm_driver *driver); |
@@ -772,12 +794,11 @@ extern int drm_ioctl(struct inode *inode, struct file *filp, | |||
772 | unsigned int cmd, unsigned long arg); | 794 | unsigned int cmd, unsigned long arg); |
773 | extern long drm_compat_ioctl(struct file *filp, | 795 | extern long drm_compat_ioctl(struct file *filp, |
774 | unsigned int cmd, unsigned long arg); | 796 | unsigned int cmd, unsigned long arg); |
775 | extern int drm_takedown(drm_device_t * dev); | 797 | extern int drm_lastclose(drm_device_t *dev); |
776 | 798 | ||
777 | /* Device support (drm_fops.h) */ | 799 | /* Device support (drm_fops.h) */ |
778 | extern int drm_open(struct inode *inode, struct file *filp); | 800 | extern int drm_open(struct inode *inode, struct file *filp); |
779 | extern int drm_stub_open(struct inode *inode, struct file *filp); | 801 | extern int drm_stub_open(struct inode *inode, struct file *filp); |
780 | extern int drm_flush(struct file *filp); | ||
781 | extern int drm_fasync(int fd, struct file *filp, int on); | 802 | extern int drm_fasync(int fd, struct file *filp, int on); |
782 | extern int drm_release(struct inode *inode, struct file *filp); | 803 | extern int drm_release(struct inode *inode, struct file *filp); |
783 | 804 | ||
@@ -819,6 +840,8 @@ extern int drm_getstats(struct inode *inode, struct file *filp, | |||
819 | unsigned int cmd, unsigned long arg); | 840 | unsigned int cmd, unsigned long arg); |
820 | extern int drm_setversion(struct inode *inode, struct file *filp, | 841 | extern int drm_setversion(struct inode *inode, struct file *filp, |
821 | unsigned int cmd, unsigned long arg); | 842 | unsigned int cmd, unsigned long arg); |
843 | extern int drm_noop(struct inode *inode, struct file *filp, | ||
844 | unsigned int cmd, unsigned long arg); | ||
822 | 845 | ||
823 | /* Context IOCTL support (drm_context.h) */ | 846 | /* Context IOCTL support (drm_context.h) */ |
824 | extern int drm_resctx(struct inode *inode, struct file *filp, | 847 | extern int drm_resctx(struct inode *inode, struct file *filp, |
@@ -857,10 +880,6 @@ extern int drm_getmagic(struct inode *inode, struct file *filp, | |||
857 | extern int drm_authmagic(struct inode *inode, struct file *filp, | 880 | extern int drm_authmagic(struct inode *inode, struct file *filp, |
858 | unsigned int cmd, unsigned long arg); | 881 | unsigned int cmd, unsigned long arg); |
859 | 882 | ||
860 | /* Placeholder for ioctls past */ | ||
861 | extern int drm_noop(struct inode *inode, struct file *filp, | ||
862 | unsigned int cmd, unsigned long arg); | ||
863 | |||
864 | /* Locking IOCTL support (drm_lock.h) */ | 883 | /* Locking IOCTL support (drm_lock.h) */ |
865 | extern int drm_lock(struct inode *inode, struct file *filp, | 884 | extern int drm_lock(struct inode *inode, struct file *filp, |
866 | unsigned int cmd, unsigned long arg); | 885 | unsigned int cmd, unsigned long arg); |
@@ -873,6 +892,7 @@ extern int drm_lock_free(drm_device_t * dev, | |||
873 | /* Buffer management support (drm_bufs.h) */ | 892 | /* Buffer management support (drm_bufs.h) */ |
874 | extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); | 893 | extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request); |
875 | extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); | 894 | extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request); |
895 | extern int drm_addbufs_fb(drm_device_t *dev, drm_buf_desc_t *request); | ||
876 | extern int drm_addmap(drm_device_t * dev, unsigned int offset, | 896 | extern int drm_addmap(drm_device_t * dev, unsigned int offset, |
877 | unsigned int size, drm_map_type_t type, | 897 | unsigned int size, drm_map_type_t type, |
878 | drm_map_flags_t flags, drm_local_map_t ** map_ptr); | 898 | drm_map_flags_t flags, drm_local_map_t ** map_ptr); |
@@ -908,8 +928,8 @@ extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp); | |||
908 | /* IRQ support (drm_irq.h) */ | 928 | /* IRQ support (drm_irq.h) */ |
909 | extern int drm_control(struct inode *inode, struct file *filp, | 929 | extern int drm_control(struct inode *inode, struct file *filp, |
910 | unsigned int cmd, unsigned long arg); | 930 | unsigned int cmd, unsigned long arg); |
911 | extern int drm_irq_uninstall(drm_device_t * dev); | ||
912 | extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); | 931 | extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS); |
932 | extern int drm_irq_uninstall(drm_device_t * dev); | ||
913 | extern void drm_driver_irq_preinstall(drm_device_t * dev); | 933 | extern void drm_driver_irq_preinstall(drm_device_t * dev); |
914 | extern void drm_driver_irq_postinstall(drm_device_t * dev); | 934 | extern void drm_driver_irq_postinstall(drm_device_t * dev); |
915 | extern void drm_driver_irq_uninstall(drm_device_t * dev); | 935 | extern void drm_driver_irq_uninstall(drm_device_t * dev); |
@@ -933,13 +953,17 @@ extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, | |||
933 | extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info); | 953 | extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info); |
934 | extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, | 954 | extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp, |
935 | unsigned int cmd, unsigned long arg); | 955 | unsigned int cmd, unsigned long arg); |
936 | extern int drm_agp_alloc(struct inode *inode, struct file *filp, | 956 | extern int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request); |
957 | extern int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp, | ||
937 | unsigned int cmd, unsigned long arg); | 958 | unsigned int cmd, unsigned long arg); |
938 | extern int drm_agp_free(struct inode *inode, struct file *filp, | 959 | extern int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request); |
960 | extern int drm_agp_free_ioctl(struct inode *inode, struct file *filp, | ||
939 | unsigned int cmd, unsigned long arg); | 961 | unsigned int cmd, unsigned long arg); |
940 | extern int drm_agp_unbind(struct inode *inode, struct file *filp, | 962 | extern int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request); |
963 | extern int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp, | ||
941 | unsigned int cmd, unsigned long arg); | 964 | unsigned int cmd, unsigned long arg); |
942 | extern int drm_agp_bind(struct inode *inode, struct file *filp, | 965 | extern int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request); |
966 | extern int drm_agp_bind_ioctl(struct inode *inode, struct file *filp, | ||
943 | unsigned int cmd, unsigned long arg); | 967 | unsigned int cmd, unsigned long arg); |
944 | extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, | 968 | extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, |
945 | size_t pages, u32 type); | 969 | size_t pages, u32 type); |
@@ -991,10 +1015,8 @@ extern struct drm_sysfs_class *drm_sysfs_create(struct module *owner, | |||
991 | char *name); | 1015 | char *name); |
992 | extern void drm_sysfs_destroy(struct drm_sysfs_class *cs); | 1016 | extern void drm_sysfs_destroy(struct drm_sysfs_class *cs); |
993 | extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, | 1017 | extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, |
994 | dev_t dev, | 1018 | drm_head_t *head); |
995 | struct device *device, | 1019 | extern void drm_sysfs_device_remove(struct class_device *class_dev); |
996 | const char *fmt, ...); | ||
997 | extern void drm_sysfs_device_remove(dev_t dev); | ||
998 | 1020 | ||
999 | /* Inline replacements for DRM_IOREMAP macros */ | 1021 | /* Inline replacements for DRM_IOREMAP macros */ |
1000 | static __inline__ void drm_core_ioremap(struct drm_map *map, | 1022 | static __inline__ void drm_core_ioremap(struct drm_map *map, |