2 * Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
3 * Copyright (c) 2007-2008 Intel Corporation
4 * Jesse Barnes <jesse.barnes@intel.com>
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:
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
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
26 #ifndef __INTEL_DISPLAY_TYPES_H__
27 #define __INTEL_DISPLAY_TYPES_H__
29 #include <linux/async.h>
30 #include <linux/i2c.h>
31 #include <linux/pwm.h>
32 #include <linux/sched/clock.h>
34 #include <drm/drm_atomic.h>
35 #include <drm/drm_crtc.h>
36 #include <drm/drm_dp_dual_mode_helper.h>
37 #include <drm/drm_dp_mst_helper.h>
38 #include <drm/drm_encoder.h>
39 #include <drm/drm_fb_helper.h>
40 #include <drm/drm_probe_helper.h>
41 #include <drm/drm_rect.h>
42 #include <drm/drm_vblank.h>
43 #include <drm/i915_mei_hdcp_interface.h>
44 #include <media/cec-notifier.h>
50 struct __intel_global_objs_state;
53 * Display related stuff
56 /* these are outputs from the chip - integrated only
57 external chips are via DVO or SDVO output */
58 enum intel_output_type {
59 INTEL_OUTPUT_UNUSED = 0,
60 INTEL_OUTPUT_ANALOG = 1,
62 INTEL_OUTPUT_SDVO = 3,
63 INTEL_OUTPUT_LVDS = 4,
64 INTEL_OUTPUT_TVOUT = 5,
65 INTEL_OUTPUT_HDMI = 6,
69 INTEL_OUTPUT_DDI = 10,
70 INTEL_OUTPUT_DP_MST = 11,
73 enum hdmi_force_audio {
74 HDMI_AUDIO_OFF_DVI = -2, /* no aux data for HDMI-DVI converter */
75 HDMI_AUDIO_OFF, /* force turn off HDMI audio */
76 HDMI_AUDIO_AUTO, /* trust EDID */
77 HDMI_AUDIO_ON, /* force turn on HDMI audio */
80 /* "Broadcast RGB" property */
81 enum intel_broadcast_rgb {
82 INTEL_BROADCAST_RGB_AUTO,
83 INTEL_BROADCAST_RGB_FULL,
84 INTEL_BROADCAST_RGB_LIMITED,
87 struct intel_framebuffer {
88 struct drm_framebuffer base;
89 struct intel_frontbuffer *frontbuffer;
90 struct intel_rotation_info rot_info;
92 /* for each plane in the normal GTT view */
96 /* for each plane in the rotated GTT view for no-CCS formats */
99 unsigned int pitch; /* pixels */
104 struct drm_fb_helper helper;
105 struct intel_framebuffer *fb;
106 struct i915_vma *vma;
107 unsigned long vma_flags;
108 async_cookie_t cookie;
111 /* Whether or not fbdev hpd processing is temporarily suspended */
112 bool hpd_suspended : 1;
113 /* Set when a hotplug was received while HPD processing was
116 bool hpd_waiting : 1;
118 /* Protects hpd_suspended */
119 struct mutex hpd_lock;
122 enum intel_hotplug_state {
123 INTEL_HOTPLUG_UNCHANGED,
124 INTEL_HOTPLUG_CHANGED,
128 struct intel_encoder {
129 struct drm_encoder base;
131 enum intel_output_type type;
135 enum intel_hotplug_state (*hotplug)(struct intel_encoder *encoder,
136 struct intel_connector *connector);
137 enum intel_output_type (*compute_output_type)(struct intel_encoder *,
138 struct intel_crtc_state *,
139 struct drm_connector_state *);
140 int (*compute_config)(struct intel_encoder *,
141 struct intel_crtc_state *,
142 struct drm_connector_state *);
143 int (*compute_config_late)(struct intel_encoder *,
144 struct intel_crtc_state *,
145 struct drm_connector_state *);
146 void (*update_prepare)(struct intel_atomic_state *,
147 struct intel_encoder *,
148 struct intel_crtc *);
149 void (*pre_pll_enable)(struct intel_atomic_state *,
150 struct intel_encoder *,
151 const struct intel_crtc_state *,
152 const struct drm_connector_state *);
153 void (*pre_enable)(struct intel_atomic_state *,
154 struct intel_encoder *,
155 const struct intel_crtc_state *,
156 const struct drm_connector_state *);
157 void (*enable)(struct intel_atomic_state *,
158 struct intel_encoder *,
159 const struct intel_crtc_state *,
160 const struct drm_connector_state *);
161 void (*update_complete)(struct intel_atomic_state *,
162 struct intel_encoder *,
163 struct intel_crtc *);
164 void (*disable)(struct intel_atomic_state *,
165 struct intel_encoder *,
166 const struct intel_crtc_state *,
167 const struct drm_connector_state *);
168 void (*post_disable)(struct intel_atomic_state *,
169 struct intel_encoder *,
170 const struct intel_crtc_state *,
171 const struct drm_connector_state *);
172 void (*post_pll_disable)(struct intel_atomic_state *,
173 struct intel_encoder *,
174 const struct intel_crtc_state *,
175 const struct drm_connector_state *);
176 void (*update_pipe)(struct intel_atomic_state *,
177 struct intel_encoder *,
178 const struct intel_crtc_state *,
179 const struct drm_connector_state *);
180 /* Read out the current hw state of this connector, returning true if
181 * the encoder is active. If the encoder is enabled it also set the pipe
182 * it is connected to in the pipe parameter. */
183 bool (*get_hw_state)(struct intel_encoder *, enum pipe *pipe);
184 /* Reconstructs the equivalent mode flags for the current hardware
185 * state. This must be called _after_ display->get_pipe_config has
186 * pre-filled the pipe config. Note that intel_encoder->base.crtc must
187 * be set correctly before calling this function. */
188 void (*get_config)(struct intel_encoder *,
189 struct intel_crtc_state *pipe_config);
192 * Optional hook called during init/resume to sync any state
193 * stored in the encoder (eg. DP link parameters) wrt. the HW state.
195 void (*sync_state)(struct intel_encoder *encoder,
196 const struct intel_crtc_state *crtc_state);
199 * Optional hook, returning true if this encoder allows a fastset
200 * during the initial commit, false otherwise.
202 bool (*initial_fastset_check)(struct intel_encoder *encoder,
203 struct intel_crtc_state *crtc_state);
206 * Acquires the power domains needed for an active encoder during
207 * hardware state readout.
209 void (*get_power_domains)(struct intel_encoder *encoder,
210 struct intel_crtc_state *crtc_state);
212 * Called during system suspend after all pending requests for the
213 * encoder are flushed (for example for DP AUX transactions) and
214 * device interrupts are disabled.
216 void (*suspend)(struct intel_encoder *);
218 * Called during system reboot/shutdown after all the
219 * encoders have been disabled and suspended.
221 void (*shutdown)(struct intel_encoder *encoder);
222 enum hpd_pin hpd_pin;
223 enum intel_display_power_domain power_domain;
224 /* for communication with audio component; protected by av_mutex */
225 const struct drm_connector *audio_connector;
228 struct intel_panel_bl_funcs {
229 /* Connector and platform specific backlight functions */
230 int (*setup)(struct intel_connector *connector, enum pipe pipe);
231 u32 (*get)(struct intel_connector *connector);
232 void (*set)(const struct drm_connector_state *conn_state, u32 level);
233 void (*disable)(const struct drm_connector_state *conn_state, u32 level);
234 void (*enable)(const struct intel_crtc_state *crtc_state,
235 const struct drm_connector_state *conn_state, u32 level);
236 u32 (*hz_to_pwm)(struct intel_connector *connector, u32 hz);
240 struct drm_display_mode *fixed_mode;
241 struct drm_display_mode *downclock_mode;
250 bool combination_mode; /* gen 2/4 only */
252 bool alternate_pwm_increment; /* lpt+ */
255 bool util_pin_active_low; /* bxt+ */
256 u8 controller; /* bxt+ only */
257 struct pwm_device *pwm;
258 struct pwm_state pwm_state;
263 struct backlight_device *device;
265 const struct intel_panel_bl_funcs *funcs;
266 void (*power)(struct intel_connector *, bool enable);
270 struct intel_digital_port;
272 enum check_link_response {
273 HDCP_LINK_PROTECTED = 0,
274 HDCP_TOPOLOGY_CHANGE,
275 HDCP_LINK_INTEGRITY_FAILURE,
280 * This structure serves as a translation layer between the generic HDCP code
281 * and the bus-specific code. What that means is that HDCP over HDMI differs
282 * from HDCP over DP, so to account for these differences, we need to
283 * communicate with the receiver through this shim.
285 * For completeness, the 2 buses differ in the following ways:
287 * HDCP registers on the receiver are set via DP AUX for DP, and
288 * they are set via DDC for HDMI.
289 * - Receiver register offsets
290 * The offsets of the registers are different for DP vs. HDMI
291 * - Receiver register masks/offsets
292 * For instance, the ready bit for the KSV fifo is in a different
293 * place on DP vs HDMI
294 * - Receiver register names
295 * Seriously. In the DP spec, the 16-bit register containing
296 * downstream information is called BINFO, on HDMI it's called
297 * BSTATUS. To confuse matters further, DP has a BSTATUS register
298 * with a completely different definition.
300 * On HDMI, the ksv fifo is read all at once, whereas on DP it must
301 * be read 3 keys at a time
303 * Since Aksv is hidden in hardware, there's different procedures
304 * to send it over DP AUX vs DDC
306 struct intel_hdcp_shim {
307 /* Outputs the transmitter's An and Aksv values to the receiver. */
308 int (*write_an_aksv)(struct intel_digital_port *dig_port, u8 *an);
310 /* Reads the receiver's key selection vector */
311 int (*read_bksv)(struct intel_digital_port *dig_port, u8 *bksv);
314 * Reads BINFO from DP receivers and BSTATUS from HDMI receivers. The
315 * definitions are the same in the respective specs, but the names are
316 * different. Call it BSTATUS since that's the name the HDMI spec
317 * uses and it was there first.
319 int (*read_bstatus)(struct intel_digital_port *dig_port,
322 /* Determines whether a repeater is present downstream */
323 int (*repeater_present)(struct intel_digital_port *dig_port,
324 bool *repeater_present);
326 /* Reads the receiver's Ri' value */
327 int (*read_ri_prime)(struct intel_digital_port *dig_port, u8 *ri);
329 /* Determines if the receiver's KSV FIFO is ready for consumption */
330 int (*read_ksv_ready)(struct intel_digital_port *dig_port,
333 /* Reads the ksv fifo for num_downstream devices */
334 int (*read_ksv_fifo)(struct intel_digital_port *dig_port,
335 int num_downstream, u8 *ksv_fifo);
337 /* Reads a 32-bit part of V' from the receiver */
338 int (*read_v_prime_part)(struct intel_digital_port *dig_port,
341 /* Enables HDCP signalling on the port */
342 int (*toggle_signalling)(struct intel_digital_port *dig_port,
343 enum transcoder cpu_transcoder,
346 /* Ensures the link is still protected */
347 bool (*check_link)(struct intel_digital_port *dig_port,
348 struct intel_connector *connector);
350 /* Detects panel's hdcp capability. This is optional for HDMI. */
351 int (*hdcp_capable)(struct intel_digital_port *dig_port,
354 /* HDCP adaptation(DP/HDMI) required on the port */
355 enum hdcp_wired_protocol protocol;
357 /* Detects whether sink is HDCP2.2 capable */
358 int (*hdcp_2_2_capable)(struct intel_digital_port *dig_port,
361 /* Write HDCP2.2 messages */
362 int (*write_2_2_msg)(struct intel_digital_port *dig_port,
363 void *buf, size_t size);
365 /* Read HDCP2.2 messages */
366 int (*read_2_2_msg)(struct intel_digital_port *dig_port,
367 u8 msg_id, void *buf, size_t size);
370 * Implementation of DP HDCP2.2 Errata for the communication of stream
371 * type to Receivers. In DP HDCP2.2 Stream type is one of the input to
372 * the HDCP2.2 Cipher for En/De-Cryption. Not applicable for HDMI.
374 int (*config_stream_type)(struct intel_digital_port *dig_port,
375 bool is_repeater, u8 type);
377 /* HDCP2.2 Link Integrity Check */
378 int (*check_2_2_link)(struct intel_digital_port *dig_port);
382 const struct intel_hdcp_shim *shim;
383 /* Mutex for hdcp state of the connector */
386 struct delayed_work check_work;
387 struct work_struct prop_work;
389 /* HDCP1.4 Encryption status */
392 /* HDCP2.2 related definitions */
393 /* Flag indicates whether this connector supports HDCP2.2 or not. */
394 bool hdcp2_supported;
396 /* HDCP2.2 Encryption status */
397 bool hdcp2_encrypted;
400 * Content Stream Type defined by content owner. TYPE0(0x0) content can
401 * flow in the link protected by HDCP2.2 or HDCP1.4, where as TYPE1(0x1)
402 * content can flow only through a link protected by HDCP2.2.
405 struct hdcp_port_data port_data;
411 * Count of ReceiverID_List received. Initialized to 0 at AKE_INIT.
412 * Incremented after processing the RepeaterAuth_Send_ReceiverID_List.
413 * When it rolls over re-auth has to be triggered.
418 * Count of RepeaterAuth_Stream_Manage msg propagated.
419 * Initialized to 0 on AKE_INIT. Incremented after every successful
420 * transmission of RepeaterAuth_Stream_Manage message. When it rolls
421 * over re-Auth has to be triggered.
426 * Work queue to signal the CP_IRQ. Used for the waiters to read the
427 * available information from HDCP DP sink.
429 wait_queue_head_t cp_irq_queue;
430 atomic_t cp_irq_count;
431 int cp_irq_count_cached;
434 * HDCP register access for gen12+ need the transcoder associated.
435 * Transcoder attached to the connector could be changed at modeset.
436 * Hence caching the transcoder here.
438 enum transcoder cpu_transcoder;
441 struct intel_connector {
442 struct drm_connector base;
444 * The fixed encoder this connector is connected to.
446 struct intel_encoder *encoder;
448 /* ACPI device id for ACPI and driver cooperation */
451 /* Reads out the current hw, returning true if the connector is enabled
452 * and active (i.e. dpms ON state). */
453 bool (*get_hw_state)(struct intel_connector *);
455 /* Panel info for eDP and LVDS */
456 struct intel_panel panel;
458 /* Cached EDID for eDP and LVDS. May hold ERR_PTR for invalid EDID. */
460 struct edid *detect_edid;
462 /* Number of times hotplug detection was tried after an HPD interrupt */
465 /* since POLL and HPD connectors may use the same HPD line keep the native
466 state of connector->polled in case hotplug storm detection changes it */
469 struct drm_dp_mst_port *port;
471 struct intel_dp *mst_port;
473 /* Work struct to schedule a uevent on link train failure */
474 struct work_struct modeset_retry_work;
476 struct intel_hdcp hdcp;
479 struct intel_digital_connector_state {
480 struct drm_connector_state base;
482 enum hdmi_force_audio force_audio;
486 #define to_intel_digital_connector_state(x) container_of(x, struct intel_digital_connector_state, base)
500 struct intel_atomic_state {
501 struct drm_atomic_state base;
503 intel_wakeref_t wakeref;
505 struct __intel_global_objs_state *global_objs;
508 bool dpll_set, modeset;
510 struct intel_shared_dpll_state shared_dpll[I915_NUM_PLLS];
513 * Current watermarks can't be trusted during hardware readout, so
514 * don't bother calculating intermediate watermarks.
516 bool skip_intermediate_wm;
518 bool rps_interactive;
520 struct i915_sw_fence commit_ready;
522 struct llist_node freed;
525 struct intel_plane_state {
526 struct drm_plane_state uapi;
529 * actual hardware state, the state we program to the hardware.
530 * The following members are used to verify the hardware state:
531 * During initial hw readout, they need to be copied from uapi.
534 struct drm_crtc *crtc;
535 struct drm_framebuffer *fb;
538 uint16_t pixel_blend_mode;
539 unsigned int rotation;
540 enum drm_color_encoding color_encoding;
541 enum drm_color_range color_range;
542 enum drm_scaling_filter scaling_filter;
545 struct i915_ggtt_view view;
546 struct i915_vma *vma;
548 #define PLANE_HAS_FENCE BIT(0)
554 * bytes for 0/180 degree rotation
555 * pixels for 90/270 degree rotation
561 /* plane control register */
564 /* plane color control register */
567 /* chroma upsampler control register */
572 * = -1 : not using a scaler
573 * >= 0 : using a scalers
575 * plane requiring a scaler:
576 * - During check_plane, its bit is set in
577 * crtc_state->scaler_state.scaler_users by calling helper function
578 * update_scaler_plane.
579 * - scaler_id indicates the scaler it got assigned.
581 * plane doesn't require a scaler:
582 * - this can happen when scaling is no more required or plane simply
584 * - During check_plane, corresponding bit is reset in
585 * crtc_state->scaler_state.scaler_users by calling helper function
586 * update_scaler_plane.
591 * planar_linked_plane:
593 * ICL planar formats require 2 planes that are updated as pairs.
594 * This member is used to make sure the other plane is also updated
595 * when required, and for update_slave() to find the correct
596 * plane_state to pass as argument.
598 struct intel_plane *planar_linked_plane;
602 * If set don't update use the linked plane's state for updating
603 * this plane during atomic commit with the update_slave() callback.
605 * It's also used by the watermark code to ignore wm calculations on
606 * this plane. They're calculated by the linked plane's wm code.
610 struct drm_intel_sprite_colorkey ckey;
612 struct drm_rect psr2_sel_fetch_area;
615 struct intel_initial_plane_config {
616 struct intel_framebuffer *fb;
617 struct i915_vma *vma;
624 struct intel_scaler {
629 struct intel_crtc_scaler_state {
630 #define SKL_NUM_SCALERS 2
631 struct intel_scaler scalers[SKL_NUM_SCALERS];
634 * scaler_users: keeps track of users requesting scalers on this crtc.
636 * If a bit is set, a user is using a scaler.
637 * Here user can be a plane or crtc as defined below:
638 * bits 0-30 - plane (bit position is index from drm_plane_index)
641 * Instead of creating a new index to cover planes and crtc, using
642 * existing drm_plane_index for planes which is well less than 31
643 * planes and bit 31 for crtc. This should be fine to cover all
646 * intel_atomic_setup_scalers will setup available scalers to users
647 * requesting scalers. It will gracefully fail if request exceeds
650 #define SKL_CRTC_INDEX 31
651 unsigned scaler_users;
653 /* scaler used by crtc for panel fitting purpose */
657 /* {crtc,crtc_state}->mode_flags */
658 /* Flag to get scanline using frame time stamps */
659 #define I915_MODE_FLAG_GET_SCANLINE_FROM_TIMESTAMP (1<<1)
660 /* Flag to use the scanline counter instead of the pixel counter */
661 #define I915_MODE_FLAG_USE_SCANLINE_COUNTER (1<<2)
663 * TE0 or TE1 flag is set if the crtc has a DSI encoder which
664 * is operating in command mode.
665 * Flag to use TE from DSI0 instead of VBI in command mode
667 #define I915_MODE_FLAG_DSI_USE_TE0 (1<<3)
668 /* Flag to use TE from DSI1 instead of VBI in command mode */
669 #define I915_MODE_FLAG_DSI_USE_TE1 (1<<4)
670 /* Flag to indicate mipi dsi periodic command mode where we do not get TE */
671 #define I915_MODE_FLAG_DSI_PERIODIC_CMD_MODE (1<<5)
673 struct intel_wm_level {
681 struct intel_pipe_wm {
682 struct intel_wm_level wm[5];
685 bool sprites_enabled;
689 struct skl_wm_level {
698 struct skl_plane_wm {
699 struct skl_wm_level wm[8];
700 struct skl_wm_level uv_wm[8];
701 struct skl_wm_level trans_wm;
702 struct skl_wm_level sagv_wm0;
707 struct skl_plane_wm planes[I915_MAX_PLANES];
714 VLV_WM_LEVEL_DDR_DVFS,
718 struct vlv_wm_state {
719 struct g4x_pipe_wm wm[NUM_VLV_WM_LEVELS];
720 struct g4x_sr_wm sr[NUM_VLV_WM_LEVELS];
725 struct vlv_fifo_state {
726 u16 plane[I915_MAX_PLANES];
736 struct g4x_wm_state {
737 struct g4x_pipe_wm wm;
739 struct g4x_sr_wm hpll;
745 struct intel_crtc_wm_state {
749 * The "raw" watermark values produced by the formula
750 * given the plane's current state. They do not consider
751 * how much FIFO is actually allocated for each plane.
754 * The "optimal" watermark values given the current
755 * state of the planes and the amount of FIFO
756 * allocated to each, ignoring any previous state
760 * The "intermediate" watermark values when transitioning
761 * between the old and new "optimal" values. Used when
762 * the watermark registers are single buffered and hence
763 * their state changes asynchronously with regards to the
764 * actual plane registers. These are essentially the
765 * worst case combination of the old and new "optimal"
766 * watermarks, which are therefore safe to use when the
767 * plane is in either its old or new state.
770 struct intel_pipe_wm intermediate;
771 struct intel_pipe_wm optimal;
775 struct skl_pipe_wm raw;
776 /* gen9+ only needs 1-step wm programming */
777 struct skl_pipe_wm optimal;
778 struct skl_ddb_entry ddb;
779 struct skl_ddb_entry plane_ddb_y[I915_MAX_PLANES];
780 struct skl_ddb_entry plane_ddb_uv[I915_MAX_PLANES];
784 struct g4x_pipe_wm raw[NUM_VLV_WM_LEVELS]; /* not inverted */
785 struct vlv_wm_state intermediate; /* inverted */
786 struct vlv_wm_state optimal; /* inverted */
787 struct vlv_fifo_state fifo_state;
791 struct g4x_pipe_wm raw[NUM_G4X_WM_LEVELS];
792 struct g4x_wm_state intermediate;
793 struct g4x_wm_state optimal;
798 * Platforms with two-step watermark programming will need to
799 * update watermark programming post-vblank to switch from the
800 * safe intermediate watermarks to the optimal final
803 bool need_postvbl_update;
806 enum intel_output_format {
807 INTEL_OUTPUT_FORMAT_INVALID,
808 INTEL_OUTPUT_FORMAT_RGB,
809 INTEL_OUTPUT_FORMAT_YCBCR420,
810 INTEL_OUTPUT_FORMAT_YCBCR444,
813 struct intel_crtc_state {
815 * uapi (drm) state. This is the software state shown to userspace.
816 * In particular, the following members are used for bookkeeping:
824 struct drm_crtc_state uapi;
827 * actual hardware state, the state we program to the hardware.
828 * The following members are used to verify the hardware state:
831 * - mode / pipe_mode / adjusted_mode
832 * - color property blobs.
834 * During initial hw readout, they need to be copied to uapi.
836 * Bigjoiner will allow a transcoder mode that spans 2 pipes;
837 * Use the pipe_mode for calculations like watermarks, pipe
838 * scaler, and bandwidth.
840 * Use adjusted_mode for things that need to know the full
841 * mode on the transcoder, which spans all pipes.
845 struct drm_property_blob *degamma_lut, *gamma_lut, *ctm;
846 struct drm_display_mode mode, pipe_mode, adjusted_mode;
847 enum drm_scaling_filter scaling_filter;
851 * quirks - bitfield with hw state readout quirks
853 * For various reasons the hw state readout code might not be able to
854 * completely faithfully read out the current state. These cases are
855 * tracked with quirk flags so that fastboot and state checker can act
858 #define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */
859 #define PIPE_CONFIG_QUIRK_BIGJOINER_SLAVE (1<<1) /* bigjoiner slave, partial readout */
860 unsigned long quirks;
862 unsigned fb_bits; /* framebuffers to flip */
863 bool update_pipe; /* can a fast modeset be performed? */
865 bool update_wm_pre, update_wm_post; /* watermarks are updated */
866 bool fifo_changed; /* FIFO split is changed */
868 bool inherited; /* state inherited from BIOS? */
870 /* Pipe source size (ie. panel fitter input size)
871 * All planes will be positioned inside this space,
872 * and get clipped at the edges. */
873 int pipe_src_w, pipe_src_h;
876 * Pipe pixel rate, adjusted for
877 * panel fitter/pipe scaler downscaling.
879 unsigned int pixel_rate;
881 /* Whether to set up the PCH/FDI. Note that we never allow sharing
882 * between pch encoders and cpu encoders. */
883 bool has_pch_encoder;
885 /* Are we sending infoframes on the attached port */
888 /* CPU Transcoder for the pipe. Currently this can only differ from the
889 * pipe on Haswell and later (where we have a special eDP transcoder)
890 * and Broxton (where we have special DSI transcoders). */
891 enum transcoder cpu_transcoder;
894 * Use reduced/limited/broadcast rbg range, compressing from the full
895 * range fed into the crtcs.
897 bool limited_color_range;
899 /* Bitmask of encoder types (enum intel_output_type)
900 * driven by the pipe.
902 unsigned int output_types;
904 /* Whether we should send NULL infoframes. Required for audio. */
907 /* Audio enabled on this pipe. Only valid if either has_hdmi_sink or
908 * has_dp_encoder is set. */
912 * Enable dithering, used when the selected pipe bpp doesn't match the
918 * Dither gets enabled for 18bpp which causes CRC mismatch errors for
919 * compliance video pattern tests.
920 * Disable dither only if it is a compliance test request for
923 bool dither_force_disable;
925 /* Controls for the clock computation, to override various stages. */
928 /* SDVO TV has a bunch of special case. To make multifunction encoders
929 * work correctly, we need to track this at runtime.*/
933 * crtc bandwidth limit, don't increase pipe bpp or clock if not really
934 * required. This is set in the 2nd loop of calling encoder's
935 * ->compute_config if the first pick doesn't work out.
939 /* Settings for the intel dpll used on pretty much everything but
943 /* Selected dpll when shared or NULL. */
944 struct intel_shared_dpll *shared_dpll;
946 /* Actual register state of the dpll, for shared dpll cross-checking. */
947 struct intel_dpll_hw_state dpll_hw_state;
950 * ICL reserved DPLLs for the CRTC/port. The active PLL is selected by
951 * setting shared_dpll and dpll_hw_state to one of these reserved ones.
953 struct icl_port_dpll {
954 struct intel_shared_dpll *pll;
955 struct intel_dpll_hw_state hw_state;
956 } icl_port_dplls[ICL_PORT_DPLL_COUNT];
958 /* DSI PLL registers */
964 struct intel_link_m_n dp_m_n;
966 /* m2_n2 for eDP downclock */
967 struct intel_link_m_n dp_m2_n2;
972 bool enable_psr2_sel_fetch;
976 * Frequence the dpll for the port should run at. Differs from the
977 * adjusted dotclock e.g. for DP or 10/12bpc hdmi mode. This is also
978 * already multiplied by pixel_multiplier.
982 /* Used by SDVO (and if we ever fix it, HDMI). */
983 unsigned pixel_multiplier;
985 /* I915_MODE_FLAG_* */
991 * Used by platforms having DP/HDMI PHY with programmable lane
992 * latency optimization.
994 u8 lane_lat_optim_mask;
996 /* minimum acceptable voltage level */
997 u8 min_voltage_level;
999 /* Panel fitter controls for gen2-gen4 + VLV */
1003 u32 lvds_border_bits;
1006 /* Panel fitter placement and size for Ironlake+ */
1008 struct drm_rect dst;
1013 /* FDI configuration, only valid if has_pch_encoder is set. */
1015 struct intel_link_m_n fdi_m_n;
1027 struct intel_crtc_scaler_state scaler_state;
1029 /* w/a for waiting 2 vblanks during crtc enable */
1030 enum pipe hsw_workaround_pipe;
1032 /* IVB sprite scaling w/a (WaCxSRDisabledForSpriteScaling:ivb) */
1035 struct intel_crtc_wm_state wm;
1037 int min_cdclk[I915_MAX_PLANES];
1039 u32 data_rate[I915_MAX_PLANES];
1041 /* FIXME unify with data_rate[] */
1042 u64 plane_data_rate[I915_MAX_PLANES];
1043 u64 uv_plane_data_rate[I915_MAX_PLANES];
1045 /* Gamma mode programmed on the pipe */
1049 /* CSC mode programmed on the pipe */
1056 /* bitmask of logically enabled planes (enum plane_id) */
1059 /* bitmask of actually visible planes (enum plane_id) */
1064 /* bitmask of planes that will be updated during the commit */
1070 union hdmi_infoframe avi;
1071 union hdmi_infoframe spd;
1072 union hdmi_infoframe hdmi;
1073 union hdmi_infoframe drm;
1074 struct drm_dp_vsc_sdp vsc;
1077 /* HDMI scrambling status */
1078 bool hdmi_scrambling;
1080 /* HDMI High TMDS char rate ratio */
1081 bool hdmi_high_tmds_clock_ratio;
1083 /* Output format RGB/YCBCR etc */
1084 enum intel_output_format output_format;
1086 /* enable pipe gamma? */
1089 /* enable pipe csc? */
1092 /* enable pipe big joiner? */
1095 /* big joiner slave crtc? */
1096 bool bigjoiner_slave;
1098 /* linked crtc for bigjoiner, either slave or master */
1099 struct intel_crtc *bigjoiner_linked_crtc;
1101 /* Display Stream compression state */
1103 bool compression_enable;
1107 struct drm_dsc_config config;
1110 /* HSW+ linetime watermarks */
1114 /* Forward Error correction State */
1117 /* Pointer to master transcoder in case of tiled displays */
1118 enum transcoder master_transcoder;
1120 /* Bitmask to indicate slaves attached */
1121 u8 sync_mode_slaves_mask;
1123 /* Only valid on TGL+ */
1124 enum transcoder mst_master_transcoder;
1126 /* For DSB related info */
1127 struct intel_dsb *dsb;
1129 u32 psr2_man_track_ctl;
1132 enum intel_pipe_crc_source {
1133 INTEL_PIPE_CRC_SOURCE_NONE,
1134 INTEL_PIPE_CRC_SOURCE_PLANE1,
1135 INTEL_PIPE_CRC_SOURCE_PLANE2,
1136 INTEL_PIPE_CRC_SOURCE_PLANE3,
1137 INTEL_PIPE_CRC_SOURCE_PLANE4,
1138 INTEL_PIPE_CRC_SOURCE_PLANE5,
1139 INTEL_PIPE_CRC_SOURCE_PLANE6,
1140 INTEL_PIPE_CRC_SOURCE_PLANE7,
1141 INTEL_PIPE_CRC_SOURCE_PIPE,
1142 /* TV/DP on pre-gen5/vlv can't use the pipe source. */
1143 INTEL_PIPE_CRC_SOURCE_TV,
1144 INTEL_PIPE_CRC_SOURCE_DP_B,
1145 INTEL_PIPE_CRC_SOURCE_DP_C,
1146 INTEL_PIPE_CRC_SOURCE_DP_D,
1147 INTEL_PIPE_CRC_SOURCE_AUTO,
1148 INTEL_PIPE_CRC_SOURCE_MAX,
1151 #define INTEL_PIPE_CRC_ENTRIES_NR 128
1152 struct intel_pipe_crc {
1155 enum intel_pipe_crc_source source;
1159 struct drm_crtc base;
1162 * Whether the crtc and the connected output pipeline is active. Implies
1163 * that crtc->enabled is set, i.e. the current mode configuration has
1164 * some outputs connected to this crtc.
1169 /* I915_MODE_FLAG_* */
1172 struct intel_display_power_domain_set enabled_power_domains;
1173 struct intel_overlay *overlay;
1175 struct intel_crtc_state *config;
1177 /* Access to these should be protected by dev_priv->irq_lock. */
1178 bool cpu_fifo_underrun_disabled;
1179 bool pch_fifo_underrun_disabled;
1181 /* per-pipe watermark state */
1183 /* watermarks currently being used */
1185 struct intel_pipe_wm ilk;
1186 struct vlv_wm_state vlv;
1187 struct g4x_wm_state g4x;
1191 int scanline_offset;
1194 unsigned start_vbl_count;
1195 ktime_t start_vbl_time;
1196 int min_vbl, max_vbl;
1198 #ifdef CONFIG_DRM_I915_DEBUG_VBLANK_EVADE
1204 unsigned int times[17]; /* [1us, 16ms] */
1209 /* scalers available on this crtc */
1212 #ifdef CONFIG_DEBUG_FS
1213 struct intel_pipe_crc pipe_crc;
1217 struct intel_plane {
1218 struct drm_plane base;
1219 enum i9xx_plane_id i9xx_plane;
1224 u32 frontbuffer_bit;
1227 u32 base, cntl, size;
1231 * NOTE: Do not place new plane state fields here (e.g., when adding
1232 * new plane properties). New runtime state should now be placed in
1233 * the intel_plane_state structure and accessed via plane_state.
1236 int (*min_width)(const struct drm_framebuffer *fb,
1238 unsigned int rotation);
1239 int (*max_width)(const struct drm_framebuffer *fb,
1241 unsigned int rotation);
1242 int (*max_height)(const struct drm_framebuffer *fb,
1244 unsigned int rotation);
1245 unsigned int (*max_stride)(struct intel_plane *plane,
1246 u32 pixel_format, u64 modifier,
1247 unsigned int rotation);
1248 void (*update_plane)(struct intel_plane *plane,
1249 const struct intel_crtc_state *crtc_state,
1250 const struct intel_plane_state *plane_state);
1251 void (*disable_plane)(struct intel_plane *plane,
1252 const struct intel_crtc_state *crtc_state);
1253 bool (*get_hw_state)(struct intel_plane *plane, enum pipe *pipe);
1254 int (*check_plane)(struct intel_crtc_state *crtc_state,
1255 struct intel_plane_state *plane_state);
1256 int (*min_cdclk)(const struct intel_crtc_state *crtc_state,
1257 const struct intel_plane_state *plane_state);
1258 void (*async_flip)(struct intel_plane *plane,
1259 const struct intel_crtc_state *crtc_state,
1260 const struct intel_plane_state *plane_state);
1263 struct intel_watermark_params {
1271 struct cxsr_latency {
1272 bool is_desktop : 1;
1277 u16 display_hpll_disable;
1279 u16 cursor_hpll_disable;
1282 #define to_intel_atomic_state(x) container_of(x, struct intel_atomic_state, base)
1283 #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
1284 #define to_intel_crtc_state(x) container_of(x, struct intel_crtc_state, uapi)
1285 #define to_intel_connector(x) container_of(x, struct intel_connector, base)
1286 #define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
1287 #define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
1288 #define to_intel_plane(x) container_of(x, struct intel_plane, base)
1289 #define to_intel_plane_state(x) container_of(x, struct intel_plane_state, uapi)
1290 #define intel_fb_obj(x) ((x) ? to_intel_bo((x)->obj[0]) : NULL)
1293 i915_reg_t hdmi_reg;
1296 enum drm_dp_dual_mode_type type;
1301 struct intel_connector *attached_connector;
1302 struct cec_notifier *cec_notifier;
1305 struct intel_dp_mst_encoder;
1307 * enum link_m_n_set:
1308 * When platform provides two set of M_N registers for dp, we can
1309 * program them and switch between them incase of DRRS.
1310 * But When only one such register is provided, we have to program the
1311 * required divider value on that registers itself based on the DRRS state.
1313 * M1_N1 : Program dp_m_n on M1_N1 registers
1314 * dp_m2_n2 on M2_N2 registers (If supported)
1316 * M2_N2 : Program dp_m2_n2 on M1_N1 registers
1317 * M2_N2 registers are not supported
1321 /* Sets the m1_n1 and m2_n2 */
1326 struct intel_dp_compliance_data {
1329 u16 hdisplay, vdisplay;
1331 struct drm_dp_phy_test_params phytest;
1334 struct intel_dp_compliance {
1335 unsigned long test_type;
1336 struct intel_dp_compliance_data test_data;
1343 i915_reg_t output_reg;
1351 bool reset_link_params;
1352 u8 dpcd[DP_RECEIVER_CAP_SIZE];
1353 u8 psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE];
1354 u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
1355 u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
1356 u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE];
1357 u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE];
1358 u8 lttpr_phy_caps[DP_MAX_LTTPR_COUNT][DP_LTTPR_PHY_CAP_SIZE];
1361 int num_source_rates;
1362 const int *source_rates;
1363 /* sink rates as reported by DP_MAX_LINK_RATE/DP_SUPPORTED_LINK_RATES */
1365 int sink_rates[DP_MAX_SUPPORTED_RATES];
1366 bool use_rate_select;
1367 /* intersection of source and sink rates */
1368 int num_common_rates;
1369 int common_rates[DP_MAX_SUPPORTED_RATES];
1370 /* Max lane count for the current link */
1371 int max_link_lane_count;
1372 /* Max rate for the current link */
1374 /* sink or branch descriptor */
1375 struct drm_dp_desc desc;
1377 struct drm_dp_aux aux;
1378 u32 aux_busy_last_status;
1380 int panel_power_up_delay;
1381 int panel_power_down_delay;
1382 int panel_power_cycle_delay;
1383 int backlight_on_delay;
1384 int backlight_off_delay;
1385 struct delayed_work panel_vdd_work;
1386 bool want_panel_vdd;
1387 unsigned long last_power_on;
1388 unsigned long last_backlight_off;
1389 ktime_t panel_power_off_time;
1390 intel_wakeref_t vdd_wakeref;
1393 * Pipe whose power sequencer is currently locked into
1394 * this port. Only relevant on VLV/CHV.
1398 * Pipe currently driving the port. Used for preventing
1399 * the use of the PPS for any pipe currentrly driving
1400 * external DP as that will mess things up on VLV.
1402 enum pipe active_pipe;
1404 * Set if the sequencer may be reset due to a power transition,
1405 * requiring a reinitialization. Only relevant on BXT.
1408 struct edp_power_seq pps_delays;
1410 bool can_mst; /* this port supports mst */
1412 int active_mst_links;
1414 /* connector directly attached - won't be use for modeset in mst world */
1415 struct intel_connector *attached_connector;
1417 /* mst connector list */
1418 struct intel_dp_mst_encoder *mst_encoders[I915_MAX_PIPES];
1419 struct drm_dp_mst_topology_mgr mst_mgr;
1421 u32 (*get_aux_clock_divider)(struct intel_dp *dp, int index);
1423 * This function returns the value we have to program the AUX_CTL
1424 * register with to kick off an AUX transaction.
1426 u32 (*get_aux_send_ctl)(struct intel_dp *dp, int send_bytes,
1427 u32 aux_clock_divider);
1429 i915_reg_t (*aux_ch_ctl_reg)(struct intel_dp *dp);
1430 i915_reg_t (*aux_ch_data_reg)(struct intel_dp *dp, int index);
1432 /* This is called before a link training is starterd */
1433 void (*prepare_link_retrain)(struct intel_dp *intel_dp,
1434 const struct intel_crtc_state *crtc_state);
1435 void (*set_link_train)(struct intel_dp *intel_dp,
1436 const struct intel_crtc_state *crtc_state,
1438 void (*set_idle_link_train)(struct intel_dp *intel_dp,
1439 const struct intel_crtc_state *crtc_state);
1440 void (*set_signal_levels)(struct intel_dp *intel_dp,
1441 const struct intel_crtc_state *crtc_state);
1443 u8 (*preemph_max)(struct intel_dp *intel_dp);
1444 u8 (*voltage_max)(struct intel_dp *intel_dp,
1445 const struct intel_crtc_state *crtc_state);
1447 /* Displayport compliance testing */
1448 struct intel_dp_compliance compliance;
1450 /* Downstream facing port caps */
1452 int min_tmds_clock, max_tmds_clock;
1455 bool ycbcr_444_to_420;
1458 /* To control wakeup latency, e.g. for irq-driven dp aux transfers. */
1459 struct pm_qos_request pm_qos;
1461 /* Display stream compression testing */
1468 enum lspcon_vendor {
1470 LSPCON_VENDOR_PARADE
1473 struct intel_lspcon {
1476 enum drm_lspcon_mode mode;
1477 enum lspcon_vendor vendor;
1480 struct intel_digital_port {
1481 struct intel_encoder base;
1482 u32 saved_port_bits;
1484 struct intel_hdmi hdmi;
1485 struct intel_lspcon lspcon;
1486 enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
1487 bool release_cl2_override;
1489 /* Used for DP and ICL+ TypeC/DP and TypeC/HDMI ports. */
1491 enum intel_display_power_domain ddi_io_power_domain;
1492 intel_wakeref_t ddi_io_wakeref;
1493 intel_wakeref_t aux_wakeref;
1494 struct mutex tc_lock; /* protects the TypeC port mode */
1495 intel_wakeref_t tc_lock_wakeref;
1496 int tc_link_refcount;
1497 bool tc_legacy_port:1;
1498 char tc_port_name[8];
1499 enum tc_port_mode tc_mode;
1500 enum phy_fia tc_phy_fia;
1503 /* protects num_hdcp_streams reference count */
1504 struct mutex hdcp_mutex;
1505 /* the number of pipes using HDCP signalling out of this port */
1506 unsigned int num_hdcp_streams;
1508 void (*write_infoframe)(struct intel_encoder *encoder,
1509 const struct intel_crtc_state *crtc_state,
1511 const void *frame, ssize_t len);
1512 void (*read_infoframe)(struct intel_encoder *encoder,
1513 const struct intel_crtc_state *crtc_state,
1515 void *frame, ssize_t len);
1516 void (*set_infoframes)(struct intel_encoder *encoder,
1518 const struct intel_crtc_state *crtc_state,
1519 const struct drm_connector_state *conn_state);
1520 u32 (*infoframes_enabled)(struct intel_encoder *encoder,
1521 const struct intel_crtc_state *pipe_config);
1522 bool (*connected)(struct intel_encoder *encoder);
1525 struct intel_dp_mst_encoder {
1526 struct intel_encoder base;
1528 struct intel_digital_port *primary;
1529 struct intel_connector *connector;
1532 static inline enum dpio_channel
1533 vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
1535 switch (dig_port->base.port) {
1546 static inline enum dpio_phy
1547 vlv_dig_port_to_phy(struct intel_digital_port *dig_port)
1549 switch (dig_port->base.port) {
1560 static inline enum dpio_channel
1561 vlv_pipe_to_channel(enum pipe pipe)
1574 static inline struct intel_crtc *
1575 intel_get_first_crtc(struct drm_i915_private *dev_priv)
1577 return to_intel_crtc(drm_crtc_from_index(&dev_priv->drm, 0));
1580 static inline struct intel_crtc *
1581 intel_get_crtc_for_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
1583 /* pipe_to_crtc_mapping may have hole on any of 3 display pipe system */
1584 drm_WARN_ON(&dev_priv->drm,
1585 !(INTEL_INFO(dev_priv)->pipe_mask & BIT(pipe)));
1586 return dev_priv->pipe_to_crtc_mapping[pipe];
1589 static inline struct intel_crtc *
1590 intel_get_crtc_for_plane(struct drm_i915_private *dev_priv, enum i9xx_plane_id plane)
1592 return dev_priv->plane_to_crtc_mapping[plane];
1595 struct intel_load_detect_pipe {
1596 struct drm_atomic_state *restore_state;
1599 static inline struct intel_encoder *
1600 intel_attached_encoder(struct intel_connector *connector)
1602 return connector->encoder;
1605 static inline bool intel_encoder_is_dig_port(struct intel_encoder *encoder)
1607 switch (encoder->type) {
1608 case INTEL_OUTPUT_DDI:
1609 case INTEL_OUTPUT_DP:
1610 case INTEL_OUTPUT_EDP:
1611 case INTEL_OUTPUT_HDMI:
1618 static inline bool intel_encoder_is_mst(struct intel_encoder *encoder)
1620 return encoder->type == INTEL_OUTPUT_DP_MST;
1623 static inline struct intel_dp_mst_encoder *
1624 enc_to_mst(struct intel_encoder *encoder)
1626 return container_of(&encoder->base, struct intel_dp_mst_encoder,
1630 static inline struct intel_digital_port *
1631 enc_to_dig_port(struct intel_encoder *encoder)
1633 struct intel_encoder *intel_encoder = encoder;
1635 if (intel_encoder_is_dig_port(intel_encoder))
1636 return container_of(&encoder->base, struct intel_digital_port,
1638 else if (intel_encoder_is_mst(intel_encoder))
1639 return enc_to_mst(encoder)->primary;
1644 static inline struct intel_digital_port *
1645 intel_attached_dig_port(struct intel_connector *connector)
1647 return enc_to_dig_port(intel_attached_encoder(connector));
1650 static inline struct intel_dp *enc_to_intel_dp(struct intel_encoder *encoder)
1652 return &enc_to_dig_port(encoder)->dp;
1655 static inline struct intel_dp *intel_attached_dp(struct intel_connector *connector)
1657 return enc_to_intel_dp(intel_attached_encoder(connector));
1660 static inline bool intel_encoder_is_dp(struct intel_encoder *encoder)
1662 switch (encoder->type) {
1663 case INTEL_OUTPUT_DP:
1664 case INTEL_OUTPUT_EDP:
1666 case INTEL_OUTPUT_DDI:
1667 /* Skip pure HDMI/DVI DDI encoders */
1668 return i915_mmio_reg_valid(enc_to_intel_dp(encoder)->output_reg);
1674 static inline struct intel_lspcon *
1675 enc_to_intel_lspcon(struct intel_encoder *encoder)
1677 return &enc_to_dig_port(encoder)->lspcon;
1680 static inline struct intel_digital_port *
1681 dp_to_dig_port(struct intel_dp *intel_dp)
1683 return container_of(intel_dp, struct intel_digital_port, dp);
1686 static inline struct intel_lspcon *
1687 dp_to_lspcon(struct intel_dp *intel_dp)
1689 return &dp_to_dig_port(intel_dp)->lspcon;
1692 static inline struct drm_i915_private *
1693 dp_to_i915(struct intel_dp *intel_dp)
1695 return to_i915(dp_to_dig_port(intel_dp)->base.base.dev);
1698 static inline struct intel_digital_port *
1699 hdmi_to_dig_port(struct intel_hdmi *intel_hdmi)
1701 return container_of(intel_hdmi, struct intel_digital_port, hdmi);
1704 static inline struct intel_plane_state *
1705 intel_atomic_get_plane_state(struct intel_atomic_state *state,
1706 struct intel_plane *plane)
1708 struct drm_plane_state *ret =
1709 drm_atomic_get_plane_state(&state->base, &plane->base);
1712 return ERR_CAST(ret);
1714 return to_intel_plane_state(ret);
1717 static inline struct intel_plane_state *
1718 intel_atomic_get_old_plane_state(struct intel_atomic_state *state,
1719 struct intel_plane *plane)
1721 return to_intel_plane_state(drm_atomic_get_old_plane_state(&state->base,
1725 static inline struct intel_plane_state *
1726 intel_atomic_get_new_plane_state(struct intel_atomic_state *state,
1727 struct intel_plane *plane)
1729 return to_intel_plane_state(drm_atomic_get_new_plane_state(&state->base,
1733 static inline struct intel_crtc_state *
1734 intel_atomic_get_old_crtc_state(struct intel_atomic_state *state,
1735 struct intel_crtc *crtc)
1737 return to_intel_crtc_state(drm_atomic_get_old_crtc_state(&state->base,
1741 static inline struct intel_crtc_state *
1742 intel_atomic_get_new_crtc_state(struct intel_atomic_state *state,
1743 struct intel_crtc *crtc)
1745 return to_intel_crtc_state(drm_atomic_get_new_crtc_state(&state->base,
1749 static inline struct intel_digital_connector_state *
1750 intel_atomic_get_new_connector_state(struct intel_atomic_state *state,
1751 struct intel_connector *connector)
1753 return to_intel_digital_connector_state(
1754 drm_atomic_get_new_connector_state(&state->base,
1758 static inline struct intel_digital_connector_state *
1759 intel_atomic_get_old_connector_state(struct intel_atomic_state *state,
1760 struct intel_connector *connector)
1762 return to_intel_digital_connector_state(
1763 drm_atomic_get_old_connector_state(&state->base,
1767 /* intel_display.c */
1769 intel_crtc_has_type(const struct intel_crtc_state *crtc_state,
1770 enum intel_output_type type)
1772 return crtc_state->output_types & (1 << type);
1775 intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state)
1777 return crtc_state->output_types &
1778 ((1 << INTEL_OUTPUT_DP) |
1779 (1 << INTEL_OUTPUT_DP_MST) |
1780 (1 << INTEL_OUTPUT_EDP));
1784 intel_crtc_needs_modeset(const struct intel_crtc_state *crtc_state)
1786 return drm_atomic_crtc_needs_modeset(&crtc_state->uapi);
1790 intel_wait_for_vblank(struct drm_i915_private *dev_priv, enum pipe pipe)
1792 struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
1794 drm_crtc_wait_one_vblank(&crtc->base);
1798 intel_wait_for_vblank_if_active(struct drm_i915_private *dev_priv, enum pipe pipe)
1800 const struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
1803 intel_wait_for_vblank(dev_priv, pipe);
1806 static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state)
1808 return i915_ggtt_offset(state->vma);
1811 static inline struct intel_frontbuffer *
1812 to_intel_frontbuffer(struct drm_framebuffer *fb)
1814 return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL;
1817 #endif /* __INTEL_DISPLAY_TYPES_H__ */