]>
Commit | Line | Data |
---|---|---|
79e53945 JB |
1 | /* |
2 | * Copyright (c) 2006 Dave Airlie <airlied@linux.ie> | |
3 | * Copyright (c) 2007-2008 Intel Corporation | |
4 | * Jesse Barnes <jesse.barnes@intel.com> | |
5 | * | |
6 | * Permission is hereby granted, free of charge, to any person obtaining a | |
7 | * copy of this software and associated documentation files (the "Software"), | |
8 | * to deal in the Software without restriction, including without limitation | |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
10 | * and/or sell copies of the Software, and to permit persons to whom the | |
11 | * Software is furnished to do so, subject to the following conditions: | |
12 | * | |
13 | * The above copyright notice and this permission notice (including the next | |
14 | * paragraph) shall be included in all copies or substantial portions of the | |
15 | * Software. | |
16 | * | |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
22 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
23 | * IN THE SOFTWARE. | |
24 | */ | |
25 | #ifndef __INTEL_DRV_H__ | |
26 | #define __INTEL_DRV_H__ | |
27 | ||
d1d70677 | 28 | #include <linux/async.h> |
79e53945 | 29 | #include <linux/i2c.h> |
178f736a | 30 | #include <linux/hdmi.h> |
e6017571 | 31 | #include <linux/sched/clock.h> |
760285e7 | 32 | #include <drm/i915_drm.h> |
80824003 | 33 | #include "i915_drv.h" |
760285e7 DH |
34 | #include <drm/drm_crtc.h> |
35 | #include <drm/drm_crtc_helper.h> | |
9338203c | 36 | #include <drm/drm_encoder.h> |
760285e7 | 37 | #include <drm/drm_fb_helper.h> |
b1ba124d | 38 | #include <drm/drm_dp_dual_mode_helper.h> |
0e32b39c | 39 | #include <drm/drm_dp_mst_helper.h> |
eeca778a | 40 | #include <drm/drm_rect.h> |
10f81c19 | 41 | #include <drm/drm_atomic.h> |
913d8d11 | 42 | |
1d5bfac9 SV |
43 | /** |
44 | * _wait_for - magic (register) wait macro | |
45 | * | |
46 | * Does the right thing for modeset paths when run under kdgb or similar atomic | |
47 | * contexts. Note that it's important that we check the condition again after | |
48 | * having timed out, since the timeout could be due to preemption or similar and | |
49 | * we've never had a chance to check the condition before the timeout. | |
50 | */ | |
a54b1873 | 51 | #define _wait_for(COND, US, Wmin, Wmax) ({ \ |
3f177625 | 52 | unsigned long timeout__ = jiffies + usecs_to_jiffies(US) + 1; \ |
a54b1873 | 53 | long wait__ = (Wmin); /* recommended min for usleep is 10 us */ \ |
b0876afd | 54 | int ret__; \ |
290b20a6 | 55 | might_sleep(); \ |
b0876afd DG |
56 | for (;;) { \ |
57 | bool expired__ = time_after(jiffies, timeout__); \ | |
58 | if (COND) { \ | |
59 | ret__ = 0; \ | |
60 | break; \ | |
61 | } \ | |
62 | if (expired__) { \ | |
63 | ret__ = -ETIMEDOUT; \ | |
913d8d11 CW |
64 | break; \ |
65 | } \ | |
a54b1873 CW |
66 | usleep_range(wait__, wait__ * 2); \ |
67 | if (wait__ < (Wmax)) \ | |
68 | wait__ <<= 1; \ | |
913d8d11 CW |
69 | } \ |
70 | ret__; \ | |
71 | }) | |
72 | ||
a54b1873 | 73 | #define wait_for(COND, MS) _wait_for((COND), (MS) * 1000, 10, 1000) |
3f177625 | 74 | |
0351b939 TU |
75 | /* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. */ |
76 | #if defined(CONFIG_DRM_I915_DEBUG) && defined(CONFIG_PREEMPT_COUNT) | |
18f4b843 | 77 | # define _WAIT_FOR_ATOMIC_CHECK(ATOMIC) WARN_ON_ONCE((ATOMIC) && !in_atomic()) |
0351b939 | 78 | #else |
18f4b843 | 79 | # define _WAIT_FOR_ATOMIC_CHECK(ATOMIC) do { } while (0) |
0351b939 TU |
80 | #endif |
81 | ||
18f4b843 TU |
82 | #define _wait_for_atomic(COND, US, ATOMIC) \ |
83 | ({ \ | |
84 | int cpu, ret, timeout = (US) * 1000; \ | |
85 | u64 base; \ | |
86 | _WAIT_FOR_ATOMIC_CHECK(ATOMIC); \ | |
18f4b843 TU |
87 | if (!(ATOMIC)) { \ |
88 | preempt_disable(); \ | |
89 | cpu = smp_processor_id(); \ | |
90 | } \ | |
91 | base = local_clock(); \ | |
92 | for (;;) { \ | |
93 | u64 now = local_clock(); \ | |
94 | if (!(ATOMIC)) \ | |
95 | preempt_enable(); \ | |
96 | if (COND) { \ | |
97 | ret = 0; \ | |
98 | break; \ | |
99 | } \ | |
100 | if (now - base >= timeout) { \ | |
101 | ret = -ETIMEDOUT; \ | |
0351b939 TU |
102 | break; \ |
103 | } \ | |
104 | cpu_relax(); \ | |
18f4b843 TU |
105 | if (!(ATOMIC)) { \ |
106 | preempt_disable(); \ | |
107 | if (unlikely(cpu != smp_processor_id())) { \ | |
108 | timeout -= now - base; \ | |
109 | cpu = smp_processor_id(); \ | |
110 | base = local_clock(); \ | |
111 | } \ | |
112 | } \ | |
0351b939 | 113 | } \ |
18f4b843 TU |
114 | ret; \ |
115 | }) | |
116 | ||
117 | #define wait_for_us(COND, US) \ | |
118 | ({ \ | |
119 | int ret__; \ | |
120 | BUILD_BUG_ON(!__builtin_constant_p(US)); \ | |
121 | if ((US) > 10) \ | |
a54b1873 | 122 | ret__ = _wait_for((COND), (US), 10, 10); \ |
18f4b843 TU |
123 | else \ |
124 | ret__ = _wait_for_atomic((COND), (US), 0); \ | |
0351b939 TU |
125 | ret__; \ |
126 | }) | |
127 | ||
939cf46c TU |
128 | #define wait_for_atomic_us(COND, US) \ |
129 | ({ \ | |
130 | BUILD_BUG_ON(!__builtin_constant_p(US)); \ | |
131 | BUILD_BUG_ON((US) > 50000); \ | |
132 | _wait_for_atomic((COND), (US), 1); \ | |
133 | }) | |
134 | ||
135 | #define wait_for_atomic(COND, MS) wait_for_atomic_us((COND), (MS) * 1000) | |
481b6af3 | 136 | |
49938ac4 JN |
137 | #define KHz(x) (1000 * (x)) |
138 | #define MHz(x) KHz(1000 * (x)) | |
021357ac | 139 | |
79e53945 JB |
140 | /* |
141 | * Display related stuff | |
142 | */ | |
143 | ||
144 | /* store information about an Ixxx DVO */ | |
145 | /* The i830->i865 use multiple DVOs with multiple i2cs */ | |
146 | /* the i915, i945 have a single sDVO i2c bus - which is different */ | |
147 | #define MAX_OUTPUTS 6 | |
148 | /* maximum connectors per crtcs in the mode set */ | |
79e53945 | 149 | |
4726e0b0 SK |
150 | /* Maximum cursor sizes */ |
151 | #define GEN2_CURSOR_WIDTH 64 | |
152 | #define GEN2_CURSOR_HEIGHT 64 | |
068be561 DL |
153 | #define MAX_CURSOR_WIDTH 256 |
154 | #define MAX_CURSOR_HEIGHT 256 | |
4726e0b0 | 155 | |
79e53945 JB |
156 | #define INTEL_I2C_BUS_DVO 1 |
157 | #define INTEL_I2C_BUS_SDVO 2 | |
158 | ||
159 | /* these are outputs from the chip - integrated only | |
160 | external chips are via DVO or SDVO output */ | |
6847d71b PZ |
161 | enum intel_output_type { |
162 | INTEL_OUTPUT_UNUSED = 0, | |
163 | INTEL_OUTPUT_ANALOG = 1, | |
164 | INTEL_OUTPUT_DVO = 2, | |
165 | INTEL_OUTPUT_SDVO = 3, | |
166 | INTEL_OUTPUT_LVDS = 4, | |
167 | INTEL_OUTPUT_TVOUT = 5, | |
168 | INTEL_OUTPUT_HDMI = 6, | |
cca0502b | 169 | INTEL_OUTPUT_DP = 7, |
6847d71b PZ |
170 | INTEL_OUTPUT_EDP = 8, |
171 | INTEL_OUTPUT_DSI = 9, | |
7e732cac | 172 | INTEL_OUTPUT_DDI = 10, |
6847d71b PZ |
173 | INTEL_OUTPUT_DP_MST = 11, |
174 | }; | |
79e53945 JB |
175 | |
176 | #define INTEL_DVO_CHIP_NONE 0 | |
177 | #define INTEL_DVO_CHIP_LVDS 1 | |
178 | #define INTEL_DVO_CHIP_TMDS 2 | |
179 | #define INTEL_DVO_CHIP_TVOUT 4 | |
180 | ||
dfba2e2d SK |
181 | #define INTEL_DSI_VIDEO_MODE 0 |
182 | #define INTEL_DSI_COMMAND_MODE 1 | |
72ffa333 | 183 | |
79e53945 JB |
184 | struct intel_framebuffer { |
185 | struct drm_framebuffer base; | |
05394f39 | 186 | struct drm_i915_gem_object *obj; |
2d7a215f | 187 | struct intel_rotation_info rot_info; |
6687c906 VS |
188 | |
189 | /* for each plane in the normal GTT view */ | |
190 | struct { | |
191 | unsigned int x, y; | |
192 | } normal[2]; | |
193 | /* for each plane in the rotated GTT view */ | |
194 | struct { | |
195 | unsigned int x, y; | |
196 | unsigned int pitch; /* pixels */ | |
197 | } rotated[2]; | |
79e53945 JB |
198 | }; |
199 | ||
37811fcc CW |
200 | struct intel_fbdev { |
201 | struct drm_fb_helper helper; | |
8bcd4553 | 202 | struct intel_framebuffer *fb; |
058d88c4 | 203 | struct i915_vma *vma; |
5935485f | 204 | unsigned long vma_flags; |
43cee314 | 205 | async_cookie_t cookie; |
d978ef14 | 206 | int preferred_bpp; |
37811fcc | 207 | }; |
79e53945 | 208 | |
21d40d37 | 209 | struct intel_encoder { |
4ef69c7a | 210 | struct drm_encoder base; |
9a935856 | 211 | |
6847d71b | 212 | enum intel_output_type type; |
03cdc1d4 | 213 | enum port port; |
bc079e8b | 214 | unsigned int cloneable; |
21d40d37 | 215 | void (*hot_plug)(struct intel_encoder *); |
7e732cac VS |
216 | enum intel_output_type (*compute_output_type)(struct intel_encoder *, |
217 | struct intel_crtc_state *, | |
218 | struct drm_connector_state *); | |
7ae89233 | 219 | bool (*compute_config)(struct intel_encoder *, |
0a478c27 ML |
220 | struct intel_crtc_state *, |
221 | struct drm_connector_state *); | |
fd6bbda9 | 222 | void (*pre_pll_enable)(struct intel_encoder *, |
5f88a9c6 VS |
223 | const struct intel_crtc_state *, |
224 | const struct drm_connector_state *); | |
fd6bbda9 | 225 | void (*pre_enable)(struct intel_encoder *, |
5f88a9c6 VS |
226 | const struct intel_crtc_state *, |
227 | const struct drm_connector_state *); | |
fd6bbda9 | 228 | void (*enable)(struct intel_encoder *, |
5f88a9c6 VS |
229 | const struct intel_crtc_state *, |
230 | const struct drm_connector_state *); | |
fd6bbda9 | 231 | void (*disable)(struct intel_encoder *, |
5f88a9c6 VS |
232 | const struct intel_crtc_state *, |
233 | const struct drm_connector_state *); | |
fd6bbda9 | 234 | void (*post_disable)(struct intel_encoder *, |
5f88a9c6 VS |
235 | const struct intel_crtc_state *, |
236 | const struct drm_connector_state *); | |
fd6bbda9 | 237 | void (*post_pll_disable)(struct intel_encoder *, |
5f88a9c6 VS |
238 | const struct intel_crtc_state *, |
239 | const struct drm_connector_state *); | |
f0947c37 SV |
240 | /* Read out the current hw state of this connector, returning true if |
241 | * the encoder is active. If the encoder is enabled it also set the pipe | |
242 | * it is connected to in the pipe parameter. */ | |
243 | bool (*get_hw_state)(struct intel_encoder *, enum pipe *pipe); | |
045ac3b5 | 244 | /* Reconstructs the equivalent mode flags for the current hardware |
fdafa9e2 | 245 | * state. This must be called _after_ display->get_pipe_config has |
63000ef6 XZ |
246 | * pre-filled the pipe config. Note that intel_encoder->base.crtc must |
247 | * be set correctly before calling this function. */ | |
045ac3b5 | 248 | void (*get_config)(struct intel_encoder *, |
5cec258b | 249 | struct intel_crtc_state *pipe_config); |
62b69566 ACO |
250 | /* Returns a mask of power domains that need to be referenced as part |
251 | * of the hardware state readout code. */ | |
252 | u64 (*get_power_domains)(struct intel_encoder *encoder); | |
07f9cd0b ID |
253 | /* |
254 | * Called during system suspend after all pending requests for the | |
255 | * encoder are flushed (for example for DP AUX transactions) and | |
256 | * device interrupts are disabled. | |
257 | */ | |
258 | void (*suspend)(struct intel_encoder *); | |
f8aed700 | 259 | int crtc_mask; |
1d843f9d | 260 | enum hpd_pin hpd_pin; |
79f255a0 | 261 | enum intel_display_power_domain power_domain; |
f1a3acea PD |
262 | /* for communication with audio component; protected by av_mutex */ |
263 | const struct drm_connector *audio_connector; | |
79e53945 JB |
264 | }; |
265 | ||
1d508706 | 266 | struct intel_panel { |
dd06f90e | 267 | struct drm_display_mode *fixed_mode; |
dc911f5b | 268 | struct drm_display_mode *alt_fixed_mode; |
ec9ed197 | 269 | struct drm_display_mode *downclock_mode; |
58c68779 JN |
270 | |
271 | /* backlight */ | |
272 | struct { | |
c91c9f32 | 273 | bool present; |
58c68779 | 274 | u32 level; |
6dda730e | 275 | u32 min; |
7bd688cd | 276 | u32 max; |
58c68779 | 277 | bool enabled; |
636baebf JN |
278 | bool combination_mode; /* gen 2/4 only */ |
279 | bool active_low_pwm; | |
32b421e7 | 280 | bool alternate_pwm_increment; /* lpt+ */ |
b029e66f SK |
281 | |
282 | /* PWM chip */ | |
022e4e52 SK |
283 | bool util_pin_active_low; /* bxt+ */ |
284 | u8 controller; /* bxt+ only */ | |
b029e66f SK |
285 | struct pwm_device *pwm; |
286 | ||
58c68779 | 287 | struct backlight_device *device; |
ab656bb9 | 288 | |
5507faeb JN |
289 | /* Connector and platform specific backlight functions */ |
290 | int (*setup)(struct intel_connector *connector, enum pipe pipe); | |
291 | uint32_t (*get)(struct intel_connector *connector); | |
7d025e08 ML |
292 | void (*set)(const struct drm_connector_state *conn_state, uint32_t level); |
293 | void (*disable)(const struct drm_connector_state *conn_state); | |
294 | void (*enable)(const struct intel_crtc_state *crtc_state, | |
295 | const struct drm_connector_state *conn_state); | |
5507faeb JN |
296 | uint32_t (*hz_to_pwm)(struct intel_connector *connector, |
297 | uint32_t hz); | |
298 | void (*power)(struct intel_connector *, bool enable); | |
299 | } backlight; | |
1d508706 JN |
300 | }; |
301 | ||
5daa55eb ZW |
302 | struct intel_connector { |
303 | struct drm_connector base; | |
9a935856 SV |
304 | /* |
305 | * The fixed encoder this connector is connected to. | |
306 | */ | |
df0e9248 | 307 | struct intel_encoder *encoder; |
9a935856 | 308 | |
8e1b56a4 JN |
309 | /* ACPI device id for ACPI and driver cooperation */ |
310 | u32 acpi_device_id; | |
311 | ||
f0947c37 SV |
312 | /* Reads out the current hw, returning true if the connector is enabled |
313 | * and active (i.e. dpms ON state). */ | |
314 | bool (*get_hw_state)(struct intel_connector *); | |
1d508706 JN |
315 | |
316 | /* Panel info for eDP and LVDS */ | |
317 | struct intel_panel panel; | |
9cd300e0 JN |
318 | |
319 | /* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */ | |
320 | struct edid *edid; | |
beb60608 | 321 | struct edid *detect_edid; |
821450c6 EE |
322 | |
323 | /* since POLL and HPD connectors may use the same HPD line keep the native | |
324 | state of connector->polled in case hotplug storm detection changes it */ | |
325 | u8 polled; | |
0e32b39c DA |
326 | |
327 | void *port; /* store this opaque as its illegal to dereference it */ | |
328 | ||
329 | struct intel_dp *mst_port; | |
9301397a MN |
330 | |
331 | /* Work struct to schedule a uevent on link train failure */ | |
332 | struct work_struct modeset_retry_work; | |
5daa55eb ZW |
333 | }; |
334 | ||
11c1a9ec ML |
335 | struct intel_digital_connector_state { |
336 | struct drm_connector_state base; | |
337 | ||
338 | enum hdmi_force_audio force_audio; | |
339 | int broadcast_rgb; | |
340 | }; | |
341 | ||
342 | #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base) | |
343 | ||
9e2c8475 | 344 | struct dpll { |
80ad9206 VS |
345 | /* given values */ |
346 | int n; | |
347 | int m1, m2; | |
348 | int p1, p2; | |
349 | /* derived values */ | |
350 | int dot; | |
351 | int vco; | |
352 | int m; | |
353 | int p; | |
9e2c8475 | 354 | }; |
80ad9206 | 355 | |
de419ab6 ML |
356 | struct intel_atomic_state { |
357 | struct drm_atomic_state base; | |
358 | ||
bb0f4aab VS |
359 | struct { |
360 | /* | |
361 | * Logical state of cdclk (used for all scaling, watermark, | |
362 | * etc. calculations and checks). This is computed as if all | |
363 | * enabled crtcs were active. | |
364 | */ | |
365 | struct intel_cdclk_state logical; | |
366 | ||
367 | /* | |
368 | * Actual state of cdclk, can be different from the logical | |
369 | * state only when all crtc's are DPMS off. | |
370 | */ | |
371 | struct intel_cdclk_state actual; | |
372 | } cdclk; | |
1a617b77 | 373 | |
565602d7 ML |
374 | bool dpll_set, modeset; |
375 | ||
8b4a7d05 MR |
376 | /* |
377 | * Does this transaction change the pipes that are active? This mask | |
378 | * tracks which CRTC's have changed their active state at the end of | |
379 | * the transaction (not counting the temporary disable during modesets). | |
380 | * This mask should only be non-zero when intel_state->modeset is true, | |
381 | * but the converse is not necessarily true; simply changing a mode may | |
382 | * not flip the final active status of any CRTC's | |
383 | */ | |
384 | unsigned int active_pipe_changes; | |
385 | ||
565602d7 | 386 | unsigned int active_crtcs; |
d305e061 VS |
387 | /* minimum acceptable cdclk for each pipe */ |
388 | int min_cdclk[I915_MAX_PIPES]; | |
53e9bf5e VS |
389 | /* minimum acceptable voltage level for each pipe */ |
390 | u8 min_voltage_level[I915_MAX_PIPES]; | |
565602d7 | 391 | |
2c42e535 | 392 | struct intel_shared_dpll_state shared_dpll[I915_NUM_PLLS]; |
ed4a6a7c MR |
393 | |
394 | /* | |
395 | * Current watermarks can't be trusted during hardware readout, so | |
396 | * don't bother calculating intermediate watermarks. | |
397 | */ | |
398 | bool skip_intermediate_wm; | |
98d39494 MR |
399 | |
400 | /* Gen9+ only */ | |
734fa01f | 401 | struct skl_wm_values wm_results; |
c004a90b CW |
402 | |
403 | struct i915_sw_fence commit_ready; | |
eb955eee CW |
404 | |
405 | struct llist_node freed; | |
de419ab6 ML |
406 | }; |
407 | ||
eeca778a | 408 | struct intel_plane_state { |
2b875c22 | 409 | struct drm_plane_state base; |
eeca778a | 410 | struct drm_rect clip; |
be1e3415 | 411 | struct i915_vma *vma; |
5935485f CW |
412 | unsigned long flags; |
413 | #define PLANE_HAS_FENCE BIT(0) | |
32b7eeec | 414 | |
b63a16f6 VS |
415 | struct { |
416 | u32 offset; | |
417 | int x, y; | |
418 | } main; | |
8d970654 VS |
419 | struct { |
420 | u32 offset; | |
421 | int x, y; | |
422 | } aux; | |
b63a16f6 | 423 | |
a0864d59 VS |
424 | /* plane control register */ |
425 | u32 ctl; | |
426 | ||
4036c78c JA |
427 | /* plane color control register */ |
428 | u32 color_ctl; | |
429 | ||
be41e336 CK |
430 | /* |
431 | * scaler_id | |
432 | * = -1 : not using a scaler | |
433 | * >= 0 : using a scalers | |
434 | * | |
435 | * plane requiring a scaler: | |
436 | * - During check_plane, its bit is set in | |
437 | * crtc_state->scaler_state.scaler_users by calling helper function | |
86adf9d7 | 438 | * update_scaler_plane. |
be41e336 CK |
439 | * - scaler_id indicates the scaler it got assigned. |
440 | * | |
441 | * plane doesn't require a scaler: | |
442 | * - this can happen when scaling is no more required or plane simply | |
443 | * got disabled. | |
444 | * - During check_plane, corresponding bit is reset in | |
445 | * crtc_state->scaler_state.scaler_users by calling helper function | |
86adf9d7 | 446 | * update_scaler_plane. |
be41e336 CK |
447 | */ |
448 | int scaler_id; | |
818ed961 ML |
449 | |
450 | struct drm_intel_sprite_colorkey ckey; | |
eeca778a GP |
451 | }; |
452 | ||
5724dbd1 | 453 | struct intel_initial_plane_config { |
2d14030b | 454 | struct intel_framebuffer *fb; |
49af449b | 455 | unsigned int tiling; |
46f297fb JB |
456 | int size; |
457 | u32 base; | |
458 | }; | |
459 | ||
be41e336 CK |
460 | #define SKL_MIN_SRC_W 8 |
461 | #define SKL_MAX_SRC_W 4096 | |
462 | #define SKL_MIN_SRC_H 8 | |
6156a456 | 463 | #define SKL_MAX_SRC_H 4096 |
be41e336 CK |
464 | #define SKL_MIN_DST_W 8 |
465 | #define SKL_MAX_DST_W 4096 | |
466 | #define SKL_MIN_DST_H 8 | |
6156a456 | 467 | #define SKL_MAX_DST_H 4096 |
be41e336 CK |
468 | |
469 | struct intel_scaler { | |
be41e336 CK |
470 | int in_use; |
471 | uint32_t mode; | |
472 | }; | |
473 | ||
474 | struct intel_crtc_scaler_state { | |
475 | #define SKL_NUM_SCALERS 2 | |
476 | struct intel_scaler scalers[SKL_NUM_SCALERS]; | |
477 | ||
478 | /* | |
479 | * scaler_users: keeps track of users requesting scalers on this crtc. | |
480 | * | |
481 | * If a bit is set, a user is using a scaler. | |
482 | * Here user can be a plane or crtc as defined below: | |
483 | * bits 0-30 - plane (bit position is index from drm_plane_index) | |
484 | * bit 31 - crtc | |
485 | * | |
486 | * Instead of creating a new index to cover planes and crtc, using | |
487 | * existing drm_plane_index for planes which is well less than 31 | |
488 | * planes and bit 31 for crtc. This should be fine to cover all | |
489 | * our platforms. | |
490 | * | |
491 | * intel_atomic_setup_scalers will setup available scalers to users | |
492 | * requesting scalers. It will gracefully fail if request exceeds | |
493 | * avilability. | |
494 | */ | |
495 | #define SKL_CRTC_INDEX 31 | |
496 | unsigned scaler_users; | |
497 | ||
498 | /* scaler used by crtc for panel fitting purpose */ | |
499 | int scaler_id; | |
500 | }; | |
501 | ||
1ed51de9 SV |
502 | /* drm_mode->private_flags */ |
503 | #define I915_MODE_FLAG_INHERITED 1 | |
aec0246f US |
504 | /* Flag to get scanline using frame time stamps */ |
505 | #define I915_MODE_FLAG_GET_SCANLINE_FROM_TIMESTAMP (1<<1) | |
1ed51de9 | 506 | |
4e0963c7 MR |
507 | struct intel_pipe_wm { |
508 | struct intel_wm_level wm[5]; | |
509 | uint32_t linetime; | |
510 | bool fbc_wm_enabled; | |
511 | bool pipe_enabled; | |
512 | bool sprites_enabled; | |
513 | bool sprites_scaled; | |
514 | }; | |
515 | ||
a62163e9 | 516 | struct skl_plane_wm { |
4e0963c7 MR |
517 | struct skl_wm_level wm[8]; |
518 | struct skl_wm_level trans_wm; | |
a62163e9 L |
519 | }; |
520 | ||
521 | struct skl_pipe_wm { | |
522 | struct skl_plane_wm planes[I915_MAX_PLANES]; | |
4e0963c7 MR |
523 | uint32_t linetime; |
524 | }; | |
525 | ||
855c79f5 VS |
526 | enum vlv_wm_level { |
527 | VLV_WM_LEVEL_PM2, | |
528 | VLV_WM_LEVEL_PM5, | |
529 | VLV_WM_LEVEL_DDR_DVFS, | |
530 | NUM_VLV_WM_LEVELS, | |
531 | }; | |
532 | ||
533 | struct vlv_wm_state { | |
114d7dc0 VS |
534 | struct g4x_pipe_wm wm[NUM_VLV_WM_LEVELS]; |
535 | struct g4x_sr_wm sr[NUM_VLV_WM_LEVELS]; | |
855c79f5 | 536 | uint8_t num_levels; |
855c79f5 VS |
537 | bool cxsr; |
538 | }; | |
539 | ||
814e7f0b VS |
540 | struct vlv_fifo_state { |
541 | u16 plane[I915_MAX_PLANES]; | |
542 | }; | |
543 | ||
04548cba VS |
544 | enum g4x_wm_level { |
545 | G4X_WM_LEVEL_NORMAL, | |
546 | G4X_WM_LEVEL_SR, | |
547 | G4X_WM_LEVEL_HPLL, | |
548 | NUM_G4X_WM_LEVELS, | |
549 | }; | |
550 | ||
551 | struct g4x_wm_state { | |
552 | struct g4x_pipe_wm wm; | |
553 | struct g4x_sr_wm sr; | |
554 | struct g4x_sr_wm hpll; | |
555 | bool cxsr; | |
556 | bool hpll_en; | |
557 | bool fbc_en; | |
558 | }; | |
559 | ||
e8f1f02e MR |
560 | struct intel_crtc_wm_state { |
561 | union { | |
562 | struct { | |
563 | /* | |
564 | * Intermediate watermarks; these can be | |
565 | * programmed immediately since they satisfy | |
566 | * both the current configuration we're | |
567 | * switching away from and the new | |
568 | * configuration we're switching to. | |
569 | */ | |
570 | struct intel_pipe_wm intermediate; | |
571 | ||
572 | /* | |
573 | * Optimal watermarks, programmed post-vblank | |
574 | * when this state is committed. | |
575 | */ | |
576 | struct intel_pipe_wm optimal; | |
577 | } ilk; | |
578 | ||
579 | struct { | |
580 | /* gen9+ only needs 1-step wm programming */ | |
581 | struct skl_pipe_wm optimal; | |
ce0ba283 | 582 | struct skl_ddb_entry ddb; |
e8f1f02e | 583 | } skl; |
855c79f5 VS |
584 | |
585 | struct { | |
5012e604 | 586 | /* "raw" watermarks (not inverted) */ |
114d7dc0 | 587 | struct g4x_pipe_wm raw[NUM_VLV_WM_LEVELS]; |
4841da51 VS |
588 | /* intermediate watermarks (inverted) */ |
589 | struct vlv_wm_state intermediate; | |
855c79f5 VS |
590 | /* optimal watermarks (inverted) */ |
591 | struct vlv_wm_state optimal; | |
814e7f0b VS |
592 | /* display FIFO split */ |
593 | struct vlv_fifo_state fifo_state; | |
855c79f5 | 594 | } vlv; |
04548cba VS |
595 | |
596 | struct { | |
597 | /* "raw" watermarks */ | |
598 | struct g4x_pipe_wm raw[NUM_G4X_WM_LEVELS]; | |
599 | /* intermediate watermarks */ | |
600 | struct g4x_wm_state intermediate; | |
601 | /* optimal watermarks */ | |
602 | struct g4x_wm_state optimal; | |
603 | } g4x; | |
e8f1f02e MR |
604 | }; |
605 | ||
606 | /* | |
607 | * Platforms with two-step watermark programming will need to | |
608 | * update watermark programming post-vblank to switch from the | |
609 | * safe intermediate watermarks to the optimal final | |
610 | * watermarks. | |
611 | */ | |
612 | bool need_postvbl_update; | |
613 | }; | |
614 | ||
5cec258b | 615 | struct intel_crtc_state { |
2d112de7 ACO |
616 | struct drm_crtc_state base; |
617 | ||
bb760063 SV |
618 | /** |
619 | * quirks - bitfield with hw state readout quirks | |
620 | * | |
621 | * For various reasons the hw state readout code might not be able to | |
622 | * completely faithfully read out the current state. These cases are | |
623 | * tracked with quirk flags so that fastboot and state checker can act | |
624 | * accordingly. | |
625 | */ | |
9953599b | 626 | #define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */ |
bb760063 SV |
627 | unsigned long quirks; |
628 | ||
cd202f69 | 629 | unsigned fb_bits; /* framebuffers to flip */ |
ab1d3a0e ML |
630 | bool update_pipe; /* can a fast modeset be performed? */ |
631 | bool disable_cxsr; | |
caed361d | 632 | bool update_wm_pre, update_wm_post; /* watermarks are updated */ |
e8861675 | 633 | bool fb_changed; /* fb on any of the planes is changed */ |
236c48e6 | 634 | bool fifo_changed; /* FIFO split is changed */ |
bfd16b2a | 635 | |
37327abd VS |
636 | /* Pipe source size (ie. panel fitter input size) |
637 | * All planes will be positioned inside this space, | |
638 | * and get clipped at the edges. */ | |
639 | int pipe_src_w, pipe_src_h; | |
640 | ||
a7d1b3f4 VS |
641 | /* |
642 | * Pipe pixel rate, adjusted for | |
643 | * panel fitter/pipe scaler downscaling. | |
644 | */ | |
645 | unsigned int pixel_rate; | |
646 | ||
5bfe2ac0 SV |
647 | /* Whether to set up the PCH/FDI. Note that we never allow sharing |
648 | * between pch encoders and cpu encoders. */ | |
649 | bool has_pch_encoder; | |
50f3b016 | 650 | |
e43823ec JB |
651 | /* Are we sending infoframes on the attached port */ |
652 | bool has_infoframe; | |
653 | ||
3b117c8f | 654 | /* CPU Transcoder for the pipe. Currently this can only differ from the |
4d1de975 JN |
655 | * pipe on Haswell and later (where we have a special eDP transcoder) |
656 | * and Broxton (where we have special DSI transcoders). */ | |
3b117c8f SV |
657 | enum transcoder cpu_transcoder; |
658 | ||
50f3b016 SV |
659 | /* |
660 | * Use reduced/limited/broadcast rbg range, compressing from the full | |
661 | * range fed into the crtcs. | |
662 | */ | |
663 | bool limited_color_range; | |
664 | ||
253c84c8 VS |
665 | /* Bitmask of encoder types (enum intel_output_type) |
666 | * driven by the pipe. | |
667 | */ | |
668 | unsigned int output_types; | |
669 | ||
6897b4b5 SV |
670 | /* Whether we should send NULL infoframes. Required for audio. */ |
671 | bool has_hdmi_sink; | |
672 | ||
9ed109a7 SV |
673 | /* Audio enabled on this pipe. Only valid if either has_hdmi_sink or |
674 | * has_dp_encoder is set. */ | |
675 | bool has_audio; | |
676 | ||
d8b32247 SV |
677 | /* |
678 | * Enable dithering, used when the selected pipe bpp doesn't match the | |
679 | * plane bpp. | |
680 | */ | |
965e0c48 | 681 | bool dither; |
f47709a9 | 682 | |
611032bf MN |
683 | /* |
684 | * Dither gets enabled for 18bpp which causes CRC mismatch errors for | |
685 | * compliance video pattern tests. | |
686 | * Disable dither only if it is a compliance test request for | |
687 | * 18bpp. | |
688 | */ | |
689 | bool dither_force_disable; | |
690 | ||
f47709a9 SV |
691 | /* Controls for the clock computation, to override various stages. */ |
692 | bool clock_set; | |
693 | ||
09ede541 SV |
694 | /* SDVO TV has a bunch of special case. To make multifunction encoders |
695 | * work correctly, we need to track this at runtime.*/ | |
696 | bool sdvo_tv_clock; | |
697 | ||
e29c22c0 SV |
698 | /* |
699 | * crtc bandwidth limit, don't increase pipe bpp or clock if not really | |
700 | * required. This is set in the 2nd loop of calling encoder's | |
701 | * ->compute_config if the first pick doesn't work out. | |
702 | */ | |
703 | bool bw_constrained; | |
704 | ||
f47709a9 SV |
705 | /* Settings for the intel dpll used on pretty much everything but |
706 | * haswell. */ | |
80ad9206 | 707 | struct dpll dpll; |
f47709a9 | 708 | |
8106ddbd ACO |
709 | /* Selected dpll when shared or NULL. */ |
710 | struct intel_shared_dpll *shared_dpll; | |
a43f6e0f | 711 | |
66e985c0 SV |
712 | /* Actual register state of the dpll, for shared dpll cross-checking. */ |
713 | struct intel_dpll_hw_state dpll_hw_state; | |
714 | ||
47eacbab VS |
715 | /* DSI PLL registers */ |
716 | struct { | |
717 | u32 ctrl, div; | |
718 | } dsi_pll; | |
719 | ||
965e0c48 | 720 | int pipe_bpp; |
6cf86a5e | 721 | struct intel_link_m_n dp_m_n; |
ff9a6750 | 722 | |
439d7ac0 PB |
723 | /* m2_n2 for eDP downclock */ |
724 | struct intel_link_m_n dp_m2_n2; | |
f769cd24 | 725 | bool has_drrs; |
439d7ac0 | 726 | |
4d90f2d5 VS |
727 | bool has_psr; |
728 | bool has_psr2; | |
729 | ||
ff9a6750 SV |
730 | /* |
731 | * Frequence the dpll for the port should run at. Differs from the | |
3c52f4eb VS |
732 | * adjusted dotclock e.g. for DP or 12bpc hdmi mode. This is also |
733 | * already multiplied by pixel_multiplier. | |
df92b1e6 | 734 | */ |
ff9a6750 SV |
735 | int port_clock; |
736 | ||
6cc5f341 SV |
737 | /* Used by SDVO (and if we ever fix it, HDMI). */ |
738 | unsigned pixel_multiplier; | |
2dd24552 | 739 | |
90a6b7b0 VS |
740 | uint8_t lane_count; |
741 | ||
95a7a2ae ID |
742 | /* |
743 | * Used by platforms having DP/HDMI PHY with programmable lane | |
744 | * latency optimization. | |
745 | */ | |
746 | uint8_t lane_lat_optim_mask; | |
747 | ||
53e9bf5e VS |
748 | /* minimum acceptable voltage level */ |
749 | u8 min_voltage_level; | |
750 | ||
2dd24552 | 751 | /* Panel fitter controls for gen2-gen4 + VLV */ |
b074cec8 JB |
752 | struct { |
753 | u32 control; | |
754 | u32 pgm_ratios; | |
68fc8742 | 755 | u32 lvds_border_bits; |
b074cec8 JB |
756 | } gmch_pfit; |
757 | ||
758 | /* Panel fitter placement and size for Ironlake+ */ | |
759 | struct { | |
760 | u32 pos; | |
761 | u32 size; | |
fd4daa9c | 762 | bool enabled; |
fabf6e51 | 763 | bool force_thru; |
b074cec8 | 764 | } pch_pfit; |
33d29b14 | 765 | |
ca3a0ff8 | 766 | /* FDI configuration, only valid if has_pch_encoder is set. */ |
33d29b14 | 767 | int fdi_lanes; |
ca3a0ff8 | 768 | struct intel_link_m_n fdi_m_n; |
42db64ef PZ |
769 | |
770 | bool ips_enabled; | |
6e644626 | 771 | bool ips_force_disable; |
cf532bb2 | 772 | |
f51be2e0 PZ |
773 | bool enable_fbc; |
774 | ||
cf532bb2 | 775 | bool double_wide; |
0e32b39c | 776 | |
0e32b39c | 777 | int pbn; |
be41e336 CK |
778 | |
779 | struct intel_crtc_scaler_state scaler_state; | |
99d736a2 ML |
780 | |
781 | /* w/a for waiting 2 vblanks during crtc enable */ | |
782 | enum pipe hsw_workaround_pipe; | |
d21fbe87 MR |
783 | |
784 | /* IVB sprite scaling w/a (WaCxSRDisabledForSpriteScaling:ivb) */ | |
785 | bool disable_lp_wm; | |
4e0963c7 | 786 | |
e8f1f02e | 787 | struct intel_crtc_wm_state wm; |
05dc698c LL |
788 | |
789 | /* Gamma mode programmed on the pipe */ | |
790 | uint32_t gamma_mode; | |
e9728bd8 VS |
791 | |
792 | /* bitmask of visible planes (enum plane_id) */ | |
793 | u8 active_planes; | |
15953637 SS |
794 | |
795 | /* HDMI scrambling status */ | |
796 | bool hdmi_scrambling; | |
797 | ||
798 | /* HDMI High TMDS char rate ratio */ | |
799 | bool hdmi_high_tmds_clock_ratio; | |
60436fd4 SS |
800 | |
801 | /* output format is YCBCR 4:2:0 */ | |
802 | bool ycbcr420; | |
b8cecdf5 SV |
803 | }; |
804 | ||
79e53945 JB |
805 | struct intel_crtc { |
806 | struct drm_crtc base; | |
80824003 | 807 | enum pipe pipe; |
08a48469 SV |
808 | /* |
809 | * Whether the crtc and the connected output pipeline is active. Implies | |
810 | * that crtc->enabled is set, i.e. the current mode configuration has | |
811 | * some outputs connected to this crtc. | |
08a48469 SV |
812 | */ |
813 | bool active; | |
d97d7b48 | 814 | u8 plane_ids_mask; |
d8fc70b7 | 815 | unsigned long long enabled_power_domains; |
02e792fb | 816 | struct intel_overlay *overlay; |
cda4b7d3 | 817 | |
6e3c9717 | 818 | struct intel_crtc_state *config; |
b8cecdf5 | 819 | |
8af29b0c CW |
820 | /* global reset count when the last flip was submitted */ |
821 | unsigned int reset_count; | |
5a21b665 | 822 | |
8664281b PZ |
823 | /* Access to these should be protected by dev_priv->irq_lock. */ |
824 | bool cpu_fifo_underrun_disabled; | |
825 | bool pch_fifo_underrun_disabled; | |
0b2ae6d7 VS |
826 | |
827 | /* per-pipe watermark state */ | |
828 | struct { | |
829 | /* watermarks currently being used */ | |
4e0963c7 MR |
830 | union { |
831 | struct intel_pipe_wm ilk; | |
7eb4941f | 832 | struct vlv_wm_state vlv; |
04548cba | 833 | struct g4x_wm_state g4x; |
4e0963c7 | 834 | } active; |
0b2ae6d7 | 835 | } wm; |
8d7849db | 836 | |
80715b2f | 837 | int scanline_offset; |
32b7eeec | 838 | |
eb120ef6 JB |
839 | struct { |
840 | unsigned start_vbl_count; | |
841 | ktime_t start_vbl_time; | |
842 | int min_vbl, max_vbl; | |
843 | int scanline_start; | |
844 | } debug; | |
85a62bf9 | 845 | |
be41e336 CK |
846 | /* scalers available on this crtc */ |
847 | int num_scalers; | |
79e53945 JB |
848 | }; |
849 | ||
b840d907 JB |
850 | struct intel_plane { |
851 | struct drm_plane base; | |
ed15030d | 852 | enum i9xx_plane_id i9xx_plane; |
b14e5848 | 853 | enum plane_id id; |
b840d907 | 854 | enum pipe pipe; |
2d354c34 | 855 | bool can_scale; |
b840d907 | 856 | int max_downscale; |
a9ff8714 | 857 | uint32_t frontbuffer_bit; |
526682e9 | 858 | |
cd5dcbf1 VS |
859 | struct { |
860 | u32 base, cntl, size; | |
861 | } cursor; | |
862 | ||
8e7d688b MR |
863 | /* |
864 | * NOTE: Do not place new plane state fields here (e.g., when adding | |
865 | * new plane properties). New runtime state should now be placed in | |
2fde1391 | 866 | * the intel_plane_state structure and accessed via plane_state. |
8e7d688b MR |
867 | */ |
868 | ||
282dbf9b | 869 | void (*update_plane)(struct intel_plane *plane, |
2fde1391 ML |
870 | const struct intel_crtc_state *crtc_state, |
871 | const struct intel_plane_state *plane_state); | |
282dbf9b VS |
872 | void (*disable_plane)(struct intel_plane *plane, |
873 | struct intel_crtc *crtc); | |
51f5a096 | 874 | bool (*get_hw_state)(struct intel_plane *plane); |
282dbf9b | 875 | int (*check_plane)(struct intel_plane *plane, |
061e4b8d | 876 | struct intel_crtc_state *crtc_state, |
c59cb179 | 877 | struct intel_plane_state *state); |
b840d907 JB |
878 | }; |
879 | ||
b445e3b0 | 880 | struct intel_watermark_params { |
ae9400ca TU |
881 | u16 fifo_size; |
882 | u16 max_wm; | |
883 | u8 default_wm; | |
884 | u8 guard_size; | |
885 | u8 cacheline_size; | |
b445e3b0 ED |
886 | }; |
887 | ||
888 | struct cxsr_latency { | |
c13fb778 TU |
889 | bool is_desktop : 1; |
890 | bool is_ddr3 : 1; | |
44a655ca TU |
891 | u16 fsb_freq; |
892 | u16 mem_freq; | |
893 | u16 display_sr; | |
894 | u16 display_hpll_disable; | |
895 | u16 cursor_sr; | |
896 | u16 cursor_hpll_disable; | |
b445e3b0 ED |
897 | }; |
898 | ||
de419ab6 | 899 | #define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base) |
79e53945 | 900 | #define to_intel_crtc(x) container_of(x, struct intel_crtc, base) |
10f81c19 | 901 | #define to_intel_crtc_state(x) container_of(x, struct intel_crtc_state, base) |
5daa55eb | 902 | #define to_intel_connector(x) container_of(x, struct intel_connector, base) |
4ef69c7a | 903 | #define to_intel_encoder(x) container_of(x, struct intel_encoder, base) |
79e53945 | 904 | #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) |
b840d907 | 905 | #define to_intel_plane(x) container_of(x, struct intel_plane, base) |
ea2c67bb | 906 | #define to_intel_plane_state(x) container_of(x, struct intel_plane_state, base) |
155e6369 | 907 | #define intel_fb_obj(x) (x ? to_intel_framebuffer(x)->obj : NULL) |
79e53945 | 908 | |
f5bbfca3 | 909 | struct intel_hdmi { |
f0f59a00 | 910 | i915_reg_t hdmi_reg; |
f5bbfca3 | 911 | int ddc_bus; |
b1ba124d VS |
912 | struct { |
913 | enum drm_dp_dual_mode_type type; | |
914 | int max_tmds_clock; | |
915 | } dp_dual_mode; | |
f5bbfca3 ED |
916 | bool has_hdmi_sink; |
917 | bool has_audio; | |
abedc077 | 918 | bool rgb_quant_range_selectable; |
d8b4c43a | 919 | struct intel_connector *attached_connector; |
f5bbfca3 ED |
920 | }; |
921 | ||
0e32b39c | 922 | struct intel_dp_mst_encoder; |
b091cd92 | 923 | #define DP_MAX_DOWNSTREAM_PORTS 0x10 |
54d63ca6 | 924 | |
fe3cd48d R |
925 | /* |
926 | * enum link_m_n_set: | |
927 | * When platform provides two set of M_N registers for dp, we can | |
928 | * program them and switch between them incase of DRRS. | |
929 | * But When only one such register is provided, we have to program the | |
930 | * required divider value on that registers itself based on the DRRS state. | |
931 | * | |
932 | * M1_N1 : Program dp_m_n on M1_N1 registers | |
933 | * dp_m2_n2 on M2_N2 registers (If supported) | |
934 | * | |
935 | * M2_N2 : Program dp_m2_n2 on M1_N1 registers | |
936 | * M2_N2 registers are not supported | |
937 | */ | |
938 | ||
939 | enum link_m_n_set { | |
940 | /* Sets the m1_n1 and m2_n2 */ | |
941 | M1_N1 = 0, | |
942 | M2_N2 | |
943 | }; | |
944 | ||
c1617abc MN |
945 | struct intel_dp_compliance_data { |
946 | unsigned long edid; | |
611032bf MN |
947 | uint8_t video_pattern; |
948 | uint16_t hdisplay, vdisplay; | |
949 | uint8_t bpc; | |
c1617abc MN |
950 | }; |
951 | ||
952 | struct intel_dp_compliance { | |
953 | unsigned long test_type; | |
954 | struct intel_dp_compliance_data test_data; | |
955 | bool test_active; | |
da15f7cb MN |
956 | int test_link_rate; |
957 | u8 test_lane_count; | |
c1617abc MN |
958 | }; |
959 | ||
54d63ca6 | 960 | struct intel_dp { |
f0f59a00 VS |
961 | i915_reg_t output_reg; |
962 | i915_reg_t aux_ch_ctl_reg; | |
963 | i915_reg_t aux_ch_data_reg[5]; | |
54d63ca6 | 964 | uint32_t DP; |
901c2daf VS |
965 | int link_rate; |
966 | uint8_t lane_count; | |
30d9aa42 | 967 | uint8_t sink_count; |
64ee2fd2 | 968 | bool link_mst; |
54d63ca6 | 969 | bool has_audio; |
7d23e3c3 | 970 | bool detect_done; |
c92bd2fa | 971 | bool channel_eq_status; |
d7e8ef02 | 972 | bool reset_link_params; |
54d63ca6 | 973 | uint8_t dpcd[DP_RECEIVER_CAP_SIZE]; |
2293bb5c | 974 | uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE]; |
b091cd92 | 975 | uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS]; |
86ee27b5 | 976 | uint8_t edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE]; |
55cfc580 JN |
977 | /* source rates */ |
978 | int num_source_rates; | |
979 | const int *source_rates; | |
68f357cb JN |
980 | /* sink rates as reported by DP_MAX_LINK_RATE/DP_SUPPORTED_LINK_RATES */ |
981 | int num_sink_rates; | |
94ca719e | 982 | int sink_rates[DP_MAX_SUPPORTED_RATES]; |
68f357cb | 983 | bool use_rate_select; |
975ee5fc JN |
984 | /* intersection of source and sink rates */ |
985 | int num_common_rates; | |
986 | int common_rates[DP_MAX_SUPPORTED_RATES]; | |
e6c0c64a JN |
987 | /* Max lane count for the current link */ |
988 | int max_link_lane_count; | |
989 | /* Max rate for the current link */ | |
990 | int max_link_rate; | |
7b3fc170 | 991 | /* sink or branch descriptor */ |
84c36753 | 992 | struct drm_dp_desc desc; |
9d1a1031 | 993 | struct drm_dp_aux aux; |
5432fcaf | 994 | enum intel_display_power_domain aux_power_domain; |
54d63ca6 SK |
995 | uint8_t train_set[4]; |
996 | int panel_power_up_delay; | |
997 | int panel_power_down_delay; | |
998 | int panel_power_cycle_delay; | |
999 | int backlight_on_delay; | |
1000 | int backlight_off_delay; | |
54d63ca6 SK |
1001 | struct delayed_work panel_vdd_work; |
1002 | bool want_panel_vdd; | |
dce56b3c PZ |
1003 | unsigned long last_power_on; |
1004 | unsigned long last_backlight_off; | |
d28d4731 | 1005 | ktime_t panel_power_off_time; |
5d42f82a | 1006 | |
01527b31 CT |
1007 | struct notifier_block edp_notifier; |
1008 | ||
a4a5d2f8 VS |
1009 | /* |
1010 | * Pipe whose power sequencer is currently locked into | |
1011 | * this port. Only relevant on VLV/CHV. | |
1012 | */ | |
1013 | enum pipe pps_pipe; | |
9f2bdb00 VS |
1014 | /* |
1015 | * Pipe currently driving the port. Used for preventing | |
1016 | * the use of the PPS for any pipe currentrly driving | |
1017 | * external DP as that will mess things up on VLV. | |
1018 | */ | |
1019 | enum pipe active_pipe; | |
78597996 ID |
1020 | /* |
1021 | * Set if the sequencer may be reset due to a power transition, | |
1022 | * requiring a reinitialization. Only relevant on BXT. | |
1023 | */ | |
1024 | bool pps_reset; | |
36b5f425 | 1025 | struct edp_power_seq pps_delays; |
a4a5d2f8 | 1026 | |
0e32b39c DA |
1027 | bool can_mst; /* this port supports mst */ |
1028 | bool is_mst; | |
19e0b4ca | 1029 | int active_mst_links; |
0e32b39c | 1030 | /* connector directly attached - won't be use for modeset in mst world */ |
dd06f90e | 1031 | struct intel_connector *attached_connector; |
ec5b01dd | 1032 | |
0e32b39c DA |
1033 | /* mst connector list */ |
1034 | struct intel_dp_mst_encoder *mst_encoders[I915_MAX_PIPES]; | |
1035 | struct drm_dp_mst_topology_mgr mst_mgr; | |
1036 | ||
ec5b01dd | 1037 | uint32_t (*get_aux_clock_divider)(struct intel_dp *dp, int index); |
153b1100 DL |
1038 | /* |
1039 | * This function returns the value we have to program the AUX_CTL | |
1040 | * register with to kick off an AUX transaction. | |
1041 | */ | |
1042 | uint32_t (*get_aux_send_ctl)(struct intel_dp *dp, | |
1043 | bool has_aux_irq, | |
1044 | int send_bytes, | |
1045 | uint32_t aux_clock_divider); | |
ad64217b ACO |
1046 | |
1047 | /* This is called before a link training is starterd */ | |
1048 | void (*prepare_link_retrain)(struct intel_dp *intel_dp); | |
1049 | ||
c5d5ab7a | 1050 | /* Displayport compliance testing */ |
c1617abc | 1051 | struct intel_dp_compliance compliance; |
54d63ca6 SK |
1052 | }; |
1053 | ||
dbe9e61b SS |
1054 | struct intel_lspcon { |
1055 | bool active; | |
1056 | enum drm_lspcon_mode mode; | |
dbe9e61b SS |
1057 | }; |
1058 | ||
da63a9f2 PZ |
1059 | struct intel_digital_port { |
1060 | struct intel_encoder base; | |
bcf53de4 | 1061 | u32 saved_port_bits; |
da63a9f2 PZ |
1062 | struct intel_dp dp; |
1063 | struct intel_hdmi hdmi; | |
dbe9e61b | 1064 | struct intel_lspcon lspcon; |
b2c5c181 | 1065 | enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool); |
b0b33846 | 1066 | bool release_cl2_override; |
ccb1a831 | 1067 | uint8_t max_lanes; |
62b69566 | 1068 | enum intel_display_power_domain ddi_io_power_domain; |
f99be1b3 VS |
1069 | |
1070 | void (*write_infoframe)(struct drm_encoder *encoder, | |
1071 | const struct intel_crtc_state *crtc_state, | |
1d776538 | 1072 | unsigned int type, |
f99be1b3 VS |
1073 | const void *frame, ssize_t len); |
1074 | void (*set_infoframes)(struct drm_encoder *encoder, | |
1075 | bool enable, | |
1076 | const struct intel_crtc_state *crtc_state, | |
1077 | const struct drm_connector_state *conn_state); | |
1078 | bool (*infoframe_enabled)(struct drm_encoder *encoder, | |
1079 | const struct intel_crtc_state *pipe_config); | |
da63a9f2 PZ |
1080 | }; |
1081 | ||
0e32b39c DA |
1082 | struct intel_dp_mst_encoder { |
1083 | struct intel_encoder base; | |
1084 | enum pipe pipe; | |
1085 | struct intel_digital_port *primary; | |
0552f765 | 1086 | struct intel_connector *connector; |
0e32b39c DA |
1087 | }; |
1088 | ||
65d64cc5 | 1089 | static inline enum dpio_channel |
89b667f8 JB |
1090 | vlv_dport_to_channel(struct intel_digital_port *dport) |
1091 | { | |
8f4f2797 | 1092 | switch (dport->base.port) { |
89b667f8 | 1093 | case PORT_B: |
00fc31b7 | 1094 | case PORT_D: |
e4607fcf | 1095 | return DPIO_CH0; |
89b667f8 | 1096 | case PORT_C: |
e4607fcf | 1097 | return DPIO_CH1; |
89b667f8 JB |
1098 | default: |
1099 | BUG(); | |
1100 | } | |
1101 | } | |
1102 | ||
65d64cc5 VS |
1103 | static inline enum dpio_phy |
1104 | vlv_dport_to_phy(struct intel_digital_port *dport) | |
1105 | { | |
8f4f2797 | 1106 | switch (dport->base.port) { |
65d64cc5 VS |
1107 | case PORT_B: |
1108 | case PORT_C: | |
1109 | return DPIO_PHY0; | |
1110 | case PORT_D: | |
1111 | return DPIO_PHY1; | |
1112 | default: | |
1113 | BUG(); | |
1114 | } | |
1115 | } | |
1116 | ||
1117 | static inline enum dpio_channel | |
eb69b0e5 CML |
1118 | vlv_pipe_to_channel(enum pipe pipe) |
1119 | { | |
1120 | switch (pipe) { | |
1121 | case PIPE_A: | |
1122 | case PIPE_C: | |
1123 | return DPIO_CH0; | |
1124 | case PIPE_B: | |
1125 | return DPIO_CH1; | |
1126 | default: | |
1127 | BUG(); | |
1128 | } | |
1129 | } | |
1130 | ||
e2af48c6 | 1131 | static inline struct intel_crtc * |
b91eb5cc | 1132 | intel_get_crtc_for_pipe(struct drm_i915_private *dev_priv, enum pipe pipe) |
f875c15a | 1133 | { |
f875c15a CW |
1134 | return dev_priv->pipe_to_crtc_mapping[pipe]; |
1135 | } | |
1136 | ||
e2af48c6 | 1137 | static inline struct intel_crtc * |
ed15030d | 1138 | intel_get_crtc_for_plane(struct drm_i915_private *dev_priv, enum i9xx_plane_id plane) |
417ae147 | 1139 | { |
417ae147 CW |
1140 | return dev_priv->plane_to_crtc_mapping[plane]; |
1141 | } | |
1142 | ||
5f1aae65 | 1143 | struct intel_load_detect_pipe { |
edde3617 | 1144 | struct drm_atomic_state *restore_state; |
5f1aae65 | 1145 | }; |
79e53945 | 1146 | |
5f1aae65 PZ |
1147 | static inline struct intel_encoder * |
1148 | intel_attached_encoder(struct drm_connector *connector) | |
df0e9248 CW |
1149 | { |
1150 | return to_intel_connector(connector)->encoder; | |
1151 | } | |
1152 | ||
da63a9f2 PZ |
1153 | static inline struct intel_digital_port * |
1154 | enc_to_dig_port(struct drm_encoder *encoder) | |
1155 | { | |
9a5da00b ACO |
1156 | struct intel_encoder *intel_encoder = to_intel_encoder(encoder); |
1157 | ||
1158 | switch (intel_encoder->type) { | |
7e732cac | 1159 | case INTEL_OUTPUT_DDI: |
9a5da00b ACO |
1160 | WARN_ON(!HAS_DDI(to_i915(encoder->dev))); |
1161 | case INTEL_OUTPUT_DP: | |
1162 | case INTEL_OUTPUT_EDP: | |
1163 | case INTEL_OUTPUT_HDMI: | |
1164 | return container_of(encoder, struct intel_digital_port, | |
1165 | base.base); | |
1166 | default: | |
1167 | return NULL; | |
1168 | } | |
9ff8c9ba ID |
1169 | } |
1170 | ||
0e32b39c DA |
1171 | static inline struct intel_dp_mst_encoder * |
1172 | enc_to_mst(struct drm_encoder *encoder) | |
1173 | { | |
1174 | return container_of(encoder, struct intel_dp_mst_encoder, base.base); | |
1175 | } | |
1176 | ||
9ff8c9ba ID |
1177 | static inline struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder) |
1178 | { | |
1179 | return &enc_to_dig_port(encoder)->dp; | |
da63a9f2 PZ |
1180 | } |
1181 | ||
1182 | static inline struct intel_digital_port * | |
1183 | dp_to_dig_port(struct intel_dp *intel_dp) | |
1184 | { | |
1185 | return container_of(intel_dp, struct intel_digital_port, dp); | |
1186 | } | |
1187 | ||
dd75f6dd ID |
1188 | static inline struct intel_lspcon * |
1189 | dp_to_lspcon(struct intel_dp *intel_dp) | |
1190 | { | |
1191 | return &dp_to_dig_port(intel_dp)->lspcon; | |
1192 | } | |
1193 | ||
da63a9f2 PZ |
1194 | static inline struct intel_digital_port * |
1195 | hdmi_to_dig_port(struct intel_hdmi *intel_hdmi) | |
1196 | { | |
1197 | return container_of(intel_hdmi, struct intel_digital_port, hdmi); | |
7739c33b PZ |
1198 | } |
1199 | ||
b2b55502 VS |
1200 | static inline struct intel_plane_state * |
1201 | intel_atomic_get_new_plane_state(struct intel_atomic_state *state, | |
1202 | struct intel_plane *plane) | |
1203 | { | |
1204 | return to_intel_plane_state(drm_atomic_get_new_plane_state(&state->base, | |
1205 | &plane->base)); | |
1206 | } | |
1207 | ||
7b510451 VS |
1208 | static inline struct intel_crtc_state * |
1209 | intel_atomic_get_old_crtc_state(struct intel_atomic_state *state, | |
1210 | struct intel_crtc *crtc) | |
1211 | { | |
1212 | return to_intel_crtc_state(drm_atomic_get_old_crtc_state(&state->base, | |
1213 | &crtc->base)); | |
1214 | } | |
1215 | ||
d3a8fb32 VS |
1216 | static inline struct intel_crtc_state * |
1217 | intel_atomic_get_new_crtc_state(struct intel_atomic_state *state, | |
1218 | struct intel_crtc *crtc) | |
1219 | { | |
1220 | return to_intel_crtc_state(drm_atomic_get_new_crtc_state(&state->base, | |
1221 | &crtc->base)); | |
1222 | } | |
1223 | ||
47339cd9 | 1224 | /* intel_fifo_underrun.c */ |
a72e4c9f | 1225 | bool intel_set_cpu_fifo_underrun_reporting(struct drm_i915_private *dev_priv, |
87440425 | 1226 | enum pipe pipe, bool enable); |
a72e4c9f | 1227 | bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv, |
a2196033 | 1228 | enum pipe pch_transcoder, |
87440425 | 1229 | bool enable); |
1f7247c0 SV |
1230 | void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, |
1231 | enum pipe pipe); | |
1232 | void intel_pch_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, | |
a2196033 | 1233 | enum pipe pch_transcoder); |
aca7b684 VS |
1234 | void intel_check_cpu_fifo_underruns(struct drm_i915_private *dev_priv); |
1235 | void intel_check_pch_fifo_underruns(struct drm_i915_private *dev_priv); | |
47339cd9 SV |
1236 | |
1237 | /* i915_irq.c */ | |
480c8033 SV |
1238 | void gen5_enable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask); |
1239 | void gen5_disable_gt_irq(struct drm_i915_private *dev_priv, uint32_t mask); | |
f4e9af4f AG |
1240 | void gen6_mask_pm_irq(struct drm_i915_private *dev_priv, u32 mask); |
1241 | void gen6_unmask_pm_irq(struct drm_i915_private *dev_priv, u32 mask); | |
dc97997a | 1242 | void gen6_reset_rps_interrupts(struct drm_i915_private *dev_priv); |
91d14251 TU |
1243 | void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv); |
1244 | void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv); | |
1300b4f8 CW |
1245 | |
1246 | static inline u32 gen6_sanitize_rps_pm_mask(const struct drm_i915_private *i915, | |
1247 | u32 mask) | |
1248 | { | |
562d9bae | 1249 | return mask & ~i915->gt_pm.rps.pm_intrmsk_mbz; |
1300b4f8 CW |
1250 | } |
1251 | ||
b963291c SV |
1252 | void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv); |
1253 | void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv); | |
9df7575f JB |
1254 | static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv) |
1255 | { | |
1256 | /* | |
1257 | * We only use drm_irq_uninstall() at unload and VT switch, so | |
1258 | * this is the only thing we need to check. | |
1259 | */ | |
ad1443f0 | 1260 | return dev_priv->runtime_pm.irqs_enabled; |
9df7575f JB |
1261 | } |
1262 | ||
a225f079 | 1263 | int intel_get_crtc_scanline(struct intel_crtc *crtc); |
4c6c03be | 1264 | void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv, |
001bd2cb | 1265 | u8 pipe_mask); |
aae8ba84 | 1266 | void gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv, |
001bd2cb | 1267 | u8 pipe_mask); |
26705e20 SAK |
1268 | void gen9_reset_guc_interrupts(struct drm_i915_private *dev_priv); |
1269 | void gen9_enable_guc_interrupts(struct drm_i915_private *dev_priv); | |
1270 | void gen9_disable_guc_interrupts(struct drm_i915_private *dev_priv); | |
5f1aae65 | 1271 | |
5f1aae65 | 1272 | /* intel_crt.c */ |
c39055b0 | 1273 | void intel_crt_init(struct drm_i915_private *dev_priv); |
9504a892 | 1274 | void intel_crt_reset(struct drm_encoder *encoder); |
5f1aae65 PZ |
1275 | |
1276 | /* intel_ddi.c */ | |
b7076546 | 1277 | void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder, |
5f88a9c6 VS |
1278 | const struct intel_crtc_state *old_crtc_state, |
1279 | const struct drm_connector_state *old_conn_state); | |
dc4a1094 ACO |
1280 | void hsw_fdi_link_train(struct intel_crtc *crtc, |
1281 | const struct intel_crtc_state *crtc_state); | |
c39055b0 | 1282 | void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port); |
87440425 | 1283 | bool intel_ddi_get_hw_state(struct intel_encoder *encoder, enum pipe *pipe); |
3dc38eea | 1284 | void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state); |
87440425 PZ |
1285 | void intel_ddi_disable_transcoder_func(struct drm_i915_private *dev_priv, |
1286 | enum transcoder cpu_transcoder); | |
3dc38eea ACO |
1287 | void intel_ddi_enable_pipe_clock(const struct intel_crtc_state *crtc_state); |
1288 | void intel_ddi_disable_pipe_clock(const struct intel_crtc_state *crtc_state); | |
44a126ba PZ |
1289 | struct intel_encoder * |
1290 | intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state); | |
3dc38eea | 1291 | void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state); |
ad64217b | 1292 | void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp); |
87440425 | 1293 | bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector); |
87440425 | 1294 | void intel_ddi_get_config(struct intel_encoder *encoder, |
5cec258b | 1295 | struct intel_crtc_state *pipe_config); |
5f1aae65 | 1296 | |
3dc38eea ACO |
1297 | void intel_ddi_set_vc_payload_alloc(const struct intel_crtc_state *crtc_state, |
1298 | bool state); | |
53e9bf5e VS |
1299 | void intel_ddi_compute_min_voltage_level(struct drm_i915_private *dev_priv, |
1300 | struct intel_crtc_state *crtc_state); | |
d509af6c | 1301 | u32 bxt_signal_levels(struct intel_dp *intel_dp); |
f8896f5d | 1302 | uint32_t ddi_signal_levels(struct intel_dp *intel_dp); |
ffe5111e VS |
1303 | u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder); |
1304 | ||
d88c4afd VS |
1305 | unsigned int intel_fb_align_height(const struct drm_framebuffer *fb, |
1306 | int plane, unsigned int height); | |
b680c37a | 1307 | |
7c10a2b5 | 1308 | /* intel_audio.c */ |
88212941 | 1309 | void intel_init_audio_hooks(struct drm_i915_private *dev_priv); |
bbf35e9d ML |
1310 | void intel_audio_codec_enable(struct intel_encoder *encoder, |
1311 | const struct intel_crtc_state *crtc_state, | |
1312 | const struct drm_connector_state *conn_state); | |
8ec47de2 VS |
1313 | void intel_audio_codec_disable(struct intel_encoder *encoder, |
1314 | const struct intel_crtc_state *old_crtc_state, | |
1315 | const struct drm_connector_state *old_conn_state); | |
58fddc28 ID |
1316 | void i915_audio_component_init(struct drm_i915_private *dev_priv); |
1317 | void i915_audio_component_cleanup(struct drm_i915_private *dev_priv); | |
eef57324 JA |
1318 | void intel_audio_init(struct drm_i915_private *dev_priv); |
1319 | void intel_audio_deinit(struct drm_i915_private *dev_priv); | |
7c10a2b5 | 1320 | |
7ff89ca2 | 1321 | /* intel_cdclk.c */ |
d305e061 | 1322 | int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state); |
e1cd3325 PZ |
1323 | void skl_init_cdclk(struct drm_i915_private *dev_priv); |
1324 | void skl_uninit_cdclk(struct drm_i915_private *dev_priv); | |
d8d4a512 VS |
1325 | void cnl_init_cdclk(struct drm_i915_private *dev_priv); |
1326 | void cnl_uninit_cdclk(struct drm_i915_private *dev_priv); | |
e1cd3325 PZ |
1327 | void bxt_init_cdclk(struct drm_i915_private *dev_priv); |
1328 | void bxt_uninit_cdclk(struct drm_i915_private *dev_priv); | |
186a277e PZ |
1329 | void icl_init_cdclk(struct drm_i915_private *dev_priv); |
1330 | void icl_uninit_cdclk(struct drm_i915_private *dev_priv); | |
7ff89ca2 VS |
1331 | void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv); |
1332 | void intel_update_max_cdclk(struct drm_i915_private *dev_priv); | |
1333 | void intel_update_cdclk(struct drm_i915_private *dev_priv); | |
1334 | void intel_update_rawclk(struct drm_i915_private *dev_priv); | |
64600bd5 | 1335 | bool intel_cdclk_needs_modeset(const struct intel_cdclk_state *a, |
49cd97a3 | 1336 | const struct intel_cdclk_state *b); |
64600bd5 VS |
1337 | bool intel_cdclk_changed(const struct intel_cdclk_state *a, |
1338 | const struct intel_cdclk_state *b); | |
b0587e4d VS |
1339 | void intel_set_cdclk(struct drm_i915_private *dev_priv, |
1340 | const struct intel_cdclk_state *cdclk_state); | |
cfddadc9 VS |
1341 | void intel_dump_cdclk_state(const struct intel_cdclk_state *cdclk_state, |
1342 | const char *context); | |
7ff89ca2 | 1343 | |
b680c37a | 1344 | /* intel_display.c */ |
2ee0da16 VS |
1345 | void i830_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe); |
1346 | void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe); | |
a2196033 | 1347 | enum pipe intel_crtc_pch_transcoder(struct intel_crtc *crtc); |
19ab4ed3 | 1348 | void intel_update_rawclk(struct drm_i915_private *dev_priv); |
49cd97a3 | 1349 | int vlv_get_hpll_vco(struct drm_i915_private *dev_priv); |
c30fec65 VS |
1350 | int vlv_get_cck_clock(struct drm_i915_private *dev_priv, |
1351 | const char *name, u32 reg, int ref_freq); | |
7ff89ca2 VS |
1352 | int vlv_get_cck_clock_hpll(struct drm_i915_private *dev_priv, |
1353 | const char *name, u32 reg); | |
b7076546 ML |
1354 | void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv); |
1355 | void lpt_disable_iclkip(struct drm_i915_private *dev_priv); | |
88212941 | 1356 | void intel_init_display_hooks(struct drm_i915_private *dev_priv); |
6687c906 | 1357 | unsigned int intel_fb_xy_to_linear(int x, int y, |
2949056c VS |
1358 | const struct intel_plane_state *state, |
1359 | int plane); | |
6687c906 | 1360 | void intel_add_fb_offsets(int *x, int *y, |
2949056c | 1361 | const struct intel_plane_state *state, int plane); |
1663b9d6 | 1362 | unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info); |
49d73912 | 1363 | bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv); |
7d993739 TU |
1364 | void intel_mark_busy(struct drm_i915_private *dev_priv); |
1365 | void intel_mark_idle(struct drm_i915_private *dev_priv); | |
70e0bd74 | 1366 | int intel_display_suspend(struct drm_device *dev); |
8090ba8c | 1367 | void intel_pps_unlock_regs_wa(struct drm_i915_private *dev_priv); |
87440425 | 1368 | void intel_encoder_destroy(struct drm_encoder *encoder); |
08d9bc92 ACO |
1369 | int intel_connector_init(struct intel_connector *); |
1370 | struct intel_connector *intel_connector_alloc(void); | |
091a4f91 | 1371 | void intel_connector_free(struct intel_connector *connector); |
87440425 | 1372 | bool intel_connector_get_hw_state(struct intel_connector *connector); |
87440425 PZ |
1373 | void intel_connector_attach_encoder(struct intel_connector *connector, |
1374 | struct intel_encoder *encoder); | |
de330815 VS |
1375 | struct drm_display_mode * |
1376 | intel_encoder_current_mode(struct intel_encoder *encoder); | |
1377 | ||
752aa88a | 1378 | enum pipe intel_get_pipe_from_connector(struct intel_connector *connector); |
6a20fe7b VS |
1379 | int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data, |
1380 | struct drm_file *file_priv); | |
87440425 PZ |
1381 | enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv, |
1382 | enum pipe pipe); | |
2d84d2b3 VS |
1383 | static inline bool |
1384 | intel_crtc_has_type(const struct intel_crtc_state *crtc_state, | |
1385 | enum intel_output_type type) | |
1386 | { | |
1387 | return crtc_state->output_types & (1 << type); | |
1388 | } | |
37a5650b VS |
1389 | static inline bool |
1390 | intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state) | |
1391 | { | |
1392 | return crtc_state->output_types & | |
cca0502b | 1393 | ((1 << INTEL_OUTPUT_DP) | |
37a5650b VS |
1394 | (1 << INTEL_OUTPUT_DP_MST) | |
1395 | (1 << INTEL_OUTPUT_EDP)); | |
1396 | } | |
4f905cf9 | 1397 | static inline void |
0f0f74bc | 1398 | intel_wait_for_vblank(struct drm_i915_private *dev_priv, enum pipe pipe) |
4f905cf9 | 1399 | { |
0f0f74bc | 1400 | drm_wait_one_vblank(&dev_priv->drm, pipe); |
4f905cf9 | 1401 | } |
0c241d5b | 1402 | static inline void |
0f0f74bc | 1403 | intel_wait_for_vblank_if_active(struct drm_i915_private *dev_priv, int pipe) |
0c241d5b | 1404 | { |
b91eb5cc | 1405 | const struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe); |
0c241d5b VS |
1406 | |
1407 | if (crtc->active) | |
0f0f74bc | 1408 | intel_wait_for_vblank(dev_priv, pipe); |
0c241d5b | 1409 | } |
a2991414 ML |
1410 | |
1411 | u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc); | |
1412 | ||
87440425 | 1413 | int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp); |
e4607fcf | 1414 | void vlv_wait_port_ready(struct drm_i915_private *dev_priv, |
9b6de0a1 VS |
1415 | struct intel_digital_port *dport, |
1416 | unsigned int expected_mask); | |
6c5ed5ae | 1417 | int intel_get_load_detect_pipe(struct drm_connector *connector, |
bacdcd55 | 1418 | const struct drm_display_mode *mode, |
6c5ed5ae ML |
1419 | struct intel_load_detect_pipe *old, |
1420 | struct drm_modeset_acquire_ctx *ctx); | |
87440425 | 1421 | void intel_release_load_detect_pipe(struct drm_connector *connector, |
49172fee ACO |
1422 | struct intel_load_detect_pipe *old, |
1423 | struct drm_modeset_acquire_ctx *ctx); | |
058d88c4 | 1424 | struct i915_vma * |
5935485f CW |
1425 | intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, |
1426 | unsigned int rotation, | |
1427 | unsigned long *out_flags); | |
1428 | void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags); | |
a8bb6818 | 1429 | struct drm_framebuffer * |
24dbf51a CW |
1430 | intel_framebuffer_create(struct drm_i915_gem_object *obj, |
1431 | struct drm_mode_fb_cmd2 *mode_cmd); | |
6beb8c23 | 1432 | int intel_prepare_plane_fb(struct drm_plane *plane, |
1832040d | 1433 | struct drm_plane_state *new_state); |
38f3ce3a | 1434 | void intel_cleanup_plane_fb(struct drm_plane *plane, |
1832040d | 1435 | struct drm_plane_state *old_state); |
a98b3431 MR |
1436 | int intel_plane_atomic_get_property(struct drm_plane *plane, |
1437 | const struct drm_plane_state *state, | |
1438 | struct drm_property *property, | |
1439 | uint64_t *val); | |
1440 | int intel_plane_atomic_set_property(struct drm_plane *plane, | |
1441 | struct drm_plane_state *state, | |
1442 | struct drm_property *property, | |
1443 | uint64_t val); | |
b2b55502 VS |
1444 | int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_state, |
1445 | struct drm_crtc_state *crtc_state, | |
1446 | const struct intel_plane_state *old_plane_state, | |
da20eabd | 1447 | struct drm_plane_state *plane_state); |
716c2e55 | 1448 | |
7abd4b35 ACO |
1449 | void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv, |
1450 | enum pipe pipe); | |
1451 | ||
30ad9814 | 1452 | int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe, |
3f36b937 | 1453 | const struct dpll *dpll); |
30ad9814 | 1454 | void vlv_force_pll_off(struct drm_i915_private *dev_priv, enum pipe pipe); |
8802e5b6 | 1455 | int lpt_get_iclkip(struct drm_i915_private *dev_priv); |
d288f65f | 1456 | |
716c2e55 | 1457 | /* modesetting asserts */ |
b680c37a SV |
1458 | void assert_panel_unlocked(struct drm_i915_private *dev_priv, |
1459 | enum pipe pipe); | |
55607e8a SV |
1460 | void assert_pll(struct drm_i915_private *dev_priv, |
1461 | enum pipe pipe, bool state); | |
1462 | #define assert_pll_enabled(d, p) assert_pll(d, p, true) | |
1463 | #define assert_pll_disabled(d, p) assert_pll(d, p, false) | |
8563b1e8 LL |
1464 | void assert_dsi_pll(struct drm_i915_private *dev_priv, bool state); |
1465 | #define assert_dsi_pll_enabled(d) assert_dsi_pll(d, true) | |
1466 | #define assert_dsi_pll_disabled(d) assert_dsi_pll(d, false) | |
55607e8a SV |
1467 | void assert_fdi_rx_pll(struct drm_i915_private *dev_priv, |
1468 | enum pipe pipe, bool state); | |
1469 | #define assert_fdi_rx_pll_enabled(d, p) assert_fdi_rx_pll(d, p, true) | |
1470 | #define assert_fdi_rx_pll_disabled(d, p) assert_fdi_rx_pll(d, p, false) | |
87440425 | 1471 | void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state); |
b840d907 JB |
1472 | #define assert_pipe_enabled(d, p) assert_pipe(d, p, true) |
1473 | #define assert_pipe_disabled(d, p) assert_pipe(d, p, false) | |
4f2d9934 | 1474 | u32 intel_compute_tile_offset(int *x, int *y, |
2949056c | 1475 | const struct intel_plane_state *state, int plane); |
c033666a CW |
1476 | void intel_prepare_reset(struct drm_i915_private *dev_priv); |
1477 | void intel_finish_reset(struct drm_i915_private *dev_priv); | |
a14cb6fc PZ |
1478 | void hsw_enable_pc8(struct drm_i915_private *dev_priv); |
1479 | void hsw_disable_pc8(struct drm_i915_private *dev_priv); | |
da2f41d1 | 1480 | void gen9_sanitize_dc_state(struct drm_i915_private *dev_priv); |
664326f8 SK |
1481 | void bxt_enable_dc9(struct drm_i915_private *dev_priv); |
1482 | void bxt_disable_dc9(struct drm_i915_private *dev_priv); | |
f62c79b3 | 1483 | void gen9_enable_dc5(struct drm_i915_private *dev_priv); |
c89e39f3 | 1484 | unsigned int skl_cdclk_get_vco(unsigned int freq); |
0a9d2bed AM |
1485 | void skl_enable_dc6(struct drm_i915_private *dev_priv); |
1486 | void skl_disable_dc6(struct drm_i915_private *dev_priv); | |
87440425 | 1487 | void intel_dp_get_m_n(struct intel_crtc *crtc, |
5cec258b | 1488 | struct intel_crtc_state *pipe_config); |
fe3cd48d | 1489 | void intel_dp_set_m_n(struct intel_crtc *crtc, enum link_m_n_set m_n); |
87440425 | 1490 | int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n); |
5ab7b0b7 | 1491 | bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state, int target_clock, |
9e2c8475 ACO |
1492 | struct dpll *best_clock); |
1493 | int chv_calc_dpll_params(int refclk, struct dpll *pll_clock); | |
dccbea3b | 1494 | |
525b9311 | 1495 | bool intel_crtc_active(struct intel_crtc *crtc); |
24f28450 | 1496 | bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state); |
199ea381 ML |
1497 | void hsw_enable_ips(const struct intel_crtc_state *crtc_state); |
1498 | void hsw_disable_ips(const struct intel_crtc_state *crtc_state); | |
79f255a0 | 1499 | enum intel_display_power_domain intel_port_to_power_domain(enum port port); |
f6a83288 | 1500 | void intel_mode_from_pipe_config(struct drm_display_mode *mode, |
5cec258b | 1501 | struct intel_crtc_state *pipe_config); |
86adf9d7 | 1502 | |
e435d6e5 | 1503 | int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state); |
6156a456 | 1504 | int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state); |
8ea30864 | 1505 | |
be1e3415 CW |
1506 | static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state) |
1507 | { | |
1508 | return i915_ggtt_offset(state->vma); | |
1509 | } | |
dedf278c | 1510 | |
4036c78c JA |
1511 | u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, |
1512 | const struct intel_plane_state *plane_state); | |
2e881264 VS |
1513 | u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, |
1514 | const struct intel_plane_state *plane_state); | |
d2196774 VS |
1515 | u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane, |
1516 | unsigned int rotation); | |
c322c649 ID |
1517 | int skl_check_plane_surface(const struct intel_crtc_state *crtc_state, |
1518 | struct intel_plane_state *plane_state); | |
f9407ae1 | 1519 | int i9xx_check_plane_surface(struct intel_plane_state *plane_state); |
121920fa | 1520 | |
eb805623 | 1521 | /* intel_csr.c */ |
f4448375 | 1522 | void intel_csr_ucode_init(struct drm_i915_private *); |
2abc525b | 1523 | void intel_csr_load_program(struct drm_i915_private *); |
f4448375 | 1524 | void intel_csr_ucode_fini(struct drm_i915_private *); |
f74ed08d ID |
1525 | void intel_csr_ucode_suspend(struct drm_i915_private *); |
1526 | void intel_csr_ucode_resume(struct drm_i915_private *); | |
eb805623 | 1527 | |
5f1aae65 | 1528 | /* intel_dp.c */ |
c39055b0 ACO |
1529 | bool intel_dp_init(struct drm_i915_private *dev_priv, i915_reg_t output_reg, |
1530 | enum port port); | |
87440425 PZ |
1531 | bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port, |
1532 | struct intel_connector *intel_connector); | |
901c2daf | 1533 | void intel_dp_set_link_params(struct intel_dp *intel_dp, |
dfa10480 ACO |
1534 | int link_rate, uint8_t lane_count, |
1535 | bool link_mst); | |
fdb14d33 MN |
1536 | int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp, |
1537 | int link_rate, uint8_t lane_count); | |
87440425 | 1538 | void intel_dp_start_link_train(struct intel_dp *intel_dp); |
87440425 PZ |
1539 | void intel_dp_stop_link_train(struct intel_dp *intel_dp); |
1540 | void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode); | |
bf93ba67 ID |
1541 | void intel_dp_encoder_reset(struct drm_encoder *encoder); |
1542 | void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder); | |
87440425 | 1543 | void intel_dp_encoder_destroy(struct drm_encoder *encoder); |
93313538 ML |
1544 | int intel_dp_sink_crc(struct intel_dp *intel_dp, |
1545 | struct intel_crtc_state *crtc_state, u8 *crc); | |
87440425 | 1546 | bool intel_dp_compute_config(struct intel_encoder *encoder, |
0a478c27 ML |
1547 | struct intel_crtc_state *pipe_config, |
1548 | struct drm_connector_state *conn_state); | |
1853a9da | 1549 | bool intel_dp_is_edp(struct intel_dp *intel_dp); |
7b91bf7f | 1550 | bool intel_dp_is_port_edp(struct drm_i915_private *dev_priv, enum port port); |
b2c5c181 SV |
1551 | enum irqreturn intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, |
1552 | bool long_hpd); | |
b037d58f ML |
1553 | void intel_edp_backlight_on(const struct intel_crtc_state *crtc_state, |
1554 | const struct drm_connector_state *conn_state); | |
1555 | void intel_edp_backlight_off(const struct drm_connector_state *conn_state); | |
24f3e092 | 1556 | void intel_edp_panel_vdd_on(struct intel_dp *intel_dp); |
4be73780 SV |
1557 | void intel_edp_panel_on(struct intel_dp *intel_dp); |
1558 | void intel_edp_panel_off(struct intel_dp *intel_dp); | |
0e32b39c DA |
1559 | void intel_dp_mst_suspend(struct drm_device *dev); |
1560 | void intel_dp_mst_resume(struct drm_device *dev); | |
50fec21a | 1561 | int intel_dp_max_link_rate(struct intel_dp *intel_dp); |
3d65a735 | 1562 | int intel_dp_max_lane_count(struct intel_dp *intel_dp); |
ed4e9c1d | 1563 | int intel_dp_rate_select(struct intel_dp *intel_dp, int rate); |
0e32b39c | 1564 | void intel_dp_hot_plug(struct intel_encoder *intel_encoder); |
78597996 | 1565 | void intel_power_sequencer_reset(struct drm_i915_private *dev_priv); |
0bc12bcb | 1566 | uint32_t intel_dp_pack_aux(const uint8_t *src, int src_bytes); |
4a3b8769 | 1567 | void intel_plane_destroy(struct drm_plane *plane); |
85cb48a1 | 1568 | void intel_edp_drrs_enable(struct intel_dp *intel_dp, |
5f88a9c6 | 1569 | const struct intel_crtc_state *crtc_state); |
85cb48a1 | 1570 | void intel_edp_drrs_disable(struct intel_dp *intel_dp, |
5f88a9c6 | 1571 | const struct intel_crtc_state *crtc_state); |
5748b6a1 CW |
1572 | void intel_edp_drrs_invalidate(struct drm_i915_private *dev_priv, |
1573 | unsigned int frontbuffer_bits); | |
1574 | void intel_edp_drrs_flush(struct drm_i915_private *dev_priv, | |
1575 | unsigned int frontbuffer_bits); | |
0bc12bcb | 1576 | |
94223d04 ACO |
1577 | void |
1578 | intel_dp_program_link_training_pattern(struct intel_dp *intel_dp, | |
1579 | uint8_t dp_train_pat); | |
1580 | void | |
1581 | intel_dp_set_signal_levels(struct intel_dp *intel_dp); | |
1582 | void intel_dp_set_idle_link_train(struct intel_dp *intel_dp); | |
1583 | uint8_t | |
1584 | intel_dp_voltage_max(struct intel_dp *intel_dp); | |
1585 | uint8_t | |
1586 | intel_dp_pre_emphasis_max(struct intel_dp *intel_dp, uint8_t voltage_swing); | |
1587 | void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, | |
1588 | uint8_t *link_bw, uint8_t *rate_select); | |
e588fa18 | 1589 | bool intel_dp_source_supports_hbr2(struct intel_dp *intel_dp); |
94223d04 ACO |
1590 | bool |
1591 | intel_dp_get_link_status(struct intel_dp *intel_dp, uint8_t link_status[DP_LINK_STATUS_SIZE]); | |
1592 | ||
419b1b7a ACO |
1593 | static inline unsigned int intel_dp_unused_lane_mask(int lane_count) |
1594 | { | |
1595 | return ~((1 << lane_count) - 1) & 0xf; | |
1596 | } | |
1597 | ||
24e807e7 | 1598 | bool intel_dp_read_dpcd(struct intel_dp *intel_dp); |
22a2c8e0 DP |
1599 | int intel_dp_link_required(int pixel_clock, int bpp); |
1600 | int intel_dp_max_data_rate(int max_link_clock, int max_lanes); | |
7533eb4f | 1601 | bool intel_digital_port_connected(struct intel_encoder *encoder); |
24e807e7 | 1602 | |
e7156c83 YA |
1603 | /* intel_dp_aux_backlight.c */ |
1604 | int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector); | |
1605 | ||
0e32b39c DA |
1606 | /* intel_dp_mst.c */ |
1607 | int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id); | |
1608 | void intel_dp_mst_encoder_cleanup(struct intel_digital_port *intel_dig_port); | |
5f1aae65 | 1609 | /* intel_dsi.c */ |
c39055b0 | 1610 | void intel_dsi_init(struct drm_i915_private *dev_priv); |
5f1aae65 | 1611 | |
90198355 JN |
1612 | /* intel_dsi_dcs_backlight.c */ |
1613 | int intel_dsi_dcs_init_backlight_funcs(struct intel_connector *intel_connector); | |
5f1aae65 PZ |
1614 | |
1615 | /* intel_dvo.c */ | |
c39055b0 | 1616 | void intel_dvo_init(struct drm_i915_private *dev_priv); |
19625e85 L |
1617 | /* intel_hotplug.c */ |
1618 | void intel_hpd_poll_init(struct drm_i915_private *dev_priv); | |
5f1aae65 PZ |
1619 | |
1620 | ||
0632fef6 | 1621 | /* legacy fbdev emulation in intel_fbdev.c */ |
0695726e | 1622 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
4520f53a | 1623 | extern int intel_fbdev_init(struct drm_device *dev); |
e00bf696 | 1624 | extern void intel_fbdev_initial_config_async(struct drm_device *dev); |
4f256d82 SV |
1625 | extern void intel_fbdev_unregister(struct drm_i915_private *dev_priv); |
1626 | extern void intel_fbdev_fini(struct drm_i915_private *dev_priv); | |
82e3b8c1 | 1627 | extern void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous); |
0632fef6 SV |
1628 | extern void intel_fbdev_output_poll_changed(struct drm_device *dev); |
1629 | extern void intel_fbdev_restore_mode(struct drm_device *dev); | |
4520f53a SV |
1630 | #else |
1631 | static inline int intel_fbdev_init(struct drm_device *dev) | |
1632 | { | |
1633 | return 0; | |
1634 | } | |
5f1aae65 | 1635 | |
e00bf696 | 1636 | static inline void intel_fbdev_initial_config_async(struct drm_device *dev) |
4520f53a SV |
1637 | { |
1638 | } | |
1639 | ||
4f256d82 SV |
1640 | static inline void intel_fbdev_unregister(struct drm_i915_private *dev_priv) |
1641 | { | |
1642 | } | |
1643 | ||
1644 | static inline void intel_fbdev_fini(struct drm_i915_private *dev_priv) | |
4520f53a SV |
1645 | { |
1646 | } | |
1647 | ||
82e3b8c1 | 1648 | static inline void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous) |
4520f53a SV |
1649 | { |
1650 | } | |
1651 | ||
d9c409d6 JN |
1652 | static inline void intel_fbdev_output_poll_changed(struct drm_device *dev) |
1653 | { | |
1654 | } | |
1655 | ||
0632fef6 | 1656 | static inline void intel_fbdev_restore_mode(struct drm_device *dev) |
4520f53a SV |
1657 | { |
1658 | } | |
1659 | #endif | |
5f1aae65 | 1660 | |
7ff0ebcc | 1661 | /* intel_fbc.c */ |
f51be2e0 | 1662 | void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, |
dd57602e | 1663 | struct intel_atomic_state *state); |
0e631adc | 1664 | bool intel_fbc_is_active(struct drm_i915_private *dev_priv); |
faf68d92 ML |
1665 | void intel_fbc_pre_update(struct intel_crtc *crtc, |
1666 | struct intel_crtc_state *crtc_state, | |
1667 | struct intel_plane_state *plane_state); | |
1eb52238 | 1668 | void intel_fbc_post_update(struct intel_crtc *crtc); |
7ff0ebcc | 1669 | void intel_fbc_init(struct drm_i915_private *dev_priv); |
010cf73d | 1670 | void intel_fbc_init_pipe_state(struct drm_i915_private *dev_priv); |
faf68d92 ML |
1671 | void intel_fbc_enable(struct intel_crtc *crtc, |
1672 | struct intel_crtc_state *crtc_state, | |
1673 | struct intel_plane_state *plane_state); | |
c937ab3e PZ |
1674 | void intel_fbc_disable(struct intel_crtc *crtc); |
1675 | void intel_fbc_global_disable(struct drm_i915_private *dev_priv); | |
dbef0f15 PZ |
1676 | void intel_fbc_invalidate(struct drm_i915_private *dev_priv, |
1677 | unsigned int frontbuffer_bits, | |
1678 | enum fb_op_origin origin); | |
1679 | void intel_fbc_flush(struct drm_i915_private *dev_priv, | |
6f4551fe | 1680 | unsigned int frontbuffer_bits, enum fb_op_origin origin); |
7733b49b | 1681 | void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv); |
61a585d6 | 1682 | void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *dev_priv); |
7ff0ebcc | 1683 | |
5f1aae65 | 1684 | /* intel_hdmi.c */ |
c39055b0 ACO |
1685 | void intel_hdmi_init(struct drm_i915_private *dev_priv, i915_reg_t hdmi_reg, |
1686 | enum port port); | |
87440425 PZ |
1687 | void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, |
1688 | struct intel_connector *intel_connector); | |
1689 | struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder); | |
1690 | bool intel_hdmi_compute_config(struct intel_encoder *encoder, | |
0a478c27 ML |
1691 | struct intel_crtc_state *pipe_config, |
1692 | struct drm_connector_state *conn_state); | |
15953637 SS |
1693 | void intel_hdmi_handle_sink_scrambling(struct intel_encoder *intel_encoder, |
1694 | struct drm_connector *connector, | |
1695 | bool high_tmds_clock_ratio, | |
1696 | bool scrambling); | |
b2ccb822 | 1697 | void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable); |
385e4de0 | 1698 | void intel_infoframe_init(struct intel_digital_port *intel_dig_port); |
5f1aae65 PZ |
1699 | |
1700 | ||
1701 | /* intel_lvds.c */ | |
c39055b0 | 1702 | void intel_lvds_init(struct drm_i915_private *dev_priv); |
97a824e1 | 1703 | struct intel_encoder *intel_get_lvds_encoder(struct drm_device *dev); |
87440425 | 1704 | bool intel_is_dual_link_lvds(struct drm_device *dev); |
5f1aae65 PZ |
1705 | |
1706 | ||
1707 | /* intel_modes.c */ | |
1708 | int intel_connector_update_modes(struct drm_connector *connector, | |
87440425 | 1709 | struct edid *edid); |
5f1aae65 | 1710 | int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter); |
87440425 PZ |
1711 | void intel_attach_force_audio_property(struct drm_connector *connector); |
1712 | void intel_attach_broadcast_rgb_property(struct drm_connector *connector); | |
7949dd47 | 1713 | void intel_attach_aspect_ratio_property(struct drm_connector *connector); |
5f1aae65 PZ |
1714 | |
1715 | ||
1716 | /* intel_overlay.c */ | |
1ee8da6d CW |
1717 | void intel_setup_overlay(struct drm_i915_private *dev_priv); |
1718 | void intel_cleanup_overlay(struct drm_i915_private *dev_priv); | |
87440425 | 1719 | int intel_overlay_switch_off(struct intel_overlay *overlay); |
1ee8da6d CW |
1720 | int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data, |
1721 | struct drm_file *file_priv); | |
1722 | int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data, | |
1723 | struct drm_file *file_priv); | |
1362b776 | 1724 | void intel_overlay_reset(struct drm_i915_private *dev_priv); |
5f1aae65 PZ |
1725 | |
1726 | ||
1727 | /* intel_panel.c */ | |
87440425 | 1728 | int intel_panel_init(struct intel_panel *panel, |
4b6ed685 | 1729 | struct drm_display_mode *fixed_mode, |
dc911f5b | 1730 | struct drm_display_mode *alt_fixed_mode, |
4b6ed685 | 1731 | struct drm_display_mode *downclock_mode); |
87440425 PZ |
1732 | void intel_panel_fini(struct intel_panel *panel); |
1733 | void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode, | |
1734 | struct drm_display_mode *adjusted_mode); | |
1735 | void intel_pch_panel_fitting(struct intel_crtc *crtc, | |
5cec258b | 1736 | struct intel_crtc_state *pipe_config, |
87440425 PZ |
1737 | int fitting_mode); |
1738 | void intel_gmch_panel_fitting(struct intel_crtc *crtc, | |
5cec258b | 1739 | struct intel_crtc_state *pipe_config, |
87440425 | 1740 | int fitting_mode); |
90d7cd24 | 1741 | void intel_panel_set_backlight_acpi(const struct drm_connector_state *conn_state, |
6dda730e | 1742 | u32 level, u32 max); |
fda9ee98 CW |
1743 | int intel_panel_setup_backlight(struct drm_connector *connector, |
1744 | enum pipe pipe); | |
b037d58f ML |
1745 | void intel_panel_enable_backlight(const struct intel_crtc_state *crtc_state, |
1746 | const struct drm_connector_state *conn_state); | |
1747 | void intel_panel_disable_backlight(const struct drm_connector_state *old_conn_state); | |
db31af1d | 1748 | void intel_panel_destroy_backlight(struct drm_connector *connector); |
1650be74 | 1749 | enum drm_connector_status intel_panel_detect(struct drm_i915_private *dev_priv); |
ec9ed197 | 1750 | extern struct drm_display_mode *intel_find_panel_downclock( |
a318b4c4 | 1751 | struct drm_i915_private *dev_priv, |
ec9ed197 VK |
1752 | struct drm_display_mode *fixed_mode, |
1753 | struct drm_connector *connector); | |
e63d87c0 CW |
1754 | |
1755 | #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) | |
1ebaa0b9 | 1756 | int intel_backlight_device_register(struct intel_connector *connector); |
e63d87c0 CW |
1757 | void intel_backlight_device_unregister(struct intel_connector *connector); |
1758 | #else /* CONFIG_BACKLIGHT_CLASS_DEVICE */ | |
2de2d0b0 | 1759 | static inline int intel_backlight_device_register(struct intel_connector *connector) |
1ebaa0b9 CW |
1760 | { |
1761 | return 0; | |
1762 | } | |
e63d87c0 CW |
1763 | static inline void intel_backlight_device_unregister(struct intel_connector *connector) |
1764 | { | |
1765 | } | |
1766 | #endif /* CONFIG_BACKLIGHT_CLASS_DEVICE */ | |
0962c3c9 | 1767 | |
5f1aae65 | 1768 | |
0bc12bcb | 1769 | /* intel_psr.c */ |
4371d896 | 1770 | #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support) |
d2419ffc VS |
1771 | void intel_psr_enable(struct intel_dp *intel_dp, |
1772 | const struct intel_crtc_state *crtc_state); | |
1773 | void intel_psr_disable(struct intel_dp *intel_dp, | |
1774 | const struct intel_crtc_state *old_crtc_state); | |
5748b6a1 | 1775 | void intel_psr_invalidate(struct drm_i915_private *dev_priv, |
20c8838b | 1776 | unsigned frontbuffer_bits); |
5748b6a1 | 1777 | void intel_psr_flush(struct drm_i915_private *dev_priv, |
169de131 RV |
1778 | unsigned frontbuffer_bits, |
1779 | enum fb_op_origin origin); | |
c39055b0 | 1780 | void intel_psr_init(struct drm_i915_private *dev_priv); |
5748b6a1 | 1781 | void intel_psr_single_frame_update(struct drm_i915_private *dev_priv, |
20c8838b | 1782 | unsigned frontbuffer_bits); |
4d90f2d5 VS |
1783 | void intel_psr_compute_config(struct intel_dp *intel_dp, |
1784 | struct intel_crtc_state *crtc_state); | |
0bc12bcb | 1785 | |
9c065a7d SV |
1786 | /* intel_runtime_pm.c */ |
1787 | int intel_power_domains_init(struct drm_i915_private *); | |
f458ebbc | 1788 | void intel_power_domains_fini(struct drm_i915_private *); |
73dfc227 ID |
1789 | void intel_power_domains_init_hw(struct drm_i915_private *dev_priv, bool resume); |
1790 | void intel_power_domains_suspend(struct drm_i915_private *dev_priv); | |
8d8c386c | 1791 | void intel_power_domains_verify_state(struct drm_i915_private *dev_priv); |
d7d7c9ee ID |
1792 | void bxt_display_core_init(struct drm_i915_private *dev_priv, bool resume); |
1793 | void bxt_display_core_uninit(struct drm_i915_private *dev_priv); | |
f458ebbc | 1794 | void intel_runtime_pm_enable(struct drm_i915_private *dev_priv); |
9895ad03 DS |
1795 | const char * |
1796 | intel_display_power_domain_str(enum intel_display_power_domain domain); | |
9c065a7d | 1797 | |
f458ebbc SV |
1798 | bool intel_display_power_is_enabled(struct drm_i915_private *dev_priv, |
1799 | enum intel_display_power_domain domain); | |
1800 | bool __intel_display_power_is_enabled(struct drm_i915_private *dev_priv, | |
1801 | enum intel_display_power_domain domain); | |
9c065a7d SV |
1802 | void intel_display_power_get(struct drm_i915_private *dev_priv, |
1803 | enum intel_display_power_domain domain); | |
09731280 ID |
1804 | bool intel_display_power_get_if_enabled(struct drm_i915_private *dev_priv, |
1805 | enum intel_display_power_domain domain); | |
9c065a7d SV |
1806 | void intel_display_power_put(struct drm_i915_private *dev_priv, |
1807 | enum intel_display_power_domain domain); | |
da5827c3 ID |
1808 | |
1809 | static inline void | |
1810 | assert_rpm_device_not_suspended(struct drm_i915_private *dev_priv) | |
1811 | { | |
ad1443f0 | 1812 | WARN_ONCE(dev_priv->runtime_pm.suspended, |
da5827c3 ID |
1813 | "Device suspended during HW access\n"); |
1814 | } | |
1815 | ||
1816 | static inline void | |
1817 | assert_rpm_wakelock_held(struct drm_i915_private *dev_priv) | |
1818 | { | |
1819 | assert_rpm_device_not_suspended(dev_priv); | |
ad1443f0 | 1820 | WARN_ONCE(!atomic_read(&dev_priv->runtime_pm.wakeref_count), |
1f58c8e7 | 1821 | "RPM wakelock ref not held during HW access"); |
da5827c3 ID |
1822 | } |
1823 | ||
1f814dac ID |
1824 | /** |
1825 | * disable_rpm_wakeref_asserts - disable the RPM assert checks | |
1826 | * @dev_priv: i915 device instance | |
1827 | * | |
1828 | * This function disable asserts that check if we hold an RPM wakelock | |
1829 | * reference, while keeping the device-not-suspended checks still enabled. | |
1830 | * It's meant to be used only in special circumstances where our rule about | |
1831 | * the wakelock refcount wrt. the device power state doesn't hold. According | |
1832 | * to this rule at any point where we access the HW or want to keep the HW in | |
1833 | * an active state we must hold an RPM wakelock reference acquired via one of | |
1834 | * the intel_runtime_pm_get() helpers. Currently there are a few special spots | |
1835 | * where this rule doesn't hold: the IRQ and suspend/resume handlers, the | |
1836 | * forcewake release timer, and the GPU RPS and hangcheck works. All other | |
1837 | * users should avoid using this function. | |
1838 | * | |
1839 | * Any calls to this function must have a symmetric call to | |
1840 | * enable_rpm_wakeref_asserts(). | |
1841 | */ | |
1842 | static inline void | |
1843 | disable_rpm_wakeref_asserts(struct drm_i915_private *dev_priv) | |
1844 | { | |
ad1443f0 | 1845 | atomic_inc(&dev_priv->runtime_pm.wakeref_count); |
1f814dac ID |
1846 | } |
1847 | ||
1848 | /** | |
1849 | * enable_rpm_wakeref_asserts - re-enable the RPM assert checks | |
1850 | * @dev_priv: i915 device instance | |
1851 | * | |
1852 | * This function re-enables the RPM assert checks after disabling them with | |
1853 | * disable_rpm_wakeref_asserts. It's meant to be used only in special | |
1854 | * circumstances otherwise its use should be avoided. | |
1855 | * | |
1856 | * Any calls to this function must have a symmetric call to | |
1857 | * disable_rpm_wakeref_asserts(). | |
1858 | */ | |
1859 | static inline void | |
1860 | enable_rpm_wakeref_asserts(struct drm_i915_private *dev_priv) | |
1861 | { | |
ad1443f0 | 1862 | atomic_dec(&dev_priv->runtime_pm.wakeref_count); |
1f814dac ID |
1863 | } |
1864 | ||
9c065a7d | 1865 | void intel_runtime_pm_get(struct drm_i915_private *dev_priv); |
09731280 | 1866 | bool intel_runtime_pm_get_if_in_use(struct drm_i915_private *dev_priv); |
9c065a7d SV |
1867 | void intel_runtime_pm_get_noresume(struct drm_i915_private *dev_priv); |
1868 | void intel_runtime_pm_put(struct drm_i915_private *dev_priv); | |
1869 | ||
d9bc89d9 SV |
1870 | void intel_display_set_init_power(struct drm_i915_private *dev, bool enable); |
1871 | ||
e0fce78f VS |
1872 | void chv_phy_powergate_lanes(struct intel_encoder *encoder, |
1873 | bool override, unsigned int mask); | |
b0b33846 VS |
1874 | bool chv_phy_powergate_ch(struct drm_i915_private *dev_priv, enum dpio_phy phy, |
1875 | enum dpio_channel ch, bool override); | |
e0fce78f VS |
1876 | |
1877 | ||
5f1aae65 | 1878 | /* intel_pm.c */ |
46f16e63 | 1879 | void intel_init_clock_gating(struct drm_i915_private *dev_priv); |
712bf364 | 1880 | void intel_suspend_hw(struct drm_i915_private *dev_priv); |
5db94019 | 1881 | int ilk_wm_max_level(const struct drm_i915_private *dev_priv); |
432081bc | 1882 | void intel_update_watermarks(struct intel_crtc *crtc); |
62d75df7 | 1883 | void intel_init_pm(struct drm_i915_private *dev_priv); |
bb400da9 | 1884 | void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv); |
192aa181 | 1885 | void intel_pm_setup(struct drm_i915_private *dev_priv); |
87440425 PZ |
1886 | void intel_gpu_ips_init(struct drm_i915_private *dev_priv); |
1887 | void intel_gpu_ips_teardown(void); | |
dc97997a | 1888 | void intel_init_gt_powersave(struct drm_i915_private *dev_priv); |
54b4f68f CW |
1889 | void intel_cleanup_gt_powersave(struct drm_i915_private *dev_priv); |
1890 | void intel_sanitize_gt_powersave(struct drm_i915_private *dev_priv); | |
dc97997a CW |
1891 | void intel_enable_gt_powersave(struct drm_i915_private *dev_priv); |
1892 | void intel_disable_gt_powersave(struct drm_i915_private *dev_priv); | |
54b4f68f | 1893 | void intel_suspend_gt_powersave(struct drm_i915_private *dev_priv); |
43cf3bf0 CW |
1894 | void gen6_rps_busy(struct drm_i915_private *dev_priv); |
1895 | void gen6_rps_reset_ei(struct drm_i915_private *dev_priv); | |
076e29f2 | 1896 | void gen6_rps_idle(struct drm_i915_private *dev_priv); |
e61e0f51 | 1897 | void gen6_rps_boost(struct i915_request *rq, struct intel_rps_client *rps); |
04548cba | 1898 | void g4x_wm_get_hw_state(struct drm_device *dev); |
6eb1a681 | 1899 | void vlv_wm_get_hw_state(struct drm_device *dev); |
243e6a44 | 1900 | void ilk_wm_get_hw_state(struct drm_device *dev); |
3078999f | 1901 | void skl_wm_get_hw_state(struct drm_device *dev); |
08db6652 DL |
1902 | void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv, |
1903 | struct skl_ddb_allocation *ddb /* out */); | |
bf9d99ad | 1904 | void skl_pipe_wm_get_hw_state(struct drm_crtc *crtc, |
1905 | struct skl_pipe_wm *out); | |
04548cba | 1906 | void g4x_wm_sanitize(struct drm_i915_private *dev_priv); |
602ae835 | 1907 | void vlv_wm_sanitize(struct drm_i915_private *dev_priv); |
16dcdc4e PZ |
1908 | bool intel_can_enable_sagv(struct drm_atomic_state *state); |
1909 | int intel_enable_sagv(struct drm_i915_private *dev_priv); | |
1910 | int intel_disable_sagv(struct drm_i915_private *dev_priv); | |
45ece230 | 1911 | bool skl_wm_level_equals(const struct skl_wm_level *l1, |
1912 | const struct skl_wm_level *l2); | |
2b68504b MK |
1913 | bool skl_ddb_allocation_overlaps(struct drm_i915_private *dev_priv, |
1914 | const struct skl_ddb_entry **entries, | |
5eff503b ML |
1915 | const struct skl_ddb_entry *ddb, |
1916 | int ignore); | |
ed4a6a7c | 1917 | bool ilk_disable_lp_wm(struct drm_device *dev); |
73b0ca8e MK |
1918 | int skl_check_pipe_max_pixel_rate(struct intel_crtc *intel_crtc, |
1919 | struct intel_crtc_state *cstate); | |
2503a0fe KM |
1920 | void intel_init_ipc(struct drm_i915_private *dev_priv); |
1921 | void intel_enable_ipc(struct drm_i915_private *dev_priv); | |
72662e10 | 1922 | |
5f1aae65 | 1923 | /* intel_sdvo.c */ |
c39055b0 | 1924 | bool intel_sdvo_init(struct drm_i915_private *dev_priv, |
f0f59a00 | 1925 | i915_reg_t reg, enum port port); |
96a02917 | 1926 | |
2b28bb1b | 1927 | |
5f1aae65 | 1928 | /* intel_sprite.c */ |
dfd2e9ab VS |
1929 | int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, |
1930 | int usecs); | |
580503c7 | 1931 | struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv, |
b079bd17 | 1932 | enum pipe pipe, int plane); |
6a20fe7b VS |
1933 | int intel_sprite_set_colorkey_ioctl(struct drm_device *dev, void *data, |
1934 | struct drm_file *file_priv); | |
d3a8fb32 VS |
1935 | void intel_pipe_update_start(const struct intel_crtc_state *new_crtc_state); |
1936 | void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state); | |
9a8cc576 JPH |
1937 | void skl_update_plane(struct intel_plane *plane, |
1938 | const struct intel_crtc_state *crtc_state, | |
1939 | const struct intel_plane_state *plane_state); | |
779d4d8f | 1940 | void skl_disable_plane(struct intel_plane *plane, struct intel_crtc *crtc); |
51f5a096 | 1941 | bool skl_plane_get_hw_state(struct intel_plane *plane); |
77064e2e VS |
1942 | bool skl_plane_has_ccs(struct drm_i915_private *dev_priv, |
1943 | enum pipe pipe, enum plane_id plane_id); | |
5f1aae65 PZ |
1944 | |
1945 | /* intel_tv.c */ | |
c39055b0 | 1946 | void intel_tv_init(struct drm_i915_private *dev_priv); |
20ddf665 | 1947 | |
ea2c67bb | 1948 | /* intel_atomic.c */ |
11c1a9ec ML |
1949 | int intel_digital_connector_atomic_get_property(struct drm_connector *connector, |
1950 | const struct drm_connector_state *state, | |
1951 | struct drm_property *property, | |
1952 | uint64_t *val); | |
1953 | int intel_digital_connector_atomic_set_property(struct drm_connector *connector, | |
1954 | struct drm_connector_state *state, | |
1955 | struct drm_property *property, | |
1956 | uint64_t val); | |
1957 | int intel_digital_connector_atomic_check(struct drm_connector *conn, | |
1958 | struct drm_connector_state *new_state); | |
1959 | struct drm_connector_state * | |
1960 | intel_digital_connector_duplicate_state(struct drm_connector *connector); | |
1961 | ||
1356837e MR |
1962 | struct drm_crtc_state *intel_crtc_duplicate_state(struct drm_crtc *crtc); |
1963 | void intel_crtc_destroy_state(struct drm_crtc *crtc, | |
1964 | struct drm_crtc_state *state); | |
de419ab6 ML |
1965 | struct drm_atomic_state *intel_atomic_state_alloc(struct drm_device *dev); |
1966 | void intel_atomic_state_clear(struct drm_atomic_state *); | |
de419ab6 | 1967 | |
10f81c19 ACO |
1968 | static inline struct intel_crtc_state * |
1969 | intel_atomic_get_crtc_state(struct drm_atomic_state *state, | |
1970 | struct intel_crtc *crtc) | |
1971 | { | |
1972 | struct drm_crtc_state *crtc_state; | |
1973 | crtc_state = drm_atomic_get_crtc_state(state, &crtc->base); | |
1974 | if (IS_ERR(crtc_state)) | |
0b6cc188 | 1975 | return ERR_CAST(crtc_state); |
10f81c19 ACO |
1976 | |
1977 | return to_intel_crtc_state(crtc_state); | |
1978 | } | |
e3bddded | 1979 | |
ccc24b39 MK |
1980 | static inline struct intel_crtc_state * |
1981 | intel_atomic_get_existing_crtc_state(struct drm_atomic_state *state, | |
1982 | struct intel_crtc *crtc) | |
1983 | { | |
1984 | struct drm_crtc_state *crtc_state; | |
1985 | ||
1986 | crtc_state = drm_atomic_get_existing_crtc_state(state, &crtc->base); | |
1987 | ||
1988 | if (crtc_state) | |
1989 | return to_intel_crtc_state(crtc_state); | |
1990 | else | |
1991 | return NULL; | |
1992 | } | |
1993 | ||
e3bddded ML |
1994 | static inline struct intel_plane_state * |
1995 | intel_atomic_get_existing_plane_state(struct drm_atomic_state *state, | |
1996 | struct intel_plane *plane) | |
1997 | { | |
1998 | struct drm_plane_state *plane_state; | |
1999 | ||
2000 | plane_state = drm_atomic_get_existing_plane_state(state, &plane->base); | |
2001 | ||
2002 | return to_intel_plane_state(plane_state); | |
2003 | } | |
2004 | ||
6ebc6923 ACO |
2005 | int intel_atomic_setup_scalers(struct drm_i915_private *dev_priv, |
2006 | struct intel_crtc *intel_crtc, | |
2007 | struct intel_crtc_state *crtc_state); | |
5ee67f1c MR |
2008 | |
2009 | /* intel_atomic_plane.c */ | |
8e7d688b | 2010 | struct intel_plane_state *intel_create_plane_state(struct drm_plane *plane); |
ea2c67bb MR |
2011 | struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane); |
2012 | void intel_plane_destroy_state(struct drm_plane *plane, | |
2013 | struct drm_plane_state *state); | |
2014 | extern const struct drm_plane_helper_funcs intel_plane_helper_funcs; | |
b2b55502 VS |
2015 | int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state, |
2016 | struct intel_crtc_state *crtc_state, | |
2017 | const struct intel_plane_state *old_plane_state, | |
f79f2692 | 2018 | struct intel_plane_state *intel_state); |
ea2c67bb | 2019 | |
8563b1e8 LL |
2020 | /* intel_color.c */ |
2021 | void intel_color_init(struct drm_crtc *crtc); | |
82cf435b | 2022 | int intel_color_check(struct drm_crtc *crtc, struct drm_crtc_state *state); |
b95c5321 ML |
2023 | void intel_color_set_csc(struct drm_crtc_state *crtc_state); |
2024 | void intel_color_load_luts(struct drm_crtc_state *crtc_state); | |
8563b1e8 | 2025 | |
dbe9e61b SS |
2026 | /* intel_lspcon.c */ |
2027 | bool lspcon_init(struct intel_digital_port *intel_dig_port); | |
910530c0 | 2028 | void lspcon_resume(struct intel_lspcon *lspcon); |
357c0ae9 | 2029 | void lspcon_wait_pcon_mode(struct intel_lspcon *lspcon); |
731035fe TV |
2030 | |
2031 | /* intel_pipe_crc.c */ | |
2032 | int intel_pipe_crc_create(struct drm_minor *minor); | |
8c6b709d TV |
2033 | #ifdef CONFIG_DEBUG_FS |
2034 | int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name, | |
2035 | size_t *values_cnt); | |
2036 | #else | |
2037 | #define intel_crtc_set_crc_source NULL | |
2038 | #endif | |
731035fe | 2039 | extern const struct file_operations i915_display_crc_ctl_fops; |
79e53945 | 2040 | #endif /* __INTEL_DRV_H__ */ |