diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-11 01:43:25 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-12 09:28:12 -0400 |
commit | ba8286fab52652e431784d066b075c1bb4933ea1 (patch) | |
tree | 700d1372b71ae2df393bd1b4b6482eeecc7b00ed /include/drm | |
parent | 86c1fbd55c6abc72496a45b7cbf1940324983977 (diff) |
drm: Move legacy buffer structures to <drm/drm_legacy.h>
A few odd cases:
- mgag200 someho had a totally unused drm_dma_handle_t. Remove it.
- i915 still uses the legacy pci dma alloc api, so grows an include.
Everything else fairly standard.
v2: Include "drm_legacy.h" in drm.ko source files for consistency.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm')
-rw-r--r-- | include/drm/ati_pcigart.h | 2 | ||||
-rw-r--r-- | include/drm/drmP.h | 119 | ||||
-rw-r--r-- | include/drm/drm_legacy.h | 109 |
3 files changed, 117 insertions, 113 deletions
diff --git a/include/drm/ati_pcigart.h b/include/drm/ati_pcigart.h index da4bfcd81a37..5765648b5ef7 100644 --- a/include/drm/ati_pcigart.h +++ b/include/drm/ati_pcigart.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef DRM_ATI_PCIGART_H | 1 | #ifndef DRM_ATI_PCIGART_H |
2 | #define DRM_ATI_PCIGART_H | 2 | #define DRM_ATI_PCIGART_H |
3 | 3 | ||
4 | #include <drm/drm_legacy.h> | ||
5 | |||
4 | /* location of GART table */ | 6 | /* location of GART table */ |
5 | #define DRM_ATI_GART_MAIN 1 | 7 | #define DRM_ATI_GART_MAIN 1 |
6 | #define DRM_ATI_GART_FB 2 | 8 | #define DRM_ATI_GART_FB 2 |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 4a72db4b4329..0d68ecdb447a 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -79,6 +79,9 @@ struct module; | |||
79 | struct drm_file; | 79 | struct drm_file; |
80 | struct drm_device; | 80 | struct drm_device; |
81 | struct drm_agp_head; | 81 | struct drm_agp_head; |
82 | struct drm_local_map; | ||
83 | struct drm_device_dma; | ||
84 | struct drm_dma_handle; | ||
82 | 85 | ||
83 | struct device_node; | 86 | struct device_node; |
84 | struct videomode; | 87 | struct videomode; |
@@ -275,57 +278,6 @@ struct drm_ioctl_desc { | |||
275 | #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ | 278 | #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ |
276 | [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} | 279 | [DRM_IOCTL_NR(DRM_##ioctl)] = {.cmd = DRM_##ioctl, .func = _func, .flags = _flags, .cmd_drv = DRM_IOCTL_##ioctl, .name = #ioctl} |
277 | 280 | ||
278 | /** | ||
279 | * DMA buffer. | ||
280 | */ | ||
281 | struct drm_buf { | ||
282 | int idx; /**< Index into master buflist */ | ||
283 | int total; /**< Buffer size */ | ||
284 | int order; /**< log-base-2(total) */ | ||
285 | int used; /**< Amount of buffer in use (for DMA) */ | ||
286 | unsigned long offset; /**< Byte offset (used internally) */ | ||
287 | void *address; /**< Address of buffer */ | ||
288 | unsigned long bus_address; /**< Bus address of buffer */ | ||
289 | struct drm_buf *next; /**< Kernel-only: used for free list */ | ||
290 | __volatile__ int waiting; /**< On kernel DMA queue */ | ||
291 | __volatile__ int pending; /**< On hardware DMA queue */ | ||
292 | struct drm_file *file_priv; /**< Private of holding file descr */ | ||
293 | int context; /**< Kernel queue for this buffer */ | ||
294 | int while_locked; /**< Dispatch this buffer while locked */ | ||
295 | enum { | ||
296 | DRM_LIST_NONE = 0, | ||
297 | DRM_LIST_FREE = 1, | ||
298 | DRM_LIST_WAIT = 2, | ||
299 | DRM_LIST_PEND = 3, | ||
300 | DRM_LIST_PRIO = 4, | ||
301 | DRM_LIST_RECLAIM = 5 | ||
302 | } list; /**< Which list we're on */ | ||
303 | |||
304 | int dev_priv_size; /**< Size of buffer private storage */ | ||
305 | void *dev_private; /**< Per-buffer private storage */ | ||
306 | }; | ||
307 | |||
308 | typedef struct drm_dma_handle { | ||
309 | dma_addr_t busaddr; | ||
310 | void *vaddr; | ||
311 | size_t size; | ||
312 | } drm_dma_handle_t; | ||
313 | |||
314 | /** | ||
315 | * Buffer entry. There is one of this for each buffer size order. | ||
316 | */ | ||
317 | struct drm_buf_entry { | ||
318 | int buf_size; /**< size */ | ||
319 | int buf_count; /**< number of buffers */ | ||
320 | struct drm_buf *buflist; /**< buffer list */ | ||
321 | int seg_count; | ||
322 | int page_order; | ||
323 | struct drm_dma_handle **seglist; | ||
324 | |||
325 | int low_mark; /**< Low water mark */ | ||
326 | int high_mark; /**< High water mark */ | ||
327 | }; | ||
328 | |||
329 | /* Event queued up for userspace to read */ | 281 | /* Event queued up for userspace to read */ |
330 | struct drm_pending_event { | 282 | struct drm_pending_event { |
331 | struct drm_event *event; | 283 | struct drm_event *event; |
@@ -404,65 +356,6 @@ struct drm_lock_data { | |||
404 | }; | 356 | }; |
405 | 357 | ||
406 | /** | 358 | /** |
407 | * DMA data. | ||
408 | */ | ||
409 | struct drm_device_dma { | ||
410 | |||
411 | struct drm_buf_entry bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */ | ||
412 | int buf_count; /**< total number of buffers */ | ||
413 | struct drm_buf **buflist; /**< Vector of pointers into drm_device_dma::bufs */ | ||
414 | int seg_count; | ||
415 | int page_count; /**< number of pages */ | ||
416 | unsigned long *pagelist; /**< page list */ | ||
417 | unsigned long byte_count; | ||
418 | enum { | ||
419 | _DRM_DMA_USE_AGP = 0x01, | ||
420 | _DRM_DMA_USE_SG = 0x02, | ||
421 | _DRM_DMA_USE_FB = 0x04, | ||
422 | _DRM_DMA_USE_PCI_RO = 0x08 | ||
423 | } flags; | ||
424 | |||
425 | }; | ||
426 | |||
427 | /** | ||
428 | * Scatter-gather memory. | ||
429 | */ | ||
430 | struct drm_sg_mem { | ||
431 | unsigned long handle; | ||
432 | void *virtual; | ||
433 | int pages; | ||
434 | struct page **pagelist; | ||
435 | dma_addr_t *busaddr; | ||
436 | }; | ||
437 | |||
438 | /** | ||
439 | * Kernel side of a mapping | ||
440 | */ | ||
441 | struct drm_local_map { | ||
442 | resource_size_t offset; /**< Requested physical address (0 for SAREA)*/ | ||
443 | unsigned long size; /**< Requested physical size (bytes) */ | ||
444 | enum drm_map_type type; /**< Type of memory to map */ | ||
445 | enum drm_map_flags flags; /**< Flags */ | ||
446 | void *handle; /**< User-space: "Handle" to pass to mmap() */ | ||
447 | /**< Kernel-space: kernel-virtual address */ | ||
448 | int mtrr; /**< MTRR slot used */ | ||
449 | }; | ||
450 | |||
451 | typedef struct drm_local_map drm_local_map_t; | ||
452 | |||
453 | /** | ||
454 | * Mappings list | ||
455 | */ | ||
456 | struct drm_map_list { | ||
457 | struct list_head head; /**< list head */ | ||
458 | struct drm_hash_item hash; | ||
459 | struct drm_local_map *map; /**< mapping */ | ||
460 | uint64_t user_token; | ||
461 | struct drm_master *master; | ||
462 | }; | ||
463 | |||
464 | |||
465 | /** | ||
466 | * This structure defines the drm_mm memory object, which will be used by the | 359 | * This structure defines the drm_mm memory object, which will be used by the |
467 | * DRM for its buffer objects. | 360 | * DRM for its buffer objects. |
468 | */ | 361 | */ |
@@ -1246,9 +1139,9 @@ int drm_gem_dumb_destroy(struct drm_file *file, | |||
1246 | uint32_t handle); | 1139 | uint32_t handle); |
1247 | 1140 | ||
1248 | 1141 | ||
1249 | extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, | 1142 | extern struct drm_dma_handle *drm_pci_alloc(struct drm_device *dev, size_t size, |
1250 | size_t align); | 1143 | size_t align); |
1251 | extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); | 1144 | extern void drm_pci_free(struct drm_device *dev, struct drm_dma_handle * dmah); |
1252 | 1145 | ||
1253 | /* sysfs support (drm_sysfs.c) */ | 1146 | /* sysfs support (drm_sysfs.c) */ |
1254 | extern void drm_sysfs_hotplug_event(struct drm_device *dev); | 1147 | extern void drm_sysfs_hotplug_event(struct drm_device *dev); |
diff --git a/include/drm/drm_legacy.h b/include/drm/drm_legacy.h index cc6e528069a8..a0fabf7624ea 100644 --- a/include/drm/drm_legacy.h +++ b/include/drm/drm_legacy.h | |||
@@ -42,6 +42,115 @@ | |||
42 | * you're doing it terribly wrong. | 42 | * you're doing it terribly wrong. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | /** | ||
46 | * DMA buffer. | ||
47 | */ | ||
48 | struct drm_buf { | ||
49 | int idx; /**< Index into master buflist */ | ||
50 | int total; /**< Buffer size */ | ||
51 | int order; /**< log-base-2(total) */ | ||
52 | int used; /**< Amount of buffer in use (for DMA) */ | ||
53 | unsigned long offset; /**< Byte offset (used internally) */ | ||
54 | void *address; /**< Address of buffer */ | ||
55 | unsigned long bus_address; /**< Bus address of buffer */ | ||
56 | struct drm_buf *next; /**< Kernel-only: used for free list */ | ||
57 | __volatile__ int waiting; /**< On kernel DMA queue */ | ||
58 | __volatile__ int pending; /**< On hardware DMA queue */ | ||
59 | struct drm_file *file_priv; /**< Private of holding file descr */ | ||
60 | int context; /**< Kernel queue for this buffer */ | ||
61 | int while_locked; /**< Dispatch this buffer while locked */ | ||
62 | enum { | ||
63 | DRM_LIST_NONE = 0, | ||
64 | DRM_LIST_FREE = 1, | ||
65 | DRM_LIST_WAIT = 2, | ||
66 | DRM_LIST_PEND = 3, | ||
67 | DRM_LIST_PRIO = 4, | ||
68 | DRM_LIST_RECLAIM = 5 | ||
69 | } list; /**< Which list we're on */ | ||
70 | |||
71 | int dev_priv_size; /**< Size of buffer private storage */ | ||
72 | void *dev_private; /**< Per-buffer private storage */ | ||
73 | }; | ||
74 | |||
75 | typedef struct drm_dma_handle { | ||
76 | dma_addr_t busaddr; | ||
77 | void *vaddr; | ||
78 | size_t size; | ||
79 | } drm_dma_handle_t; | ||
80 | |||
81 | /** | ||
82 | * Buffer entry. There is one of this for each buffer size order. | ||
83 | */ | ||
84 | struct drm_buf_entry { | ||
85 | int buf_size; /**< size */ | ||
86 | int buf_count; /**< number of buffers */ | ||
87 | struct drm_buf *buflist; /**< buffer list */ | ||
88 | int seg_count; | ||
89 | int page_order; | ||
90 | struct drm_dma_handle **seglist; | ||
91 | |||
92 | int low_mark; /**< Low water mark */ | ||
93 | int high_mark; /**< High water mark */ | ||
94 | }; | ||
95 | |||
96 | /** | ||
97 | * DMA data. | ||
98 | */ | ||
99 | struct drm_device_dma { | ||
100 | |||
101 | struct drm_buf_entry bufs[DRM_MAX_ORDER + 1]; /**< buffers, grouped by their size order */ | ||
102 | int buf_count; /**< total number of buffers */ | ||
103 | struct drm_buf **buflist; /**< Vector of pointers into drm_device_dma::bufs */ | ||
104 | int seg_count; | ||
105 | int page_count; /**< number of pages */ | ||
106 | unsigned long *pagelist; /**< page list */ | ||
107 | unsigned long byte_count; | ||
108 | enum { | ||
109 | _DRM_DMA_USE_AGP = 0x01, | ||
110 | _DRM_DMA_USE_SG = 0x02, | ||
111 | _DRM_DMA_USE_FB = 0x04, | ||
112 | _DRM_DMA_USE_PCI_RO = 0x08 | ||
113 | } flags; | ||
114 | |||
115 | }; | ||
116 | |||
117 | /** | ||
118 | * Scatter-gather memory. | ||
119 | */ | ||
120 | struct drm_sg_mem { | ||
121 | unsigned long handle; | ||
122 | void *virtual; | ||
123 | int pages; | ||
124 | struct page **pagelist; | ||
125 | dma_addr_t *busaddr; | ||
126 | }; | ||
127 | |||
128 | /** | ||
129 | * Kernel side of a mapping | ||
130 | */ | ||
131 | struct drm_local_map { | ||
132 | resource_size_t offset; /**< Requested physical address (0 for SAREA)*/ | ||
133 | unsigned long size; /**< Requested physical size (bytes) */ | ||
134 | enum drm_map_type type; /**< Type of memory to map */ | ||
135 | enum drm_map_flags flags; /**< Flags */ | ||
136 | void *handle; /**< User-space: "Handle" to pass to mmap() */ | ||
137 | /**< Kernel-space: kernel-virtual address */ | ||
138 | int mtrr; /**< MTRR slot used */ | ||
139 | }; | ||
140 | |||
141 | typedef struct drm_local_map drm_local_map_t; | ||
142 | |||
143 | /** | ||
144 | * Mappings list | ||
145 | */ | ||
146 | struct drm_map_list { | ||
147 | struct list_head head; /**< list head */ | ||
148 | struct drm_hash_item hash; | ||
149 | struct drm_local_map *map; /**< mapping */ | ||
150 | uint64_t user_token; | ||
151 | struct drm_master *master; | ||
152 | }; | ||
153 | |||
45 | int drm_legacy_addmap(struct drm_device *d, resource_size_t offset, | 154 | int drm_legacy_addmap(struct drm_device *d, resource_size_t offset, |
46 | unsigned int size, enum drm_map_type type, | 155 | unsigned int size, enum drm_map_type type, |
47 | enum drm_map_flags flags, struct drm_local_map **map_p); | 156 | enum drm_map_flags flags, struct drm_local_map **map_p); |