Rev 5178 | Rev 6082 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5178 | Rev 5270 | ||
---|---|---|---|
Line 1... | Line -... | ||
1 | /** |
- | |
2 | * \file drmP.h |
- | |
3 | * Private header for Direct Rendering Manager |
- | |
4 | * |
- | |
5 | * \author Rickard E. (Rik) Faith |
- | |
6 | * \author Gareth Hughes |
- | |
7 | */ |
- | |
8 | - | ||
9 | /* |
1 | /* |
- | 2 | * Internal Header for the Direct Rendering Manager |
|
- | 3 | * |
|
10 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
4 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
11 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
5 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
12 | * Copyright (c) 2009-2010, Code Aurora Forum. |
6 | * Copyright (c) 2009-2010, Code Aurora Forum. |
13 | * All rights reserved. |
7 | * All rights reserved. |
14 | * |
8 | * |
- | 9 | * Author: Rickard E. (Rik) Faith |
|
- | 10 | * Author: Gareth Hughes |
|
- | 11 | * |
|
15 | * Permission is hereby granted, free of charge, to any person obtaining a |
12 | * Permission is hereby granted, free of charge, to any person obtaining a |
16 | * copy of this software and associated documentation files (the "Software"), |
13 | * copy of this software and associated documentation files (the "Software"), |
17 | * to deal in the Software without restriction, including without limitation |
14 | * to deal in the Software without restriction, including without limitation |
18 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
15 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
19 | * and/or sell copies of the Software, and to permit persons to whom the |
16 | * and/or sell copies of the Software, and to permit persons to whom the |
Line 33... | Line 30... | ||
33 | */ |
30 | */ |
Line 34... | Line 31... | ||
34 | 31 | ||
35 | #ifndef _DRM_P_H_ |
32 | #ifndef _DRM_P_H_ |
Line 36... | Line -... | ||
36 | #define _DRM_P_H_ |
- | |
37 | - | ||
38 | #define iowrite32(v, addr) writel((v), (addr)) |
- | |
39 | - | ||
40 | #ifdef __KERNEL__ |
- | |
41 | #ifdef __alpha__ |
- | |
42 | /* add include of current.h so that "current" is defined |
- | |
43 | * before static inline funcs in wait.h. Doing this so we |
- | |
44 | * can build the DRM (part of PI DRI). 4/21/2000 S + B */ |
- | |
45 | #include |
- | |
46 | #endif /* __alpha__ */ |
33 | #define _DRM_P_H_ |
- | 34 | ||
Line -... | Line 35... | ||
- | 35 | #include |
|
- | 36 | #include |
|
- | 37 | ||
- | 38 | #include |
|
- | 39 | #include |
|
47 | 40 | #include |
|
48 | #include |
- | |
49 | - | ||
50 | #include |
41 | #include |
- | 42 | #include |
|
- | 43 | #include |
|
51 | #include |
44 | #include |
52 | #include |
45 | #include |
53 | #include |
46 | |
- | 47 | #include |
|
- | 48 | #include |
|
54 | #include |
49 | #include |
Line 55... | Line 50... | ||
55 | #include |
50 | #include |
56 | #include |
51 | #include |
Line 57... | Line -... | ||
57 | #include |
- | |
58 | - | ||
59 | #include |
- | |
60 | #include |
- | |
61 | - | ||
62 | #include |
- | |
Line 63... | Line 52... | ||
63 | //#include |
52 | #include |
64 | #include |
- | |
65 | #include |
- | |
66 | #include |
53 | |
67 | #include |
- | |
68 | - | ||
69 | #include |
- | |
70 | #include |
- | |
71 | //#include |
- | |
72 | #include |
- | |
73 | 54 | #include |
|
- | 55 | #include |
|
74 | //#include |
56 | |
Line -... | Line 57... | ||
- | 57 | ||
- | 58 | #include |
|
Line -... | Line 59... | ||
- | 59 | #include |
|
- | 60 | #include |
|
- | 61 | #include |
|
- | 62 | #include |
|
- | 63 | ||
75 | //#include |
64 | #include |
- | 65 | #include |
|
- | 66 | ||
76 | //#include |
67 | #include |
Line 77... | Line -... | ||
77 | //#include |
- | |
78 | - | ||
79 | #include |
- | |
80 | #include |
- | |
81 | 68 | #include |
|
Line 82... | Line 69... | ||
82 | 69 | #include |
|
83 | #include |
70 | #include |
- | 71 | #include |
|
- | 72 | #include |
|
- | 73 | #include |
|
- | 74 | #include |
|
- | 75 | #include |
|
Line 84... | Line 76... | ||
84 | #include |
76 | |
85 | 77 | struct module; |
|
86 | #include |
78 | |
- | 79 | struct drm_file; |
|
Line 87... | Line 80... | ||
87 | 80 | struct drm_device; |
|
88 | #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) |
81 | struct drm_agp_head; |
89 | - | ||
90 | struct module; |
- | |
91 | 82 | struct drm_local_map; |
|
92 | struct drm_file; |
- | |
93 | struct drm_device; |
- | |
94 | - | ||
95 | struct device_node; |
- | |
96 | struct videomode; |
- | |
Line 97... | Line 83... | ||
97 | struct reservation_object; |
83 | struct drm_device_dma; |
Line 98... | Line -... | ||
98 | - | ||
99 | struct inode; |
- | |
100 | struct poll_table_struct; |
- | |
101 | struct drm_lock_data; |
- | |
102 | - | ||
103 | struct sg_table; |
- | |
104 | struct dma_buf; |
- | |
105 | - | ||
106 | //#include |
- | |
107 | #include |
- | |
108 | #include |
- | |
109 | 84 | struct drm_dma_handle; |
|
110 | #define KHZ2PICOS(a) (1000000000UL/(a)) |
85 | struct drm_gem_object; |
111 | 86 | ||
112 | /* Flags and return codes for get_vblank_timestamp() driver function. */ |
87 | struct device_node; |
113 | #define DRM_CALLED_FROM_VBLIRQ 1 |
88 | struct videomode; |
Line 154... | Line 129... | ||
154 | #define DRM_UT_PRIME 0x08 |
129 | #define DRM_UT_PRIME 0x08 |
Line 155... | Line 130... | ||
155 | 130 | ||
156 | extern __printf(2, 3) |
131 | extern __printf(2, 3) |
157 | void drm_ut_debug_printk(const char *function_name, |
132 | void drm_ut_debug_printk(const char *function_name, |
158 | const char *format, ...); |
133 | const char *format, ...); |
159 | extern __printf(2, 3) |
134 | extern __printf(1, 2) |
Line 160... | Line 135... | ||
160 | int drm_err(const char *func, const char *format, ...); |
135 | void drm_err(const char *format, ...); |
161 | 136 | ||
162 | /***********************************************************************/ |
137 | /***********************************************************************/ |
Line 173... | Line 148... | ||
173 | #define DRIVER_GEM 0x1000 |
148 | #define DRIVER_GEM 0x1000 |
174 | #define DRIVER_MODESET 0x2000 |
149 | #define DRIVER_MODESET 0x2000 |
175 | #define DRIVER_PRIME 0x4000 |
150 | #define DRIVER_PRIME 0x4000 |
176 | #define DRIVER_RENDER 0x8000 |
151 | #define DRIVER_RENDER 0x8000 |
Line 177... | Line -... | ||
177 | - | ||
178 | #define DRIVER_BUS_PCI 0x1 |
- | |
179 | #define DRIVER_BUS_PLATFORM 0x2 |
- | |
180 | #define DRIVER_BUS_USB 0x3 |
- | |
181 | #define DRIVER_BUS_HOST1X 0x4 |
- | |
182 | - | ||
183 | /***********************************************************************/ |
- | |
184 | /** \name Begin the DRM... */ |
- | |
185 | /*@{*/ |
- | |
186 | - | ||
187 | #define DRM_DEBUG_CODE 2 /**< Include debugging code if > 1, then |
- | |
188 | also include looping detection. */ |
- | |
189 | - | ||
190 | #define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ |
- | |
191 | - | ||
192 | #define DRM_MAP_HASH_OFFSET 0x10000000 |
- | |
193 | - | ||
194 | /*@}*/ |
- | |
195 | 152 | ||
196 | /***********************************************************************/ |
153 | /***********************************************************************/ |
197 | /** \name Macros to make printk easier */ |
154 | /** \name Macros to make printk easier */ |
Line 198... | Line 155... | ||
198 | /*@{*/ |
155 | /*@{*/ |
Line 202... | Line 159... | ||
202 | * |
159 | * |
203 | * \param fmt printf() like format string. |
160 | * \param fmt printf() like format string. |
204 | * \param arg arguments |
161 | * \param arg arguments |
205 | */ |
162 | */ |
206 | #define DRM_ERROR(fmt, ...) \ |
163 | #define DRM_ERROR(fmt, ...) \ |
207 | drm_err(__func__, fmt, ##__VA_ARGS__) |
164 | drm_err(fmt, ##__VA_ARGS__) |
Line 208... | Line 165... | ||
208 | 165 | ||
209 | /** |
166 | /** |
210 | * Rate limited error output. Like DRM_ERROR() but won't flood the log. |
167 | * Rate limited error output. Like DRM_ERROR() but won't flood the log. |
211 | * |
168 | * |
Line 217... | Line 174... | ||
217 | static DEFINE_RATELIMIT_STATE(_rs, \ |
174 | static DEFINE_RATELIMIT_STATE(_rs, \ |
218 | DEFAULT_RATELIMIT_INTERVAL, \ |
175 | DEFAULT_RATELIMIT_INTERVAL, \ |
219 | DEFAULT_RATELIMIT_BURST); \ |
176 | DEFAULT_RATELIMIT_BURST); \ |
220 | \ |
177 | \ |
221 | if (__ratelimit(&_rs)) \ |
178 | if (__ratelimit(&_rs)) \ |
222 | drm_err(__func__, fmt, ##__VA_ARGS__); \ |
179 | drm_err(fmt, ##__VA_ARGS__); \ |
223 | }) |
180 | }) |
Line 224... | Line 181... | ||
224 | 181 | ||
225 | #define DRM_INFO(fmt, ...) \ |
182 | #define DRM_INFO(fmt, ...) \ |
Line 263... | Line 220... | ||
263 | 220 | ||
264 | /***********************************************************************/ |
221 | /***********************************************************************/ |
265 | /** \name Internal types and structures */ |
222 | /** \name Internal types and structures */ |
Line 266... | Line -... | ||
266 | /*@{*/ |
- | |
267 | - | ||
268 | #define DRM_ARRAY_SIZE(x) ARRAY_SIZE(x) |
223 | /*@{*/ |
Line 269... | Line 224... | ||
269 | 224 | ||
270 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
- | |
271 | - | ||
272 | /** |
- | |
273 | * Test that the hardware lock is held by the caller, returning otherwise. |
- | |
274 | * |
- | |
275 | * \param dev DRM device. |
- | |
276 | * \param filp file pointer of the caller. |
- | |
277 | */ |
- | |
278 | #define LOCK_TEST_WITH_RETURN( dev, _file_priv ) \ |
- | |
279 | do { \ |
- | |
280 | if (!_DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock) || \ |
- | |
281 | _file_priv->master->lock.file_priv != _file_priv) { \ |
- | |
282 | DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\ |
- | |
283 | __func__, _DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock),\ |
- | |
284 | _file_priv->master->lock.file_priv, _file_priv); \ |
- | |
285 | return -EINVAL; \ |
- | |
286 | } \ |
- | |
287 | } while (0) |
225 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
288 | 226 | ||
289 | /** |
227 | /** |
290 | * Ioctl function type. |
228 | * Ioctl function type. |
291 | * |
229 | * |
Line 324... | Line 262... | ||
324 | */ |
262 | */ |
Line 325... | Line 263... | ||
325 | 263 | ||
326 | #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ |
264 | #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ |
Line 327... | Line -... | ||
327 | [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} |
- | |
328 | - | ||
329 | #if 0 |
- | |
330 | struct drm_magic_entry { |
- | |
331 | struct list_head head; |
- | |
332 | struct drm_hash_item hash_item; |
- | |
333 | struct drm_file *priv; |
- | |
334 | }; |
- | |
335 | - | ||
336 | struct drm_vma_entry { |
- | |
337 | struct list_head head; |
- | |
338 | struct vm_area_struct *vma; |
- | |
339 | pid_t pid; |
- | |
340 | }; |
- | |
341 | - | ||
342 | /** |
- | |
343 | * DMA buffer. |
- | |
344 | */ |
- | |
345 | struct drm_buf { |
- | |
346 | int idx; /**< Index into master buflist */ |
- | |
347 | int total; /**< Buffer size */ |
- | |
348 | int order; /**< log-base-2(total) */ |
- | |
349 | int used; /**< Amount of buffer in use (for DMA) */ |
- | |
350 | unsigned long offset; /**< Byte offset (used internally) */ |
- | |
351 | void *address; /**< Address of buffer */ |
- | |
352 | unsigned long bus_address; /**< Bus address of buffer */ |
- | |
353 | struct drm_buf *next; /**< Kernel-only: used for free list */ |
- | |
354 | __volatile__ int waiting; /**< On kernel DMA queue */ |
- | |
355 | __volatile__ int pending; /**< On hardware DMA queue */ |
- | |
356 | struct drm_file *file_priv; /**< Private of holding file descr */ |
- | |
357 | int context; /**< Kernel queue for this buffer */ |
- | |
358 | int while_locked; /**< Dispatch this buffer while locked */ |
- | |
359 | enum { |
- | |
360 | DRM_LIST_NONE = 0, |
- | |
361 | DRM_LIST_FREE = 1, |
- | |
362 | DRM_LIST_WAIT = 2, |
- | |
363 | DRM_LIST_PEND = 3, |
- | |
364 | DRM_LIST_PRIO = 4, |
- | |
365 | DRM_LIST_RECLAIM = 5 |
- | |
366 | } list; /**< Which list we're on */ |
- | |
367 | - | ||
368 | int dev_priv_size; /**< Size of buffer private storage */ |
- | |
369 | void *dev_private; /**< Per-buffer private storage */ |
- | |
370 | }; |
- | |
371 | - | ||
372 | /** bufs is one longer than it has to be */ |
- | |
373 | struct drm_waitlist { |
- | |
374 | int count; /**< Number of possible buffers */ |
- | |
375 | struct drm_buf **bufs; /**< List of pointers to buffers */ |
- | |
376 | struct drm_buf **rp; /**< Read pointer */ |
- | |
377 | struct drm_buf **wp; /**< Write pointer */ |
- | |
378 | struct drm_buf **end; /**< End pointer */ |
- | |
379 | spinlock_t read_lock; |
- | |
380 | spinlock_t write_lock; |
- | |
381 | }; |
- | |
382 | #endif |
- | |
383 | - | ||
384 | - | ||
385 | typedef struct drm_dma_handle { |
- | |
386 | dma_addr_t busaddr; |
- | |
387 | void *vaddr; |
- | |
388 | size_t size; |
- | |
389 | } drm_dma_handle_t; |
- | |
390 | - | ||
391 | /** |
- | |
392 | * Buffer entry. There is one of this for each buffer size order. |
- | |
393 | */ |
- | |
394 | struct drm_buf_entry { |
- | |
395 | int buf_size; /**< size */ |
- | |
396 | int buf_count; /**< number of buffers */ |
- | |
397 | struct drm_buf *buflist; /**< buffer list */ |
- | |
398 | int seg_count; |
- | |
399 | int page_order; |
- | |
400 | struct drm_dma_handle **seglist; |
- | |
401 | - | ||
402 | int low_mark; /**< Low water mark */ |
- | |
403 | int high_mark; /**< High water mark */ |
- | |
404 | }; |
265 | [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} |
405 | 266 | ||
406 | /* Event queued up for userspace to read */ |
267 | /* Event queued up for userspace to read */ |
407 | struct drm_pending_event { |
268 | struct drm_pending_event { |
408 | struct drm_event *event; |
269 | struct drm_event *event; |
Line 455... | Line 316... | ||
455 | wait_queue_head_t event_wait; |
316 | wait_queue_head_t event_wait; |
456 | struct list_head event_list; |
317 | struct list_head event_list; |
457 | int event_space; |
318 | int event_space; |
458 | }; |
319 | }; |
Line 459... | Line -... | ||
459 | - | ||
460 | #if 0 |
320 | |
461 | /** |
321 | /** |
462 | * Lock data. |
322 | * Lock data. |
463 | */ |
323 | */ |
464 | struct drm_lock_data { |
324 | struct drm_lock_data { |
Line 472... | Line 332... | ||
472 | uint32_t user_waiters; |
332 | uint32_t user_waiters; |
473 | int idle_has_lock; |
333 | int idle_has_lock; |
474 | }; |
334 | }; |
Line 475... | Line 335... | ||
475 | 335 | ||
476 | /** |
- | |
477 | * DMA data. |
- | |
478 | */ |
- | |
479 | struct drm_device_dma { |
- | |
480 | - | ||
481 | struct drm_buf_entry bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */ |
- | |
482 | int buf_count; /**< total number of buffers */ |
- | |
483 | struct drm_buf **buflist; /**< Vector of pointers into drm_device_dma::bufs */ |
- | |
484 | int seg_count; |
- | |
485 | int page_count; /**< number of pages */ |
- | |
486 | unsigned long *pagelist; /**< page list */ |
- | |
487 | unsigned long byte_count; |
- | |
488 | enum { |
- | |
489 | _DRM_DMA_USE_AGP = 0x01, |
- | |
490 | _DRM_DMA_USE_SG = 0x02, |
- | |
491 | _DRM_DMA_USE_FB = 0x04, |
- | |
492 | _DRM_DMA_USE_PCI_RO = 0x08 |
- | |
493 | } flags; |
- | |
494 | - | ||
495 | }; |
- | |
496 | - | ||
497 | /** |
- | |
498 | * AGP memory entry. Stored as a doubly linked list. |
- | |
499 | */ |
- | |
500 | struct drm_agp_mem { |
- | |
501 | unsigned long handle; /**< handle */ |
- | |
502 | struct agp_memory *memory; |
- | |
503 | unsigned long bound; /**< address */ |
- | |
504 | int pages; |
- | |
505 | struct list_head head; |
- | |
506 | }; |
- | |
507 | - | ||
508 | /** |
- | |
509 | * AGP data. |
- | |
510 | * |
- | |
511 | * \sa drm_agp_init() and drm_device::agp. |
- | |
512 | */ |
- | |
513 | struct drm_agp_head { |
- | |
514 | struct agp_kern_info agp_info; /**< AGP device information */ |
- | |
515 | struct list_head memory; |
- | |
516 | unsigned long mode; /**< AGP mode */ |
- | |
517 | struct agp_bridge_data *bridge; |
- | |
518 | int enabled; /**< whether the AGP bus as been enabled */ |
- | |
519 | int acquired; /**< whether the AGP device has been acquired */ |
- | |
520 | unsigned long base; |
- | |
521 | int agp_mtrr; |
- | |
522 | int cant_use_aperture; |
- | |
523 | unsigned long page_mask; |
- | |
524 | }; |
- | |
525 | - | ||
526 | /** |
- | |
527 | * Scatter-gather memory. |
- | |
528 | */ |
- | |
529 | struct drm_sg_mem { |
- | |
530 | unsigned long handle; |
- | |
531 | void *virtual; |
- | |
532 | int pages; |
- | |
533 | struct page **pagelist; |
- | |
534 | dma_addr_t *busaddr; |
- | |
535 | }; |
- | |
536 | - | ||
537 | struct drm_sigdata { |
- | |
538 | int context; |
- | |
539 | struct drm_hw_lock *lock; |
- | |
540 | }; |
- | |
541 | - | ||
542 | #endif |
- | |
543 | - | ||
544 | /** |
- | |
545 | * Kernel side of a mapping |
- | |
546 | */ |
- | |
547 | struct drm_local_map { |
- | |
548 | resource_size_t offset; /**< Requested physical address (0 for SAREA)*/ |
- | |
549 | unsigned long size; /**< Requested physical size (bytes) */ |
- | |
550 | enum drm_map_type type; /**< Type of memory to map */ |
- | |
551 | enum drm_map_flags flags; /**< Flags */ |
- | |
552 | void *handle; /**< User-space: "Handle" to pass to mmap() */ |
- | |
553 | /**< Kernel-space: kernel-virtual address */ |
- | |
554 | int mtrr; /**< MTRR slot used */ |
- | |
555 | }; |
- | |
556 | - | ||
557 | typedef struct drm_local_map drm_local_map_t; |
- | |
558 | - | ||
559 | /** |
- | |
560 | * Mappings list |
- | |
561 | */ |
- | |
562 | struct drm_map_list { |
- | |
563 | struct list_head head; /**< list head */ |
- | |
564 | struct drm_hash_item hash; |
- | |
565 | struct drm_local_map *map; /**< mapping */ |
- | |
566 | uint64_t user_token; |
- | |
567 | struct drm_master *master; |
- | |
568 | }; |
- | |
569 | - | ||
570 | /* location of GART table */ |
- | |
571 | #define DRM_ATI_GART_MAIN 1 |
- | |
572 | #define DRM_ATI_GART_FB 2 |
- | |
573 | - | ||
574 | #define DRM_ATI_GART_PCI 1 |
- | |
575 | #define DRM_ATI_GART_PCIE 2 |
- | |
576 | #define DRM_ATI_GART_IGP 3 |
- | |
577 | - | ||
578 | struct drm_ati_pcigart_info { |
- | |
579 | int gart_table_location; |
- | |
580 | int gart_reg_if; |
- | |
581 | void *addr; |
- | |
582 | dma_addr_t bus_addr; |
- | |
583 | dma_addr_t table_mask; |
- | |
584 | struct drm_dma_handle *table_handle; |
- | |
585 | struct drm_local_map mapping; |
- | |
586 | int table_size; |
- | |
587 | }; |
- | |
588 | - | ||
589 | /** |
- | |
590 | * This structure defines the drm_mm memory object, which will be used by the |
- | |
591 | * DRM for its buffer objects. |
- | |
592 | */ |
- | |
593 | struct drm_gem_object { |
- | |
594 | /** Reference count of this object */ |
- | |
595 | struct kref refcount; |
- | |
596 | - | ||
597 | /** |
- | |
598 | * handle_count - gem file_priv handle count of this object |
- | |
599 | * |
- | |
600 | * Each handle also holds a reference. Note that when the handle_count |
- | |
601 | * drops to 0 any global names (e.g. the id in the flink namespace) will |
- | |
602 | * be cleared. |
- | |
603 | * |
- | |
604 | * Protected by dev->object_name_lock. |
- | |
605 | * */ |
- | |
606 | unsigned handle_count; |
- | |
607 | - | ||
608 | /** Related drm device */ |
- | |
609 | struct drm_device *dev; |
- | |
610 | - | ||
611 | /** File representing the shmem storage */ |
- | |
612 | struct file *filp; |
- | |
613 | - | ||
614 | /* Mapping info for this object */ |
- | |
615 | struct drm_vma_offset_node vma_node; |
- | |
616 | - | ||
617 | /** |
- | |
618 | * Size of the object, in bytes. Immutable over the object's |
- | |
619 | * lifetime. |
- | |
620 | */ |
- | |
621 | size_t size; |
- | |
622 | - | ||
623 | /** |
- | |
624 | * Global name for this object, starts at 1. 0 means unnamed. |
- | |
625 | * Access is covered by the object_name_lock in the related drm_device |
- | |
626 | */ |
- | |
627 | int name; |
- | |
628 | - | ||
629 | /** |
- | |
630 | * Memory domains. These monitor which caches contain read/write data |
- | |
631 | * related to the object. When transitioning from one set of domains |
- | |
632 | * to another, the driver is called to ensure that caches are suitably |
- | |
633 | * flushed and invalidated |
- | |
634 | */ |
- | |
635 | uint32_t read_domains; |
- | |
636 | uint32_t write_domain; |
- | |
637 | - | ||
638 | /** |
- | |
639 | * While validating an exec operation, the |
- | |
640 | * new read/write domain values are computed here. |
- | |
641 | * They will be transferred to the above values |
- | |
642 | * at the point that any cache flushing occurs |
- | |
643 | */ |
- | |
644 | uint32_t pending_read_domains; |
- | |
645 | uint32_t pending_write_domain; |
- | |
646 | - | ||
647 | /** |
- | |
648 | * dma_buf - dma buf associated with this GEM object |
- | |
649 | * |
- | |
650 | * Pointer to the dma-buf associated with this gem object (either |
- | |
651 | * through importing or exporting). We break the resulting reference |
- | |
652 | * loop when the last gem handle for this object is released. |
- | |
653 | * |
- | |
654 | * Protected by obj->object_name_lock |
- | |
655 | */ |
- | |
656 | struct dma_buf *dma_buf; |
- | |
657 | - | ||
658 | }; |
- | |
659 | - | ||
660 | #include |
- | |
661 | - | ||
662 | /** |
336 | /** |
663 | * struct drm_master - drm master structure |
337 | * struct drm_master - drm master structure |
664 | * |
338 | * |
665 | * @refcount: Refcount for this master object. |
339 | * @refcount: Refcount for this master object. |
666 | * @minor: Link back to minor char device we are master for. Immutable. |
340 | * @minor: Link back to minor char device we are master for. Immutable. |
667 | * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. |
341 | * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. |
668 | * @unique_len: Length of unique field. Protected by drm_global_mutex. |
- | |
669 | * @unique_size: Amount allocated. Protected by drm_global_mutex. |
342 | * @unique_len: Length of unique field. Protected by drm_global_mutex. |
670 | * @magiclist: Hash of used authentication tokens. Protected by struct_mutex. |
343 | * @magiclist: Hash of used authentication tokens. Protected by struct_mutex. |
671 | * @magicfree: List of used authentication tokens. Protected by struct_mutex. |
344 | * @magicfree: List of used authentication tokens. Protected by struct_mutex. |
672 | * @lock: DRI lock information. |
345 | * @lock: DRI lock information. |
673 | * @driver_priv: Pointer to driver-private information. |
346 | * @driver_priv: Pointer to driver-private information. |
674 | */ |
347 | */ |
675 | struct drm_master { |
348 | struct drm_master { |
676 | struct kref refcount; |
349 | struct kref refcount; |
677 | struct drm_minor *minor; |
350 | struct drm_minor *minor; |
678 | char *unique; |
351 | char *unique; |
679 | int unique_len; |
- | |
680 | int unique_size; |
352 | int unique_len; |
681 | // struct drm_open_hash magiclist; |
353 | struct drm_open_hash magiclist; |
682 | // struct list_head magicfree; |
354 | struct list_head magicfree; |
683 | // struct drm_lock_data lock; |
355 | struct drm_lock_data lock; |
684 | void *driver_priv; |
356 | void *driver_priv; |
Line 685... | Line 357... | ||
685 | }; |
357 | }; |
686 | 358 | ||
Line 690... | Line 362... | ||
690 | #define DRM_VBLANKTIME_RBSIZE 2 |
362 | #define DRM_VBLANKTIME_RBSIZE 2 |
Line 691... | Line 363... | ||
691 | 363 | ||
692 | /* Flags and return codes for get_vblank_timestamp() driver function. */ |
364 | /* Flags and return codes for get_vblank_timestamp() driver function. */ |
693 | #define DRM_CALLED_FROM_VBLIRQ 1 |
365 | #define DRM_CALLED_FROM_VBLIRQ 1 |
694 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) |
366 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) |
Line 695... | Line 367... | ||
695 | #define DRM_VBLANKTIME_INVBL (1 << 1) |
367 | #define DRM_VBLANKTIME_IN_VBLANK (1 << 1) |
696 | 368 | ||
697 | /* get_scanout_position() return flags */ |
369 | /* get_scanout_position() return flags */ |
698 | #define DRM_SCANOUTPOS_VALID (1 << 0) |
370 | #define DRM_SCANOUTPOS_VALID (1 << 0) |
Line 699... | Line -... | ||
699 | #define DRM_SCANOUTPOS_INVBL (1 << 1) |
- | |
700 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) |
- | |
701 | - | ||
702 | struct drm_bus { |
- | |
703 | int (*set_busid)(struct drm_device *dev, struct drm_master *master); |
371 | #define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) |
704 | }; |
372 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) |
705 | 373 | ||
706 | /** |
374 | /** |
707 | * DRM driver structure. This structure represent the common code for |
375 | * DRM driver structure. This structure represent the common code for |
Line 892... | Line 560... | ||
892 | struct drm_master *master; |
560 | struct drm_master *master; |
893 | struct drm_mode_group mode_group; |
561 | struct drm_mode_group mode_group; |
894 | }; |
562 | }; |
Line -... | Line 563... | ||
- | 563 | ||
- | 564 | ||
- | 565 | struct drm_pending_vblank_event { |
|
- | 566 | struct drm_pending_event base; |
|
- | 567 | int pipe; |
|
- | 568 | struct drm_event_vblank event; |
|
- | 569 | }; |
|
- | 570 | ||
- | 571 | struct drm_vblank_crtc { |
|
- | 572 | struct drm_device *dev; /* pointer to the drm_device */ |
|
- | 573 | wait_queue_head_t queue; /**< VBLANK wait queue */ |
|
- | 574 | struct timeval time[DRM_VBLANKTIME_RBSIZE]; /**< timestamp of current count */ |
|
- | 575 | struct timer_list disable_timer; /* delayed disable timer */ |
|
- | 576 | atomic_t count; /**< number of VBLANK interrupts */ |
|
- | 577 | atomic_t refcount; /* number of users of vblank interruptsper crtc */ |
|
- | 578 | u32 last; /* protected by dev->vbl_lock, used */ |
|
- | 579 | /* for wraparound handling */ |
|
- | 580 | u32 last_wait; /* Last vblank seqno waited per CRTC */ |
|
- | 581 | unsigned int inmodeset; /* Display driver is setting mode */ |
|
- | 582 | int crtc; /* crtc index */ |
|
- | 583 | bool enabled; /* so we don't call enable more than |
|
Line 895... | Line 584... | ||
895 | 584 | once per disable */ |
|
896 | 585 | }; |
|
897 | 586 | ||
898 | /** |
587 | /** |
899 | * DRM device structure. This structure represent a complete card that |
588 | * DRM device structure. This structure represent a complete card that |
900 | * may contain multiple heads. |
589 | * may contain multiple heads. |
901 | */ |
590 | */ |
Line -... | Line 591... | ||
- | 591 | struct drm_device { |
|
- | 592 | struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ |
|
- | 593 | int if_version; /**< Highest interface version set */ |
|
902 | struct drm_device { |
594 | |
903 | struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ |
595 | /** \name Lifetime Management */ |
904 | int if_version; /**< Highest interface version set */ |
596 | /*@{ */ |
905 | 597 | struct kref ref; /**< Object ref-count */ |
|
906 | struct device *dev; /**< Device structure of bus-device */ |
598 | struct device *dev; /**< Device structure of bus-device */ |
Line 962... | Line 654... | ||
962 | * Once the modeset ioctl *has* been called though, we can safely |
654 | * Once the modeset ioctl *has* been called though, we can safely |
963 | * disable them when unused. |
655 | * disable them when unused. |
964 | */ |
656 | */ |
965 | bool vblank_disable_allowed; |
657 | bool vblank_disable_allowed; |
Line -... | Line 658... | ||
- | 658 | ||
- | 659 | /* |
|
- | 660 | * If true, vblank interrupt will be disabled immediately when the |
|
- | 661 | * refcount drops to zero, as opposed to via the vblank disable |
|
- | 662 | * timer. |
|
- | 663 | * This can be set to true it the hardware has a working vblank |
|
- | 664 | * counter and the driver uses drm_vblank_on() and drm_vblank_off() |
|
- | 665 | * appropriately. |
|
- | 666 | */ |
|
- | 667 | bool vblank_disable_immediate; |
|
966 | 668 | ||
967 | /* array of size num_crtcs */ |
669 | /* array of size num_crtcs */ |
Line 968... | Line 670... | ||
968 | struct drm_vblank_crtc *vblank; |
670 | struct drm_vblank_crtc *vblank; |
969 | 671 | ||
Line 984... | Line 686... | ||
984 | 686 | ||
Line 985... | Line 687... | ||
985 | struct pci_dev *pdev; /**< PCI device structure */ |
687 | struct pci_dev *pdev; /**< PCI device structure */ |
Line -... | Line 688... | ||
- | 688 | ||
- | 689 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
|
- | 690 | ||
- | 691 | struct { |
|
Line 986... | Line 692... | ||
986 | 692 | int context; |
|
Line 987... | Line 693... | ||
987 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
693 | struct drm_hw_lock *lock; |
988 | 694 | } sigdata; |
|
Line 1030... | Line 736... | ||
1030 | /* Driver support (drm_drv.h) */ |
736 | /* Driver support (drm_drv.h) */ |
1031 | extern long drm_ioctl(struct file *filp, |
737 | extern long drm_ioctl(struct file *filp, |
1032 | unsigned int cmd, unsigned long arg); |
738 | unsigned int cmd, unsigned long arg); |
1033 | extern long drm_compat_ioctl(struct file *filp, |
739 | extern long drm_compat_ioctl(struct file *filp, |
1034 | unsigned int cmd, unsigned long arg); |
740 | unsigned int cmd, unsigned long arg); |
1035 | extern int drm_lastclose(struct drm_device *dev); |
- | |
1036 | extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); |
741 | extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); |
Line 1037... | Line 742... | ||
1037 | 742 | ||
1038 | /* Device support (drm_fops.h) */ |
- | |
1039 | extern struct mutex drm_global_mutex; |
743 | /* Device support (drm_fops.h) */ |
1040 | extern int drm_open(struct inode *inode, struct file *filp); |
744 | extern int drm_open(struct inode *inode, struct file *filp); |
1041 | extern ssize_t drm_read(struct file *filp, char __user *buffer, |
745 | extern ssize_t drm_read(struct file *filp, char __user *buffer, |
1042 | size_t count, loff_t *offset); |
746 | size_t count, loff_t *offset); |
Line 1043... | Line 747... | ||
1043 | extern int drm_release(struct inode *inode, struct file *filp); |
747 | extern int drm_release(struct inode *inode, struct file *filp); |
1044 | - | ||
1045 | /* Mapping support (drm_vm.h) */ |
- | |
1046 | extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); |
- | |
1047 | extern int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma); |
- | |
1048 | extern void drm_vm_open_locked(struct drm_device *dev, struct vm_area_struct *vma); |
748 | |
Line 1049... | Line -... | ||
1049 | extern void drm_vm_close_locked(struct drm_device *dev, struct vm_area_struct *vma); |
- | |
1050 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); |
- | |
1051 | - | ||
1052 | /* Memory management support (drm_memory.h) */ |
- | |
1053 | #include |
749 | /* Mapping support (drm_vm.h) */ |
1054 | - | ||
1055 | - | ||
1056 | /* Misc. IOCTL support (drm_ioctl.h) */ |
- | |
1057 | extern int drm_irq_by_busid(struct drm_device *dev, void *data, |
- | |
1058 | struct drm_file *file_priv); |
750 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); |
1059 | extern int drm_getunique(struct drm_device *dev, void *data, |
751 | |
1060 | struct drm_file *file_priv); |
- | |
1061 | extern int drm_setunique(struct drm_device *dev, void *data, |
- | |
1062 | struct drm_file *file_priv); |
- | |
1063 | extern int drm_getmap(struct drm_device *dev, void *data, |
- | |
1064 | struct drm_file *file_priv); |
- | |
1065 | extern int drm_getclient(struct drm_device *dev, void *data, |
- | |
1066 | struct drm_file *file_priv); |
- | |
1067 | extern int drm_getstats(struct drm_device *dev, void *data, |
- | |
1068 | struct drm_file *file_priv); |
- | |
1069 | extern int drm_getcap(struct drm_device *dev, void *data, |
- | |
1070 | struct drm_file *file_priv); |
- | |
1071 | extern int drm_setclientcap(struct drm_device *dev, void *data, |
- | |
1072 | struct drm_file *file_priv); |
- | |
1073 | extern int drm_setversion(struct drm_device *dev, void *data, |
- | |
1074 | struct drm_file *file_priv); |
- | |
1075 | extern int drm_noop(struct drm_device *dev, void *data, |
- | |
1076 | struct drm_file *file_priv); |
- | |
1077 | - | ||
1078 | /* Authentication IOCTL support (drm_auth.h) */ |
- | |
1079 | extern int drm_getmagic(struct drm_device *dev, void *data, |
- | |
1080 | struct drm_file *file_priv); |
- | |
Line 1081... | Line 752... | ||
1081 | extern int drm_authmagic(struct drm_device *dev, void *data, |
752 | /* Misc. IOCTL support (drm_ioctl.c) */ |
1082 | struct drm_file *file_priv); |
753 | int drm_noop(struct drm_device *dev, void *data, |
1083 | extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic); |
754 | struct drm_file *file_priv); |
1084 | 755 | ||
Line 1085... | Line -... | ||
1085 | /* Cache management (drm_cache.c) */ |
- | |
1086 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |
- | |
1087 | void drm_clflush_sg(struct sg_table *st); |
- | |
1088 | void drm_clflush_virt_range(void *addr, unsigned long length); |
- | |
1089 | - | ||
1090 | /* Locking IOCTL support (drm_lock.h) */ |
- | |
1091 | extern int drm_lock(struct drm_device *dev, void *data, |
- | |
1092 | struct drm_file *file_priv); |
- | |
1093 | extern int drm_unlock(struct drm_device *dev, void *data, |
- | |
1094 | struct drm_file *file_priv); |
756 | /* Cache management (drm_cache.c) */ |
1095 | extern int drm_lock_free(struct drm_lock_data *lock_data, unsigned int context); |
757 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |
1096 | extern void drm_idlelock_take(struct drm_lock_data *lock_data); |
758 | void drm_clflush_sg(struct sg_table *st); |
1097 | extern void drm_idlelock_release(struct drm_lock_data *lock_data); |
759 | void drm_clflush_virt_range(void *addr, unsigned long length); |
Line 1098... | Line -... | ||
1098 | - | ||
1099 | /* |
- | |
1100 | * These are exported to drivers so that they can implement fencing using |
- | |
1101 | * DMA quiscent + idle. DMA quiescent usually requires the hardware lock. |
- | |
1102 | */ |
- | |
1103 | - | ||
1104 | extern int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv); |
- | |
1105 | - | ||
1106 | /* Buffer management support (drm_bufs.h) */ |
- | |
1107 | extern int drm_addbufs_agp(struct drm_device *dev, struct drm_buf_desc * request); |
- | |
1108 | extern int drm_addbufs_pci(struct drm_device *dev, struct drm_buf_desc * request); |
- | |
1109 | extern int drm_addmap(struct drm_device *dev, resource_size_t offset, |
- | |
1110 | unsigned int size, enum drm_map_type type, |
- | |
1111 | enum drm_map_flags flags, struct drm_local_map **map_ptr); |
- | |
1112 | extern int drm_addmap_ioctl(struct drm_device *dev, void *data, |
- | |
1113 | struct drm_file *file_priv); |
- | |
1114 | extern int drm_rmmap(struct drm_device *dev, struct drm_local_map *map); |
- | |
1115 | extern int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map); |
- | |
1116 | extern int drm_rmmap_ioctl(struct drm_device *dev, void *data, |
- | |
1117 | struct drm_file *file_priv); |
- | |
1118 | extern int drm_addbufs(struct drm_device *dev, void *data, |
- | |
1119 | struct drm_file *file_priv); |
- | |
1120 | extern int drm_infobufs(struct drm_device *dev, void *data, |
- | |
1121 | struct drm_file *file_priv); |
- | |
1122 | extern int drm_markbufs(struct drm_device *dev, void *data, |
- | |
1123 | struct drm_file *file_priv); |
- | |
1124 | extern int drm_freebufs(struct drm_device *dev, void *data, |
- | |
1125 | struct drm_file *file_priv); |
- | |
1126 | extern int drm_mapbufs(struct drm_device *dev, void *data, |
- | |
1127 | struct drm_file *file_priv); |
- | |
1128 | extern int drm_dma_ioctl(struct drm_device *dev, void *data, |
- | |
1129 | struct drm_file *file_priv); |
- | |
1130 | - | ||
1131 | /* DMA support (drm_dma.h) */ |
- | |
1132 | extern int drm_legacy_dma_setup(struct drm_device *dev); |
760 | |
1133 | extern void drm_legacy_dma_takedown(struct drm_device *dev); |
- | |
1134 | extern void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf); |
- | |
1135 | extern void drm_core_reclaim_buffers(struct drm_device *dev, |
761 | /* |
1136 | struct drm_file *filp); |
762 | * These are exported to drivers so that they can implement fencing using |
Line 1137... | Line 763... | ||
1137 | 763 | * DMA quiscent + idle. DMA quiescent usually requires the hardware lock. |
|
1138 | /* IRQ support (drm_irq.h) */ |
764 | */ |
Line 1152... | Line 778... | ||
1152 | extern bool drm_handle_vblank(struct drm_device *dev, int crtc); |
778 | extern bool drm_handle_vblank(struct drm_device *dev, int crtc); |
1153 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
779 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
1154 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
780 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
1155 | extern int drm_crtc_vblank_get(struct drm_crtc *crtc); |
781 | extern int drm_crtc_vblank_get(struct drm_crtc *crtc); |
1156 | extern void drm_crtc_vblank_put(struct drm_crtc *crtc); |
782 | extern void drm_crtc_vblank_put(struct drm_crtc *crtc); |
- | 783 | extern void drm_wait_one_vblank(struct drm_device *dev, int crtc); |
|
- | 784 | extern void drm_crtc_wait_one_vblank(struct drm_crtc *crtc); |
|
1157 | extern void drm_vblank_off(struct drm_device *dev, int crtc); |
785 | extern void drm_vblank_off(struct drm_device *dev, int crtc); |
1158 | extern void drm_vblank_on(struct drm_device *dev, int crtc); |
786 | extern void drm_vblank_on(struct drm_device *dev, int crtc); |
1159 | extern void drm_crtc_vblank_off(struct drm_crtc *crtc); |
787 | extern void drm_crtc_vblank_off(struct drm_crtc *crtc); |
1160 | extern void drm_crtc_vblank_on(struct drm_crtc *crtc); |
788 | extern void drm_crtc_vblank_on(struct drm_crtc *crtc); |
1161 | extern void drm_vblank_cleanup(struct drm_device *dev); |
789 | extern void drm_vblank_cleanup(struct drm_device *dev); |
Line 1162... | Line -... | ||
1162 | - | ||
1163 | extern u32 drm_get_last_vbltimestamp(struct drm_device *dev, int crtc, |
- | |
1164 | struct timeval *tvblank, unsigned flags); |
790 | |
1165 | extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, |
791 | extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, |
1166 | int crtc, int *max_error, |
792 | int crtc, int *max_error, |
1167 | struct timeval *vblank_time, |
793 | struct timeval *vblank_time, |
1168 | unsigned flags, |
794 | unsigned flags, |
1169 | const struct drm_crtc *refcrtc, |
795 | const struct drm_crtc *refcrtc, |
1170 | const struct drm_display_mode *mode); |
796 | const struct drm_display_mode *mode); |
1171 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, |
797 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, |
Line -... | Line 798... | ||
- | 798 | const struct drm_display_mode *mode); |
|
- | 799 | ||
- | 800 | /** |
|
- | 801 | * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC |
|
- | 802 | * @crtc: which CRTC's vblank waitqueue to retrieve |
|
- | 803 | * |
|
- | 804 | * This function returns a pointer to the vblank waitqueue for the CRTC. |
|
- | 805 | * Drivers can use this to implement vblank waits using wait_event() & co. |
|
- | 806 | */ |
|
- | 807 | static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc) |
|
- | 808 | { |
|
Line 1172... | Line 809... | ||
1172 | const struct drm_display_mode *mode); |
809 | return &crtc->dev->vblank[drm_crtc_index(crtc)].queue; |
1173 | 810 | } |
|
1174 | 811 | ||
1175 | /* Modesetting support */ |
- | |
1176 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
- | |
1177 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); |
- | |
1178 | extern int drm_modeset_ctl(struct drm_device *dev, void *data, |
- | |
Line 1179... | Line 812... | ||
1179 | struct drm_file *file_priv); |
812 | /* Modesetting support */ |
1180 | - | ||
1181 | /* AGP/GART support (drm_agpsupport.h) */ |
- | |
1182 | - | ||
1183 | /* Stub support (drm_stub.h) */ |
- | |
1184 | extern int drm_setmaster_ioctl(struct drm_device *dev, void *data, |
- | |
1185 | struct drm_file *file_priv); |
813 | extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc); |
1186 | extern int drm_dropmaster_ioctl(struct drm_device *dev, void *data, |
814 | extern void drm_vblank_post_modeset(struct drm_device *dev, int crtc); |
Line 1187... | Line 815... | ||
1187 | struct drm_file *file_priv); |
815 | |
1188 | struct drm_master *drm_master_create(struct drm_minor *minor); |
816 | /* Stub support (drm_stub.h) */ |
1189 | extern struct drm_master *drm_master_get(struct drm_master *master); |
817 | extern struct drm_master *drm_master_get(struct drm_master *master); |
Line 1190... | Line -... | ||
1190 | extern void drm_master_put(struct drm_master **master); |
- | |
1191 | - | ||
1192 | extern void drm_put_dev(struct drm_device *dev); |
- | |
1193 | extern void drm_unplug_dev(struct drm_device *dev); |
- | |
1194 | extern unsigned int drm_debug; |
- | |
1195 | - | ||
1196 | #if 0 |
- | |
1197 | extern unsigned int drm_vblank_offdelay; |
- | |
1198 | extern unsigned int drm_timestamp_precision; |
- | |
1199 | extern unsigned int drm_timestamp_monotonic; |
818 | extern void drm_master_put(struct drm_master **master); |
1200 | 819 | ||
1201 | extern struct class *drm_class; |
- | |
1202 | - | ||
1203 | extern struct drm_local_map *drm_getsarea(struct drm_device *dev); |
820 | extern void drm_put_dev(struct drm_device *dev); |
1204 | #endif |
821 | extern void drm_unplug_dev(struct drm_device *dev); |
1205 | /* Debugfs support */ |
822 | extern unsigned int drm_debug; |
1206 | #if defined(CONFIG_DEBUG_FS) |
823 | |
1207 | extern int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
824 | /* Debugfs support */ |
1208 | struct dentry *root); |
- | |
1209 | extern int drm_debugfs_create_files(const struct drm_info_list *files, |
- | |
1210 | int count, struct dentry *root, |
- | |
1211 | struct drm_minor *minor); |
825 | #if defined(CONFIG_DEBUG_FS) |
1212 | extern int drm_debugfs_remove_files(const struct drm_info_list *files, |
- | |
1213 | int count, struct drm_minor *minor); |
- | |
1214 | extern int drm_debugfs_cleanup(struct drm_minor *minor); |
- | |
1215 | extern int drm_debugfs_connector_add(struct drm_connector *connector); |
- | |
1216 | extern void drm_debugfs_connector_remove(struct drm_connector *connector); |
- | |
1217 | #else |
- | |
1218 | static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, |
826 | extern int drm_debugfs_create_files(const struct drm_info_list *files, |
1219 | struct dentry *root) |
827 | int count, struct dentry *root, |
1220 | { |
828 | struct drm_minor *minor); |
1221 | return 0; |
829 | extern int drm_debugfs_remove_files(const struct drm_info_list *files, |
1222 | } |
830 | int count, struct drm_minor *minor); |
Line 1231... | Line 839... | ||
1231 | static inline int drm_debugfs_remove_files(const struct drm_info_list *files, |
839 | static inline int drm_debugfs_remove_files(const struct drm_info_list *files, |
1232 | int count, struct drm_minor *minor) |
840 | int count, struct drm_minor *minor) |
1233 | { |
841 | { |
1234 | return 0; |
842 | return 0; |
1235 | } |
843 | } |
1236 | - | ||
1237 | static inline int drm_debugfs_cleanup(struct drm_minor *minor) |
- | |
1238 | { |
- | |
1239 | return 0; |
- | |
1240 | } |
- | |
1241 | - | ||
1242 | static inline int drm_debugfs_connector_add(struct drm_connector *connector) |
- | |
1243 | { |
- | |
1244 | return 0; |
- | |
1245 | } |
- | |
1246 | static inline void drm_debugfs_connector_remove(struct drm_connector *connector) |
- | |
1247 | { |
- | |
1248 | } |
- | |
1249 | - | ||
1250 | #endif |
844 | #endif |
Line 1251... | Line 845... | ||
1251 | 845 | ||
1252 | /* Info file support */ |
846 | extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev, |
1253 | extern int drm_name_info(struct seq_file *m, void *data); |
847 | struct drm_gem_object *obj, int flags); |
1254 | extern int drm_vm_info(struct seq_file *m, void *data); |
848 | extern int drm_gem_prime_handle_to_fd(struct drm_device *dev, |
- | 849 | struct drm_file *file_priv, uint32_t handle, uint32_t flags, |
|
1255 | extern int drm_bufs_info(struct seq_file *m, void *data); |
850 | int *prime_fd); |
1256 | extern int drm_vblank_info(struct seq_file *m, void *data); |
851 | extern struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, |
1257 | extern int drm_clients_info(struct seq_file *m, void* data); |
852 | struct dma_buf *dma_buf); |
1258 | extern int drm_gem_name_info(struct seq_file *m, void *data); |
- | |
1259 | 853 | extern int drm_gem_prime_fd_to_handle(struct drm_device *dev, |
|
1260 | #if DRM_DEBUG_CODE |
854 | struct drm_file *file_priv, int prime_fd, uint32_t *handle); |
1261 | extern int drm_vma_info(struct seq_file *m, void *data); |
- | |
1262 | #endif |
855 | extern void drm_gem_dmabuf_release(struct dma_buf *dma_buf); |
1263 | - | ||
1264 | /* Scatter Gather Support (drm_scatter.h) */ |
- | |
1265 | extern void drm_legacy_sg_cleanup(struct drm_device *dev); |
856 | |
1266 | extern int drm_sg_alloc(struct drm_device *dev, void *data, |
857 | extern int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, |
1267 | struct drm_file *file_priv); |
858 | dma_addr_t *addrs, int max_pages); |
1268 | extern int drm_sg_free(struct drm_device *dev, void *data, |
859 | extern struct sg_table *drm_prime_pages_to_sg(struct page **pages, unsigned int nr_pages); |
Line 1269... | Line -... | ||
1269 | struct drm_file *file_priv); |
- | |
1270 | - | ||
1271 | /* ATI PCIGART support (ati_pcigart.h) */ |
- | |
1272 | extern int drm_ati_pcigart_init(struct drm_device *dev, |
- | |
1273 | struct drm_ati_pcigart_info * gart_info); |
- | |
Line 1274... | Line 860... | ||
1274 | extern int drm_ati_pcigart_cleanup(struct drm_device *dev, |
860 | extern void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg); |
1275 | struct drm_ati_pcigart_info * gart_info); |
861 | |
1276 | - | ||
1277 | extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, |
862 | |
Line 1278... | Line -... | ||
1278 | size_t align); |
- | |
1279 | extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); |
863 | extern struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size, |
1280 | extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); |
- | |
1281 | - | ||
1282 | #if 0 |
- | |
1283 | /* sysfs support (drm_sysfs.c) */ |
- | |
1284 | struct drm_sysfs_class; |
864 | size_t align); |
1285 | extern struct class *drm_sysfs_create(struct module *owner, char *name); |
- | |
1286 | extern void drm_sysfs_destroy(void); |
- | |
1287 | extern struct device *drm_sysfs_minor_alloc(struct drm_minor *minor); |
- | |
1288 | extern void drm_sysfs_hotplug_event(struct drm_device *dev); |
- | |
1289 | extern int drm_sysfs_connector_add(struct drm_connector *connector); |
- | |
1290 | extern void drm_sysfs_connector_remove(struct drm_connector *connector); |
- | |
1291 | #endif |
- | |
1292 | - | ||
1293 | /* Graphics Execution Manager library functions (drm_gem.c) */ |
- | |
1294 | int drm_gem_init(struct drm_device *dev); |
- | |
1295 | void drm_gem_destroy(struct drm_device *dev); |
- | |
1296 | void drm_gem_object_release(struct drm_gem_object *obj); |
- | |
1297 | void drm_gem_object_free(struct kref *kref); |
- | |
1298 | int drm_gem_object_init(struct drm_device *dev, |
- | |
1299 | struct drm_gem_object *obj, size_t size); |
- | |
1300 | void drm_gem_private_object_init(struct drm_device *dev, |
- | |
1301 | struct drm_gem_object *obj, size_t size); |
- | |
1302 | void drm_gem_vm_open(struct vm_area_struct *vma); |
- | |
1303 | void drm_gem_vm_close(struct vm_area_struct *vma); |
- | |
1304 | int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, |
- | |
Line 1305... | Line -... | ||
1305 | struct vm_area_struct *vma); |
- | |
1306 | int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); |
- | |
1307 | - | ||
1308 | #include |
- | |
1309 | - | ||
1310 | static inline void |
- | |
1311 | drm_gem_object_reference(struct drm_gem_object *obj) |
- | |
1312 | { |
- | |
1313 | kref_get(&obj->refcount); |
- | |
1314 | } |
- | |
1315 | - | ||
1316 | static inline void |
- | |
1317 | drm_gem_object_unreference(struct drm_gem_object *obj) |
- | |
1318 | { |
- | |
1319 | if (obj != NULL) |
- | |
1320 | kref_put(&obj->refcount, drm_gem_object_free); |
- | |
1321 | } |
- | |
1322 | - | ||
1323 | static inline void |
- | |
1324 | drm_gem_object_unreference_unlocked(struct drm_gem_object *obj) |
- | |
1325 | { |
- | |
1326 | if (obj && !atomic_add_unless(&obj->refcount.refcount, -1, 1)) { |
- | |
1327 | struct drm_device *dev = obj->dev; |
- | |
1328 | - | ||
1329 | mutex_lock(&dev->struct_mutex); |
- | |
1330 | if (likely(atomic_dec_and_test(&obj->refcount.refcount))) |
- | |
1331 | drm_gem_object_free(&obj->refcount); |
- | |
1332 | mutex_unlock(&dev->struct_mutex); |
- | |
1333 | } |
- | |
1334 | } |
- | |
1335 | - | ||
1336 | int drm_gem_handle_create_tail(struct drm_file *file_priv, |
- | |
1337 | struct drm_gem_object *obj, |
- | |
1338 | u32 *handlep); |
- | |
1339 | int drm_gem_handle_create(struct drm_file *file_priv, |
- | |
1340 | struct drm_gem_object *obj, |
- | |
1341 | u32 *handlep); |
- | |
1342 | int drm_gem_handle_delete(struct drm_file *filp, u32 handle); |
- | |
1343 | - | ||
1344 | - | ||
1345 | void drm_gem_free_mmap_offset(struct drm_gem_object *obj); |
- | |
1346 | int drm_gem_create_mmap_offset(struct drm_gem_object *obj); |
- | |
1347 | int drm_gem_create_mmap_offset_size(struct drm_gem_object *obj, size_t size); |
- | |
1348 | - | ||
1349 | struct page **drm_gem_get_pages(struct drm_gem_object *obj); |
- | |
1350 | void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, |
- | |
1351 | bool dirty, bool accessed); |
- | |
1352 | - | ||
1353 | struct drm_gem_object *drm_gem_object_lookup(struct drm_device *dev, |
- | |
1354 | struct drm_file *filp, |
- | |
1355 | u32 handle); |
- | |
1356 | int drm_gem_close_ioctl(struct drm_device *dev, void *data, |
- | |
1357 | struct drm_file *file_priv); |
- | |
1358 | int drm_gem_flink_ioctl(struct drm_device *dev, void *data, |
- | |
1359 | struct drm_file *file_priv); |
- | |
1360 | int drm_gem_open_ioctl(struct drm_device *dev, void *data, |
- | |
1361 | struct drm_file *file_priv); |
- | |
1362 | void drm_gem_open(struct drm_device *dev, struct drm_file *file_private); |
- | |
1363 | void drm_gem_release(struct drm_device *dev, struct drm_file *file_private); |
- | |
1364 | - | ||
1365 | extern void drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev); |
- | |
1366 | extern void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev); |
- | |
1367 | extern void drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev); |
- | |
1368 | - | ||
1369 | static __inline__ struct drm_local_map *drm_core_findmap(struct drm_device *dev, |
- | |
1370 | unsigned int token) |
- | |
1371 | { |
- | |
1372 | struct drm_map_list *_entry; |
- | |
1373 | list_for_each_entry(_entry, &dev->maplist, head) |
- | |
1374 | if (_entry->user_token == token) |
- | |
1375 | return _entry->map; |
- | |
1376 | return NULL; |
- | |
1377 | } |
- | |
1378 | - | ||
Line 1379... | Line 865... | ||
1379 | static __inline__ void drm_core_dropmap(struct drm_local_map *map) |
865 | extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah); |
1380 | { |
866 | |
1381 | } |
867 | /* sysfs support (drm_sysfs.c) */ |
1382 | 868 | extern void drm_sysfs_hotplug_event(struct drm_device *dev); |
|
- | 869 | ||
- | 870 | ||
- | 871 | struct drm_device *drm_dev_alloc(struct drm_driver *driver, |
|
- | 872 | struct device *parent); |
|
- | 873 | void drm_dev_ref(struct drm_device *dev); |
|
- | 874 | void drm_dev_unref(struct drm_device *dev); |
|
Line 1383... | Line -... | ||
1383 | #include |
- | |
1384 | - | ||
1385 | struct drm_device *drm_dev_alloc(struct drm_driver *driver, |
- | |
1386 | struct device *parent); |
- | |
1387 | void drm_dev_ref(struct drm_device *dev); |
875 | int drm_dev_register(struct drm_device *dev, unsigned long flags); |
Line 1388... | Line 876... | ||
1388 | void drm_dev_unref(struct drm_device *dev); |
876 | void drm_dev_unregister(struct drm_device *dev); |
1389 | 877 | int drm_dev_set_unique(struct drm_device *dev, const char *fmt, ...); |
|
1390 | extern int drm_fill_in_dev(struct drm_device *dev, |
878 | |
Line 1418... | Line 906... | ||
1418 | 906 | ||
1419 | static __inline__ int drm_device_is_pcie(struct drm_device *dev) |
907 | static __inline__ int drm_device_is_pcie(struct drm_device *dev) |
1420 | { |
908 | { |
1421 | return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); |
909 | return pci_find_capability(dev->pdev, PCI_CAP_ID_EXP); |
1422 | } |
- | |
1423 | #endif /* __KERNEL__ */ |
- | |
1424 | - | ||
1425 | #define drm_sysfs_connector_add(connector) |
- | |
Line 1426... | Line 910... | ||
1426 | #define drm_sysfs_connector_remove(connector) |
910 | } |
1427 | 911 | ||
1428 | #define LFB_SIZE 0x1000000 |
912 | #define LFB_SIZE 0x1000000 |