aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drm_device.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drm_device.h')
-rw-r--r--include/drm/drm_device.h288
1 files changed, 205 insertions, 83 deletions
diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h
index 42411b3ea0c8..d5e092dccf3e 100644
--- a/include/drm/drm_device.h
+++ b/include/drm/drm_device.h
@@ -24,25 +24,79 @@ struct inode;
24struct pci_dev; 24struct pci_dev;
25struct pci_controller; 25struct pci_controller;
26 26
27
27/** 28/**
28 * DRM device structure. This structure represent a complete card that 29 * enum drm_switch_power - power state of drm device
30 */
31
32enum switch_power_state {
33 /** @DRM_SWITCH_POWER_ON: Power state is ON */
34 DRM_SWITCH_POWER_ON = 0,
35
36 /** @DRM_SWITCH_POWER_OFF: Power state is OFF */
37 DRM_SWITCH_POWER_OFF = 1,
38
39 /** @DRM_SWITCH_POWER_CHANGING: Power state is changing */
40 DRM_SWITCH_POWER_CHANGING = 2,
41
42 /** @DRM_SWITCH_POWER_DYNAMIC_OFF: Suspended */
43 DRM_SWITCH_POWER_DYNAMIC_OFF = 3,
44};
45
46/**
47 * struct drm_device - DRM device structure
48 *
49 * This structure represent a complete card that
29 * may contain multiple heads. 50 * may contain multiple heads.
30 */ 51 */
31struct drm_device { 52struct drm_device {
32 struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ 53 /**
33 int if_version; /**< Highest interface version set */ 54 * @legacy_dev_list:
34 55 *
35 /** \name Lifetime Management */ 56 * List of devices per driver for stealth attach cleanup
36 /*@{ */ 57 */
37 struct kref ref; /**< Object ref-count */ 58 struct list_head legacy_dev_list;
38 struct device *dev; /**< Device structure of bus-device */ 59
39 struct drm_driver *driver; /**< DRM driver managing the device */ 60 /** @if_version: Highest interface version set */
40 void *dev_private; /**< DRM driver private data */ 61 int if_version;
41 struct drm_minor *primary; /**< Primary node */ 62
42 struct drm_minor *render; /**< Render node */ 63 /** @ref: Object ref-count */
64 struct kref ref;
65
66 /** @dev: Device structure of bus-device */
67 struct device *dev;
68
69 /** @driver: DRM driver managing the device */
70 struct drm_driver *driver;
71
72 /**
73 * @dev_private:
74 *
75 * DRM driver private data. Instead of using this pointer it is
76 * recommended that drivers use drm_dev_init() and embed struct
77 * &drm_device in their larger per-device structure.
78 */
79 void *dev_private;
80
81 /** @primary: Primary node */
82 struct drm_minor *primary;
83
84 /** @render: Render node */
85 struct drm_minor *render;
86
87 /**
88 * @registered:
89 *
90 * Internally used by drm_dev_register() and drm_connector_register().
91 */
43 bool registered; 92 bool registered;
44 93
45 /* currently active master for this device. Protected by master_mutex */ 94 /**
95 * @master:
96 *
97 * Currently active master for this device.
98 * Protected by &master_mutex
99 */
46 struct drm_master *master; 100 struct drm_master *master;
47 101
48 /** 102 /**
@@ -63,76 +117,65 @@ struct drm_device {
63 */ 117 */
64 bool unplugged; 118 bool unplugged;
65 119
66 struct inode *anon_inode; /**< inode for private address-space */ 120 /** @anon_inode: inode for private address-space */
67 char *unique; /**< unique name of the device */ 121 struct inode *anon_inode;
68 /*@} */ 122
123 /** @unique: Unique name of the device */
124 char *unique;
69 125
70 /** \name Locks */ 126 /**
71 /*@{ */ 127 * @struct_mutex:
72 struct mutex struct_mutex; /**< For others */ 128 *
73 struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */ 129 * Lock for others (not &drm_minor.master and &drm_file.is_master)
74 /*@} */ 130 */
131 struct mutex struct_mutex;
75 132
76 /** \name Usage Counters */ 133 /**
77 /*@{ */ 134 * @master_mutex:
78 int open_count; /**< Outstanding files open, protected by drm_global_mutex. */ 135 *
79 spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */ 136 * Lock for &drm_minor.master and &drm_file.is_master
80 int buf_use; /**< Buffers in use -- cannot alloc */ 137 */
81 atomic_t buf_alloc; /**< Buffer allocation in progress */ 138 struct mutex master_mutex;
82 /*@} */ 139
140 /**
141 * @open_count:
142 *
143 * Usage counter for outstanding files open,
144 * protected by drm_global_mutex
145 */
146 int open_count;
83 147
148 /** @filelist_mutex: Protects @filelist. */
84 struct mutex filelist_mutex; 149 struct mutex filelist_mutex;
150 /**
151 * @filelist:
152 *
153 * List of userspace clients, linked through &drm_file.lhead.
154 */
85 struct list_head filelist; 155 struct list_head filelist;
86 156
87 /** 157 /**
88 * @filelist_internal: 158 * @filelist_internal:
89 * 159 *
90 * List of open DRM files for in-kernel clients. Protected by @filelist_mutex. 160 * List of open DRM files for in-kernel clients.
161 * Protected by &filelist_mutex.
91 */ 162 */
92 struct list_head filelist_internal; 163 struct list_head filelist_internal;
93 164
94 /** 165 /**
95 * @clientlist_mutex: 166 * @clientlist_mutex:
96 * 167 *
97 * Protects @clientlist access. 168 * Protects &clientlist access.
98 */ 169 */
99 struct mutex clientlist_mutex; 170 struct mutex clientlist_mutex;
100 171
101 /** 172 /**
102 * @clientlist: 173 * @clientlist:
103 * 174 *
104 * List of in-kernel clients. Protected by @clientlist_mutex. 175 * List of in-kernel clients. Protected by &clientlist_mutex.
105 */ 176 */
106 struct list_head clientlist; 177 struct list_head clientlist;
107 178
108 /** \name Memory management */
109 /*@{ */
110 struct list_head maplist; /**< Linked list of regions */
111 struct drm_open_hash map_hash; /**< User token hash table for maps */
112
113 /** \name Context handle management */
114 /*@{ */
115 struct list_head ctxlist; /**< Linked list of context handles */
116 struct mutex ctxlist_mutex; /**< For ctxlist */
117
118 struct idr ctx_idr;
119
120 struct list_head vmalist; /**< List of vmas (for debugging) */
121
122 /*@} */
123
124 /** \name DMA support */
125 /*@{ */
126 struct drm_device_dma *dma; /**< Optional pointer for DMA support */
127 /*@} */
128
129 /** \name Context support */
130 /*@{ */
131
132 __volatile__ long context_flag; /**< Context swapping flag */
133 int last_context; /**< Last current context */
134 /*@} */
135
136 /** 179 /**
137 * @irq_enabled: 180 * @irq_enabled:
138 * 181 *
@@ -141,6 +184,10 @@ struct drm_device {
141 * to true manually. 184 * to true manually.
142 */ 185 */
143 bool irq_enabled; 186 bool irq_enabled;
187
188 /**
189 * @irq: Used by the drm_irq_install() and drm_irq_unistall() helpers.
190 */
144 int irq; 191 int irq;
145 192
146 /** 193 /**
@@ -168,7 +215,16 @@ struct drm_device {
168 */ 215 */
169 struct drm_vblank_crtc *vblank; 216 struct drm_vblank_crtc *vblank;
170 217
171 spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ 218 /**
219 * @vblank_time_lock:
220 *
221 * Protects vblank count and time updates during vblank enable/disable
222 */
223 spinlock_t vblank_time_lock;
224 /**
225 * @vbl_lock: Top-level vblank references lock, wraps the low-level
226 * @vblank_time_lock.
227 */
172 spinlock_t vbl_lock; 228 spinlock_t vbl_lock;
173 229
174 /** 230 /**
@@ -184,45 +240,61 @@ struct drm_device {
184 * races and imprecision over longer time periods, hence exposing a 240 * races and imprecision over longer time periods, hence exposing a
185 * hardware vblank counter is always recommended. 241 * hardware vblank counter is always recommended.
186 * 242 *
187 * If non-zeor, &drm_crtc_funcs.get_vblank_counter must be set. 243 * This is the statically configured device wide maximum. The driver
244 * can instead choose to use a runtime configurable per-crtc value
245 * &drm_vblank_crtc.max_vblank_count, in which case @max_vblank_count
246 * must be left at zero. See drm_crtc_set_max_vblank_count() on how
247 * to use the per-crtc value.
248 *
249 * If non-zero, &drm_crtc_funcs.get_vblank_counter must be set.
188 */ 250 */
189 u32 max_vblank_count; /**< size of vblank counter register */ 251 u32 max_vblank_count;
252
253 /** @vblank_event_list: List of vblank events */
254 struct list_head vblank_event_list;
190 255
191 /** 256 /**
192 * List of events 257 * @event_lock:
258 *
259 * Protects @vblank_event_list and event delivery in
260 * general. See drm_send_event() and drm_send_event_locked().
193 */ 261 */
194 struct list_head vblank_event_list;
195 spinlock_t event_lock; 262 spinlock_t event_lock;
196 263
197 /*@} */ 264 /** @agp: AGP data */
265 struct drm_agp_head *agp;
198 266
199 struct drm_agp_head *agp; /**< AGP data */ 267 /** @pdev: PCI device structure */
268 struct pci_dev *pdev;
200 269
201 struct pci_dev *pdev; /**< PCI device structure */
202#ifdef __alpha__ 270#ifdef __alpha__
271 /** @hose: PCI hose, only used on ALPHA platforms. */
203 struct pci_controller *hose; 272 struct pci_controller *hose;
204#endif 273#endif
274 /** @num_crtcs: Number of CRTCs on this device */
275 unsigned int num_crtcs;
205 276
206 struct drm_sg_mem *sg; /**< Scatter gather memory */ 277 /** @mode_config: Current mode config */
207 unsigned int num_crtcs; /**< Number of CRTCs on this device */ 278 struct drm_mode_config mode_config;
208 279
209 struct { 280 /** @object_name_lock: GEM information */
210 int context;
211 struct drm_hw_lock *lock;
212 } sigdata;
213
214 struct drm_local_map *agp_buffer_map;
215 unsigned int agp_buffer_token;
216
217 struct drm_mode_config mode_config; /**< Current mode config */
218
219 /** \name GEM information */
220 /*@{ */
221 struct mutex object_name_lock; 281 struct mutex object_name_lock;
282
283 /** @object_name_idr: GEM information */
222 struct idr object_name_idr; 284 struct idr object_name_idr;
285
286 /** @vma_offset_manager: GEM information */
223 struct drm_vma_offset_manager *vma_offset_manager; 287 struct drm_vma_offset_manager *vma_offset_manager;
224 /*@} */ 288
225 int switch_power_state; 289 /**
290 * @switch_power_state:
291 *
292 * Power state of the client.
293 * Used by drivers supporting the switcheroo driver.
294 * The state is maintained in the
295 * &vga_switcheroo_client_ops.set_gpu_state callback
296 */
297 enum switch_power_state switch_power_state;
226 298
227 /** 299 /**
228 * @fb_helper: 300 * @fb_helper:
@@ -231,6 +303,56 @@ struct drm_device {
231 * Set by drm_fb_helper_init() and cleared by drm_fb_helper_fini(). 303 * Set by drm_fb_helper_init() and cleared by drm_fb_helper_fini().
232 */ 304 */
233 struct drm_fb_helper *fb_helper; 305 struct drm_fb_helper *fb_helper;
306
307 /* Everything below here is for legacy driver, never use! */
308 /* private: */
309
310 /* Context handle management - linked list of context handles */
311 struct list_head ctxlist;
312
313 /* Context handle management - mutex for &ctxlist */
314 struct mutex ctxlist_mutex;
315
316 /* Context handle management */
317 struct idr ctx_idr;
318
319 /* Memory management - linked list of regions */
320 struct list_head maplist;
321
322 /* Memory management - user token hash table for maps */
323 struct drm_open_hash map_hash;
324
325 /* Context handle management - list of vmas (for debugging) */
326 struct list_head vmalist;
327
328 /* Optional pointer for DMA support */
329 struct drm_device_dma *dma;
330
331 /* Context swapping flag */
332 __volatile__ long context_flag;
333
334 /* Last current context */
335 int last_context;
336
337 /* Lock for &buf_use and a few other things. */
338 spinlock_t buf_lock;
339
340 /* Usage counter for buffers in use -- cannot alloc */
341 int buf_use;
342
343 /* Buffer allocation in progress */
344 atomic_t buf_alloc;
345
346 struct {
347 int context;
348 struct drm_hw_lock *lock;
349 } sigdata;
350
351 struct drm_local_map *agp_buffer_map;
352 unsigned int agp_buffer_token;
353
354 /* Scatter gather memory */
355 struct drm_sg_mem *sg;
234}; 356};
235 357
236#endif 358#endif