OSDN Git Service

drm: Add for_each_oldnew_intel_crtc_in_state_reverse()
[tomoyo/tomoyo-test1.git] / drivers / gpu / drm / i915 / display / intel_display.h
1 /*
2  * Copyright © 2006-2017 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  *
23  */
24
25 #ifndef _INTEL_DISPLAY_H_
26 #define _INTEL_DISPLAY_H_
27
28 #include <drm/drm_util.h>
29 #include <drm/i915_drm.h>
30
31 enum link_m_n_set;
32 struct dpll;
33 struct drm_connector;
34 struct drm_device;
35 struct drm_encoder;
36 struct drm_file;
37 struct drm_framebuffer;
38 struct drm_i915_error_state_buf;
39 struct drm_i915_gem_object;
40 struct drm_i915_private;
41 struct drm_modeset_acquire_ctx;
42 struct drm_plane;
43 struct drm_plane_state;
44 struct i915_ggtt_view;
45 struct intel_crtc;
46 struct intel_crtc_state;
47 struct intel_digital_port;
48 struct intel_dp;
49 struct intel_encoder;
50 struct intel_load_detect_pipe;
51 struct intel_plane;
52 struct intel_plane_state;
53 struct intel_remapped_info;
54 struct intel_rotation_info;
55
56 enum i915_gpio {
57         GPIOA,
58         GPIOB,
59         GPIOC,
60         GPIOD,
61         GPIOE,
62         GPIOF,
63         GPIOG,
64         GPIOH,
65         __GPIOI_UNUSED,
66         GPIOJ,
67         GPIOK,
68         GPIOL,
69         GPIOM,
70         GPION,
71         GPIOO,
72 };
73
74 /*
75  * Keep the pipe enum values fixed: the code assumes that PIPE_A=0, the
76  * rest have consecutive values and match the enum values of transcoders
77  * with a 1:1 transcoder -> pipe mapping.
78  */
79 enum pipe {
80         INVALID_PIPE = -1,
81
82         PIPE_A = 0,
83         PIPE_B,
84         PIPE_C,
85         PIPE_D,
86         _PIPE_EDP,
87
88         I915_MAX_PIPES = _PIPE_EDP
89 };
90
91 #define pipe_name(p) ((p) + 'A')
92
93 enum transcoder {
94         /*
95          * The following transcoders have a 1:1 transcoder -> pipe mapping,
96          * keep their values fixed: the code assumes that TRANSCODER_A=0, the
97          * rest have consecutive values and match the enum values of the pipes
98          * they map to.
99          */
100         TRANSCODER_A = PIPE_A,
101         TRANSCODER_B = PIPE_B,
102         TRANSCODER_C = PIPE_C,
103         TRANSCODER_D = PIPE_D,
104
105         /*
106          * The following transcoders can map to any pipe, their enum value
107          * doesn't need to stay fixed.
108          */
109         TRANSCODER_EDP,
110         TRANSCODER_DSI_0,
111         TRANSCODER_DSI_1,
112         TRANSCODER_DSI_A = TRANSCODER_DSI_0,    /* legacy DSI */
113         TRANSCODER_DSI_C = TRANSCODER_DSI_1,    /* legacy DSI */
114
115         I915_MAX_TRANSCODERS
116 };
117
118 static inline const char *transcoder_name(enum transcoder transcoder)
119 {
120         switch (transcoder) {
121         case TRANSCODER_A:
122                 return "A";
123         case TRANSCODER_B:
124                 return "B";
125         case TRANSCODER_C:
126                 return "C";
127         case TRANSCODER_D:
128                 return "D";
129         case TRANSCODER_EDP:
130                 return "EDP";
131         case TRANSCODER_DSI_A:
132                 return "DSI A";
133         case TRANSCODER_DSI_C:
134                 return "DSI C";
135         default:
136                 return "<invalid>";
137         }
138 }
139
140 static inline bool transcoder_is_dsi(enum transcoder transcoder)
141 {
142         return transcoder == TRANSCODER_DSI_A || transcoder == TRANSCODER_DSI_C;
143 }
144
145 /*
146  * Global legacy plane identifier. Valid only for primary/sprite
147  * planes on pre-g4x, and only for primary planes on g4x-bdw.
148  */
149 enum i9xx_plane_id {
150         PLANE_A,
151         PLANE_B,
152         PLANE_C,
153 };
154
155 #define plane_name(p) ((p) + 'A')
156 #define sprite_name(p, s) ((p) * RUNTIME_INFO(dev_priv)->num_sprites[(p)] + (s) + 'A')
157
158 /*
159  * Per-pipe plane identifier.
160  * I915_MAX_PLANES in the enum below is the maximum (across all platforms)
161  * number of planes per CRTC.  Not all platforms really have this many planes,
162  * which means some arrays of size I915_MAX_PLANES may have unused entries
163  * between the topmost sprite plane and the cursor plane.
164  *
165  * This is expected to be passed to various register macros
166  * (eg. PLANE_CTL(), PS_PLANE_SEL(), etc.) so adjust with care.
167  */
168 enum plane_id {
169         PLANE_PRIMARY,
170         PLANE_SPRITE0,
171         PLANE_SPRITE1,
172         PLANE_SPRITE2,
173         PLANE_SPRITE3,
174         PLANE_SPRITE4,
175         PLANE_SPRITE5,
176         PLANE_CURSOR,
177
178         I915_MAX_PLANES,
179 };
180
181 #define for_each_plane_id_on_crtc(__crtc, __p) \
182         for ((__p) = PLANE_PRIMARY; (__p) < I915_MAX_PLANES; (__p)++) \
183                 for_each_if((__crtc)->plane_ids_mask & BIT(__p))
184
185 /*
186  * Ports identifier referenced from other drivers.
187  * Expected to remain stable over time
188  */
189 static inline const char *port_identifier(enum port port)
190 {
191         switch (port) {
192         case PORT_A:
193                 return "Port A";
194         case PORT_B:
195                 return "Port B";
196         case PORT_C:
197                 return "Port C";
198         case PORT_D:
199                 return "Port D";
200         case PORT_E:
201                 return "Port E";
202         case PORT_F:
203                 return "Port F";
204         case PORT_G:
205                 return "Port G";
206         case PORT_H:
207                 return "Port H";
208         case PORT_I:
209                 return "Port I";
210         default:
211                 return "<invalid>";
212         }
213 }
214
215 enum tc_port {
216         PORT_TC_NONE = -1,
217
218         PORT_TC1 = 0,
219         PORT_TC2,
220         PORT_TC3,
221         PORT_TC4,
222         PORT_TC5,
223         PORT_TC6,
224
225         I915_MAX_TC_PORTS
226 };
227
228 enum tc_port_mode {
229         TC_PORT_TBT_ALT,
230         TC_PORT_DP_ALT,
231         TC_PORT_LEGACY,
232 };
233
234 enum dpio_channel {
235         DPIO_CH0,
236         DPIO_CH1
237 };
238
239 enum dpio_phy {
240         DPIO_PHY0,
241         DPIO_PHY1,
242         DPIO_PHY2,
243 };
244
245 #define I915_NUM_PHYS_VLV 2
246
247 enum aux_ch {
248         AUX_CH_A,
249         AUX_CH_B,
250         AUX_CH_C,
251         AUX_CH_D,
252         AUX_CH_E, /* ICL+ */
253         AUX_CH_F,
254 };
255
256 #define aux_ch_name(a) ((a) + 'A')
257
258 /* Used by dp and fdi links */
259 struct intel_link_m_n {
260         u32 tu;
261         u32 gmch_m;
262         u32 gmch_n;
263         u32 link_m;
264         u32 link_n;
265 };
266
267 enum phy {
268         PHY_NONE = -1,
269
270         PHY_A = 0,
271         PHY_B,
272         PHY_C,
273         PHY_D,
274         PHY_E,
275         PHY_F,
276         PHY_G,
277         PHY_H,
278         PHY_I,
279
280         I915_MAX_PHYS
281 };
282
283 #define phy_name(a) ((a) + 'A')
284
285 enum phy_fia {
286         FIA1,
287         FIA2,
288         FIA3,
289 };
290
291 #define for_each_pipe(__dev_priv, __p) \
292         for ((__p) = 0; (__p) < INTEL_INFO(__dev_priv)->num_pipes; (__p)++)
293
294 #define for_each_pipe_masked(__dev_priv, __p, __mask) \
295         for ((__p) = 0; (__p) < INTEL_INFO(__dev_priv)->num_pipes; (__p)++) \
296                 for_each_if((__mask) & BIT(__p))
297
298 #define for_each_cpu_transcoder_masked(__dev_priv, __t, __mask) \
299         for ((__t) = 0; (__t) < I915_MAX_TRANSCODERS; (__t)++)  \
300                 for_each_if ((__mask) & (1 << (__t)))
301
302 #define for_each_universal_plane(__dev_priv, __pipe, __p)               \
303         for ((__p) = 0;                                                 \
304              (__p) < RUNTIME_INFO(__dev_priv)->num_sprites[(__pipe)] + 1;       \
305              (__p)++)
306
307 #define for_each_sprite(__dev_priv, __p, __s)                           \
308         for ((__s) = 0;                                                 \
309              (__s) < RUNTIME_INFO(__dev_priv)->num_sprites[(__p)];      \
310              (__s)++)
311
312 #define for_each_port_masked(__port, __ports_mask) \
313         for ((__port) = PORT_A; (__port) < I915_MAX_PORTS; (__port)++)  \
314                 for_each_if((__ports_mask) & BIT(__port))
315
316 #define for_each_phy_masked(__phy, __phys_mask) \
317         for ((__phy) = PHY_A; (__phy) < I915_MAX_PHYS; (__phy)++)       \
318                 for_each_if((__phys_mask) & BIT(__phy))
319
320 #define for_each_crtc(dev, crtc) \
321         list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
322
323 #define for_each_intel_plane(dev, intel_plane) \
324         list_for_each_entry(intel_plane,                        \
325                             &(dev)->mode_config.plane_list,     \
326                             base.head)
327
328 #define for_each_intel_plane_mask(dev, intel_plane, plane_mask)         \
329         list_for_each_entry(intel_plane,                                \
330                             &(dev)->mode_config.plane_list,             \
331                             base.head)                                  \
332                 for_each_if((plane_mask) &                              \
333                             drm_plane_mask(&intel_plane->base)))
334
335 #define for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane)      \
336         list_for_each_entry(intel_plane,                                \
337                             &(dev)->mode_config.plane_list,             \
338                             base.head)                                  \
339                 for_each_if((intel_plane)->pipe == (intel_crtc)->pipe)
340
341 #define for_each_intel_crtc(dev, intel_crtc)                            \
342         list_for_each_entry(intel_crtc,                                 \
343                             &(dev)->mode_config.crtc_list,              \
344                             base.head)
345
346 #define for_each_intel_crtc_mask(dev, intel_crtc, crtc_mask)            \
347         list_for_each_entry(intel_crtc,                                 \
348                             &(dev)->mode_config.crtc_list,              \
349                             base.head)                                  \
350                 for_each_if((crtc_mask) & drm_crtc_mask(&intel_crtc->base))
351
352 #define for_each_intel_encoder(dev, intel_encoder)              \
353         list_for_each_entry(intel_encoder,                      \
354                             &(dev)->mode_config.encoder_list,   \
355                             base.head)
356
357 #define for_each_intel_dp(dev, intel_encoder)                   \
358         for_each_intel_encoder(dev, intel_encoder)              \
359                 for_each_if(intel_encoder_is_dp(intel_encoder))
360
361 #define for_each_intel_connector_iter(intel_connector, iter) \
362         while ((intel_connector = to_intel_connector(drm_connector_list_iter_next(iter))))
363
364 #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
365         list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
366                 for_each_if((intel_encoder)->base.crtc == (__crtc))
367
368 #define for_each_connector_on_encoder(dev, __encoder, intel_connector) \
369         list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \
370                 for_each_if((intel_connector)->base.encoder == (__encoder))
371
372 #define for_each_old_intel_plane_in_state(__state, plane, old_plane_state, __i) \
373         for ((__i) = 0; \
374              (__i) < (__state)->base.dev->mode_config.num_total_plane && \
375                      ((plane) = to_intel_plane((__state)->base.planes[__i].ptr), \
376                       (old_plane_state) = to_intel_plane_state((__state)->base.planes[__i].old_state), 1); \
377              (__i)++) \
378                 for_each_if(plane)
379
380 #define for_each_new_intel_plane_in_state(__state, plane, new_plane_state, __i) \
381         for ((__i) = 0; \
382              (__i) < (__state)->base.dev->mode_config.num_total_plane && \
383                      ((plane) = to_intel_plane((__state)->base.planes[__i].ptr), \
384                       (new_plane_state) = to_intel_plane_state((__state)->base.planes[__i].new_state), 1); \
385              (__i)++) \
386                 for_each_if(plane)
387
388 #define for_each_new_intel_crtc_in_state(__state, crtc, new_crtc_state, __i) \
389         for ((__i) = 0; \
390              (__i) < (__state)->base.dev->mode_config.num_crtc && \
391                      ((crtc) = to_intel_crtc((__state)->base.crtcs[__i].ptr), \
392                       (new_crtc_state) = to_intel_crtc_state((__state)->base.crtcs[__i].new_state), 1); \
393              (__i)++) \
394                 for_each_if(crtc)
395
396 #define for_each_oldnew_intel_plane_in_state(__state, plane, old_plane_state, new_plane_state, __i) \
397         for ((__i) = 0; \
398              (__i) < (__state)->base.dev->mode_config.num_total_plane && \
399                      ((plane) = to_intel_plane((__state)->base.planes[__i].ptr), \
400                       (old_plane_state) = to_intel_plane_state((__state)->base.planes[__i].old_state), \
401                       (new_plane_state) = to_intel_plane_state((__state)->base.planes[__i].new_state), 1); \
402              (__i)++) \
403                 for_each_if(plane)
404
405 #define for_each_oldnew_intel_crtc_in_state(__state, crtc, old_crtc_state, new_crtc_state, __i) \
406         for ((__i) = 0; \
407              (__i) < (__state)->base.dev->mode_config.num_crtc && \
408                      ((crtc) = to_intel_crtc((__state)->base.crtcs[__i].ptr), \
409                       (old_crtc_state) = to_intel_crtc_state((__state)->base.crtcs[__i].old_state), \
410                       (new_crtc_state) = to_intel_crtc_state((__state)->base.crtcs[__i].new_state), 1); \
411              (__i)++) \
412                 for_each_if(crtc)
413
414 #define for_each_oldnew_intel_crtc_in_state_reverse(__state, crtc, old_crtc_state, new_crtc_state, __i) \
415         for ((__i) = (__state)->base.dev->mode_config.num_crtc - 1; \
416              (__i) >= 0  && \
417              ((crtc) = to_intel_crtc((__state)->base.crtcs[__i].ptr), \
418               (old_crtc_state) = to_intel_crtc_state((__state)->base.crtcs[__i].old_state), \
419               (new_crtc_state) = to_intel_crtc_state((__state)->base.crtcs[__i].new_state), 1); \
420              (__i)--) \
421                 for_each_if(crtc)
422
423 void intel_link_compute_m_n(u16 bpp, int nlanes,
424                             int pixel_clock, int link_clock,
425                             struct intel_link_m_n *m_n,
426                             bool constant_n);
427 bool is_ccs_modifier(u64 modifier);
428 void lpt_disable_clkout_dp(struct drm_i915_private *dev_priv);
429 u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
430                               u32 pixel_format, u64 modifier);
431 bool intel_plane_can_remap(const struct intel_plane_state *plane_state);
432 enum phy intel_port_to_phy(struct drm_i915_private *i915, enum port port);
433
434 void intel_plane_destroy(struct drm_plane *plane);
435 void i830_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe);
436 void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe);
437 enum pipe intel_crtc_pch_transcoder(struct intel_crtc *crtc);
438 int vlv_get_hpll_vco(struct drm_i915_private *dev_priv);
439 int vlv_get_cck_clock(struct drm_i915_private *dev_priv,
440                       const char *name, u32 reg, int ref_freq);
441 int vlv_get_cck_clock_hpll(struct drm_i915_private *dev_priv,
442                            const char *name, u32 reg);
443 void lpt_disable_pch_transcoder(struct drm_i915_private *dev_priv);
444 void lpt_disable_iclkip(struct drm_i915_private *dev_priv);
445 void intel_init_display_hooks(struct drm_i915_private *dev_priv);
446 unsigned int intel_fb_xy_to_linear(int x, int y,
447                                    const struct intel_plane_state *state,
448                                    int plane);
449 unsigned int intel_fb_align_height(const struct drm_framebuffer *fb,
450                                    int color_plane, unsigned int height);
451 void intel_add_fb_offsets(int *x, int *y,
452                           const struct intel_plane_state *state, int plane);
453 unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info);
454 unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info);
455 bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv);
456 int intel_display_suspend(struct drm_device *dev);
457 void intel_pps_unlock_regs_wa(struct drm_i915_private *dev_priv);
458 void intel_encoder_destroy(struct drm_encoder *encoder);
459 struct drm_display_mode *
460 intel_encoder_current_mode(struct intel_encoder *encoder);
461 bool intel_phy_is_combo(struct drm_i915_private *dev_priv, enum phy phy);
462 bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy);
463 enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv,
464                               enum port port);
465 int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,
466                                       struct drm_file *file_priv);
467 enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
468                                              enum pipe pipe);
469 u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc);
470
471 int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
472 void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
473                          struct intel_digital_port *dport,
474                          unsigned int expected_mask);
475 int intel_get_load_detect_pipe(struct drm_connector *connector,
476                                const struct drm_display_mode *mode,
477                                struct intel_load_detect_pipe *old,
478                                struct drm_modeset_acquire_ctx *ctx);
479 void intel_release_load_detect_pipe(struct drm_connector *connector,
480                                     struct intel_load_detect_pipe *old,
481                                     struct drm_modeset_acquire_ctx *ctx);
482 struct i915_vma *
483 intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
484                            const struct i915_ggtt_view *view,
485                            bool uses_fence,
486                            unsigned long *out_flags);
487 void intel_unpin_fb_vma(struct i915_vma *vma, unsigned long flags);
488 struct drm_framebuffer *
489 intel_framebuffer_create(struct drm_i915_gem_object *obj,
490                          struct drm_mode_fb_cmd2 *mode_cmd);
491 int intel_prepare_plane_fb(struct drm_plane *plane,
492                            struct drm_plane_state *new_state);
493 void intel_cleanup_plane_fb(struct drm_plane *plane,
494                             struct drm_plane_state *old_state);
495
496 void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
497                                     enum pipe pipe);
498
499 int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe,
500                      const struct dpll *dpll);
501 void vlv_force_pll_off(struct drm_i915_private *dev_priv, enum pipe pipe);
502 int lpt_get_iclkip(struct drm_i915_private *dev_priv);
503 bool intel_fuzzy_clock_check(int clock1, int clock2);
504
505 void intel_prepare_reset(struct drm_i915_private *dev_priv);
506 void intel_finish_reset(struct drm_i915_private *dev_priv);
507 void intel_dp_get_m_n(struct intel_crtc *crtc,
508                       struct intel_crtc_state *pipe_config);
509 void intel_dp_set_m_n(const struct intel_crtc_state *crtc_state,
510                       enum link_m_n_set m_n);
511 void intel_dp_ycbcr_420_enable(struct intel_dp *intel_dp,
512                                const struct intel_crtc_state *crtc_state);
513 int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
514 bool bxt_find_best_dpll(struct intel_crtc_state *crtc_state,
515                         struct dpll *best_clock);
516 int chv_calc_dpll_params(int refclk, struct dpll *pll_clock);
517
518 bool intel_crtc_active(struct intel_crtc *crtc);
519 bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state);
520 void hsw_enable_ips(const struct intel_crtc_state *crtc_state);
521 void hsw_disable_ips(const struct intel_crtc_state *crtc_state);
522 enum intel_display_power_domain intel_port_to_power_domain(enum port port);
523 enum intel_display_power_domain
524 intel_aux_power_domain(struct intel_digital_port *dig_port);
525 void intel_mode_from_pipe_config(struct drm_display_mode *mode,
526                                  struct intel_crtc_state *pipe_config);
527 void intel_crtc_arm_fifo_underrun(struct intel_crtc *crtc,
528                                   struct intel_crtc_state *crtc_state);
529
530 u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_center);
531 int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
532 int skl_max_scale(const struct intel_crtc_state *crtc_state,
533                   u32 pixel_format);
534 u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
535                         const struct intel_plane_state *plane_state);
536 u32 glk_plane_color_ctl_crtc(const struct intel_crtc_state *crtc_state);
537 u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
538                   const struct intel_plane_state *plane_state);
539 u32 skl_plane_ctl_crtc(const struct intel_crtc_state *crtc_state);
540 u32 skl_plane_stride(const struct intel_plane_state *plane_state,
541                      int plane);
542 int skl_check_plane_surface(struct intel_plane_state *plane_state);
543 int i9xx_check_plane_surface(struct intel_plane_state *plane_state);
544 int skl_format_to_fourcc(int format, bool rgb_order, bool alpha);
545 unsigned int i9xx_plane_max_stride(struct intel_plane *plane,
546                                    u32 pixel_format, u64 modifier,
547                                    unsigned int rotation);
548 int bdw_get_pipemisc_bpp(struct intel_crtc *crtc);
549
550 struct intel_display_error_state *
551 intel_display_capture_error_state(struct drm_i915_private *dev_priv);
552 void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
553                                      struct intel_display_error_state *error);
554
555 /* modesetting */
556 void intel_modeset_init_hw(struct drm_device *dev);
557 int intel_modeset_init(struct drm_device *dev);
558 void intel_modeset_driver_remove(struct drm_device *dev);
559 int intel_modeset_vga_set_state(struct drm_i915_private *dev_priv, bool state);
560 void intel_display_resume(struct drm_device *dev);
561 void i915_redisable_vga(struct drm_i915_private *dev_priv);
562 void i915_redisable_vga_power_on(struct drm_i915_private *dev_priv);
563 void intel_init_pch_refclk(struct drm_i915_private *dev_priv);
564
565 /* modesetting asserts */
566 void assert_panel_unlocked(struct drm_i915_private *dev_priv,
567                            enum pipe pipe);
568 void assert_pll(struct drm_i915_private *dev_priv,
569                 enum pipe pipe, bool state);
570 #define assert_pll_enabled(d, p) assert_pll(d, p, true)
571 #define assert_pll_disabled(d, p) assert_pll(d, p, false)
572 void assert_dsi_pll(struct drm_i915_private *dev_priv, bool state);
573 #define assert_dsi_pll_enabled(d) assert_dsi_pll(d, true)
574 #define assert_dsi_pll_disabled(d) assert_dsi_pll(d, false)
575 void assert_fdi_rx_pll(struct drm_i915_private *dev_priv,
576                        enum pipe pipe, bool state);
577 #define assert_fdi_rx_pll_enabled(d, p) assert_fdi_rx_pll(d, p, true)
578 #define assert_fdi_rx_pll_disabled(d, p) assert_fdi_rx_pll(d, p, false)
579 void assert_pipe(struct drm_i915_private *dev_priv, enum pipe pipe, bool state);
580 #define assert_pipe_enabled(d, p) assert_pipe(d, p, true)
581 #define assert_pipe_disabled(d, p) assert_pipe(d, p, false)
582
583 /* Use I915_STATE_WARN(x) and I915_STATE_WARN_ON() (rather than WARN() and
584  * WARN_ON()) for hw state sanity checks to check for unexpected conditions
585  * which may not necessarily be a user visible problem.  This will either
586  * WARN() or DRM_ERROR() depending on the verbose_checks moduleparam, to
587  * enable distros and users to tailor their preferred amount of i915 abrt
588  * spam.
589  */
590 #define I915_STATE_WARN(condition, format...) ({                        \
591         int __ret_warn_on = !!(condition);                              \
592         if (unlikely(__ret_warn_on))                                    \
593                 if (!WARN(i915_modparams.verbose_state_checks, format)) \
594                         DRM_ERROR(format);                              \
595         unlikely(__ret_warn_on);                                        \
596 })
597
598 #define I915_STATE_WARN_ON(x)                                           \
599         I915_STATE_WARN((x), "%s", "WARN_ON(" __stringify(x) ")")
600
601 #endif