diff options
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 324 |
1 files changed, 203 insertions, 121 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 4c9461a4f9e6..738b3a5faa12 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -95,7 +95,7 @@ struct drm_device; | |||
95 | * drm_core, drm_driver, drm_kms | 95 | * drm_core, drm_driver, drm_kms |
96 | * drm_core level can be used in the generic drm code. For example: | 96 | * drm_core level can be used in the generic drm code. For example: |
97 | * drm_ioctl, drm_mm, drm_memory | 97 | * drm_ioctl, drm_mm, drm_memory |
98 | * The macro definiton of DRM_DEBUG is used. | 98 | * The macro definition of DRM_DEBUG is used. |
99 | * DRM_DEBUG(fmt, args...) | 99 | * DRM_DEBUG(fmt, args...) |
100 | * The debug info by using the DRM_DEBUG can be obtained by adding | 100 | * The debug info by using the DRM_DEBUG can be obtained by adding |
101 | * the boot option of "drm.debug=1". | 101 | * the boot option of "drm.debug=1". |
@@ -122,10 +122,14 @@ struct drm_device; | |||
122 | * using the DRM_DEBUG_KMS and DRM_DEBUG. | 122 | * using the DRM_DEBUG_KMS and DRM_DEBUG. |
123 | */ | 123 | */ |
124 | 124 | ||
125 | extern void drm_ut_debug_printk(unsigned int request_level, | 125 | extern __attribute__((format (printf, 4, 5))) |
126 | void drm_ut_debug_printk(unsigned int request_level, | ||
126 | const char *prefix, | 127 | const char *prefix, |
127 | const char *function_name, | 128 | const char *function_name, |
128 | const char *format, ...); | 129 | const char *format, ...); |
130 | extern __attribute__((format (printf, 2, 3))) | ||
131 | int drm_err(const char *func, const char *format, ...); | ||
132 | |||
129 | /***********************************************************************/ | 133 | /***********************************************************************/ |
130 | /** \name DRM template customization defaults */ | 134 | /** \name DRM template customization defaults */ |
131 | /*@{*/ | 135 | /*@{*/ |
@@ -145,7 +149,10 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
145 | #define DRIVER_IRQ_VBL2 0x800 | 149 | #define DRIVER_IRQ_VBL2 0x800 |
146 | #define DRIVER_GEM 0x1000 | 150 | #define DRIVER_GEM 0x1000 |
147 | #define DRIVER_MODESET 0x2000 | 151 | #define DRIVER_MODESET 0x2000 |
148 | #define DRIVER_USE_PLATFORM_DEVICE 0x4000 | 152 | |
153 | #define DRIVER_BUS_PCI 0x1 | ||
154 | #define DRIVER_BUS_PLATFORM 0x2 | ||
155 | #define DRIVER_BUS_USB 0x3 | ||
149 | 156 | ||
150 | /***********************************************************************/ | 157 | /***********************************************************************/ |
151 | /** \name Begin the DRM... */ | 158 | /** \name Begin the DRM... */ |
@@ -178,21 +185,11 @@ extern void drm_ut_debug_printk(unsigned int request_level, | |||
178 | * \param fmt printf() like format string. | 185 | * \param fmt printf() like format string. |
179 | * \param arg arguments | 186 | * \param arg arguments |
180 | */ | 187 | */ |
181 | #define DRM_ERROR(fmt, arg...) \ | 188 | #define DRM_ERROR(fmt, ...) \ |
182 | printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __func__ , ##arg) | 189 | drm_err(__func__, fmt, ##__VA_ARGS__) |
183 | 190 | ||
184 | /** | 191 | #define DRM_INFO(fmt, ...) \ |
185 | * Memory error output. | 192 | printk(KERN_INFO "[" DRM_NAME "] " fmt, ##__VA_ARGS__) |
186 | * | ||
187 | * \param area memory area where the error occurred. | ||
188 | * \param fmt printf() like format string. | ||
189 | * \param arg arguments | ||
190 | */ | ||
191 | #define DRM_MEM_ERROR(area, fmt, arg...) \ | ||
192 | printk(KERN_ERR "[" DRM_NAME ":%s:%s] *ERROR* " fmt , __func__, \ | ||
193 | drm_mem_stats[area].name , ##arg) | ||
194 | |||
195 | #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg) | ||
196 | 193 | ||
197 | /** | 194 | /** |
198 | * Debug output. | 195 | * Debug output. |
@@ -683,6 +680,34 @@ struct drm_master { | |||
683 | void *driver_priv; /**< Private structure for driver to use */ | 680 | void *driver_priv; /**< Private structure for driver to use */ |
684 | }; | 681 | }; |
685 | 682 | ||
683 | /* Size of ringbuffer for vblank timestamps. Just double-buffer | ||
684 | * in initial implementation. | ||
685 | */ | ||
686 | #define DRM_VBLANKTIME_RBSIZE 2 | ||
687 | |||
688 | /* Flags and return codes for get_vblank_timestamp() driver function. */ | ||
689 | #define DRM_CALLED_FROM_VBLIRQ 1 | ||
690 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) | ||
691 | #define DRM_VBLANKTIME_INVBL (1 << 1) | ||
692 | |||
693 | /* get_scanout_position() return flags */ | ||
694 | #define DRM_SCANOUTPOS_VALID (1 << 0) | ||
695 | #define DRM_SCANOUTPOS_INVBL (1 << 1) | ||
696 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) | ||
697 | |||
698 | struct drm_bus { | ||
699 | int bus_type; | ||
700 | int (*get_irq)(struct drm_device *dev); | ||
701 | const char *(*get_name)(struct drm_device *dev); | ||
702 | int (*set_busid)(struct drm_device *dev, struct drm_master *master); | ||
703 | int (*set_unique)(struct drm_device *dev, struct drm_master *master, | ||
704 | struct drm_unique *unique); | ||
705 | int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p); | ||
706 | /* hooks that are for PCI */ | ||
707 | int (*agp_init)(struct drm_device *dev); | ||
708 | |||
709 | }; | ||
710 | |||
686 | /** | 711 | /** |
687 | * DRM driver structure. This structure represent the common code for | 712 | * DRM driver structure. This structure represent the common code for |
688 | * a family of cards. There will one drm_device for each card present | 713 | * a family of cards. There will one drm_device for each card present |
@@ -699,13 +724,8 @@ struct drm_driver { | |||
699 | int (*suspend) (struct drm_device *, pm_message_t state); | 724 | int (*suspend) (struct drm_device *, pm_message_t state); |
700 | int (*resume) (struct drm_device *); | 725 | int (*resume) (struct drm_device *); |
701 | int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); | 726 | int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); |
702 | void (*dma_ready) (struct drm_device *); | ||
703 | int (*dma_quiescent) (struct drm_device *); | 727 | int (*dma_quiescent) (struct drm_device *); |
704 | int (*context_ctor) (struct drm_device *dev, int context); | ||
705 | int (*context_dtor) (struct drm_device *dev, int context); | 728 | int (*context_dtor) (struct drm_device *dev, int context); |
706 | int (*kernel_context_switch) (struct drm_device *dev, int old, | ||
707 | int new); | ||
708 | void (*kernel_context_switch_unlock) (struct drm_device *dev); | ||
709 | 729 | ||
710 | /** | 730 | /** |
711 | * get_vblank_counter - get raw hardware vblank counter | 731 | * get_vblank_counter - get raw hardware vblank counter |
@@ -765,6 +785,68 @@ struct drm_driver { | |||
765 | */ | 785 | */ |
766 | int (*device_is_agp) (struct drm_device *dev); | 786 | int (*device_is_agp) (struct drm_device *dev); |
767 | 787 | ||
788 | /** | ||
789 | * Called by vblank timestamping code. | ||
790 | * | ||
791 | * Return the current display scanout position from a crtc. | ||
792 | * | ||
793 | * \param dev DRM device. | ||
794 | * \param crtc Id of the crtc to query. | ||
795 | * \param *vpos Target location for current vertical scanout position. | ||
796 | * \param *hpos Target location for current horizontal scanout position. | ||
797 | * | ||
798 | * Returns vpos as a positive number while in active scanout area. | ||
799 | * Returns vpos as a negative number inside vblank, counting the number | ||
800 | * of scanlines to go until end of vblank, e.g., -1 means "one scanline | ||
801 | * until start of active scanout / end of vblank." | ||
802 | * | ||
803 | * \return Flags, or'ed together as follows: | ||
804 | * | ||
805 | * DRM_SCANOUTPOS_VALID = Query successful. | ||
806 | * DRM_SCANOUTPOS_INVBL = Inside vblank. | ||
807 | * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of | ||
808 | * this flag means that returned position may be offset by a constant | ||
809 | * but unknown small number of scanlines wrt. real scanout position. | ||
810 | * | ||
811 | */ | ||
812 | int (*get_scanout_position) (struct drm_device *dev, int crtc, | ||
813 | int *vpos, int *hpos); | ||
814 | |||
815 | /** | ||
816 | * Called by \c drm_get_last_vbltimestamp. Should return a precise | ||
817 | * timestamp when the most recent VBLANK interval ended or will end. | ||
818 | * | ||
819 | * Specifically, the timestamp in @vblank_time should correspond as | ||
820 | * closely as possible to the time when the first video scanline of | ||
821 | * the video frame after the end of VBLANK will start scanning out, | ||
822 | * the time immmediately after end of the VBLANK interval. If the | ||
823 | * @crtc is currently inside VBLANK, this will be a time in the future. | ||
824 | * If the @crtc is currently scanning out a frame, this will be the | ||
825 | * past start time of the current scanout. This is meant to adhere | ||
826 | * to the OpenML OML_sync_control extension specification. | ||
827 | * | ||
828 | * \param dev dev DRM device handle. | ||
829 | * \param crtc crtc for which timestamp should be returned. | ||
830 | * \param *max_error Maximum allowable timestamp error in nanoseconds. | ||
831 | * Implementation should strive to provide timestamp | ||
832 | * with an error of at most *max_error nanoseconds. | ||
833 | * Returns true upper bound on error for timestamp. | ||
834 | * \param *vblank_time Target location for returned vblank timestamp. | ||
835 | * \param flags 0 = Defaults, no special treatment needed. | ||
836 | * \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank | ||
837 | * irq handler. Some drivers need to apply some workarounds | ||
838 | * for gpu-specific vblank irq quirks if flag is set. | ||
839 | * | ||
840 | * \returns | ||
841 | * Zero if timestamping isn't supported in current display mode or a | ||
842 | * negative number on failure. A positive status code on success, | ||
843 | * which describes how the vblank_time timestamp was computed. | ||
844 | */ | ||
845 | int (*get_vblank_timestamp) (struct drm_device *dev, int crtc, | ||
846 | int *max_error, | ||
847 | struct timeval *vblank_time, | ||
848 | unsigned flags); | ||
849 | |||
768 | /* these have to be filled in */ | 850 | /* these have to be filled in */ |
769 | 851 | ||
770 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); | 852 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
@@ -777,8 +859,6 @@ struct drm_driver { | |||
777 | struct drm_file *file_priv); | 859 | struct drm_file *file_priv); |
778 | void (*reclaim_buffers_idlelocked) (struct drm_device *dev, | 860 | void (*reclaim_buffers_idlelocked) (struct drm_device *dev, |
779 | struct drm_file *file_priv); | 861 | struct drm_file *file_priv); |
780 | resource_size_t (*get_map_ofs) (struct drm_local_map * map); | ||
781 | resource_size_t (*get_reg_ofs) (struct drm_device *dev); | ||
782 | void (*set_version) (struct drm_device *dev, | 862 | void (*set_version) (struct drm_device *dev, |
783 | struct drm_set_version *sv); | 863 | struct drm_set_version *sv); |
784 | 864 | ||
@@ -795,8 +875,6 @@ struct drm_driver { | |||
795 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, | 875 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, |
796 | bool from_release); | 876 | bool from_release); |
797 | 877 | ||
798 | int (*proc_init)(struct drm_minor *minor); | ||
799 | void (*proc_cleanup)(struct drm_minor *minor); | ||
800 | int (*debugfs_init)(struct drm_minor *minor); | 878 | int (*debugfs_init)(struct drm_minor *minor); |
801 | void (*debugfs_cleanup)(struct drm_minor *minor); | 879 | void (*debugfs_cleanup)(struct drm_minor *minor); |
802 | 880 | ||
@@ -812,6 +890,17 @@ struct drm_driver { | |||
812 | /* vga arb irq handler */ | 890 | /* vga arb irq handler */ |
813 | void (*vgaarb_irq)(struct drm_device *dev, bool state); | 891 | void (*vgaarb_irq)(struct drm_device *dev, bool state); |
814 | 892 | ||
893 | /* dumb alloc support */ | ||
894 | int (*dumb_create)(struct drm_file *file_priv, | ||
895 | struct drm_device *dev, | ||
896 | struct drm_mode_create_dumb *args); | ||
897 | int (*dumb_map_offset)(struct drm_file *file_priv, | ||
898 | struct drm_device *dev, uint32_t handle, | ||
899 | uint64_t *offset); | ||
900 | int (*dumb_destroy)(struct drm_file *file_priv, | ||
901 | struct drm_device *dev, | ||
902 | uint32_t handle); | ||
903 | |||
815 | /* Driver private ops for this object */ | 904 | /* Driver private ops for this object */ |
816 | struct vm_operations_struct *gem_vm_ops; | 905 | struct vm_operations_struct *gem_vm_ops; |
817 | 906 | ||
@@ -827,8 +916,13 @@ struct drm_driver { | |||
827 | struct drm_ioctl_desc *ioctls; | 916 | struct drm_ioctl_desc *ioctls; |
828 | int num_ioctls; | 917 | int num_ioctls; |
829 | struct file_operations fops; | 918 | struct file_operations fops; |
830 | struct pci_driver pci_driver; | 919 | union { |
831 | struct platform_device *platform_device; | 920 | struct pci_driver *pci; |
921 | struct platform_device *platform_device; | ||
922 | struct usb_driver *usb; | ||
923 | } kdriver; | ||
924 | struct drm_bus *bus; | ||
925 | |||
832 | /* List of devices hanging off this driver */ | 926 | /* List of devices hanging off this driver */ |
833 | struct list_head device_list; | 927 | struct list_head device_list; |
834 | }; | 928 | }; |
@@ -900,6 +994,22 @@ struct drm_minor { | |||
900 | struct drm_mode_group mode_group; | 994 | struct drm_mode_group mode_group; |
901 | }; | 995 | }; |
902 | 996 | ||
997 | /* mode specified on the command line */ | ||
998 | struct drm_cmdline_mode { | ||
999 | bool specified; | ||
1000 | bool refresh_specified; | ||
1001 | bool bpp_specified; | ||
1002 | int xres, yres; | ||
1003 | int bpp; | ||
1004 | int refresh; | ||
1005 | bool rb; | ||
1006 | bool interlace; | ||
1007 | bool cvt; | ||
1008 | bool margins; | ||
1009 | enum drm_connector_force force; | ||
1010 | }; | ||
1011 | |||
1012 | |||
903 | struct drm_pending_vblank_event { | 1013 | struct drm_pending_vblank_event { |
904 | struct drm_pending_event base; | 1014 | struct drm_pending_event base; |
905 | int pipe; | 1015 | int pipe; |
@@ -972,7 +1082,6 @@ struct drm_device { | |||
972 | __volatile__ long context_flag; /**< Context swapping flag */ | 1082 | __volatile__ long context_flag; /**< Context swapping flag */ |
973 | __volatile__ long interrupt_flag; /**< Interruption handler flag */ | 1083 | __volatile__ long interrupt_flag; /**< Interruption handler flag */ |
974 | __volatile__ long dma_flag; /**< DMA dispatch flag */ | 1084 | __volatile__ long dma_flag; /**< DMA dispatch flag */ |
975 | struct timer_list timer; /**< Timer for delaying ctx switch */ | ||
976 | wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ | 1085 | wait_queue_head_t context_wait; /**< Processes waiting on ctx switch */ |
977 | int last_checked; /**< Last context checked for DMA */ | 1086 | int last_checked; /**< Last context checked for DMA */ |
978 | int last_context; /**< Last current context */ | 1087 | int last_context; /**< Last current context */ |
@@ -993,6 +1102,8 @@ struct drm_device { | |||
993 | 1102 | ||
994 | wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ | 1103 | wait_queue_head_t *vbl_queue; /**< VBLANK wait queue */ |
995 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ | 1104 | atomic_t *_vblank_count; /**< number of VBLANK interrupts (driver must alloc the right number of counters) */ |
1105 | struct timeval *_vblank_time; /**< timestamp of current vblank_count (drivers must alloc right number of fields) */ | ||
1106 | spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ | ||
996 | spinlock_t vbl_lock; | 1107 | spinlock_t vbl_lock; |
997 | atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ | 1108 | atomic_t *vblank_refcount; /* number of users of vblank interruptsper crtc */ |
998 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ | 1109 | u32 *last_vblank; /* protected by dev->vbl_lock, used */ |
@@ -1030,9 +1141,10 @@ struct drm_device { | |||
1030 | #endif | 1141 | #endif |
1031 | 1142 | ||
1032 | struct platform_device *platformdev; /**< Platform device struture */ | 1143 | struct platform_device *platformdev; /**< Platform device struture */ |
1144 | struct usb_device *usbdev; | ||
1033 | 1145 | ||
1034 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | 1146 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
1035 | int num_crtcs; /**< Number of CRTCs on this device */ | 1147 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
1036 | void *dev_private; /**< device private data */ | 1148 | void *dev_private; /**< device private data */ |
1037 | void *mm_private; | 1149 | void *mm_private; |
1038 | struct address_space *dev_mapping; | 1150 | struct address_space *dev_mapping; |
@@ -1045,31 +1157,20 @@ struct drm_device { | |||
1045 | struct drm_minor *control; /**< Control node for card */ | 1157 | struct drm_minor *control; /**< Control node for card */ |
1046 | struct drm_minor *primary; /**< render type primary screen head */ | 1158 | struct drm_minor *primary; /**< render type primary screen head */ |
1047 | 1159 | ||
1048 | /** \name Drawable information */ | ||
1049 | /*@{ */ | ||
1050 | spinlock_t drw_lock; | ||
1051 | struct idr drw_idr; | ||
1052 | /*@} */ | ||
1053 | |||
1054 | struct drm_mode_config mode_config; /**< Current mode config */ | 1160 | struct drm_mode_config mode_config; /**< Current mode config */ |
1055 | 1161 | ||
1056 | /** \name GEM information */ | 1162 | /** \name GEM information */ |
1057 | /*@{ */ | 1163 | /*@{ */ |
1058 | spinlock_t object_name_lock; | 1164 | spinlock_t object_name_lock; |
1059 | struct idr object_name_idr; | 1165 | struct idr object_name_idr; |
1060 | atomic_t object_count; | ||
1061 | atomic_t object_memory; | ||
1062 | atomic_t pin_count; | ||
1063 | atomic_t pin_memory; | ||
1064 | atomic_t gtt_count; | ||
1065 | atomic_t gtt_memory; | ||
1066 | uint32_t gtt_total; | ||
1067 | uint32_t invalidate_domains; /* domains pending invalidation */ | ||
1068 | uint32_t flush_domains; /* domains pending flush */ | ||
1069 | /*@} */ | 1166 | /*@} */ |
1070 | 1167 | int switch_power_state; | |
1071 | }; | 1168 | }; |
1072 | 1169 | ||
1170 | #define DRM_SWITCH_POWER_ON 0 | ||
1171 | #define DRM_SWITCH_POWER_OFF 1 | ||
1172 | #define DRM_SWITCH_POWER_CHANGING 2 | ||
1173 | |||
1073 | static __inline__ int drm_core_check_feature(struct drm_device *dev, | 1174 | static __inline__ int drm_core_check_feature(struct drm_device *dev, |
1074 | int feature) | 1175 | int feature) |
1075 | { | 1176 | { |
@@ -1078,28 +1179,9 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev, | |||
1078 | 1179 | ||
1079 | static inline int drm_dev_to_irq(struct drm_device *dev) | 1180 | static inline int drm_dev_to_irq(struct drm_device *dev) |
1080 | { | 1181 | { |
1081 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | 1182 | return dev->driver->bus->get_irq(dev); |
1082 | return platform_get_irq(dev->platformdev, 0); | ||
1083 | else | ||
1084 | return dev->pdev->irq; | ||
1085 | } | 1183 | } |
1086 | 1184 | ||
1087 | static inline int drm_get_pci_domain(struct drm_device *dev) | ||
1088 | { | ||
1089 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | ||
1090 | return 0; | ||
1091 | |||
1092 | #ifndef __alpha__ | ||
1093 | /* For historical reasons, drm_get_pci_domain() is busticated | ||
1094 | * on most archs and has to remain so for userspace interface | ||
1095 | * < 1.4, except on alpha which was right from the beginning | ||
1096 | */ | ||
1097 | if (dev->if_version < 0x10004) | ||
1098 | return 0; | ||
1099 | #endif /* __alpha__ */ | ||
1100 | |||
1101 | return pci_domain_nr(dev->pdev->bus); | ||
1102 | } | ||
1103 | 1185 | ||
1104 | #if __OS_HAS_AGP | 1186 | #if __OS_HAS_AGP |
1105 | static inline int drm_core_has_AGP(struct drm_device *dev) | 1187 | static inline int drm_core_has_AGP(struct drm_device *dev) |
@@ -1153,8 +1235,6 @@ static inline int drm_mtrr_del(int handle, unsigned long offset, | |||
1153 | /*@{*/ | 1235 | /*@{*/ |
1154 | 1236 | ||
1155 | /* Driver support (drm_drv.h) */ | 1237 | /* Driver support (drm_drv.h) */ |
1156 | extern int drm_init(struct drm_driver *driver); | ||
1157 | extern void drm_exit(struct drm_driver *driver); | ||
1158 | extern long drm_ioctl(struct file *filp, | 1238 | extern long drm_ioctl(struct file *filp, |
1159 | unsigned int cmd, unsigned long arg); | 1239 | unsigned int cmd, unsigned long arg); |
1160 | extern long drm_compat_ioctl(struct file *filp, | 1240 | extern long drm_compat_ioctl(struct file *filp, |
@@ -1175,8 +1255,6 @@ extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); | |||
1175 | extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); | 1255 | extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); |
1176 | extern void drm_vm_open_locked(struct vm_area_struct *vma); | 1256 | extern void drm_vm_open_locked(struct vm_area_struct *vma); |
1177 | extern void drm_vm_close_locked(struct vm_area_struct *vma); | 1257 | extern void drm_vm_close_locked(struct vm_area_struct *vma); |
1178 | extern resource_size_t drm_core_get_map_ofs(struct drm_local_map * map); | ||
1179 | extern resource_size_t drm_core_get_reg_ofs(struct drm_device *dev); | ||
1180 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); | 1258 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); |
1181 | 1259 | ||
1182 | /* Memory management support (drm_memory.h) */ | 1260 | /* Memory management support (drm_memory.h) */ |
@@ -1186,8 +1264,7 @@ extern int drm_mem_info(char *buf, char **start, off_t offset, | |||
1186 | int request, int *eof, void *data); | 1264 | int request, int *eof, void *data); |
1187 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); | 1265 | extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); |
1188 | 1266 | ||
1189 | extern DRM_AGP_MEM *drm_alloc_agp(struct drm_device *dev, int pages, u32 type); | 1267 | extern void drm_free_agp(DRM_AGP_MEM * handle, int pages); |
1190 | extern int drm_free_agp(DRM_AGP_MEM * handle, int pages); | ||
1191 | extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); | 1268 | extern int drm_bind_agp(DRM_AGP_MEM * handle, unsigned int start); |
1192 | extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, | 1269 | extern DRM_AGP_MEM *drm_agp_bind_pages(struct drm_device *dev, |
1193 | struct page **pages, | 1270 | struct page **pages, |
@@ -1209,6 +1286,8 @@ extern int drm_getclient(struct drm_device *dev, void *data, | |||
1209 | struct drm_file *file_priv); | 1286 | struct drm_file *file_priv); |
1210 | extern int drm_getstats(struct drm_device *dev, void *data, | 1287 | extern int drm_getstats(struct drm_device *dev, void *data, |
1211 | struct drm_file *file_priv); | 1288 | struct drm_file *file_priv); |
1289 | extern int drm_getcap(struct drm_device *dev, void *data, | ||
1290 | struct drm_file *file_priv); | ||
1212 | extern int drm_setversion(struct drm_device *dev, void *data, | 1291 | extern int drm_setversion(struct drm_device *dev, void *data, |
1213 | struct drm_file *file_priv); | 1292 | struct drm_file *file_priv); |
1214 | extern int drm_noop(struct drm_device *dev, void *data, | 1293 | extern int drm_noop(struct drm_device *dev, void *data, |
@@ -1239,17 +1318,6 @@ extern int drm_setsareactx(struct drm_device *dev, void *data, | |||
1239 | extern int drm_getsareactx(struct drm_device *dev, void *data, | 1318 | extern int drm_getsareactx(struct drm_device *dev, void *data, |
1240 | struct drm_file *file_priv); | 1319 | struct drm_file *file_priv); |
1241 | 1320 | ||
1242 | /* Drawable IOCTL support (drm_drawable.h) */ | ||
1243 | extern int drm_adddraw(struct drm_device *dev, void *data, | ||
1244 | struct drm_file *file_priv); | ||
1245 | extern int drm_rmdraw(struct drm_device *dev, void *data, | ||
1246 | struct drm_file *file_priv); | ||
1247 | extern int drm_update_drawable_info(struct drm_device *dev, void *data, | ||
1248 | struct drm_file *file_priv); | ||
1249 | extern struct drm_drawable_info *drm_get_drawable_info(struct drm_device *dev, | ||
1250 | drm_drawable_t id); | ||
1251 | extern void drm_drawable_free_all(struct drm_device *dev); | ||
1252 | |||
1253 | /* Authentication IOCTL support (drm_auth.h) */ | 1321 | /* Authentication IOCTL support (drm_auth.h) */ |
1254 | extern int drm_getmagic(struct drm_device *dev, void *data, | 1322 | extern int drm_getmagic(struct drm_device *dev, void *data, |
1255 | struct drm_file *file_priv); | 1323 | struct drm_file *file_priv); |
@@ -1264,7 +1332,6 @@ extern int drm_lock(struct drm_device *dev, void *data, | |||
1264 | struct drm_file *file_priv); | 1332 | struct drm_file *file_priv); |
1265 | extern int drm_unlock(struct drm_device *dev, void *data, | 1333 | extern int drm_unlock(struct drm_device *dev, void *data, |
1266 | struct drm_file *file_priv); | 1334 | struct drm_file *file_priv); |
1267 | extern int drm_lock_take(struct drm_lock_data *lock_data, unsigned int context); | ||
1268 | extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context); | 1335 | extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context); |
1269 | extern void drm_idlelock_take(struct drm_lock_data *lock_data); | 1336 | extern void drm_idlelock_take(struct drm_lock_data *lock_data); |
1270 | extern void drm_idlelock_release(struct drm_lock_data *lock_data); | 1337 | extern void drm_idlelock_release(struct drm_lock_data *lock_data); |
@@ -1322,11 +1389,31 @@ extern int drm_wait_vblank(struct drm_device *dev, void *data, | |||
1322 | struct drm_file *filp); | 1389 | struct drm_file *filp); |
1323 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); | 1390 | extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); |
1324 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | 1391 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); |
1325 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); | 1392 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, |
1393 | struct timeval *vblanktime); | ||
1394 | extern bool drm_handle_vblank(struct drm_device *dev, int crtc); | ||
1326 | extern int drm_vblank_get(struct drm_device *dev, int crtc); | 1395 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
1327 | extern void drm_vblank_put(struct drm_device *dev, int crtc); | 1396 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
1328 | extern void drm_vblank_off(struct drm_device *dev, int crtc); | 1397 | extern void drm_vblank_off(struct drm_device *dev, int crtc); |
1329 | extern void drm_vblank_cleanup(struct drm_device *dev); | 1398 | extern void drm_vblank_cleanup(struct drm_device *dev); |
1399 | extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, | ||
1400 | struct timeval *tvblank, unsigned flags); | ||
1401 | extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, | ||
1402 | int crtc, int *max_error, | ||
1403 | struct timeval *vblank_time, | ||
1404 | unsigned flags, | ||
1405 | struct drm_crtc *refcrtc); | ||
1406 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc); | ||
1407 | |||
1408 | extern bool | ||
1409 | drm_mode_parse_command_line_for_connector(const char *mode_option, | ||
1410 | struct drm_connector *connector, | ||
1411 | struct drm_cmdline_mode *mode); | ||
1412 | |||
1413 | extern struct drm_display_mode * | ||
1414 | drm_mode_create_from_cmdline_mode(struct drm_device *dev, | ||
1415 | struct drm_cmdline_mode *cmd); | ||
1416 | |||
1330 | /* Modesetting support */ | 1417 | /* Modesetting support */ |
1331 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); | 1418 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
1332 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); | 1419 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); |
@@ -1359,11 +1446,6 @@ extern int drm_agp_unbind_ioctl(struct drm_device *dev, void *data, | |||
1359 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); | 1446 | extern int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request); |
1360 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, | 1447 | extern int drm_agp_bind_ioctl(struct drm_device *dev, void *data, |
1361 | struct drm_file *file_priv); | 1448 | struct drm_file *file_priv); |
1362 | extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type); | ||
1363 | extern int drm_agp_free_memory(DRM_AGP_MEM * handle); | ||
1364 | extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start); | ||
1365 | extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle); | ||
1366 | extern void drm_agp_chipset_flush(struct drm_device *dev); | ||
1367 | 1449 | ||
1368 | /* Stub support (drm_stub.h) */ | 1450 | /* Stub support (drm_stub.h) */ |
1369 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, | 1451 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
@@ -1373,15 +1455,14 @@ extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data, | |||
1373 | struct drm_master *drm_master_create(struct drm_minor *minor); | 1455 | struct drm_master *drm_master_create(struct drm_minor *minor); |
1374 | extern struct drm_master *drm_master_get(struct drm_master *master); | 1456 | extern struct drm_master *drm_master_get(struct drm_master *master); |
1375 | extern void drm_master_put(struct drm_master **master); | 1457 | extern void drm_master_put(struct drm_master **master); |
1376 | extern int drm_get_pci_dev(struct pci_dev *pdev, | 1458 | |
1377 | const struct pci_device_id *ent, | ||
1378 | struct drm_driver *driver); | ||
1379 | extern int drm_get_platform_dev(struct platform_device *pdev, | ||
1380 | struct drm_driver *driver); | ||
1381 | extern void drm_put_dev(struct drm_device *dev); | 1459 | extern void drm_put_dev(struct drm_device *dev); |
1382 | extern int drm_put_minor(struct drm_minor **minor); | 1460 | extern int drm_put_minor(struct drm_minor **minor); |
1383 | extern unsigned int drm_debug; | 1461 | extern unsigned int drm_debug; |
1384 | 1462 | ||
1463 | extern unsigned int drm_vblank_offdelay; | ||
1464 | extern unsigned int drm_timestamp_precision; | ||
1465 | |||
1385 | extern struct class *drm_class; | 1466 | extern struct class *drm_class; |
1386 | extern struct proc_dir_entry *drm_proc_root; | 1467 | extern struct proc_dir_entry *drm_proc_root; |
1387 | extern struct dentry *drm_debugfs_root; | 1468 | extern struct dentry *drm_debugfs_root; |
@@ -1414,7 +1495,6 @@ extern int drm_bufs_info(struct seq_file *m, void *data); | |||
1414 | extern int drm_vblank_info(struct seq_file *m, void *data); | 1495 | extern int drm_vblank_info(struct seq_file *m, void *data); |
1415 | extern int drm_clients_info(struct seq_file *m, void* data); | 1496 | extern int drm_clients_info(struct seq_file *m, void* data); |
1416 | extern int drm_gem_name_info(struct seq_file *m, void *data); | 1497 | extern int drm_gem_name_info(struct seq_file *m, void *data); |
1417 | extern int drm_gem_object_info(struct seq_file *m, void* data); | ||
1418 | 1498 | ||
1419 | #if DRM_DEBUG_CODE | 1499 | #if DRM_DEBUG_CODE |
1420 | extern int drm_vma_info(struct seq_file *m, void *data); | 1500 | extern int drm_vma_info(struct seq_file *m, void *data); |
@@ -1493,6 +1573,7 @@ drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) | |||
1493 | int drm_gem_handle_create(struct drm_file *file_priv, | 1573 | int drm_gem_handle_create(struct drm_file *file_priv, |
1494 | struct drm_gem_object *obj, | 1574 | struct drm_gem_object *obj, |
1495 | u32 *handlep); | 1575 | u32 *handlep); |
1576 | int drm_gem_handle_delete(struct drm_file *filp, u32 handle); | ||
1496 | 1577 | ||
1497 | static inline void | 1578 | static inline void |
1498 | drm_gem_object_handle_reference(struct drm_gem_object *obj) | 1579 | drm_gem_object_handle_reference(struct drm_gem_object *obj) |
@@ -1565,11 +1646,21 @@ static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, | |||
1565 | return NULL; | 1646 | return NULL; |
1566 | } | 1647 | } |
1567 | 1648 | ||
1568 | static __inline__ int drm_device_is_agp(struct drm_device *dev) | 1649 | static __inline__ void drm_core_dropmap(struct drm_local_map *map) |
1569 | { | 1650 | { |
1570 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | 1651 | } |
1571 | return 0; | ||
1572 | 1652 | ||
1653 | #include "drm_mem_util.h" | ||
1654 | |||
1655 | extern int drm_fill_in_dev(struct drm_device *dev, | ||
1656 | const struct pci_device_id *ent, | ||
1657 | struct drm_driver *driver); | ||
1658 | int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); | ||
1659 | /*@}*/ | ||
1660 | |||
1661 | /* PCI section */ | ||
1662 | static __inline__ int drm_pci_device_is_agp(struct drm_device *dev) | ||
1663 | { | ||
1573 | if (dev->driver->device_is_agp != NULL) { | 1664 | if (dev->driver->device_is_agp != NULL) { |
1574 | int err = (*dev->driver->device_is_agp) (dev); | 1665 | int err = (*dev->driver->device_is_agp) (dev); |
1575 | 1666 | ||
@@ -1581,35 +1672,26 @@ static __inline__ int drm_device_is_agp(struct drm_device *dev) | |||
1581 | return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); | 1672 | return pci_find_capability(dev->pdev, PCI_CAP_ID_AGP); |
1582 | } | 1673 | } |
1583 | 1674 | ||
1584 | static __inline__ int drm_device_is_pcie(struct drm_device *dev) | ||
1585 | { | ||
1586 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | ||
1587 | return 0; | ||
1588 | else | ||
1589 | return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); | ||
1590 | } | ||
1591 | 1675 | ||
1592 | static __inline__ void drm_core_dropmap(struct drm_local_map *map) | 1676 | static __inline__ int drm_pci_device_is_pcie(struct drm_device *dev) |
1593 | { | 1677 | { |
1678 | return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); | ||
1594 | } | 1679 | } |
1595 | 1680 | ||
1596 | #include "drm_mem_util.h" | ||
1597 | |||
1598 | static inline void *drm_get_device(struct drm_device *dev) | ||
1599 | { | ||
1600 | if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) | ||
1601 | return dev->platformdev; | ||
1602 | else | ||
1603 | return dev->pdev; | ||
1604 | } | ||
1605 | 1681 | ||
1606 | extern int drm_platform_init(struct drm_driver *driver); | 1682 | extern int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver); |
1607 | extern int drm_pci_init(struct drm_driver *driver); | 1683 | extern void drm_pci_exit(struct drm_driver *driver, struct pci_driver *pdriver); |
1608 | extern int drm_fill_in_dev(struct drm_device *dev, | 1684 | extern int drm_get_pci_dev(struct pci_dev *pdev, |
1609 | const struct pci_device_id *ent, | 1685 | const struct pci_device_id *ent, |
1610 | struct drm_driver *driver); | 1686 | struct drm_driver *driver); |
1611 | int drm_get_minor(struct drm_device *dev, struct drm_minor **minor, int type); | 1687 | |
1612 | /*@}*/ | 1688 | |
1689 | /* platform section */ | ||
1690 | extern int drm_platform_init(struct drm_driver *driver, struct platform_device *platform_device); | ||
1691 | extern void drm_platform_exit(struct drm_driver *driver, struct platform_device *platform_device); | ||
1692 | |||
1693 | extern int drm_get_platform_dev(struct platform_device *pdev, | ||
1694 | struct drm_driver *driver); | ||
1613 | 1695 | ||
1614 | #endif /* __KERNEL__ */ | 1696 | #endif /* __KERNEL__ */ |
1615 | #endif | 1697 | #endif |