| @@ -1,1097 +1,1098 @@ | | | @@ -1,1097 +1,1098 @@ |
1 | /* $NetBSD: drmP.h,v 1.14 2018/08/27 04:58:37 riastradh Exp $ */ | | 1 | /* $NetBSD: drmP.h,v 1.15 2018/08/27 06:17:30 riastradh Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Internal Header for the Direct Rendering Manager | | 4 | * Internal Header for the Direct Rendering Manager |
5 | * | | 5 | * |
6 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. | | 6 | * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. |
7 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. | | 7 | * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. |
8 | * Copyright (c) 2009-2010, Code Aurora Forum. | | 8 | * Copyright (c) 2009-2010, Code Aurora Forum. |
9 | * All rights reserved. | | 9 | * All rights reserved. |
10 | * | | 10 | * |
11 | * Author: Rickard E. (Rik) Faith <faith@valinux.com> | | 11 | * Author: Rickard E. (Rik) Faith <faith@valinux.com> |
12 | * Author: Gareth Hughes <gareth@valinux.com> | | 12 | * Author: Gareth Hughes <gareth@valinux.com> |
13 | * | | 13 | * |
14 | * Permission is hereby granted, free of charge, to any person obtaining a | | 14 | * Permission is hereby granted, free of charge, to any person obtaining a |
15 | * copy of this software and associated documentation files (the "Software"), | | 15 | * copy of this software and associated documentation files (the "Software"), |
16 | * to deal in the Software without restriction, including without limitation | | 16 | * to deal in the Software without restriction, including without limitation |
17 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | | 17 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
18 | * and/or sell copies of the Software, and to permit persons to whom the | | 18 | * and/or sell copies of the Software, and to permit persons to whom the |
19 | * Software is furnished to do so, subject to the following conditions: | | 19 | * Software is furnished to do so, subject to the following conditions: |
20 | * | | 20 | * |
21 | * The above copyright notice and this permission notice (including the next | | 21 | * The above copyright notice and this permission notice (including the next |
22 | * paragraph) shall be included in all copies or substantial portions of the | | 22 | * paragraph) shall be included in all copies or substantial portions of the |
23 | * Software. | | 23 | * Software. |
24 | * | | 24 | * |
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | | 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | | 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | | 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
28 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | | 28 | * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
29 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | | 29 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
30 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | | 30 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
31 | * OTHER DEALINGS IN THE SOFTWARE. | | 31 | * OTHER DEALINGS IN THE SOFTWARE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #ifndef _DRM_P_H_ | | 34 | #ifndef _DRM_P_H_ |
35 | #define _DRM_P_H_ | | 35 | #define _DRM_P_H_ |
36 | | | 36 | |
37 | #include <linux/agp_backend.h> | | 37 | #include <linux/agp_backend.h> |
38 | #include <linux/atomic.h> | | 38 | #include <linux/atomic.h> |
39 | #include <linux/cdev.h> | | 39 | #include <linux/cdev.h> |
40 | #include <linux/dma-mapping.h> | | 40 | #include <linux/dma-mapping.h> |
41 | #include <linux/file.h> | | 41 | #include <linux/file.h> |
42 | #include <linux/fs.h> | | 42 | #include <linux/fs.h> |
43 | #include <linux/highmem.h> | | 43 | #include <linux/highmem.h> |
44 | #include <linux/idr.h> | | 44 | #include <linux/idr.h> |
45 | #include <linux/init.h> | | 45 | #include <linux/init.h> |
46 | #include <linux/io.h> | | 46 | #include <linux/io.h> |
47 | #include <linux/jiffies.h> | | 47 | #include <linux/jiffies.h> |
48 | #include <linux/kernel.h> | | 48 | #include <linux/kernel.h> |
49 | #include <linux/kref.h> | | 49 | #include <linux/kref.h> |
50 | #include <linux/ktime.h> | | 50 | #include <linux/ktime.h> |
51 | #include <linux/miscdevice.h> | | 51 | #include <linux/miscdevice.h> |
52 | #include <linux/mm.h> | | 52 | #include <linux/mm.h> |
53 | #include <linux/mutex.h> | | 53 | #include <linux/mutex.h> |
54 | #include <linux/pci.h> | | 54 | #include <linux/pci.h> |
55 | #include <linux/platform_device.h> | | 55 | #include <linux/platform_device.h> |
56 | #include <linux/pm.h> | | 56 | #include <linux/pm.h> |
57 | #include <linux/poll.h> | | 57 | #include <linux/poll.h> |
58 | #include <linux/ratelimit.h> | | 58 | #include <linux/ratelimit.h> |
59 | #include <linux/sched.h> | | 59 | #include <linux/sched.h> |
60 | #include <linux/slab.h> | | 60 | #include <linux/slab.h> |
61 | #include <linux/timer.h> | | 61 | #include <linux/timer.h> |
62 | #include <linux/types.h> | | 62 | #include <linux/types.h> |
63 | #include <linux/uidgid.h> | | 63 | #include <linux/uidgid.h> |
64 | #include <linux/vmalloc.h> | | 64 | #include <linux/vmalloc.h> |
65 | #include <linux/workqueue.h> | | 65 | #include <linux/workqueue.h> |
66 | | | 66 | |
67 | #include <asm/barrier.h> | | 67 | #include <asm/barrier.h> |
68 | #include <asm/mman.h> | | 68 | #include <asm/mman.h> |
69 | #include <asm/pgalloc.h> | | 69 | #include <asm/pgalloc.h> |
70 | #include <asm/uaccess.h> | | 70 | #include <asm/uaccess.h> |
71 | | | 71 | |
72 | #include <uapi/drm/drm.h> | | 72 | #include <uapi/drm/drm.h> |
73 | #include <uapi/drm/drm_mode.h> | | 73 | #include <uapi/drm/drm_mode.h> |
74 | | | 74 | |
75 | #include <drm/drm.h> | | 75 | #include <drm/drm.h> |
76 | #include <drm/drm_agpsupport.h> | | 76 | #include <drm/drm_agpsupport.h> |
77 | #include <drm/drm_crtc.h> | | 77 | #include <drm/drm_crtc.h> |
78 | #include <drm/drm_global.h> | | 78 | #include <drm/drm_global.h> |
79 | #include <drm/drm_hashtab.h> | | 79 | #include <drm/drm_hashtab.h> |
80 | #include <drm/drm_mem_util.h> | | 80 | #include <drm/drm_mem_util.h> |
81 | #include <drm/drm_mm.h> | | 81 | #include <drm/drm_mm.h> |
82 | #ifdef __NetBSD__ | | 82 | #ifdef __NetBSD__ |
83 | #include <drm/drm_os_netbsd.h> | | 83 | #include <drm/drm_os_netbsd.h> |
84 | #else | | 84 | #else |
85 | #include <drm/drm_os_linux.h> | | 85 | #include <drm/drm_os_linux.h> |
86 | #endif | | 86 | #endif |
87 | #include <drm/drm_sarea.h> | | 87 | #include <drm/drm_sarea.h> |
88 | #include <drm/drm_vma_manager.h> | | 88 | #include <drm/drm_vma_manager.h> |
89 | | | 89 | |
90 | struct module; | | 90 | struct module; |
91 | | | 91 | |
92 | struct drm_file; | | 92 | struct drm_file; |
93 | struct drm_device; | | 93 | struct drm_device; |
94 | struct drm_agp_head; | | 94 | struct drm_agp_head; |
95 | struct drm_local_map; | | 95 | struct drm_local_map; |
96 | struct drm_device_dma; | | 96 | struct drm_device_dma; |
97 | struct drm_dma_handle; | | 97 | struct drm_dma_handle; |
98 | struct drm_gem_object; | | 98 | struct drm_gem_object; |
| | | 99 | struct drm_bus_irq_cookie; |
99 | | | 100 | |
100 | struct device_node; | | 101 | struct device_node; |
101 | struct videomode; | | 102 | struct videomode; |
102 | struct reservation_object; | | 103 | struct reservation_object; |
103 | struct dma_buf_attachment; | | 104 | struct dma_buf_attachment; |
104 | | | 105 | |
105 | /* | | 106 | /* |
106 | * 4 debug categories are defined: | | 107 | * 4 debug categories are defined: |
107 | * | | 108 | * |
108 | * CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ... | | 109 | * CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ... |
109 | * This is the category used by the DRM_DEBUG() macro. | | 110 | * This is the category used by the DRM_DEBUG() macro. |
110 | * | | 111 | * |
111 | * DRIVER: Used in the vendor specific part of the driver: i915, radeon, ... | | 112 | * DRIVER: Used in the vendor specific part of the driver: i915, radeon, ... |
112 | * This is the category used by the DRM_DEBUG_DRIVER() macro. | | 113 | * This is the category used by the DRM_DEBUG_DRIVER() macro. |
113 | * | | 114 | * |
114 | * KMS: used in the modesetting code. | | 115 | * KMS: used in the modesetting code. |
115 | * This is the category used by the DRM_DEBUG_KMS() macro. | | 116 | * This is the category used by the DRM_DEBUG_KMS() macro. |
116 | * | | 117 | * |
117 | * PRIME: used in the prime code. | | 118 | * PRIME: used in the prime code. |
118 | * This is the category used by the DRM_DEBUG_PRIME() macro. | | 119 | * This is the category used by the DRM_DEBUG_PRIME() macro. |
119 | * | | 120 | * |
120 | * ATOMIC: used in the atomic code. | | 121 | * ATOMIC: used in the atomic code. |
121 | * This is the category used by the DRM_DEBUG_ATOMIC() macro. | | 122 | * This is the category used by the DRM_DEBUG_ATOMIC() macro. |
122 | * | | 123 | * |
123 | * VBL: used for verbose debug message in the vblank code | | 124 | * VBL: used for verbose debug message in the vblank code |
124 | * This is the category used by the DRM_DEBUG_VBL() macro. | | 125 | * This is the category used by the DRM_DEBUG_VBL() macro. |
125 | * | | 126 | * |
126 | * Enabling verbose debug messages is done through the drm.debug parameter, | | 127 | * Enabling verbose debug messages is done through the drm.debug parameter, |
127 | * each category being enabled by a bit. | | 128 | * each category being enabled by a bit. |
128 | * | | 129 | * |
129 | * drm.debug=0x1 will enable CORE messages | | 130 | * drm.debug=0x1 will enable CORE messages |
130 | * drm.debug=0x2 will enable DRIVER messages | | 131 | * drm.debug=0x2 will enable DRIVER messages |
131 | * drm.debug=0x3 will enable CORE and DRIVER messages | | 132 | * drm.debug=0x3 will enable CORE and DRIVER messages |
132 | * ... | | 133 | * ... |
133 | * drm.debug=0x3f will enable all messages | | 134 | * drm.debug=0x3f will enable all messages |
134 | * | | 135 | * |
135 | * An interesting feature is that it's possible to enable verbose logging at | | 136 | * An interesting feature is that it's possible to enable verbose logging at |
136 | * run-time by echoing the debug value in its sysfs node: | | 137 | * run-time by echoing the debug value in its sysfs node: |
137 | * # echo 0xf > /sys/module/drm/parameters/debug | | 138 | * # echo 0xf > /sys/module/drm/parameters/debug |
138 | */ | | 139 | */ |
139 | #define DRM_UT_CORE 0x01 | | 140 | #define DRM_UT_CORE 0x01 |
140 | #define DRM_UT_DRIVER 0x02 | | 141 | #define DRM_UT_DRIVER 0x02 |
141 | #define DRM_UT_KMS 0x04 | | 142 | #define DRM_UT_KMS 0x04 |
142 | #define DRM_UT_PRIME 0x08 | | 143 | #define DRM_UT_PRIME 0x08 |
143 | #define DRM_UT_ATOMIC 0x10 | | 144 | #define DRM_UT_ATOMIC 0x10 |
144 | #define DRM_UT_VBL 0x20 | | 145 | #define DRM_UT_VBL 0x20 |
145 | | | 146 | |
146 | extern __printf(2, 3) | | 147 | extern __printf(2, 3) |
147 | void drm_ut_debug_printk(const char *function_name, | | 148 | void drm_ut_debug_printk(const char *function_name, |
148 | const char *format, ...); | | 149 | const char *format, ...); |
149 | extern __printf(1, 2) | | 150 | extern __printf(1, 2) |
150 | void drm_err(const char *format, ...); | | 151 | void drm_err(const char *format, ...); |
151 | | | 152 | |
152 | /***********************************************************************/ | | 153 | /***********************************************************************/ |
153 | /** \name DRM template customization defaults */ | | 154 | /** \name DRM template customization defaults */ |
154 | /*@{*/ | | 155 | /*@{*/ |
155 | | | 156 | |
156 | /* driver capabilities and requirements mask */ | | 157 | /* driver capabilities and requirements mask */ |
157 | #define DRIVER_USE_AGP 0x1 | | 158 | #define DRIVER_USE_AGP 0x1 |
158 | #define DRIVER_PCI_DMA 0x8 | | 159 | #define DRIVER_PCI_DMA 0x8 |
159 | #define DRIVER_SG 0x10 | | 160 | #define DRIVER_SG 0x10 |
160 | #define DRIVER_HAVE_DMA 0x20 | | 161 | #define DRIVER_HAVE_DMA 0x20 |
161 | #define DRIVER_HAVE_IRQ 0x40 | | 162 | #define DRIVER_HAVE_IRQ 0x40 |
162 | #define DRIVER_IRQ_SHARED 0x80 | | 163 | #define DRIVER_IRQ_SHARED 0x80 |
163 | #define DRIVER_GEM 0x1000 | | 164 | #define DRIVER_GEM 0x1000 |
164 | #define DRIVER_MODESET 0x2000 | | 165 | #define DRIVER_MODESET 0x2000 |
165 | #define DRIVER_PRIME 0x4000 | | 166 | #define DRIVER_PRIME 0x4000 |
166 | #define DRIVER_RENDER 0x8000 | | 167 | #define DRIVER_RENDER 0x8000 |
167 | #define DRIVER_ATOMIC 0x10000 | | 168 | #define DRIVER_ATOMIC 0x10000 |
168 | #define DRIVER_KMS_LEGACY_CONTEXT 0x20000 | | 169 | #define DRIVER_KMS_LEGACY_CONTEXT 0x20000 |
169 | | | 170 | |
170 | /***********************************************************************/ | | 171 | /***********************************************************************/ |
171 | /** \name Macros to make printk easier */ | | 172 | /** \name Macros to make printk easier */ |
172 | /*@{*/ | | 173 | /*@{*/ |
173 | | | 174 | |
174 | #define _DRM_PRINTK(once, level, fmt, ...) \ | | 175 | #define _DRM_PRINTK(once, level, fmt, ...) \ |
175 | do { \ | | 176 | do { \ |
176 | printk##once(KERN_##level "[" DRM_NAME "] " fmt, \ | | 177 | printk##once(KERN_##level "[" DRM_NAME "] " fmt, \ |
177 | ##__VA_ARGS__); \ | | 178 | ##__VA_ARGS__); \ |
178 | } while (0) | | 179 | } while (0) |
179 | | | 180 | |
180 | #define DRM_INFO(fmt, ...) \ | | 181 | #define DRM_INFO(fmt, ...) \ |
181 | _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__) | | 182 | _DRM_PRINTK(, INFO, fmt, ##__VA_ARGS__) |
182 | #define DRM_NOTE(fmt, ...) \ | | 183 | #define DRM_NOTE(fmt, ...) \ |
183 | _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__) | | 184 | _DRM_PRINTK(, NOTICE, fmt, ##__VA_ARGS__) |
184 | #define DRM_WARN(fmt, ...) \ | | 185 | #define DRM_WARN(fmt, ...) \ |
185 | _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__) | | 186 | _DRM_PRINTK(, WARNING, fmt, ##__VA_ARGS__) |
186 | | | 187 | |
187 | #define DRM_INFO_ONCE(fmt, ...) \ | | 188 | #define DRM_INFO_ONCE(fmt, ...) \ |
188 | _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__) | | 189 | _DRM_PRINTK(_once, INFO, fmt, ##__VA_ARGS__) |
189 | #define DRM_NOTE_ONCE(fmt, ...) \ | | 190 | #define DRM_NOTE_ONCE(fmt, ...) \ |
190 | _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__) | | 191 | _DRM_PRINTK(_once, NOTICE, fmt, ##__VA_ARGS__) |
191 | #define DRM_WARN_ONCE(fmt, ...) \ | | 192 | #define DRM_WARN_ONCE(fmt, ...) \ |
192 | _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__) | | 193 | _DRM_PRINTK(_once, WARNING, fmt, ##__VA_ARGS__) |
193 | | | 194 | |
194 | /** | | 195 | /** |
195 | * Error output. | | 196 | * Error output. |
196 | * | | 197 | * |
197 | * \param fmt printf() like format string. | | 198 | * \param fmt printf() like format string. |
198 | * \param arg arguments | | 199 | * \param arg arguments |
199 | */ | | 200 | */ |
200 | #define DRM_ERROR(fmt, ...) \ | | 201 | #define DRM_ERROR(fmt, ...) \ |
201 | drm_err(fmt, ##__VA_ARGS__) | | 202 | drm_err(fmt, ##__VA_ARGS__) |
202 | | | 203 | |
203 | /** | | 204 | /** |
204 | * Rate limited error output. Like DRM_ERROR() but won't flood the log. | | 205 | * Rate limited error output. Like DRM_ERROR() but won't flood the log. |
205 | * | | 206 | * |
206 | * \param fmt printf() like format string. | | 207 | * \param fmt printf() like format string. |
207 | * \param arg arguments | | 208 | * \param arg arguments |
208 | */ | | 209 | */ |
209 | #define DRM_ERROR_RATELIMITED(fmt, ...) \ | | 210 | #define DRM_ERROR_RATELIMITED(fmt, ...) \ |
210 | ({ \ | | 211 | ({ \ |
211 | static DEFINE_RATELIMIT_STATE(_rs, \ | | 212 | static DEFINE_RATELIMIT_STATE(_rs, \ |
212 | DEFAULT_RATELIMIT_INTERVAL, \ | | 213 | DEFAULT_RATELIMIT_INTERVAL, \ |
213 | DEFAULT_RATELIMIT_BURST); \ | | 214 | DEFAULT_RATELIMIT_BURST); \ |
214 | \ | | 215 | \ |
215 | if (__ratelimit(&_rs)) \ | | 216 | if (__ratelimit(&_rs)) \ |
216 | drm_err(fmt, ##__VA_ARGS__); \ | | 217 | drm_err(fmt, ##__VA_ARGS__); \ |
217 | }) | | 218 | }) |
218 | | | 219 | |
219 | /** | | 220 | /** |
220 | * Debug output. | | 221 | * Debug output. |
221 | * | | 222 | * |
222 | * \param fmt printf() like format string. | | 223 | * \param fmt printf() like format string. |
223 | * \param arg arguments | | 224 | * \param arg arguments |
224 | */ | | 225 | */ |
225 | #define DRM_DEBUG(fmt, args...) \ | | 226 | #define DRM_DEBUG(fmt, args...) \ |
226 | do { \ | | 227 | do { \ |
227 | if (unlikely(drm_debug & DRM_UT_CORE)) \ | | 228 | if (unlikely(drm_debug & DRM_UT_CORE)) \ |
228 | drm_ut_debug_printk(__func__, fmt, ##args); \ | | 229 | drm_ut_debug_printk(__func__, fmt, ##args); \ |
229 | } while (0) | | 230 | } while (0) |
230 | | | 231 | |
231 | #define DRM_DEBUG_DRIVER(fmt, args...) \ | | 232 | #define DRM_DEBUG_DRIVER(fmt, args...) \ |
232 | do { \ | | 233 | do { \ |
233 | if (unlikely(drm_debug & DRM_UT_DRIVER)) \ | | 234 | if (unlikely(drm_debug & DRM_UT_DRIVER)) \ |
234 | drm_ut_debug_printk(__func__, fmt, ##args); \ | | 235 | drm_ut_debug_printk(__func__, fmt, ##args); \ |
235 | } while (0) | | 236 | } while (0) |
236 | #define DRM_DEBUG_KMS(fmt, args...) \ | | 237 | #define DRM_DEBUG_KMS(fmt, args...) \ |
237 | do { \ | | 238 | do { \ |
238 | if (unlikely(drm_debug & DRM_UT_KMS)) \ | | 239 | if (unlikely(drm_debug & DRM_UT_KMS)) \ |
239 | drm_ut_debug_printk(__func__, fmt, ##args); \ | | 240 | drm_ut_debug_printk(__func__, fmt, ##args); \ |
240 | } while (0) | | 241 | } while (0) |
241 | #define DRM_DEBUG_PRIME(fmt, args...) \ | | 242 | #define DRM_DEBUG_PRIME(fmt, args...) \ |
242 | do { \ | | 243 | do { \ |
243 | if (unlikely(drm_debug & DRM_UT_PRIME)) \ | | 244 | if (unlikely(drm_debug & DRM_UT_PRIME)) \ |
244 | drm_ut_debug_printk(__func__, fmt, ##args); \ | | 245 | drm_ut_debug_printk(__func__, fmt, ##args); \ |
245 | } while (0) | | 246 | } while (0) |
246 | #define DRM_DEBUG_ATOMIC(fmt, args...) \ | | 247 | #define DRM_DEBUG_ATOMIC(fmt, args...) \ |
247 | do { \ | | 248 | do { \ |
248 | if (unlikely(drm_debug & DRM_UT_ATOMIC)) \ | | 249 | if (unlikely(drm_debug & DRM_UT_ATOMIC)) \ |
249 | drm_ut_debug_printk(__func__, fmt, ##args); \ | | 250 | drm_ut_debug_printk(__func__, fmt, ##args); \ |
250 | } while (0) | | 251 | } while (0) |
251 | #define DRM_DEBUG_VBL(fmt, args...) \ | | 252 | #define DRM_DEBUG_VBL(fmt, args...) \ |
252 | do { \ | | 253 | do { \ |
253 | if (unlikely(drm_debug & DRM_UT_VBL)) \ | | 254 | if (unlikely(drm_debug & DRM_UT_VBL)) \ |
254 | drm_ut_debug_printk(__func__, fmt, ##args); \ | | 255 | drm_ut_debug_printk(__func__, fmt, ##args); \ |
255 | } while (0) | | 256 | } while (0) |
256 | | | 257 | |
257 | /*@}*/ | | 258 | /*@}*/ |
258 | | | 259 | |
259 | /***********************************************************************/ | | 260 | /***********************************************************************/ |
260 | /** \name Internal types and structures */ | | 261 | /** \name Internal types and structures */ |
261 | /*@{*/ | | 262 | /*@{*/ |
262 | | | 263 | |
263 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) | | 264 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
264 | | | 265 | |
265 | /** | | 266 | /** |
266 | * Ioctl function type. | | 267 | * Ioctl function type. |
267 | * | | 268 | * |
268 | * \param inode device inode. | | 269 | * \param inode device inode. |
269 | * \param file_priv DRM file private pointer. | | 270 | * \param file_priv DRM file private pointer. |
270 | * \param cmd command. | | 271 | * \param cmd command. |
271 | * \param arg argument. | | 272 | * \param arg argument. |
272 | */ | | 273 | */ |
273 | typedef int drm_ioctl_t(struct drm_device *dev, void *data, | | 274 | typedef int drm_ioctl_t(struct drm_device *dev, void *data, |
274 | struct drm_file *file_priv); | | 275 | struct drm_file *file_priv); |
275 | | | 276 | |
276 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, | | 277 | typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd, |
277 | unsigned long arg); | | 278 | unsigned long arg); |
278 | | | 279 | |
279 | #ifdef __NetBSD__ | | 280 | #ifdef __NetBSD__ |
280 | /* XXX Kludge...is there a better way to do this? */ | | 281 | /* XXX Kludge...is there a better way to do this? */ |
281 | #define DRM_IOCTL_NR(n) \ | | 282 | #define DRM_IOCTL_NR(n) \ |
282 | (IOCBASECMD(n) &~ (IOC_DIRMASK | (IOCGROUP(n) << IOCGROUP_SHIFT))) | | 283 | (IOCBASECMD(n) &~ (IOC_DIRMASK | (IOCGROUP(n) << IOCGROUP_SHIFT))) |
283 | #define DRM_MAJOR cdevsw_lookup_major(&drm_cdevsw) | | 284 | #define DRM_MAJOR cdevsw_lookup_major(&drm_cdevsw) |
284 | #else | | 285 | #else |
285 | #define DRM_IOCTL_NR(n) _IOC_NR(n) | | 286 | #define DRM_IOCTL_NR(n) _IOC_NR(n) |
286 | #define DRM_MAJOR 226 | | 287 | #define DRM_MAJOR 226 |
287 | #endif | | 288 | #endif |
288 | | | 289 | |
289 | #define DRM_AUTH 0x1 | | 290 | #define DRM_AUTH 0x1 |
290 | #define DRM_MASTER 0x2 | | 291 | #define DRM_MASTER 0x2 |
291 | #define DRM_ROOT_ONLY 0x4 | | 292 | #define DRM_ROOT_ONLY 0x4 |
292 | #define DRM_CONTROL_ALLOW 0x8 | | 293 | #define DRM_CONTROL_ALLOW 0x8 |
293 | #define DRM_UNLOCKED 0x10 | | 294 | #define DRM_UNLOCKED 0x10 |
294 | #define DRM_RENDER_ALLOW 0x20 | | 295 | #define DRM_RENDER_ALLOW 0x20 |
295 | | | 296 | |
296 | struct drm_ioctl_desc { | | 297 | struct drm_ioctl_desc { |
297 | unsigned int cmd; | | 298 | unsigned int cmd; |
298 | int flags; | | 299 | int flags; |
299 | drm_ioctl_t *func; | | 300 | drm_ioctl_t *func; |
300 | const char *name; | | 301 | const char *name; |
301 | }; | | 302 | }; |
302 | | | 303 | |
303 | /** | | 304 | /** |
304 | * Creates a driver or general drm_ioctl_desc array entry for the given | | 305 | * Creates a driver or general drm_ioctl_desc array entry for the given |
305 | * ioctl, for use by drm_ioctl(). | | 306 | * ioctl, for use by drm_ioctl(). |
306 | */ | | 307 | */ |
307 | | | 308 | |
308 | #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ | | 309 | #define DRM_IOCTL_DEF_DRV(ioctl, _func, _flags) \ |
309 | [DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = { \ | | 310 | [DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = { \ |
310 | .cmd = DRM_IOCTL_##ioctl, \ | | 311 | .cmd = DRM_IOCTL_##ioctl, \ |
311 | .func = _func, \ | | 312 | .func = _func, \ |
312 | .flags = _flags, \ | | 313 | .flags = _flags, \ |
313 | .name = #ioctl \ | | 314 | .name = #ioctl \ |
314 | } | | 315 | } |
315 | | | 316 | |
316 | /* Event queued up for userspace to read */ | | 317 | /* Event queued up for userspace to read */ |
317 | struct drm_pending_event { | | 318 | struct drm_pending_event { |
318 | struct drm_event *event; | | 319 | struct drm_event *event; |
319 | struct list_head link; | | 320 | struct list_head link; |
320 | struct drm_file *file_priv; | | 321 | struct drm_file *file_priv; |
321 | pid_t pid; /* pid of requester, no guarantee it's valid by the time | | 322 | pid_t pid; /* pid of requester, no guarantee it's valid by the time |
322 | we deliver the event, for tracing only */ | | 323 | we deliver the event, for tracing only */ |
323 | void (*destroy)(struct drm_pending_event *event); | | 324 | void (*destroy)(struct drm_pending_event *event); |
324 | }; | | 325 | }; |
325 | | | 326 | |
326 | /* initial implementaton using a linked list - todo hashtab */ | | 327 | /* initial implementaton using a linked list - todo hashtab */ |
327 | struct drm_prime_file_private { | | 328 | struct drm_prime_file_private { |
328 | struct list_head head; | | 329 | struct list_head head; |
329 | struct mutex lock; | | 330 | struct mutex lock; |
330 | }; | | 331 | }; |
331 | | | 332 | |
332 | /** File private data */ | | 333 | /** File private data */ |
333 | struct drm_file { | | 334 | struct drm_file { |
334 | unsigned authenticated :1; | | 335 | unsigned authenticated :1; |
335 | /* Whether we're master for a minor. Protected by master_mutex */ | | 336 | /* Whether we're master for a minor. Protected by master_mutex */ |
336 | unsigned is_master :1; | | 337 | unsigned is_master :1; |
337 | /* true when the client has asked us to expose stereo 3D mode flags */ | | 338 | /* true when the client has asked us to expose stereo 3D mode flags */ |
338 | unsigned stereo_allowed :1; | | 339 | unsigned stereo_allowed :1; |
339 | /* | | 340 | /* |
340 | * true if client understands CRTC primary planes and cursor planes | | 341 | * true if client understands CRTC primary planes and cursor planes |
341 | * in the plane list | | 342 | * in the plane list |
342 | */ | | 343 | */ |
343 | unsigned universal_planes:1; | | 344 | unsigned universal_planes:1; |
344 | /* true if client understands atomic properties */ | | 345 | /* true if client understands atomic properties */ |
345 | unsigned atomic:1; | | 346 | unsigned atomic:1; |
346 | /* | | 347 | /* |
347 | * This client is allowed to gain master privileges for @master. | | 348 | * This client is allowed to gain master privileges for @master. |
348 | * Protected by struct drm_device::master_mutex. | | 349 | * Protected by struct drm_device::master_mutex. |
349 | */ | | 350 | */ |
350 | unsigned allowed_master:1; | | 351 | unsigned allowed_master:1; |
351 | | | 352 | |
352 | #ifndef __NetBSD__ | | 353 | #ifndef __NetBSD__ |
353 | struct pid *pid; | | 354 | struct pid *pid; |
354 | kuid_t uid; | | 355 | kuid_t uid; |
355 | #endif | | 356 | #endif |
356 | drm_magic_t magic; | | 357 | drm_magic_t magic; |
357 | struct list_head lhead; | | 358 | struct list_head lhead; |
358 | struct drm_minor *minor; | | 359 | struct drm_minor *minor; |
359 | unsigned long lock_count; | | 360 | unsigned long lock_count; |
360 | | | 361 | |
361 | /** Mapping of mm object handles to object pointers. */ | | 362 | /** Mapping of mm object handles to object pointers. */ |
362 | struct idr object_idr; | | 363 | struct idr object_idr; |
363 | /** Lock for synchronization of access to object_idr. */ | | 364 | /** Lock for synchronization of access to object_idr. */ |
364 | spinlock_t table_lock; | | 365 | spinlock_t table_lock; |
365 | | | 366 | |
366 | struct file *filp; | | 367 | struct file *filp; |
367 | void *driver_priv; | | 368 | void *driver_priv; |
368 | | | 369 | |
369 | struct drm_master *master; /* master this node is currently associated with | | 370 | struct drm_master *master; /* master this node is currently associated with |
370 | N.B. not always minor->master */ | | 371 | N.B. not always minor->master */ |
371 | /** | | 372 | /** |
372 | * fbs - List of framebuffers associated with this file. | | 373 | * fbs - List of framebuffers associated with this file. |
373 | * | | 374 | * |
374 | * Protected by fbs_lock. Note that the fbs list holds a reference on | | 375 | * Protected by fbs_lock. Note that the fbs list holds a reference on |
375 | * the fb object to prevent it from untimely disappearing. | | 376 | * the fb object to prevent it from untimely disappearing. |
376 | */ | | 377 | */ |
377 | struct list_head fbs; | | 378 | struct list_head fbs; |
378 | struct mutex fbs_lock; | | 379 | struct mutex fbs_lock; |
379 | | | 380 | |
380 | /** User-created blob properties; this retains a reference on the | | 381 | /** User-created blob properties; this retains a reference on the |
381 | * property. */ | | 382 | * property. */ |
382 | struct list_head blobs; | | 383 | struct list_head blobs; |
383 | | | 384 | |
384 | #ifdef __NetBSD__ | | 385 | #ifdef __NetBSD__ |
385 | drm_waitqueue_t event_wait; | | 386 | drm_waitqueue_t event_wait; |
386 | struct selinfo event_selq; | | 387 | struct selinfo event_selq; |
387 | #else | | 388 | #else |
388 | wait_queue_head_t event_wait; | | 389 | wait_queue_head_t event_wait; |
389 | #endif | | 390 | #endif |
390 | struct list_head event_list; | | 391 | struct list_head event_list; |
391 | int event_space; | | 392 | int event_space; |
392 | | | 393 | |
393 | struct drm_prime_file_private prime; | | 394 | struct drm_prime_file_private prime; |
394 | }; | | 395 | }; |
395 | | | 396 | |
396 | /** | | 397 | /** |
397 | * Lock data. | | 398 | * Lock data. |
398 | */ | | 399 | */ |
399 | struct drm_lock_data { | | 400 | struct drm_lock_data { |
400 | struct drm_hw_lock *hw_lock; /**< Hardware lock */ | | 401 | struct drm_hw_lock *hw_lock; /**< Hardware lock */ |
401 | /** Private of lock holder's file (NULL=kernel) */ | | 402 | /** Private of lock holder's file (NULL=kernel) */ |
402 | struct drm_file *file_priv; | | 403 | struct drm_file *file_priv; |
403 | #ifdef __NetBSD__ | | 404 | #ifdef __NetBSD__ |
404 | drm_waitqueue_t lock_queue; /**< Queue of blocked processes */ | | 405 | drm_waitqueue_t lock_queue; /**< Queue of blocked processes */ |
405 | #else | | 406 | #else |
406 | wait_queue_head_t lock_queue; /**< Queue of blocked processes */ | | 407 | wait_queue_head_t lock_queue; /**< Queue of blocked processes */ |
407 | #endif | | 408 | #endif |
408 | unsigned long lock_time; /**< Time of last lock in jiffies */ | | 409 | unsigned long lock_time; /**< Time of last lock in jiffies */ |
409 | spinlock_t spinlock; | | 410 | spinlock_t spinlock; |
410 | uint32_t kernel_waiters; | | 411 | uint32_t kernel_waiters; |
411 | uint32_t user_waiters; | | 412 | uint32_t user_waiters; |
412 | int idle_has_lock; | | 413 | int idle_has_lock; |
413 | }; | | 414 | }; |
414 | | | 415 | |
415 | /** | | 416 | /** |
416 | * struct drm_master - drm master structure | | 417 | * struct drm_master - drm master structure |
417 | * | | 418 | * |
418 | * @refcount: Refcount for this master object. | | 419 | * @refcount: Refcount for this master object. |
419 | * @minor: Link back to minor char device we are master for. Immutable. | | 420 | * @minor: Link back to minor char device we are master for. Immutable. |
420 | * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. | | 421 | * @unique: Unique identifier: e.g. busid. Protected by drm_global_mutex. |
421 | * @unique_len: Length of unique field. Protected by drm_global_mutex. | | 422 | * @unique_len: Length of unique field. Protected by drm_global_mutex. |
422 | * @magic_map: Map of used authentication tokens. Protected by struct_mutex. | | 423 | * @magic_map: Map of used authentication tokens. Protected by struct_mutex. |
423 | * @lock: DRI lock information. | | 424 | * @lock: DRI lock information. |
424 | * @driver_priv: Pointer to driver-private information. | | 425 | * @driver_priv: Pointer to driver-private information. |
425 | */ | | 426 | */ |
426 | struct drm_master { | | 427 | struct drm_master { |
427 | struct kref refcount; | | 428 | struct kref refcount; |
428 | struct drm_minor *minor; | | 429 | struct drm_minor *minor; |
429 | char *unique; | | 430 | char *unique; |
430 | int unique_len; | | 431 | int unique_len; |
431 | struct idr magic_map; | | 432 | struct idr magic_map; |
432 | struct drm_lock_data lock; | | 433 | struct drm_lock_data lock; |
433 | void *driver_priv; | | 434 | void *driver_priv; |
434 | }; | | 435 | }; |
435 | | | 436 | |
436 | /* Size of ringbuffer for vblank timestamps. Just double-buffer | | 437 | /* Size of ringbuffer for vblank timestamps. Just double-buffer |
437 | * in initial implementation. | | 438 | * in initial implementation. |
438 | */ | | 439 | */ |
439 | #define DRM_VBLANKTIME_RBSIZE 2 | | 440 | #define DRM_VBLANKTIME_RBSIZE 2 |
440 | | | 441 | |
441 | /* Flags and return codes for get_vblank_timestamp() driver function. */ | | 442 | /* Flags and return codes for get_vblank_timestamp() driver function. */ |
442 | #define DRM_CALLED_FROM_VBLIRQ 1 | | 443 | #define DRM_CALLED_FROM_VBLIRQ 1 |
443 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) | | 444 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) |
444 | #define DRM_VBLANKTIME_IN_VBLANK (1 << 1) | | 445 | #define DRM_VBLANKTIME_IN_VBLANK (1 << 1) |
445 | | | 446 | |
446 | /* get_scanout_position() return flags */ | | 447 | /* get_scanout_position() return flags */ |
447 | #define DRM_SCANOUTPOS_VALID (1 << 0) | | 448 | #define DRM_SCANOUTPOS_VALID (1 << 0) |
448 | #define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) | | 449 | #define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) |
449 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) | | 450 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) |
450 | | | 451 | |
451 | /** | | 452 | /** |
452 | * DRM driver structure. This structure represent the common code for | | 453 | * DRM driver structure. This structure represent the common code for |
453 | * a family of cards. There will one drm_device for each card present | | 454 | * a family of cards. There will one drm_device for each card present |
454 | * in this family | | 455 | * in this family |
455 | */ | | 456 | */ |
456 | struct drm_driver { | | 457 | struct drm_driver { |
457 | int (*load) (struct drm_device *, unsigned long flags); | | 458 | int (*load) (struct drm_device *, unsigned long flags); |
458 | int (*firstopen) (struct drm_device *); | | 459 | int (*firstopen) (struct drm_device *); |
459 | int (*open) (struct drm_device *, struct drm_file *); | | 460 | int (*open) (struct drm_device *, struct drm_file *); |
460 | void (*preclose) (struct drm_device *, struct drm_file *file_priv); | | 461 | void (*preclose) (struct drm_device *, struct drm_file *file_priv); |
461 | void (*postclose) (struct drm_device *, struct drm_file *); | | 462 | void (*postclose) (struct drm_device *, struct drm_file *); |
462 | void (*lastclose) (struct drm_device *); | | 463 | void (*lastclose) (struct drm_device *); |
463 | int (*unload) (struct drm_device *); | | 464 | int (*unload) (struct drm_device *); |
464 | int (*suspend) (struct drm_device *, pm_message_t state); | | 465 | int (*suspend) (struct drm_device *, pm_message_t state); |
465 | int (*resume) (struct drm_device *); | | 466 | int (*resume) (struct drm_device *); |
466 | int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); | | 467 | int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); |
467 | int (*dma_quiescent) (struct drm_device *); | | 468 | int (*dma_quiescent) (struct drm_device *); |
468 | int (*context_dtor) (struct drm_device *dev, int context); | | 469 | int (*context_dtor) (struct drm_device *dev, int context); |
469 | int (*set_busid)(struct drm_device *dev, struct drm_master *master); | | 470 | int (*set_busid)(struct drm_device *dev, struct drm_master *master); |
470 | | | 471 | |
471 | /** | | 472 | /** |
472 | * get_vblank_counter - get raw hardware vblank counter | | 473 | * get_vblank_counter - get raw hardware vblank counter |
473 | * @dev: DRM device | | 474 | * @dev: DRM device |
474 | * @pipe: counter to fetch | | 475 | * @pipe: counter to fetch |
475 | * | | 476 | * |
476 | * Driver callback for fetching a raw hardware vblank counter for @crtc. | | 477 | * Driver callback for fetching a raw hardware vblank counter for @crtc. |
477 | * If a device doesn't have a hardware counter, the driver can simply | | 478 | * If a device doesn't have a hardware counter, the driver can simply |
478 | * return the value of drm_vblank_count. The DRM core will account for | | 479 | * return the value of drm_vblank_count. The DRM core will account for |
479 | * missed vblank events while interrupts where disabled based on system | | 480 | * missed vblank events while interrupts where disabled based on system |
480 | * timestamps. | | 481 | * timestamps. |
481 | * | | 482 | * |
482 | * Wraparound handling and loss of events due to modesetting is dealt | | 483 | * Wraparound handling and loss of events due to modesetting is dealt |
483 | * with in the DRM core code. | | 484 | * with in the DRM core code. |
484 | * | | 485 | * |
485 | * RETURNS | | 486 | * RETURNS |
486 | * Raw vblank counter value. | | 487 | * Raw vblank counter value. |
487 | */ | | 488 | */ |
488 | u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe); | | 489 | u32 (*get_vblank_counter) (struct drm_device *dev, unsigned int pipe); |
489 | | | 490 | |
490 | /** | | 491 | /** |
491 | * enable_vblank - enable vblank interrupt events | | 492 | * enable_vblank - enable vblank interrupt events |
492 | * @dev: DRM device | | 493 | * @dev: DRM device |
493 | * @pipe: which irq to enable | | 494 | * @pipe: which irq to enable |
494 | * | | 495 | * |
495 | * Enable vblank interrupts for @crtc. If the device doesn't have | | 496 | * Enable vblank interrupts for @crtc. If the device doesn't have |
496 | * a hardware vblank counter, this routine should be a no-op, since | | 497 | * a hardware vblank counter, this routine should be a no-op, since |
497 | * interrupts will have to stay on to keep the count accurate. | | 498 | * interrupts will have to stay on to keep the count accurate. |
498 | * | | 499 | * |
499 | * RETURNS | | 500 | * RETURNS |
500 | * Zero on success, appropriate errno if the given @crtc's vblank | | 501 | * Zero on success, appropriate errno if the given @crtc's vblank |
501 | * interrupt cannot be enabled. | | 502 | * interrupt cannot be enabled. |
502 | */ | | 503 | */ |
503 | int (*enable_vblank) (struct drm_device *dev, unsigned int pipe); | | 504 | int (*enable_vblank) (struct drm_device *dev, unsigned int pipe); |
504 | | | 505 | |
505 | /** | | 506 | /** |
506 | * disable_vblank - disable vblank interrupt events | | 507 | * disable_vblank - disable vblank interrupt events |
507 | * @dev: DRM device | | 508 | * @dev: DRM device |
508 | * @pipe: which irq to enable | | 509 | * @pipe: which irq to enable |
509 | * | | 510 | * |
510 | * Disable vblank interrupts for @crtc. If the device doesn't have | | 511 | * Disable vblank interrupts for @crtc. If the device doesn't have |
511 | * a hardware vblank counter, this routine should be a no-op, since | | 512 | * a hardware vblank counter, this routine should be a no-op, since |
512 | * interrupts will have to stay on to keep the count accurate. | | 513 | * interrupts will have to stay on to keep the count accurate. |
513 | */ | | 514 | */ |
514 | void (*disable_vblank) (struct drm_device *dev, unsigned int pipe); | | 515 | void (*disable_vblank) (struct drm_device *dev, unsigned int pipe); |
515 | | | 516 | |
516 | /** | | 517 | /** |
517 | * Called by \c drm_device_is_agp. Typically used to determine if a | | 518 | * Called by \c drm_device_is_agp. Typically used to determine if a |
518 | * card is really attached to AGP or not. | | 519 | * card is really attached to AGP or not. |
519 | * | | 520 | * |
520 | * \param dev DRM device handle | | 521 | * \param dev DRM device handle |
521 | * | | 522 | * |
522 | * \returns | | 523 | * \returns |
523 | * One of three values is returned depending on whether or not the | | 524 | * One of three values is returned depending on whether or not the |
524 | * card is absolutely \b not AGP (return of 0), absolutely \b is AGP | | 525 | * card is absolutely \b not AGP (return of 0), absolutely \b is AGP |
525 | * (return of 1), or may or may not be AGP (return of 2). | | 526 | * (return of 1), or may or may not be AGP (return of 2). |
526 | */ | | 527 | */ |
527 | int (*device_is_agp) (struct drm_device *dev); | | 528 | int (*device_is_agp) (struct drm_device *dev); |
528 | | | 529 | |
529 | /** | | 530 | /** |
530 | * Called by vblank timestamping code. | | 531 | * Called by vblank timestamping code. |
531 | * | | 532 | * |
532 | * Return the current display scanout position from a crtc, and an | | 533 | * Return the current display scanout position from a crtc, and an |
533 | * optional accurate ktime_get timestamp of when position was measured. | | 534 | * optional accurate ktime_get timestamp of when position was measured. |
534 | * | | 535 | * |
535 | * \param dev DRM device. | | 536 | * \param dev DRM device. |
536 | * \param pipe Id of the crtc to query. | | 537 | * \param pipe Id of the crtc to query. |
537 | * \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0). | | 538 | * \param flags Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0). |
538 | * \param *vpos Target location for current vertical scanout position. | | 539 | * \param *vpos Target location for current vertical scanout position. |
539 | * \param *hpos Target location for current horizontal scanout position. | | 540 | * \param *hpos Target location for current horizontal scanout position. |
540 | * \param *stime Target location for timestamp taken immediately before | | 541 | * \param *stime Target location for timestamp taken immediately before |
541 | * scanout position query. Can be NULL to skip timestamp. | | 542 | * scanout position query. Can be NULL to skip timestamp. |
542 | * \param *etime Target location for timestamp taken immediately after | | 543 | * \param *etime Target location for timestamp taken immediately after |
543 | * scanout position query. Can be NULL to skip timestamp. | | 544 | * scanout position query. Can be NULL to skip timestamp. |
544 | * \param mode Current display timings. | | 545 | * \param mode Current display timings. |
545 | * | | 546 | * |
546 | * Returns vpos as a positive number while in active scanout area. | | 547 | * Returns vpos as a positive number while in active scanout area. |
547 | * Returns vpos as a negative number inside vblank, counting the number | | 548 | * Returns vpos as a negative number inside vblank, counting the number |
548 | * of scanlines to go until end of vblank, e.g., -1 means "one scanline | | 549 | * of scanlines to go until end of vblank, e.g., -1 means "one scanline |
549 | * until start of active scanout / end of vblank." | | 550 | * until start of active scanout / end of vblank." |
550 | * | | 551 | * |
551 | * \return Flags, or'ed together as follows: | | 552 | * \return Flags, or'ed together as follows: |
552 | * | | 553 | * |
553 | * DRM_SCANOUTPOS_VALID = Query successful. | | 554 | * DRM_SCANOUTPOS_VALID = Query successful. |
554 | * DRM_SCANOUTPOS_INVBL = Inside vblank. | | 555 | * DRM_SCANOUTPOS_INVBL = Inside vblank. |
555 | * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of | | 556 | * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of |
556 | * this flag means that returned position may be offset by a constant | | 557 | * this flag means that returned position may be offset by a constant |
557 | * but unknown small number of scanlines wrt. real scanout position. | | 558 | * but unknown small number of scanlines wrt. real scanout position. |
558 | * | | 559 | * |
559 | */ | | 560 | */ |
560 | int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, | | 561 | int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, |
561 | unsigned int flags, int *vpos, int *hpos, | | 562 | unsigned int flags, int *vpos, int *hpos, |
562 | ktime_t *stime, ktime_t *etime, | | 563 | ktime_t *stime, ktime_t *etime, |
563 | const struct drm_display_mode *mode); | | 564 | const struct drm_display_mode *mode); |
564 | | | 565 | |
565 | /** | | 566 | /** |
566 | * Called by \c drm_get_last_vbltimestamp. Should return a precise | | 567 | * Called by \c drm_get_last_vbltimestamp. Should return a precise |
567 | * timestamp when the most recent VBLANK interval ended or will end. | | 568 | * timestamp when the most recent VBLANK interval ended or will end. |
568 | * | | 569 | * |
569 | * Specifically, the timestamp in @vblank_time should correspond as | | 570 | * Specifically, the timestamp in @vblank_time should correspond as |
570 | * closely as possible to the time when the first video scanline of | | 571 | * closely as possible to the time when the first video scanline of |
571 | * the video frame after the end of VBLANK will start scanning out, | | 572 | * the video frame after the end of VBLANK will start scanning out, |
572 | * the time immediately after end of the VBLANK interval. If the | | 573 | * the time immediately after end of the VBLANK interval. If the |
573 | * @crtc is currently inside VBLANK, this will be a time in the future. | | 574 | * @crtc is currently inside VBLANK, this will be a time in the future. |
574 | * If the @crtc is currently scanning out a frame, this will be the | | 575 | * If the @crtc is currently scanning out a frame, this will be the |
575 | * past start time of the current scanout. This is meant to adhere | | 576 | * past start time of the current scanout. This is meant to adhere |
576 | * to the OpenML OML_sync_control extension specification. | | 577 | * to the OpenML OML_sync_control extension specification. |
577 | * | | 578 | * |
578 | * \param dev dev DRM device handle. | | 579 | * \param dev dev DRM device handle. |
579 | * \param pipe crtc for which timestamp should be returned. | | 580 | * \param pipe crtc for which timestamp should be returned. |
580 | * \param *max_error Maximum allowable timestamp error in nanoseconds. | | 581 | * \param *max_error Maximum allowable timestamp error in nanoseconds. |
581 | * Implementation should strive to provide timestamp | | 582 | * Implementation should strive to provide timestamp |
582 | * with an error of at most *max_error nanoseconds. | | 583 | * with an error of at most *max_error nanoseconds. |
583 | * Returns true upper bound on error for timestamp. | | 584 | * Returns true upper bound on error for timestamp. |
584 | * \param *vblank_time Target location for returned vblank timestamp. | | 585 | * \param *vblank_time Target location for returned vblank timestamp. |
585 | * \param flags 0 = Defaults, no special treatment needed. | | 586 | * \param flags 0 = Defaults, no special treatment needed. |
586 | * \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank | | 587 | * \param DRM_CALLED_FROM_VBLIRQ = Function is called from vblank |
587 | * irq handler. Some drivers need to apply some workarounds | | 588 | * irq handler. Some drivers need to apply some workarounds |
588 | * for gpu-specific vblank irq quirks if flag is set. | | 589 | * for gpu-specific vblank irq quirks if flag is set. |
589 | * | | 590 | * |
590 | * \returns | | 591 | * \returns |
591 | * Zero if timestamping isn't supported in current display mode or a | | 592 | * Zero if timestamping isn't supported in current display mode or a |
592 | * negative number on failure. A positive status code on success, | | 593 | * negative number on failure. A positive status code on success, |
593 | * which describes how the vblank_time timestamp was computed. | | 594 | * which describes how the vblank_time timestamp was computed. |
594 | */ | | 595 | */ |
595 | int (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, | | 596 | int (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, |
596 | int *max_error, | | 597 | int *max_error, |
597 | struct timeval *vblank_time, | | 598 | struct timeval *vblank_time, |
598 | unsigned flags); | | 599 | unsigned flags); |
599 | | | 600 | |
600 | /* these have to be filled in */ | | 601 | /* these have to be filled in */ |
601 | | | 602 | |
602 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); | | 603 | irqreturn_t(*irq_handler) (DRM_IRQ_ARGS); |
603 | void (*irq_preinstall) (struct drm_device *dev); | | 604 | void (*irq_preinstall) (struct drm_device *dev); |
604 | int (*irq_postinstall) (struct drm_device *dev); | | 605 | int (*irq_postinstall) (struct drm_device *dev); |
605 | void (*irq_uninstall) (struct drm_device *dev); | | 606 | void (*irq_uninstall) (struct drm_device *dev); |
606 | | | 607 | |
607 | /* Master routines */ | | 608 | /* Master routines */ |
608 | int (*master_create)(struct drm_device *dev, struct drm_master *master); | | 609 | int (*master_create)(struct drm_device *dev, struct drm_master *master); |
609 | void (*master_destroy)(struct drm_device *dev, struct drm_master *master); | | 610 | void (*master_destroy)(struct drm_device *dev, struct drm_master *master); |
610 | /** | | 611 | /** |
611 | * master_set is called whenever the minor master is set. | | 612 | * master_set is called whenever the minor master is set. |
612 | * master_drop is called whenever the minor master is dropped. | | 613 | * master_drop is called whenever the minor master is dropped. |
613 | */ | | 614 | */ |
614 | | | 615 | |
615 | int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, | | 616 | int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, |
616 | bool from_open); | | 617 | bool from_open); |
617 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, | | 618 | void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv, |
618 | bool from_release); | | 619 | bool from_release); |
619 | | | 620 | |
620 | int (*debugfs_init)(struct drm_minor *minor); | | 621 | int (*debugfs_init)(struct drm_minor *minor); |
621 | void (*debugfs_cleanup)(struct drm_minor *minor); | | 622 | void (*debugfs_cleanup)(struct drm_minor *minor); |
622 | | | 623 | |
623 | /** | | 624 | /** |
624 | * Driver-specific constructor for drm_gem_objects, to set up | | 625 | * Driver-specific constructor for drm_gem_objects, to set up |
625 | * obj->driver_private. | | 626 | * obj->driver_private. |
626 | * | | 627 | * |
627 | * Returns 0 on success. | | 628 | * Returns 0 on success. |
628 | */ | | 629 | */ |
629 | void (*gem_free_object) (struct drm_gem_object *obj); | | 630 | void (*gem_free_object) (struct drm_gem_object *obj); |
630 | int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); | | 631 | int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); |
631 | void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); | | 632 | void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); |
632 | | | 633 | |
633 | /* prime: */ | | 634 | /* prime: */ |
634 | /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */ | | 635 | /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */ |
635 | int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv, | | 636 | int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv, |
636 | uint32_t handle, uint32_t flags, int *prime_fd); | | 637 | uint32_t handle, uint32_t flags, int *prime_fd); |
637 | /* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */ | | 638 | /* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */ |
638 | int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv, | | 639 | int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv, |
639 | int prime_fd, uint32_t *handle); | | 640 | int prime_fd, uint32_t *handle); |
640 | /* export GEM -> dmabuf */ | | 641 | /* export GEM -> dmabuf */ |
641 | struct dma_buf * (*gem_prime_export)(struct drm_device *dev, | | 642 | struct dma_buf * (*gem_prime_export)(struct drm_device *dev, |
642 | struct drm_gem_object *obj, int flags); | | 643 | struct drm_gem_object *obj, int flags); |
643 | /* import dmabuf -> GEM */ | | 644 | /* import dmabuf -> GEM */ |
644 | struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, | | 645 | struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, |
645 | struct dma_buf *dma_buf); | | 646 | struct dma_buf *dma_buf); |
646 | /* low-level interface used by drm_gem_prime_{import,export} */ | | 647 | /* low-level interface used by drm_gem_prime_{import,export} */ |
647 | int (*gem_prime_pin)(struct drm_gem_object *obj); | | 648 | int (*gem_prime_pin)(struct drm_gem_object *obj); |
648 | void (*gem_prime_unpin)(struct drm_gem_object *obj); | | 649 | void (*gem_prime_unpin)(struct drm_gem_object *obj); |
649 | struct reservation_object * (*gem_prime_res_obj)( | | 650 | struct reservation_object * (*gem_prime_res_obj)( |
650 | struct drm_gem_object *obj); | | 651 | struct drm_gem_object *obj); |
651 | struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); | | 652 | struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); |
652 | struct drm_gem_object *(*gem_prime_import_sg_table)( | | 653 | struct drm_gem_object *(*gem_prime_import_sg_table)( |
653 | struct drm_device *dev, | | 654 | struct drm_device *dev, |
654 | struct dma_buf_attachment *attach, | | 655 | struct dma_buf_attachment *attach, |
655 | struct sg_table *sgt); | | 656 | struct sg_table *sgt); |
656 | void *(*gem_prime_vmap)(struct drm_gem_object *obj); | | 657 | void *(*gem_prime_vmap)(struct drm_gem_object *obj); |
657 | void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr); | | 658 | void (*gem_prime_vunmap)(struct drm_gem_object *obj, void *vaddr); |
658 | int (*gem_prime_mmap)(struct drm_gem_object *obj, | | 659 | int (*gem_prime_mmap)(struct drm_gem_object *obj, |
659 | struct vm_area_struct *vma); | | 660 | struct vm_area_struct *vma); |
660 | | | 661 | |
661 | /* vga arb irq handler */ | | 662 | /* vga arb irq handler */ |
662 | void (*vgaarb_irq)(struct drm_device *dev, bool state); | | 663 | void (*vgaarb_irq)(struct drm_device *dev, bool state); |
663 | | | 664 | |
664 | /* dumb alloc support */ | | 665 | /* dumb alloc support */ |
665 | int (*dumb_create)(struct drm_file *file_priv, | | 666 | int (*dumb_create)(struct drm_file *file_priv, |
666 | struct drm_device *dev, | | 667 | struct drm_device *dev, |
667 | struct drm_mode_create_dumb *args); | | 668 | struct drm_mode_create_dumb *args); |
668 | int (*dumb_map_offset)(struct drm_file *file_priv, | | 669 | int (*dumb_map_offset)(struct drm_file *file_priv, |
669 | struct drm_device *dev, uint32_t handle, | | 670 | struct drm_device *dev, uint32_t handle, |
670 | uint64_t *offset); | | 671 | uint64_t *offset); |
671 | int (*dumb_destroy)(struct drm_file *file_priv, | | 672 | int (*dumb_destroy)(struct drm_file *file_priv, |
672 | struct drm_device *dev, | | 673 | struct drm_device *dev, |
673 | uint32_t handle); | | 674 | uint32_t handle); |
674 | | | 675 | |
675 | /* Driver private ops for this object */ | | 676 | /* Driver private ops for this object */ |
676 | #ifdef __NetBSD__ | | 677 | #ifdef __NetBSD__ |
677 | int (*mmap_object)(struct drm_device *, off_t, size_t, int, | | 678 | int (*mmap_object)(struct drm_device *, off_t, size_t, int, |
678 | struct uvm_object **, voff_t *, struct file *); | | 679 | struct uvm_object **, voff_t *, struct file *); |
679 | const struct uvm_pagerops *gem_uvm_ops; | | 680 | const struct uvm_pagerops *gem_uvm_ops; |
680 | #else | | 681 | #else |
681 | const struct vm_operations_struct *gem_vm_ops; | | 682 | const struct vm_operations_struct *gem_vm_ops; |
682 | #endif | | 683 | #endif |
683 | | | 684 | |
684 | int major; | | 685 | int major; |
685 | int minor; | | 686 | int minor; |
686 | int patchlevel; | | 687 | int patchlevel; |
687 | const char *name; | | 688 | const char *name; |
688 | const char *desc; | | 689 | const char *desc; |
689 | const char *date; | | 690 | const char *date; |
690 | | | 691 | |
691 | u32 driver_features; | | 692 | u32 driver_features; |
692 | int dev_priv_size; | | 693 | int dev_priv_size; |
693 | const struct drm_ioctl_desc *ioctls; | | 694 | const struct drm_ioctl_desc *ioctls; |
694 | int num_ioctls; | | 695 | int num_ioctls; |
695 | const struct file_operations *fops; | | 696 | const struct file_operations *fops; |
696 | | | 697 | |
697 | /* List of devices hanging off this driver with stealth attach. */ | | 698 | /* List of devices hanging off this driver with stealth attach. */ |
698 | struct list_head legacy_dev_list; | | 699 | struct list_head legacy_dev_list; |
699 | }; | | 700 | }; |
700 | | | 701 | |
701 | enum drm_minor_type { | | 702 | enum drm_minor_type { |
702 | DRM_MINOR_LEGACY, | | 703 | DRM_MINOR_LEGACY, |
703 | DRM_MINOR_CONTROL, | | 704 | DRM_MINOR_CONTROL, |
704 | DRM_MINOR_RENDER, | | 705 | DRM_MINOR_RENDER, |
705 | DRM_MINOR_CNT, | | 706 | DRM_MINOR_CNT, |
706 | }; | | 707 | }; |
707 | | | 708 | |
708 | #ifdef __NetBSD__ /* XXX debugfs */ | | 709 | #ifdef __NetBSD__ /* XXX debugfs */ |
709 | struct seq_file; | | 710 | struct seq_file; |
710 | #endif | | 711 | #endif |
711 | | | 712 | |
712 | /** | | 713 | /** |
713 | * Info file list entry. This structure represents a debugfs or proc file to | | 714 | * Info file list entry. This structure represents a debugfs or proc file to |
714 | * be created by the drm core | | 715 | * be created by the drm core |
715 | */ | | 716 | */ |
716 | struct drm_info_list { | | 717 | struct drm_info_list { |
717 | const char *name; /** file name */ | | 718 | const char *name; /** file name */ |
718 | int (*show)(struct seq_file*, void*); /** show callback */ | | 719 | int (*show)(struct seq_file*, void*); /** show callback */ |
719 | u32 driver_features; /**< Required driver features for this entry */ | | 720 | u32 driver_features; /**< Required driver features for this entry */ |
720 | void *data; | | 721 | void *data; |
721 | }; | | 722 | }; |
722 | | | 723 | |
723 | /** | | 724 | /** |
724 | * debugfs node structure. This structure represents a debugfs file. | | 725 | * debugfs node structure. This structure represents a debugfs file. |
725 | */ | | 726 | */ |
726 | struct drm_info_node { | | 727 | struct drm_info_node { |
727 | struct list_head list; | | 728 | struct list_head list; |
728 | struct drm_minor *minor; | | 729 | struct drm_minor *minor; |
729 | const struct drm_info_list *info_ent; | | 730 | const struct drm_info_list *info_ent; |
730 | struct dentry *dent; | | 731 | struct dentry *dent; |
731 | }; | | 732 | }; |
732 | | | 733 | |
733 | /** | | 734 | /** |
734 | * DRM minor structure. This structure represents a drm minor number. | | 735 | * DRM minor structure. This structure represents a drm minor number. |
735 | */ | | 736 | */ |
736 | struct drm_minor { | | 737 | struct drm_minor { |
737 | int index; /**< Minor device number */ | | 738 | int index; /**< Minor device number */ |
738 | int type; /**< Control or render */ | | 739 | int type; /**< Control or render */ |
739 | struct device *kdev; /**< Linux device */ | | 740 | struct device *kdev; /**< Linux device */ |
740 | struct drm_device *dev; | | 741 | struct drm_device *dev; |
741 | | | 742 | |
742 | #ifndef __NetBSD__ /* XXX debugfs */ | | 743 | #ifndef __NetBSD__ /* XXX debugfs */ |
743 | struct dentry *debugfs_root; | | 744 | struct dentry *debugfs_root; |
744 | | | 745 | |
745 | struct list_head debugfs_list; | | 746 | struct list_head debugfs_list; |
746 | struct mutex debugfs_lock; /* Protects debugfs_list. */ | | 747 | struct mutex debugfs_lock; /* Protects debugfs_list. */ |
747 | #endif | | 748 | #endif |
748 | | | 749 | |
749 | /* currently active master for this node. Protected by master_mutex */ | | 750 | /* currently active master for this node. Protected by master_mutex */ |
750 | struct drm_master *master; | | 751 | struct drm_master *master; |
751 | }; | | 752 | }; |
752 | | | 753 | |
753 | | | 754 | |
754 | struct drm_pending_vblank_event { | | 755 | struct drm_pending_vblank_event { |
755 | struct drm_pending_event base; | | 756 | struct drm_pending_event base; |
756 | unsigned int pipe; | | 757 | unsigned int pipe; |
757 | struct drm_event_vblank event; | | 758 | struct drm_event_vblank event; |
758 | }; | | 759 | }; |
759 | | | 760 | |
760 | struct drm_vblank_crtc { | | 761 | struct drm_vblank_crtc { |
761 | struct drm_device *dev; /* pointer to the drm_device */ | | 762 | struct drm_device *dev; /* pointer to the drm_device */ |
762 | #ifdef __NetBSD__ | | 763 | #ifdef __NetBSD__ |
763 | drm_waitqueue_t queue; | | 764 | drm_waitqueue_t queue; |
764 | #else | | 765 | #else |
765 | wait_queue_head_t queue; /**< VBLANK wait queue */ | | 766 | wait_queue_head_t queue; /**< VBLANK wait queue */ |
766 | #endif | | 767 | #endif |
767 | struct timer_list disable_timer; /* delayed disable timer */ | | 768 | struct timer_list disable_timer; /* delayed disable timer */ |
768 | | | 769 | |
769 | /* vblank counter, protected by dev->vblank_time_lock for writes */ | | 770 | /* vblank counter, protected by dev->vblank_time_lock for writes */ |
770 | u32 count; | | 771 | u32 count; |
771 | /* vblank timestamps, protected by dev->vblank_time_lock for writes */ | | 772 | /* vblank timestamps, protected by dev->vblank_time_lock for writes */ |
772 | struct timeval time[DRM_VBLANKTIME_RBSIZE]; | | 773 | struct timeval time[DRM_VBLANKTIME_RBSIZE]; |
773 | | | 774 | |
774 | atomic_t refcount; /* number of users of vblank interruptsper crtc */ | | 775 | atomic_t refcount; /* number of users of vblank interruptsper crtc */ |
775 | u32 last; /* protected by dev->vbl_lock, used */ | | 776 | u32 last; /* protected by dev->vbl_lock, used */ |
776 | /* for wraparound handling */ | | 777 | /* for wraparound handling */ |
777 | u32 last_wait; /* Last vblank seqno waited per CRTC */ | | 778 | u32 last_wait; /* Last vblank seqno waited per CRTC */ |
778 | unsigned int inmodeset; /* Display driver is setting mode */ | | 779 | unsigned int inmodeset; /* Display driver is setting mode */ |
779 | unsigned int pipe; /* crtc index */ | | 780 | unsigned int pipe; /* crtc index */ |
780 | int framedur_ns; /* frame/field duration in ns */ | | 781 | int framedur_ns; /* frame/field duration in ns */ |
781 | int linedur_ns; /* line duration in ns */ | | 782 | int linedur_ns; /* line duration in ns */ |
782 | bool enabled; /* so we don't call enable more than | | 783 | bool enabled; /* so we don't call enable more than |
783 | once per disable */ | | 784 | once per disable */ |
784 | }; | | 785 | }; |
785 | | | 786 | |
786 | /** | | 787 | /** |
787 | * DRM device structure. This structure represent a complete card that | | 788 | * DRM device structure. This structure represent a complete card that |
788 | * may contain multiple heads. | | 789 | * may contain multiple heads. |
789 | */ | | 790 | */ |
790 | struct drm_device { | | 791 | struct drm_device { |
791 | struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ | | 792 | struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ |
792 | int if_version; /**< Highest interface version set */ | | 793 | int if_version; /**< Highest interface version set */ |
793 | | | 794 | |
794 | /** \name Lifetime Management */ | | 795 | /** \name Lifetime Management */ |
795 | /*@{ */ | | 796 | /*@{ */ |
796 | struct kref ref; /**< Object ref-count */ | | 797 | struct kref ref; /**< Object ref-count */ |
797 | struct device *dev; /**< Device structure of bus-device */ | | 798 | struct device *dev; /**< Device structure of bus-device */ |
798 | struct drm_driver *driver; /**< DRM driver managing the device */ | | 799 | struct drm_driver *driver; /**< DRM driver managing the device */ |
799 | void *dev_private; /**< DRM driver private data */ | | 800 | void *dev_private; /**< DRM driver private data */ |
800 | struct drm_minor *control; /**< Control node */ | | 801 | struct drm_minor *control; /**< Control node */ |
801 | struct drm_minor *primary; /**< Primary node */ | | 802 | struct drm_minor *primary; /**< Primary node */ |
802 | struct drm_minor *render; /**< Render node */ | | 803 | struct drm_minor *render; /**< Render node */ |
803 | atomic_t unplugged; /**< Flag whether dev is dead */ | | 804 | atomic_t unplugged; /**< Flag whether dev is dead */ |
804 | struct inode *anon_inode; /**< inode for private address-space */ | | 805 | struct inode *anon_inode; /**< inode for private address-space */ |
805 | char *unique; /**< unique name of the device */ | | 806 | char *unique; /**< unique name of the device */ |
806 | /*@} */ | | 807 | /*@} */ |
807 | | | 808 | |
808 | /** \name Locks */ | | 809 | /** \name Locks */ |
809 | /*@{ */ | | 810 | /*@{ */ |
810 | struct mutex struct_mutex; /**< For others */ | | 811 | struct mutex struct_mutex; /**< For others */ |
811 | struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */ | | 812 | struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */ |
812 | /*@} */ | | 813 | /*@} */ |
813 | | | 814 | |
814 | /** \name Usage Counters */ | | 815 | /** \name Usage Counters */ |
815 | /*@{ */ | | 816 | /*@{ */ |
816 | int open_count; /**< Outstanding files open, protected by drm_global_mutex. */ | | 817 | int open_count; /**< Outstanding files open, protected by drm_global_mutex. */ |
817 | spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */ | | 818 | spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */ |
818 | int buf_use; /**< Buffers in use -- cannot alloc */ | | 819 | int buf_use; /**< Buffers in use -- cannot alloc */ |
819 | atomic_t buf_alloc; /**< Buffer allocation in progress */ | | 820 | atomic_t buf_alloc; /**< Buffer allocation in progress */ |
820 | /*@} */ | | 821 | /*@} */ |
821 | | | 822 | |
822 | struct list_head filelist; | | 823 | struct list_head filelist; |
823 | | | 824 | |
824 | /** \name Memory management */ | | 825 | /** \name Memory management */ |
825 | /*@{ */ | | 826 | /*@{ */ |
826 | struct list_head maplist; /**< Linked list of regions */ | | 827 | struct list_head maplist; /**< Linked list of regions */ |
827 | struct drm_open_hash map_hash; /**< User token hash table for maps */ | | 828 | struct drm_open_hash map_hash; /**< User token hash table for maps */ |
828 | | | 829 | |
829 | /** \name Context handle management */ | | 830 | /** \name Context handle management */ |
830 | /*@{ */ | | 831 | /*@{ */ |
831 | struct list_head ctxlist; /**< Linked list of context handles */ | | 832 | struct list_head ctxlist; /**< Linked list of context handles */ |
832 | struct mutex ctxlist_mutex; /**< For ctxlist */ | | 833 | struct mutex ctxlist_mutex; /**< For ctxlist */ |
833 | | | 834 | |
834 | struct idr ctx_idr; | | 835 | struct idr ctx_idr; |
835 | | | 836 | |
836 | struct list_head vmalist; /**< List of vmas (for debugging) */ | | 837 | struct list_head vmalist; /**< List of vmas (for debugging) */ |
837 | | | 838 | |
838 | /*@} */ | | 839 | /*@} */ |
839 | | | 840 | |
840 | /** \name DMA support */ | | 841 | /** \name DMA support */ |
841 | /*@{ */ | | 842 | /*@{ */ |
842 | struct drm_device_dma *dma; /**< Optional pointer for DMA support */ | | 843 | struct drm_device_dma *dma; /**< Optional pointer for DMA support */ |
843 | /*@} */ | | 844 | /*@} */ |
844 | | | 845 | |
845 | /** \name Context support */ | | 846 | /** \name Context support */ |
846 | /*@{ */ | | 847 | /*@{ */ |
847 | | | 848 | |
848 | __volatile__ long context_flag; /**< Context swapping flag */ | | 849 | __volatile__ long context_flag; /**< Context swapping flag */ |
849 | int last_context; /**< Last current context */ | | 850 | int last_context; /**< Last current context */ |
850 | /*@} */ | | 851 | /*@} */ |
851 | | | 852 | |
852 | /** \name VBLANK IRQ support */ | | 853 | /** \name VBLANK IRQ support */ |
853 | /*@{ */ | | 854 | /*@{ */ |
854 | bool irq_enabled; | | 855 | bool irq_enabled; |
855 | int irq; | | 856 | int irq; |
856 | #ifdef __NetBSD__ | | 857 | #ifdef __NetBSD__ |
857 | struct drm_bus_irq_cookie *irq_cookie; | | 858 | struct drm_bus_irq_cookie *irq_cookie; |
858 | #endif | | 859 | #endif |
859 | | | 860 | |
860 | /* | | 861 | /* |
861 | * At load time, disabling the vblank interrupt won't be allowed since | | 862 | * At load time, disabling the vblank interrupt won't be allowed since |
862 | * old clients may not call the modeset ioctl and therefore misbehave. | | 863 | * old clients may not call the modeset ioctl and therefore misbehave. |
863 | * Once the modeset ioctl *has* been called though, we can safely | | 864 | * Once the modeset ioctl *has* been called though, we can safely |
864 | * disable them when unused. | | 865 | * disable them when unused. |
865 | */ | | 866 | */ |
866 | bool vblank_disable_allowed; | | 867 | bool vblank_disable_allowed; |
867 | | | 868 | |
868 | /* | | 869 | /* |
869 | * If true, vblank interrupt will be disabled immediately when the | | 870 | * If true, vblank interrupt will be disabled immediately when the |
870 | * refcount drops to zero, as opposed to via the vblank disable | | 871 | * refcount drops to zero, as opposed to via the vblank disable |
871 | * timer. | | 872 | * timer. |
872 | * This can be set to true it the hardware has a working vblank | | 873 | * This can be set to true it the hardware has a working vblank |
873 | * counter and the driver uses drm_vblank_on() and drm_vblank_off() | | 874 | * counter and the driver uses drm_vblank_on() and drm_vblank_off() |
874 | * appropriately. | | 875 | * appropriately. |
875 | */ | | 876 | */ |
876 | bool vblank_disable_immediate; | | 877 | bool vblank_disable_immediate; |
877 | | | 878 | |
878 | /* array of size num_crtcs */ | | 879 | /* array of size num_crtcs */ |
879 | struct drm_vblank_crtc *vblank; | | 880 | struct drm_vblank_crtc *vblank; |
880 | | | 881 | |
881 | spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ | | 882 | spinlock_t vblank_time_lock; /**< Protects vblank count and time updates during vblank enable/disable */ |
882 | spinlock_t vbl_lock; | | 883 | spinlock_t vbl_lock; |
883 | | | 884 | |
884 | u32 max_vblank_count; /**< size of vblank counter register */ | | 885 | u32 max_vblank_count; /**< size of vblank counter register */ |
885 | | | 886 | |
886 | /** | | 887 | /** |
887 | * List of events | | 888 | * List of events |
888 | */ | | 889 | */ |
889 | struct list_head vblank_event_list; | | 890 | struct list_head vblank_event_list; |
890 | spinlock_t event_lock; | | 891 | spinlock_t event_lock; |
891 | | | 892 | |
892 | /*@} */ | | 893 | /*@} */ |
893 | | | 894 | |
894 | struct drm_agp_head *agp; /**< AGP data */ | | 895 | struct drm_agp_head *agp; /**< AGP data */ |
895 | | | 896 | |
896 | struct pci_dev *pdev; /**< PCI device structure */ | | 897 | struct pci_dev *pdev; /**< PCI device structure */ |
897 | #ifdef __alpha__ | | 898 | #ifdef __alpha__ |
898 | struct pci_controller *hose; | | 899 | struct pci_controller *hose; |
899 | #endif | | 900 | #endif |
900 | | | 901 | |
901 | struct platform_device *platformdev; /**< Platform device struture */ | | 902 | struct platform_device *platformdev; /**< Platform device struture */ |
902 | struct virtio_device *virtdev; | | 903 | struct virtio_device *virtdev; |
903 | | | 904 | |
904 | #ifdef __NetBSD__ | | 905 | #ifdef __NetBSD__ |
905 | bus_space_tag_t bst; | | 906 | bus_space_tag_t bst; |
906 | struct drm_bus_map *bus_maps; | | 907 | struct drm_bus_map *bus_maps; |
907 | unsigned bus_nmaps; | | 908 | unsigned bus_nmaps; |
908 | bus_dma_tag_t bus_dmat; | | 909 | bus_dma_tag_t bus_dmat; |
909 | bus_dma_tag_t dmat; | | 910 | bus_dma_tag_t dmat; |
910 | bool dmat_subregion_p; | | 911 | bool dmat_subregion_p; |
911 | bus_addr_t dmat_subregion_min; | | 912 | bus_addr_t dmat_subregion_min; |
912 | bus_addr_t dmat_subregion_max; | | 913 | bus_addr_t dmat_subregion_max; |
913 | #endif | | 914 | #endif |
914 | | | 915 | |
915 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | | 916 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
916 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ | | 917 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
917 | | | 918 | |
918 | struct { | | 919 | struct { |
919 | int context; | | 920 | int context; |
920 | struct drm_hw_lock *lock; | | 921 | struct drm_hw_lock *lock; |
921 | } sigdata; | | 922 | } sigdata; |
922 | | | 923 | |
923 | struct drm_local_map *agp_buffer_map; | | 924 | struct drm_local_map *agp_buffer_map; |
924 | unsigned int agp_buffer_token; | | 925 | unsigned int agp_buffer_token; |
925 | | | 926 | |
926 | struct drm_mode_config mode_config; /**< Current mode config */ | | 927 | struct drm_mode_config mode_config; /**< Current mode config */ |
927 | | | 928 | |
928 | /** \name GEM information */ | | 929 | /** \name GEM information */ |
929 | /*@{ */ | | 930 | /*@{ */ |
930 | struct mutex object_name_lock; | | 931 | struct mutex object_name_lock; |
931 | struct idr object_name_idr; | | 932 | struct idr object_name_idr; |
932 | struct drm_vma_offset_manager *vma_offset_manager; | | 933 | struct drm_vma_offset_manager *vma_offset_manager; |
933 | /*@} */ | | 934 | /*@} */ |
934 | int switch_power_state; | | 935 | int switch_power_state; |
935 | }; | | 936 | }; |
936 | | | 937 | |
937 | #define DRM_SWITCH_POWER_ON 0 | | 938 | #define DRM_SWITCH_POWER_ON 0 |
938 | #define DRM_SWITCH_POWER_OFF 1 | | 939 | #define DRM_SWITCH_POWER_OFF 1 |
939 | #define DRM_SWITCH_POWER_CHANGING 2 | | 940 | #define DRM_SWITCH_POWER_CHANGING 2 |
940 | #define DRM_SWITCH_POWER_DYNAMIC_OFF 3 | | 941 | #define DRM_SWITCH_POWER_DYNAMIC_OFF 3 |
941 | | | 942 | |
942 | static __inline__ int drm_core_check_feature(struct drm_device *dev, | | 943 | static __inline__ int drm_core_check_feature(struct drm_device *dev, |
943 | int feature) | | 944 | int feature) |
944 | { | | 945 | { |
945 | return ((dev->driver->driver_features & feature) ? 1 : 0); | | 946 | return ((dev->driver->driver_features & feature) ? 1 : 0); |
946 | } | | 947 | } |
947 | | | 948 | |
948 | static inline void drm_device_set_unplugged(struct drm_device *dev) | | 949 | static inline void drm_device_set_unplugged(struct drm_device *dev) |
949 | { | | 950 | { |
950 | smp_wmb(); | | 951 | smp_wmb(); |
951 | atomic_set(&dev->unplugged, 1); | | 952 | atomic_set(&dev->unplugged, 1); |
952 | } | | 953 | } |
953 | | | 954 | |
954 | static inline int drm_device_is_unplugged(struct drm_device *dev) | | 955 | static inline int drm_device_is_unplugged(struct drm_device *dev) |
955 | { | | 956 | { |
956 | int ret = atomic_read(&dev->unplugged); | | 957 | int ret = atomic_read(&dev->unplugged); |
957 | smp_rmb(); | | 958 | smp_rmb(); |
958 | return ret; | | 959 | return ret; |
959 | } | | 960 | } |
960 | | | 961 | |
961 | static inline bool drm_is_render_client(const struct drm_file *file_priv) | | 962 | static inline bool drm_is_render_client(const struct drm_file *file_priv) |
962 | { | | 963 | { |
963 | return file_priv->minor->type == DRM_MINOR_RENDER; | | 964 | return file_priv->minor->type == DRM_MINOR_RENDER; |
964 | } | | 965 | } |
965 | | | 966 | |
966 | static inline bool drm_is_control_client(const struct drm_file *file_priv) | | 967 | static inline bool drm_is_control_client(const struct drm_file *file_priv) |
967 | { | | 968 | { |
968 | return file_priv->minor->type == DRM_MINOR_CONTROL; | | 969 | return file_priv->minor->type == DRM_MINOR_CONTROL; |
969 | } | | 970 | } |
970 | | | 971 | |
971 | static inline bool drm_is_primary_client(const struct drm_file *file_priv) | | 972 | static inline bool drm_is_primary_client(const struct drm_file *file_priv) |
972 | { | | 973 | { |
973 | return file_priv->minor->type == DRM_MINOR_LEGACY; | | 974 | return file_priv->minor->type == DRM_MINOR_LEGACY; |
974 | } | | 975 | } |
975 | | | 976 | |
976 | /******************************************************************/ | | 977 | /******************************************************************/ |
977 | /** \name Internal function definitions */ | | 978 | /** \name Internal function definitions */ |
978 | /*@{*/ | | 979 | /*@{*/ |
979 | | | 980 | |
980 | /* Driver support (drm_drv.h) */ | | 981 | /* Driver support (drm_drv.h) */ |
981 | #ifndef __NetBSD__ | | 982 | #ifndef __NetBSD__ |
982 | extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv); | | 983 | extern int drm_ioctl_permit(u32 flags, struct drm_file *file_priv); |
983 | extern long drm_ioctl(struct file *filp, | | 984 | extern long drm_ioctl(struct file *filp, |
984 | unsigned int cmd, unsigned long arg); | | 985 | unsigned int cmd, unsigned long arg); |
985 | extern long drm_compat_ioctl(struct file *filp, | | 986 | extern long drm_compat_ioctl(struct file *filp, |
986 | unsigned int cmd, unsigned long arg); | | 987 | unsigned int cmd, unsigned long arg); |
987 | extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); | | 988 | extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); |
988 | #endif | | 989 | #endif |
989 | | | 990 | |
990 | /* Device support (drm_fops.h) */ | | 991 | /* Device support (drm_fops.h) */ |
991 | #ifdef __NetBSD__ | | 992 | #ifdef __NetBSD__ |
992 | extern int drm_open_file(struct drm_file *, void *, struct drm_minor *); | | 993 | extern int drm_open_file(struct drm_file *, void *, struct drm_minor *); |
993 | extern void drm_close_file(struct drm_file *); | | 994 | extern void drm_close_file(struct drm_file *); |
994 | #else | | 995 | #else |
995 | extern int drm_open(struct inode *inode, struct file *filp); | | 996 | extern int drm_open(struct inode *inode, struct file *filp); |
996 | extern ssize_t drm_read(struct file *filp, char __user *buffer, | | 997 | extern ssize_t drm_read(struct file *filp, char __user *buffer, |
997 | size_t count, loff_t *offset); | | 998 | size_t count, loff_t *offset); |
998 | extern int drm_release(struct inode *inode, struct file *filp); | | 999 | extern int drm_release(struct inode *inode, struct file *filp); |
999 | #endif | | 1000 | #endif |
1000 | extern int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv); | | 1001 | extern int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv); |
1001 | | | 1002 | |
1002 | /* Mapping support (drm_vm.h) */ | | 1003 | /* Mapping support (drm_vm.h) */ |
1003 | #ifndef __NetBSD__ | | 1004 | #ifndef __NetBSD__ |
1004 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); | | 1005 | extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); |
1005 | #endif | | 1006 | #endif |
1006 | | | 1007 | |
1007 | /* Misc. IOCTL support (drm_ioctl.c) */ | | 1008 | /* Misc. IOCTL support (drm_ioctl.c) */ |
1008 | int drm_noop(struct drm_device *dev, void *data, | | 1009 | int drm_noop(struct drm_device *dev, void *data, |
1009 | struct drm_file *file_priv); | | 1010 | struct drm_file *file_priv); |
1010 | int drm_invalid_op(struct drm_device *dev, void *data, | | 1011 | int drm_invalid_op(struct drm_device *dev, void *data, |
1011 | struct drm_file *file_priv); | | 1012 | struct drm_file *file_priv); |
1012 | | | 1013 | |
1013 | /* Cache management (drm_cache.c) */ | | 1014 | /* Cache management (drm_cache.c) */ |
1014 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); | | 1015 | void drm_clflush_pages(struct page *pages[], unsigned long num_pages); |
1015 | #ifdef __NetBSD__ /* XXX drm clflush */ | | 1016 | #ifdef __NetBSD__ /* XXX drm clflush */ |
1016 | void drm_clflush_pglist(struct pglist *); | | 1017 | void drm_clflush_pglist(struct pglist *); |
1017 | void drm_clflush_page(struct page *); | | 1018 | void drm_clflush_page(struct page *); |
1018 | void drm_clflush_virt_range(const void *, size_t); | | 1019 | void drm_clflush_virt_range(const void *, size_t); |
1019 | #else | | 1020 | #else |
1020 | void drm_clflush_sg(struct sg_table *st); | | 1021 | void drm_clflush_sg(struct sg_table *st); |
1021 | void drm_clflush_virt_range(void *addr, unsigned long length); | | 1022 | void drm_clflush_virt_range(void *addr, unsigned long length); |
1022 | #endif | | 1023 | #endif |
1023 | | | 1024 | |
1024 | /* | | 1025 | /* |
1025 | * These are exported to drivers so that they can implement fencing using | | 1026 | * These are exported to drivers so that they can implement fencing using |
1026 | * DMA quiscent + idle. DMA quiescent usually requires the hardware lock. | | 1027 | * DMA quiscent + idle. DMA quiescent usually requires the hardware lock. |
1027 | */ | | 1028 | */ |
1028 | | | 1029 | |
1029 | /* IRQ support (drm_irq.h) */ | | 1030 | /* IRQ support (drm_irq.h) */ |
1030 | extern int drm_irq_install(struct drm_device *dev, int irq); | | 1031 | extern int drm_irq_install(struct drm_device *dev, int irq); |
1031 | extern int drm_irq_uninstall(struct drm_device *dev); | | 1032 | extern int drm_irq_uninstall(struct drm_device *dev); |
1032 | | | 1033 | |
1033 | extern int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs); | | 1034 | extern int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs); |
1034 | extern int drm_wait_vblank(struct drm_device *dev, void *data, | | 1035 | extern int drm_wait_vblank(struct drm_device *dev, void *data, |
1035 | struct drm_file *filp); | | 1036 | struct drm_file *filp); |
1036 | extern u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe); | | 1037 | extern u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe); |
1037 | extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc); | | 1038 | extern u32 drm_crtc_vblank_count(struct drm_crtc *crtc); |
1038 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, | | 1039 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, |
1039 | struct timeval *vblanktime); | | 1040 | struct timeval *vblanktime); |
1040 | extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc, | | 1041 | extern u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc, |
1041 | struct timeval *vblanktime); | | 1042 | struct timeval *vblanktime); |
1042 | extern void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe, | | 1043 | extern void drm_send_vblank_event(struct drm_device *dev, unsigned int pipe, |
1043 | struct drm_pending_vblank_event *e); | | 1044 | struct drm_pending_vblank_event *e); |
1044 | extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc, | | 1045 | extern void drm_crtc_send_vblank_event(struct drm_crtc *crtc, |
1045 | struct drm_pending_vblank_event *e); | | 1046 | struct drm_pending_vblank_event *e); |
1046 | extern void drm_arm_vblank_event(struct drm_device *dev, unsigned int pipe, | | 1047 | extern void drm_arm_vblank_event(struct drm_device *dev, unsigned int pipe, |
1047 | struct drm_pending_vblank_event *e); | | 1048 | struct drm_pending_vblank_event *e); |
1048 | extern void drm_crtc_arm_vblank_event(struct drm_crtc *crtc, | | 1049 | extern void drm_crtc_arm_vblank_event(struct drm_crtc *crtc, |
1049 | struct drm_pending_vblank_event *e); | | 1050 | struct drm_pending_vblank_event *e); |
1050 | extern bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe); | | 1051 | extern bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe); |
1051 | extern bool drm_crtc_handle_vblank(struct drm_crtc *crtc); | | 1052 | extern bool drm_crtc_handle_vblank(struct drm_crtc *crtc); |
1052 | extern int drm_vblank_get(struct drm_device *dev, unsigned int pipe); | | 1053 | extern int drm_vblank_get(struct drm_device *dev, unsigned int pipe); |
1053 | extern void drm_vblank_put(struct drm_device *dev, unsigned int pipe); | | 1054 | extern void drm_vblank_put(struct drm_device *dev, unsigned int pipe); |
1054 | extern int drm_crtc_vblank_get(struct drm_crtc *crtc); | | 1055 | extern int drm_crtc_vblank_get(struct drm_crtc *crtc); |
1055 | extern void drm_crtc_vblank_put(struct drm_crtc *crtc); | | 1056 | extern void drm_crtc_vblank_put(struct drm_crtc *crtc); |
1056 | extern void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe); | | 1057 | extern void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe); |
1057 | extern void drm_crtc_wait_one_vblank(struct drm_crtc *crtc); | | 1058 | extern void drm_crtc_wait_one_vblank(struct drm_crtc *crtc); |
1058 | extern void drm_vblank_off(struct drm_device *dev, unsigned int pipe); | | 1059 | extern void drm_vblank_off(struct drm_device *dev, unsigned int pipe); |
1059 | extern void drm_vblank_on(struct drm_device *dev, unsigned int pipe); | | 1060 | extern void drm_vblank_on(struct drm_device *dev, unsigned int pipe); |
1060 | extern void drm_crtc_vblank_off(struct drm_crtc *crtc); | | 1061 | extern void drm_crtc_vblank_off(struct drm_crtc *crtc); |
1061 | extern void drm_crtc_vblank_reset(struct drm_crtc *crtc); | | 1062 | extern void drm_crtc_vblank_reset(struct drm_crtc *crtc); |
1062 | extern void drm_crtc_vblank_on(struct drm_crtc *crtc); | | 1063 | extern void drm_crtc_vblank_on(struct drm_crtc *crtc); |
1063 | extern void drm_vblank_cleanup(struct drm_device *dev); | | 1064 | extern void drm_vblank_cleanup(struct drm_device *dev); |
1064 | extern u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe); | | 1065 | extern u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe); |
1065 | | | 1066 | |
1066 | extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, | | 1067 | extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, |
1067 | unsigned int pipe, int *max_error, | | 1068 | unsigned int pipe, int *max_error, |
1068 | struct timeval *vblank_time, | | 1069 | struct timeval *vblank_time, |
1069 | unsigned flags, | | 1070 | unsigned flags, |
1070 | const struct drm_display_mode *mode); | | 1071 | const struct drm_display_mode *mode); |
1071 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, | | 1072 | extern void drm_calc_timestamping_constants(struct drm_crtc *crtc, |
1072 | const struct drm_display_mode *mode); | | 1073 | const struct drm_display_mode *mode); |
1073 | | | 1074 | |
1074 | /** | | 1075 | /** |
1075 | * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC | | 1076 | * drm_crtc_vblank_waitqueue - get vblank waitqueue for the CRTC |
1076 | * @crtc: which CRTC's vblank waitqueue to retrieve | | 1077 | * @crtc: which CRTC's vblank waitqueue to retrieve |
1077 | * | | 1078 | * |
1078 | * This function returns a pointer to the vblank waitqueue for the CRTC. | | 1079 | * This function returns a pointer to the vblank waitqueue for the CRTC. |
1079 | * Drivers can use this to implement vblank waits using wait_event() & co. | | 1080 | * Drivers can use this to implement vblank waits using wait_event() & co. |
1080 | */ | | 1081 | */ |
1081 | static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc) | | 1082 | static inline wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc) |
1082 | { | | 1083 | { |
1083 | return &crtc->dev->vblank[drm_crtc_index(crtc)].queue; | | 1084 | return &crtc->dev->vblank[drm_crtc_index(crtc)].queue; |
1084 | } | | 1085 | } |
1085 | | | 1086 | |
1086 | /* Modesetting support */ | | 1087 | /* Modesetting support */ |
1087 | extern void drm_vblank_pre_modeset(struct drm_device *dev, unsigned int pipe); | | 1088 | extern void drm_vblank_pre_modeset(struct drm_device *dev, unsigned int pipe); |
1088 | extern void drm_vblank_post_modeset(struct drm_device *dev, unsigned int pipe); | | 1089 | extern void drm_vblank_post_modeset(struct drm_device *dev, unsigned int pipe); |
1089 | | | 1090 | |
1090 | #ifdef __NetBSD__ | | 1091 | #ifdef __NetBSD__ |
1091 | struct drm_agp_hooks { | | 1092 | struct drm_agp_hooks { |
1092 | drm_ioctl_t *agph_acquire_ioctl; | | 1093 | drm_ioctl_t *agph_acquire_ioctl; |
1093 | drm_ioctl_t *agph_release_ioctl; | | 1094 | drm_ioctl_t *agph_release_ioctl; |
1094 | drm_ioctl_t *agph_enable_ioctl; | | 1095 | drm_ioctl_t *agph_enable_ioctl; |
1095 | drm_ioctl_t *agph_info_ioctl; | | 1096 | drm_ioctl_t *agph_info_ioctl; |
1096 | drm_ioctl_t *agph_alloc_ioctl; | | 1097 | drm_ioctl_t *agph_alloc_ioctl; |
1097 | drm_ioctl_t *agph_free_ioctl; | | 1098 | drm_ioctl_t *agph_free_ioctl; |