Rev 5354 | Rev 6088 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5354 | Rev 6084 | ||
---|---|---|---|
1 | /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- |
1 | /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*- |
2 | */ |
2 | */ |
3 | /* |
3 | /* |
4 | * |
4 | * |
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
5 | * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. |
6 | * All Rights Reserved. |
6 | * All Rights Reserved. |
7 | * |
7 | * |
8 | * Permission is hereby granted, free of charge, to any person obtaining a |
8 | * Permission is hereby granted, free of charge, to any person obtaining a |
9 | * copy of this software and associated documentation files (the |
9 | * copy of this software and associated documentation files (the |
10 | * "Software"), to deal in the Software without restriction, including |
10 | * "Software"), to deal in the Software without restriction, including |
11 | * without limitation the rights to use, copy, modify, merge, publish, |
11 | * without limitation the rights to use, copy, modify, merge, publish, |
12 | * distribute, sub license, and/or sell copies of the Software, and to |
12 | * distribute, sub license, and/or sell copies of the Software, and to |
13 | * permit persons to whom the Software is furnished to do so, subject to |
13 | * permit persons to whom the Software is furnished to do so, subject to |
14 | * the following conditions: |
14 | * the following conditions: |
15 | * |
15 | * |
16 | * The above copyright notice and this permission notice (including the |
16 | * The above copyright notice and this permission notice (including the |
17 | * next paragraph) shall be included in all copies or substantial portions |
17 | * next paragraph) shall be included in all copies or substantial portions |
18 | * of the Software. |
18 | * of the Software. |
19 | * |
19 | * |
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. |
23 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR |
23 | * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR |
24 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
24 | * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
25 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
26 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
27 | * |
27 | * |
28 | */ |
28 | */ |
29 | 29 | ||
30 | #ifndef _I915_DRV_H_ |
30 | #ifndef _I915_DRV_H_ |
31 | #define _I915_DRV_H_ |
31 | #define _I915_DRV_H_ |
32 | 32 | ||
33 | #include |
33 | #include |
- | 34 | #include |
|
34 | 35 | ||
35 | #include "i915_reg.h" |
36 | #include "i915_reg.h" |
36 | #include "intel_bios.h" |
37 | #include "intel_bios.h" |
37 | #include "intel_ringbuffer.h" |
38 | #include "intel_ringbuffer.h" |
38 | #include "intel_lrc.h" |
39 | #include "intel_lrc.h" |
39 | #include "i915_gem_gtt.h" |
40 | #include "i915_gem_gtt.h" |
40 | #include "i915_gem_render_state.h" |
41 | #include "i915_gem_render_state.h" |
41 | //#include |
42 | #include |
42 | #include |
43 | #include |
43 | #include |
44 | #include |
44 | #include |
45 | #include |
45 | #include |
46 | #include |
46 | #include |
47 | #include |
47 | //#include |
48 | //#include |
48 | #include |
49 | #include |
- | 50 | #include |
|
- | 51 | #include "intel_guc.h" |
|
49 | 52 | ||
50 | #include |
53 | #include |
51 | #include |
54 | #include |
- | 55 | ||
- | 56 | extern int i915_fbsize; |
|
- | 57 | extern struct drm_i915_gem_object *main_fb_obj; |
|
- | 58 | extern struct drm_framebuffer *main_framebuffer; |
|
- | 59 | ||
- | 60 | static struct drm_i915_gem_object *get_fb_obj() |
|
- | 61 | { |
|
- | 62 | return main_fb_obj; |
|
- | 63 | }; |
|
- | 64 | ||
- | 65 | #define ioread32(addr) readl(addr) |
|
- | 66 | static inline u8 inb(u16 port) |
|
- | 67 | { |
|
- | 68 | u8 v; |
|
- | 69 | asm volatile("inb %1,%0" : "=a" (v) : "dN" (port)); |
|
- | 70 | return v; |
|
- | 71 | } |
|
- | 72 | ||
- | 73 | static inline void outb(u8 v, u16 port) |
|
- | 74 | { |
|
- | 75 | asm volatile("outb %0,%1" : : "a" (v), "dN" (port)); |
|
- | 76 | } |
|
52 | 77 | ||
53 | 78 | ||
54 | /* General customization: |
79 | /* General customization: |
55 | */ |
80 | */ |
56 | 81 | ||
57 | #define DRIVER_NAME "i915" |
82 | #define DRIVER_NAME "i915" |
58 | #define DRIVER_DESC "Intel Graphics" |
83 | #define DRIVER_DESC "Intel Graphics" |
59 | #define DRIVER_DATE "20141121" |
84 | #define DRIVER_DATE "20151010" |
60 | 85 | ||
- | 86 | #undef WARN_ON |
|
- | 87 | /* Many gcc seem to no see through this and fall over :( */ |
|
- | 88 | #if 0 |
|
- | 89 | #define WARN_ON(x) ({ \ |
|
- | 90 | bool __i915_warn_cond = (x); \ |
|
- | 91 | if (__builtin_constant_p(__i915_warn_cond)) \ |
|
- | 92 | BUILD_BUG_ON(__i915_warn_cond); \ |
|
- | 93 | WARN(__i915_warn_cond, "WARN_ON(" #x ")"); }) |
|
61 | #undef WARN_ON |
94 | #else |
- | 95 | #define WARN_ON(x) WARN((x), "WARN_ON(%s)", #x ) |
|
- | 96 | #endif |
|
- | 97 | ||
- | 98 | #undef WARN_ON_ONCE |
|
- | 99 | #define WARN_ON_ONCE(x) WARN_ONCE((x), "WARN_ON_ONCE(%s)", #x ) |
|
- | 100 | ||
- | 101 | #define MISSING_CASE(x) WARN(1, "Missing switch case (%lu) in %s\n", \ |
|
- | 102 | (long) (x), __func__); |
|
- | 103 | ||
- | 104 | /* Use I915_STATE_WARN(x) and I915_STATE_WARN_ON() (rather than WARN() and |
|
- | 105 | * WARN_ON()) for hw state sanity checks to check for unexpected conditions |
|
- | 106 | * which may not necessarily be a user visible problem. This will either |
|
- | 107 | * WARN() or DRM_ERROR() depending on the verbose_checks moduleparam, to |
|
- | 108 | * enable distros and users to tailor their preferred amount of i915 abrt |
|
- | 109 | * spam. |
|
- | 110 | */ |
|
- | 111 | #define I915_STATE_WARN(condition, format...) ({ \ |
|
- | 112 | int __ret_warn_on = !!(condition); \ |
|
- | 113 | if (unlikely(__ret_warn_on)) { \ |
|
- | 114 | if (i915.verbose_state_checks) \ |
|
- | 115 | WARN(1, format); \ |
|
- | 116 | else \ |
|
- | 117 | DRM_ERROR(format); \ |
|
- | 118 | } \ |
|
- | 119 | unlikely(__ret_warn_on); \ |
|
- | 120 | }) |
|
- | 121 | ||
- | 122 | #define I915_STATE_WARN_ON(condition) ({ \ |
|
- | 123 | int __ret_warn_on = !!(condition); \ |
|
- | 124 | if (unlikely(__ret_warn_on)) { \ |
|
- | 125 | if (i915.verbose_state_checks) \ |
|
- | 126 | WARN(1, "WARN_ON(" #condition ")\n"); \ |
|
- | 127 | else \ |
|
- | 128 | DRM_ERROR("WARN_ON(" #condition ")\n"); \ |
|
- | 129 | } \ |
|
- | 130 | unlikely(__ret_warn_on); \ |
|
- | 131 | }) |
|
- | 132 | ||
- | 133 | static inline const char *yesno(bool v) |
|
- | 134 | { |
|
- | 135 | return v ? "yes" : "no"; |
|
62 | #define WARN_ON(x) WARN(x, "WARN_ON(" #x ")") |
136 | } |
63 | 137 | ||
64 | enum pipe { |
138 | enum pipe { |
65 | INVALID_PIPE = -1, |
139 | INVALID_PIPE = -1, |
66 | PIPE_A = 0, |
140 | PIPE_A = 0, |
67 | PIPE_B, |
141 | PIPE_B, |
68 | PIPE_C, |
142 | PIPE_C, |
69 | _PIPE_EDP, |
143 | _PIPE_EDP, |
70 | I915_MAX_PIPES = _PIPE_EDP |
144 | I915_MAX_PIPES = _PIPE_EDP |
71 | }; |
145 | }; |
72 | #define pipe_name(p) ((p) + 'A') |
146 | #define pipe_name(p) ((p) + 'A') |
73 | 147 | ||
74 | enum transcoder { |
148 | enum transcoder { |
75 | TRANSCODER_A = 0, |
149 | TRANSCODER_A = 0, |
76 | TRANSCODER_B, |
150 | TRANSCODER_B, |
77 | TRANSCODER_C, |
151 | TRANSCODER_C, |
78 | TRANSCODER_EDP, |
152 | TRANSCODER_EDP, |
79 | I915_MAX_TRANSCODERS |
153 | I915_MAX_TRANSCODERS |
80 | }; |
154 | }; |
81 | #define transcoder_name(t) ((t) + 'A') |
155 | #define transcoder_name(t) ((t) + 'A') |
82 | 156 | ||
83 | /* |
157 | /* |
- | 158 | * I915_MAX_PLANES in the enum below is the maximum (across all platforms) |
|
84 | * This is the maximum (across all platforms) number of planes (primary + |
159 | * number of planes per CRTC. Not all platforms really have this many planes, |
85 | * sprites) that can be active at the same time on one pipe. |
160 | * which means some arrays of size I915_MAX_PLANES may have unused entries |
86 | * |
- | |
87 | * This value doesn't count the cursor plane. |
161 | * between the topmost sprite plane and the cursor plane. |
88 | */ |
162 | */ |
89 | #define I915_MAX_PLANES 3 |
- | |
90 | - | ||
91 | enum plane { |
163 | enum plane { |
92 | PLANE_A = 0, |
164 | PLANE_A = 0, |
93 | PLANE_B, |
165 | PLANE_B, |
94 | PLANE_C, |
166 | PLANE_C, |
- | 167 | PLANE_CURSOR, |
|
- | 168 | I915_MAX_PLANES, |
|
95 | }; |
169 | }; |
96 | #define plane_name(p) ((p) + 'A') |
170 | #define plane_name(p) ((p) + 'A') |
97 | 171 | ||
98 | #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A') |
172 | #define sprite_name(p, s) ((p) * INTEL_INFO(dev)->num_sprites[(p)] + (s) + 'A') |
99 | 173 | ||
100 | enum port { |
174 | enum port { |
101 | PORT_A = 0, |
175 | PORT_A = 0, |
102 | PORT_B, |
176 | PORT_B, |
103 | PORT_C, |
177 | PORT_C, |
104 | PORT_D, |
178 | PORT_D, |
105 | PORT_E, |
179 | PORT_E, |
106 | I915_MAX_PORTS |
180 | I915_MAX_PORTS |
107 | }; |
181 | }; |
108 | #define port_name(p) ((p) + 'A') |
182 | #define port_name(p) ((p) + 'A') |
109 | 183 | ||
110 | #define I915_NUM_PHYS_VLV 2 |
184 | #define I915_NUM_PHYS_VLV 2 |
111 | 185 | ||
112 | enum dpio_channel { |
186 | enum dpio_channel { |
113 | DPIO_CH0, |
187 | DPIO_CH0, |
114 | DPIO_CH1 |
188 | DPIO_CH1 |
115 | }; |
189 | }; |
116 | 190 | ||
117 | enum dpio_phy { |
191 | enum dpio_phy { |
118 | DPIO_PHY0, |
192 | DPIO_PHY0, |
119 | DPIO_PHY1 |
193 | DPIO_PHY1 |
120 | }; |
194 | }; |
121 | 195 | ||
122 | enum intel_display_power_domain { |
196 | enum intel_display_power_domain { |
123 | POWER_DOMAIN_PIPE_A, |
197 | POWER_DOMAIN_PIPE_A, |
124 | POWER_DOMAIN_PIPE_B, |
198 | POWER_DOMAIN_PIPE_B, |
125 | POWER_DOMAIN_PIPE_C, |
199 | POWER_DOMAIN_PIPE_C, |
126 | POWER_DOMAIN_PIPE_A_PANEL_FITTER, |
200 | POWER_DOMAIN_PIPE_A_PANEL_FITTER, |
127 | POWER_DOMAIN_PIPE_B_PANEL_FITTER, |
201 | POWER_DOMAIN_PIPE_B_PANEL_FITTER, |
128 | POWER_DOMAIN_PIPE_C_PANEL_FITTER, |
202 | POWER_DOMAIN_PIPE_C_PANEL_FITTER, |
129 | POWER_DOMAIN_TRANSCODER_A, |
203 | POWER_DOMAIN_TRANSCODER_A, |
130 | POWER_DOMAIN_TRANSCODER_B, |
204 | POWER_DOMAIN_TRANSCODER_B, |
131 | POWER_DOMAIN_TRANSCODER_C, |
205 | POWER_DOMAIN_TRANSCODER_C, |
132 | POWER_DOMAIN_TRANSCODER_EDP, |
206 | POWER_DOMAIN_TRANSCODER_EDP, |
133 | POWER_DOMAIN_PORT_DDI_A_2_LANES, |
207 | POWER_DOMAIN_PORT_DDI_A_2_LANES, |
134 | POWER_DOMAIN_PORT_DDI_A_4_LANES, |
208 | POWER_DOMAIN_PORT_DDI_A_4_LANES, |
135 | POWER_DOMAIN_PORT_DDI_B_2_LANES, |
209 | POWER_DOMAIN_PORT_DDI_B_2_LANES, |
136 | POWER_DOMAIN_PORT_DDI_B_4_LANES, |
210 | POWER_DOMAIN_PORT_DDI_B_4_LANES, |
137 | POWER_DOMAIN_PORT_DDI_C_2_LANES, |
211 | POWER_DOMAIN_PORT_DDI_C_2_LANES, |
138 | POWER_DOMAIN_PORT_DDI_C_4_LANES, |
212 | POWER_DOMAIN_PORT_DDI_C_4_LANES, |
139 | POWER_DOMAIN_PORT_DDI_D_2_LANES, |
213 | POWER_DOMAIN_PORT_DDI_D_2_LANES, |
140 | POWER_DOMAIN_PORT_DDI_D_4_LANES, |
214 | POWER_DOMAIN_PORT_DDI_D_4_LANES, |
- | 215 | POWER_DOMAIN_PORT_DDI_E_2_LANES, |
|
141 | POWER_DOMAIN_PORT_DSI, |
216 | POWER_DOMAIN_PORT_DSI, |
142 | POWER_DOMAIN_PORT_CRT, |
217 | POWER_DOMAIN_PORT_CRT, |
143 | POWER_DOMAIN_PORT_OTHER, |
218 | POWER_DOMAIN_PORT_OTHER, |
144 | POWER_DOMAIN_VGA, |
219 | POWER_DOMAIN_VGA, |
145 | POWER_DOMAIN_AUDIO, |
220 | POWER_DOMAIN_AUDIO, |
146 | POWER_DOMAIN_PLLS, |
221 | POWER_DOMAIN_PLLS, |
- | 222 | POWER_DOMAIN_AUX_A, |
|
- | 223 | POWER_DOMAIN_AUX_B, |
|
- | 224 | POWER_DOMAIN_AUX_C, |
|
- | 225 | POWER_DOMAIN_AUX_D, |
|
- | 226 | POWER_DOMAIN_GMBUS, |
|
147 | POWER_DOMAIN_INIT, |
227 | POWER_DOMAIN_INIT, |
148 | 228 | ||
149 | POWER_DOMAIN_NUM, |
229 | POWER_DOMAIN_NUM, |
150 | }; |
230 | }; |
151 | 231 | ||
152 | #define POWER_DOMAIN_PIPE(pipe) ((pipe) + POWER_DOMAIN_PIPE_A) |
232 | #define POWER_DOMAIN_PIPE(pipe) ((pipe) + POWER_DOMAIN_PIPE_A) |
153 | #define POWER_DOMAIN_PIPE_PANEL_FITTER(pipe) \ |
233 | #define POWER_DOMAIN_PIPE_PANEL_FITTER(pipe) \ |
154 | ((pipe) + POWER_DOMAIN_PIPE_A_PANEL_FITTER) |
234 | ((pipe) + POWER_DOMAIN_PIPE_A_PANEL_FITTER) |
155 | #define POWER_DOMAIN_TRANSCODER(tran) \ |
235 | #define POWER_DOMAIN_TRANSCODER(tran) \ |
156 | ((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \ |
236 | ((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \ |
157 | (tran) + POWER_DOMAIN_TRANSCODER_A) |
237 | (tran) + POWER_DOMAIN_TRANSCODER_A) |
158 | 238 | ||
159 | enum hpd_pin { |
239 | enum hpd_pin { |
160 | HPD_NONE = 0, |
240 | HPD_NONE = 0, |
161 | HPD_PORT_A = HPD_NONE, /* PORT_A is internal */ |
- | |
162 | HPD_TV = HPD_NONE, /* TV is known to be unreliable */ |
241 | HPD_TV = HPD_NONE, /* TV is known to be unreliable */ |
163 | HPD_CRT, |
242 | HPD_CRT, |
164 | HPD_SDVO_B, |
243 | HPD_SDVO_B, |
165 | HPD_SDVO_C, |
244 | HPD_SDVO_C, |
- | 245 | HPD_PORT_A, |
|
166 | HPD_PORT_B, |
246 | HPD_PORT_B, |
167 | HPD_PORT_C, |
247 | HPD_PORT_C, |
168 | HPD_PORT_D, |
248 | HPD_PORT_D, |
- | 249 | HPD_PORT_E, |
|
169 | HPD_NUM_PINS |
250 | HPD_NUM_PINS |
170 | }; |
251 | }; |
- | 252 | ||
- | 253 | #define for_each_hpd_pin(__pin) \ |
|
- | 254 | for ((__pin) = (HPD_NONE + 1); (__pin) < HPD_NUM_PINS; (__pin)++) |
|
- | 255 | ||
- | 256 | struct i915_hotplug { |
|
- | 257 | struct work_struct hotplug_work; |
|
- | 258 | ||
- | 259 | struct { |
|
- | 260 | unsigned long last_jiffies; |
|
- | 261 | int count; |
|
- | 262 | enum { |
|
- | 263 | HPD_ENABLED = 0, |
|
- | 264 | HPD_DISABLED = 1, |
|
- | 265 | HPD_MARK_DISABLED = 2 |
|
- | 266 | } state; |
|
- | 267 | } stats[HPD_NUM_PINS]; |
|
- | 268 | u32 event_bits; |
|
- | 269 | struct delayed_work reenable_work; |
|
- | 270 | ||
- | 271 | struct intel_digital_port *irq_port[I915_MAX_PORTS]; |
|
- | 272 | u32 long_port_mask; |
|
- | 273 | u32 short_port_mask; |
|
- | 274 | struct work_struct dig_port_work; |
|
- | 275 | ||
- | 276 | /* |
|
- | 277 | * if we get a HPD irq from DP and a HPD irq from non-DP |
|
- | 278 | * the non-DP HPD could block the workqueue on a mode config |
|
- | 279 | * mutex getting, that userspace may have taken. However |
|
- | 280 | * userspace is waiting on the DP workqueue to run which is |
|
- | 281 | * blocked behind the non-DP one. |
|
- | 282 | */ |
|
- | 283 | struct workqueue_struct *dp_wq; |
|
- | 284 | }; |
|
171 | 285 | ||
172 | #define I915_GEM_GPU_DOMAINS \ |
286 | #define I915_GEM_GPU_DOMAINS \ |
173 | (I915_GEM_DOMAIN_RENDER | \ |
287 | (I915_GEM_DOMAIN_RENDER | \ |
174 | I915_GEM_DOMAIN_SAMPLER | \ |
288 | I915_GEM_DOMAIN_SAMPLER | \ |
175 | I915_GEM_DOMAIN_COMMAND | \ |
289 | I915_GEM_DOMAIN_COMMAND | \ |
176 | I915_GEM_DOMAIN_INSTRUCTION | \ |
290 | I915_GEM_DOMAIN_INSTRUCTION | \ |
177 | I915_GEM_DOMAIN_VERTEX) |
291 | I915_GEM_DOMAIN_VERTEX) |
178 | 292 | ||
179 | #define for_each_pipe(__dev_priv, __p) \ |
293 | #define for_each_pipe(__dev_priv, __p) \ |
180 | for ((__p) = 0; (__p) < INTEL_INFO(__dev_priv)->num_pipes; (__p)++) |
294 | for ((__p) = 0; (__p) < INTEL_INFO(__dev_priv)->num_pipes; (__p)++) |
181 | #define for_each_plane(pipe, p) \ |
295 | #define for_each_plane(__dev_priv, __pipe, __p) \ |
- | 296 | for ((__p) = 0; \ |
|
182 | for ((p) = 0; (p) < INTEL_INFO(dev)->num_sprites[(pipe)] + 1; (p)++) |
297 | (__p) < INTEL_INFO(__dev_priv)->num_sprites[(__pipe)] + 1; \ |
- | 298 | (__p)++) |
|
- | 299 | #define for_each_sprite(__dev_priv, __p, __s) \ |
|
- | 300 | for ((__s) = 0; \ |
|
183 | #define for_each_sprite(p, s) for ((s) = 0; (s) < INTEL_INFO(dev)->num_sprites[(p)]; (s)++) |
301 | (__s) < INTEL_INFO(__dev_priv)->num_sprites[(__p)]; \ |
- | 302 | (__s)++) |
|
184 | 303 | ||
185 | #define for_each_crtc(dev, crtc) \ |
304 | #define for_each_crtc(dev, crtc) \ |
186 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
305 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) |
- | 306 | ||
- | 307 | #define for_each_intel_plane(dev, intel_plane) \ |
|
- | 308 | list_for_each_entry(intel_plane, \ |
|
- | 309 | &dev->mode_config.plane_list, \ |
|
- | 310 | base.head) |
|
- | 311 | ||
- | 312 | #define for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) \ |
|
- | 313 | list_for_each_entry(intel_plane, \ |
|
- | 314 | &(dev)->mode_config.plane_list, \ |
|
- | 315 | base.head) \ |
|
- | 316 | if ((intel_plane)->pipe == (intel_crtc)->pipe) |
|
187 | 317 | ||
188 | #define for_each_intel_crtc(dev, intel_crtc) \ |
318 | #define for_each_intel_crtc(dev, intel_crtc) \ |
189 | list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head) |
319 | list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head) |
190 | 320 | ||
191 | #define for_each_intel_encoder(dev, intel_encoder) \ |
321 | #define for_each_intel_encoder(dev, intel_encoder) \ |
192 | list_for_each_entry(intel_encoder, \ |
322 | list_for_each_entry(intel_encoder, \ |
193 | &(dev)->mode_config.encoder_list, \ |
323 | &(dev)->mode_config.encoder_list, \ |
194 | base.head) |
324 | base.head) |
- | 325 | ||
- | 326 | #define for_each_intel_connector(dev, intel_connector) \ |
|
- | 327 | list_for_each_entry(intel_connector, \ |
|
- | 328 | &dev->mode_config.connector_list, \ |
|
- | 329 | base.head) |
|
195 | 330 | ||
196 | #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \ |
331 | #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \ |
197 | list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ |
332 | list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ |
198 | if ((intel_encoder)->base.crtc == (__crtc)) |
333 | if ((intel_encoder)->base.crtc == (__crtc)) |
199 | 334 | ||
200 | #define for_each_connector_on_encoder(dev, __encoder, intel_connector) \ |
335 | #define for_each_connector_on_encoder(dev, __encoder, intel_connector) \ |
201 | list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \ |
336 | list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \ |
202 | if ((intel_connector)->base.encoder == (__encoder)) |
337 | if ((intel_connector)->base.encoder == (__encoder)) |
203 | 338 | ||
204 | #define for_each_power_domain(domain, mask) \ |
339 | #define for_each_power_domain(domain, mask) \ |
205 | for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \ |
340 | for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \ |
206 | if ((1 << (domain)) & (mask)) |
341 | if ((1 << (domain)) & (mask)) |
207 | 342 | ||
208 | struct drm_i915_private; |
343 | struct drm_i915_private; |
209 | struct i915_mm_struct; |
344 | struct i915_mm_struct; |
210 | struct i915_mmu_object; |
345 | struct i915_mmu_object; |
- | 346 | ||
- | 347 | struct drm_i915_file_private { |
|
- | 348 | struct drm_i915_private *dev_priv; |
|
- | 349 | struct drm_file *file; |
|
- | 350 | ||
- | 351 | struct { |
|
- | 352 | spinlock_t lock; |
|
- | 353 | struct list_head request_list; |
|
- | 354 | /* 20ms is a fairly arbitrary limit (greater than the average frame time) |
|
- | 355 | * chosen to prevent the CPU getting more than a frame ahead of the GPU |
|
- | 356 | * (when using lax throttling for the frontbuffer). We also use it to |
|
- | 357 | * offer free GPU waitboosts for severely congested workloads. |
|
- | 358 | */ |
|
- | 359 | #define DRM_I915_THROTTLE_JIFFIES msecs_to_jiffies(20) |
|
- | 360 | } mm; |
|
- | 361 | struct idr context_idr; |
|
- | 362 | ||
- | 363 | struct intel_rps_client { |
|
- | 364 | struct list_head link; |
|
- | 365 | unsigned boosts; |
|
- | 366 | } rps; |
|
- | 367 | ||
- | 368 | struct intel_engine_cs *bsd_ring; |
|
- | 369 | }; |
|
211 | 370 | ||
212 | enum intel_dpll_id { |
371 | enum intel_dpll_id { |
213 | DPLL_ID_PRIVATE = -1, /* non-shared dpll in use */ |
372 | DPLL_ID_PRIVATE = -1, /* non-shared dpll in use */ |
214 | /* real shared dpll ids must be >= 0 */ |
373 | /* real shared dpll ids must be >= 0 */ |
215 | DPLL_ID_PCH_PLL_A = 0, |
374 | DPLL_ID_PCH_PLL_A = 0, |
216 | DPLL_ID_PCH_PLL_B = 1, |
375 | DPLL_ID_PCH_PLL_B = 1, |
217 | /* hsw/bdw */ |
376 | /* hsw/bdw */ |
218 | DPLL_ID_WRPLL1 = 0, |
377 | DPLL_ID_WRPLL1 = 0, |
219 | DPLL_ID_WRPLL2 = 1, |
378 | DPLL_ID_WRPLL2 = 1, |
- | 379 | DPLL_ID_SPLL = 2, |
|
- | 380 | ||
220 | /* skl */ |
381 | /* skl */ |
221 | DPLL_ID_SKL_DPLL1 = 0, |
382 | DPLL_ID_SKL_DPLL1 = 0, |
222 | DPLL_ID_SKL_DPLL2 = 1, |
383 | DPLL_ID_SKL_DPLL2 = 1, |
223 | DPLL_ID_SKL_DPLL3 = 2, |
384 | DPLL_ID_SKL_DPLL3 = 2, |
224 | }; |
385 | }; |
225 | #define I915_NUM_PLLS 3 |
386 | #define I915_NUM_PLLS 3 |
226 | 387 | ||
227 | struct intel_dpll_hw_state { |
388 | struct intel_dpll_hw_state { |
228 | /* i9xx, pch plls */ |
389 | /* i9xx, pch plls */ |
229 | uint32_t dpll; |
390 | uint32_t dpll; |
230 | uint32_t dpll_md; |
391 | uint32_t dpll_md; |
231 | uint32_t fp0; |
392 | uint32_t fp0; |
232 | uint32_t fp1; |
393 | uint32_t fp1; |
233 | 394 | ||
234 | /* hsw, bdw */ |
395 | /* hsw, bdw */ |
235 | uint32_t wrpll; |
396 | uint32_t wrpll; |
- | 397 | uint32_t spll; |
|
236 | 398 | ||
237 | /* skl */ |
399 | /* skl */ |
238 | /* |
400 | /* |
239 | * DPLL_CTRL1 has 6 bits for each each this DPLL. We store those in |
401 | * DPLL_CTRL1 has 6 bits for each each this DPLL. We store those in |
240 | * lower part of crtl1 and they get shifted into position when writing |
402 | * lower part of ctrl1 and they get shifted into position when writing |
241 | * the register. This allows us to easily compare the state to share |
403 | * the register. This allows us to easily compare the state to share |
242 | * the DPLL. |
404 | * the DPLL. |
243 | */ |
405 | */ |
244 | uint32_t ctrl1; |
406 | uint32_t ctrl1; |
245 | /* HDMI only, 0 when used for DP */ |
407 | /* HDMI only, 0 when used for DP */ |
246 | uint32_t cfgcr1, cfgcr2; |
408 | uint32_t cfgcr1, cfgcr2; |
- | 409 | ||
- | 410 | /* bxt */ |
|
- | 411 | uint32_t ebb0, ebb4, pll0, pll1, pll2, pll3, pll6, pll8, pll9, pll10, |
|
- | 412 | pcsdw12; |
|
247 | }; |
413 | }; |
248 | 414 | ||
249 | struct intel_shared_dpll_config { |
415 | struct intel_shared_dpll_config { |
250 | unsigned crtc_mask; /* mask of CRTCs sharing this PLL */ |
416 | unsigned crtc_mask; /* mask of CRTCs sharing this PLL */ |
251 | struct intel_dpll_hw_state hw_state; |
417 | struct intel_dpll_hw_state hw_state; |
252 | }; |
418 | }; |
253 | 419 | ||
254 | struct intel_shared_dpll { |
420 | struct intel_shared_dpll { |
255 | struct intel_shared_dpll_config config; |
421 | struct intel_shared_dpll_config config; |
256 | struct intel_shared_dpll_config *new_config; |
- | |
257 | 422 | ||
258 | int active; /* count of number of active CRTCs (i.e. DPMS on) */ |
423 | int active; /* count of number of active CRTCs (i.e. DPMS on) */ |
259 | bool on; /* is the PLL actually active? Disabled during modeset */ |
424 | bool on; /* is the PLL actually active? Disabled during modeset */ |
260 | const char *name; |
425 | const char *name; |
261 | /* should match the index in the dev_priv->shared_dplls array */ |
426 | /* should match the index in the dev_priv->shared_dplls array */ |
262 | enum intel_dpll_id id; |
427 | enum intel_dpll_id id; |
263 | /* The mode_set hook is optional and should be used together with the |
428 | /* The mode_set hook is optional and should be used together with the |
264 | * intel_prepare_shared_dpll function. */ |
429 | * intel_prepare_shared_dpll function. */ |
265 | void (*mode_set)(struct drm_i915_private *dev_priv, |
430 | void (*mode_set)(struct drm_i915_private *dev_priv, |
266 | struct intel_shared_dpll *pll); |
431 | struct intel_shared_dpll *pll); |
267 | void (*enable)(struct drm_i915_private *dev_priv, |
432 | void (*enable)(struct drm_i915_private *dev_priv, |
268 | struct intel_shared_dpll *pll); |
433 | struct intel_shared_dpll *pll); |
269 | void (*disable)(struct drm_i915_private *dev_priv, |
434 | void (*disable)(struct drm_i915_private *dev_priv, |
270 | struct intel_shared_dpll *pll); |
435 | struct intel_shared_dpll *pll); |
271 | bool (*get_hw_state)(struct drm_i915_private *dev_priv, |
436 | bool (*get_hw_state)(struct drm_i915_private *dev_priv, |
272 | struct intel_shared_dpll *pll, |
437 | struct intel_shared_dpll *pll, |
273 | struct intel_dpll_hw_state *hw_state); |
438 | struct intel_dpll_hw_state *hw_state); |
274 | }; |
439 | }; |
275 | 440 | ||
276 | #define SKL_DPLL0 0 |
441 | #define SKL_DPLL0 0 |
277 | #define SKL_DPLL1 1 |
442 | #define SKL_DPLL1 1 |
278 | #define SKL_DPLL2 2 |
443 | #define SKL_DPLL2 2 |
279 | #define SKL_DPLL3 3 |
444 | #define SKL_DPLL3 3 |
280 | 445 | ||
281 | /* Used by dp and fdi links */ |
446 | /* Used by dp and fdi links */ |
282 | struct intel_link_m_n { |
447 | struct intel_link_m_n { |
283 | uint32_t tu; |
448 | uint32_t tu; |
284 | uint32_t gmch_m; |
449 | uint32_t gmch_m; |
285 | uint32_t gmch_n; |
450 | uint32_t gmch_n; |
286 | uint32_t link_m; |
451 | uint32_t link_m; |
287 | uint32_t link_n; |
452 | uint32_t link_n; |
288 | }; |
453 | }; |
289 | 454 | ||
290 | void intel_link_compute_m_n(int bpp, int nlanes, |
455 | void intel_link_compute_m_n(int bpp, int nlanes, |
291 | int pixel_clock, int link_clock, |
456 | int pixel_clock, int link_clock, |
292 | struct intel_link_m_n *m_n); |
457 | struct intel_link_m_n *m_n); |
293 | 458 | ||
294 | /* Interface history: |
459 | /* Interface history: |
295 | * |
460 | * |
296 | * 1.1: Original. |
461 | * 1.1: Original. |
297 | * 1.2: Add Power Management |
462 | * 1.2: Add Power Management |
298 | * 1.3: Add vblank support |
463 | * 1.3: Add vblank support |
299 | * 1.4: Fix cmdbuffer path, add heap destroy |
464 | * 1.4: Fix cmdbuffer path, add heap destroy |
300 | * 1.5: Add vblank pipe configuration |
465 | * 1.5: Add vblank pipe configuration |
301 | * 1.6: - New ioctl for scheduling buffer swaps on vertical blank |
466 | * 1.6: - New ioctl for scheduling buffer swaps on vertical blank |
302 | * - Support vertical blank on secondary display pipe |
467 | * - Support vertical blank on secondary display pipe |
303 | */ |
468 | */ |
304 | #define DRIVER_MAJOR 1 |
469 | #define DRIVER_MAJOR 1 |
305 | #define DRIVER_MINOR 6 |
470 | #define DRIVER_MINOR 6 |
306 | #define DRIVER_PATCHLEVEL 0 |
471 | #define DRIVER_PATCHLEVEL 0 |
307 | 472 | ||
308 | #define WATCH_LISTS 0 |
473 | #define WATCH_LISTS 0 |
309 | 474 | ||
310 | struct opregion_header; |
475 | struct opregion_header; |
311 | struct opregion_acpi; |
476 | struct opregion_acpi; |
312 | struct opregion_swsci; |
477 | struct opregion_swsci; |
313 | struct opregion_asle; |
478 | struct opregion_asle; |
314 | 479 | ||
315 | struct intel_opregion { |
480 | struct intel_opregion { |
316 | struct opregion_header __iomem *header; |
481 | struct opregion_header *header; |
317 | struct opregion_acpi __iomem *acpi; |
482 | struct opregion_acpi *acpi; |
318 | struct opregion_swsci __iomem *swsci; |
483 | struct opregion_swsci *swsci; |
319 | u32 swsci_gbda_sub_functions; |
484 | u32 swsci_gbda_sub_functions; |
320 | u32 swsci_sbcb_sub_functions; |
485 | u32 swsci_sbcb_sub_functions; |
321 | struct opregion_asle __iomem *asle; |
486 | struct opregion_asle *asle; |
322 | void __iomem *vbt; |
487 | void *vbt; |
323 | u32 __iomem *lid_state; |
488 | u32 *lid_state; |
324 | struct work_struct asle_work; |
489 | struct work_struct asle_work; |
325 | }; |
490 | }; |
326 | #define OPREGION_SIZE (8*1024) |
491 | #define OPREGION_SIZE (8*1024) |
327 | 492 | ||
328 | struct intel_overlay; |
493 | struct intel_overlay; |
329 | struct intel_overlay_error_state; |
494 | struct intel_overlay_error_state; |
330 | 495 | ||
331 | #define I915_FENCE_REG_NONE -1 |
496 | #define I915_FENCE_REG_NONE -1 |
332 | #define I915_MAX_NUM_FENCES 32 |
497 | #define I915_MAX_NUM_FENCES 32 |
333 | /* 32 fences + sign bit for FENCE_REG_NONE */ |
498 | /* 32 fences + sign bit for FENCE_REG_NONE */ |
334 | #define I915_MAX_NUM_FENCE_BITS 6 |
499 | #define I915_MAX_NUM_FENCE_BITS 6 |
335 | 500 | ||
336 | struct drm_i915_fence_reg { |
501 | struct drm_i915_fence_reg { |
337 | struct list_head lru_list; |
502 | struct list_head lru_list; |
338 | struct drm_i915_gem_object *obj; |
503 | struct drm_i915_gem_object *obj; |
339 | int pin_count; |
504 | int pin_count; |
340 | }; |
505 | }; |
341 | 506 | ||
342 | struct sdvo_device_mapping { |
507 | struct sdvo_device_mapping { |
343 | u8 initialized; |
508 | u8 initialized; |
344 | u8 dvo_port; |
509 | u8 dvo_port; |
345 | u8 slave_addr; |
510 | u8 slave_addr; |
346 | u8 dvo_wiring; |
511 | u8 dvo_wiring; |
347 | u8 i2c_pin; |
512 | u8 i2c_pin; |
348 | u8 ddc_pin; |
513 | u8 ddc_pin; |
349 | }; |
514 | }; |
350 | 515 | ||
351 | struct intel_display_error_state; |
516 | struct intel_display_error_state; |
352 | 517 | ||
353 | struct drm_i915_error_state { |
518 | struct drm_i915_error_state { |
354 | struct kref ref; |
519 | struct kref ref; |
355 | struct timeval time; |
520 | struct timeval time; |
356 | 521 | ||
357 | char error_msg[128]; |
522 | char error_msg[128]; |
- | 523 | int iommu; |
|
358 | u32 reset_count; |
524 | u32 reset_count; |
359 | u32 suspend_count; |
525 | u32 suspend_count; |
360 | 526 | ||
361 | /* Generic register state */ |
527 | /* Generic register state */ |
362 | u32 eir; |
528 | u32 eir; |
363 | u32 pgtbl_er; |
529 | u32 pgtbl_er; |
364 | u32 ier; |
530 | u32 ier; |
365 | u32 gtier[4]; |
531 | u32 gtier[4]; |
366 | u32 ccid; |
532 | u32 ccid; |
367 | u32 derrmr; |
533 | u32 derrmr; |
368 | u32 forcewake; |
534 | u32 forcewake; |
369 | u32 error; /* gen6+ */ |
535 | u32 error; /* gen6+ */ |
370 | u32 err_int; /* gen7 */ |
536 | u32 err_int; /* gen7 */ |
- | 537 | u32 fault_data0; /* gen8, gen9 */ |
|
- | 538 | u32 fault_data1; /* gen8, gen9 */ |
|
371 | u32 done_reg; |
539 | u32 done_reg; |
372 | u32 gac_eco; |
540 | u32 gac_eco; |
373 | u32 gam_ecochk; |
541 | u32 gam_ecochk; |
374 | u32 gab_ctl; |
542 | u32 gab_ctl; |
375 | u32 gfx_mode; |
543 | u32 gfx_mode; |
376 | u32 extra_instdone[I915_NUM_INSTDONE_REG]; |
544 | u32 extra_instdone[I915_NUM_INSTDONE_REG]; |
377 | u64 fence[I915_MAX_NUM_FENCES]; |
545 | u64 fence[I915_MAX_NUM_FENCES]; |
378 | struct intel_overlay_error_state *overlay; |
546 | struct intel_overlay_error_state *overlay; |
379 | struct intel_display_error_state *display; |
547 | struct intel_display_error_state *display; |
- | 548 | struct drm_i915_error_object *semaphore_obj; |
|
380 | 549 | ||
381 | struct drm_i915_error_ring { |
550 | struct drm_i915_error_ring { |
382 | bool valid; |
551 | bool valid; |
383 | /* Software tracked state */ |
552 | /* Software tracked state */ |
384 | bool waiting; |
553 | bool waiting; |
385 | int hangcheck_score; |
554 | int hangcheck_score; |
386 | enum intel_ring_hangcheck_action hangcheck_action; |
555 | enum intel_ring_hangcheck_action hangcheck_action; |
387 | int num_requests; |
556 | int num_requests; |
388 | 557 | ||
389 | /* our own tracking of ring head and tail */ |
558 | /* our own tracking of ring head and tail */ |
390 | u32 cpu_ring_head; |
559 | u32 cpu_ring_head; |
391 | u32 cpu_ring_tail; |
560 | u32 cpu_ring_tail; |
392 | 561 | ||
393 | u32 semaphore_seqno[I915_NUM_RINGS - 1]; |
562 | u32 semaphore_seqno[I915_NUM_RINGS - 1]; |
394 | 563 | ||
395 | /* Register state */ |
564 | /* Register state */ |
- | 565 | u32 start; |
|
396 | u32 tail; |
566 | u32 tail; |
397 | u32 head; |
567 | u32 head; |
398 | u32 ctl; |
568 | u32 ctl; |
399 | u32 hws; |
569 | u32 hws; |
400 | u32 ipeir; |
570 | u32 ipeir; |
401 | u32 ipehr; |
571 | u32 ipehr; |
402 | u32 instdone; |
572 | u32 instdone; |
403 | u32 bbstate; |
573 | u32 bbstate; |
404 | u32 instpm; |
574 | u32 instpm; |
405 | u32 instps; |
575 | u32 instps; |
406 | u32 seqno; |
576 | u32 seqno; |
407 | u64 bbaddr; |
577 | u64 bbaddr; |
408 | u64 acthd; |
578 | u64 acthd; |
409 | u32 fault_reg; |
579 | u32 fault_reg; |
410 | u64 faddr; |
580 | u64 faddr; |
411 | u32 rc_psmi; /* sleep state */ |
581 | u32 rc_psmi; /* sleep state */ |
412 | u32 semaphore_mboxes[I915_NUM_RINGS - 1]; |
582 | u32 semaphore_mboxes[I915_NUM_RINGS - 1]; |
413 | 583 | ||
414 | struct drm_i915_error_object { |
584 | struct drm_i915_error_object { |
415 | int page_count; |
585 | int page_count; |
416 | u32 gtt_offset; |
586 | u64 gtt_offset; |
417 | u32 *pages[0]; |
587 | u32 *pages[0]; |
418 | } *ringbuffer, *batchbuffer, *wa_batchbuffer, *ctx, *hws_page; |
588 | } *ringbuffer, *batchbuffer, *wa_batchbuffer, *ctx, *hws_page; |
419 | 589 | ||
420 | struct drm_i915_error_request { |
590 | struct drm_i915_error_request { |
421 | long jiffies; |
591 | long jiffies; |
422 | u32 seqno; |
592 | u32 seqno; |
423 | u32 tail; |
593 | u32 tail; |
424 | } *requests; |
594 | } *requests; |
425 | 595 | ||
426 | struct { |
596 | struct { |
427 | u32 gfx_mode; |
597 | u32 gfx_mode; |
428 | union { |
598 | union { |
429 | u64 pdp[4]; |
599 | u64 pdp[4]; |
430 | u32 pp_dir_base; |
600 | u32 pp_dir_base; |
431 | }; |
601 | }; |
432 | } vm_info; |
602 | } vm_info; |
433 | 603 | ||
434 | pid_t pid; |
604 | pid_t pid; |
435 | char comm[TASK_COMM_LEN]; |
605 | char comm[TASK_COMM_LEN]; |
436 | } ring[I915_NUM_RINGS]; |
606 | } ring[I915_NUM_RINGS]; |
437 | 607 | ||
438 | struct drm_i915_error_buffer { |
608 | struct drm_i915_error_buffer { |
439 | u32 size; |
609 | u32 size; |
440 | u32 name; |
610 | u32 name; |
441 | u32 rseqno, wseqno; |
611 | u32 rseqno[I915_NUM_RINGS], wseqno; |
442 | u32 gtt_offset; |
612 | u64 gtt_offset; |
443 | u32 read_domains; |
613 | u32 read_domains; |
444 | u32 write_domain; |
614 | u32 write_domain; |
445 | s32 fence_reg:I915_MAX_NUM_FENCE_BITS; |
615 | s32 fence_reg:I915_MAX_NUM_FENCE_BITS; |
446 | s32 pinned:2; |
616 | s32 pinned:2; |
447 | u32 tiling:2; |
617 | u32 tiling:2; |
448 | u32 dirty:1; |
618 | u32 dirty:1; |
449 | u32 purgeable:1; |
619 | u32 purgeable:1; |
450 | u32 userptr:1; |
620 | u32 userptr:1; |
451 | s32 ring:4; |
621 | s32 ring:4; |
452 | u32 cache_level:3; |
622 | u32 cache_level:3; |
453 | } **active_bo, **pinned_bo; |
623 | } **active_bo, **pinned_bo; |
454 | 624 | ||
455 | u32 *active_bo_count, *pinned_bo_count; |
625 | u32 *active_bo_count, *pinned_bo_count; |
456 | u32 vm_count; |
626 | u32 vm_count; |
457 | }; |
627 | }; |
458 | 628 | ||
459 | struct intel_connector; |
629 | struct intel_connector; |
460 | struct intel_encoder; |
630 | struct intel_encoder; |
461 | struct intel_crtc_config; |
631 | struct intel_crtc_state; |
462 | struct intel_plane_config; |
632 | struct intel_initial_plane_config; |
463 | struct intel_crtc; |
633 | struct intel_crtc; |
464 | struct intel_limit; |
634 | struct intel_limit; |
465 | struct dpll; |
635 | struct dpll; |
466 | 636 | ||
467 | struct drm_i915_display_funcs { |
637 | struct drm_i915_display_funcs { |
468 | bool (*fbc_enabled)(struct drm_device *dev); |
- | |
469 | void (*enable_fbc)(struct drm_crtc *crtc); |
- | |
470 | void (*disable_fbc)(struct drm_device *dev); |
- | |
471 | int (*get_display_clock_speed)(struct drm_device *dev); |
638 | int (*get_display_clock_speed)(struct drm_device *dev); |
472 | int (*get_fifo_size)(struct drm_device *dev, int plane); |
639 | int (*get_fifo_size)(struct drm_device *dev, int plane); |
473 | /** |
640 | /** |
474 | * find_dpll() - Find the best values for the PLL |
641 | * find_dpll() - Find the best values for the PLL |
475 | * @limit: limits for the PLL |
642 | * @limit: limits for the PLL |
476 | * @crtc: current CRTC |
643 | * @crtc: current CRTC |
477 | * @target: target frequency in kHz |
644 | * @target: target frequency in kHz |
478 | * @refclk: reference clock frequency in kHz |
645 | * @refclk: reference clock frequency in kHz |
479 | * @match_clock: if provided, @best_clock P divider must |
646 | * @match_clock: if provided, @best_clock P divider must |
480 | * match the P divider from @match_clock |
647 | * match the P divider from @match_clock |
481 | * used for LVDS downclocking |
648 | * used for LVDS downclocking |
482 | * @best_clock: best PLL values found |
649 | * @best_clock: best PLL values found |
483 | * |
650 | * |
484 | * Returns true on success, false on failure. |
651 | * Returns true on success, false on failure. |
485 | */ |
652 | */ |
486 | bool (*find_dpll)(const struct intel_limit *limit, |
653 | bool (*find_dpll)(const struct intel_limit *limit, |
487 | struct intel_crtc *crtc, |
654 | struct intel_crtc_state *crtc_state, |
488 | int target, int refclk, |
655 | int target, int refclk, |
489 | struct dpll *match_clock, |
656 | struct dpll *match_clock, |
490 | struct dpll *best_clock); |
657 | struct dpll *best_clock); |
491 | void (*update_wm)(struct drm_crtc *crtc); |
658 | void (*update_wm)(struct drm_crtc *crtc); |
492 | void (*update_sprite_wm)(struct drm_plane *plane, |
659 | void (*update_sprite_wm)(struct drm_plane *plane, |
493 | struct drm_crtc *crtc, |
660 | struct drm_crtc *crtc, |
494 | uint32_t sprite_width, uint32_t sprite_height, |
661 | uint32_t sprite_width, uint32_t sprite_height, |
495 | int pixel_size, bool enable, bool scaled); |
662 | int pixel_size, bool enable, bool scaled); |
- | 663 | int (*modeset_calc_cdclk)(struct drm_atomic_state *state); |
|
496 | void (*modeset_global_resources)(struct drm_device *dev); |
664 | void (*modeset_commit_cdclk)(struct drm_atomic_state *state); |
497 | /* Returns the active state of the crtc, and if the crtc is active, |
665 | /* Returns the active state of the crtc, and if the crtc is active, |
498 | * fills out the pipe-config with the hw state. */ |
666 | * fills out the pipe-config with the hw state. */ |
499 | bool (*get_pipe_config)(struct intel_crtc *, |
667 | bool (*get_pipe_config)(struct intel_crtc *, |
500 | struct intel_crtc_config *); |
668 | struct intel_crtc_state *); |
501 | void (*get_plane_config)(struct intel_crtc *, |
669 | void (*get_initial_plane_config)(struct intel_crtc *, |
502 | struct intel_plane_config *); |
670 | struct intel_initial_plane_config *); |
503 | int (*crtc_compute_clock)(struct intel_crtc *crtc); |
671 | int (*crtc_compute_clock)(struct intel_crtc *crtc, |
- | 672 | struct intel_crtc_state *crtc_state); |
|
504 | void (*crtc_enable)(struct drm_crtc *crtc); |
673 | void (*crtc_enable)(struct drm_crtc *crtc); |
505 | void (*crtc_disable)(struct drm_crtc *crtc); |
674 | void (*crtc_disable)(struct drm_crtc *crtc); |
506 | void (*off)(struct drm_crtc *crtc); |
- | |
507 | void (*audio_codec_enable)(struct drm_connector *connector, |
675 | void (*audio_codec_enable)(struct drm_connector *connector, |
508 | struct intel_encoder *encoder, |
676 | struct intel_encoder *encoder, |
509 | struct drm_display_mode *mode); |
677 | const struct drm_display_mode *adjusted_mode); |
510 | void (*audio_codec_disable)(struct intel_encoder *encoder); |
678 | void (*audio_codec_disable)(struct intel_encoder *encoder); |
511 | void (*fdi_link_train)(struct drm_crtc *crtc); |
679 | void (*fdi_link_train)(struct drm_crtc *crtc); |
512 | void (*init_clock_gating)(struct drm_device *dev); |
680 | void (*init_clock_gating)(struct drm_device *dev); |
513 | int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc, |
681 | int (*queue_flip)(struct drm_device *dev, struct drm_crtc *crtc, |
514 | struct drm_framebuffer *fb, |
682 | struct drm_framebuffer *fb, |
515 | struct drm_i915_gem_object *obj, |
683 | struct drm_i915_gem_object *obj, |
516 | struct intel_engine_cs *ring, |
684 | struct drm_i915_gem_request *req, |
517 | uint32_t flags); |
685 | uint32_t flags); |
518 | void (*update_primary_plane)(struct drm_crtc *crtc, |
686 | void (*update_primary_plane)(struct drm_crtc *crtc, |
519 | struct drm_framebuffer *fb, |
687 | struct drm_framebuffer *fb, |
520 | int x, int y); |
688 | int x, int y); |
521 | void (*hpd_irq_setup)(struct drm_device *dev); |
689 | void (*hpd_irq_setup)(struct drm_device *dev); |
522 | /* clock updates for mode set */ |
690 | /* clock updates for mode set */ |
523 | /* cursor updates */ |
691 | /* cursor updates */ |
524 | /* render clock increase/decrease */ |
692 | /* render clock increase/decrease */ |
525 | /* display clock increase/decrease */ |
693 | /* display clock increase/decrease */ |
526 | /* pll clock increase/decrease */ |
694 | /* pll clock increase/decrease */ |
- | 695 | }; |
|
527 | 696 | ||
- | 697 | enum forcewake_domain_id { |
|
- | 698 | FW_DOMAIN_ID_RENDER = 0, |
|
- | 699 | FW_DOMAIN_ID_BLITTER, |
|
- | 700 | FW_DOMAIN_ID_MEDIA, |
|
- | 701 | ||
- | 702 | FW_DOMAIN_ID_COUNT |
|
- | 703 | }; |
|
528 | int (*setup_backlight)(struct intel_connector *connector, enum pipe pipe); |
704 | |
529 | uint32_t (*get_backlight)(struct intel_connector *connector); |
705 | enum forcewake_domains { |
530 | void (*set_backlight)(struct intel_connector *connector, |
706 | FORCEWAKE_RENDER = (1 << FW_DOMAIN_ID_RENDER), |
531 | uint32_t level); |
707 | FORCEWAKE_BLITTER = (1 << FW_DOMAIN_ID_BLITTER), |
532 | void (*disable_backlight)(struct intel_connector *connector); |
708 | FORCEWAKE_MEDIA = (1 << FW_DOMAIN_ID_MEDIA), |
- | 709 | FORCEWAKE_ALL = (FORCEWAKE_RENDER | |
|
- | 710 | FORCEWAKE_BLITTER | |
|
533 | void (*enable_backlight)(struct intel_connector *connector); |
711 | FORCEWAKE_MEDIA) |
534 | }; |
712 | }; |
535 | 713 | ||
536 | struct intel_uncore_funcs { |
714 | struct intel_uncore_funcs { |
537 | void (*force_wake_get)(struct drm_i915_private *dev_priv, |
715 | void (*force_wake_get)(struct drm_i915_private *dev_priv, |
538 | int fw_engine); |
716 | enum forcewake_domains domains); |
539 | void (*force_wake_put)(struct drm_i915_private *dev_priv, |
717 | void (*force_wake_put)(struct drm_i915_private *dev_priv, |
540 | int fw_engine); |
718 | enum forcewake_domains domains); |
541 | 719 | ||
542 | uint8_t (*mmio_readb)(struct drm_i915_private *dev_priv, off_t offset, bool trace); |
720 | uint8_t (*mmio_readb)(struct drm_i915_private *dev_priv, off_t offset, bool trace); |
543 | uint16_t (*mmio_readw)(struct drm_i915_private *dev_priv, off_t offset, bool trace); |
721 | uint16_t (*mmio_readw)(struct drm_i915_private *dev_priv, off_t offset, bool trace); |
544 | uint32_t (*mmio_readl)(struct drm_i915_private *dev_priv, off_t offset, bool trace); |
722 | uint32_t (*mmio_readl)(struct drm_i915_private *dev_priv, off_t offset, bool trace); |
545 | uint64_t (*mmio_readq)(struct drm_i915_private *dev_priv, off_t offset, bool trace); |
723 | uint64_t (*mmio_readq)(struct drm_i915_private *dev_priv, off_t offset, bool trace); |
546 | 724 | ||
547 | void (*mmio_writeb)(struct drm_i915_private *dev_priv, off_t offset, |
725 | void (*mmio_writeb)(struct drm_i915_private *dev_priv, off_t offset, |
548 | uint8_t val, bool trace); |
726 | uint8_t val, bool trace); |
549 | void (*mmio_writew)(struct drm_i915_private *dev_priv, off_t offset, |
727 | void (*mmio_writew)(struct drm_i915_private *dev_priv, off_t offset, |
550 | uint16_t val, bool trace); |
728 | uint16_t val, bool trace); |
551 | void (*mmio_writel)(struct drm_i915_private *dev_priv, off_t offset, |
729 | void (*mmio_writel)(struct drm_i915_private *dev_priv, off_t offset, |
552 | uint32_t val, bool trace); |
730 | uint32_t val, bool trace); |
553 | void (*mmio_writeq)(struct drm_i915_private *dev_priv, off_t offset, |
731 | void (*mmio_writeq)(struct drm_i915_private *dev_priv, off_t offset, |
554 | uint64_t val, bool trace); |
732 | uint64_t val, bool trace); |
555 | }; |
733 | }; |
556 | 734 | ||
557 | struct intel_uncore { |
735 | struct intel_uncore { |
558 | spinlock_t lock; /** lock is also taken in irq contexts. */ |
736 | spinlock_t lock; /** lock is also taken in irq contexts. */ |
559 | 737 | ||
560 | struct intel_uncore_funcs funcs; |
738 | struct intel_uncore_funcs funcs; |
561 | 739 | ||
562 | unsigned fifo_count; |
740 | unsigned fifo_count; |
563 | unsigned forcewake_count; |
741 | enum forcewake_domains fw_domains; |
564 | - | ||
565 | unsigned fw_rendercount; |
- | |
566 | unsigned fw_mediacount; |
- | |
567 | unsigned fw_blittercount; |
- | |
- | 742 | ||
- | 743 | struct intel_uncore_forcewake_domain { |
|
- | 744 | struct drm_i915_private *i915; |
|
- | 745 | enum forcewake_domain_id id; |
|
568 | 746 | unsigned wake_count; |
|
- | 747 | struct timer_list timer; |
|
- | 748 | u32 reg_set; |
|
- | 749 | u32 val_set; |
|
- | 750 | u32 val_clear; |
|
- | 751 | u32 reg_ack; |
|
- | 752 | u32 reg_post; |
|
- | 753 | u32 val_reset; |
|
- | 754 | } fw_domain[FW_DOMAIN_ID_COUNT]; |
|
- | 755 | }; |
|
- | 756 | ||
- | 757 | /* Iterate over initialised fw domains */ |
|
- | 758 | #define for_each_fw_domain_mask(domain__, mask__, dev_priv__, i__) \ |
|
- | 759 | for ((i__) = 0, (domain__) = &(dev_priv__)->uncore.fw_domain[0]; \ |
|
- | 760 | (i__) < FW_DOMAIN_ID_COUNT; \ |
|
- | 761 | (i__)++, (domain__) = &(dev_priv__)->uncore.fw_domain[i__]) \ |
|
- | 762 | if (((mask__) & (dev_priv__)->uncore.fw_domains) & (1 << (i__))) |
|
- | 763 | ||
- | 764 | #define for_each_fw_domain(domain__, dev_priv__, i__) \ |
|
- | 765 | for_each_fw_domain_mask(domain__, FORCEWAKE_ALL, dev_priv__, i__) |
|
- | 766 | ||
- | 767 | enum csr_state { |
|
- | 768 | FW_UNINITIALIZED = 0, |
|
- | 769 | FW_LOADED, |
|
- | 770 | FW_FAILED |
|
- | 771 | }; |
|
- | 772 | ||
- | 773 | struct intel_csr { |
|
- | 774 | const char *fw_path; |
|
- | 775 | uint32_t *dmc_payload; |
|
- | 776 | uint32_t dmc_fw_size; |
|
- | 777 | uint32_t mmio_count; |
|
- | 778 | uint32_t mmioaddr[8]; |
|
- | 779 | uint32_t mmiodata[8]; |
|
569 | struct timer_list force_wake_timer; |
780 | enum csr_state state; |
570 | }; |
781 | }; |
571 | 782 | ||
572 | #define DEV_INFO_FOR_EACH_FLAG(func, sep) \ |
783 | #define DEV_INFO_FOR_EACH_FLAG(func, sep) \ |
573 | func(is_mobile) sep \ |
784 | func(is_mobile) sep \ |
574 | func(is_i85x) sep \ |
785 | func(is_i85x) sep \ |
575 | func(is_i915g) sep \ |
786 | func(is_i915g) sep \ |
576 | func(is_i945gm) sep \ |
787 | func(is_i945gm) sep \ |
577 | func(is_g33) sep \ |
788 | func(is_g33) sep \ |
578 | func(need_gfx_hws) sep \ |
789 | func(need_gfx_hws) sep \ |
579 | func(is_g4x) sep \ |
790 | func(is_g4x) sep \ |
580 | func(is_pineview) sep \ |
791 | func(is_pineview) sep \ |
581 | func(is_broadwater) sep \ |
792 | func(is_broadwater) sep \ |
582 | func(is_crestline) sep \ |
793 | func(is_crestline) sep \ |
583 | func(is_ivybridge) sep \ |
794 | func(is_ivybridge) sep \ |
584 | func(is_valleyview) sep \ |
795 | func(is_valleyview) sep \ |
585 | func(is_haswell) sep \ |
796 | func(is_haswell) sep \ |
586 | func(is_skylake) sep \ |
797 | func(is_skylake) sep \ |
587 | func(is_preliminary) sep \ |
798 | func(is_preliminary) sep \ |
588 | func(has_fbc) sep \ |
799 | func(has_fbc) sep \ |
589 | func(has_pipe_cxsr) sep \ |
800 | func(has_pipe_cxsr) sep \ |
590 | func(has_hotplug) sep \ |
801 | func(has_hotplug) sep \ |
591 | func(cursor_needs_physical) sep \ |
802 | func(cursor_needs_physical) sep \ |
592 | func(has_overlay) sep \ |
803 | func(has_overlay) sep \ |
593 | func(overlay_needs_physical) sep \ |
804 | func(overlay_needs_physical) sep \ |
594 | func(supports_tv) sep \ |
805 | func(supports_tv) sep \ |
595 | func(has_llc) sep \ |
806 | func(has_llc) sep \ |
596 | func(has_ddi) sep \ |
807 | func(has_ddi) sep \ |
597 | func(has_fpga_dbg) |
808 | func(has_fpga_dbg) |
598 | 809 | ||
599 | #define DEFINE_FLAG(name) u8 name:1 |
810 | #define DEFINE_FLAG(name) u8 name:1 |
600 | #define SEP_SEMICOLON ; |
811 | #define SEP_SEMICOLON ; |
601 | 812 | ||
602 | struct intel_device_info { |
813 | struct intel_device_info { |
603 | u32 display_mmio_offset; |
814 | u32 display_mmio_offset; |
604 | u16 device_id; |
815 | u16 device_id; |
605 | u8 num_pipes:3; |
816 | u8 num_pipes:3; |
606 | u8 num_sprites[I915_MAX_PIPES]; |
817 | u8 num_sprites[I915_MAX_PIPES]; |
607 | u8 gen; |
818 | u8 gen; |
608 | u8 ring_mask; /* Rings supported by the HW */ |
819 | u8 ring_mask; /* Rings supported by the HW */ |
609 | DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON); |
820 | DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG, SEP_SEMICOLON); |
610 | /* Register offsets for the various display pipes and transcoders */ |
821 | /* Register offsets for the various display pipes and transcoders */ |
611 | int pipe_offsets[I915_MAX_TRANSCODERS]; |
822 | int pipe_offsets[I915_MAX_TRANSCODERS]; |
612 | int trans_offsets[I915_MAX_TRANSCODERS]; |
823 | int trans_offsets[I915_MAX_TRANSCODERS]; |
613 | int palette_offsets[I915_MAX_PIPES]; |
824 | int palette_offsets[I915_MAX_PIPES]; |
614 | int cursor_offsets[I915_MAX_PIPES]; |
825 | int cursor_offsets[I915_MAX_PIPES]; |
- | 826 | ||
- | 827 | /* Slice/subslice/EU info */ |
|
- | 828 | u8 slice_total; |
|
- | 829 | u8 subslice_total; |
|
- | 830 | u8 subslice_per_slice; |
|
- | 831 | u8 eu_total; |
|
- | 832 | u8 eu_per_subslice; |
|
- | 833 | /* For each slice, which subslice(s) has(have) 7 EUs (bitfield)? */ |
|
- | 834 | u8 subslice_7eu[3]; |
|
- | 835 | u8 has_slice_pg:1; |
|
- | 836 | u8 has_subslice_pg:1; |
|
- | 837 | u8 has_eu_pg:1; |
|
615 | }; |
838 | }; |
616 | 839 | ||
617 | #undef DEFINE_FLAG |
840 | #undef DEFINE_FLAG |
618 | #undef SEP_SEMICOLON |
841 | #undef SEP_SEMICOLON |
619 | 842 | ||
620 | enum i915_cache_level { |
843 | enum i915_cache_level { |
621 | I915_CACHE_NONE = 0, |
844 | I915_CACHE_NONE = 0, |
622 | I915_CACHE_LLC, /* also used for snoopable memory on non-LLC */ |
845 | I915_CACHE_LLC, /* also used for snoopable memory on non-LLC */ |
623 | I915_CACHE_L3_LLC, /* gen7+, L3 sits between the domain specifc |
846 | I915_CACHE_L3_LLC, /* gen7+, L3 sits between the domain specifc |
624 | caches, eg sampler/render caches, and the |
847 | caches, eg sampler/render caches, and the |
625 | large Last-Level-Cache. LLC is coherent with |
848 | large Last-Level-Cache. LLC is coherent with |
626 | the CPU, but L3 is only visible to the GPU. */ |
849 | the CPU, but L3 is only visible to the GPU. */ |
627 | I915_CACHE_WT, /* hsw:gt3e WriteThrough for scanouts */ |
850 | I915_CACHE_WT, /* hsw:gt3e WriteThrough for scanouts */ |
628 | }; |
851 | }; |
629 | 852 | ||
630 | struct i915_ctx_hang_stats { |
853 | struct i915_ctx_hang_stats { |
631 | /* This context had batch pending when hang was declared */ |
854 | /* This context had batch pending when hang was declared */ |
632 | unsigned batch_pending; |
855 | unsigned batch_pending; |
633 | 856 | ||
634 | /* This context had batch active when hang was declared */ |
857 | /* This context had batch active when hang was declared */ |
635 | unsigned batch_active; |
858 | unsigned batch_active; |
636 | 859 | ||
637 | /* Time when this context was last blamed for a GPU reset */ |
860 | /* Time when this context was last blamed for a GPU reset */ |
638 | unsigned long guilty_ts; |
861 | unsigned long guilty_ts; |
- | 862 | ||
- | 863 | /* If the contexts causes a second GPU hang within this time, |
|
- | 864 | * it is permanently banned from submitting any more work. |
|
- | 865 | */ |
|
- | 866 | unsigned long ban_period_seconds; |
|
639 | 867 | ||
640 | /* This context is banned to submit more work */ |
868 | /* This context is banned to submit more work */ |
641 | bool banned; |
869 | bool banned; |
642 | }; |
870 | }; |
643 | 871 | ||
644 | /* This must match up with the value previously used for execbuf2.rsvd1. */ |
872 | /* This must match up with the value previously used for execbuf2.rsvd1. */ |
645 | #define DEFAULT_CONTEXT_HANDLE 0 |
873 | #define DEFAULT_CONTEXT_HANDLE 0 |
- | 874 | ||
- | 875 | #define CONTEXT_NO_ZEROMAP (1<<0) |
|
646 | /** |
876 | /** |
647 | * struct intel_context - as the name implies, represents a context. |
877 | * struct intel_context - as the name implies, represents a context. |
648 | * @ref: reference count. |
878 | * @ref: reference count. |
649 | * @user_handle: userspace tracking identity for this context. |
879 | * @user_handle: userspace tracking identity for this context. |
650 | * @remap_slice: l3 row remapping information. |
880 | * @remap_slice: l3 row remapping information. |
- | 881 | * @flags: context specific flags: |
|
- | 882 | * CONTEXT_NO_ZEROMAP: do not allow mapping things to page 0. |
|
651 | * @file_priv: filp associated with this context (NULL for global default |
883 | * @file_priv: filp associated with this context (NULL for global default |
652 | * context). |
884 | * context). |
653 | * @hang_stats: information about the role of this context in possible GPU |
885 | * @hang_stats: information about the role of this context in possible GPU |
654 | * hangs. |
886 | * hangs. |
655 | * @vm: virtual memory space used by this context. |
887 | * @ppgtt: virtual memory space used by this context. |
656 | * @legacy_hw_ctx: render context backing object and whether it is correctly |
888 | * @legacy_hw_ctx: render context backing object and whether it is correctly |
657 | * initialized (legacy ring submission mechanism only). |
889 | * initialized (legacy ring submission mechanism only). |
658 | * @link: link in the global list of contexts. |
890 | * @link: link in the global list of contexts. |
659 | * |
891 | * |
660 | * Contexts are memory images used by the hardware to store copies of their |
892 | * Contexts are memory images used by the hardware to store copies of their |
661 | * internal state. |
893 | * internal state. |
662 | */ |
894 | */ |
663 | struct intel_context { |
895 | struct intel_context { |
664 | struct kref ref; |
896 | struct kref ref; |
665 | int user_handle; |
897 | int user_handle; |
666 | uint8_t remap_slice; |
898 | uint8_t remap_slice; |
- | 899 | struct drm_i915_private *i915; |
|
- | 900 | int flags; |
|
667 | struct drm_i915_file_private *file_priv; |
901 | struct drm_i915_file_private *file_priv; |
668 | struct i915_ctx_hang_stats hang_stats; |
902 | struct i915_ctx_hang_stats hang_stats; |
669 | struct i915_hw_ppgtt *ppgtt; |
903 | struct i915_hw_ppgtt *ppgtt; |
670 | 904 | ||
671 | /* Legacy ring buffer submission */ |
905 | /* Legacy ring buffer submission */ |
672 | struct { |
906 | struct { |
673 | struct drm_i915_gem_object *rcs_state; |
907 | struct drm_i915_gem_object *rcs_state; |
674 | bool initialized; |
908 | bool initialized; |
675 | } legacy_hw_ctx; |
909 | } legacy_hw_ctx; |
676 | 910 | ||
677 | /* Execlists */ |
911 | /* Execlists */ |
678 | bool rcs_initialized; |
- | |
679 | struct { |
912 | struct { |
680 | struct drm_i915_gem_object *state; |
913 | struct drm_i915_gem_object *state; |
681 | struct intel_ringbuffer *ringbuf; |
914 | struct intel_ringbuffer *ringbuf; |
682 | int unpin_count; |
915 | int pin_count; |
683 | } engine[I915_NUM_RINGS]; |
916 | } engine[I915_NUM_RINGS]; |
684 | 917 | ||
685 | struct list_head link; |
918 | struct list_head link; |
686 | }; |
919 | }; |
- | 920 | ||
- | 921 | enum fb_op_origin { |
|
- | 922 | ORIGIN_GTT, |
|
- | 923 | ORIGIN_CPU, |
|
- | 924 | ORIGIN_CS, |
|
- | 925 | ORIGIN_FLIP, |
|
- | 926 | ORIGIN_DIRTYFB, |
|
- | 927 | }; |
|
687 | 928 | ||
- | 929 | struct i915_fbc { |
|
- | 930 | /* This is always the inner lock when overlapping with struct_mutex and |
|
- | 931 | * it's the outer lock when overlapping with stolen_lock. */ |
|
688 | struct i915_fbc { |
932 | struct mutex lock; |
689 | unsigned long size; |
933 | unsigned long uncompressed_size; |
690 | unsigned threshold; |
934 | unsigned threshold; |
- | 935 | unsigned int fb_id; |
|
- | 936 | unsigned int possible_framebuffer_bits; |
|
691 | unsigned int fb_id; |
937 | unsigned int busy_bits; |
692 | enum plane plane; |
938 | struct intel_crtc *crtc; |
693 | int y; |
939 | int y; |
694 | 940 | ||
695 | struct drm_mm_node compressed_fb; |
941 | struct drm_mm_node compressed_fb; |
696 | struct drm_mm_node *compressed_llb; |
942 | struct drm_mm_node *compressed_llb; |
697 | 943 | ||
698 | bool false_color; |
944 | bool false_color; |
699 | 945 | ||
700 | /* Tracks whether the HW is actually enabled, not whether the feature is |
946 | /* Tracks whether the HW is actually enabled, not whether the feature is |
701 | * possible. */ |
947 | * possible. */ |
702 | bool enabled; |
948 | bool enabled; |
703 | - | ||
704 | /* On gen8 some rings cannont perform fbc clean operation so for now |
- | |
705 | * we are doing this on SW with mmio. |
- | |
706 | * This variable works in the opposite information direction |
- | |
707 | * of ring->fbc_dirty telling software on frontbuffer tracking |
- | |
708 | * to perform the cache clean on sw side. |
- | |
709 | */ |
- | |
710 | bool need_sw_cache_clean; |
- | |
711 | 949 | ||
712 | struct intel_fbc_work { |
950 | struct intel_fbc_work { |
713 | struct delayed_work work; |
951 | struct delayed_work work; |
714 | struct drm_crtc *crtc; |
952 | struct intel_crtc *crtc; |
715 | struct drm_framebuffer *fb; |
953 | struct drm_framebuffer *fb; |
716 | } *fbc_work; |
954 | } *fbc_work; |
717 | 955 | ||
718 | enum no_fbc_reason { |
956 | enum no_fbc_reason { |
719 | FBC_OK, /* FBC is enabled */ |
957 | FBC_OK, /* FBC is enabled */ |
720 | FBC_UNSUPPORTED, /* FBC is not supported by this chipset */ |
958 | FBC_UNSUPPORTED, /* FBC is not supported by this chipset */ |
721 | FBC_NO_OUTPUT, /* no outputs enabled to compress */ |
959 | FBC_NO_OUTPUT, /* no outputs enabled to compress */ |
722 | FBC_STOLEN_TOO_SMALL, /* not enough space for buffers */ |
960 | FBC_STOLEN_TOO_SMALL, /* not enough space for buffers */ |
723 | FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */ |
961 | FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */ |
724 | FBC_MODE_TOO_LARGE, /* mode too large for compression */ |
962 | FBC_MODE_TOO_LARGE, /* mode too large for compression */ |
725 | FBC_BAD_PLANE, /* fbc not supported on plane */ |
963 | FBC_BAD_PLANE, /* fbc not supported on plane */ |
726 | FBC_NOT_TILED, /* buffer not tiled */ |
964 | FBC_NOT_TILED, /* buffer not tiled */ |
727 | FBC_MULTIPLE_PIPES, /* more than one pipe active */ |
965 | FBC_MULTIPLE_PIPES, /* more than one pipe active */ |
728 | FBC_MODULE_PARAM, |
966 | FBC_MODULE_PARAM, |
729 | FBC_CHIP_DEFAULT, /* disabled by default on this chip */ |
967 | FBC_CHIP_DEFAULT, /* disabled by default on this chip */ |
- | 968 | FBC_ROTATION, /* rotation is not supported */ |
|
- | 969 | FBC_IN_DBG_MASTER, /* kernel debugger is active */ |
|
- | 970 | FBC_BAD_STRIDE, /* stride is not supported */ |
|
- | 971 | FBC_PIXEL_RATE, /* pixel rate is too big */ |
|
- | 972 | FBC_PIXEL_FORMAT /* pixel format is invalid */ |
|
730 | } no_fbc_reason; |
973 | } no_fbc_reason; |
- | 974 | ||
- | 975 | bool (*fbc_enabled)(struct drm_i915_private *dev_priv); |
|
- | 976 | void (*enable_fbc)(struct intel_crtc *crtc); |
|
- | 977 | void (*disable_fbc)(struct drm_i915_private *dev_priv); |
|
731 | }; |
978 | }; |
- | 979 | ||
- | 980 | /** |
|
- | 981 | * HIGH_RR is the highest eDP panel refresh rate read from EDID |
|
- | 982 | * LOW_RR is the lowest eDP panel refresh rate found from EDID |
|
- | 983 | * parsing for same resolution. |
|
732 | 984 | */ |
|
- | 985 | enum drrs_refresh_rate_type { |
|
- | 986 | DRRS_HIGH_RR, |
|
733 | struct i915_drrs { |
987 | DRRS_LOW_RR, |
- | 988 | DRRS_MAX_RR, /* RR count */ |
|
- | 989 | }; |
|
- | 990 | ||
- | 991 | enum drrs_support_type { |
|
- | 992 | DRRS_NOT_SUPPORTED = 0, |
|
- | 993 | STATIC_DRRS_SUPPORT = 1, |
|
734 | struct intel_connector *connector; |
994 | SEAMLESS_DRRS_SUPPORT = 2 |
735 | }; |
995 | }; |
736 | 996 | ||
737 | struct intel_dp; |
997 | struct intel_dp; |
- | 998 | struct i915_drrs { |
|
- | 999 | struct mutex mutex; |
|
- | 1000 | struct delayed_work work; |
|
- | 1001 | struct intel_dp *dp; |
|
- | 1002 | unsigned busy_frontbuffer_bits; |
|
- | 1003 | enum drrs_refresh_rate_type refresh_rate_type; |
|
- | 1004 | enum drrs_support_type type; |
|
- | 1005 | }; |
|
- | 1006 | ||
738 | struct i915_psr { |
1007 | struct i915_psr { |
739 | struct mutex lock; |
1008 | struct mutex lock; |
740 | bool sink_support; |
1009 | bool sink_support; |
741 | bool source_ok; |
1010 | bool source_ok; |
742 | struct intel_dp *enabled; |
1011 | struct intel_dp *enabled; |
743 | bool active; |
1012 | bool active; |
744 | struct delayed_work work; |
1013 | struct delayed_work work; |
745 | unsigned busy_frontbuffer_bits; |
1014 | unsigned busy_frontbuffer_bits; |
- | 1015 | bool psr2_support; |
|
- | 1016 | bool aux_frame_sync; |
|
746 | }; |
1017 | }; |
747 | 1018 | ||
748 | enum intel_pch { |
1019 | enum intel_pch { |
749 | PCH_NONE = 0, /* No PCH present */ |
1020 | PCH_NONE = 0, /* No PCH present */ |
750 | PCH_IBX, /* Ibexpeak PCH */ |
1021 | PCH_IBX, /* Ibexpeak PCH */ |
751 | PCH_CPT, /* Cougarpoint PCH */ |
1022 | PCH_CPT, /* Cougarpoint PCH */ |
752 | PCH_LPT, /* Lynxpoint PCH */ |
1023 | PCH_LPT, /* Lynxpoint PCH */ |
753 | PCH_SPT, /* Sunrisepoint PCH */ |
1024 | PCH_SPT, /* Sunrisepoint PCH */ |
754 | PCH_NOP, |
1025 | PCH_NOP, |
755 | }; |
1026 | }; |
756 | 1027 | ||
757 | enum intel_sbi_destination { |
1028 | enum intel_sbi_destination { |
758 | SBI_ICLK, |
1029 | SBI_ICLK, |
759 | SBI_MPHY, |
1030 | SBI_MPHY, |
760 | }; |
1031 | }; |
761 | 1032 | ||
762 | #define QUIRK_PIPEA_FORCE (1<<0) |
1033 | #define QUIRK_PIPEA_FORCE (1<<0) |
763 | #define QUIRK_LVDS_SSC_DISABLE (1<<1) |
1034 | #define QUIRK_LVDS_SSC_DISABLE (1<<1) |
764 | #define QUIRK_INVERT_BRIGHTNESS (1<<2) |
1035 | #define QUIRK_INVERT_BRIGHTNESS (1<<2) |
765 | #define QUIRK_BACKLIGHT_PRESENT (1<<3) |
1036 | #define QUIRK_BACKLIGHT_PRESENT (1<<3) |
766 | #define QUIRK_PIPEB_FORCE (1<<4) |
1037 | #define QUIRK_PIPEB_FORCE (1<<4) |
767 | #define QUIRK_PIN_SWIZZLED_PAGES (1<<5) |
1038 | #define QUIRK_PIN_SWIZZLED_PAGES (1<<5) |
768 | 1039 | ||
769 | struct intel_fbdev; |
1040 | struct intel_fbdev; |
770 | struct intel_fbc_work; |
1041 | struct intel_fbc_work; |
771 | 1042 | ||
772 | struct intel_gmbus { |
1043 | struct intel_gmbus { |
773 | struct i2c_adapter adapter; |
1044 | struct i2c_adapter adapter; |
774 | u32 force_bit; |
1045 | u32 force_bit; |
775 | u32 reg0; |
1046 | u32 reg0; |
776 | u32 gpio_reg; |
1047 | u32 gpio_reg; |
777 | struct i2c_algo_bit_data bit_algo; |
1048 | struct i2c_algo_bit_data bit_algo; |
778 | struct drm_i915_private *dev_priv; |
1049 | struct drm_i915_private *dev_priv; |
779 | }; |
1050 | }; |
780 | 1051 | ||
781 | struct i915_suspend_saved_registers { |
1052 | struct i915_suspend_saved_registers { |
782 | u8 saveLBB; |
- | |
783 | u32 saveDSPACNTR; |
- | |
784 | u32 saveDSPBCNTR; |
- | |
785 | u32 saveDSPARB; |
1053 | u32 saveDSPARB; |
786 | u32 savePIPEACONF; |
- | |
787 | u32 savePIPEBCONF; |
- | |
788 | u32 savePIPEASRC; |
- | |
789 | u32 savePIPEBSRC; |
- | |
790 | u32 saveFPA0; |
- | |
791 | u32 saveFPA1; |
- | |
792 | u32 saveDPLL_A; |
- | |
793 | u32 saveDPLL_A_MD; |
- | |
794 | u32 saveHTOTAL_A; |
- | |
795 | u32 saveHBLANK_A; |
- | |
796 | u32 saveHSYNC_A; |
- | |
797 | u32 saveVTOTAL_A; |
- | |
798 | u32 saveVBLANK_A; |
- | |
799 | u32 saveVSYNC_A; |
- | |
800 | u32 saveBCLRPAT_A; |
- | |
801 | u32 saveTRANSACONF; |
- | |
802 | u32 saveTRANS_HTOTAL_A; |
- | |
803 | u32 saveTRANS_HBLANK_A; |
- | |
804 | u32 saveTRANS_HSYNC_A; |
- | |
805 | u32 saveTRANS_VTOTAL_A; |
- | |
806 | u32 saveTRANS_VBLANK_A; |
- | |
807 | u32 saveTRANS_VSYNC_A; |
- | |
808 | u32 savePIPEASTAT; |
- | |
809 | u32 saveDSPASTRIDE; |
- | |
810 | u32 saveDSPASIZE; |
- | |
811 | u32 saveDSPAPOS; |
- | |
812 | u32 saveDSPAADDR; |
- | |
813 | u32 saveDSPASURF; |
- | |
814 | u32 saveDSPATILEOFF; |
- | |
815 | u32 savePFIT_PGM_RATIOS; |
- | |
816 | u32 saveBLC_HIST_CTL; |
- | |
817 | u32 saveBLC_PWM_CTL; |
- | |
818 | u32 saveBLC_PWM_CTL2; |
- | |
819 | u32 saveBLC_CPU_PWM_CTL; |
- | |
820 | u32 saveBLC_CPU_PWM_CTL2; |
- | |
821 | u32 saveFPB0; |
- | |
822 | u32 saveFPB1; |
- | |
823 | u32 saveDPLL_B; |
- | |
824 | u32 saveDPLL_B_MD; |
- | |
825 | u32 saveHTOTAL_B; |
- | |
826 | u32 saveHBLANK_B; |
- | |
827 | u32 saveHSYNC_B; |
- | |
828 | u32 saveVTOTAL_B; |
- | |
829 | u32 saveVBLANK_B; |
- | |
830 | u32 saveVSYNC_B; |
- | |
831 | u32 saveBCLRPAT_B; |
- | |
832 | u32 saveTRANSBCONF; |
- | |
833 | u32 saveTRANS_HTOTAL_B; |
- | |
834 | u32 saveTRANS_HBLANK_B; |
- | |
835 | u32 saveTRANS_HSYNC_B; |
- | |
836 | u32 saveTRANS_VTOTAL_B; |
- | |
837 | u32 saveTRANS_VBLANK_B; |
- | |
838 | u32 saveTRANS_VSYNC_B; |
- | |
839 | u32 savePIPEBSTAT; |
- | |
840 | u32 saveDSPBSTRIDE; |
- | |
841 | u32 saveDSPBSIZE; |
- | |
842 | u32 saveDSPBPOS; |
- | |
843 | u32 saveDSPBADDR; |
- | |
844 | u32 saveDSPBSURF; |
- | |
845 | u32 saveDSPBTILEOFF; |
- | |
846 | u32 saveVGA0; |
- | |
847 | u32 saveVGA1; |
- | |
848 | u32 saveVGA_PD; |
- | |
849 | u32 saveVGACNTRL; |
- | |
850 | u32 saveADPA; |
- | |
851 | u32 saveLVDS; |
1054 | u32 saveLVDS; |
852 | u32 savePP_ON_DELAYS; |
1055 | u32 savePP_ON_DELAYS; |
853 | u32 savePP_OFF_DELAYS; |
1056 | u32 savePP_OFF_DELAYS; |
854 | u32 saveDVOA; |
- | |
855 | u32 saveDVOB; |
- | |
856 | u32 saveDVOC; |
- | |
857 | u32 savePP_ON; |
1057 | u32 savePP_ON; |
858 | u32 savePP_OFF; |
1058 | u32 savePP_OFF; |
859 | u32 savePP_CONTROL; |
1059 | u32 savePP_CONTROL; |
860 | u32 savePP_DIVISOR; |
1060 | u32 savePP_DIVISOR; |
861 | u32 savePFIT_CONTROL; |
- | |
862 | u32 save_palette_a[256]; |
- | |
863 | u32 save_palette_b[256]; |
- | |
864 | u32 saveFBC_CONTROL; |
1061 | u32 saveFBC_CONTROL; |
865 | u32 saveIER; |
- | |
866 | u32 saveIIR; |
- | |
867 | u32 saveIMR; |
- | |
868 | u32 saveDEIER; |
- | |
869 | u32 saveDEIMR; |
- | |
870 | u32 saveGTIER; |
- | |
871 | u32 saveGTIMR; |
- | |
872 | u32 saveFDI_RXA_IMR; |
- | |
873 | u32 saveFDI_RXB_IMR; |
- | |
874 | u32 saveCACHE_MODE_0; |
1062 | u32 saveCACHE_MODE_0; |
875 | u32 saveMI_ARB_STATE; |
1063 | u32 saveMI_ARB_STATE; |
876 | u32 saveSWF0[16]; |
1064 | u32 saveSWF0[16]; |
877 | u32 saveSWF1[16]; |
1065 | u32 saveSWF1[16]; |
878 | u32 saveSWF2[3]; |
1066 | u32 saveSWF3[3]; |
879 | u8 saveMSR; |
- | |
880 | u8 saveSR[8]; |
- | |
881 | u8 saveGR[25]; |
- | |
882 | u8 saveAR_INDEX; |
- | |
883 | u8 saveAR[21]; |
- | |
884 | u8 saveDACMASK; |
- | |
885 | u8 saveCR[37]; |
- | |
886 | uint64_t saveFENCE[I915_MAX_NUM_FENCES]; |
1067 | uint64_t saveFENCE[I915_MAX_NUM_FENCES]; |
887 | u32 saveCURACNTR; |
- | |
888 | u32 saveCURAPOS; |
- | |
889 | u32 saveCURABASE; |
- | |
890 | u32 saveCURBCNTR; |
- | |
891 | u32 saveCURBPOS; |
- | |
892 | u32 saveCURBBASE; |
- | |
893 | u32 saveCURSIZE; |
- | |
894 | u32 saveDP_B; |
- | |
895 | u32 saveDP_C; |
- | |
896 | u32 saveDP_D; |
- | |
897 | u32 savePIPEA_GMCH_DATA_M; |
- | |
898 | u32 savePIPEB_GMCH_DATA_M; |
- | |
899 | u32 savePIPEA_GMCH_DATA_N; |
- | |
900 | u32 savePIPEB_GMCH_DATA_N; |
- | |
901 | u32 savePIPEA_DP_LINK_M; |
- | |
902 | u32 savePIPEB_DP_LINK_M; |
- | |
903 | u32 savePIPEA_DP_LINK_N; |
- | |
904 | u32 savePIPEB_DP_LINK_N; |
- | |
905 | u32 saveFDI_RXA_CTL; |
- | |
906 | u32 saveFDI_TXA_CTL; |
- | |
907 | u32 saveFDI_RXB_CTL; |
- | |
908 | u32 saveFDI_TXB_CTL; |
- | |
909 | u32 savePFA_CTL_1; |
- | |
910 | u32 savePFB_CTL_1; |
- | |
911 | u32 savePFA_WIN_SZ; |
- | |
912 | u32 savePFB_WIN_SZ; |
- | |
913 | u32 savePFA_WIN_POS; |
- | |
914 | u32 savePFB_WIN_POS; |
- | |
915 | u32 savePCH_DREF_CONTROL; |
- | |
916 | u32 saveDISP_ARB_CTL; |
- | |
917 | u32 savePIPEA_DATA_M1; |
- | |
918 | u32 savePIPEA_DATA_N1; |
- | |
919 | u32 savePIPEA_LINK_M1; |
- | |
920 | u32 savePIPEA_LINK_N1; |
- | |
921 | u32 savePIPEB_DATA_M1; |
- | |
922 | u32 savePIPEB_DATA_N1; |
- | |
923 | u32 savePIPEB_LINK_M1; |
- | |
924 | u32 savePIPEB_LINK_N1; |
- | |
925 | u32 saveMCHBAR_RENDER_STANDBY; |
- | |
926 | u32 savePCH_PORT_HOTPLUG; |
1068 | u32 savePCH_PORT_HOTPLUG; |
927 | u16 saveGCDGMBUS; |
1069 | u16 saveGCDGMBUS; |
928 | }; |
1070 | }; |
929 | 1071 | ||
930 | struct vlv_s0ix_state { |
1072 | struct vlv_s0ix_state { |
931 | /* GAM */ |
1073 | /* GAM */ |
932 | u32 wr_watermark; |
1074 | u32 wr_watermark; |
933 | u32 gfx_prio_ctrl; |
1075 | u32 gfx_prio_ctrl; |
934 | u32 arb_mode; |
1076 | u32 arb_mode; |
935 | u32 gfx_pend_tlb0; |
1077 | u32 gfx_pend_tlb0; |
936 | u32 gfx_pend_tlb1; |
1078 | u32 gfx_pend_tlb1; |
937 | u32 lra_limits[GEN7_LRA_LIMITS_REG_NUM]; |
1079 | u32 lra_limits[GEN7_LRA_LIMITS_REG_NUM]; |
938 | u32 media_max_req_count; |
1080 | u32 media_max_req_count; |
939 | u32 gfx_max_req_count; |
1081 | u32 gfx_max_req_count; |
940 | u32 render_hwsp; |
1082 | u32 render_hwsp; |
941 | u32 ecochk; |
1083 | u32 ecochk; |
942 | u32 bsd_hwsp; |
1084 | u32 bsd_hwsp; |
943 | u32 blt_hwsp; |
1085 | u32 blt_hwsp; |
944 | u32 tlb_rd_addr; |
1086 | u32 tlb_rd_addr; |
945 | 1087 | ||
946 | /* MBC */ |
1088 | /* MBC */ |
947 | u32 g3dctl; |
1089 | u32 g3dctl; |
948 | u32 gsckgctl; |
1090 | u32 gsckgctl; |
949 | u32 mbctl; |
1091 | u32 mbctl; |
950 | 1092 | ||
951 | /* GCP */ |
1093 | /* GCP */ |
952 | u32 ucgctl1; |
1094 | u32 ucgctl1; |
953 | u32 ucgctl3; |
1095 | u32 ucgctl3; |
954 | u32 rcgctl1; |
1096 | u32 rcgctl1; |
955 | u32 rcgctl2; |
1097 | u32 rcgctl2; |
956 | u32 rstctl; |
1098 | u32 rstctl; |
957 | u32 misccpctl; |
1099 | u32 misccpctl; |
958 | 1100 | ||
959 | /* GPM */ |
1101 | /* GPM */ |
960 | u32 gfxpause; |
1102 | u32 gfxpause; |
961 | u32 rpdeuhwtc; |
1103 | u32 rpdeuhwtc; |
962 | u32 rpdeuc; |
1104 | u32 rpdeuc; |
963 | u32 ecobus; |
1105 | u32 ecobus; |
964 | u32 pwrdwnupctl; |
1106 | u32 pwrdwnupctl; |
965 | u32 rp_down_timeout; |
1107 | u32 rp_down_timeout; |
966 | u32 rp_deucsw; |
1108 | u32 rp_deucsw; |
967 | u32 rcubmabdtmr; |
1109 | u32 rcubmabdtmr; |
968 | u32 rcedata; |
1110 | u32 rcedata; |
969 | u32 spare2gh; |
1111 | u32 spare2gh; |
970 | 1112 | ||
971 | /* Display 1 CZ domain */ |
1113 | /* Display 1 CZ domain */ |
972 | u32 gt_imr; |
1114 | u32 gt_imr; |
973 | u32 gt_ier; |
1115 | u32 gt_ier; |
974 | u32 pm_imr; |
1116 | u32 pm_imr; |
975 | u32 pm_ier; |
1117 | u32 pm_ier; |
976 | u32 gt_scratch[GEN7_GT_SCRATCH_REG_NUM]; |
1118 | u32 gt_scratch[GEN7_GT_SCRATCH_REG_NUM]; |
977 | 1119 | ||
978 | /* GT SA CZ domain */ |
1120 | /* GT SA CZ domain */ |
979 | u32 tilectl; |
1121 | u32 tilectl; |
980 | u32 gt_fifoctl; |
1122 | u32 gt_fifoctl; |
981 | u32 gtlc_wake_ctrl; |
1123 | u32 gtlc_wake_ctrl; |
982 | u32 gtlc_survive; |
1124 | u32 gtlc_survive; |
983 | u32 pmwgicz; |
1125 | u32 pmwgicz; |
984 | 1126 | ||
985 | /* Display 2 CZ domain */ |
1127 | /* Display 2 CZ domain */ |
986 | u32 gu_ctl0; |
1128 | u32 gu_ctl0; |
987 | u32 gu_ctl1; |
1129 | u32 gu_ctl1; |
- | 1130 | u32 pcbr; |
|
988 | u32 clock_gate_dis2; |
1131 | u32 clock_gate_dis2; |
989 | }; |
1132 | }; |
990 | 1133 | ||
991 | struct intel_rps_ei { |
1134 | struct intel_rps_ei { |
992 | u32 cz_clock; |
1135 | u32 cz_clock; |
993 | u32 render_c0; |
1136 | u32 render_c0; |
994 | u32 media_c0; |
1137 | u32 media_c0; |
995 | }; |
1138 | }; |
996 | 1139 | ||
997 | struct intel_gen6_power_mgmt { |
1140 | struct intel_gen6_power_mgmt { |
998 | /* |
1141 | /* |
999 | * work, interrupts_enabled and pm_iir are protected by |
1142 | * work, interrupts_enabled and pm_iir are protected by |
1000 | * dev_priv->irq_lock |
1143 | * dev_priv->irq_lock |
1001 | */ |
1144 | */ |
1002 | struct work_struct work; |
1145 | struct work_struct work; |
1003 | bool interrupts_enabled; |
1146 | bool interrupts_enabled; |
1004 | u32 pm_iir; |
1147 | u32 pm_iir; |
1005 | 1148 | ||
1006 | /* Frequencies are stored in potentially platform dependent multiples. |
1149 | /* Frequencies are stored in potentially platform dependent multiples. |
1007 | * In other words, *_freq needs to be multiplied by X to be interesting. |
1150 | * In other words, *_freq needs to be multiplied by X to be interesting. |
1008 | * Soft limits are those which are used for the dynamic reclocking done |
1151 | * Soft limits are those which are used for the dynamic reclocking done |
1009 | * by the driver (raise frequencies under heavy loads, and lower for |
1152 | * by the driver (raise frequencies under heavy loads, and lower for |
1010 | * lighter loads). Hard limits are those imposed by the hardware. |
1153 | * lighter loads). Hard limits are those imposed by the hardware. |
1011 | * |
1154 | * |
1012 | * A distinction is made for overclocking, which is never enabled by |
1155 | * A distinction is made for overclocking, which is never enabled by |
1013 | * default, and is considered to be above the hard limit if it's |
1156 | * default, and is considered to be above the hard limit if it's |
1014 | * possible at all. |
1157 | * possible at all. |
1015 | */ |
1158 | */ |
1016 | u8 cur_freq; /* Current frequency (cached, may not == HW) */ |
1159 | u8 cur_freq; /* Current frequency (cached, may not == HW) */ |
1017 | u8 min_freq_softlimit; /* Minimum frequency permitted by the driver */ |
1160 | u8 min_freq_softlimit; /* Minimum frequency permitted by the driver */ |
1018 | u8 max_freq_softlimit; /* Max frequency permitted by the driver */ |
1161 | u8 max_freq_softlimit; /* Max frequency permitted by the driver */ |
1019 | u8 max_freq; /* Maximum frequency, RP0 if not overclocking */ |
1162 | u8 max_freq; /* Maximum frequency, RP0 if not overclocking */ |
1020 | u8 min_freq; /* AKA RPn. Minimum frequency */ |
1163 | u8 min_freq; /* AKA RPn. Minimum frequency */ |
- | 1164 | u8 idle_freq; /* Frequency to request when we are idle */ |
|
1021 | u8 efficient_freq; /* AKA RPe. Pre-determined balanced frequency */ |
1165 | u8 efficient_freq; /* AKA RPe. Pre-determined balanced frequency */ |
1022 | u8 rp1_freq; /* "less than" RP0 power/freqency */ |
1166 | u8 rp1_freq; /* "less than" RP0 power/freqency */ |
1023 | u8 rp0_freq; /* Non-overclocked max frequency. */ |
1167 | u8 rp0_freq; /* Non-overclocked max frequency. */ |
1024 | u32 cz_freq; |
- | |
1025 | 1168 | ||
- | 1169 | u8 up_threshold; /* Current %busy required to uplock */ |
|
1026 | u32 ei_interrupt_count; |
1170 | u8 down_threshold; /* Current %busy required to downclock */ |
1027 | 1171 | ||
1028 | int last_adj; |
1172 | int last_adj; |
1029 | enum { LOW_POWER, BETWEEN, HIGH_POWER } power; |
1173 | enum { LOW_POWER, BETWEEN, HIGH_POWER } power; |
- | 1174 | ||
- | 1175 | spinlock_t client_lock; |
|
- | 1176 | struct list_head clients; |
|
- | 1177 | bool client_boost; |
|
1030 | 1178 | ||
1031 | bool enabled; |
1179 | bool enabled; |
- | 1180 | struct delayed_work delayed_resume_work; |
|
- | 1181 | unsigned boosts; |
|
- | 1182 | ||
1032 | struct delayed_work delayed_resume_work; |
1183 | struct intel_rps_client semaphores, mmioflips; |
1033 | 1184 | ||
1034 | /* manual wa residency calculations */ |
1185 | /* manual wa residency calculations */ |
1035 | struct intel_rps_ei up_ei, down_ei; |
1186 | struct intel_rps_ei up_ei, down_ei; |
1036 | 1187 | ||
1037 | /* |
1188 | /* |
1038 | * Protects RPS/RC6 register access and PCU communication. |
1189 | * Protects RPS/RC6 register access and PCU communication. |
1039 | * Must be taken after struct_mutex if nested. |
1190 | * Must be taken after struct_mutex if nested. Note that |
- | 1191 | * this lock may be held for long periods of time when |
|
- | 1192 | * talking to hw - so only take it when talking to hw! |
|
1040 | */ |
1193 | */ |
1041 | struct mutex hw_lock; |
1194 | struct mutex hw_lock; |
1042 | }; |
1195 | }; |
1043 | 1196 | ||
1044 | /* defined intel_pm.c */ |
1197 | /* defined intel_pm.c */ |
1045 | extern spinlock_t mchdev_lock; |
1198 | extern spinlock_t mchdev_lock; |
1046 | 1199 | ||
1047 | struct intel_ilk_power_mgmt { |
1200 | struct intel_ilk_power_mgmt { |
1048 | u8 cur_delay; |
1201 | u8 cur_delay; |
1049 | u8 min_delay; |
1202 | u8 min_delay; |
1050 | u8 max_delay; |
1203 | u8 max_delay; |
1051 | u8 fmax; |
1204 | u8 fmax; |
1052 | u8 fstart; |
1205 | u8 fstart; |
1053 | 1206 | ||
1054 | u64 last_count1; |
1207 | u64 last_count1; |
1055 | unsigned long last_time1; |
1208 | unsigned long last_time1; |
1056 | unsigned long chipset_power; |
1209 | unsigned long chipset_power; |
1057 | u64 last_count2; |
1210 | u64 last_count2; |
1058 | u64 last_time2; |
1211 | u64 last_time2; |
1059 | unsigned long gfx_power; |
1212 | unsigned long gfx_power; |
1060 | u8 corr; |
1213 | u8 corr; |
1061 | 1214 | ||
1062 | int c_m; |
1215 | int c_m; |
1063 | int r_t; |
1216 | int r_t; |
1064 | - | ||
1065 | struct drm_i915_gem_object *pwrctx; |
- | |
1066 | struct drm_i915_gem_object *renderctx; |
- | |
1067 | }; |
1217 | }; |
1068 | 1218 | ||
1069 | struct drm_i915_private; |
1219 | struct drm_i915_private; |
1070 | struct i915_power_well; |
1220 | struct i915_power_well; |
1071 | 1221 | ||
1072 | struct i915_power_well_ops { |
1222 | struct i915_power_well_ops { |
1073 | /* |
1223 | /* |
1074 | * Synchronize the well's hw state to match the current sw state, for |
1224 | * Synchronize the well's hw state to match the current sw state, for |
1075 | * example enable/disable it based on the current refcount. Called |
1225 | * example enable/disable it based on the current refcount. Called |
1076 | * during driver init and resume time, possibly after first calling |
1226 | * during driver init and resume time, possibly after first calling |
1077 | * the enable/disable handlers. |
1227 | * the enable/disable handlers. |
1078 | */ |
1228 | */ |
1079 | void (*sync_hw)(struct drm_i915_private *dev_priv, |
1229 | void (*sync_hw)(struct drm_i915_private *dev_priv, |
1080 | struct i915_power_well *power_well); |
1230 | struct i915_power_well *power_well); |
1081 | /* |
1231 | /* |
1082 | * Enable the well and resources that depend on it (for example |
1232 | * Enable the well and resources that depend on it (for example |
1083 | * interrupts located on the well). Called after the 0->1 refcount |
1233 | * interrupts located on the well). Called after the 0->1 refcount |
1084 | * transition. |
1234 | * transition. |
1085 | */ |
1235 | */ |
1086 | void (*enable)(struct drm_i915_private *dev_priv, |
1236 | void (*enable)(struct drm_i915_private *dev_priv, |
1087 | struct i915_power_well *power_well); |
1237 | struct i915_power_well *power_well); |
1088 | /* |
1238 | /* |
1089 | * Disable the well and resources that depend on it. Called after |
1239 | * Disable the well and resources that depend on it. Called after |
1090 | * the 1->0 refcount transition. |
1240 | * the 1->0 refcount transition. |
1091 | */ |
1241 | */ |
1092 | void (*disable)(struct drm_i915_private *dev_priv, |
1242 | void (*disable)(struct drm_i915_private *dev_priv, |
1093 | struct i915_power_well *power_well); |
1243 | struct i915_power_well *power_well); |
1094 | /* Returns the hw enabled state. */ |
1244 | /* Returns the hw enabled state. */ |
1095 | bool (*is_enabled)(struct drm_i915_private *dev_priv, |
1245 | bool (*is_enabled)(struct drm_i915_private *dev_priv, |
1096 | struct i915_power_well *power_well); |
1246 | struct i915_power_well *power_well); |
1097 | }; |
1247 | }; |
1098 | 1248 | ||
1099 | /* Power well structure for haswell */ |
1249 | /* Power well structure for haswell */ |
1100 | struct i915_power_well { |
1250 | struct i915_power_well { |
1101 | const char *name; |
1251 | const char *name; |
1102 | bool always_on; |
1252 | bool always_on; |
1103 | /* power well enable/disable usage count */ |
1253 | /* power well enable/disable usage count */ |
1104 | int count; |
1254 | int count; |
1105 | /* cached hw enabled state */ |
1255 | /* cached hw enabled state */ |
1106 | bool hw_enabled; |
1256 | bool hw_enabled; |
1107 | unsigned long domains; |
1257 | unsigned long domains; |
1108 | unsigned long data; |
1258 | unsigned long data; |
1109 | const struct i915_power_well_ops *ops; |
1259 | const struct i915_power_well_ops *ops; |
1110 | }; |
1260 | }; |
1111 | 1261 | ||
1112 | struct i915_power_domains { |
1262 | struct i915_power_domains { |
1113 | /* |
1263 | /* |
1114 | * Power wells needed for initialization at driver init and suspend |
1264 | * Power wells needed for initialization at driver init and suspend |
1115 | * time are on. They are kept on until after the first modeset. |
1265 | * time are on. They are kept on until after the first modeset. |
1116 | */ |
1266 | */ |
1117 | bool init_power_on; |
1267 | bool init_power_on; |
1118 | bool initializing; |
1268 | bool initializing; |
1119 | int power_well_count; |
1269 | int power_well_count; |
1120 | 1270 | ||
1121 | struct mutex lock; |
1271 | struct mutex lock; |
1122 | int domain_use_count[POWER_DOMAIN_NUM]; |
1272 | int domain_use_count[POWER_DOMAIN_NUM]; |
1123 | struct i915_power_well *power_wells; |
1273 | struct i915_power_well *power_wells; |
1124 | }; |
1274 | }; |
1125 | 1275 | ||
1126 | #define MAX_L3_SLICES 2 |
1276 | #define MAX_L3_SLICES 2 |
1127 | struct intel_l3_parity { |
1277 | struct intel_l3_parity { |
1128 | u32 *remap_info[MAX_L3_SLICES]; |
1278 | u32 *remap_info[MAX_L3_SLICES]; |
1129 | struct work_struct error_work; |
1279 | struct work_struct error_work; |
1130 | int which_slice; |
1280 | int which_slice; |
1131 | }; |
1281 | }; |
1132 | 1282 | ||
1133 | struct i915_gem_mm { |
1283 | struct i915_gem_mm { |
1134 | /** Memory allocator for GTT stolen memory */ |
1284 | /** Memory allocator for GTT stolen memory */ |
1135 | struct drm_mm stolen; |
1285 | struct drm_mm stolen; |
- | 1286 | /** Protects the usage of the GTT stolen memory allocator. This is |
|
- | 1287 | * always the inner lock when overlapping with struct_mutex. */ |
|
- | 1288 | struct mutex stolen_lock; |
|
- | 1289 | ||
1136 | /** List of all objects in gtt_space. Used to restore gtt |
1290 | /** List of all objects in gtt_space. Used to restore gtt |
1137 | * mappings on resume */ |
1291 | * mappings on resume */ |
1138 | struct list_head bound_list; |
1292 | struct list_head bound_list; |
1139 | /** |
1293 | /** |
1140 | * List of objects which are not bound to the GTT (thus |
1294 | * List of objects which are not bound to the GTT (thus |
1141 | * are idle and not used by the GPU) but still have |
1295 | * are idle and not used by the GPU) but still have |
1142 | * (presumably uncached) pages still attached. |
1296 | * (presumably uncached) pages still attached. |
1143 | */ |
1297 | */ |
1144 | struct list_head unbound_list; |
1298 | struct list_head unbound_list; |
1145 | 1299 | ||
1146 | /** Usable portion of the GTT for GEM */ |
1300 | /** Usable portion of the GTT for GEM */ |
1147 | unsigned long stolen_base; /* limited to low memory (32-bit) */ |
1301 | unsigned long stolen_base; /* limited to low memory (32-bit) */ |
1148 | 1302 | ||
1149 | /** PPGTT used for aliasing the PPGTT with the GTT */ |
1303 | /** PPGTT used for aliasing the PPGTT with the GTT */ |
1150 | struct i915_hw_ppgtt *aliasing_ppgtt; |
1304 | struct i915_hw_ppgtt *aliasing_ppgtt; |
1151 | 1305 | ||
1152 | /** LRU list of objects with fence regs on them. */ |
1306 | /** LRU list of objects with fence regs on them. */ |
1153 | struct list_head fence_list; |
1307 | struct list_head fence_list; |
1154 | 1308 | ||
1155 | /** |
1309 | /** |
1156 | * We leave the user IRQ off as much as possible, |
1310 | * We leave the user IRQ off as much as possible, |
1157 | * but this means that requests will finish and never |
1311 | * but this means that requests will finish and never |
1158 | * be retired once the system goes idle. Set a timer to |
1312 | * be retired once the system goes idle. Set a timer to |
1159 | * fire periodically while the ring is running. When it |
1313 | * fire periodically while the ring is running. When it |
1160 | * fires, go retire requests. |
1314 | * fires, go retire requests. |
1161 | */ |
1315 | */ |
1162 | struct delayed_work retire_work; |
1316 | struct delayed_work retire_work; |
1163 | 1317 | ||
1164 | /** |
1318 | /** |
1165 | * When we detect an idle GPU, we want to turn on |
1319 | * When we detect an idle GPU, we want to turn on |
1166 | * powersaving features. So once we see that there |
1320 | * powersaving features. So once we see that there |
1167 | * are no more requests outstanding and no more |
1321 | * are no more requests outstanding and no more |
1168 | * arrive within a small period of time, we fire |
1322 | * arrive within a small period of time, we fire |
1169 | * off the idle_work. |
1323 | * off the idle_work. |
1170 | */ |
1324 | */ |
1171 | struct delayed_work idle_work; |
1325 | struct delayed_work idle_work; |
1172 | 1326 | ||
1173 | /** |
1327 | /** |
1174 | * Are we in a non-interruptible section of code like |
1328 | * Are we in a non-interruptible section of code like |
1175 | * modesetting? |
1329 | * modesetting? |
1176 | */ |
1330 | */ |
1177 | bool interruptible; |
1331 | bool interruptible; |
1178 | 1332 | ||
1179 | /** |
1333 | /** |
1180 | * Is the GPU currently considered idle, or busy executing userspace |
1334 | * Is the GPU currently considered idle, or busy executing userspace |
1181 | * requests? Whilst idle, we attempt to power down the hardware and |
1335 | * requests? Whilst idle, we attempt to power down the hardware and |
1182 | * display clocks. In order to reduce the effect on performance, there |
1336 | * display clocks. In order to reduce the effect on performance, there |
1183 | * is a slight delay before we do so. |
1337 | * is a slight delay before we do so. |
1184 | */ |
1338 | */ |
1185 | bool busy; |
1339 | bool busy; |
1186 | 1340 | ||
1187 | /* the indicator for dispatch video commands on two BSD rings */ |
1341 | /* the indicator for dispatch video commands on two BSD rings */ |
1188 | int bsd_ring_dispatch_index; |
1342 | int bsd_ring_dispatch_index; |
1189 | 1343 | ||
1190 | /** Bit 6 swizzling required for X tiling */ |
1344 | /** Bit 6 swizzling required for X tiling */ |
1191 | uint32_t bit_6_swizzle_x; |
1345 | uint32_t bit_6_swizzle_x; |
1192 | /** Bit 6 swizzling required for Y tiling */ |
1346 | /** Bit 6 swizzling required for Y tiling */ |
1193 | uint32_t bit_6_swizzle_y; |
1347 | uint32_t bit_6_swizzle_y; |
1194 | 1348 | ||
1195 | /* accounting, useful for userland debugging */ |
1349 | /* accounting, useful for userland debugging */ |
1196 | spinlock_t object_stat_lock; |
1350 | spinlock_t object_stat_lock; |
1197 | size_t object_memory; |
1351 | size_t object_memory; |
1198 | u32 object_count; |
1352 | u32 object_count; |
1199 | }; |
1353 | }; |
1200 | 1354 | ||
1201 | struct drm_i915_error_state_buf { |
1355 | struct drm_i915_error_state_buf { |
1202 | struct drm_i915_private *i915; |
1356 | struct drm_i915_private *i915; |
1203 | unsigned bytes; |
1357 | unsigned bytes; |
1204 | unsigned size; |
1358 | unsigned size; |
1205 | int err; |
1359 | int err; |
1206 | u8 *buf; |
1360 | u8 *buf; |
1207 | loff_t start; |
1361 | loff_t start; |
1208 | loff_t pos; |
1362 | loff_t pos; |
1209 | }; |
1363 | }; |
1210 | 1364 | ||
1211 | struct i915_error_state_file_priv { |
1365 | struct i915_error_state_file_priv { |
1212 | struct drm_device *dev; |
1366 | struct drm_device *dev; |
1213 | struct drm_i915_error_state *error; |
1367 | struct drm_i915_error_state *error; |
1214 | }; |
1368 | }; |
1215 | 1369 | ||
1216 | struct i915_gpu_error { |
1370 | struct i915_gpu_error { |
1217 | /* For hangcheck timer */ |
1371 | /* For hangcheck timer */ |
1218 | #define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */ |
1372 | #define DRM_I915_HANGCHECK_PERIOD 1500 /* in ms */ |
1219 | #define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD) |
1373 | #define DRM_I915_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_I915_HANGCHECK_PERIOD) |
1220 | /* Hang gpu twice in this window and your context gets banned */ |
1374 | /* Hang gpu twice in this window and your context gets banned */ |
1221 | #define DRM_I915_CTX_BAN_PERIOD DIV_ROUND_UP(8*DRM_I915_HANGCHECK_PERIOD, 1000) |
1375 | #define DRM_I915_CTX_BAN_PERIOD DIV_ROUND_UP(8*DRM_I915_HANGCHECK_PERIOD, 1000) |
- | 1376 | ||
1222 | 1377 | struct workqueue_struct *hangcheck_wq; |
|
1223 | struct timer_list hangcheck_timer; |
1378 | struct delayed_work hangcheck_work; |
1224 | 1379 | ||
1225 | /* For reset and error_state handling. */ |
1380 | /* For reset and error_state handling. */ |
1226 | spinlock_t lock; |
1381 | spinlock_t lock; |
1227 | /* Protected by the above dev->gpu_error.lock. */ |
1382 | /* Protected by the above dev->gpu_error.lock. */ |
1228 | struct drm_i915_error_state *first_error; |
1383 | struct drm_i915_error_state *first_error; |
1229 | struct work_struct work; |
- | |
1230 | - | ||
1231 | 1384 | ||
1232 | unsigned long missed_irq_rings; |
1385 | unsigned long missed_irq_rings; |
1233 | 1386 | ||
1234 | /** |
1387 | /** |
1235 | * State variable controlling the reset flow and count |
1388 | * State variable controlling the reset flow and count |
1236 | * |
1389 | * |
1237 | * This is a counter which gets incremented when reset is triggered, |
1390 | * This is a counter which gets incremented when reset is triggered, |
1238 | * and again when reset has been handled. So odd values (lowest bit set) |
1391 | * and again when reset has been handled. So odd values (lowest bit set) |
1239 | * means that reset is in progress and even values that |
1392 | * means that reset is in progress and even values that |
1240 | * (reset_counter >> 1):th reset was successfully completed. |
1393 | * (reset_counter >> 1):th reset was successfully completed. |
1241 | * |
1394 | * |
1242 | * If reset is not completed succesfully, the I915_WEDGE bit is |
1395 | * If reset is not completed succesfully, the I915_WEDGE bit is |
1243 | * set meaning that hardware is terminally sour and there is no |
1396 | * set meaning that hardware is terminally sour and there is no |
1244 | * recovery. All waiters on the reset_queue will be woken when |
1397 | * recovery. All waiters on the reset_queue will be woken when |
1245 | * that happens. |
1398 | * that happens. |
1246 | * |
1399 | * |
1247 | * This counter is used by the wait_seqno code to notice that reset |
1400 | * This counter is used by the wait_seqno code to notice that reset |
1248 | * event happened and it needs to restart the entire ioctl (since most |
1401 | * event happened and it needs to restart the entire ioctl (since most |
1249 | * likely the seqno it waited for won't ever signal anytime soon). |
1402 | * likely the seqno it waited for won't ever signal anytime soon). |
1250 | * |
1403 | * |
1251 | * This is important for lock-free wait paths, where no contended lock |
1404 | * This is important for lock-free wait paths, where no contended lock |
1252 | * naturally enforces the correct ordering between the bail-out of the |
1405 | * naturally enforces the correct ordering between the bail-out of the |
1253 | * waiter and the gpu reset work code. |
1406 | * waiter and the gpu reset work code. |
1254 | */ |
1407 | */ |
1255 | atomic_t reset_counter; |
1408 | atomic_t reset_counter; |
1256 | 1409 | ||
1257 | #define I915_RESET_IN_PROGRESS_FLAG 1 |
1410 | #define I915_RESET_IN_PROGRESS_FLAG 1 |
1258 | #define I915_WEDGED (1 << 31) |
1411 | #define I915_WEDGED (1 << 31) |
1259 | 1412 | ||
1260 | /** |
1413 | /** |
1261 | * Waitqueue to signal when the reset has completed. Used by clients |
1414 | * Waitqueue to signal when the reset has completed. Used by clients |
1262 | * that wait for dev_priv->mm.wedged to settle. |
1415 | * that wait for dev_priv->mm.wedged to settle. |
1263 | */ |
1416 | */ |
1264 | wait_queue_head_t reset_queue; |
1417 | wait_queue_head_t reset_queue; |
1265 | 1418 | ||
1266 | /* Userspace knobs for gpu hang simulation; |
1419 | /* Userspace knobs for gpu hang simulation; |
1267 | * combines both a ring mask, and extra flags |
1420 | * combines both a ring mask, and extra flags |
1268 | */ |
1421 | */ |
1269 | u32 stop_rings; |
1422 | u32 stop_rings; |
1270 | #define I915_STOP_RING_ALLOW_BAN (1 << 31) |
1423 | #define I915_STOP_RING_ALLOW_BAN (1 << 31) |
1271 | #define I915_STOP_RING_ALLOW_WARN (1 << 30) |
1424 | #define I915_STOP_RING_ALLOW_WARN (1 << 30) |
1272 | 1425 | ||
1273 | /* For missed irq/seqno simulation. */ |
1426 | /* For missed irq/seqno simulation. */ |
1274 | unsigned int test_irq_rings; |
1427 | unsigned int test_irq_rings; |
1275 | 1428 | ||
1276 | /* Used to prevent gem_check_wedged returning -EAGAIN during gpu reset */ |
1429 | /* Used to prevent gem_check_wedged returning -EAGAIN during gpu reset */ |
1277 | bool reload_in_reset; |
1430 | bool reload_in_reset; |
1278 | }; |
1431 | }; |
1279 | 1432 | ||
1280 | enum modeset_restore { |
1433 | enum modeset_restore { |
1281 | MODESET_ON_LID_OPEN, |
1434 | MODESET_ON_LID_OPEN, |
1282 | MODESET_DONE, |
1435 | MODESET_DONE, |
1283 | MODESET_SUSPENDED, |
1436 | MODESET_SUSPENDED, |
1284 | }; |
1437 | }; |
- | 1438 | ||
- | 1439 | #define DP_AUX_A 0x40 |
|
- | 1440 | #define DP_AUX_B 0x10 |
|
- | 1441 | #define DP_AUX_C 0x20 |
|
- | 1442 | #define DP_AUX_D 0x30 |
|
- | 1443 | ||
- | 1444 | #define DDC_PIN_B 0x05 |
|
- | 1445 | #define DDC_PIN_C 0x04 |
|
- | 1446 | #define DDC_PIN_D 0x06 |
|
1285 | 1447 | ||
1286 | struct ddi_vbt_port_info { |
1448 | struct ddi_vbt_port_info { |
1287 | /* |
1449 | /* |
1288 | * This is an index in the HDMI/DVI DDI buffer translation table. |
1450 | * This is an index in the HDMI/DVI DDI buffer translation table. |
1289 | * The special value HDMI_LEVEL_SHIFT_UNKNOWN means the VBT didn't |
1451 | * The special value HDMI_LEVEL_SHIFT_UNKNOWN means the VBT didn't |
1290 | * populate this field. |
1452 | * populate this field. |
1291 | */ |
1453 | */ |
1292 | #define HDMI_LEVEL_SHIFT_UNKNOWN 0xff |
1454 | #define HDMI_LEVEL_SHIFT_UNKNOWN 0xff |
1293 | uint8_t hdmi_level_shift; |
1455 | uint8_t hdmi_level_shift; |
1294 | 1456 | ||
1295 | uint8_t supports_dvi:1; |
1457 | uint8_t supports_dvi:1; |
1296 | uint8_t supports_hdmi:1; |
1458 | uint8_t supports_hdmi:1; |
1297 | uint8_t supports_dp:1; |
1459 | uint8_t supports_dp:1; |
- | 1460 | ||
- | 1461 | uint8_t alternate_aux_channel; |
|
- | 1462 | uint8_t alternate_ddc_pin; |
|
- | 1463 | ||
- | 1464 | uint8_t dp_boost_level; |
|
- | 1465 | uint8_t hdmi_boost_level; |
|
1298 | }; |
1466 | }; |
1299 | 1467 | ||
1300 | enum drrs_support_type { |
1468 | enum psr_lines_to_wait { |
1301 | DRRS_NOT_SUPPORTED = 0, |
1469 | PSR_0_LINES_TO_WAIT = 0, |
1302 | STATIC_DRRS_SUPPORT = 1, |
1470 | PSR_1_LINE_TO_WAIT, |
- | 1471 | PSR_4_LINES_TO_WAIT, |
|
1303 | SEAMLESS_DRRS_SUPPORT = 2 |
1472 | PSR_8_LINES_TO_WAIT |
1304 | }; |
1473 | }; |
1305 | 1474 | ||
1306 | struct intel_vbt_data { |
1475 | struct intel_vbt_data { |
1307 | struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ |
1476 | struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */ |
1308 | struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ |
1477 | struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */ |
1309 | 1478 | ||
1310 | /* Feature bits */ |
1479 | /* Feature bits */ |
1311 | unsigned int int_tv_support:1; |
1480 | unsigned int int_tv_support:1; |
1312 | unsigned int lvds_dither:1; |
1481 | unsigned int lvds_dither:1; |
1313 | unsigned int lvds_vbt:1; |
1482 | unsigned int lvds_vbt:1; |
1314 | unsigned int int_crt_support:1; |
1483 | unsigned int int_crt_support:1; |
1315 | unsigned int lvds_use_ssc:1; |
1484 | unsigned int lvds_use_ssc:1; |
1316 | unsigned int display_clock_mode:1; |
1485 | unsigned int display_clock_mode:1; |
1317 | unsigned int fdi_rx_polarity_inverted:1; |
1486 | unsigned int fdi_rx_polarity_inverted:1; |
1318 | unsigned int has_mipi:1; |
1487 | unsigned int has_mipi:1; |
1319 | int lvds_ssc_freq; |
1488 | int lvds_ssc_freq; |
1320 | unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */ |
1489 | unsigned int bios_lvds_val; /* initial [PCH_]LVDS reg val in VBIOS */ |
1321 | 1490 | ||
1322 | enum drrs_support_type drrs_type; |
1491 | enum drrs_support_type drrs_type; |
1323 | 1492 | ||
1324 | /* eDP */ |
1493 | /* eDP */ |
1325 | int edp_rate; |
1494 | int edp_rate; |
1326 | int edp_lanes; |
1495 | int edp_lanes; |
1327 | int edp_preemphasis; |
1496 | int edp_preemphasis; |
1328 | int edp_vswing; |
1497 | int edp_vswing; |
1329 | bool edp_initialized; |
1498 | bool edp_initialized; |
1330 | bool edp_support; |
1499 | bool edp_support; |
1331 | int edp_bpp; |
1500 | int edp_bpp; |
1332 | struct edp_power_seq edp_pps; |
1501 | struct edp_power_seq edp_pps; |
1333 | 1502 | ||
1334 | struct { |
1503 | struct { |
- | 1504 | bool full_link; |
|
- | 1505 | bool require_aux_wakeup; |
|
- | 1506 | int idle_frames; |
|
- | 1507 | enum psr_lines_to_wait lines_to_wait; |
|
- | 1508 | int tp1_wakeup_time; |
|
- | 1509 | int tp2_tp3_wakeup_time; |
|
- | 1510 | } psr; |
|
- | 1511 | ||
- | 1512 | struct { |
|
1335 | u16 pwm_freq_hz; |
1513 | u16 pwm_freq_hz; |
1336 | bool present; |
1514 | bool present; |
1337 | bool active_low_pwm; |
1515 | bool active_low_pwm; |
1338 | u8 min_brightness; /* min_brightness/255 of max */ |
1516 | u8 min_brightness; /* min_brightness/255 of max */ |
1339 | } backlight; |
1517 | } backlight; |
1340 | 1518 | ||
1341 | /* MIPI DSI */ |
1519 | /* MIPI DSI */ |
1342 | struct { |
1520 | struct { |
1343 | u16 port; |
1521 | u16 port; |
1344 | u16 panel_id; |
1522 | u16 panel_id; |
1345 | struct mipi_config *config; |
1523 | struct mipi_config *config; |
1346 | struct mipi_pps_data *pps; |
1524 | struct mipi_pps_data *pps; |
1347 | u8 seq_version; |
1525 | u8 seq_version; |
1348 | u32 size; |
1526 | u32 size; |
1349 | u8 *data; |
1527 | u8 *data; |
1350 | u8 *sequence[MIPI_SEQ_MAX]; |
1528 | u8 *sequence[MIPI_SEQ_MAX]; |
1351 | } dsi; |
1529 | } dsi; |
1352 | 1530 | ||
1353 | int crt_ddc_pin; |
1531 | int crt_ddc_pin; |
1354 | 1532 | ||
1355 | int child_dev_num; |
1533 | int child_dev_num; |
1356 | union child_device_config *child_dev; |
1534 | union child_device_config *child_dev; |
1357 | 1535 | ||
1358 | struct ddi_vbt_port_info ddi_port_info[I915_MAX_PORTS]; |
1536 | struct ddi_vbt_port_info ddi_port_info[I915_MAX_PORTS]; |
1359 | }; |
1537 | }; |
1360 | 1538 | ||
1361 | enum intel_ddb_partitioning { |
1539 | enum intel_ddb_partitioning { |
1362 | INTEL_DDB_PART_1_2, |
1540 | INTEL_DDB_PART_1_2, |
1363 | INTEL_DDB_PART_5_6, /* IVB+ */ |
1541 | INTEL_DDB_PART_5_6, /* IVB+ */ |
1364 | }; |
1542 | }; |
1365 | 1543 | ||
1366 | struct intel_wm_level { |
1544 | struct intel_wm_level { |
1367 | bool enable; |
1545 | bool enable; |
1368 | uint32_t pri_val; |
1546 | uint32_t pri_val; |
1369 | uint32_t spr_val; |
1547 | uint32_t spr_val; |
1370 | uint32_t cur_val; |
1548 | uint32_t cur_val; |
1371 | uint32_t fbc_val; |
1549 | uint32_t fbc_val; |
1372 | }; |
1550 | }; |
1373 | 1551 | ||
1374 | struct ilk_wm_values { |
1552 | struct ilk_wm_values { |
1375 | uint32_t wm_pipe[3]; |
1553 | uint32_t wm_pipe[3]; |
1376 | uint32_t wm_lp[3]; |
1554 | uint32_t wm_lp[3]; |
1377 | uint32_t wm_lp_spr[3]; |
1555 | uint32_t wm_lp_spr[3]; |
1378 | uint32_t wm_linetime[3]; |
1556 | uint32_t wm_linetime[3]; |
1379 | bool enable_fbc_wm; |
1557 | bool enable_fbc_wm; |
1380 | enum intel_ddb_partitioning partitioning; |
1558 | enum intel_ddb_partitioning partitioning; |
1381 | }; |
1559 | }; |
- | 1560 | ||
- | 1561 | struct vlv_pipe_wm { |
|
- | 1562 | uint16_t primary; |
|
- | 1563 | uint16_t sprite[2]; |
|
- | 1564 | uint8_t cursor; |
|
- | 1565 | }; |
|
- | 1566 | ||
- | 1567 | struct vlv_sr_wm { |
|
- | 1568 | uint16_t plane; |
|
- | 1569 | uint8_t cursor; |
|
- | 1570 | }; |
|
- | 1571 | ||
- | 1572 | struct vlv_wm_values { |
|
- | 1573 | struct vlv_pipe_wm pipe[3]; |
|
- | 1574 | struct vlv_sr_wm sr; |
|
- | 1575 | struct { |
|
- | 1576 | uint8_t cursor; |
|
- | 1577 | uint8_t sprite[2]; |
|
- | 1578 | uint8_t primary; |
|
- | 1579 | } ddl[3]; |
|
- | 1580 | uint8_t level; |
|
- | 1581 | bool cxsr; |
|
- | 1582 | }; |
|
1382 | 1583 | ||
1383 | struct skl_ddb_entry { |
1584 | struct skl_ddb_entry { |
1384 | uint16_t start, end; /* in number of blocks, 'end' is exclusive */ |
1585 | uint16_t start, end; /* in number of blocks, 'end' is exclusive */ |
1385 | }; |
1586 | }; |
1386 | 1587 | ||
1387 | static inline uint16_t skl_ddb_entry_size(const struct skl_ddb_entry *entry) |
1588 | static inline uint16_t skl_ddb_entry_size(const struct skl_ddb_entry *entry) |
1388 | { |
1589 | { |
1389 | return entry->end - entry->start; |
1590 | return entry->end - entry->start; |
1390 | } |
1591 | } |
1391 | 1592 | ||
1392 | static inline bool skl_ddb_entry_equal(const struct skl_ddb_entry *e1, |
1593 | static inline bool skl_ddb_entry_equal(const struct skl_ddb_entry *e1, |
1393 | const struct skl_ddb_entry *e2) |
1594 | const struct skl_ddb_entry *e2) |
1394 | { |
1595 | { |
1395 | if (e1->start == e2->start && e1->end == e2->end) |
1596 | if (e1->start == e2->start && e1->end == e2->end) |
1396 | return true; |
1597 | return true; |
1397 | 1598 | ||
1398 | return false; |
1599 | return false; |
1399 | } |
1600 | } |
1400 | 1601 | ||
1401 | struct skl_ddb_allocation { |
1602 | struct skl_ddb_allocation { |
1402 | struct skl_ddb_entry pipe[I915_MAX_PIPES]; |
1603 | struct skl_ddb_entry pipe[I915_MAX_PIPES]; |
1403 | struct skl_ddb_entry plane[I915_MAX_PIPES][I915_MAX_PLANES]; |
1604 | struct skl_ddb_entry plane[I915_MAX_PIPES][I915_MAX_PLANES]; /* packed/uv */ |
1404 | struct skl_ddb_entry cursor[I915_MAX_PIPES]; |
1605 | struct skl_ddb_entry y_plane[I915_MAX_PIPES][I915_MAX_PLANES]; |
1405 | }; |
1606 | }; |
1406 | 1607 | ||
1407 | struct skl_wm_values { |
1608 | struct skl_wm_values { |
1408 | bool dirty[I915_MAX_PIPES]; |
1609 | bool dirty[I915_MAX_PIPES]; |
1409 | struct skl_ddb_allocation ddb; |
1610 | struct skl_ddb_allocation ddb; |
1410 | uint32_t wm_linetime[I915_MAX_PIPES]; |
1611 | uint32_t wm_linetime[I915_MAX_PIPES]; |
1411 | uint32_t plane[I915_MAX_PIPES][I915_MAX_PLANES][8]; |
1612 | uint32_t plane[I915_MAX_PIPES][I915_MAX_PLANES][8]; |
1412 | uint32_t cursor[I915_MAX_PIPES][8]; |
- | |
1413 | uint32_t plane_trans[I915_MAX_PIPES][I915_MAX_PLANES]; |
1613 | uint32_t plane_trans[I915_MAX_PIPES][I915_MAX_PLANES]; |
1414 | uint32_t cursor_trans[I915_MAX_PIPES]; |
- | |
1415 | }; |
1614 | }; |
1416 | 1615 | ||
1417 | struct skl_wm_level { |
1616 | struct skl_wm_level { |
1418 | bool plane_en[I915_MAX_PLANES]; |
1617 | bool plane_en[I915_MAX_PLANES]; |
1419 | bool cursor_en; |
- | |
1420 | uint16_t plane_res_b[I915_MAX_PLANES]; |
1618 | uint16_t plane_res_b[I915_MAX_PLANES]; |
1421 | uint8_t plane_res_l[I915_MAX_PLANES]; |
1619 | uint8_t plane_res_l[I915_MAX_PLANES]; |
1422 | uint16_t cursor_res_b; |
- | |
1423 | uint8_t cursor_res_l; |
- | |
1424 | }; |
1620 | }; |
1425 | 1621 | ||
1426 | /* |
1622 | /* |
1427 | * This struct helps tracking the state needed for runtime PM, which puts the |
1623 | * This struct helps tracking the state needed for runtime PM, which puts the |
1428 | * device in PCI D3 state. Notice that when this happens, nothing on the |
1624 | * device in PCI D3 state. Notice that when this happens, nothing on the |
1429 | * graphics device works, even register access, so we don't get interrupts nor |
1625 | * graphics device works, even register access, so we don't get interrupts nor |
1430 | * anything else. |
1626 | * anything else. |
1431 | * |
1627 | * |
1432 | * Every piece of our code that needs to actually touch the hardware needs to |
1628 | * Every piece of our code that needs to actually touch the hardware needs to |
1433 | * either call intel_runtime_pm_get or call intel_display_power_get with the |
1629 | * either call intel_runtime_pm_get or call intel_display_power_get with the |
1434 | * appropriate power domain. |
1630 | * appropriate power domain. |
1435 | * |
1631 | * |
1436 | * Our driver uses the autosuspend delay feature, which means we'll only really |
1632 | * Our driver uses the autosuspend delay feature, which means we'll only really |
1437 | * suspend if we stay with zero refcount for a certain amount of time. The |
1633 | * suspend if we stay with zero refcount for a certain amount of time. The |
1438 | * default value is currently very conservative (see intel_runtime_pm_enable), but |
1634 | * default value is currently very conservative (see intel_runtime_pm_enable), but |
1439 | * it can be changed with the standard runtime PM files from sysfs. |
1635 | * it can be changed with the standard runtime PM files from sysfs. |
1440 | * |
1636 | * |
1441 | * The irqs_disabled variable becomes true exactly after we disable the IRQs and |
1637 | * The irqs_disabled variable becomes true exactly after we disable the IRQs and |
1442 | * goes back to false exactly before we reenable the IRQs. We use this variable |
1638 | * goes back to false exactly before we reenable the IRQs. We use this variable |
1443 | * to check if someone is trying to enable/disable IRQs while they're supposed |
1639 | * to check if someone is trying to enable/disable IRQs while they're supposed |
1444 | * to be disabled. This shouldn't happen and we'll print some error messages in |
1640 | * to be disabled. This shouldn't happen and we'll print some error messages in |
1445 | * case it happens. |
1641 | * case it happens. |
1446 | * |
1642 | * |
1447 | * For more, read the Documentation/power/runtime_pm.txt. |
1643 | * For more, read the Documentation/power/runtime_pm.txt. |
1448 | */ |
1644 | */ |
1449 | struct i915_runtime_pm { |
1645 | struct i915_runtime_pm { |
1450 | bool suspended; |
1646 | bool suspended; |
1451 | bool irqs_enabled; |
1647 | bool irqs_enabled; |
1452 | }; |
1648 | }; |
1453 | 1649 | ||
1454 | enum intel_pipe_crc_source { |
1650 | enum intel_pipe_crc_source { |
1455 | INTEL_PIPE_CRC_SOURCE_NONE, |
1651 | INTEL_PIPE_CRC_SOURCE_NONE, |
1456 | INTEL_PIPE_CRC_SOURCE_PLANE1, |
1652 | INTEL_PIPE_CRC_SOURCE_PLANE1, |
1457 | INTEL_PIPE_CRC_SOURCE_PLANE2, |
1653 | INTEL_PIPE_CRC_SOURCE_PLANE2, |
1458 | INTEL_PIPE_CRC_SOURCE_PF, |
1654 | INTEL_PIPE_CRC_SOURCE_PF, |
1459 | INTEL_PIPE_CRC_SOURCE_PIPE, |
1655 | INTEL_PIPE_CRC_SOURCE_PIPE, |
1460 | /* TV/DP on pre-gen5/vlv can't use the pipe source. */ |
1656 | /* TV/DP on pre-gen5/vlv can't use the pipe source. */ |
1461 | INTEL_PIPE_CRC_SOURCE_TV, |
1657 | INTEL_PIPE_CRC_SOURCE_TV, |
1462 | INTEL_PIPE_CRC_SOURCE_DP_B, |
1658 | INTEL_PIPE_CRC_SOURCE_DP_B, |
1463 | INTEL_PIPE_CRC_SOURCE_DP_C, |
1659 | INTEL_PIPE_CRC_SOURCE_DP_C, |
1464 | INTEL_PIPE_CRC_SOURCE_DP_D, |
1660 | INTEL_PIPE_CRC_SOURCE_DP_D, |
1465 | INTEL_PIPE_CRC_SOURCE_AUTO, |
1661 | INTEL_PIPE_CRC_SOURCE_AUTO, |
1466 | INTEL_PIPE_CRC_SOURCE_MAX, |
1662 | INTEL_PIPE_CRC_SOURCE_MAX, |
1467 | }; |
1663 | }; |
1468 | 1664 | ||
1469 | struct intel_pipe_crc_entry { |
1665 | struct intel_pipe_crc_entry { |
1470 | uint32_t frame; |
1666 | uint32_t frame; |
1471 | uint32_t crc[5]; |
1667 | uint32_t crc[5]; |
1472 | }; |
1668 | }; |
1473 | 1669 | ||
1474 | #define INTEL_PIPE_CRC_ENTRIES_NR 128 |
1670 | #define INTEL_PIPE_CRC_ENTRIES_NR 128 |
1475 | struct intel_pipe_crc { |
1671 | struct intel_pipe_crc { |
1476 | spinlock_t lock; |
1672 | spinlock_t lock; |
1477 | bool opened; /* exclusive access to the result file */ |
1673 | bool opened; /* exclusive access to the result file */ |
1478 | struct intel_pipe_crc_entry *entries; |
1674 | struct intel_pipe_crc_entry *entries; |
1479 | enum intel_pipe_crc_source source; |
1675 | enum intel_pipe_crc_source source; |
1480 | int head, tail; |
1676 | int head, tail; |
1481 | wait_queue_head_t wq; |
1677 | wait_queue_head_t wq; |
1482 | }; |
1678 | }; |
1483 | 1679 | ||
1484 | struct i915_frontbuffer_tracking { |
1680 | struct i915_frontbuffer_tracking { |
1485 | struct mutex lock; |
1681 | struct mutex lock; |
1486 | 1682 | ||
1487 | /* |
1683 | /* |
1488 | * Tracking bits for delayed frontbuffer flushing du to gpu activity or |
1684 | * Tracking bits for delayed frontbuffer flushing du to gpu activity or |
1489 | * scheduled flips. |
1685 | * scheduled flips. |
1490 | */ |
1686 | */ |
1491 | unsigned busy_bits; |
1687 | unsigned busy_bits; |
1492 | unsigned flip_bits; |
1688 | unsigned flip_bits; |
1493 | }; |
1689 | }; |
1494 | 1690 | ||
1495 | struct i915_wa_reg { |
1691 | struct i915_wa_reg { |
1496 | u32 addr; |
1692 | u32 addr; |
1497 | u32 value; |
1693 | u32 value; |
1498 | /* bitmask representing WA bits */ |
1694 | /* bitmask representing WA bits */ |
1499 | u32 mask; |
1695 | u32 mask; |
1500 | }; |
1696 | }; |
1501 | 1697 | ||
1502 | #define I915_MAX_WA_REGS 16 |
1698 | #define I915_MAX_WA_REGS 16 |
1503 | 1699 | ||
1504 | struct i915_workarounds { |
1700 | struct i915_workarounds { |
1505 | struct i915_wa_reg reg[I915_MAX_WA_REGS]; |
1701 | struct i915_wa_reg reg[I915_MAX_WA_REGS]; |
1506 | u32 count; |
1702 | u32 count; |
1507 | }; |
1703 | }; |
- | 1704 | ||
- | 1705 | struct i915_virtual_gpu { |
|
- | 1706 | bool active; |
|
- | 1707 | }; |
|
- | 1708 | ||
- | 1709 | struct i915_execbuffer_params { |
|
- | 1710 | struct drm_device *dev; |
|
- | 1711 | struct drm_file *file; |
|
- | 1712 | uint32_t dispatch_flags; |
|
- | 1713 | uint32_t args_batch_start_offset; |
|
- | 1714 | uint64_t batch_obj_vm_offset; |
|
- | 1715 | struct intel_engine_cs *ring; |
|
- | 1716 | struct drm_i915_gem_object *batch_obj; |
|
- | 1717 | struct intel_context *ctx; |
|
- | 1718 | struct drm_i915_gem_request *request; |
|
- | 1719 | }; |
|
1508 | 1720 | ||
1509 | struct drm_i915_private { |
1721 | struct drm_i915_private { |
- | 1722 | struct drm_device *dev; |
|
- | 1723 | struct kmem_cache *objects; |
|
- | 1724 | struct kmem_cache *vmas; |
|
1510 | struct drm_device *dev; |
1725 | struct kmem_cache *requests; |
1511 | 1726 | ||
1512 | const struct intel_device_info info; |
1727 | const struct intel_device_info info; |
1513 | 1728 | ||
1514 | int relative_constants_mode; |
1729 | int relative_constants_mode; |
1515 | 1730 | ||
1516 | void __iomem *regs; |
1731 | void __iomem *regs; |
1517 | 1732 | ||
1518 | struct intel_uncore uncore; |
1733 | struct intel_uncore uncore; |
1519 | 1734 | ||
- | 1735 | struct i915_virtual_gpu vgpu; |
|
- | 1736 | ||
- | 1737 | struct intel_guc guc; |
|
- | 1738 | ||
- | 1739 | struct intel_csr csr; |
|
- | 1740 | ||
- | 1741 | /* Display CSR-related protection */ |
|
- | 1742 | struct mutex csr_lock; |
|
1520 | struct intel_gmbus gmbus[GMBUS_NUM_PORTS]; |
1743 | |
1521 | 1744 | struct intel_gmbus gmbus[GMBUS_NUM_PINS]; |
|
1522 | 1745 | ||
1523 | /** gmbus_mutex protects against concurrent usage of the single hw gmbus |
1746 | /** gmbus_mutex protects against concurrent usage of the single hw gmbus |
1524 | * controller on different i2c buses. */ |
1747 | * controller on different i2c buses. */ |
1525 | struct mutex gmbus_mutex; |
1748 | struct mutex gmbus_mutex; |
1526 | 1749 | ||
1527 | /** |
1750 | /** |
1528 | * Base address of the gmbus and gpio block. |
1751 | * Base address of the gmbus and gpio block. |
1529 | */ |
1752 | */ |
1530 | uint32_t gpio_mmio_base; |
1753 | uint32_t gpio_mmio_base; |
1531 | 1754 | ||
1532 | /* MMIO base address for MIPI regs */ |
1755 | /* MMIO base address for MIPI regs */ |
1533 | uint32_t mipi_mmio_base; |
1756 | uint32_t mipi_mmio_base; |
1534 | 1757 | ||
1535 | wait_queue_head_t gmbus_wait_queue; |
1758 | wait_queue_head_t gmbus_wait_queue; |
1536 | 1759 | ||
1537 | struct pci_dev *bridge_dev; |
1760 | struct pci_dev *bridge_dev; |
1538 | struct intel_engine_cs ring[I915_NUM_RINGS]; |
1761 | struct intel_engine_cs ring[I915_NUM_RINGS]; |
1539 | struct drm_i915_gem_object *semaphore_obj; |
1762 | struct drm_i915_gem_object *semaphore_obj; |
1540 | uint32_t last_seqno, next_seqno; |
1763 | uint32_t last_seqno, next_seqno; |
1541 | 1764 | ||
1542 | struct drm_dma_handle *status_page_dmah; |
1765 | struct drm_dma_handle *status_page_dmah; |
1543 | struct resource mch_res; |
1766 | struct resource mch_res; |
1544 | 1767 | ||
1545 | /* protects the irq masks */ |
1768 | /* protects the irq masks */ |
1546 | spinlock_t irq_lock; |
1769 | spinlock_t irq_lock; |
1547 | 1770 | ||
1548 | /* protects the mmio flip data */ |
1771 | /* protects the mmio flip data */ |
1549 | spinlock_t mmio_flip_lock; |
1772 | spinlock_t mmio_flip_lock; |
1550 | 1773 | ||
1551 | bool display_irqs_enabled; |
1774 | bool display_irqs_enabled; |
1552 | - | ||
1553 | /* To control wakeup latency, e.g. for irq-driven dp aux transfers. */ |
- | |
1554 | // struct pm_qos_request pm_qos; |
1775 | |
1555 | 1776 | ||
1556 | /* DPIO indirect register protection */ |
1777 | /* Sideband mailbox protection */ |
1557 | struct mutex dpio_lock; |
1778 | struct mutex sb_lock; |
1558 | 1779 | ||
1559 | /** Cached value of IMR to avoid reads in updating the bitfield */ |
1780 | /** Cached value of IMR to avoid reads in updating the bitfield */ |
1560 | union { |
1781 | union { |
1561 | u32 irq_mask; |
1782 | u32 irq_mask; |
1562 | u32 de_irq_mask[I915_MAX_PIPES]; |
1783 | u32 de_irq_mask[I915_MAX_PIPES]; |
1563 | }; |
1784 | }; |
1564 | u32 gt_irq_mask; |
1785 | u32 gt_irq_mask; |
1565 | u32 pm_irq_mask; |
1786 | u32 pm_irq_mask; |
1566 | u32 pm_rps_events; |
1787 | u32 pm_rps_events; |
1567 | u32 pipestat_irq_mask[I915_MAX_PIPES]; |
1788 | u32 pipestat_irq_mask[I915_MAX_PIPES]; |
1568 | 1789 | ||
1569 | struct work_struct hotplug_work; |
- | |
1570 | struct { |
- | |
1571 | unsigned long hpd_last_jiffies; |
- | |
1572 | int hpd_cnt; |
- | |
1573 | enum { |
- | |
1574 | HPD_ENABLED = 0, |
- | |
1575 | HPD_DISABLED = 1, |
- | |
1576 | HPD_MARK_DISABLED = 2 |
- | |
1577 | } hpd_mark; |
- | |
1578 | } hpd_stats[HPD_NUM_PINS]; |
- | |
1579 | u32 hpd_event_bits; |
- | |
1580 | struct delayed_work hotplug_reenable_work; |
- | |
1581 | 1790 | struct i915_hotplug hotplug; |
|
1582 | struct i915_fbc fbc; |
1791 | struct i915_fbc fbc; |
1583 | struct i915_drrs drrs; |
1792 | struct i915_drrs drrs; |
1584 | struct intel_opregion opregion; |
1793 | struct intel_opregion opregion; |
1585 | struct intel_vbt_data vbt; |
1794 | struct intel_vbt_data vbt; |
1586 | 1795 | ||
1587 | bool preserve_bios_swizzle; |
1796 | bool preserve_bios_swizzle; |
1588 | 1797 | ||
1589 | /* overlay */ |
1798 | /* overlay */ |
1590 | struct intel_overlay *overlay; |
1799 | struct intel_overlay *overlay; |
1591 | 1800 | ||
1592 | /* backlight registers and fields in struct intel_panel */ |
1801 | /* backlight registers and fields in struct intel_panel */ |
1593 | struct mutex backlight_lock; |
1802 | struct mutex backlight_lock; |
1594 | 1803 | ||
1595 | /* LVDS info */ |
1804 | /* LVDS info */ |
1596 | bool no_aux_handshake; |
1805 | bool no_aux_handshake; |
1597 | 1806 | ||
1598 | /* protects panel power sequencer state */ |
1807 | /* protects panel power sequencer state */ |
1599 | struct mutex pps_mutex; |
1808 | struct mutex pps_mutex; |
1600 | 1809 | ||
1601 | struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */ |
1810 | struct drm_i915_fence_reg fence_regs[I915_MAX_NUM_FENCES]; /* assume 965 */ |
1602 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ |
- | |
1603 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ |
1811 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ |
1604 | 1812 | ||
1605 | unsigned int fsb_freq, mem_freq, is_ddr3; |
1813 | unsigned int fsb_freq, mem_freq, is_ddr3; |
- | 1814 | unsigned int skl_boot_cdclk; |
|
- | 1815 | unsigned int cdclk_freq, max_cdclk_freq; |
|
1606 | unsigned int vlv_cdclk_freq; |
1816 | unsigned int max_dotclk_freq; |
1607 | unsigned int hpll_freq; |
1817 | unsigned int hpll_freq; |
- | 1818 | unsigned int czclk_freq; |
|
1608 | 1819 | ||
1609 | /** |
1820 | /** |
1610 | * wq - Driver workqueue for GEM. |
1821 | * wq - Driver workqueue for GEM. |
1611 | * |
1822 | * |
1612 | * NOTE: Work items scheduled here are not allowed to grab any modeset |
1823 | * NOTE: Work items scheduled here are not allowed to grab any modeset |
1613 | * locks, for otherwise the flushing done in the pageflip code will |
1824 | * locks, for otherwise the flushing done in the pageflip code will |
1614 | * result in deadlocks. |
1825 | * result in deadlocks. |
1615 | */ |
1826 | */ |
1616 | struct workqueue_struct *wq; |
1827 | struct workqueue_struct *wq; |
1617 | 1828 | ||
1618 | /* Display functions */ |
1829 | /* Display functions */ |
1619 | struct drm_i915_display_funcs display; |
1830 | struct drm_i915_display_funcs display; |
1620 | 1831 | ||
1621 | /* PCH chipset type */ |
1832 | /* PCH chipset type */ |
1622 | enum intel_pch pch_type; |
1833 | enum intel_pch pch_type; |
1623 | unsigned short pch_id; |
1834 | unsigned short pch_id; |
1624 | 1835 | ||
1625 | unsigned long quirks; |
1836 | unsigned long quirks; |
1626 | 1837 | ||
1627 | enum modeset_restore modeset_restore; |
1838 | enum modeset_restore modeset_restore; |
1628 | struct mutex modeset_restore_lock; |
1839 | struct mutex modeset_restore_lock; |
1629 | 1840 | ||
1630 | struct list_head vm_list; /* Global list of all address spaces */ |
1841 | struct list_head vm_list; /* Global list of all address spaces */ |
1631 | struct i915_gtt gtt; /* VM representing the global address space */ |
1842 | struct i915_gtt gtt; /* VM representing the global address space */ |
1632 | 1843 | ||
1633 | struct i915_gem_mm mm; |
1844 | struct i915_gem_mm mm; |
1634 | DECLARE_HASHTABLE(mm_structs, 7); |
1845 | DECLARE_HASHTABLE(mm_structs, 7); |
1635 | struct mutex mm_lock; |
1846 | struct mutex mm_lock; |
1636 | 1847 | ||
1637 | /* Kernel Modesetting */ |
1848 | /* Kernel Modesetting */ |
1638 | 1849 | ||
1639 | struct sdvo_device_mapping sdvo_mappings[2]; |
1850 | struct sdvo_device_mapping sdvo_mappings[2]; |
1640 | 1851 | ||
1641 | struct drm_crtc *plane_to_crtc_mapping[I915_MAX_PIPES]; |
1852 | struct drm_crtc *plane_to_crtc_mapping[I915_MAX_PIPES]; |
1642 | struct drm_crtc *pipe_to_crtc_mapping[I915_MAX_PIPES]; |
1853 | struct drm_crtc *pipe_to_crtc_mapping[I915_MAX_PIPES]; |
1643 | wait_queue_head_t pending_flip_queue; |
1854 | wait_queue_head_t pending_flip_queue; |
1644 | 1855 | ||
1645 | #ifdef CONFIG_DEBUG_FS |
1856 | #ifdef CONFIG_DEBUG_FS |
1646 | struct intel_pipe_crc pipe_crc[I915_MAX_PIPES]; |
1857 | struct intel_pipe_crc pipe_crc[I915_MAX_PIPES]; |
1647 | #endif |
1858 | #endif |
1648 | 1859 | ||
1649 | int num_shared_dpll; |
1860 | int num_shared_dpll; |
1650 | struct intel_shared_dpll shared_dplls[I915_NUM_PLLS]; |
1861 | struct intel_shared_dpll shared_dplls[I915_NUM_PLLS]; |
1651 | int dpio_phy_iosf_port[I915_NUM_PHYS_VLV]; |
1862 | int dpio_phy_iosf_port[I915_NUM_PHYS_VLV]; |
1652 | 1863 | ||
1653 | struct i915_workarounds workarounds; |
1864 | struct i915_workarounds workarounds; |
1654 | 1865 | ||
1655 | /* Reclocking support */ |
1866 | /* Reclocking support */ |
1656 | bool render_reclock_avail; |
1867 | bool render_reclock_avail; |
1657 | bool lvds_downclock_avail; |
- | |
1658 | /* indicates the reduced downclock for LVDS*/ |
- | |
1659 | int lvds_downclock; |
- | |
1660 | 1868 | ||
1661 | struct i915_frontbuffer_tracking fb_tracking; |
1869 | struct i915_frontbuffer_tracking fb_tracking; |
1662 | 1870 | ||
1663 | u16 orig_clock; |
1871 | u16 orig_clock; |
1664 | 1872 | ||
1665 | bool mchbar_need_disable; |
1873 | bool mchbar_need_disable; |
1666 | 1874 | ||
1667 | struct intel_l3_parity l3_parity; |
1875 | struct intel_l3_parity l3_parity; |
1668 | 1876 | ||
1669 | /* Cannot be determined by PCIID. You must always read a register. */ |
1877 | /* Cannot be determined by PCIID. You must always read a register. */ |
1670 | size_t ellc_size; |
1878 | size_t ellc_size; |
1671 | 1879 | ||
1672 | /* gen6+ rps state */ |
1880 | /* gen6+ rps state */ |
1673 | struct intel_gen6_power_mgmt rps; |
1881 | struct intel_gen6_power_mgmt rps; |
1674 | 1882 | ||
1675 | /* ilk-only ips/rps state. Everything in here is protected by the global |
1883 | /* ilk-only ips/rps state. Everything in here is protected by the global |
1676 | * mchdev_lock in intel_pm.c */ |
1884 | * mchdev_lock in intel_pm.c */ |
1677 | struct intel_ilk_power_mgmt ips; |
1885 | struct intel_ilk_power_mgmt ips; |
1678 | 1886 | ||
1679 | struct i915_power_domains power_domains; |
1887 | struct i915_power_domains power_domains; |
1680 | 1888 | ||
1681 | struct i915_psr psr; |
1889 | struct i915_psr psr; |
1682 | 1890 | ||
1683 | struct i915_gpu_error gpu_error; |
1891 | struct i915_gpu_error gpu_error; |
1684 | 1892 | ||
1685 | struct drm_i915_gem_object *vlv_pctx; |
1893 | struct drm_i915_gem_object *vlv_pctx; |
1686 | 1894 | ||
1687 | #ifdef CONFIG_DRM_I915_FBDEV |
1895 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
1688 | /* list of fbdev register on this device */ |
1896 | /* list of fbdev register on this device */ |
1689 | struct intel_fbdev *fbdev; |
1897 | struct intel_fbdev *fbdev; |
1690 | struct work_struct fbdev_suspend_work; |
1898 | struct work_struct fbdev_suspend_work; |
1691 | #endif |
1899 | #endif |
1692 | 1900 | ||
1693 | struct drm_property *broadcast_rgb_property; |
1901 | struct drm_property *broadcast_rgb_property; |
1694 | struct drm_property *force_audio_property; |
1902 | struct drm_property *force_audio_property; |
- | 1903 | ||
- | 1904 | /* hda/i915 audio component */ |
|
- | 1905 | struct i915_audio_component *audio_component; |
|
- | 1906 | bool audio_component_registered; |
|
- | 1907 | /** |
|
- | 1908 | * av_mutex - mutex for audio/video sync |
|
- | 1909 | * |
|
- | 1910 | */ |
|
- | 1911 | struct mutex av_mutex; |
|
1695 | 1912 | ||
1696 | uint32_t hw_context_size; |
1913 | uint32_t hw_context_size; |
1697 | struct list_head context_list; |
1914 | struct list_head context_list; |
1698 | 1915 | ||
1699 | u32 fdi_rx_config; |
1916 | u32 fdi_rx_config; |
- | 1917 | ||
- | 1918 | u32 chv_phy_control; |
|
1700 | 1919 | ||
1701 | u32 suspend_count; |
1920 | u32 suspend_count; |
1702 | struct i915_suspend_saved_registers regfile; |
1921 | struct i915_suspend_saved_registers regfile; |
1703 | struct vlv_s0ix_state vlv_s0ix_state; |
1922 | struct vlv_s0ix_state vlv_s0ix_state; |
1704 | 1923 | ||
1705 | struct { |
1924 | struct { |
1706 | /* |
1925 | /* |
1707 | * Raw watermark latency values: |
1926 | * Raw watermark latency values: |
1708 | * in 0.1us units for WM0, |
1927 | * in 0.1us units for WM0, |
1709 | * in 0.5us units for WM1+. |
1928 | * in 0.5us units for WM1+. |
1710 | */ |
1929 | */ |
1711 | /* primary */ |
1930 | /* primary */ |
1712 | uint16_t pri_latency[5]; |
1931 | uint16_t pri_latency[5]; |
1713 | /* sprite */ |
1932 | /* sprite */ |
1714 | uint16_t spr_latency[5]; |
1933 | uint16_t spr_latency[5]; |
1715 | /* cursor */ |
1934 | /* cursor */ |
1716 | uint16_t cur_latency[5]; |
1935 | uint16_t cur_latency[5]; |
1717 | /* |
1936 | /* |
1718 | * Raw watermark memory latency values |
1937 | * Raw watermark memory latency values |
1719 | * for SKL for all 8 levels |
1938 | * for SKL for all 8 levels |
1720 | * in 1us units. |
1939 | * in 1us units. |
1721 | */ |
1940 | */ |
1722 | uint16_t skl_latency[8]; |
1941 | uint16_t skl_latency[8]; |
1723 | 1942 | ||
1724 | /* |
1943 | /* |
1725 | * The skl_wm_values structure is a bit too big for stack |
1944 | * The skl_wm_values structure is a bit too big for stack |
1726 | * allocation, so we keep the staging struct where we store |
1945 | * allocation, so we keep the staging struct where we store |
1727 | * intermediate results here instead. |
1946 | * intermediate results here instead. |
1728 | */ |
1947 | */ |
1729 | struct skl_wm_values skl_results; |
1948 | struct skl_wm_values skl_results; |
1730 | 1949 | ||
1731 | /* current hardware state */ |
1950 | /* current hardware state */ |
1732 | union { |
1951 | union { |
1733 | struct ilk_wm_values hw; |
1952 | struct ilk_wm_values hw; |
1734 | struct skl_wm_values skl_hw; |
1953 | struct skl_wm_values skl_hw; |
- | 1954 | struct vlv_wm_values vlv; |
|
1735 | }; |
1955 | }; |
- | 1956 | ||
- | 1957 | uint8_t max_level; |
|
1736 | } wm; |
1958 | } wm; |
1737 | 1959 | ||
1738 | struct i915_runtime_pm pm; |
1960 | struct i915_runtime_pm pm; |
1739 | - | ||
1740 | struct intel_digital_port *hpd_irq_port[I915_MAX_PORTS]; |
- | |
1741 | u32 long_hpd_port_mask; |
- | |
1742 | u32 short_hpd_port_mask; |
- | |
1743 | struct work_struct dig_port_work; |
- | |
1744 | - | ||
1745 | /* |
- | |
1746 | * if we get a HPD irq from DP and a HPD irq from non-DP |
- | |
1747 | * the non-DP HPD could block the workqueue on a mode config |
- | |
1748 | * mutex getting, that userspace may have taken. However |
- | |
1749 | * userspace is waiting on the DP workqueue to run which is |
- | |
1750 | * blocked behind the non-DP one. |
- | |
1751 | */ |
- | |
1752 | struct workqueue_struct *dp_wq; |
- | |
1753 | - | ||
1754 | uint32_t bios_vgacntr; |
- | |
1755 | 1961 | ||
1756 | /* Abstract the submission mechanism (legacy ringbuffer or execlists) away */ |
1962 | /* Abstract the submission mechanism (legacy ringbuffer or execlists) away */ |
1757 | struct { |
1963 | struct { |
1758 | int (*do_execbuf)(struct drm_device *dev, struct drm_file *file, |
- | |
1759 | struct intel_engine_cs *ring, |
- | |
1760 | struct intel_context *ctx, |
1964 | int (*execbuf_submit)(struct i915_execbuffer_params *params, |
1761 | struct drm_i915_gem_execbuffer2 *args, |
1965 | struct drm_i915_gem_execbuffer2 *args, |
1762 | struct list_head *vmas, |
- | |
1763 | struct drm_i915_gem_object *batch_obj, |
- | |
1764 | u64 exec_start, u32 flags); |
1966 | struct list_head *vmas); |
1765 | int (*init_rings)(struct drm_device *dev); |
1967 | int (*init_rings)(struct drm_device *dev); |
1766 | void (*cleanup_ring)(struct intel_engine_cs *ring); |
1968 | void (*cleanup_ring)(struct intel_engine_cs *ring); |
1767 | void (*stop_ring)(struct intel_engine_cs *ring); |
1969 | void (*stop_ring)(struct intel_engine_cs *ring); |
1768 | } gt; |
1970 | } gt; |
- | 1971 | ||
- | 1972 | bool edp_low_vswing; |
|
- | 1973 | ||
- | 1974 | /* perform PHY state sanity checks? */ |
|
- | 1975 | bool chv_phy_assert[2]; |
|
1769 | 1976 | ||
1770 | /* |
1977 | /* |
1771 | * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch |
1978 | * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch |
1772 | * will be rejected. Instead look for a better place. |
1979 | * will be rejected. Instead look for a better place. |
1773 | */ |
1980 | */ |
1774 | }; |
1981 | }; |
1775 | 1982 | ||
1776 | static inline struct drm_i915_private *to_i915(const struct drm_device *dev) |
1983 | static inline struct drm_i915_private *to_i915(const struct drm_device *dev) |
1777 | { |
1984 | { |
1778 | return dev->dev_private; |
1985 | return dev->dev_private; |
1779 | } |
1986 | } |
- | 1987 | ||
- | 1988 | static inline struct drm_i915_private *dev_to_i915(struct device *dev) |
|
- | 1989 | { |
|
- | 1990 | return to_i915(dev_get_drvdata(dev)); |
|
- | 1991 | } |
|
- | 1992 | ||
- | 1993 | static inline struct drm_i915_private *guc_to_i915(struct intel_guc *guc) |
|
- | 1994 | { |
|
- | 1995 | return container_of(guc, struct drm_i915_private, guc); |
|
- | 1996 | } |
|
1780 | 1997 | ||
1781 | /* Iterate over initialised rings */ |
1998 | /* Iterate over initialised rings */ |
1782 | #define for_each_ring(ring__, dev_priv__, i__) \ |
1999 | #define for_each_ring(ring__, dev_priv__, i__) \ |
1783 | for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \ |
2000 | for ((i__) = 0; (i__) < I915_NUM_RINGS; (i__)++) \ |
1784 | if (((ring__) = &(dev_priv__)->ring[(i__)]), intel_ring_initialized((ring__))) |
2001 | if (((ring__) = &(dev_priv__)->ring[(i__)]), intel_ring_initialized((ring__))) |
1785 | 2002 | ||
1786 | enum hdmi_force_audio { |
2003 | enum hdmi_force_audio { |
1787 | HDMI_AUDIO_OFF_DVI = -2, /* no aux data for HDMI-DVI converter */ |
2004 | HDMI_AUDIO_OFF_DVI = -2, /* no aux data for HDMI-DVI converter */ |
1788 | HDMI_AUDIO_OFF, /* force turn off HDMI audio */ |
2005 | HDMI_AUDIO_OFF, /* force turn off HDMI audio */ |
1789 | HDMI_AUDIO_AUTO, /* trust EDID */ |
2006 | HDMI_AUDIO_AUTO, /* trust EDID */ |
1790 | HDMI_AUDIO_ON, /* force turn on HDMI audio */ |
2007 | HDMI_AUDIO_ON, /* force turn on HDMI audio */ |
1791 | }; |
2008 | }; |
1792 | 2009 | ||
1793 | #define I915_GTT_OFFSET_NONE ((u32)-1) |
2010 | #define I915_GTT_OFFSET_NONE ((u32)-1) |
1794 | 2011 | ||
1795 | struct drm_i915_gem_object_ops { |
2012 | struct drm_i915_gem_object_ops { |
1796 | /* Interface between the GEM object and its backing storage. |
2013 | /* Interface between the GEM object and its backing storage. |
1797 | * get_pages() is called once prior to the use of the associated set |
2014 | * get_pages() is called once prior to the use of the associated set |
1798 | * of pages before to binding them into the GTT, and put_pages() is |
2015 | * of pages before to binding them into the GTT, and put_pages() is |
1799 | * called after we no longer need them. As we expect there to be |
2016 | * called after we no longer need them. As we expect there to be |
1800 | * associated cost with migrating pages between the backing storage |
2017 | * associated cost with migrating pages between the backing storage |
1801 | * and making them available for the GPU (e.g. clflush), we may hold |
2018 | * and making them available for the GPU (e.g. clflush), we may hold |
1802 | * onto the pages after they are no longer referenced by the GPU |
2019 | * onto the pages after they are no longer referenced by the GPU |
1803 | * in case they may be used again shortly (for example migrating the |
2020 | * in case they may be used again shortly (for example migrating the |
1804 | * pages to a different memory domain within the GTT). put_pages() |
2021 | * pages to a different memory domain within the GTT). put_pages() |
1805 | * will therefore most likely be called when the object itself is |
2022 | * will therefore most likely be called when the object itself is |
1806 | * being released or under memory pressure (where we attempt to |
2023 | * being released or under memory pressure (where we attempt to |
1807 | * reap pages for the shrinker). |
2024 | * reap pages for the shrinker). |
1808 | */ |
2025 | */ |
1809 | int (*get_pages)(struct drm_i915_gem_object *); |
2026 | int (*get_pages)(struct drm_i915_gem_object *); |
1810 | void (*put_pages)(struct drm_i915_gem_object *); |
2027 | void (*put_pages)(struct drm_i915_gem_object *); |
1811 | int (*dmabuf_export)(struct drm_i915_gem_object *); |
2028 | int (*dmabuf_export)(struct drm_i915_gem_object *); |
1812 | void (*release)(struct drm_i915_gem_object *); |
2029 | void (*release)(struct drm_i915_gem_object *); |
1813 | }; |
2030 | }; |
1814 | 2031 | ||
1815 | /* |
2032 | /* |
1816 | * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is |
2033 | * Frontbuffer tracking bits. Set in obj->frontbuffer_bits while a gem bo is |
1817 | * considered to be the frontbuffer for the given plane interface-vise. This |
2034 | * considered to be the frontbuffer for the given plane interface-wise. This |
1818 | * doesn't mean that the hw necessarily already scans it out, but that any |
2035 | * doesn't mean that the hw necessarily already scans it out, but that any |
1819 | * rendering (by the cpu or gpu) will land in the frontbuffer eventually. |
2036 | * rendering (by the cpu or gpu) will land in the frontbuffer eventually. |
1820 | * |
2037 | * |
1821 | * We have one bit per pipe and per scanout plane type. |
2038 | * We have one bit per pipe and per scanout plane type. |
1822 | */ |
2039 | */ |
- | 2040 | #define INTEL_MAX_SPRITE_BITS_PER_PIPE 5 |
|
1823 | #define INTEL_FRONTBUFFER_BITS_PER_PIPE 4 |
2041 | #define INTEL_FRONTBUFFER_BITS_PER_PIPE 8 |
1824 | #define INTEL_FRONTBUFFER_BITS \ |
2042 | #define INTEL_FRONTBUFFER_BITS \ |
1825 | (INTEL_FRONTBUFFER_BITS_PER_PIPE * I915_MAX_PIPES) |
2043 | (INTEL_FRONTBUFFER_BITS_PER_PIPE * I915_MAX_PIPES) |
1826 | #define INTEL_FRONTBUFFER_PRIMARY(pipe) \ |
2044 | #define INTEL_FRONTBUFFER_PRIMARY(pipe) \ |
1827 | (1 << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))) |
2045 | (1 << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))) |
1828 | #define INTEL_FRONTBUFFER_CURSOR(pipe) \ |
2046 | #define INTEL_FRONTBUFFER_CURSOR(pipe) \ |
1829 | (1 << (1 +(INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))) |
2047 | (1 << (1 + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))) |
1830 | #define INTEL_FRONTBUFFER_SPRITE(pipe) \ |
2048 | #define INTEL_FRONTBUFFER_SPRITE(pipe, plane) \ |
1831 | (1 << (2 +(INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))) |
2049 | (1 << (2 + plane + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))) |
1832 | #define INTEL_FRONTBUFFER_OVERLAY(pipe) \ |
2050 | #define INTEL_FRONTBUFFER_OVERLAY(pipe) \ |
1833 | (1 << (3 +(INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))) |
2051 | (1 << (2 + INTEL_MAX_SPRITE_BITS_PER_PIPE + (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe)))) |
1834 | #define INTEL_FRONTBUFFER_ALL_MASK(pipe) \ |
2052 | #define INTEL_FRONTBUFFER_ALL_MASK(pipe) \ |
1835 | (0xf << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))) |
2053 | (0xff << (INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))) |
1836 | 2054 | ||
1837 | struct drm_i915_gem_object { |
2055 | struct drm_i915_gem_object { |
1838 | struct drm_gem_object base; |
2056 | struct drm_gem_object base; |
1839 | 2057 | ||
1840 | const struct drm_i915_gem_object_ops *ops; |
2058 | const struct drm_i915_gem_object_ops *ops; |
1841 | 2059 | ||
1842 | /** List of VMAs backed by this object */ |
2060 | /** List of VMAs backed by this object */ |
1843 | struct list_head vma_list; |
2061 | struct list_head vma_list; |
1844 | 2062 | ||
1845 | /** Stolen memory for this object, instead of being backed by shmem. */ |
2063 | /** Stolen memory for this object, instead of being backed by shmem. */ |
1846 | struct drm_mm_node *stolen; |
2064 | struct drm_mm_node *stolen; |
1847 | struct list_head global_list; |
2065 | struct list_head global_list; |
1848 | 2066 | ||
1849 | struct list_head ring_list; |
2067 | struct list_head ring_list[I915_NUM_RINGS]; |
1850 | /** Used in execbuf to temporarily hold a ref */ |
2068 | /** Used in execbuf to temporarily hold a ref */ |
1851 | struct list_head obj_exec_link; |
2069 | struct list_head obj_exec_link; |
- | 2070 | ||
- | 2071 | struct list_head batch_pool_link; |
|
1852 | 2072 | ||
1853 | /** |
2073 | /** |
1854 | * This is set if the object is on the active lists (has pending |
2074 | * This is set if the object is on the active lists (has pending |
1855 | * rendering and so a non-zero seqno), and is not set if it i s on |
2075 | * rendering and so a non-zero seqno), and is not set if it i s on |
1856 | * inactive (ready to be unbound) list. |
2076 | * inactive (ready to be unbound) list. |
1857 | */ |
2077 | */ |
1858 | unsigned int active:1; |
2078 | unsigned int active:I915_NUM_RINGS; |
1859 | 2079 | ||
1860 | /** |
2080 | /** |
1861 | * This is set if the object has been written to since last bound |
2081 | * This is set if the object has been written to since last bound |
1862 | * to the GTT |
2082 | * to the GTT |
1863 | */ |
2083 | */ |
1864 | unsigned int dirty:1; |
2084 | unsigned int dirty:1; |
1865 | 2085 | ||
1866 | /** |
2086 | /** |
1867 | * Fence register bits (if any) for this object. Will be set |
2087 | * Fence register bits (if any) for this object. Will be set |
1868 | * as needed when mapped into the GTT. |
2088 | * as needed when mapped into the GTT. |
1869 | * Protected by dev->struct_mutex. |
2089 | * Protected by dev->struct_mutex. |
1870 | */ |
2090 | */ |
1871 | signed int fence_reg:I915_MAX_NUM_FENCE_BITS; |
2091 | signed int fence_reg:I915_MAX_NUM_FENCE_BITS; |
1872 | 2092 | ||
1873 | /** |
2093 | /** |
1874 | * Advice: are the backing pages purgeable? |
2094 | * Advice: are the backing pages purgeable? |
1875 | */ |
2095 | */ |
1876 | unsigned int madv:2; |
2096 | unsigned int madv:2; |
1877 | 2097 | ||
1878 | /** |
2098 | /** |
1879 | * Current tiling mode for the object. |
2099 | * Current tiling mode for the object. |
1880 | */ |
2100 | */ |
1881 | unsigned int tiling_mode:2; |
2101 | unsigned int tiling_mode:2; |
1882 | /** |
2102 | /** |
1883 | * Whether the tiling parameters for the currently associated fence |
2103 | * Whether the tiling parameters for the currently associated fence |
1884 | * register have changed. Note that for the purposes of tracking |
2104 | * register have changed. Note that for the purposes of tracking |
1885 | * tiling changes we also treat the unfenced register, the register |
2105 | * tiling changes we also treat the unfenced register, the register |
1886 | * slot that the object occupies whilst it executes a fenced |
2106 | * slot that the object occupies whilst it executes a fenced |
1887 | * command (such as BLT on gen2/3), as a "fence". |
2107 | * command (such as BLT on gen2/3), as a "fence". |
1888 | */ |
2108 | */ |
1889 | unsigned int fence_dirty:1; |
2109 | unsigned int fence_dirty:1; |
1890 | 2110 | ||
1891 | /** |
2111 | /** |
1892 | * Is the object at the current location in the gtt mappable and |
2112 | * Is the object at the current location in the gtt mappable and |
1893 | * fenceable? Used to avoid costly recalculations. |
2113 | * fenceable? Used to avoid costly recalculations. |
1894 | */ |
2114 | */ |
1895 | unsigned int map_and_fenceable:1; |
2115 | unsigned int map_and_fenceable:1; |
1896 | 2116 | ||
1897 | /** |
2117 | /** |
1898 | * Whether the current gtt mapping needs to be mappable (and isn't just |
2118 | * Whether the current gtt mapping needs to be mappable (and isn't just |
1899 | * mappable by accident). Track pin and fault separate for a more |
2119 | * mappable by accident). Track pin and fault separate for a more |
1900 | * accurate mappable working set. |
2120 | * accurate mappable working set. |
1901 | */ |
2121 | */ |
1902 | unsigned int fault_mappable:1; |
2122 | unsigned int fault_mappable:1; |
1903 | unsigned int pin_mappable:1; |
- | |
1904 | unsigned int pin_display:1; |
- | |
1905 | 2123 | ||
1906 | /* |
2124 | /* |
1907 | * Is the object to be mapped as read-only to the GPU |
2125 | * Is the object to be mapped as read-only to the GPU |
1908 | * Only honoured if hardware has relevant pte bit |
2126 | * Only honoured if hardware has relevant pte bit |
1909 | */ |
2127 | */ |
1910 | unsigned long gt_ro:1; |
2128 | unsigned long gt_ro:1; |
1911 | unsigned int cache_level:3; |
2129 | unsigned int cache_level:3; |
1912 | - | ||
1913 | unsigned int has_dma_mapping:1; |
2130 | unsigned int cache_dirty:1; |
1914 | 2131 | ||
1915 | unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS; |
2132 | unsigned int frontbuffer_bits:INTEL_FRONTBUFFER_BITS; |
- | 2133 | ||
- | 2134 | unsigned int pin_display; |
|
1916 | 2135 | ||
1917 | struct sg_table *pages; |
2136 | struct sg_table *pages; |
- | 2137 | int pages_pin_count; |
|
- | 2138 | struct get_page { |
|
- | 2139 | struct scatterlist *sg; |
|
- | 2140 | int last; |
|
1918 | int pages_pin_count; |
2141 | } get_page; |
1919 | 2142 | ||
1920 | /* prime dma-buf support */ |
2143 | /* prime dma-buf support */ |
1921 | void *dma_buf_vmapping; |
2144 | void *dma_buf_vmapping; |
1922 | int vmapping_count; |
2145 | int vmapping_count; |
1923 | 2146 | ||
1924 | struct intel_engine_cs *ring; |
- | |
- | 2147 | /** Breadcrumb of last rendering to the buffer. |
|
- | 2148 | * There can only be one writer, but we allow for multiple readers. |
|
- | 2149 | * If there is a writer that necessarily implies that all other |
|
1925 | 2150 | * read requests are complete - but we may only be lazily clearing |
|
- | 2151 | * the read requests. A read request is naturally the most recent |
|
- | 2152 | * request on a ring, so we may have two different write and read |
|
- | 2153 | * requests on one ring where the write request is older than the |
|
- | 2154 | * read request. This allows for the CPU to read from an active |
|
- | 2155 | * buffer by only waiting for the write to complete. |
|
1926 | /** Breadcrumb of last rendering to the buffer. */ |
2156 | * */ |
1927 | uint32_t last_read_seqno; |
2157 | struct drm_i915_gem_request *last_read_req[I915_NUM_RINGS]; |
1928 | uint32_t last_write_seqno; |
2158 | struct drm_i915_gem_request *last_write_req; |
1929 | /** Breadcrumb of last fenced GPU access to the buffer. */ |
2159 | /** Breadcrumb of last fenced GPU access to the buffer. */ |
1930 | uint32_t last_fenced_seqno; |
2160 | struct drm_i915_gem_request *last_fenced_req; |
1931 | 2161 | ||
1932 | /** Current tiling stride for the object, if it's tiled. */ |
2162 | /** Current tiling stride for the object, if it's tiled. */ |
1933 | uint32_t stride; |
2163 | uint32_t stride; |
1934 | 2164 | ||
1935 | /** References from framebuffers, locks out tiling changes. */ |
2165 | /** References from framebuffers, locks out tiling changes. */ |
1936 | unsigned long framebuffer_references; |
2166 | unsigned long framebuffer_references; |
1937 | 2167 | ||
1938 | /** Record of address bit 17 of each page at last unbind. */ |
2168 | /** Record of address bit 17 of each page at last unbind. */ |
1939 | unsigned long *bit_17; |
2169 | unsigned long *bit_17; |
1940 | - | ||
1941 | /** User space pin count and filp owning the pin */ |
- | |
1942 | unsigned long user_pin_count; |
- | |
1943 | struct drm_file *pin_filp; |
- | |
1944 | 2170 | ||
1945 | union { |
2171 | union { |
1946 | /** for phy allocated objects */ |
2172 | /** for phy allocated objects */ |
1947 | struct drm_dma_handle *phys_handle; |
2173 | struct drm_dma_handle *phys_handle; |
1948 | 2174 | ||
1949 | struct i915_gem_userptr { |
2175 | struct i915_gem_userptr { |
1950 | uintptr_t ptr; |
2176 | uintptr_t ptr; |
1951 | unsigned read_only :1; |
2177 | unsigned read_only :1; |
1952 | unsigned workers :4; |
2178 | unsigned workers :4; |
1953 | #define I915_GEM_USERPTR_MAX_WORKERS 15 |
2179 | #define I915_GEM_USERPTR_MAX_WORKERS 15 |
1954 | 2180 | ||
1955 | struct i915_mm_struct *mm; |
2181 | struct i915_mm_struct *mm; |
1956 | struct i915_mmu_object *mmu_object; |
2182 | struct i915_mmu_object *mmu_object; |
1957 | struct work_struct *work; |
2183 | struct work_struct *work; |
1958 | } userptr; |
2184 | } userptr; |
1959 | }; |
2185 | }; |
1960 | }; |
2186 | }; |
1961 | #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base) |
2187 | #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base) |
1962 | 2188 | ||
1963 | void i915_gem_track_fb(struct drm_i915_gem_object *old, |
2189 | void i915_gem_track_fb(struct drm_i915_gem_object *old, |
1964 | struct drm_i915_gem_object *new, |
2190 | struct drm_i915_gem_object *new, |
1965 | unsigned frontbuffer_bits); |
2191 | unsigned frontbuffer_bits); |
1966 | 2192 | ||
1967 | /** |
2193 | /** |
1968 | * Request queue structure. |
2194 | * Request queue structure. |
1969 | * |
2195 | * |
1970 | * The request queue allows us to note sequence numbers that have been emitted |
2196 | * The request queue allows us to note sequence numbers that have been emitted |
1971 | * and may be associated with active buffers to be retired. |
2197 | * and may be associated with active buffers to be retired. |
1972 | * |
2198 | * |
1973 | * By keeping this list, we can avoid having to do questionable |
2199 | * By keeping this list, we can avoid having to do questionable sequence |
1974 | * sequence-number comparisons on buffer last_rendering_seqnos, and associate |
2200 | * number comparisons on buffer last_read|write_seqno. It also allows an |
1975 | * an emission time with seqnos for tracking how far ahead of the GPU we are. |
2201 | * emission time to be associated with the request for tracking how far ahead |
- | 2202 | * of the GPU the submission is. |
|
- | 2203 | * |
|
- | 2204 | * The requests are reference counted, so upon creation they should have an |
|
- | 2205 | * initial reference taken using kref_init |
|
1976 | */ |
2206 | */ |
1977 | struct drm_i915_gem_request { |
2207 | struct drm_i915_gem_request { |
- | 2208 | struct kref ref; |
|
- | 2209 | ||
1978 | /** On Which ring this request was generated */ |
2210 | /** On Which ring this request was generated */ |
- | 2211 | struct drm_i915_private *i915; |
|
1979 | struct intel_engine_cs *ring; |
2212 | struct intel_engine_cs *ring; |
- | 2213 | ||
- | 2214 | /** GEM sequence number associated with the previous request, |
|
- | 2215 | * when the HWS breadcrumb is equal to this the GPU is processing |
|
- | 2216 | * this request. |
|
- | 2217 | */ |
|
- | 2218 | u32 previous_seqno; |
|
1980 | 2219 | ||
- | 2220 | /** GEM sequence number associated with this request, |
|
- | 2221 | * when the HWS breadcrumb is equal or greater than this the GPU |
|
- | 2222 | * has finished processing this request. |
|
1981 | /** GEM sequence number associated with this request. */ |
2223 | */ |
1982 | uint32_t seqno; |
2224 | u32 seqno; |
1983 | 2225 | ||
1984 | /** Position in the ringbuffer of the start of the request */ |
2226 | /** Position in the ringbuffer of the start of the request */ |
1985 | u32 head; |
2227 | u32 head; |
- | 2228 | ||
- | 2229 | /** |
|
- | 2230 | * Position in the ringbuffer of the start of the postfix. |
|
- | 2231 | * This is required to calculate the maximum available ringbuffer |
|
- | 2232 | * space without overwriting the postfix. |
|
- | 2233 | */ |
|
- | 2234 | u32 postfix; |
|
1986 | 2235 | ||
1987 | /** Position in the ringbuffer of the end of the request */ |
2236 | /** Position in the ringbuffer of the end of the whole request */ |
- | 2237 | u32 tail; |
|
1988 | u32 tail; |
2238 | |
- | 2239 | /** |
|
- | 2240 | * Context and ring buffer related to this request |
|
- | 2241 | * Contexts are refcounted, so when this request is associated with a |
|
- | 2242 | * context, we must increment the context's refcount, to guarantee that |
|
- | 2243 | * it persists while any request is linked to it. Requests themselves |
|
- | 2244 | * are also refcounted, so the request will only be freed when the last |
|
- | 2245 | * reference to it is dismissed, and the code in |
|
- | 2246 | * i915_gem_request_free() will then decrement the refcount on the |
|
1989 | 2247 | * context. |
|
- | 2248 | */ |
|
1990 | /** Context related to this request */ |
2249 | struct intel_context *ctx; |
- | 2250 | struct intel_ringbuffer *ringbuf; |
|
1991 | struct intel_context *ctx; |
2251 | |
1992 | 2252 | /** Batch buffer related to this request if any (used for |
|
1993 | /** Batch buffer related to this request if any */ |
2253 | error state dump only) */ |
1994 | struct drm_i915_gem_object *batch_obj; |
2254 | struct drm_i915_gem_object *batch_obj; |
1995 | 2255 | ||
1996 | /** Time at which this request was emitted, in jiffies. */ |
2256 | /** Time at which this request was emitted, in jiffies. */ |
1997 | unsigned long emitted_jiffies; |
2257 | unsigned long emitted_jiffies; |
1998 | 2258 | ||
1999 | /** global list entry for this request */ |
2259 | /** global list entry for this request */ |
2000 | struct list_head list; |
2260 | struct list_head list; |
2001 | 2261 | ||
2002 | struct drm_i915_file_private *file_priv; |
2262 | struct drm_i915_file_private *file_priv; |
2003 | /** file_priv list entry for this request */ |
2263 | /** file_priv list entry for this request */ |
2004 | struct list_head client_list; |
2264 | struct list_head client_list; |
2005 | }; |
- | |
2006 | - | ||
2007 | struct drm_i915_file_private { |
2265 | |
2008 | struct drm_i915_private *dev_priv; |
2266 | /** process identifier submitting this request */ |
- | 2267 | struct pid *pid; |
|
- | 2268 | ||
- | 2269 | /** |
|
- | 2270 | * The ELSP only accepts two elements at a time, so we queue |
|
- | 2271 | * context/tail pairs on a given queue (ring->execlist_queue) until the |
|
- | 2272 | * hardware is available. The queue serves a double purpose: we also use |
|
- | 2273 | * it to keep track of the up to 2 contexts currently in the hardware |
|
- | 2274 | * (usually one in execution and the other queued up by the GPU): We |
|
2009 | struct drm_file *file; |
2275 | * only remove elements from the head of the queue when the hardware |
- | 2276 | * informs us that an element has been completed. |
|
2010 | 2277 | * |
|
- | 2278 | * All accesses to the queue are mediated by a spinlock |
|
- | 2279 | * (ring->execlist_lock). |
|
2011 | struct { |
2280 | */ |
2012 | spinlock_t lock; |
2281 | |
2013 | struct list_head request_list; |
2282 | /** Execlist link in the submission queue.*/ |
- | 2283 | struct list_head execlist_link; |
|
2014 | struct delayed_work idle_work; |
2284 | |
2015 | } mm; |
- | |
2016 | struct idr context_idr; |
- | |
2017 | 2285 | /** Execlists no. of times this request has been sent to the ELSP */ |
|
- | 2286 | int elsp_submitted; |
|
- | 2287 | ||
- | 2288 | }; |
|
- | 2289 | ||
- | 2290 | int i915_gem_request_alloc(struct intel_engine_cs *ring, |
|
- | 2291 | struct intel_context *ctx, |
|
- | 2292 | struct drm_i915_gem_request **req_out); |
|
- | 2293 | void i915_gem_request_cancel(struct drm_i915_gem_request *req); |
|
- | 2294 | void i915_gem_request_free(struct kref *req_ref); |
|
- | 2295 | int i915_gem_request_add_to_client(struct drm_i915_gem_request *req, |
|
- | 2296 | struct drm_file *file); |
|
- | 2297 | ||
- | 2298 | static inline uint32_t |
|
- | 2299 | i915_gem_request_get_seqno(struct drm_i915_gem_request *req) |
|
- | 2300 | { |
|
- | 2301 | return req ? req->seqno : 0; |
|
- | 2302 | } |
|
- | 2303 | ||
- | 2304 | static inline struct intel_engine_cs * |
|
- | 2305 | i915_gem_request_get_ring(struct drm_i915_gem_request *req) |
|
- | 2306 | { |
|
- | 2307 | return req ? req->ring : NULL; |
|
- | 2308 | } |
|
- | 2309 | ||
- | 2310 | static inline struct drm_i915_gem_request * |
|
- | 2311 | i915_gem_request_reference(struct drm_i915_gem_request *req) |
|
- | 2312 | { |
|
- | 2313 | if (req) |
|
- | 2314 | kref_get(&req->ref); |
|
- | 2315 | return req; |
|
- | 2316 | } |
|
- | 2317 | ||
- | 2318 | static inline void |
|
- | 2319 | i915_gem_request_unreference(struct drm_i915_gem_request *req) |
|
- | 2320 | { |
|
- | 2321 | WARN_ON(!mutex_is_locked(&req->ring->dev->struct_mutex)); |
|
- | 2322 | kref_put(&req->ref, i915_gem_request_free); |
|
- | 2323 | } |
|
- | 2324 | ||
- | 2325 | static inline void |
|
- | 2326 | i915_gem_request_unreference__unlocked(struct drm_i915_gem_request *req) |
|
- | 2327 | { |
|
- | 2328 | struct drm_device *dev; |
|
- | 2329 | ||
- | 2330 | if (!req) |
|
- | 2331 | return; |
|
- | 2332 | ||
- | 2333 | dev = req->ring->dev; |
|
- | 2334 | if (kref_put_mutex(&req->ref, i915_gem_request_free, &dev->struct_mutex)) |
|
- | 2335 | mutex_unlock(&dev->struct_mutex); |
|
- | 2336 | } |
|
- | 2337 | ||
- | 2338 | static inline void i915_gem_request_assign(struct drm_i915_gem_request **pdst, |
|
- | 2339 | struct drm_i915_gem_request *src) |
|
- | 2340 | { |
|
- | 2341 | if (src) |
|
- | 2342 | i915_gem_request_reference(src); |
|
- | 2343 | ||
- | 2344 | if (*pdst) |
|
- | 2345 | i915_gem_request_unreference(*pdst); |
|
- | 2346 | ||
- | 2347 | *pdst = src; |
|
- | 2348 | } |
|
- | 2349 | ||
- | 2350 | /* |
|
- | 2351 | * XXX: i915_gem_request_completed should be here but currently needs the |
|
2018 | atomic_t rps_wait_boost; |
2352 | * definition of i915_seqno_passed() which is below. It will be moved in |
2019 | struct intel_engine_cs *bsd_ring; |
2353 | * a later patch when the call to i915_seqno_passed() is obsoleted... |
2020 | }; |
2354 | */ |
2021 | 2355 | ||
2022 | /* |
2356 | /* |
2023 | * A command that requires special handling by the command parser. |
2357 | * A command that requires special handling by the command parser. |
2024 | */ |
2358 | */ |
2025 | struct drm_i915_cmd_descriptor { |
2359 | struct drm_i915_cmd_descriptor { |
2026 | /* |
2360 | /* |
2027 | * Flags describing how the command parser processes the command. |
2361 | * Flags describing how the command parser processes the command. |
2028 | * |
2362 | * |
2029 | * CMD_DESC_FIXED: The command has a fixed length if this is set, |
2363 | * CMD_DESC_FIXED: The command has a fixed length if this is set, |
2030 | * a length mask if not set |
2364 | * a length mask if not set |
2031 | * CMD_DESC_SKIP: The command is allowed but does not follow the |
2365 | * CMD_DESC_SKIP: The command is allowed but does not follow the |
2032 | * standard length encoding for the opcode range in |
2366 | * standard length encoding for the opcode range in |
2033 | * which it falls |
2367 | * which it falls |
2034 | * CMD_DESC_REJECT: The command is never allowed |
2368 | * CMD_DESC_REJECT: The command is never allowed |
2035 | * CMD_DESC_REGISTER: The command should be checked against the |
2369 | * CMD_DESC_REGISTER: The command should be checked against the |
2036 | * register whitelist for the appropriate ring |
2370 | * register whitelist for the appropriate ring |
2037 | * CMD_DESC_MASTER: The command is allowed if the submitting process |
2371 | * CMD_DESC_MASTER: The command is allowed if the submitting process |
2038 | * is the DRM master |
2372 | * is the DRM master |
2039 | */ |
2373 | */ |
2040 | u32 flags; |
2374 | u32 flags; |
2041 | #define CMD_DESC_FIXED (1<<0) |
2375 | #define CMD_DESC_FIXED (1<<0) |
2042 | #define CMD_DESC_SKIP (1<<1) |
2376 | #define CMD_DESC_SKIP (1<<1) |
2043 | #define CMD_DESC_REJECT (1<<2) |
2377 | #define CMD_DESC_REJECT (1<<2) |
2044 | #define CMD_DESC_REGISTER (1<<3) |
2378 | #define CMD_DESC_REGISTER (1<<3) |
2045 | #define CMD_DESC_BITMASK (1<<4) |
2379 | #define CMD_DESC_BITMASK (1<<4) |
2046 | #define CMD_DESC_MASTER (1<<5) |
2380 | #define CMD_DESC_MASTER (1<<5) |
2047 | 2381 | ||
2048 | /* |
2382 | /* |
2049 | * The command's unique identification bits and the bitmask to get them. |
2383 | * The command's unique identification bits and the bitmask to get them. |
2050 | * This isn't strictly the opcode field as defined in the spec and may |
2384 | * This isn't strictly the opcode field as defined in the spec and may |
2051 | * also include type, subtype, and/or subop fields. |
2385 | * also include type, subtype, and/or subop fields. |
2052 | */ |
2386 | */ |
2053 | struct { |
2387 | struct { |
2054 | u32 value; |
2388 | u32 value; |
2055 | u32 mask; |
2389 | u32 mask; |
2056 | } cmd; |
2390 | } cmd; |
2057 | 2391 | ||
2058 | /* |
2392 | /* |
2059 | * The command's length. The command is either fixed length (i.e. does |
2393 | * The command's length. The command is either fixed length (i.e. does |
2060 | * not include a length field) or has a length field mask. The flag |
2394 | * not include a length field) or has a length field mask. The flag |
2061 | * CMD_DESC_FIXED indicates a fixed length. Otherwise, the command has |
2395 | * CMD_DESC_FIXED indicates a fixed length. Otherwise, the command has |
2062 | * a length mask. All command entries in a command table must include |
2396 | * a length mask. All command entries in a command table must include |
2063 | * length information. |
2397 | * length information. |
2064 | */ |
2398 | */ |
2065 | union { |
2399 | union { |
2066 | u32 fixed; |
2400 | u32 fixed; |
2067 | u32 mask; |
2401 | u32 mask; |
2068 | } length; |
2402 | } length; |
2069 | 2403 | ||
2070 | /* |
2404 | /* |
2071 | * Describes where to find a register address in the command to check |
2405 | * Describes where to find a register address in the command to check |
2072 | * against the ring's register whitelist. Only valid if flags has the |
2406 | * against the ring's register whitelist. Only valid if flags has the |
2073 | * CMD_DESC_REGISTER bit set. |
2407 | * CMD_DESC_REGISTER bit set. |
- | 2408 | * |
|
- | 2409 | * A non-zero step value implies that the command may access multiple |
|
- | 2410 | * registers in sequence (e.g. LRI), in that case step gives the |
|
- | 2411 | * distance in dwords between individual offset fields. |
|
2074 | */ |
2412 | */ |
2075 | struct { |
2413 | struct { |
2076 | u32 offset; |
2414 | u32 offset; |
2077 | u32 mask; |
2415 | u32 mask; |
- | 2416 | u32 step; |
|
2078 | } reg; |
2417 | } reg; |
2079 | 2418 | ||
2080 | #define MAX_CMD_DESC_BITMASKS 3 |
2419 | #define MAX_CMD_DESC_BITMASKS 3 |
2081 | /* |
2420 | /* |
2082 | * Describes command checks where a particular dword is masked and |
2421 | * Describes command checks where a particular dword is masked and |
2083 | * compared against an expected value. If the command does not match |
2422 | * compared against an expected value. If the command does not match |
2084 | * the expected value, the parser rejects it. Only valid if flags has |
2423 | * the expected value, the parser rejects it. Only valid if flags has |
2085 | * the CMD_DESC_BITMASK bit set. Only entries where mask is non-zero |
2424 | * the CMD_DESC_BITMASK bit set. Only entries where mask is non-zero |
2086 | * are valid. |
2425 | * are valid. |
2087 | * |
2426 | * |
2088 | * If the check specifies a non-zero condition_mask then the parser |
2427 | * If the check specifies a non-zero condition_mask then the parser |
2089 | * only performs the check when the bits specified by condition_mask |
2428 | * only performs the check when the bits specified by condition_mask |
2090 | * are non-zero. |
2429 | * are non-zero. |
2091 | */ |
2430 | */ |
2092 | struct { |
2431 | struct { |
2093 | u32 offset; |
2432 | u32 offset; |
2094 | u32 mask; |
2433 | u32 mask; |
2095 | u32 expected; |
2434 | u32 expected; |
2096 | u32 condition_offset; |
2435 | u32 condition_offset; |
2097 | u32 condition_mask; |
2436 | u32 condition_mask; |
2098 | } bits[MAX_CMD_DESC_BITMASKS]; |
2437 | } bits[MAX_CMD_DESC_BITMASKS]; |
2099 | }; |
2438 | }; |
2100 | 2439 | ||
2101 | /* |
2440 | /* |
2102 | * A table of commands requiring special handling by the command parser. |
2441 | * A table of commands requiring special handling by the command parser. |
2103 | * |
2442 | * |
2104 | * Each ring has an array of tables. Each table consists of an array of command |
2443 | * Each ring has an array of tables. Each table consists of an array of command |
2105 | * descriptors, which must be sorted with command opcodes in ascending order. |
2444 | * descriptors, which must be sorted with command opcodes in ascending order. |
2106 | */ |
2445 | */ |
2107 | struct drm_i915_cmd_table { |
2446 | struct drm_i915_cmd_table { |
2108 | const struct drm_i915_cmd_descriptor *table; |
2447 | const struct drm_i915_cmd_descriptor *table; |
2109 | int count; |
2448 | int count; |
2110 | }; |
2449 | }; |
2111 | 2450 | ||
2112 | /* Note that the (struct drm_i915_private *) cast is just to shut up gcc. */ |
2451 | /* Note that the (struct drm_i915_private *) cast is just to shut up gcc. */ |
2113 | #define __I915__(p) ({ \ |
2452 | #define __I915__(p) ({ \ |
2114 | struct drm_i915_private *__p; \ |
2453 | struct drm_i915_private *__p; \ |
2115 | if (__builtin_types_compatible_p(typeof(*p), struct drm_i915_private)) \ |
2454 | if (__builtin_types_compatible_p(typeof(*p), struct drm_i915_private)) \ |
2116 | __p = (struct drm_i915_private *)p; \ |
2455 | __p = (struct drm_i915_private *)p; \ |
2117 | else if (__builtin_types_compatible_p(typeof(*p), struct drm_device)) \ |
2456 | else if (__builtin_types_compatible_p(typeof(*p), struct drm_device)) \ |
2118 | __p = to_i915((struct drm_device *)p); \ |
2457 | __p = to_i915((struct drm_device *)p); \ |
2119 | else \ |
2458 | else \ |
2120 | BUILD_BUG(); \ |
2459 | BUILD_BUG(); \ |
2121 | __p; \ |
2460 | __p; \ |
2122 | }) |
2461 | }) |
2123 | #define INTEL_INFO(p) (&__I915__(p)->info) |
2462 | #define INTEL_INFO(p) (&__I915__(p)->info) |
2124 | #define INTEL_DEVID(p) (INTEL_INFO(p)->device_id) |
2463 | #define INTEL_DEVID(p) (INTEL_INFO(p)->device_id) |
- | 2464 | #define INTEL_REVID(p) (__I915__(p)->dev->pdev->revision) |
|
2125 | 2465 | ||
2126 | #define IS_I830(dev) (INTEL_DEVID(dev) == 0x3577) |
2466 | #define IS_I830(dev) (INTEL_DEVID(dev) == 0x3577) |
2127 | #define IS_845G(dev) (INTEL_DEVID(dev) == 0x2562) |
2467 | #define IS_845G(dev) (INTEL_DEVID(dev) == 0x2562) |
2128 | #define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x) |
2468 | #define IS_I85X(dev) (INTEL_INFO(dev)->is_i85x) |
2129 | #define IS_I865G(dev) (INTEL_DEVID(dev) == 0x2572) |
2469 | #define IS_I865G(dev) (INTEL_DEVID(dev) == 0x2572) |
2130 | #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g) |
2470 | #define IS_I915G(dev) (INTEL_INFO(dev)->is_i915g) |
2131 | #define IS_I915GM(dev) (INTEL_DEVID(dev) == 0x2592) |
2471 | #define IS_I915GM(dev) (INTEL_DEVID(dev) == 0x2592) |
2132 | #define IS_I945G(dev) (INTEL_DEVID(dev) == 0x2772) |
2472 | #define IS_I945G(dev) (INTEL_DEVID(dev) == 0x2772) |
2133 | #define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm) |
2473 | #define IS_I945GM(dev) (INTEL_INFO(dev)->is_i945gm) |
2134 | #define IS_BROADWATER(dev) (INTEL_INFO(dev)->is_broadwater) |
2474 | #define IS_BROADWATER(dev) (INTEL_INFO(dev)->is_broadwater) |
2135 | #define IS_CRESTLINE(dev) (INTEL_INFO(dev)->is_crestline) |
2475 | #define IS_CRESTLINE(dev) (INTEL_INFO(dev)->is_crestline) |
2136 | #define IS_GM45(dev) (INTEL_DEVID(dev) == 0x2A42) |
2476 | #define IS_GM45(dev) (INTEL_DEVID(dev) == 0x2A42) |
2137 | #define IS_G4X(dev) (INTEL_INFO(dev)->is_g4x) |
2477 | #define IS_G4X(dev) (INTEL_INFO(dev)->is_g4x) |
2138 | #define IS_PINEVIEW_G(dev) (INTEL_DEVID(dev) == 0xa001) |
2478 | #define IS_PINEVIEW_G(dev) (INTEL_DEVID(dev) == 0xa001) |
2139 | #define IS_PINEVIEW_M(dev) (INTEL_DEVID(dev) == 0xa011) |
2479 | #define IS_PINEVIEW_M(dev) (INTEL_DEVID(dev) == 0xa011) |
2140 | #define IS_PINEVIEW(dev) (INTEL_INFO(dev)->is_pineview) |
2480 | #define IS_PINEVIEW(dev) (INTEL_INFO(dev)->is_pineview) |
2141 | #define IS_G33(dev) (INTEL_INFO(dev)->is_g33) |
2481 | #define IS_G33(dev) (INTEL_INFO(dev)->is_g33) |
2142 | #define IS_IRONLAKE_M(dev) (INTEL_DEVID(dev) == 0x0046) |
2482 | #define IS_IRONLAKE_M(dev) (INTEL_DEVID(dev) == 0x0046) |
2143 | #define IS_IVYBRIDGE(dev) (INTEL_INFO(dev)->is_ivybridge) |
2483 | #define IS_IVYBRIDGE(dev) (INTEL_INFO(dev)->is_ivybridge) |
2144 | #define IS_IVB_GT1(dev) (INTEL_DEVID(dev) == 0x0156 || \ |
2484 | #define IS_IVB_GT1(dev) (INTEL_DEVID(dev) == 0x0156 || \ |
2145 | INTEL_DEVID(dev) == 0x0152 || \ |
2485 | INTEL_DEVID(dev) == 0x0152 || \ |
2146 | INTEL_DEVID(dev) == 0x015a) |
2486 | INTEL_DEVID(dev) == 0x015a) |
2147 | #define IS_SNB_GT1(dev) (INTEL_DEVID(dev) == 0x0102 || \ |
- | |
2148 | INTEL_DEVID(dev) == 0x0106 || \ |
- | |
2149 | INTEL_DEVID(dev) == 0x010A) |
- | |
2150 | #define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview) |
2487 | #define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview) |
2151 | #define IS_CHERRYVIEW(dev) (INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev)) |
2488 | #define IS_CHERRYVIEW(dev) (INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev)) |
2152 | #define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell) |
2489 | #define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell) |
2153 | #define IS_BROADWELL(dev) (!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev)) |
2490 | #define IS_BROADWELL(dev) (!INTEL_INFO(dev)->is_valleyview && IS_GEN8(dev)) |
2154 | #define IS_SKYLAKE(dev) (INTEL_INFO(dev)->is_skylake) |
2491 | #define IS_SKYLAKE(dev) (INTEL_INFO(dev)->is_skylake) |
- | 2492 | #define IS_BROXTON(dev) (!INTEL_INFO(dev)->is_skylake && IS_GEN9(dev)) |
|
2155 | #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) |
2493 | #define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) |
2156 | #define IS_HSW_EARLY_SDV(dev) (IS_HASWELL(dev) && \ |
2494 | #define IS_HSW_EARLY_SDV(dev) (IS_HASWELL(dev) && \ |
2157 | (INTEL_DEVID(dev) & 0xFF00) == 0x0C00) |
2495 | (INTEL_DEVID(dev) & 0xFF00) == 0x0C00) |
2158 | #define IS_BDW_ULT(dev) (IS_BROADWELL(dev) && \ |
2496 | #define IS_BDW_ULT(dev) (IS_BROADWELL(dev) && \ |
2159 | ((INTEL_DEVID(dev) & 0xf) == 0x2 || \ |
2497 | ((INTEL_DEVID(dev) & 0xf) == 0x6 || \ |
2160 | (INTEL_DEVID(dev) & 0xf) == 0x6 || \ |
2498 | (INTEL_DEVID(dev) & 0xf) == 0xb || \ |
2161 | (INTEL_DEVID(dev) & 0xf) == 0xe)) |
2499 | (INTEL_DEVID(dev) & 0xf) == 0xe)) |
- | 2500 | /* ULX machines are also considered ULT. */ |
|
- | 2501 | #define IS_BDW_ULX(dev) (IS_BROADWELL(dev) && \ |
|
- | 2502 | (INTEL_DEVID(dev) & 0xf) == 0xe) |
|
2162 | #define IS_BDW_GT3(dev) (IS_BROADWELL(dev) && \ |
2503 | #define IS_BDW_GT3(dev) (IS_BROADWELL(dev) && \ |
2163 | (INTEL_DEVID(dev) & 0x00F0) == 0x0020) |
2504 | (INTEL_DEVID(dev) & 0x00F0) == 0x0020) |
2164 | #define IS_HSW_ULT(dev) (IS_HASWELL(dev) && \ |
2505 | #define IS_HSW_ULT(dev) (IS_HASWELL(dev) && \ |
2165 | (INTEL_DEVID(dev) & 0xFF00) == 0x0A00) |
2506 | (INTEL_DEVID(dev) & 0xFF00) == 0x0A00) |
2166 | #define IS_HSW_GT3(dev) (IS_HASWELL(dev) && \ |
2507 | #define IS_HSW_GT3(dev) (IS_HASWELL(dev) && \ |
2167 | (INTEL_DEVID(dev) & 0x00F0) == 0x0020) |
2508 | (INTEL_DEVID(dev) & 0x00F0) == 0x0020) |
2168 | /* ULX machines are also considered ULT. */ |
2509 | /* ULX machines are also considered ULT. */ |
2169 | #define IS_HSW_ULX(dev) (INTEL_DEVID(dev) == 0x0A0E || \ |
2510 | #define IS_HSW_ULX(dev) (INTEL_DEVID(dev) == 0x0A0E || \ |
2170 | INTEL_DEVID(dev) == 0x0A1E) |
2511 | INTEL_DEVID(dev) == 0x0A1E) |
- | 2512 | #define IS_SKL_ULT(dev) (INTEL_DEVID(dev) == 0x1906 || \ |
|
- | 2513 | INTEL_DEVID(dev) == 0x1913 || \ |
|
- | 2514 | INTEL_DEVID(dev) == 0x1916 || \ |
|
- | 2515 | INTEL_DEVID(dev) == 0x1921 || \ |
|
- | 2516 | INTEL_DEVID(dev) == 0x1926) |
|
- | 2517 | #define IS_SKL_ULX(dev) (INTEL_DEVID(dev) == 0x190E || \ |
|
- | 2518 | INTEL_DEVID(dev) == 0x1915 || \ |
|
- | 2519 | INTEL_DEVID(dev) == 0x191E) |
|
- | 2520 | #define IS_SKL_GT3(dev) (IS_SKYLAKE(dev) && \ |
|
- | 2521 | (INTEL_DEVID(dev) & 0x00F0) == 0x0020) |
|
- | 2522 | #define IS_SKL_GT4(dev) (IS_SKYLAKE(dev) && \ |
|
- | 2523 | (INTEL_DEVID(dev) & 0x00F0) == 0x0030) |
|
- | 2524 | ||
2171 | #define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary) |
2525 | #define IS_PRELIMINARY_HW(intel_info) ((intel_info)->is_preliminary) |
- | 2526 | ||
- | 2527 | #define SKL_REVID_A0 (0x0) |
|
- | 2528 | #define SKL_REVID_B0 (0x1) |
|
- | 2529 | #define SKL_REVID_C0 (0x2) |
|
- | 2530 | #define SKL_REVID_D0 (0x3) |
|
- | 2531 | #define SKL_REVID_E0 (0x4) |
|
- | 2532 | #define SKL_REVID_F0 (0x5) |
|
- | 2533 | ||
- | 2534 | #define BXT_REVID_A0 (0x0) |
|
- | 2535 | #define BXT_REVID_B0 (0x3) |
|
- | 2536 | #define BXT_REVID_C0 (0x9) |
|
2172 | 2537 | ||
2173 | /* |
2538 | /* |
2174 | * The genX designation typically refers to the render engine, so render |
2539 | * The genX designation typically refers to the render engine, so render |
2175 | * capability related checks should use IS_GEN, while display and other checks |
2540 | * capability related checks should use IS_GEN, while display and other checks |
2176 | * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular |
2541 | * have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular |
2177 | * chips, etc.). |
2542 | * chips, etc.). |
2178 | */ |
2543 | */ |
2179 | #define IS_GEN2(dev) (INTEL_INFO(dev)->gen == 2) |
2544 | #define IS_GEN2(dev) (INTEL_INFO(dev)->gen == 2) |
2180 | #define IS_GEN3(dev) (INTEL_INFO(dev)->gen == 3) |
2545 | #define IS_GEN3(dev) (INTEL_INFO(dev)->gen == 3) |
2181 | #define IS_GEN4(dev) (INTEL_INFO(dev)->gen == 4) |
2546 | #define IS_GEN4(dev) (INTEL_INFO(dev)->gen == 4) |
2182 | #define IS_GEN5(dev) (INTEL_INFO(dev)->gen == 5) |
2547 | #define IS_GEN5(dev) (INTEL_INFO(dev)->gen == 5) |
2183 | #define IS_GEN6(dev) (INTEL_INFO(dev)->gen == 6) |
2548 | #define IS_GEN6(dev) (INTEL_INFO(dev)->gen == 6) |
2184 | #define IS_GEN7(dev) (INTEL_INFO(dev)->gen == 7) |
2549 | #define IS_GEN7(dev) (INTEL_INFO(dev)->gen == 7) |
2185 | #define IS_GEN8(dev) (INTEL_INFO(dev)->gen == 8) |
2550 | #define IS_GEN8(dev) (INTEL_INFO(dev)->gen == 8) |
2186 | #define IS_GEN9(dev) (INTEL_INFO(dev)->gen == 9) |
2551 | #define IS_GEN9(dev) (INTEL_INFO(dev)->gen == 9) |
2187 | 2552 | ||
2188 | #define RENDER_RING (1< |
2553 | #define RENDER_RING (1< |
2189 | #define BSD_RING (1< |
2554 | #define BSD_RING (1< |
2190 | #define BLT_RING (1< |
2555 | #define BLT_RING (1< |
2191 | #define VEBOX_RING (1< |
2556 | #define VEBOX_RING (1< |
2192 | #define BSD2_RING (1< |
2557 | #define BSD2_RING (1< |
2193 | #define HAS_BSD(dev) (INTEL_INFO(dev)->ring_mask & BSD_RING) |
2558 | #define HAS_BSD(dev) (INTEL_INFO(dev)->ring_mask & BSD_RING) |
2194 | #define HAS_BSD2(dev) (INTEL_INFO(dev)->ring_mask & BSD2_RING) |
2559 | #define HAS_BSD2(dev) (INTEL_INFO(dev)->ring_mask & BSD2_RING) |
2195 | #define HAS_BLT(dev) (INTEL_INFO(dev)->ring_mask & BLT_RING) |
2560 | #define HAS_BLT(dev) (INTEL_INFO(dev)->ring_mask & BLT_RING) |
2196 | #define HAS_VEBOX(dev) (INTEL_INFO(dev)->ring_mask & VEBOX_RING) |
2561 | #define HAS_VEBOX(dev) (INTEL_INFO(dev)->ring_mask & VEBOX_RING) |
2197 | #define HAS_LLC(dev) (INTEL_INFO(dev)->has_llc) |
2562 | #define HAS_LLC(dev) (INTEL_INFO(dev)->has_llc) |
2198 | #define HAS_WT(dev) ((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \ |
2563 | #define HAS_WT(dev) ((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \ |
2199 | __I915__(dev)->ellc_size) |
2564 | __I915__(dev)->ellc_size) |
2200 | #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws) |
2565 | #define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws) |
2201 | 2566 | ||
2202 | #define HAS_HW_CONTEXTS(dev) (INTEL_INFO(dev)->gen >= 6) |
2567 | #define HAS_HW_CONTEXTS(dev) (INTEL_INFO(dev)->gen >= 6) |
2203 | #define HAS_LOGICAL_RING_CONTEXTS(dev) (INTEL_INFO(dev)->gen >= 8) |
2568 | #define HAS_LOGICAL_RING_CONTEXTS(dev) (INTEL_INFO(dev)->gen >= 8) |
2204 | #define USES_PPGTT(dev) (i915.enable_ppgtt) |
2569 | #define USES_PPGTT(dev) (i915.enable_ppgtt) |
2205 | #define USES_FULL_PPGTT(dev) (i915.enable_ppgtt == 2) |
2570 | #define USES_FULL_PPGTT(dev) (i915.enable_ppgtt >= 2) |
- | 2571 | #define USES_FULL_48BIT_PPGTT(dev) (i915.enable_ppgtt == 3) |
|
2206 | 2572 | ||
2207 | #define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay) |
2573 | #define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay) |
2208 | #define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical) |
2574 | #define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical) |
2209 | 2575 | ||
2210 | /* Early gen2 have a totally busted CS tlb and require pinned batches. */ |
2576 | /* Early gen2 have a totally busted CS tlb and require pinned batches. */ |
2211 | #define HAS_BROKEN_CS_TLB(dev) (IS_I830(dev) || IS_845G(dev)) |
2577 | #define HAS_BROKEN_CS_TLB(dev) (IS_I830(dev) || IS_845G(dev)) |
2212 | /* |
2578 | /* |
2213 | * dp aux and gmbus irq on gen4 seems to be able to generate legacy interrupts |
2579 | * dp aux and gmbus irq on gen4 seems to be able to generate legacy interrupts |
2214 | * even when in MSI mode. This results in spurious interrupt warnings if the |
2580 | * even when in MSI mode. This results in spurious interrupt warnings if the |
2215 | * legacy irq no. is shared with another device. The kernel then disables that |
2581 | * legacy irq no. is shared with another device. The kernel then disables that |
2216 | * interrupt source and so prevents the other device from working properly. |
2582 | * interrupt source and so prevents the other device from working properly. |
2217 | */ |
2583 | */ |
2218 | #define HAS_AUX_IRQ(dev) (INTEL_INFO(dev)->gen >= 5) |
2584 | #define HAS_AUX_IRQ(dev) (INTEL_INFO(dev)->gen >= 5) |
2219 | #define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 5) |
2585 | #define HAS_GMBUS_IRQ(dev) (INTEL_INFO(dev)->gen >= 5) |
2220 | 2586 | ||
2221 | /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte |
2587 | /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte |
2222 | * rows, which changed the alignment requirements and fence programming. |
2588 | * rows, which changed the alignment requirements and fence programming. |
2223 | */ |
2589 | */ |
2224 | #define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \ |
2590 | #define HAS_128_BYTE_Y_TILING(dev) (!IS_GEN2(dev) && !(IS_I915G(dev) || \ |
2225 | IS_I915GM(dev))) |
2591 | IS_I915GM(dev))) |
2226 | #define SUPPORTS_DIGITAL_OUTPUTS(dev) (!IS_GEN2(dev) && !IS_PINEVIEW(dev)) |
- | |
2227 | #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_GEN5(dev)) |
- | |
2228 | #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_GEN5(dev)) |
- | |
2229 | #define SUPPORTS_TV(dev) (INTEL_INFO(dev)->supports_tv) |
2592 | #define SUPPORTS_TV(dev) (INTEL_INFO(dev)->supports_tv) |
2230 | #define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug) |
2593 | #define I915_HAS_HOTPLUG(dev) (INTEL_INFO(dev)->has_hotplug) |
2231 | 2594 | ||
2232 | #define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2) |
2595 | #define HAS_FW_BLC(dev) (INTEL_INFO(dev)->gen > 2) |
2233 | #define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr) |
2596 | #define HAS_PIPE_CXSR(dev) (INTEL_INFO(dev)->has_pipe_cxsr) |
2234 | #define HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc) |
2597 | #define HAS_FBC(dev) (INTEL_INFO(dev)->has_fbc) |
2235 | 2598 | ||
2236 | #define HAS_IPS(dev) (IS_HSW_ULT(dev) || IS_BROADWELL(dev)) |
2599 | #define HAS_IPS(dev) (IS_HSW_ULT(dev) || IS_BROADWELL(dev)) |
- | 2600 | ||
- | 2601 | #define HAS_DP_MST(dev) (IS_HASWELL(dev) || IS_BROADWELL(dev) || \ |
|
- | 2602 | INTEL_INFO(dev)->gen >= 9) |
|
2237 | 2603 | ||
2238 | #define HAS_DDI(dev) (INTEL_INFO(dev)->has_ddi) |
2604 | #define HAS_DDI(dev) (INTEL_INFO(dev)->has_ddi) |
2239 | #define HAS_FPGA_DBG_UNCLAIMED(dev) (INTEL_INFO(dev)->has_fpga_dbg) |
2605 | #define HAS_FPGA_DBG_UNCLAIMED(dev) (INTEL_INFO(dev)->has_fpga_dbg) |
- | 2606 | #define HAS_PSR(dev) (IS_HASWELL(dev) || IS_BROADWELL(dev) || \ |
|
- | 2607 | IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev) || \ |
|
2240 | #define HAS_PSR(dev) (IS_HASWELL(dev) || IS_BROADWELL(dev)) |
2608 | IS_SKYLAKE(dev)) |
2241 | #define HAS_RUNTIME_PM(dev) (IS_GEN6(dev) || IS_HASWELL(dev) || \ |
2609 | #define HAS_RUNTIME_PM(dev) (IS_GEN6(dev) || IS_HASWELL(dev) || \ |
- | 2610 | IS_BROADWELL(dev) || IS_VALLEYVIEW(dev) || \ |
|
2242 | IS_BROADWELL(dev) || IS_VALLEYVIEW(dev)) |
2611 | IS_SKYLAKE(dev)) |
2243 | #define HAS_RC6(dev) (INTEL_INFO(dev)->gen >= 6) |
2612 | #define HAS_RC6(dev) (INTEL_INFO(dev)->gen >= 6) |
2244 | #define HAS_RC6p(dev) (INTEL_INFO(dev)->gen == 6 || IS_IVYBRIDGE(dev)) |
2613 | #define HAS_RC6p(dev) (INTEL_INFO(dev)->gen == 6 || IS_IVYBRIDGE(dev)) |
- | 2614 | ||
- | 2615 | #define HAS_CSR(dev) (IS_GEN9(dev)) |
|
- | 2616 | ||
- | 2617 | #define HAS_GUC_UCODE(dev) (IS_GEN9(dev)) |
|
- | 2618 | #define HAS_GUC_SCHED(dev) (IS_GEN9(dev)) |
|
- | 2619 | ||
- | 2620 | #define HAS_RESOURCE_STREAMER(dev) (IS_HASWELL(dev) || \ |
|
- | 2621 | INTEL_INFO(dev)->gen >= 8) |
|
- | 2622 | ||
- | 2623 | #define HAS_CORE_RING_FREQ(dev) (INTEL_INFO(dev)->gen >= 6 && \ |
|
- | 2624 | !IS_VALLEYVIEW(dev) && !IS_BROXTON(dev)) |
|
2245 | 2625 | ||
2246 | #define INTEL_PCH_DEVICE_ID_MASK 0xff00 |
2626 | #define INTEL_PCH_DEVICE_ID_MASK 0xff00 |
2247 | #define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00 |
2627 | #define INTEL_PCH_IBX_DEVICE_ID_TYPE 0x3b00 |
2248 | #define INTEL_PCH_CPT_DEVICE_ID_TYPE 0x1c00 |
2628 | #define INTEL_PCH_CPT_DEVICE_ID_TYPE 0x1c00 |
2249 | #define INTEL_PCH_PPT_DEVICE_ID_TYPE 0x1e00 |
2629 | #define INTEL_PCH_PPT_DEVICE_ID_TYPE 0x1e00 |
2250 | #define INTEL_PCH_LPT_DEVICE_ID_TYPE 0x8c00 |
2630 | #define INTEL_PCH_LPT_DEVICE_ID_TYPE 0x8c00 |
2251 | #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE 0x9c00 |
2631 | #define INTEL_PCH_LPT_LP_DEVICE_ID_TYPE 0x9c00 |
2252 | #define INTEL_PCH_SPT_DEVICE_ID_TYPE 0xA100 |
2632 | #define INTEL_PCH_SPT_DEVICE_ID_TYPE 0xA100 |
2253 | #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE 0x9D00 |
2633 | #define INTEL_PCH_SPT_LP_DEVICE_ID_TYPE 0x9D00 |
- | 2634 | #define INTEL_PCH_P2X_DEVICE_ID_TYPE 0x7100 |
|
2254 | 2635 | ||
2255 | #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type) |
2636 | #define INTEL_PCH_TYPE(dev) (__I915__(dev)->pch_type) |
2256 | #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT) |
2637 | #define HAS_PCH_SPT(dev) (INTEL_PCH_TYPE(dev) == PCH_SPT) |
2257 | #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT) |
2638 | #define HAS_PCH_LPT(dev) (INTEL_PCH_TYPE(dev) == PCH_LPT) |
- | 2639 | #define HAS_PCH_LPT_LP(dev) (__I915__(dev)->pch_id == INTEL_PCH_LPT_LP_DEVICE_ID_TYPE) |
|
2258 | #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) |
2640 | #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) |
2259 | #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) |
2641 | #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) |
2260 | #define HAS_PCH_NOP(dev) (INTEL_PCH_TYPE(dev) == PCH_NOP) |
2642 | #define HAS_PCH_NOP(dev) (INTEL_PCH_TYPE(dev) == PCH_NOP) |
2261 | #define HAS_PCH_SPLIT(dev) (INTEL_PCH_TYPE(dev) != PCH_NONE) |
2643 | #define HAS_PCH_SPLIT(dev) (INTEL_PCH_TYPE(dev) != PCH_NONE) |
2262 | 2644 | ||
2263 | #define HAS_GMCH_DISPLAY(dev) (INTEL_INFO(dev)->gen < 5 || IS_VALLEYVIEW(dev)) |
2645 | #define HAS_GMCH_DISPLAY(dev) (INTEL_INFO(dev)->gen < 5 || IS_VALLEYVIEW(dev)) |
2264 | 2646 | ||
2265 | /* DPF == dynamic parity feature */ |
2647 | /* DPF == dynamic parity feature */ |
2266 | #define HAS_L3_DPF(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) |
2648 | #define HAS_L3_DPF(dev) (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) |
2267 | #define NUM_L3_SLICES(dev) (IS_HSW_GT3(dev) ? 2 : HAS_L3_DPF(dev)) |
2649 | #define NUM_L3_SLICES(dev) (IS_HSW_GT3(dev) ? 2 : HAS_L3_DPF(dev)) |
2268 | 2650 | ||
2269 | #define GT_FREQUENCY_MULTIPLIER 50 |
2651 | #define GT_FREQUENCY_MULTIPLIER 50 |
- | 2652 | #define GEN9_FREQ_SCALER 3 |
|
2270 | 2653 | ||
2271 | #include "i915_trace.h" |
2654 | #include "i915_trace.h" |
- | 2655 | ||
- | 2656 | extern const struct drm_ioctl_desc i915_ioctls[]; |
|
2272 | 2657 | extern int i915_max_ioctl; |
|
2273 | - | ||
2274 | extern int i915_master_create(struct drm_device *dev, struct drm_master *master); |
2658 | |
2275 | extern void i915_master_destroy(struct drm_device *dev, struct drm_master *master); |
2659 | extern int i915_resume_switcheroo(struct drm_device *dev); |
2276 | 2660 | ||
2277 | /* i915_params.c */ |
2661 | /* i915_params.c */ |
2278 | struct i915_params { |
2662 | struct i915_params { |
2279 | int modeset; |
2663 | int modeset; |
2280 | int panel_ignore_lid; |
2664 | int panel_ignore_lid; |
2281 | unsigned int powersave; |
- | |
2282 | int semaphores; |
2665 | int semaphores; |
2283 | unsigned int lvds_downclock; |
- | |
2284 | int lvds_channel_mode; |
2666 | int lvds_channel_mode; |
2285 | int panel_use_ssc; |
2667 | int panel_use_ssc; |
2286 | int vbt_sdvo_panel_type; |
2668 | int vbt_sdvo_panel_type; |
2287 | int enable_rc6; |
2669 | int enable_rc6; |
2288 | int enable_fbc; |
2670 | int enable_fbc; |
2289 | int enable_ppgtt; |
2671 | int enable_ppgtt; |
2290 | int enable_execlists; |
2672 | int enable_execlists; |
2291 | int enable_psr; |
2673 | int enable_psr; |
2292 | unsigned int preliminary_hw_support; |
2674 | unsigned int preliminary_hw_support; |
2293 | int disable_power_well; |
2675 | int disable_power_well; |
2294 | int enable_ips; |
2676 | int enable_ips; |
2295 | int invert_brightness; |
2677 | int invert_brightness; |
2296 | int enable_cmd_parser; |
2678 | int enable_cmd_parser; |
2297 | /* leave bools at the end to not create holes */ |
2679 | /* leave bools at the end to not create holes */ |
2298 | bool enable_hangcheck; |
2680 | bool enable_hangcheck; |
2299 | bool fastboot; |
2681 | bool fastboot; |
2300 | bool prefault_disable; |
2682 | bool prefault_disable; |
- | 2683 | bool load_detect_test; |
|
2301 | bool reset; |
2684 | bool reset; |
2302 | bool disable_display; |
2685 | bool disable_display; |
2303 | bool disable_vtd_wa; |
2686 | bool disable_vtd_wa; |
- | 2687 | bool enable_guc_submission; |
|
- | 2688 | int guc_log_level; |
|
2304 | int use_mmio_flip; |
2689 | int use_mmio_flip; |
2305 | bool mmio_debug; |
2690 | int mmio_debug; |
- | 2691 | bool verbose_state_checks; |
|
- | 2692 | bool nuclear_pageflip; |
|
- | 2693 | int edp_vswing; |
|
2306 | }; |
2694 | }; |
2307 | extern struct i915_params i915 __read_mostly; |
2695 | extern struct i915_params i915 __read_mostly; |
2308 | 2696 | ||
2309 | /* i915_dma.c */ |
2697 | /* i915_dma.c */ |
2310 | extern int i915_driver_load(struct drm_device *, unsigned long flags); |
2698 | extern int i915_driver_load(struct drm_device *, unsigned long flags); |
2311 | extern int i915_driver_unload(struct drm_device *); |
2699 | extern int i915_driver_unload(struct drm_device *); |
2312 | extern int i915_driver_open(struct drm_device *dev, struct drm_file *file); |
2700 | extern int i915_driver_open(struct drm_device *dev, struct drm_file *file); |
2313 | extern void i915_driver_lastclose(struct drm_device * dev); |
2701 | extern void i915_driver_lastclose(struct drm_device * dev); |
2314 | extern void i915_driver_preclose(struct drm_device *dev, |
2702 | extern void i915_driver_preclose(struct drm_device *dev, |
2315 | struct drm_file *file); |
2703 | struct drm_file *file); |
2316 | extern void i915_driver_postclose(struct drm_device *dev, |
2704 | extern void i915_driver_postclose(struct drm_device *dev, |
2317 | struct drm_file *file); |
2705 | struct drm_file *file); |
2318 | extern int i915_driver_device_is_agp(struct drm_device * dev); |
- | |
2319 | #ifdef CONFIG_COMPAT |
2706 | #ifdef CONFIG_COMPAT |
2320 | extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, |
2707 | extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, |
2321 | unsigned long arg); |
2708 | unsigned long arg); |
2322 | #endif |
2709 | #endif |
2323 | extern int intel_gpu_reset(struct drm_device *dev); |
2710 | extern int intel_gpu_reset(struct drm_device *dev); |
- | 2711 | extern bool intel_has_gpu_reset(struct drm_device *dev); |
|
2324 | extern int i915_reset(struct drm_device *dev); |
2712 | extern int i915_reset(struct drm_device *dev); |
2325 | extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv); |
2713 | extern unsigned long i915_chipset_val(struct drm_i915_private *dev_priv); |
2326 | extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv); |
2714 | extern unsigned long i915_mch_val(struct drm_i915_private *dev_priv); |
2327 | extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv); |
2715 | extern unsigned long i915_gfx_val(struct drm_i915_private *dev_priv); |
2328 | extern void i915_update_gfx_val(struct drm_i915_private *dev_priv); |
2716 | extern void i915_update_gfx_val(struct drm_i915_private *dev_priv); |
2329 | int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on); |
2717 | int vlv_force_gfx_clock(struct drm_i915_private *dev_priv, bool on); |
- | 2718 | void i915_firmware_load_error_print(const char *fw_path, int err); |
|
- | 2719 | ||
- | 2720 | /* intel_hotplug.c */ |
|
- | 2721 | void intel_hpd_irq_handler(struct drm_device *dev, u32 pin_mask, u32 long_mask); |
|
- | 2722 | void intel_hpd_init(struct drm_i915_private *dev_priv); |
|
- | 2723 | void intel_hpd_init_work(struct drm_i915_private *dev_priv); |
|
2330 | void intel_hpd_cancel_work(struct drm_i915_private *dev_priv); |
2724 | void intel_hpd_cancel_work(struct drm_i915_private *dev_priv); |
- | 2725 | bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port); |
|
2331 | 2726 | ||
2332 | /* i915_irq.c */ |
2727 | /* i915_irq.c */ |
2333 | void i915_queue_hangcheck(struct drm_device *dev); |
2728 | void i915_queue_hangcheck(struct drm_device *dev); |
2334 | __printf(3, 4) |
2729 | __printf(3, 4) |
2335 | void i915_handle_error(struct drm_device *dev, bool wedged, |
2730 | void i915_handle_error(struct drm_device *dev, bool wedged, |
2336 | const char *fmt, ...); |
2731 | const char *fmt, ...); |
2337 | 2732 | ||
2338 | extern void intel_irq_init(struct drm_i915_private *dev_priv); |
2733 | extern void intel_irq_init(struct drm_i915_private *dev_priv); |
2339 | extern void intel_hpd_init(struct drm_i915_private *dev_priv); |
- | |
2340 | int intel_irq_install(struct drm_i915_private *dev_priv); |
2734 | int intel_irq_install(struct drm_i915_private *dev_priv); |
2341 | void intel_irq_uninstall(struct drm_i915_private *dev_priv); |
2735 | void intel_irq_uninstall(struct drm_i915_private *dev_priv); |
2342 | 2736 | ||
2343 | extern void intel_uncore_sanitize(struct drm_device *dev); |
2737 | extern void intel_uncore_sanitize(struct drm_device *dev); |
2344 | extern void intel_uncore_early_sanitize(struct drm_device *dev, |
2738 | extern void intel_uncore_early_sanitize(struct drm_device *dev, |
2345 | bool restore_forcewake); |
2739 | bool restore_forcewake); |
2346 | extern void intel_uncore_init(struct drm_device *dev); |
2740 | extern void intel_uncore_init(struct drm_device *dev); |
2347 | extern void intel_uncore_check_errors(struct drm_device *dev); |
2741 | extern void intel_uncore_check_errors(struct drm_device *dev); |
2348 | extern void intel_uncore_fini(struct drm_device *dev); |
2742 | extern void intel_uncore_fini(struct drm_device *dev); |
2349 | extern void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore); |
2743 | extern void intel_uncore_forcewake_reset(struct drm_device *dev, bool restore); |
- | 2744 | const char *intel_uncore_forcewake_domain_to_str(const enum forcewake_domain_id id); |
|
- | 2745 | void intel_uncore_forcewake_get(struct drm_i915_private *dev_priv, |
|
- | 2746 | enum forcewake_domains domains); |
|
- | 2747 | void intel_uncore_forcewake_put(struct drm_i915_private *dev_priv, |
|
- | 2748 | enum forcewake_domains domains); |
|
- | 2749 | /* Like above but the caller must manage the uncore.lock itself. |
|
- | 2750 | * Must be used with I915_READ_FW and friends. |
|
- | 2751 | */ |
|
- | 2752 | void intel_uncore_forcewake_get__locked(struct drm_i915_private *dev_priv, |
|
- | 2753 | enum forcewake_domains domains); |
|
- | 2754 | void intel_uncore_forcewake_put__locked(struct drm_i915_private *dev_priv, |
|
- | 2755 | enum forcewake_domains domains); |
|
- | 2756 | void assert_forcewakes_inactive(struct drm_i915_private *dev_priv); |
|
- | 2757 | static inline bool intel_vgpu_active(struct drm_device *dev) |
|
- | 2758 | { |
|
- | 2759 | return to_i915(dev)->vgpu.active; |
|
- | 2760 | } |
|
2350 | 2761 | ||
2351 | void |
2762 | void |
2352 | i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, |
2763 | i915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, |
2353 | u32 status_mask); |
2764 | u32 status_mask); |
2354 | 2765 | ||
2355 | void |
2766 | void |
2356 | i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, |
2767 | i915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, |
2357 | u32 status_mask); |
2768 | u32 status_mask); |
2358 | 2769 | ||
2359 | void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv); |
2770 | void valleyview_enable_display_irqs(struct drm_i915_private *dev_priv); |
2360 | void valleyview_disable_display_irqs(struct drm_i915_private *dev_priv); |
2771 | void valleyview_disable_display_irqs(struct drm_i915_private *dev_priv); |
- | 2772 | void i915_hotplug_interrupt_update(struct drm_i915_private *dev_priv, |
|
- | 2773 | uint32_t mask, |
|
- | 2774 | uint32_t bits); |
|
2361 | void |
2775 | void |
2362 | ironlake_enable_display_irq(struct drm_i915_private *dev_priv, u32 mask); |
2776 | ironlake_enable_display_irq(struct drm_i915_private *dev_priv, u32 mask); |
2363 | void |
2777 | void |
2364 | ironlake_disable_display_irq(struct drm_i915_private *dev_priv, u32 mask); |
2778 | ironlake_disable_display_irq(struct drm_i915_private *dev_priv, u32 mask); |
2365 | void ibx_display_interrupt_update(struct drm_i915_private *dev_priv, |
2779 | void ibx_display_interrupt_update(struct drm_i915_private *dev_priv, |
2366 | uint32_t interrupt_mask, |
2780 | uint32_t interrupt_mask, |
2367 | uint32_t enabled_irq_mask); |
2781 | uint32_t enabled_irq_mask); |
2368 | #define ibx_enable_display_interrupt(dev_priv, bits) \ |
2782 | #define ibx_enable_display_interrupt(dev_priv, bits) \ |
2369 | ibx_display_interrupt_update((dev_priv), (bits), (bits)) |
2783 | ibx_display_interrupt_update((dev_priv), (bits), (bits)) |
2370 | #define ibx_disable_display_interrupt(dev_priv, bits) \ |
2784 | #define ibx_disable_display_interrupt(dev_priv, bits) \ |
2371 | ibx_display_interrupt_update((dev_priv), (bits), 0) |
2785 | ibx_display_interrupt_update((dev_priv), (bits), 0) |
2372 | 2786 | ||
2373 | /* i915_gem.c */ |
2787 | /* i915_gem.c */ |
2374 | int i915_gem_create_ioctl(struct drm_device *dev, void *data, |
2788 | int i915_gem_create_ioctl(struct drm_device *dev, void *data, |
2375 | struct drm_file *file_priv); |
2789 | struct drm_file *file_priv); |
2376 | int i915_gem_pread_ioctl(struct drm_device *dev, void *data, |
2790 | int i915_gem_pread_ioctl(struct drm_device *dev, void *data, |
2377 | struct drm_file *file_priv); |
2791 | struct drm_file *file_priv); |
2378 | int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, |
2792 | int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, |
2379 | struct drm_file *file_priv); |
2793 | struct drm_file *file_priv); |
2380 | int i915_gem_mmap_ioctl(struct drm_device *dev, void *data, |
2794 | int i915_gem_mmap_ioctl(struct drm_device *dev, void *data, |
2381 | struct drm_file *file_priv); |
2795 | struct drm_file *file_priv); |
2382 | int i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, |
2796 | int i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, |
2383 | struct drm_file *file_priv); |
2797 | struct drm_file *file_priv); |
2384 | int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, |
2798 | int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, |
2385 | struct drm_file *file_priv); |
2799 | struct drm_file *file_priv); |
2386 | int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, |
2800 | int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, |
2387 | struct drm_file *file_priv); |
2801 | struct drm_file *file_priv); |
2388 | void i915_gem_execbuffer_move_to_active(struct list_head *vmas, |
2802 | void i915_gem_execbuffer_move_to_active(struct list_head *vmas, |
2389 | struct intel_engine_cs *ring); |
2803 | struct drm_i915_gem_request *req); |
2390 | void i915_gem_execbuffer_retire_commands(struct drm_device *dev, |
2804 | void i915_gem_execbuffer_retire_commands(struct i915_execbuffer_params *params); |
2391 | struct drm_file *file, |
- | |
2392 | struct intel_engine_cs *ring, |
- | |
2393 | struct drm_i915_gem_object *obj); |
- | |
2394 | int i915_gem_ringbuffer_submission(struct drm_device *dev, |
2805 | int i915_gem_ringbuffer_submission(struct i915_execbuffer_params *params, |
2395 | struct drm_file *file, |
- | |
2396 | struct intel_engine_cs *ring, |
- | |
2397 | struct intel_context *ctx, |
- | |
2398 | struct drm_i915_gem_execbuffer2 *args, |
2806 | struct drm_i915_gem_execbuffer2 *args, |
2399 | struct list_head *vmas, |
2807 | struct list_head *vmas); |
2400 | struct drm_i915_gem_object *batch_obj, |
- | |
2401 | u64 exec_start, u32 flags); |
- | |
2402 | int i915_gem_execbuffer(struct drm_device *dev, void *data, |
2808 | int i915_gem_execbuffer(struct drm_device *dev, void *data, |
2403 | struct drm_file *file_priv); |
2809 | struct drm_file *file_priv); |
2404 | int i915_gem_execbuffer2(struct drm_device *dev, void *data, |
2810 | int i915_gem_execbuffer2(struct drm_device *dev, void *data, |
2405 | struct drm_file *file_priv); |
2811 | struct drm_file *file_priv); |
2406 | int i915_gem_pin_ioctl(struct drm_device *dev, void *data, |
- | |
2407 | struct drm_file *file_priv); |
- | |
2408 | int i915_gem_unpin_ioctl(struct drm_device *dev, void *data, |
- | |
2409 | struct drm_file *file_priv); |
- | |
2410 | int i915_gem_busy_ioctl(struct drm_device *dev, void *data, |
2812 | int i915_gem_busy_ioctl(struct drm_device *dev, void *data, |
2411 | struct drm_file *file_priv); |
2813 | struct drm_file *file_priv); |
2412 | int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data, |
2814 | int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data, |
2413 | struct drm_file *file); |
2815 | struct drm_file *file); |
2414 | int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, |
2816 | int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, |
2415 | struct drm_file *file); |
2817 | struct drm_file *file); |
2416 | int i915_gem_throttle_ioctl(struct drm_device *dev, void *data, |
2818 | int i915_gem_throttle_ioctl(struct drm_device *dev, void *data, |
2417 | struct drm_file *file_priv); |
2819 | struct drm_file *file_priv); |
2418 | int i915_gem_madvise_ioctl(struct drm_device *dev, void *data, |
2820 | int i915_gem_madvise_ioctl(struct drm_device *dev, void *data, |
2419 | struct drm_file *file_priv); |
2821 | struct drm_file *file_priv); |
2420 | int i915_gem_set_tiling(struct drm_device *dev, void *data, |
2822 | int i915_gem_set_tiling(struct drm_device *dev, void *data, |
2421 | struct drm_file *file_priv); |
2823 | struct drm_file *file_priv); |
2422 | int i915_gem_get_tiling(struct drm_device *dev, void *data, |
2824 | int i915_gem_get_tiling(struct drm_device *dev, void *data, |
2423 | struct drm_file *file_priv); |
2825 | struct drm_file *file_priv); |
2424 | int i915_gem_init_userptr(struct drm_device *dev); |
2826 | int i915_gem_init_userptr(struct drm_device *dev); |
2425 | int i915_gem_userptr_ioctl(struct drm_device *dev, void *data, |
2827 | int i915_gem_userptr_ioctl(struct drm_device *dev, void *data, |
2426 | struct drm_file *file); |
2828 | struct drm_file *file); |
2427 | int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, |
2829 | int i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, |
2428 | struct drm_file *file_priv); |
2830 | struct drm_file *file_priv); |
2429 | int i915_gem_wait_ioctl(struct drm_device *dev, void *data, |
2831 | int i915_gem_wait_ioctl(struct drm_device *dev, void *data, |
2430 | struct drm_file *file_priv); |
2832 | struct drm_file *file_priv); |
2431 | void i915_gem_load(struct drm_device *dev); |
2833 | void i915_gem_load(struct drm_device *dev); |
2432 | unsigned long i915_gem_shrink(struct drm_i915_private *dev_priv, |
- | |
2433 | long target, |
- | |
2434 | unsigned flags); |
- | |
2435 | #define I915_SHRINK_PURGEABLE 0x1 |
- | |
2436 | #define I915_SHRINK_UNBOUND 0x2 |
- | |
2437 | #define I915_SHRINK_BOUND 0x4 |
- | |
2438 | void *i915_gem_object_alloc(struct drm_device *dev); |
2834 | void *i915_gem_object_alloc(struct drm_device *dev); |
2439 | void i915_gem_object_free(struct drm_i915_gem_object *obj); |
2835 | void i915_gem_object_free(struct drm_i915_gem_object *obj); |
2440 | void i915_gem_object_init(struct drm_i915_gem_object *obj, |
2836 | void i915_gem_object_init(struct drm_i915_gem_object *obj, |
2441 | const struct drm_i915_gem_object_ops *ops); |
2837 | const struct drm_i915_gem_object_ops *ops); |
2442 | struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev, |
2838 | struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev, |
2443 | size_t size); |
2839 | size_t size); |
2444 | void i915_init_vm(struct drm_i915_private *dev_priv, |
2840 | struct drm_i915_gem_object *i915_gem_object_create_from_data( |
2445 | struct i915_address_space *vm); |
2841 | struct drm_device *dev, const void *data, size_t size); |
2446 | void i915_gem_free_object(struct drm_gem_object *obj); |
2842 | void i915_gem_free_object(struct drm_gem_object *obj); |
2447 | void i915_gem_vma_destroy(struct i915_vma *vma); |
2843 | void i915_gem_vma_destroy(struct i915_vma *vma); |
- | 2844 | ||
2448 | 2845 | /* Flags used by pin/bind&friends. */ |
|
2449 | #define PIN_MAPPABLE 0x1 |
2846 | #define PIN_MAPPABLE (1<<0) |
2450 | #define PIN_NONBLOCK 0x2 |
2847 | #define PIN_NONBLOCK (1<<1) |
2451 | #define PIN_GLOBAL 0x4 |
2848 | #define PIN_GLOBAL (1<<2) |
- | 2849 | #define PIN_OFFSET_BIAS (1<<3) |
|
- | 2850 | #define PIN_USER (1<<4) |
|
- | 2851 | #define PIN_UPDATE (1<<5) |
|
- | 2852 | #define PIN_ZONE_4G (1<<6) |
|
2452 | #define PIN_OFFSET_BIAS 0x8 |
2853 | #define PIN_HIGH (1<<7) |
- | 2854 | #define PIN_OFFSET_MASK (~4095) |
|
2453 | #define PIN_OFFSET_MASK (~4095) |
2855 | int __must_check |
2454 | int __must_check i915_gem_object_pin(struct drm_i915_gem_object *obj, |
2856 | i915_gem_object_pin(struct drm_i915_gem_object *obj, |
2455 | struct i915_address_space *vm, |
2857 | struct i915_address_space *vm, |
2456 | uint32_t alignment, |
2858 | uint32_t alignment, |
2457 | uint64_t flags); |
2859 | uint64_t flags); |
- | 2860 | int __must_check |
|
- | 2861 | i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj, |
|
- | 2862 | const struct i915_ggtt_view *view, |
|
- | 2863 | uint32_t alignment, |
|
- | 2864 | uint64_t flags); |
|
- | 2865 | ||
- | 2866 | int i915_vma_bind(struct i915_vma *vma, enum i915_cache_level cache_level, |
|
- | 2867 | u32 flags); |
|
- | 2868 | void __i915_vma_set_map_and_fenceable(struct i915_vma *vma); |
|
2458 | int __must_check i915_vma_unbind(struct i915_vma *vma); |
2869 | int __must_check i915_vma_unbind(struct i915_vma *vma); |
- | 2870 | /* |
|
- | 2871 | * BEWARE: Do not use the function below unless you can _absolutely_ |
|
- | 2872 | * _guarantee_ VMA in question is _not in use_ anywhere. |
|
- | 2873 | */ |
|
- | 2874 | int __must_check __i915_vma_unbind_no_wait(struct i915_vma *vma); |
|
2459 | int i915_gem_object_put_pages(struct drm_i915_gem_object *obj); |
2875 | int i915_gem_object_put_pages(struct drm_i915_gem_object *obj); |
2460 | void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv); |
2876 | void i915_gem_release_all_mmaps(struct drm_i915_private *dev_priv); |
2461 | void i915_gem_release_mmap(struct drm_i915_gem_object *obj); |
2877 | void i915_gem_release_mmap(struct drm_i915_gem_object *obj); |
2462 | 2878 | ||
2463 | int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj, |
2879 | int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj, |
2464 | int *needs_clflush); |
2880 | int *needs_clflush); |
2465 | 2881 | ||
2466 | int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj); |
2882 | int __must_check i915_gem_object_get_pages(struct drm_i915_gem_object *obj); |
2467 | static inline struct page *i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n) |
- | |
2468 | { |
- | |
2469 | struct sg_page_iter sg_iter; |
- | |
2470 | 2883 | ||
- | 2884 | static inline int __sg_page_count(struct scatterlist *sg) |
|
2471 | for_each_sg_page(obj->pages->sgl, &sg_iter, obj->pages->nents, n) |
2885 | { |
- | 2886 | return sg->length >> PAGE_SHIFT; |
|
- | 2887 | } |
|
- | 2888 | ||
- | 2889 | static inline struct page * |
|
- | 2890 | i915_gem_object_get_page(struct drm_i915_gem_object *obj, int n) |
|
2472 | return sg_page_iter_page(&sg_iter); |
2891 | { |
- | 2892 | if (WARN_ON(n >= obj->base.size >> PAGE_SHIFT)) |
|
- | 2893 | return NULL; |
|
- | 2894 | ||
- | 2895 | if (n < obj->get_page.last) { |
|
- | 2896 | obj->get_page.sg = obj->pages->sgl; |
|
- | 2897 | obj->get_page.last = 0; |
|
- | 2898 | } |
|
- | 2899 | ||
- | 2900 | while (obj->get_page.last + __sg_page_count(obj->get_page.sg) <= n) { |
|
- | 2901 | obj->get_page.last += __sg_page_count(obj->get_page.sg++); |
|
2473 | 2902 | if (unlikely(sg_is_chain(obj->get_page.sg))) |
|
- | 2903 | obj->get_page.sg = sg_chain_ptr(obj->get_page.sg); |
|
- | 2904 | } |
|
- | 2905 | ||
- | 2906 | return nth_page(sg_page(obj->get_page.sg), n - obj->get_page.last); |
|
2474 | return NULL; |
2907 | } |
2475 | } |
2908 | |
2476 | static inline void i915_gem_object_pin_pages(struct drm_i915_gem_object *obj) |
2909 | static inline void i915_gem_object_pin_pages(struct drm_i915_gem_object *obj) |
2477 | { |
2910 | { |
2478 | BUG_ON(obj->pages == NULL); |
2911 | BUG_ON(obj->pages == NULL); |
2479 | obj->pages_pin_count++; |
2912 | obj->pages_pin_count++; |
2480 | } |
2913 | } |
2481 | static inline void i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj) |
2914 | static inline void i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj) |
2482 | { |
2915 | { |
2483 | BUG_ON(obj->pages_pin_count == 0); |
2916 | BUG_ON(obj->pages_pin_count == 0); |
2484 | obj->pages_pin_count--; |
2917 | obj->pages_pin_count--; |
2485 | } |
2918 | } |
2486 | 2919 | ||
2487 | int __must_check i915_mutex_lock_interruptible(struct drm_device *dev); |
2920 | int __must_check i915_mutex_lock_interruptible(struct drm_device *dev); |
2488 | int i915_gem_object_sync(struct drm_i915_gem_object *obj, |
2921 | int i915_gem_object_sync(struct drm_i915_gem_object *obj, |
2489 | struct intel_engine_cs *to); |
2922 | struct intel_engine_cs *to, |
- | 2923 | struct drm_i915_gem_request **to_req); |
|
2490 | void i915_vma_move_to_active(struct i915_vma *vma, |
2924 | void i915_vma_move_to_active(struct i915_vma *vma, |
2491 | struct intel_engine_cs *ring); |
2925 | struct drm_i915_gem_request *req); |
2492 | int i915_gem_dumb_create(struct drm_file *file_priv, |
2926 | int i915_gem_dumb_create(struct drm_file *file_priv, |
2493 | struct drm_device *dev, |
2927 | struct drm_device *dev, |
2494 | struct drm_mode_create_dumb *args); |
2928 | struct drm_mode_create_dumb *args); |
2495 | int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev, |
2929 | int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev, |
2496 | uint32_t handle, uint64_t *offset); |
2930 | uint32_t handle, uint64_t *offset); |
2497 | /** |
2931 | /** |
2498 | * Returns true if seq1 is later than seq2. |
2932 | * Returns true if seq1 is later than seq2. |
2499 | */ |
2933 | */ |
2500 | static inline bool |
2934 | static inline bool |
2501 | i915_seqno_passed(uint32_t seq1, uint32_t seq2) |
2935 | i915_seqno_passed(uint32_t seq1, uint32_t seq2) |
2502 | { |
2936 | { |
2503 | return (int32_t)(seq1 - seq2) >= 0; |
2937 | return (int32_t)(seq1 - seq2) >= 0; |
2504 | } |
2938 | } |
- | 2939 | ||
- | 2940 | static inline bool i915_gem_request_started(struct drm_i915_gem_request *req, |
|
- | 2941 | bool lazy_coherency) |
|
- | 2942 | { |
|
- | 2943 | u32 seqno = req->ring->get_seqno(req->ring, lazy_coherency); |
|
- | 2944 | return i915_seqno_passed(seqno, req->previous_seqno); |
|
- | 2945 | } |
|
- | 2946 | ||
- | 2947 | static inline bool i915_gem_request_completed(struct drm_i915_gem_request *req, |
|
- | 2948 | bool lazy_coherency) |
|
- | 2949 | { |
|
- | 2950 | u32 seqno = req->ring->get_seqno(req->ring, lazy_coherency); |
|
- | 2951 | return i915_seqno_passed(seqno, req->seqno); |
|
- | 2952 | } |
|
2505 | 2953 | ||
2506 | int __must_check i915_gem_get_seqno(struct drm_device *dev, u32 *seqno); |
2954 | int __must_check i915_gem_get_seqno(struct drm_device *dev, u32 *seqno); |
2507 | int __must_check i915_gem_set_seqno(struct drm_device *dev, u32 seqno); |
- | |
2508 | int __must_check i915_gem_object_get_fence(struct drm_i915_gem_object *obj); |
- | |
2509 | int __must_check i915_gem_object_put_fence(struct drm_i915_gem_object *obj); |
- | |
2510 | - | ||
2511 | bool i915_gem_object_pin_fence(struct drm_i915_gem_object *obj); |
- | |
2512 | void i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj); |
2955 | int __must_check i915_gem_set_seqno(struct drm_device *dev, u32 seqno); |
2513 | 2956 | ||
2514 | struct drm_i915_gem_request * |
2957 | struct drm_i915_gem_request * |
2515 | i915_gem_find_active_request(struct intel_engine_cs *ring); |
2958 | i915_gem_find_active_request(struct intel_engine_cs *ring); |
2516 | 2959 | ||
2517 | bool i915_gem_retire_requests(struct drm_device *dev); |
2960 | bool i915_gem_retire_requests(struct drm_device *dev); |
2518 | void i915_gem_retire_requests_ring(struct intel_engine_cs *ring); |
2961 | void i915_gem_retire_requests_ring(struct intel_engine_cs *ring); |
2519 | int __must_check i915_gem_check_wedge(struct i915_gpu_error *error, |
2962 | int __must_check i915_gem_check_wedge(struct i915_gpu_error *error, |
2520 | bool interruptible); |
2963 | bool interruptible); |
2521 | int __must_check i915_gem_check_olr(struct intel_engine_cs *ring, u32 seqno); |
- | |
2522 | 2964 | ||
2523 | static inline bool i915_reset_in_progress(struct i915_gpu_error *error) |
2965 | static inline bool i915_reset_in_progress(struct i915_gpu_error *error) |
2524 | { |
2966 | { |
2525 | return unlikely(atomic_read(&error->reset_counter) |
2967 | return unlikely(atomic_read(&error->reset_counter) |
2526 | & (I915_RESET_IN_PROGRESS_FLAG | I915_WEDGED)); |
2968 | & (I915_RESET_IN_PROGRESS_FLAG | I915_WEDGED)); |
2527 | } |
2969 | } |
2528 | 2970 | ||
2529 | static inline bool i915_terminally_wedged(struct i915_gpu_error *error) |
2971 | static inline bool i915_terminally_wedged(struct i915_gpu_error *error) |
2530 | { |
2972 | { |
2531 | return atomic_read(&error->reset_counter) & I915_WEDGED; |
2973 | return atomic_read(&error->reset_counter) & I915_WEDGED; |
2532 | } |
2974 | } |
2533 | 2975 | ||
2534 | static inline u32 i915_reset_count(struct i915_gpu_error *error) |
2976 | static inline u32 i915_reset_count(struct i915_gpu_error *error) |
2535 | { |
2977 | { |
2536 | return ((atomic_read(&error->reset_counter) & ~I915_WEDGED) + 1) / 2; |
2978 | return ((atomic_read(&error->reset_counter) & ~I915_WEDGED) + 1) / 2; |
2537 | } |
2979 | } |
2538 | 2980 | ||
2539 | static inline bool i915_stop_ring_allow_ban(struct drm_i915_private *dev_priv) |
2981 | static inline bool i915_stop_ring_allow_ban(struct drm_i915_private *dev_priv) |
2540 | { |
2982 | { |
2541 | return dev_priv->gpu_error.stop_rings == 0 || |
2983 | return dev_priv->gpu_error.stop_rings == 0 || |
2542 | dev_priv->gpu_error.stop_rings & I915_STOP_RING_ALLOW_BAN; |
2984 | dev_priv->gpu_error.stop_rings & I915_STOP_RING_ALLOW_BAN; |
2543 | } |
2985 | } |
2544 | 2986 | ||
2545 | static inline bool i915_stop_ring_allow_warn(struct drm_i915_private *dev_priv) |
2987 | static inline bool i915_stop_ring_allow_warn(struct drm_i915_private *dev_priv) |
2546 | { |
2988 | { |
2547 | return dev_priv->gpu_error.stop_rings == 0 || |
2989 | return dev_priv->gpu_error.stop_rings == 0 || |
2548 | dev_priv->gpu_error.stop_rings & I915_STOP_RING_ALLOW_WARN; |
2990 | dev_priv->gpu_error.stop_rings & I915_STOP_RING_ALLOW_WARN; |
2549 | } |
2991 | } |
2550 | 2992 | ||
2551 | void i915_gem_reset(struct drm_device *dev); |
2993 | void i915_gem_reset(struct drm_device *dev); |
2552 | bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force); |
2994 | bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force); |
2553 | int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj); |
- | |
2554 | int __must_check i915_gem_init(struct drm_device *dev); |
2995 | int __must_check i915_gem_init(struct drm_device *dev); |
2555 | int i915_gem_init_rings(struct drm_device *dev); |
2996 | int i915_gem_init_rings(struct drm_device *dev); |
2556 | int __must_check i915_gem_init_hw(struct drm_device *dev); |
2997 | int __must_check i915_gem_init_hw(struct drm_device *dev); |
2557 | int i915_gem_l3_remap(struct intel_engine_cs *ring, int slice); |
2998 | int i915_gem_l3_remap(struct drm_i915_gem_request *req, int slice); |
2558 | void i915_gem_init_swizzling(struct drm_device *dev); |
2999 | void i915_gem_init_swizzling(struct drm_device *dev); |
2559 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); |
3000 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); |
2560 | int __must_check i915_gpu_idle(struct drm_device *dev); |
3001 | int __must_check i915_gpu_idle(struct drm_device *dev); |
2561 | int __must_check i915_gem_suspend(struct drm_device *dev); |
3002 | int __must_check i915_gem_suspend(struct drm_device *dev); |
2562 | int __i915_add_request(struct intel_engine_cs *ring, |
3003 | void __i915_add_request(struct drm_i915_gem_request *req, |
2563 | struct drm_file *file, |
- | |
2564 | struct drm_i915_gem_object *batch_obj, |
3004 | struct drm_i915_gem_object *batch_obj, |
2565 | u32 *seqno); |
3005 | bool flush_caches); |
2566 | #define i915_add_request(ring, seqno) \ |
3006 | #define i915_add_request(req) \ |
- | 3007 | __i915_add_request(req, NULL, true) |
|
- | 3008 | #define i915_add_request_no_flush(req) \ |
|
2567 | __i915_add_request(ring, NULL, NULL, seqno) |
3009 | __i915_add_request(req, NULL, false) |
2568 | int __i915_wait_seqno(struct intel_engine_cs *ring, u32 seqno, |
3010 | int __i915_wait_request(struct drm_i915_gem_request *req, |
2569 | unsigned reset_counter, |
3011 | unsigned reset_counter, |
2570 | bool interruptible, |
3012 | bool interruptible, |
2571 | s64 *timeout, |
3013 | s64 *timeout, |
2572 | struct drm_i915_file_private *file_priv); |
3014 | struct intel_rps_client *rps); |
2573 | int __must_check i915_wait_seqno(struct intel_engine_cs *ring, |
3015 | int __must_check i915_wait_request(struct drm_i915_gem_request *req); |
2574 | uint32_t seqno); |
- | |
2575 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
3016 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
2576 | int __must_check |
3017 | int __must_check |
- | 3018 | i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj, |
|
- | 3019 | bool readonly); |
|
- | 3020 | int __must_check |
|
2577 | i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, |
3021 | i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, |
2578 | bool write); |
3022 | bool write); |
2579 | int __must_check |
3023 | int __must_check |
2580 | i915_gem_object_set_to_cpu_domain(struct drm_i915_gem_object *obj, bool write); |
3024 | i915_gem_object_set_to_cpu_domain(struct drm_i915_gem_object *obj, bool write); |
2581 | int __must_check |
3025 | int __must_check |
2582 | i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, |
3026 | i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, |
2583 | u32 alignment, |
3027 | u32 alignment, |
2584 | struct intel_engine_cs *pipelined); |
3028 | struct intel_engine_cs *pipelined, |
- | 3029 | struct drm_i915_gem_request **pipelined_request, |
|
- | 3030 | const struct i915_ggtt_view *view); |
|
2585 | void i915_gem_object_unpin_from_display_plane(struct drm_i915_gem_object *obj); |
3031 | void i915_gem_object_unpin_from_display_plane(struct drm_i915_gem_object *obj, |
- | 3032 | const struct i915_ggtt_view *view); |
|
2586 | int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, |
3033 | int i915_gem_object_attach_phys(struct drm_i915_gem_object *obj, |
2587 | int align); |
3034 | int align); |
2588 | int i915_gem_open(struct drm_device *dev, struct drm_file *file); |
3035 | int i915_gem_open(struct drm_device *dev, struct drm_file *file); |
2589 | void i915_gem_release(struct drm_device *dev, struct drm_file *file); |
3036 | void i915_gem_release(struct drm_device *dev, struct drm_file *file); |
2590 | 3037 | ||
2591 | uint32_t |
3038 | uint32_t |
2592 | i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode); |
3039 | i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, int tiling_mode); |
2593 | uint32_t |
3040 | uint32_t |
2594 | i915_gem_get_gtt_alignment(struct drm_device *dev, uint32_t size, |
3041 | i915_gem_get_gtt_alignment(struct drm_device *dev, uint32_t size, |
2595 | int tiling_mode, bool fenced); |
3042 | int tiling_mode, bool fenced); |
2596 | 3043 | ||
2597 | int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, |
3044 | int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, |
2598 | enum i915_cache_level cache_level); |
3045 | enum i915_cache_level cache_level); |
2599 | 3046 | ||
2600 | struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev, |
3047 | struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev, |
2601 | struct dma_buf *dma_buf); |
3048 | struct dma_buf *dma_buf); |
2602 | 3049 | ||
2603 | struct dma_buf *i915_gem_prime_export(struct drm_device *dev, |
3050 | struct dma_buf *i915_gem_prime_export(struct drm_device *dev, |
2604 | struct drm_gem_object *gem_obj, int flags); |
3051 | struct drm_gem_object *gem_obj, int flags); |
2605 | 3052 | ||
2606 | void i915_gem_restore_fences(struct drm_device *dev); |
- | |
- | 3053 | u64 i915_gem_obj_ggtt_offset_view(struct drm_i915_gem_object *o, |
|
2607 | 3054 | const struct i915_ggtt_view *view); |
|
2608 | unsigned long i915_gem_obj_offset(struct drm_i915_gem_object *o, |
3055 | u64 i915_gem_obj_offset(struct drm_i915_gem_object *o, |
- | 3056 | struct i915_address_space *vm); |
|
- | 3057 | static inline u64 |
|
- | 3058 | i915_gem_obj_ggtt_offset(struct drm_i915_gem_object *o) |
|
- | 3059 | { |
|
- | 3060 | return i915_gem_obj_ggtt_offset_view(o, &i915_ggtt_view_normal); |
|
- | 3061 | } |
|
2609 | struct i915_address_space *vm); |
3062 | |
- | 3063 | bool i915_gem_obj_bound_any(struct drm_i915_gem_object *o); |
|
- | 3064 | bool i915_gem_obj_ggtt_bound_view(struct drm_i915_gem_object *o, |
|
2610 | bool i915_gem_obj_bound_any(struct drm_i915_gem_object *o); |
3065 | const struct i915_ggtt_view *view); |
2611 | bool i915_gem_obj_bound(struct drm_i915_gem_object *o, |
3066 | bool i915_gem_obj_bound(struct drm_i915_gem_object *o, |
- | 3067 | struct i915_address_space *vm); |
|
2612 | struct i915_address_space *vm); |
3068 | |
2613 | unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o, |
3069 | unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o, |
- | 3070 | struct i915_address_space *vm); |
|
2614 | struct i915_address_space *vm); |
3071 | struct i915_vma * |
2615 | struct i915_vma *i915_gem_obj_to_vma(struct drm_i915_gem_object *obj, |
3072 | i915_gem_obj_to_vma(struct drm_i915_gem_object *obj, |
2616 | struct i915_address_space *vm); |
3073 | struct i915_address_space *vm); |
- | 3074 | struct i915_vma * |
|
- | 3075 | i915_gem_obj_to_ggtt_view(struct drm_i915_gem_object *obj, |
|
- | 3076 | const struct i915_ggtt_view *view); |
|
- | 3077 | ||
2617 | struct i915_vma * |
3078 | struct i915_vma * |
2618 | i915_gem_obj_lookup_or_create_vma(struct drm_i915_gem_object *obj, |
3079 | i915_gem_obj_lookup_or_create_vma(struct drm_i915_gem_object *obj, |
- | 3080 | struct i915_address_space *vm); |
|
- | 3081 | struct i915_vma * |
|
- | 3082 | i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj, |
|
2619 | struct i915_address_space *vm); |
3083 | const struct i915_ggtt_view *view); |
2620 | 3084 | ||
2621 | struct i915_vma *i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj); |
- | |
- | 3085 | static inline struct i915_vma * |
|
2622 | static inline bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj) { |
3086 | i915_gem_obj_to_ggtt(struct drm_i915_gem_object *obj) |
2623 | struct i915_vma *vma; |
- | |
2624 | list_for_each_entry(vma, &obj->vma_list, vma_link) |
- | |
2625 | if (vma->pin_count > 0) |
- | |
2626 | return true; |
3087 | { |
- | 3088 | return i915_gem_obj_to_ggtt_view(obj, &i915_ggtt_view_normal); |
|
2627 | return false; |
3089 | } |
2628 | } |
3090 | bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj); |
2629 | 3091 | ||
2630 | /* Some GGTT VM helpers */ |
3092 | /* Some GGTT VM helpers */ |
2631 | #define i915_obj_to_ggtt(obj) \ |
3093 | #define i915_obj_to_ggtt(obj) \ |
2632 | (&((struct drm_i915_private *)(obj)->base.dev->dev_private)->gtt.base) |
3094 | (&((struct drm_i915_private *)(obj)->base.dev->dev_private)->gtt.base) |
2633 | static inline bool i915_is_ggtt(struct i915_address_space *vm) |
3095 | static inline bool i915_is_ggtt(struct i915_address_space *vm) |
2634 | { |
3096 | { |
2635 | struct i915_address_space *ggtt = |
3097 | struct i915_address_space *ggtt = |
2636 | &((struct drm_i915_private *)(vm)->dev->dev_private)->gtt.base; |
3098 | &((struct drm_i915_private *)(vm)->dev->dev_private)->gtt.base; |
2637 | return vm == ggtt; |
3099 | return vm == ggtt; |
2638 | } |
3100 | } |
2639 | 3101 | ||
2640 | static inline struct i915_hw_ppgtt * |
3102 | static inline struct i915_hw_ppgtt * |
2641 | i915_vm_to_ppgtt(struct i915_address_space *vm) |
3103 | i915_vm_to_ppgtt(struct i915_address_space *vm) |
2642 | { |
3104 | { |
2643 | WARN_ON(i915_is_ggtt(vm)); |
3105 | WARN_ON(i915_is_ggtt(vm)); |
2644 | 3106 | ||
2645 | return container_of(vm, struct i915_hw_ppgtt, base); |
3107 | return container_of(vm, struct i915_hw_ppgtt, base); |
2646 | } |
3108 | } |
2647 | 3109 | ||
2648 | 3110 | ||
2649 | static inline bool i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *obj) |
3111 | static inline bool i915_gem_obj_ggtt_bound(struct drm_i915_gem_object *obj) |
2650 | { |
3112 | { |
2651 | return i915_gem_obj_bound(obj, i915_obj_to_ggtt(obj)); |
3113 | return i915_gem_obj_ggtt_bound_view(obj, &i915_ggtt_view_normal); |
2652 | } |
- | |
2653 | - | ||
2654 | static inline unsigned long |
- | |
2655 | i915_gem_obj_ggtt_offset(struct drm_i915_gem_object *obj) |
- | |
2656 | { |
- | |
2657 | return i915_gem_obj_offset(obj, i915_obj_to_ggtt(obj)); |
- | |
2658 | } |
3114 | } |
2659 | 3115 | ||
2660 | static inline unsigned long |
3116 | static inline unsigned long |
2661 | i915_gem_obj_ggtt_size(struct drm_i915_gem_object *obj) |
3117 | i915_gem_obj_ggtt_size(struct drm_i915_gem_object *obj) |
2662 | { |
3118 | { |
2663 | return i915_gem_obj_size(obj, i915_obj_to_ggtt(obj)); |
3119 | return i915_gem_obj_size(obj, i915_obj_to_ggtt(obj)); |
2664 | } |
3120 | } |
2665 | 3121 | ||
2666 | static inline int __must_check |
3122 | static inline int __must_check |
2667 | i915_gem_obj_ggtt_pin(struct drm_i915_gem_object *obj, |
3123 | i915_gem_obj_ggtt_pin(struct drm_i915_gem_object *obj, |
2668 | uint32_t alignment, |
3124 | uint32_t alignment, |
2669 | unsigned flags) |
3125 | unsigned flags) |
2670 | { |
3126 | { |
2671 | return i915_gem_object_pin(obj, i915_obj_to_ggtt(obj), |
3127 | return i915_gem_object_pin(obj, i915_obj_to_ggtt(obj), |
2672 | alignment, flags | PIN_GLOBAL); |
3128 | alignment, flags | PIN_GLOBAL); |
2673 | } |
3129 | } |
2674 | 3130 | ||
2675 | static inline int |
3131 | static inline int |
2676 | i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj) |
3132 | i915_gem_object_ggtt_unbind(struct drm_i915_gem_object *obj) |
2677 | { |
3133 | { |
2678 | return i915_vma_unbind(i915_gem_obj_to_ggtt(obj)); |
3134 | return i915_vma_unbind(i915_gem_obj_to_ggtt(obj)); |
2679 | } |
3135 | } |
- | 3136 | ||
- | 3137 | void i915_gem_object_ggtt_unpin_view(struct drm_i915_gem_object *obj, |
|
- | 3138 | const struct i915_ggtt_view *view); |
|
2680 | 3139 | static inline void |
|
- | 3140 | i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj) |
|
- | 3141 | { |
|
- | 3142 | i915_gem_object_ggtt_unpin_view(obj, &i915_ggtt_view_normal); |
|
- | 3143 | } |
|
- | 3144 | ||
- | 3145 | /* i915_gem_fence.c */ |
|
- | 3146 | int __must_check i915_gem_object_get_fence(struct drm_i915_gem_object *obj); |
|
- | 3147 | int __must_check i915_gem_object_put_fence(struct drm_i915_gem_object *obj); |
|
- | 3148 | ||
- | 3149 | bool i915_gem_object_pin_fence(struct drm_i915_gem_object *obj); |
|
- | 3150 | void i915_gem_object_unpin_fence(struct drm_i915_gem_object *obj); |
|
- | 3151 | ||
- | 3152 | void i915_gem_restore_fences(struct drm_device *dev); |
|
- | 3153 | ||
- | 3154 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); |
|
- | 3155 | void i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj); |
|
2681 | void i915_gem_object_ggtt_unpin(struct drm_i915_gem_object *obj); |
3156 | void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj); |
2682 | 3157 | ||
2683 | /* i915_gem_context.c */ |
3158 | /* i915_gem_context.c */ |
2684 | int __must_check i915_gem_context_init(struct drm_device *dev); |
3159 | int __must_check i915_gem_context_init(struct drm_device *dev); |
2685 | void i915_gem_context_fini(struct drm_device *dev); |
3160 | void i915_gem_context_fini(struct drm_device *dev); |
2686 | void i915_gem_context_reset(struct drm_device *dev); |
3161 | void i915_gem_context_reset(struct drm_device *dev); |
2687 | int i915_gem_context_open(struct drm_device *dev, struct drm_file *file); |
3162 | int i915_gem_context_open(struct drm_device *dev, struct drm_file *file); |
2688 | int i915_gem_context_enable(struct drm_i915_private *dev_priv); |
3163 | int i915_gem_context_enable(struct drm_i915_gem_request *req); |
2689 | void i915_gem_context_close(struct drm_device *dev, struct drm_file *file); |
3164 | void i915_gem_context_close(struct drm_device *dev, struct drm_file *file); |
2690 | int i915_switch_context(struct intel_engine_cs *ring, |
3165 | int i915_switch_context(struct drm_i915_gem_request *req); |
2691 | struct intel_context *to); |
- | |
2692 | struct intel_context * |
3166 | struct intel_context * |
2693 | i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); |
3167 | i915_gem_context_get(struct drm_i915_file_private *file_priv, u32 id); |
2694 | void i915_gem_context_free(struct kref *ctx_ref); |
3168 | void i915_gem_context_free(struct kref *ctx_ref); |
2695 | struct drm_i915_gem_object * |
3169 | struct drm_i915_gem_object * |
2696 | i915_gem_alloc_context_obj(struct drm_device *dev, size_t size); |
3170 | i915_gem_alloc_context_obj(struct drm_device *dev, size_t size); |
2697 | static inline void i915_gem_context_reference(struct intel_context *ctx) |
3171 | static inline void i915_gem_context_reference(struct intel_context *ctx) |
2698 | { |
3172 | { |
2699 | kref_get(&ctx->ref); |
3173 | kref_get(&ctx->ref); |
2700 | } |
3174 | } |
2701 | 3175 | ||
2702 | static inline void i915_gem_context_unreference(struct intel_context *ctx) |
3176 | static inline void i915_gem_context_unreference(struct intel_context *ctx) |
2703 | { |
3177 | { |
2704 | kref_put(&ctx->ref, i915_gem_context_free); |
3178 | kref_put(&ctx->ref, i915_gem_context_free); |
2705 | } |
3179 | } |
2706 | 3180 | ||
2707 | static inline bool i915_gem_context_is_default(const struct intel_context *c) |
3181 | static inline bool i915_gem_context_is_default(const struct intel_context *c) |
2708 | { |
3182 | { |
2709 | return c->user_handle == DEFAULT_CONTEXT_HANDLE; |
3183 | return c->user_handle == DEFAULT_CONTEXT_HANDLE; |
2710 | } |
3184 | } |
2711 | 3185 | ||
2712 | int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, |
3186 | int i915_gem_context_create_ioctl(struct drm_device *dev, void *data, |
2713 | struct drm_file *file); |
3187 | struct drm_file *file); |
2714 | int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, |
3188 | int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data, |
2715 | struct drm_file *file); |
3189 | struct drm_file *file); |
- | 3190 | int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data, |
|
- | 3191 | struct drm_file *file_priv); |
|
- | 3192 | int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data, |
|
- | 3193 | struct drm_file *file_priv); |
|
2716 | 3194 | ||
2717 | /* i915_gem_evict.c */ |
3195 | /* i915_gem_evict.c */ |
2718 | int __must_check i915_gem_evict_something(struct drm_device *dev, |
3196 | int __must_check i915_gem_evict_something(struct drm_device *dev, |
2719 | struct i915_address_space *vm, |
3197 | struct i915_address_space *vm, |
2720 | int min_size, |
3198 | int min_size, |
2721 | unsigned alignment, |
3199 | unsigned alignment, |
2722 | unsigned cache_level, |
3200 | unsigned cache_level, |
2723 | unsigned long start, |
3201 | unsigned long start, |
2724 | unsigned long end, |
3202 | unsigned long end, |
2725 | unsigned flags); |
3203 | unsigned flags); |
2726 | int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle); |
3204 | int i915_gem_evict_vm(struct i915_address_space *vm, bool do_idle); |
2727 | int i915_gem_evict_everything(struct drm_device *dev); |
- | |
2728 | 3205 | ||
2729 | /* belongs in i915_gem_gtt.h */ |
3206 | /* belongs in i915_gem_gtt.h */ |
2730 | static inline void i915_gem_chipset_flush(struct drm_device *dev) |
3207 | static inline void i915_gem_chipset_flush(struct drm_device *dev) |
2731 | { |
3208 | { |
2732 | if (INTEL_INFO(dev)->gen < 6) |
3209 | if (INTEL_INFO(dev)->gen < 6) |
2733 | intel_gtt_chipset_flush(); |
3210 | intel_gtt_chipset_flush(); |
2734 | } |
3211 | } |
2735 | 3212 | ||
2736 | /* i915_gem_stolen.c */ |
3213 | /* i915_gem_stolen.c */ |
- | 3214 | int i915_gem_stolen_insert_node(struct drm_i915_private *dev_priv, |
|
- | 3215 | struct drm_mm_node *node, u64 size, |
|
- | 3216 | unsigned alignment); |
|
- | 3217 | int i915_gem_stolen_insert_node_in_range(struct drm_i915_private *dev_priv, |
|
- | 3218 | struct drm_mm_node *node, u64 size, |
|
- | 3219 | unsigned alignment, u64 start, |
|
- | 3220 | u64 end); |
|
- | 3221 | void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv, |
|
- | 3222 | struct drm_mm_node *node); |
|
2737 | int i915_gem_init_stolen(struct drm_device *dev); |
3223 | int i915_gem_init_stolen(struct drm_device *dev); |
2738 | int i915_gem_stolen_setup_compression(struct drm_device *dev, int size, int fb_cpp); |
- | |
2739 | void i915_gem_stolen_cleanup_compression(struct drm_device *dev); |
- | |
2740 | void i915_gem_cleanup_stolen(struct drm_device *dev); |
3224 | void i915_gem_cleanup_stolen(struct drm_device *dev); |
2741 | struct drm_i915_gem_object * |
3225 | struct drm_i915_gem_object * |
2742 | i915_gem_object_create_stolen(struct drm_device *dev, u32 size); |
3226 | i915_gem_object_create_stolen(struct drm_device *dev, u32 size); |
2743 | struct drm_i915_gem_object * |
3227 | struct drm_i915_gem_object * |
2744 | i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, |
3228 | i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev, |
2745 | u32 stolen_offset, |
3229 | u32 stolen_offset, |
2746 | u32 gtt_offset, |
3230 | u32 gtt_offset, |
2747 | u32 size); |
3231 | u32 size); |
- | 3232 | ||
- | 3233 | /* i915_gem_shrinker.c */ |
|
- | 3234 | unsigned long i915_gem_shrink(struct drm_i915_private *dev_priv, |
|
- | 3235 | unsigned long target, |
|
- | 3236 | unsigned flags); |
|
- | 3237 | #define I915_SHRINK_PURGEABLE 0x1 |
|
- | 3238 | #define I915_SHRINK_UNBOUND 0x2 |
|
- | 3239 | #define I915_SHRINK_BOUND 0x4 |
|
- | 3240 | #define I915_SHRINK_ACTIVE 0x8 |
|
- | 3241 | unsigned long i915_gem_shrink_all(struct drm_i915_private *dev_priv); |
|
- | 3242 | void i915_gem_shrinker_init(struct drm_i915_private *dev_priv); |
|
- | 3243 | ||
2748 | 3244 | ||
2749 | /* i915_gem_tiling.c */ |
3245 | /* i915_gem_tiling.c */ |
2750 | static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) |
3246 | static inline bool i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) |
2751 | { |
3247 | { |
2752 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; |
3248 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; |
2753 | 3249 | ||
2754 | return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 && |
3250 | return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 && |
2755 | obj->tiling_mode != I915_TILING_NONE; |
3251 | obj->tiling_mode != I915_TILING_NONE; |
2756 | } |
3252 | } |
2757 | - | ||
2758 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); |
- | |
2759 | void i915_gem_object_do_bit_17_swizzle(struct drm_i915_gem_object *obj); |
- | |
2760 | void i915_gem_object_save_bit_17_swizzle(struct drm_i915_gem_object *obj); |
- | |
2761 | 3253 | ||
2762 | /* i915_gem_debug.c */ |
3254 | /* i915_gem_debug.c */ |
2763 | #if WATCH_LISTS |
3255 | #if WATCH_LISTS |
2764 | int i915_verify_lists(struct drm_device *dev); |
3256 | int i915_verify_lists(struct drm_device *dev); |
2765 | #else |
3257 | #else |
2766 | #define i915_verify_lists(dev) 0 |
3258 | #define i915_verify_lists(dev) 0 |
2767 | #endif |
3259 | #endif |
2768 | 3260 | ||
2769 | /* i915_debugfs.c */ |
3261 | /* i915_debugfs.c */ |
2770 | int i915_debugfs_init(struct drm_minor *minor); |
3262 | int i915_debugfs_init(struct drm_minor *minor); |
2771 | void i915_debugfs_cleanup(struct drm_minor *minor); |
3263 | void i915_debugfs_cleanup(struct drm_minor *minor); |
2772 | #ifdef CONFIG_DEBUG_FS |
3264 | #ifdef CONFIG_DEBUG_FS |
- | 3265 | int i915_debugfs_connector_add(struct drm_connector *connector); |
|
2773 | void intel_display_crc_init(struct drm_device *dev); |
3266 | void intel_display_crc_init(struct drm_device *dev); |
2774 | #else |
3267 | #else |
- | 3268 | static inline int i915_debugfs_connector_add(struct drm_connector *connector) |
|
- | 3269 | { return 0; } |
|
2775 | static inline void intel_display_crc_init(struct drm_device *dev) {} |
3270 | static inline void intel_display_crc_init(struct drm_device *dev) {} |
2776 | #endif |
3271 | #endif |
2777 | 3272 | ||
2778 | /* i915_gpu_error.c */ |
3273 | /* i915_gpu_error.c */ |
2779 | __printf(2, 3) |
3274 | __printf(2, 3) |
2780 | void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...); |
3275 | void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...); |
2781 | int i915_error_state_to_str(struct drm_i915_error_state_buf *estr, |
3276 | int i915_error_state_to_str(struct drm_i915_error_state_buf *estr, |
2782 | const struct i915_error_state_file_priv *error); |
3277 | const struct i915_error_state_file_priv *error); |
2783 | int i915_error_state_buf_init(struct drm_i915_error_state_buf *eb, |
3278 | int i915_error_state_buf_init(struct drm_i915_error_state_buf *eb, |
2784 | struct drm_i915_private *i915, |
3279 | struct drm_i915_private *i915, |
2785 | size_t count, loff_t pos); |
3280 | size_t count, loff_t pos); |
2786 | static inline void i915_error_state_buf_release( |
3281 | static inline void i915_error_state_buf_release( |
2787 | struct drm_i915_error_state_buf *eb) |
3282 | struct drm_i915_error_state_buf *eb) |
2788 | { |
3283 | { |
2789 | kfree(eb->buf); |
3284 | kfree(eb->buf); |
2790 | } |
3285 | } |
2791 | void i915_capture_error_state(struct drm_device *dev, bool wedge, |
3286 | void i915_capture_error_state(struct drm_device *dev, bool wedge, |
2792 | const char *error_msg); |
3287 | const char *error_msg); |
2793 | void i915_error_state_get(struct drm_device *dev, |
3288 | void i915_error_state_get(struct drm_device *dev, |
2794 | struct i915_error_state_file_priv *error_priv); |
3289 | struct i915_error_state_file_priv *error_priv); |
2795 | void i915_error_state_put(struct i915_error_state_file_priv *error_priv); |
3290 | void i915_error_state_put(struct i915_error_state_file_priv *error_priv); |
2796 | void i915_destroy_error_state(struct drm_device *dev); |
3291 | void i915_destroy_error_state(struct drm_device *dev); |
2797 | 3292 | ||
2798 | void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone); |
3293 | void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone); |
2799 | const char *i915_cache_level_str(struct drm_i915_private *i915, int type); |
3294 | const char *i915_cache_level_str(struct drm_i915_private *i915, int type); |
2800 | 3295 | ||
2801 | /* i915_cmd_parser.c */ |
3296 | /* i915_cmd_parser.c */ |
2802 | int i915_cmd_parser_get_version(void); |
3297 | int i915_cmd_parser_get_version(void); |
2803 | int i915_cmd_parser_init_ring(struct intel_engine_cs *ring); |
3298 | int i915_cmd_parser_init_ring(struct intel_engine_cs *ring); |
2804 | void i915_cmd_parser_fini_ring(struct intel_engine_cs *ring); |
3299 | void i915_cmd_parser_fini_ring(struct intel_engine_cs *ring); |
2805 | bool i915_needs_cmd_parser(struct intel_engine_cs *ring); |
3300 | bool i915_needs_cmd_parser(struct intel_engine_cs *ring); |
2806 | int i915_parse_cmds(struct intel_engine_cs *ring, |
3301 | int i915_parse_cmds(struct intel_engine_cs *ring, |
2807 | struct drm_i915_gem_object *batch_obj, |
3302 | struct drm_i915_gem_object *batch_obj, |
- | 3303 | struct drm_i915_gem_object *shadow_batch_obj, |
|
2808 | u32 batch_start_offset, |
3304 | u32 batch_start_offset, |
- | 3305 | u32 batch_len, |
|
2809 | bool is_master); |
3306 | bool is_master); |
2810 | 3307 | ||
2811 | /* i915_suspend.c */ |
3308 | /* i915_suspend.c */ |
2812 | extern int i915_save_state(struct drm_device *dev); |
3309 | extern int i915_save_state(struct drm_device *dev); |
2813 | extern int i915_restore_state(struct drm_device *dev); |
3310 | extern int i915_restore_state(struct drm_device *dev); |
2814 | - | ||
2815 | /* i915_ums.c */ |
- | |
2816 | void i915_save_display_reg(struct drm_device *dev); |
- | |
2817 | void i915_restore_display_reg(struct drm_device *dev); |
- | |
2818 | 3311 | ||
2819 | /* i915_sysfs.c */ |
3312 | /* i915_sysfs.c */ |
2820 | void i915_setup_sysfs(struct drm_device *dev_priv); |
3313 | void i915_setup_sysfs(struct drm_device *dev_priv); |
2821 | void i915_teardown_sysfs(struct drm_device *dev_priv); |
3314 | void i915_teardown_sysfs(struct drm_device *dev_priv); |
2822 | 3315 | ||
2823 | /* intel_i2c.c */ |
3316 | /* intel_i2c.c */ |
2824 | extern int intel_setup_gmbus(struct drm_device *dev); |
3317 | extern int intel_setup_gmbus(struct drm_device *dev); |
2825 | extern void intel_teardown_gmbus(struct drm_device *dev); |
3318 | extern void intel_teardown_gmbus(struct drm_device *dev); |
2826 | static inline bool intel_gmbus_is_port_valid(unsigned port) |
3319 | extern bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv, |
2827 | { |
- | |
2828 | return (port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD); |
3320 | unsigned int pin); |
2829 | } |
- | |
2830 | 3321 | ||
2831 | extern struct i2c_adapter *intel_gmbus_get_adapter( |
3322 | extern struct i2c_adapter * |
2832 | struct drm_i915_private *dev_priv, unsigned port); |
3323 | intel_gmbus_get_adapter(struct drm_i915_private *dev_priv, unsigned int pin); |
2833 | extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed); |
3324 | extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed); |
2834 | extern void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit); |
3325 | extern void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit); |
2835 | static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter) |
3326 | static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter) |
2836 | { |
3327 | { |
2837 | return container_of(adapter, struct intel_gmbus, adapter)->force_bit; |
3328 | return container_of(adapter, struct intel_gmbus, adapter)->force_bit; |
2838 | } |
3329 | } |
2839 | extern void intel_i2c_reset(struct drm_device *dev); |
3330 | extern void intel_i2c_reset(struct drm_device *dev); |
2840 | 3331 | ||
2841 | /* intel_opregion.c */ |
3332 | /* intel_opregion.c */ |
2842 | #ifdef CONFIG_ACPI |
3333 | #ifdef CONFIG_ACPI |
2843 | extern int intel_opregion_setup(struct drm_device *dev); |
3334 | extern int intel_opregion_setup(struct drm_device *dev); |
2844 | extern void intel_opregion_init(struct drm_device *dev); |
3335 | extern void intel_opregion_init(struct drm_device *dev); |
2845 | extern void intel_opregion_fini(struct drm_device *dev); |
3336 | extern void intel_opregion_fini(struct drm_device *dev); |
2846 | extern void intel_opregion_asle_intr(struct drm_device *dev); |
3337 | extern void intel_opregion_asle_intr(struct drm_device *dev); |
2847 | extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, |
3338 | extern int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, |
2848 | bool enable); |
3339 | bool enable); |
2849 | extern int intel_opregion_notify_adapter(struct drm_device *dev, |
3340 | extern int intel_opregion_notify_adapter(struct drm_device *dev, |
2850 | pci_power_t state); |
3341 | pci_power_t state); |
2851 | #else |
3342 | #else |
2852 | static inline int intel_opregion_setup(struct drm_device *dev) { return 0; } |
3343 | static inline int intel_opregion_setup(struct drm_device *dev) { return 0; } |
2853 | static inline void intel_opregion_init(struct drm_device *dev) { return; } |
3344 | static inline void intel_opregion_init(struct drm_device *dev) { return; } |
2854 | static inline void intel_opregion_fini(struct drm_device *dev) { return; } |
3345 | static inline void intel_opregion_fini(struct drm_device *dev) { return; } |
2855 | static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; } |
3346 | static inline void intel_opregion_asle_intr(struct drm_device *dev) { return; } |
2856 | static inline int |
3347 | static inline int |
2857 | intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable) |
3348 | intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable) |
2858 | { |
3349 | { |
2859 | return 0; |
3350 | return 0; |
2860 | } |
3351 | } |
2861 | static inline int |
3352 | static inline int |
2862 | intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state) |
3353 | intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state) |
2863 | { |
3354 | { |
2864 | return 0; |
3355 | return 0; |
2865 | } |
3356 | } |
2866 | #endif |
3357 | #endif |
2867 | 3358 | ||
2868 | /* intel_acpi.c */ |
3359 | /* intel_acpi.c */ |
2869 | #ifdef CONFIG_ACPI |
3360 | #ifdef CONFIG_ACPI |
2870 | extern void intel_register_dsm_handler(void); |
3361 | extern void intel_register_dsm_handler(void); |
2871 | extern void intel_unregister_dsm_handler(void); |
3362 | extern void intel_unregister_dsm_handler(void); |
2872 | #else |
3363 | #else |
2873 | static inline void intel_register_dsm_handler(void) { return; } |
3364 | static inline void intel_register_dsm_handler(void) { return; } |
2874 | static inline void intel_unregister_dsm_handler(void) { return; } |
3365 | static inline void intel_unregister_dsm_handler(void) { return; } |
2875 | #endif /* CONFIG_ACPI */ |
3366 | #endif /* CONFIG_ACPI */ |
2876 | 3367 | ||
2877 | /* modesetting */ |
3368 | /* modesetting */ |
2878 | extern void intel_modeset_init_hw(struct drm_device *dev); |
3369 | extern void intel_modeset_init_hw(struct drm_device *dev); |
2879 | extern void intel_modeset_init(struct drm_device *dev); |
3370 | extern void intel_modeset_init(struct drm_device *dev); |
2880 | extern void intel_modeset_gem_init(struct drm_device *dev); |
3371 | extern void intel_modeset_gem_init(struct drm_device *dev); |
2881 | extern void intel_modeset_cleanup(struct drm_device *dev); |
3372 | extern void intel_modeset_cleanup(struct drm_device *dev); |
2882 | extern void intel_connector_unregister(struct intel_connector *); |
3373 | extern void intel_connector_unregister(struct intel_connector *); |
2883 | extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state); |
3374 | extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state); |
2884 | extern void intel_modeset_setup_hw_state(struct drm_device *dev, |
3375 | extern void intel_display_resume(struct drm_device *dev); |
2885 | bool force_restore); |
- | |
2886 | extern void i915_redisable_vga(struct drm_device *dev); |
3376 | extern void i915_redisable_vga(struct drm_device *dev); |
2887 | extern void i915_redisable_vga_power_on(struct drm_device *dev); |
3377 | extern void i915_redisable_vga_power_on(struct drm_device *dev); |
2888 | extern bool intel_fbc_enabled(struct drm_device *dev); |
- | |
2889 | extern void bdw_fbc_sw_flush(struct drm_device *dev, u32 value); |
- | |
2890 | extern void intel_disable_fbc(struct drm_device *dev); |
- | |
2891 | extern bool ironlake_set_drps(struct drm_device *dev, u8 val); |
3378 | extern bool ironlake_set_drps(struct drm_device *dev, u8 val); |
2892 | extern void intel_init_pch_refclk(struct drm_device *dev); |
3379 | extern void intel_init_pch_refclk(struct drm_device *dev); |
2893 | extern void gen6_set_rps(struct drm_device *dev, u8 val); |
3380 | extern void intel_set_rps(struct drm_device *dev, u8 val); |
2894 | extern void valleyview_set_rps(struct drm_device *dev, u8 val); |
- | |
2895 | extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv, |
3381 | extern void intel_set_memory_cxsr(struct drm_i915_private *dev_priv, |
2896 | bool enable); |
3382 | bool enable); |
2897 | extern void intel_detect_pch(struct drm_device *dev); |
3383 | extern void intel_detect_pch(struct drm_device *dev); |
2898 | extern int intel_trans_dp_port_sel(struct drm_crtc *crtc); |
3384 | extern int intel_trans_dp_port_sel(struct drm_crtc *crtc); |
2899 | extern int intel_enable_rc6(const struct drm_device *dev); |
3385 | extern int intel_enable_rc6(const struct drm_device *dev); |
2900 | 3386 | ||
2901 | extern bool i915_semaphore_is_enabled(struct drm_device *dev); |
3387 | extern bool i915_semaphore_is_enabled(struct drm_device *dev); |
2902 | int i915_reg_read_ioctl(struct drm_device *dev, void *data, |
3388 | int i915_reg_read_ioctl(struct drm_device *dev, void *data, |
2903 | struct drm_file *file); |
3389 | struct drm_file *file); |
2904 | int i915_get_reset_stats_ioctl(struct drm_device *dev, void *data, |
3390 | int i915_get_reset_stats_ioctl(struct drm_device *dev, void *data, |
2905 | struct drm_file *file); |
3391 | struct drm_file *file); |
2906 | - | ||
2907 | void intel_notify_mmio_flip(struct intel_engine_cs *ring); |
- | |
2908 | 3392 | ||
2909 | /* overlay */ |
- | |
2910 | #ifdef CONFIG_DEBUG_FS |
3393 | /* overlay */ |
2911 | extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev); |
3394 | extern struct intel_overlay_error_state *intel_overlay_capture_error_state(struct drm_device *dev); |
2912 | extern void intel_overlay_print_error_state(struct drm_i915_error_state_buf *e, |
3395 | extern void intel_overlay_print_error_state(struct drm_i915_error_state_buf *e, |
2913 | struct intel_overlay_error_state *error); |
3396 | struct intel_overlay_error_state *error); |
2914 | 3397 | ||
2915 | extern struct intel_display_error_state *intel_display_capture_error_state(struct drm_device *dev); |
3398 | extern struct intel_display_error_state *intel_display_capture_error_state(struct drm_device *dev); |
2916 | extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e, |
3399 | extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e, |
2917 | struct drm_device *dev, |
3400 | struct drm_device *dev, |
2918 | struct intel_display_error_state *error); |
3401 | struct intel_display_error_state *error); |
2919 | #endif |
- | |
2920 | - | ||
2921 | /* On SNB platform, before reading ring registers forcewake bit |
- | |
2922 | * must be set to prevent GT core from power down and stale values being |
- | |
2923 | * returned. |
- | |
2924 | */ |
- | |
2925 | void gen6_gt_force_wake_get(struct drm_i915_private *dev_priv, int fw_engine); |
- | |
2926 | void gen6_gt_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine); |
- | |
2927 | void assert_force_wake_inactive(struct drm_i915_private *dev_priv); |
- | |
2928 | 3402 | ||
2929 | int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val); |
3403 | int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val); |
2930 | int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u32 mbox, u32 val); |
3404 | int sandybridge_pcode_write(struct drm_i915_private *dev_priv, u32 mbox, u32 val); |
2931 | 3405 | ||
2932 | /* intel_sideband.c */ |
3406 | /* intel_sideband.c */ |
2933 | u32 vlv_punit_read(struct drm_i915_private *dev_priv, u8 addr); |
3407 | u32 vlv_punit_read(struct drm_i915_private *dev_priv, u32 addr); |
2934 | void vlv_punit_write(struct drm_i915_private *dev_priv, u8 addr, u32 val); |
3408 | void vlv_punit_write(struct drm_i915_private *dev_priv, u32 addr, u32 val); |
2935 | u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr); |
3409 | u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr); |
2936 | u32 vlv_gpio_nc_read(struct drm_i915_private *dev_priv, u32 reg); |
3410 | u32 vlv_gpio_nc_read(struct drm_i915_private *dev_priv, u32 reg); |
2937 | void vlv_gpio_nc_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
3411 | void vlv_gpio_nc_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
2938 | u32 vlv_cck_read(struct drm_i915_private *dev_priv, u32 reg); |
3412 | u32 vlv_cck_read(struct drm_i915_private *dev_priv, u32 reg); |
2939 | void vlv_cck_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
3413 | void vlv_cck_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
2940 | u32 vlv_ccu_read(struct drm_i915_private *dev_priv, u32 reg); |
3414 | u32 vlv_ccu_read(struct drm_i915_private *dev_priv, u32 reg); |
2941 | void vlv_ccu_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
3415 | void vlv_ccu_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
2942 | u32 vlv_bunit_read(struct drm_i915_private *dev_priv, u32 reg); |
3416 | u32 vlv_bunit_read(struct drm_i915_private *dev_priv, u32 reg); |
2943 | void vlv_bunit_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
3417 | void vlv_bunit_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
2944 | u32 vlv_gps_core_read(struct drm_i915_private *dev_priv, u32 reg); |
3418 | u32 vlv_gps_core_read(struct drm_i915_private *dev_priv, u32 reg); |
2945 | void vlv_gps_core_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
3419 | void vlv_gps_core_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
2946 | u32 vlv_dpio_read(struct drm_i915_private *dev_priv, enum pipe pipe, int reg); |
3420 | u32 vlv_dpio_read(struct drm_i915_private *dev_priv, enum pipe pipe, int reg); |
2947 | void vlv_dpio_write(struct drm_i915_private *dev_priv, enum pipe pipe, int reg, u32 val); |
3421 | void vlv_dpio_write(struct drm_i915_private *dev_priv, enum pipe pipe, int reg, u32 val); |
2948 | u32 intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg, |
3422 | u32 intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg, |
2949 | enum intel_sbi_destination destination); |
3423 | enum intel_sbi_destination destination); |
2950 | void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value, |
3424 | void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value, |
2951 | enum intel_sbi_destination destination); |
3425 | enum intel_sbi_destination destination); |
2952 | u32 vlv_flisdsi_read(struct drm_i915_private *dev_priv, u32 reg); |
3426 | u32 vlv_flisdsi_read(struct drm_i915_private *dev_priv, u32 reg); |
2953 | void vlv_flisdsi_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
3427 | void vlv_flisdsi_write(struct drm_i915_private *dev_priv, u32 reg, u32 val); |
2954 | 3428 | ||
2955 | int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val); |
3429 | int intel_gpu_freq(struct drm_i915_private *dev_priv, int val); |
2956 | int vlv_freq_opcode(struct drm_i915_private *dev_priv, int val); |
- | |
2957 | - | ||
2958 | #define FORCEWAKE_RENDER (1 << 0) |
- | |
2959 | #define FORCEWAKE_MEDIA (1 << 1) |
- | |
2960 | #define FORCEWAKE_BLITTER (1 << 2) |
- | |
2961 | #define FORCEWAKE_ALL (FORCEWAKE_RENDER | FORCEWAKE_MEDIA | \ |
- | |
2962 | FORCEWAKE_BLITTER) |
- | |
2963 | 3430 | int intel_freq_opcode(struct drm_i915_private *dev_priv, int val); |
|
2964 | 3431 | ||
2965 | #define I915_READ8(reg) dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true) |
3432 | #define I915_READ8(reg) dev_priv->uncore.funcs.mmio_readb(dev_priv, (reg), true) |
2966 | #define I915_WRITE8(reg, val) dev_priv->uncore.funcs.mmio_writeb(dev_priv, (reg), (val), true) |
3433 | #define I915_WRITE8(reg, val) dev_priv->uncore.funcs.mmio_writeb(dev_priv, (reg), (val), true) |
2967 | 3434 | ||
2968 | #define I915_READ16(reg) dev_priv->uncore.funcs.mmio_readw(dev_priv, (reg), true) |
3435 | #define I915_READ16(reg) dev_priv->uncore.funcs.mmio_readw(dev_priv, (reg), true) |
2969 | #define I915_WRITE16(reg, val) dev_priv->uncore.funcs.mmio_writew(dev_priv, (reg), (val), true) |
3436 | #define I915_WRITE16(reg, val) dev_priv->uncore.funcs.mmio_writew(dev_priv, (reg), (val), true) |
2970 | #define I915_READ16_NOTRACE(reg) dev_priv->uncore.funcs.mmio_readw(dev_priv, (reg), false) |
3437 | #define I915_READ16_NOTRACE(reg) dev_priv->uncore.funcs.mmio_readw(dev_priv, (reg), false) |
2971 | #define I915_WRITE16_NOTRACE(reg, val) dev_priv->uncore.funcs.mmio_writew(dev_priv, (reg), (val), false) |
3438 | #define I915_WRITE16_NOTRACE(reg, val) dev_priv->uncore.funcs.mmio_writew(dev_priv, (reg), (val), false) |
2972 | 3439 | ||
2973 | #define I915_READ(reg) dev_priv->uncore.funcs.mmio_readl(dev_priv, (reg), true) |
3440 | #define I915_READ(reg) dev_priv->uncore.funcs.mmio_readl(dev_priv, (reg), true) |
2974 | #define I915_WRITE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), true) |
3441 | #define I915_WRITE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), true) |
2975 | #define I915_READ_NOTRACE(reg) dev_priv->uncore.funcs.mmio_readl(dev_priv, (reg), false) |
3442 | #define I915_READ_NOTRACE(reg) dev_priv->uncore.funcs.mmio_readl(dev_priv, (reg), false) |
2976 | #define I915_WRITE_NOTRACE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), false) |
3443 | #define I915_WRITE_NOTRACE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), false) |
2977 | 3444 | ||
2978 | /* Be very careful with read/write 64-bit values. On 32-bit machines, they |
3445 | /* Be very careful with read/write 64-bit values. On 32-bit machines, they |
2979 | * will be implemented using 2 32-bit writes in an arbitrary order with |
3446 | * will be implemented using 2 32-bit writes in an arbitrary order with |
2980 | * an arbitrary delay between them. This can cause the hardware to |
3447 | * an arbitrary delay between them. This can cause the hardware to |
2981 | * act upon the intermediate value, possibly leading to corruption and |
3448 | * act upon the intermediate value, possibly leading to corruption and |
2982 | * machine death. You have been warned. |
3449 | * machine death. You have been warned. |
2983 | */ |
3450 | */ |
2984 | #define I915_WRITE64(reg, val) dev_priv->uncore.funcs.mmio_writeq(dev_priv, (reg), (val), true) |
3451 | #define I915_WRITE64(reg, val) dev_priv->uncore.funcs.mmio_writeq(dev_priv, (reg), (val), true) |
2985 | #define I915_READ64(reg) dev_priv->uncore.funcs.mmio_readq(dev_priv, (reg), true) |
3452 | #define I915_READ64(reg) dev_priv->uncore.funcs.mmio_readq(dev_priv, (reg), true) |
2986 | 3453 | ||
2987 | #define I915_READ64_2x32(lower_reg, upper_reg) ({ \ |
3454 | #define I915_READ64_2x32(lower_reg, upper_reg) ({ \ |
2988 | u32 upper = I915_READ(upper_reg); \ |
3455 | u32 upper, lower, old_upper, loop = 0; \ |
2989 | u32 lower = I915_READ(lower_reg); \ |
- | |
2990 | u32 tmp = I915_READ(upper_reg); \ |
3456 | upper = I915_READ(upper_reg); \ |
2991 | if (upper != tmp) { \ |
3457 | do { \ |
2992 | upper = tmp; \ |
3458 | old_upper = upper; \ |
2993 | lower = I915_READ(lower_reg); \ |
3459 | lower = I915_READ(lower_reg); \ |
2994 | WARN_ON(I915_READ(upper_reg) != upper); \ |
3460 | upper = I915_READ(upper_reg); \ |
2995 | } \ |
3461 | } while (upper != old_upper && loop++ < 2); \ |
2996 | (u64)upper << 32 | lower; }) |
3462 | (u64)upper << 32 | lower; }) |
2997 | 3463 | ||
2998 | #define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg) |
3464 | #define POSTING_READ(reg) (void)I915_READ_NOTRACE(reg) |
2999 | #define POSTING_READ16(reg) (void)I915_READ16_NOTRACE(reg) |
3465 | #define POSTING_READ16(reg) (void)I915_READ16_NOTRACE(reg) |
- | 3466 | ||
- | 3467 | /* These are untraced mmio-accessors that are only valid to be used inside |
|
- | 3468 | * criticial sections inside IRQ handlers where forcewake is explicitly |
|
- | 3469 | * controlled. |
|
- | 3470 | * Think twice, and think again, before using these. |
|
- | 3471 | * Note: Should only be used between intel_uncore_forcewake_irqlock() and |
|
- | 3472 | * intel_uncore_forcewake_irqunlock(). |
|
- | 3473 | */ |
|
- | 3474 | #define I915_READ_FW(reg__) readl(dev_priv->regs + (reg__)) |
|
- | 3475 | #define I915_WRITE_FW(reg__, val__) writel(val__, dev_priv->regs + (reg__)) |
|
- | 3476 | #define POSTING_READ_FW(reg__) (void)I915_READ_FW(reg__) |
|
3000 | 3477 | ||
3001 | /* "Broadcast RGB" property */ |
3478 | /* "Broadcast RGB" property */ |
3002 | #define INTEL_BROADCAST_RGB_AUTO 0 |
3479 | #define INTEL_BROADCAST_RGB_AUTO 0 |
3003 | #define INTEL_BROADCAST_RGB_FULL 1 |
3480 | #define INTEL_BROADCAST_RGB_FULL 1 |
3004 | #define INTEL_BROADCAST_RGB_LIMITED 2 |
3481 | #define INTEL_BROADCAST_RGB_LIMITED 2 |
3005 | 3482 | ||
3006 | static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev) |
3483 | static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev) |
3007 | { |
3484 | { |
3008 | if (IS_VALLEYVIEW(dev)) |
3485 | if (IS_VALLEYVIEW(dev)) |
3009 | return VLV_VGACNTRL; |
3486 | return VLV_VGACNTRL; |
3010 | else if (INTEL_INFO(dev)->gen >= 5) |
3487 | else if (INTEL_INFO(dev)->gen >= 5) |
3011 | return CPU_VGACNTRL; |
3488 | return CPU_VGACNTRL; |
3012 | else |
3489 | else |
3013 | return VGACNTRL; |
3490 | return VGACNTRL; |
3014 | } |
3491 | } |
3015 | 3492 | ||
3016 | static inline void __user *to_user_ptr(u64 address) |
3493 | static inline void __user *to_user_ptr(u64 address) |
3017 | { |
3494 | { |
3018 | return (void __user *)(uintptr_t)address; |
3495 | return (void __user *)(uintptr_t)address; |
3019 | } |
3496 | } |
3020 | 3497 | ||
3021 | static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m) |
3498 | static inline unsigned long msecs_to_jiffies_timeout(const unsigned int m) |
3022 | { |
3499 | { |
3023 | unsigned long j = msecs_to_jiffies(m); |
3500 | unsigned long j = msecs_to_jiffies(m); |
3024 | 3501 | ||
3025 | return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); |
3502 | return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); |
3026 | } |
3503 | } |
3027 | 3504 | ||
3028 | static inline unsigned long nsecs_to_jiffies_timeout(const u64 n) |
3505 | static inline unsigned long nsecs_to_jiffies_timeout(const u64 n) |
3029 | { |
3506 | { |
3030 | return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1); |
3507 | return min_t(u64, MAX_JIFFY_OFFSET, nsecs_to_jiffies64(n) + 1); |
3031 | } |
3508 | } |
3032 | 3509 | ||
3033 | static inline unsigned long |
3510 | static inline unsigned long |
3034 | timespec_to_jiffies_timeout(const struct timespec *value) |
3511 | timespec_to_jiffies_timeout(const struct timespec *value) |
3035 | { |
3512 | { |
3036 | unsigned long j = timespec_to_jiffies(value); |
3513 | unsigned long j = timespec_to_jiffies(value); |
3037 | 3514 | ||
3038 | return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); |
3515 | return min_t(unsigned long, MAX_JIFFY_OFFSET, j + 1); |
3039 | } |
3516 | } |
3040 | 3517 | ||
3041 | /* |
3518 | /* |
3042 | * If you need to wait X milliseconds between events A and B, but event B |
3519 | * If you need to wait X milliseconds between events A and B, but event B |
3043 | * doesn't happen exactly after event A, you record the timestamp (jiffies) of |
3520 | * doesn't happen exactly after event A, you record the timestamp (jiffies) of |
3044 | * when event A happened, then just before event B you call this function and |
3521 | * when event A happened, then just before event B you call this function and |
3045 | * pass the timestamp as the first argument, and X as the second argument. |
3522 | * pass the timestamp as the first argument, and X as the second argument. |
3046 | */ |
3523 | */ |
3047 | static inline void |
3524 | static inline void |
3048 | wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) |
3525 | wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) |
3049 | { |
3526 | { |
3050 | unsigned long target_jiffies, tmp_jiffies, remaining_jiffies; |
3527 | unsigned long target_jiffies, tmp_jiffies, remaining_jiffies; |
3051 | 3528 | ||
3052 | /* |
3529 | /* |
3053 | * Don't re-read the value of "jiffies" every time since it may change |
3530 | * Don't re-read the value of "jiffies" every time since it may change |
3054 | * behind our back and break the math. |
3531 | * behind our back and break the math. |
3055 | */ |
3532 | */ |
3056 | tmp_jiffies = jiffies; |
3533 | tmp_jiffies = jiffies; |
3057 | target_jiffies = timestamp_jiffies + |
3534 | target_jiffies = timestamp_jiffies + |
3058 | msecs_to_jiffies_timeout(to_wait_ms); |
3535 | msecs_to_jiffies_timeout(to_wait_ms); |
3059 | 3536 | ||
3060 | if (time_after(target_jiffies, tmp_jiffies)) { |
3537 | if (time_after(target_jiffies, tmp_jiffies)) { |
3061 | remaining_jiffies = target_jiffies - tmp_jiffies; |
3538 | remaining_jiffies = target_jiffies - tmp_jiffies; |
3062 | while ((int)remaining_jiffies > 0) { |
- | |
3063 | delay(remaining_jiffies); |
3539 | delay(remaining_jiffies); |
3064 | remaining_jiffies = target_jiffies - jiffies; |
- | |
3065 | } |
- | |
3066 | } |
3540 | } |
3067 | } |
3541 | } |
- | 3542 | ||
3068 | 3543 | static inline void i915_trace_irq_get(struct intel_engine_cs *ring, |
|
3069 | typedef struct |
3544 | struct drm_i915_gem_request *req) |
3070 | { |
- | |
3071 | int width; |
- | |
3072 | int height; |
- | |
3073 | int bpp; |
- | |
3074 | int freq; |
- | |
3075 | }videomode_t; |
- | |
3076 | - | ||
3077 | struct cmdtable |
- | |
3078 | { |
- | |
3079 | char *key; |
- | |
3080 | int size; |
- | |
3081 | int *val; |
- | |
3082 | }; |
- | |
3083 | - | ||
3084 | #define CMDENTRY(key, val) {(key), (sizeof(key)-1), &val} |
- | |
3085 | - | ||
3086 | void parse_cmdline(char *cmdline, struct cmdtable *table, char *log, videomode_t *mode); |
- | |
3087 | struct drm_i915_gem_object |
- | |
3088 | *kos_gem_fb_object_create(struct drm_device *dev, u32 gtt_offset, u32 size); |
- | |
3089 | - | ||
3090 | extern struct drm_i915_gem_object *main_fb_obj; |
- | |
3091 | 3545 | { |
|
3092 | static struct drm_i915_gem_object *get_fb_obj() |
- | |
3093 | { |
- | |
3094 | return main_fb_obj; |
- | |
3095 | }; |
- | |
3096 | - | ||
3097 | #define ioread32(addr) readl(addr) |
- | |
3098 | - | ||
3099 | 3546 | if (ring->trace_irq_req == NULL && ring->irq_get(ring)) |
|
3100 | static inline int pm_runtime_get_sync(struct device *dev) |
- | |
3101 | { |
- | |
3102 | return 0; |
- | |
3103 | } |
- | |
3104 | - | ||
3105 | static inline int pm_runtime_set_active(struct device *dev) |
- | |
3106 | { |
- | |
3107 | return 0; |
- | |
3108 | } |
- | |
3109 | - | ||
3110 | static inline void pm_runtime_disable(struct device *dev) |
- | |
3111 | { |
- | |
3112 | - | ||
3113 | } |
- | |
3114 | - | ||
3115 | static inline int pm_runtime_put_autosuspend(struct device *dev) |
- | |
3116 | { |
- | |
3117 | return 0; |
- | |
3118 | } |
- | |
3119 | - | ||
3120 | static inline u8 inb(u16 port) |
- | |
3121 | { |
- | |
3122 | u8 v; |
- | |
3123 | asm volatile("inb %1,%0" : "=a" (v) : "dN" (port)); |
- | |
3124 | return v; |
- | |
3125 | } |
- | |
3126 | - | ||
3127 | static inline void outb(u8 v, u16 port) |
- | |
3128 | { |
- | |
3129 | asm volatile("outb %0,%1" : : "a" (v), "dN" (port)); |
3547 | i915_gem_request_assign(&ring->trace_irq_req, req); |
3130 | } |
3548 | } |
3131 | 3549 | ||
3132 | #endif><>><>><>><>=>>> |
3550 | #endif><>>>=>>7) |
3133 | #define> |
3551 | #define><7) |
3134 | #define> |
3552 | #define>6) |
3135 | #define> |
3553 | #define><6) |
3136 | #define> |
3554 | #define>5) |
3137 | #define> |
3555 | #define><5) |
3138 | #define> |
3556 | #define>4) |
3139 | #define> |
3557 | #define><4) |
3140 | #define> |
3558 | #define>3) |
3141 | #define> |
3559 | #define><3) |
3142 | #define>5) |
3560 | #define>2) |
3143 | 3561 | #define><2) |
|
3144 | ><5) |
3562 | #define>1) |
3145 | 3563 | #define><1) |
|
3146 | >4) |
3564 | #define>0) |
3147 | #define><4) |
3565 | #define><0) |
3148 | #define>3) |
3566 | #define>> |
3149 | #define><3) |
3567 | #define> |
3150 | #define>2) |
3568 | #define> |
3151 | #define><2) |
3569 | #define> |
3152 | #define>1) |
3570 | #define> |
3153 | #define><1) |
3571 | #define> |
3154 | #define>0) |
3572 | #define> |
3155 | #define><0) |
3573 | #define> |
3156 | #define>><>><>><>><>><>>><>><>><>5) |
3574 | #define> |
3157 | 3575 | #define> |
|
3158 | struct><5) |
3576 | #define>5) |
3159 | 3577 | ||
3160 | struct>4) |
3578 | ><5) |
3161 | #define><4) |
3579 | |
3162 | #define>3) |
3580 | >4) |
3163 | #define><3) |
3581 | #define><4) |
3164 | #define>2) |
3582 | #define>3) |
3165 | #define><2) |
3583 | #define><3) |
3166 | #define>1) |
3584 | #define>2) |
3167 | #define><1) |
3585 | #define><2) |
3168 | #define>0) |
3586 | #define>1) |
3169 | #define><0) |
3587 | #define><1) |
3170 | #define>><>>>>> |
3588 | #define>0) |
- | 3589 | #define><0) |
|
- | 3590 | #define>><>><>><>><>><>>><>><>><>5) |
|
- | 3591 | ||
- | 3592 | struct><5) |
|
- | 3593 | ||
- | 3594 | struct>4) |
|
- | 3595 | #define><4) |
|
- | 3596 | #define>3) |
|
- | 3597 | #define><3) |
|
- | 3598 | #define>2) |
|
- | 3599 | #define><2) |
|
- | 3600 | #define>1) |
|
- | 3601 | #define><1) |
|
- | 3602 | #define>0) |
|
- | 3603 | #define><0) |
|
- | 3604 | #define>0) |
|
- | 3605 | /** |
|
- | 3606 | ><0) |
|
- | 3607 | /** |
|
- | 3608 | >><>>><>><>><>><>>>>>> |