diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 288 |
1 files changed, 201 insertions, 87 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e0fffd883b54..2007c69468b9 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -219,10 +219,8 @@ intel_fdi_link_freq(struct drm_i915_private *dev_priv, | |||
219 | { | 219 | { |
220 | if (HAS_DDI(dev_priv)) | 220 | if (HAS_DDI(dev_priv)) |
221 | return pipe_config->port_clock; /* SPLL */ | 221 | return pipe_config->port_clock; /* SPLL */ |
222 | else if (IS_GEN5(dev_priv)) | ||
223 | return ((I915_READ(FDI_PLL_BIOS_0) & FDI_PLL_FB_CLOCK_MASK) + 2) * 10000; | ||
224 | else | 222 | else |
225 | return 270000; | 223 | return dev_priv->fdi_pll_freq; |
226 | } | 224 | } |
227 | 225 | ||
228 | static const struct intel_limit intel_limits_i8xx_dac = { | 226 | static const struct intel_limit intel_limits_i8xx_dac = { |
@@ -1703,7 +1701,7 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, | |||
1703 | u32 port_mask; | 1701 | u32 port_mask; |
1704 | i915_reg_t dpll_reg; | 1702 | i915_reg_t dpll_reg; |
1705 | 1703 | ||
1706 | switch (dport->port) { | 1704 | switch (dport->base.port) { |
1707 | case PORT_B: | 1705 | case PORT_B: |
1708 | port_mask = DPLL_PORTB_READY_MASK; | 1706 | port_mask = DPLL_PORTB_READY_MASK; |
1709 | dpll_reg = DPLL(0); | 1707 | dpll_reg = DPLL(0); |
@@ -1725,7 +1723,8 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, | |||
1725 | dpll_reg, port_mask, expected_mask, | 1723 | dpll_reg, port_mask, expected_mask, |
1726 | 1000)) | 1724 | 1000)) |
1727 | WARN(1, "timed out waiting for port %c ready: got 0x%x, expected 0x%x\n", | 1725 | WARN(1, "timed out waiting for port %c ready: got 0x%x, expected 0x%x\n", |
1728 | port_name(dport->port), I915_READ(dpll_reg) & port_mask, expected_mask); | 1726 | port_name(dport->base.port), |
1727 | I915_READ(dpll_reg) & port_mask, expected_mask); | ||
1729 | } | 1728 | } |
1730 | 1729 | ||
1731 | static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv, | 1730 | static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv, |
@@ -1873,8 +1872,6 @@ enum pipe intel_crtc_pch_transcoder(struct intel_crtc *crtc) | |||
1873 | { | 1872 | { |
1874 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); | 1873 | struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); |
1875 | 1874 | ||
1876 | WARN_ON(!crtc->config->has_pch_encoder); | ||
1877 | |||
1878 | if (HAS_PCH_LPT(dev_priv)) | 1875 | if (HAS_PCH_LPT(dev_priv)) |
1879 | return PIPE_A; | 1876 | return PIPE_A; |
1880 | else | 1877 | else |
@@ -3433,20 +3430,11 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format) | |||
3433 | case DRM_FORMAT_RGB565: | 3430 | case DRM_FORMAT_RGB565: |
3434 | return PLANE_CTL_FORMAT_RGB_565; | 3431 | return PLANE_CTL_FORMAT_RGB_565; |
3435 | case DRM_FORMAT_XBGR8888: | 3432 | case DRM_FORMAT_XBGR8888: |
3433 | case DRM_FORMAT_ABGR8888: | ||
3436 | return PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX; | 3434 | return PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX; |
3437 | case DRM_FORMAT_XRGB8888: | 3435 | case DRM_FORMAT_XRGB8888: |
3438 | return PLANE_CTL_FORMAT_XRGB_8888; | ||
3439 | /* | ||
3440 | * XXX: For ARBG/ABGR formats we default to expecting scanout buffers | ||
3441 | * to be already pre-multiplied. We need to add a knob (or a different | ||
3442 | * DRM_FORMAT) for user-space to configure that. | ||
3443 | */ | ||
3444 | case DRM_FORMAT_ABGR8888: | ||
3445 | return PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX | | ||
3446 | PLANE_CTL_ALPHA_SW_PREMULTIPLY; | ||
3447 | case DRM_FORMAT_ARGB8888: | 3436 | case DRM_FORMAT_ARGB8888: |
3448 | return PLANE_CTL_FORMAT_XRGB_8888 | | 3437 | return PLANE_CTL_FORMAT_XRGB_8888; |
3449 | PLANE_CTL_ALPHA_SW_PREMULTIPLY; | ||
3450 | case DRM_FORMAT_XRGB2101010: | 3438 | case DRM_FORMAT_XRGB2101010: |
3451 | return PLANE_CTL_FORMAT_XRGB_2101010; | 3439 | return PLANE_CTL_FORMAT_XRGB_2101010; |
3452 | case DRM_FORMAT_XBGR2101010: | 3440 | case DRM_FORMAT_XBGR2101010: |
@@ -3466,6 +3454,33 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format) | |||
3466 | return 0; | 3454 | return 0; |
3467 | } | 3455 | } |
3468 | 3456 | ||
3457 | /* | ||
3458 | * XXX: For ARBG/ABGR formats we default to expecting scanout buffers | ||
3459 | * to be already pre-multiplied. We need to add a knob (or a different | ||
3460 | * DRM_FORMAT) for user-space to configure that. | ||
3461 | */ | ||
3462 | static u32 skl_plane_ctl_alpha(uint32_t pixel_format) | ||
3463 | { | ||
3464 | switch (pixel_format) { | ||
3465 | case DRM_FORMAT_ABGR8888: | ||
3466 | case DRM_FORMAT_ARGB8888: | ||
3467 | return PLANE_CTL_ALPHA_SW_PREMULTIPLY; | ||
3468 | default: | ||
3469 | return PLANE_CTL_ALPHA_DISABLE; | ||
3470 | } | ||
3471 | } | ||
3472 | |||
3473 | static u32 glk_plane_color_ctl_alpha(uint32_t pixel_format) | ||
3474 | { | ||
3475 | switch (pixel_format) { | ||
3476 | case DRM_FORMAT_ABGR8888: | ||
3477 | case DRM_FORMAT_ARGB8888: | ||
3478 | return PLANE_COLOR_ALPHA_SW_PREMULTIPLY; | ||
3479 | default: | ||
3480 | return PLANE_COLOR_ALPHA_DISABLE; | ||
3481 | } | ||
3482 | } | ||
3483 | |||
3469 | static u32 skl_plane_ctl_tiling(uint64_t fb_modifier) | 3484 | static u32 skl_plane_ctl_tiling(uint64_t fb_modifier) |
3470 | { | 3485 | { |
3471 | switch (fb_modifier) { | 3486 | switch (fb_modifier) { |
@@ -3522,7 +3537,8 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, | |||
3522 | 3537 | ||
3523 | plane_ctl = PLANE_CTL_ENABLE; | 3538 | plane_ctl = PLANE_CTL_ENABLE; |
3524 | 3539 | ||
3525 | if (!IS_GEMINILAKE(dev_priv) && !IS_CANNONLAKE(dev_priv)) { | 3540 | if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv)) { |
3541 | plane_ctl |= skl_plane_ctl_alpha(fb->format->format); | ||
3526 | plane_ctl |= | 3542 | plane_ctl |= |
3527 | PLANE_CTL_PIPE_GAMMA_ENABLE | | 3543 | PLANE_CTL_PIPE_GAMMA_ENABLE | |
3528 | PLANE_CTL_PIPE_CSC_ENABLE | | 3544 | PLANE_CTL_PIPE_CSC_ENABLE | |
@@ -3541,6 +3557,20 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, | |||
3541 | return plane_ctl; | 3557 | return plane_ctl; |
3542 | } | 3558 | } |
3543 | 3559 | ||
3560 | u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, | ||
3561 | const struct intel_plane_state *plane_state) | ||
3562 | { | ||
3563 | const struct drm_framebuffer *fb = plane_state->base.fb; | ||
3564 | u32 plane_color_ctl = 0; | ||
3565 | |||
3566 | plane_color_ctl |= PLANE_COLOR_PIPE_GAMMA_ENABLE; | ||
3567 | plane_color_ctl |= PLANE_COLOR_PIPE_CSC_ENABLE; | ||
3568 | plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE; | ||
3569 | plane_color_ctl |= glk_plane_color_ctl_alpha(fb->format->format); | ||
3570 | |||
3571 | return plane_color_ctl; | ||
3572 | } | ||
3573 | |||
3544 | static int | 3574 | static int |
3545 | __intel_display_resume(struct drm_device *dev, | 3575 | __intel_display_resume(struct drm_device *dev, |
3546 | struct drm_atomic_state *state, | 3576 | struct drm_atomic_state *state, |
@@ -4483,7 +4513,7 @@ intel_trans_dp_port_sel(struct intel_crtc *crtc) | |||
4483 | for_each_encoder_on_crtc(dev, &crtc->base, encoder) { | 4513 | for_each_encoder_on_crtc(dev, &crtc->base, encoder) { |
4484 | if (encoder->type == INTEL_OUTPUT_DP || | 4514 | if (encoder->type == INTEL_OUTPUT_DP || |
4485 | encoder->type == INTEL_OUTPUT_EDP) | 4515 | encoder->type == INTEL_OUTPUT_EDP) |
4486 | return enc_to_dig_port(&encoder->base)->port; | 4516 | return encoder->port; |
4487 | } | 4517 | } |
4488 | 4518 | ||
4489 | return -1; | 4519 | return -1; |
@@ -4834,8 +4864,9 @@ static void ironlake_pfit_enable(struct intel_crtc *crtc) | |||
4834 | } | 4864 | } |
4835 | } | 4865 | } |
4836 | 4866 | ||
4837 | void hsw_enable_ips(struct intel_crtc *crtc) | 4867 | void hsw_enable_ips(const struct intel_crtc_state *crtc_state) |
4838 | { | 4868 | { |
4869 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
4839 | struct drm_device *dev = crtc->base.dev; | 4870 | struct drm_device *dev = crtc->base.dev; |
4840 | struct drm_i915_private *dev_priv = to_i915(dev); | 4871 | struct drm_i915_private *dev_priv = to_i915(dev); |
4841 | 4872 | ||
@@ -4873,12 +4904,13 @@ void hsw_enable_ips(struct intel_crtc *crtc) | |||
4873 | } | 4904 | } |
4874 | } | 4905 | } |
4875 | 4906 | ||
4876 | void hsw_disable_ips(struct intel_crtc *crtc) | 4907 | void hsw_disable_ips(const struct intel_crtc_state *crtc_state) |
4877 | { | 4908 | { |
4909 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
4878 | struct drm_device *dev = crtc->base.dev; | 4910 | struct drm_device *dev = crtc->base.dev; |
4879 | struct drm_i915_private *dev_priv = to_i915(dev); | 4911 | struct drm_i915_private *dev_priv = to_i915(dev); |
4880 | 4912 | ||
4881 | if (!crtc->config->ips_enabled) | 4913 | if (!crtc_state->ips_enabled) |
4882 | return; | 4914 | return; |
4883 | 4915 | ||
4884 | assert_plane_enabled(dev_priv, crtc->plane); | 4916 | assert_plane_enabled(dev_priv, crtc->plane); |
@@ -4926,7 +4958,8 @@ static void intel_crtc_dpms_overlay_disable(struct intel_crtc *intel_crtc) | |||
4926 | * completely hide the primary plane. | 4958 | * completely hide the primary plane. |
4927 | */ | 4959 | */ |
4928 | static void | 4960 | static void |
4929 | intel_post_enable_primary(struct drm_crtc *crtc) | 4961 | intel_post_enable_primary(struct drm_crtc *crtc, |
4962 | const struct intel_crtc_state *new_crtc_state) | ||
4930 | { | 4963 | { |
4931 | struct drm_device *dev = crtc->dev; | 4964 | struct drm_device *dev = crtc->dev; |
4932 | struct drm_i915_private *dev_priv = to_i915(dev); | 4965 | struct drm_i915_private *dev_priv = to_i915(dev); |
@@ -4939,7 +4972,7 @@ intel_post_enable_primary(struct drm_crtc *crtc) | |||
4939 | * when going from primary only to sprite only and vice | 4972 | * when going from primary only to sprite only and vice |
4940 | * versa. | 4973 | * versa. |
4941 | */ | 4974 | */ |
4942 | hsw_enable_ips(intel_crtc); | 4975 | hsw_enable_ips(new_crtc_state); |
4943 | 4976 | ||
4944 | /* | 4977 | /* |
4945 | * Gen2 reports pipe underruns whenever all planes are disabled. | 4978 | * Gen2 reports pipe underruns whenever all planes are disabled. |
@@ -4958,7 +4991,8 @@ intel_post_enable_primary(struct drm_crtc *crtc) | |||
4958 | 4991 | ||
4959 | /* FIXME move all this to pre_plane_update() with proper state tracking */ | 4992 | /* FIXME move all this to pre_plane_update() with proper state tracking */ |
4960 | static void | 4993 | static void |
4961 | intel_pre_disable_primary(struct drm_crtc *crtc) | 4994 | intel_pre_disable_primary(struct drm_crtc *crtc, |
4995 | const struct intel_crtc_state *old_crtc_state) | ||
4962 | { | 4996 | { |
4963 | struct drm_device *dev = crtc->dev; | 4997 | struct drm_device *dev = crtc->dev; |
4964 | struct drm_i915_private *dev_priv = to_i915(dev); | 4998 | struct drm_i915_private *dev_priv = to_i915(dev); |
@@ -4980,7 +5014,7 @@ intel_pre_disable_primary(struct drm_crtc *crtc) | |||
4980 | * when going from primary only to sprite only and vice | 5014 | * when going from primary only to sprite only and vice |
4981 | * versa. | 5015 | * versa. |
4982 | */ | 5016 | */ |
4983 | hsw_disable_ips(intel_crtc); | 5017 | hsw_disable_ips(old_crtc_state); |
4984 | } | 5018 | } |
4985 | 5019 | ||
4986 | /* FIXME get rid of this and use pre_plane_update */ | 5020 | /* FIXME get rid of this and use pre_plane_update */ |
@@ -4992,7 +5026,7 @@ intel_pre_disable_primary_noatomic(struct drm_crtc *crtc) | |||
4992 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5026 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
4993 | int pipe = intel_crtc->pipe; | 5027 | int pipe = intel_crtc->pipe; |
4994 | 5028 | ||
4995 | intel_pre_disable_primary(crtc); | 5029 | intel_pre_disable_primary(crtc, to_intel_crtc_state(crtc->state)); |
4996 | 5030 | ||
4997 | /* | 5031 | /* |
4998 | * Vblank time updates from the shadow to live plane control register | 5032 | * Vblank time updates from the shadow to live plane control register |
@@ -5036,7 +5070,7 @@ static void intel_post_plane_update(struct intel_crtc_state *old_crtc_state) | |||
5036 | if (primary_state->base.visible && | 5070 | if (primary_state->base.visible && |
5037 | (needs_modeset(&pipe_config->base) || | 5071 | (needs_modeset(&pipe_config->base) || |
5038 | !old_primary_state->base.visible)) | 5072 | !old_primary_state->base.visible)) |
5039 | intel_post_enable_primary(&crtc->base); | 5073 | intel_post_enable_primary(&crtc->base, pipe_config); |
5040 | } | 5074 | } |
5041 | } | 5075 | } |
5042 | 5076 | ||
@@ -5065,7 +5099,7 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state, | |||
5065 | 5099 | ||
5066 | if (old_primary_state->base.visible && | 5100 | if (old_primary_state->base.visible && |
5067 | (modeset || !primary_state->base.visible)) | 5101 | (modeset || !primary_state->base.visible)) |
5068 | intel_pre_disable_primary(&crtc->base); | 5102 | intel_pre_disable_primary(&crtc->base, old_crtc_state); |
5069 | } | 5103 | } |
5070 | 5104 | ||
5071 | /* | 5105 | /* |
@@ -5939,6 +5973,7 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc, | |||
5939 | 5973 | ||
5940 | dev_priv->active_crtcs &= ~(1 << intel_crtc->pipe); | 5974 | dev_priv->active_crtcs &= ~(1 << intel_crtc->pipe); |
5941 | dev_priv->min_cdclk[intel_crtc->pipe] = 0; | 5975 | dev_priv->min_cdclk[intel_crtc->pipe] = 0; |
5976 | dev_priv->min_voltage_level[intel_crtc->pipe] = 0; | ||
5942 | } | 5977 | } |
5943 | 5978 | ||
5944 | /* | 5979 | /* |
@@ -7633,7 +7668,7 @@ static void ironlake_init_pch_refclk(struct drm_i915_private *dev_priv) | |||
7633 | break; | 7668 | break; |
7634 | case INTEL_OUTPUT_EDP: | 7669 | case INTEL_OUTPUT_EDP: |
7635 | has_panel = true; | 7670 | has_panel = true; |
7636 | if (enc_to_dig_port(&encoder->base)->port == PORT_A) | 7671 | if (encoder->port == PORT_A) |
7637 | has_cpu_edp = true; | 7672 | has_cpu_edp = true; |
7638 | break; | 7673 | break; |
7639 | default: | 7674 | default: |
@@ -8426,7 +8461,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, | |||
8426 | { | 8461 | { |
8427 | struct drm_device *dev = crtc->base.dev; | 8462 | struct drm_device *dev = crtc->base.dev; |
8428 | struct drm_i915_private *dev_priv = to_i915(dev); | 8463 | struct drm_i915_private *dev_priv = to_i915(dev); |
8429 | u32 val, base, offset, stride_mult, tiling; | 8464 | u32 val, base, offset, stride_mult, tiling, alpha; |
8430 | int pipe = crtc->pipe; | 8465 | int pipe = crtc->pipe; |
8431 | int fourcc, pixel_format; | 8466 | int fourcc, pixel_format; |
8432 | unsigned int aligned_height; | 8467 | unsigned int aligned_height; |
@@ -8448,9 +8483,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, | |||
8448 | goto error; | 8483 | goto error; |
8449 | 8484 | ||
8450 | pixel_format = val & PLANE_CTL_FORMAT_MASK; | 8485 | pixel_format = val & PLANE_CTL_FORMAT_MASK; |
8486 | |||
8487 | if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) { | ||
8488 | alpha = I915_READ(PLANE_COLOR_CTL(pipe, 0)); | ||
8489 | alpha &= PLANE_COLOR_ALPHA_MASK; | ||
8490 | } else { | ||
8491 | alpha = val & PLANE_CTL_ALPHA_MASK; | ||
8492 | } | ||
8493 | |||
8451 | fourcc = skl_format_to_fourcc(pixel_format, | 8494 | fourcc = skl_format_to_fourcc(pixel_format, |
8452 | val & PLANE_CTL_ORDER_RGBX, | 8495 | val & PLANE_CTL_ORDER_RGBX, alpha); |
8453 | val & PLANE_CTL_ALPHA_MASK); | ||
8454 | fb->format = drm_format_info(fourcc); | 8496 | fb->format = drm_format_info(fourcc); |
8455 | 8497 | ||
8456 | tiling = val & PLANE_CTL_TILED_MASK; | 8498 | tiling = val & PLANE_CTL_TILED_MASK; |
@@ -8857,7 +8899,9 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv) | |||
8857 | } | 8899 | } |
8858 | 8900 | ||
8859 | intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); | 8901 | intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); |
8902 | |||
8860 | intel_update_cdclk(dev_priv); | 8903 | intel_update_cdclk(dev_priv); |
8904 | intel_dump_cdclk_state(&dev_priv->cdclk.hw, "Current CDCLK"); | ||
8861 | } | 8905 | } |
8862 | 8906 | ||
8863 | /* | 8907 | /* |
@@ -9231,10 +9275,6 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, | |||
9231 | ironlake_get_pfit_config(crtc, pipe_config); | 9275 | ironlake_get_pfit_config(crtc, pipe_config); |
9232 | } | 9276 | } |
9233 | 9277 | ||
9234 | if (IS_HASWELL(dev_priv)) | ||
9235 | pipe_config->ips_enabled = hsw_crtc_supports_ips(crtc) && | ||
9236 | (I915_READ(IPS_CTL) & IPS_ENABLE); | ||
9237 | |||
9238 | if (pipe_config->cpu_transcoder != TRANSCODER_EDP && | 9278 | if (pipe_config->cpu_transcoder != TRANSCODER_EDP && |
9239 | !transcoder_is_dsi(pipe_config->cpu_transcoder)) { | 9279 | !transcoder_is_dsi(pipe_config->cpu_transcoder)) { |
9240 | pipe_config->pixel_multiplier = | 9280 | pipe_config->pixel_multiplier = |
@@ -10578,7 +10618,7 @@ static const char * const output_type_str[] = { | |||
10578 | OUTPUT_TYPE(DP), | 10618 | OUTPUT_TYPE(DP), |
10579 | OUTPUT_TYPE(EDP), | 10619 | OUTPUT_TYPE(EDP), |
10580 | OUTPUT_TYPE(DSI), | 10620 | OUTPUT_TYPE(DSI), |
10581 | OUTPUT_TYPE(UNKNOWN), | 10621 | OUTPUT_TYPE(DDI), |
10582 | OUTPUT_TYPE(DP_MST), | 10622 | OUTPUT_TYPE(DP_MST), |
10583 | }; | 10623 | }; |
10584 | 10624 | ||
@@ -10749,13 +10789,13 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state) | |||
10749 | 10789 | ||
10750 | switch (encoder->type) { | 10790 | switch (encoder->type) { |
10751 | unsigned int port_mask; | 10791 | unsigned int port_mask; |
10752 | case INTEL_OUTPUT_UNKNOWN: | 10792 | case INTEL_OUTPUT_DDI: |
10753 | if (WARN_ON(!HAS_DDI(to_i915(dev)))) | 10793 | if (WARN_ON(!HAS_DDI(to_i915(dev)))) |
10754 | break; | 10794 | break; |
10755 | case INTEL_OUTPUT_DP: | 10795 | case INTEL_OUTPUT_DP: |
10756 | case INTEL_OUTPUT_HDMI: | 10796 | case INTEL_OUTPUT_HDMI: |
10757 | case INTEL_OUTPUT_EDP: | 10797 | case INTEL_OUTPUT_EDP: |
10758 | port_mask = 1 << enc_to_dig_port(&encoder->base)->port; | 10798 | port_mask = 1 << encoder->port; |
10759 | 10799 | ||
10760 | /* the same port mustn't appear more than once */ | 10800 | /* the same port mustn't appear more than once */ |
10761 | if (used_ports & port_mask) | 10801 | if (used_ports & port_mask) |
@@ -10765,7 +10805,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state) | |||
10765 | break; | 10805 | break; |
10766 | case INTEL_OUTPUT_DP_MST: | 10806 | case INTEL_OUTPUT_DP_MST: |
10767 | used_mst_ports |= | 10807 | used_mst_ports |= |
10768 | 1 << enc_to_mst(&encoder->base)->primary->port; | 10808 | 1 << encoder->port; |
10769 | break; | 10809 | break; |
10770 | default: | 10810 | default: |
10771 | break; | 10811 | break; |
@@ -10882,7 +10922,12 @@ intel_modeset_pipe_config(struct drm_crtc *crtc, | |||
10882 | * Determine output_types before calling the .compute_config() | 10922 | * Determine output_types before calling the .compute_config() |
10883 | * hooks so that the hooks can use this information safely. | 10923 | * hooks so that the hooks can use this information safely. |
10884 | */ | 10924 | */ |
10885 | pipe_config->output_types |= 1 << encoder->type; | 10925 | if (encoder->compute_output_type) |
10926 | pipe_config->output_types |= | ||
10927 | BIT(encoder->compute_output_type(encoder, pipe_config, | ||
10928 | connector_state)); | ||
10929 | else | ||
10930 | pipe_config->output_types |= BIT(encoder->type); | ||
10886 | } | 10931 | } |
10887 | 10932 | ||
10888 | encoder_retry: | 10933 | encoder_retry: |
@@ -11071,6 +11116,9 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, | |||
11071 | bool adjust) | 11116 | bool adjust) |
11072 | { | 11117 | { |
11073 | bool ret = true; | 11118 | bool ret = true; |
11119 | bool fixup_inherited = adjust && | ||
11120 | (current_config->base.mode.private_flags & I915_MODE_FLAG_INHERITED) && | ||
11121 | !(pipe_config->base.mode.private_flags & I915_MODE_FLAG_INHERITED); | ||
11074 | 11122 | ||
11075 | #define PIPE_CONF_CHECK_X(name) \ | 11123 | #define PIPE_CONF_CHECK_X(name) \ |
11076 | if (current_config->name != pipe_config->name) { \ | 11124 | if (current_config->name != pipe_config->name) { \ |
@@ -11090,6 +11138,31 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, | |||
11090 | ret = false; \ | 11138 | ret = false; \ |
11091 | } | 11139 | } |
11092 | 11140 | ||
11141 | #define PIPE_CONF_CHECK_BOOL(name) \ | ||
11142 | if (current_config->name != pipe_config->name) { \ | ||
11143 | pipe_config_err(adjust, __stringify(name), \ | ||
11144 | "(expected %s, found %s)\n", \ | ||
11145 | yesno(current_config->name), \ | ||
11146 | yesno(pipe_config->name)); \ | ||
11147 | ret = false; \ | ||
11148 | } | ||
11149 | |||
11150 | /* | ||
11151 | * Checks state where we only read out the enabling, but not the entire | ||
11152 | * state itself (like full infoframes or ELD for audio). These states | ||
11153 | * require a full modeset on bootup to fix up. | ||
11154 | */ | ||
11155 | #define PIPE_CONF_CHECK_BOOL_INCOMPLETE(name) \ | ||
11156 | if (!fixup_inherited || (!current_config->name && !pipe_config->name)) { \ | ||
11157 | PIPE_CONF_CHECK_BOOL(name); \ | ||
11158 | } else { \ | ||
11159 | pipe_config_err(adjust, __stringify(name), \ | ||
11160 | "unable to verify whether state matches exactly, forcing modeset (expected %s, found %s)\n", \ | ||
11161 | yesno(current_config->name), \ | ||
11162 | yesno(pipe_config->name)); \ | ||
11163 | ret = false; \ | ||
11164 | } | ||
11165 | |||
11093 | #define PIPE_CONF_CHECK_P(name) \ | 11166 | #define PIPE_CONF_CHECK_P(name) \ |
11094 | if (current_config->name != pipe_config->name) { \ | 11167 | if (current_config->name != pipe_config->name) { \ |
11095 | pipe_config_err(adjust, __stringify(name), \ | 11168 | pipe_config_err(adjust, __stringify(name), \ |
@@ -11175,7 +11248,7 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, | |||
11175 | 11248 | ||
11176 | PIPE_CONF_CHECK_I(cpu_transcoder); | 11249 | PIPE_CONF_CHECK_I(cpu_transcoder); |
11177 | 11250 | ||
11178 | PIPE_CONF_CHECK_I(has_pch_encoder); | 11251 | PIPE_CONF_CHECK_BOOL(has_pch_encoder); |
11179 | PIPE_CONF_CHECK_I(fdi_lanes); | 11252 | PIPE_CONF_CHECK_I(fdi_lanes); |
11180 | PIPE_CONF_CHECK_M_N(fdi_m_n); | 11253 | PIPE_CONF_CHECK_M_N(fdi_m_n); |
11181 | 11254 | ||
@@ -11207,17 +11280,17 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, | |||
11207 | PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vsync_end); | 11280 | PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vsync_end); |
11208 | 11281 | ||
11209 | PIPE_CONF_CHECK_I(pixel_multiplier); | 11282 | PIPE_CONF_CHECK_I(pixel_multiplier); |
11210 | PIPE_CONF_CHECK_I(has_hdmi_sink); | 11283 | PIPE_CONF_CHECK_BOOL(has_hdmi_sink); |
11211 | if ((INTEL_GEN(dev_priv) < 8 && !IS_HASWELL(dev_priv)) || | 11284 | if ((INTEL_GEN(dev_priv) < 8 && !IS_HASWELL(dev_priv)) || |
11212 | IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) | 11285 | IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) |
11213 | PIPE_CONF_CHECK_I(limited_color_range); | 11286 | PIPE_CONF_CHECK_BOOL(limited_color_range); |
11214 | 11287 | ||
11215 | PIPE_CONF_CHECK_I(hdmi_scrambling); | 11288 | PIPE_CONF_CHECK_BOOL(hdmi_scrambling); |
11216 | PIPE_CONF_CHECK_I(hdmi_high_tmds_clock_ratio); | 11289 | PIPE_CONF_CHECK_BOOL(hdmi_high_tmds_clock_ratio); |
11217 | PIPE_CONF_CHECK_I(has_infoframe); | 11290 | PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_infoframe); |
11218 | PIPE_CONF_CHECK_I(ycbcr420); | 11291 | PIPE_CONF_CHECK_BOOL(ycbcr420); |
11219 | 11292 | ||
11220 | PIPE_CONF_CHECK_I(has_audio); | 11293 | PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio); |
11221 | 11294 | ||
11222 | PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags, | 11295 | PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags, |
11223 | DRM_MODE_FLAG_INTERLACE); | 11296 | DRM_MODE_FLAG_INTERLACE); |
@@ -11243,7 +11316,7 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, | |||
11243 | PIPE_CONF_CHECK_I(pipe_src_w); | 11316 | PIPE_CONF_CHECK_I(pipe_src_w); |
11244 | PIPE_CONF_CHECK_I(pipe_src_h); | 11317 | PIPE_CONF_CHECK_I(pipe_src_h); |
11245 | 11318 | ||
11246 | PIPE_CONF_CHECK_I(pch_pfit.enabled); | 11319 | PIPE_CONF_CHECK_BOOL(pch_pfit.enabled); |
11247 | if (current_config->pch_pfit.enabled) { | 11320 | if (current_config->pch_pfit.enabled) { |
11248 | PIPE_CONF_CHECK_X(pch_pfit.pos); | 11321 | PIPE_CONF_CHECK_X(pch_pfit.pos); |
11249 | PIPE_CONF_CHECK_X(pch_pfit.size); | 11322 | PIPE_CONF_CHECK_X(pch_pfit.size); |
@@ -11253,11 +11326,7 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, | |||
11253 | PIPE_CONF_CHECK_CLOCK_FUZZY(pixel_rate); | 11326 | PIPE_CONF_CHECK_CLOCK_FUZZY(pixel_rate); |
11254 | } | 11327 | } |
11255 | 11328 | ||
11256 | /* BDW+ don't expose a synchronous way to read the state */ | 11329 | PIPE_CONF_CHECK_BOOL(double_wide); |
11257 | if (IS_HASWELL(dev_priv)) | ||
11258 | PIPE_CONF_CHECK_I(ips_enabled); | ||
11259 | |||
11260 | PIPE_CONF_CHECK_I(double_wide); | ||
11261 | 11330 | ||
11262 | PIPE_CONF_CHECK_P(shared_dpll); | 11331 | PIPE_CONF_CHECK_P(shared_dpll); |
11263 | PIPE_CONF_CHECK_X(dpll_hw_state.dpll); | 11332 | PIPE_CONF_CHECK_X(dpll_hw_state.dpll); |
@@ -11291,8 +11360,12 @@ intel_pipe_config_compare(struct drm_i915_private *dev_priv, | |||
11291 | PIPE_CONF_CHECK_CLOCK_FUZZY(base.adjusted_mode.crtc_clock); | 11360 | PIPE_CONF_CHECK_CLOCK_FUZZY(base.adjusted_mode.crtc_clock); |
11292 | PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock); | 11361 | PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock); |
11293 | 11362 | ||
11363 | PIPE_CONF_CHECK_I(min_voltage_level); | ||
11364 | |||
11294 | #undef PIPE_CONF_CHECK_X | 11365 | #undef PIPE_CONF_CHECK_X |
11295 | #undef PIPE_CONF_CHECK_I | 11366 | #undef PIPE_CONF_CHECK_I |
11367 | #undef PIPE_CONF_CHECK_BOOL | ||
11368 | #undef PIPE_CONF_CHECK_BOOL_INCOMPLETE | ||
11296 | #undef PIPE_CONF_CHECK_P | 11369 | #undef PIPE_CONF_CHECK_P |
11297 | #undef PIPE_CONF_CHECK_FLAGS | 11370 | #undef PIPE_CONF_CHECK_FLAGS |
11298 | #undef PIPE_CONF_CHECK_CLOCK_FUZZY | 11371 | #undef PIPE_CONF_CHECK_CLOCK_FUZZY |
@@ -11559,10 +11632,8 @@ verify_crtc_state(struct drm_crtc *crtc, | |||
11559 | "Encoder connected to wrong pipe %c\n", | 11632 | "Encoder connected to wrong pipe %c\n", |
11560 | pipe_name(pipe)); | 11633 | pipe_name(pipe)); |
11561 | 11634 | ||
11562 | if (active) { | 11635 | if (active) |
11563 | pipe_config->output_types |= 1 << encoder->type; | ||
11564 | encoder->get_config(encoder, pipe_config); | 11636 | encoder->get_config(encoder, pipe_config); |
11565 | } | ||
11566 | } | 11637 | } |
11567 | 11638 | ||
11568 | intel_crtc_compute_pixel_rate(pipe_config); | 11639 | intel_crtc_compute_pixel_rate(pipe_config); |
@@ -11933,16 +12004,16 @@ static int intel_modeset_checks(struct drm_atomic_state *state) | |||
11933 | * holding all the crtc locks, even if we don't end up | 12004 | * holding all the crtc locks, even if we don't end up |
11934 | * touching the hardware | 12005 | * touching the hardware |
11935 | */ | 12006 | */ |
11936 | if (!intel_cdclk_state_compare(&dev_priv->cdclk.logical, | 12007 | if (intel_cdclk_changed(&dev_priv->cdclk.logical, |
11937 | &intel_state->cdclk.logical)) { | 12008 | &intel_state->cdclk.logical)) { |
11938 | ret = intel_lock_all_pipes(state); | 12009 | ret = intel_lock_all_pipes(state); |
11939 | if (ret < 0) | 12010 | if (ret < 0) |
11940 | return ret; | 12011 | return ret; |
11941 | } | 12012 | } |
11942 | 12013 | ||
11943 | /* All pipes must be switched off while we change the cdclk. */ | 12014 | /* All pipes must be switched off while we change the cdclk. */ |
11944 | if (!intel_cdclk_state_compare(&dev_priv->cdclk.actual, | 12015 | if (intel_cdclk_needs_modeset(&dev_priv->cdclk.actual, |
11945 | &intel_state->cdclk.actual)) { | 12016 | &intel_state->cdclk.actual)) { |
11946 | ret = intel_modeset_all_pipes(state); | 12017 | ret = intel_modeset_all_pipes(state); |
11947 | if (ret < 0) | 12018 | if (ret < 0) |
11948 | return ret; | 12019 | return ret; |
@@ -11951,6 +12022,9 @@ static int intel_modeset_checks(struct drm_atomic_state *state) | |||
11951 | DRM_DEBUG_KMS("New cdclk calculated to be logical %u kHz, actual %u kHz\n", | 12022 | DRM_DEBUG_KMS("New cdclk calculated to be logical %u kHz, actual %u kHz\n", |
11952 | intel_state->cdclk.logical.cdclk, | 12023 | intel_state->cdclk.logical.cdclk, |
11953 | intel_state->cdclk.actual.cdclk); | 12024 | intel_state->cdclk.actual.cdclk); |
12025 | DRM_DEBUG_KMS("New voltage level calculated to be logical %u, actual %u\n", | ||
12026 | intel_state->cdclk.logical.voltage_level, | ||
12027 | intel_state->cdclk.actual.voltage_level); | ||
11954 | } else { | 12028 | } else { |
11955 | to_intel_atomic_state(state)->cdclk.logical = dev_priv->cdclk.logical; | 12029 | to_intel_atomic_state(state)->cdclk.logical = dev_priv->cdclk.logical; |
11956 | } | 12030 | } |
@@ -12519,6 +12593,9 @@ static int intel_atomic_commit(struct drm_device *dev, | |||
12519 | if (intel_state->modeset) { | 12593 | if (intel_state->modeset) { |
12520 | memcpy(dev_priv->min_cdclk, intel_state->min_cdclk, | 12594 | memcpy(dev_priv->min_cdclk, intel_state->min_cdclk, |
12521 | sizeof(intel_state->min_cdclk)); | 12595 | sizeof(intel_state->min_cdclk)); |
12596 | memcpy(dev_priv->min_voltage_level, | ||
12597 | intel_state->min_voltage_level, | ||
12598 | sizeof(intel_state->min_voltage_level)); | ||
12522 | dev_priv->active_crtcs = intel_state->active_crtcs; | 12599 | dev_priv->active_crtcs = intel_state->active_crtcs; |
12523 | dev_priv->cdclk.logical = intel_state->cdclk.logical; | 12600 | dev_priv->cdclk.logical = intel_state->cdclk.logical; |
12524 | dev_priv->cdclk.actual = intel_state->cdclk.actual; | 12601 | dev_priv->cdclk.actual = intel_state->cdclk.actual; |
@@ -12756,7 +12833,7 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct intel_crtc_state *crtc_state | |||
12756 | crtc_clock = crtc_state->base.adjusted_mode.crtc_clock; | 12833 | crtc_clock = crtc_state->base.adjusted_mode.crtc_clock; |
12757 | max_dotclk = to_intel_atomic_state(crtc_state->base.state)->cdclk.logical.cdclk; | 12834 | max_dotclk = to_intel_atomic_state(crtc_state->base.state)->cdclk.logical.cdclk; |
12758 | 12835 | ||
12759 | if (IS_GEMINILAKE(dev_priv)) | 12836 | if (IS_GEMINILAKE(dev_priv) || INTEL_GEN(dev_priv) >= 10) |
12760 | max_dotclk *= 2; | 12837 | max_dotclk *= 2; |
12761 | 12838 | ||
12762 | if (WARN_ON_ONCE(!crtc_clock || max_dotclk < crtc_clock)) | 12839 | if (WARN_ON_ONCE(!crtc_clock || max_dotclk < crtc_clock)) |
@@ -12820,6 +12897,9 @@ intel_check_primary_plane(struct intel_plane *plane, | |||
12820 | state->ctl = i9xx_plane_ctl(crtc_state, state); | 12897 | state->ctl = i9xx_plane_ctl(crtc_state, state); |
12821 | } | 12898 | } |
12822 | 12899 | ||
12900 | if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) | ||
12901 | state->color_ctl = glk_plane_color_ctl(crtc_state, state); | ||
12902 | |||
12823 | return 0; | 12903 | return 0; |
12824 | } | 12904 | } |
12825 | 12905 | ||
@@ -12864,6 +12944,7 @@ out: | |||
12864 | static void intel_finish_crtc_commit(struct drm_crtc *crtc, | 12944 | static void intel_finish_crtc_commit(struct drm_crtc *crtc, |
12865 | struct drm_crtc_state *old_crtc_state) | 12945 | struct drm_crtc_state *old_crtc_state) |
12866 | { | 12946 | { |
12947 | struct drm_i915_private *dev_priv = to_i915(crtc->dev); | ||
12867 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 12948 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
12868 | struct intel_atomic_state *old_intel_state = | 12949 | struct intel_atomic_state *old_intel_state = |
12869 | to_intel_atomic_state(old_crtc_state->state); | 12950 | to_intel_atomic_state(old_crtc_state->state); |
@@ -12871,6 +12952,20 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc, | |||
12871 | intel_atomic_get_new_crtc_state(old_intel_state, intel_crtc); | 12952 | intel_atomic_get_new_crtc_state(old_intel_state, intel_crtc); |
12872 | 12953 | ||
12873 | intel_pipe_update_end(new_crtc_state); | 12954 | intel_pipe_update_end(new_crtc_state); |
12955 | |||
12956 | if (new_crtc_state->update_pipe && | ||
12957 | !needs_modeset(&new_crtc_state->base) && | ||
12958 | old_crtc_state->mode.private_flags & I915_MODE_FLAG_INHERITED) { | ||
12959 | if (!IS_GEN2(dev_priv)) | ||
12960 | intel_set_cpu_fifo_underrun_reporting(dev_priv, intel_crtc->pipe, true); | ||
12961 | |||
12962 | if (new_crtc_state->has_pch_encoder) { | ||
12963 | enum pipe pch_transcoder = | ||
12964 | intel_crtc_pch_transcoder(intel_crtc); | ||
12965 | |||
12966 | intel_set_pch_fifo_underrun_reporting(dev_priv, pch_transcoder, true); | ||
12967 | } | ||
12968 | } | ||
12874 | } | 12969 | } |
12875 | 12970 | ||
12876 | /** | 12971 | /** |
@@ -14352,6 +14447,7 @@ void intel_modeset_init_hw(struct drm_device *dev) | |||
14352 | struct drm_i915_private *dev_priv = to_i915(dev); | 14447 | struct drm_i915_private *dev_priv = to_i915(dev); |
14353 | 14448 | ||
14354 | intel_update_cdclk(dev_priv); | 14449 | intel_update_cdclk(dev_priv); |
14450 | intel_dump_cdclk_state(&dev_priv->cdclk.hw, "Current CDCLK"); | ||
14355 | dev_priv->cdclk.logical = dev_priv->cdclk.actual = dev_priv->cdclk.hw; | 14451 | dev_priv->cdclk.logical = dev_priv->cdclk.actual = dev_priv->cdclk.hw; |
14356 | } | 14452 | } |
14357 | 14453 | ||
@@ -14431,6 +14527,8 @@ retry: | |||
14431 | 14527 | ||
14432 | cs->wm.need_postvbl_update = true; | 14528 | cs->wm.need_postvbl_update = true; |
14433 | dev_priv->display.optimize_watermarks(intel_state, cs); | 14529 | dev_priv->display.optimize_watermarks(intel_state, cs); |
14530 | |||
14531 | to_intel_crtc_state(crtc->state)->wm = cs->wm; | ||
14434 | } | 14532 | } |
14435 | 14533 | ||
14436 | put_state: | 14534 | put_state: |
@@ -14440,6 +14538,22 @@ fail: | |||
14440 | drm_modeset_acquire_fini(&ctx); | 14538 | drm_modeset_acquire_fini(&ctx); |
14441 | } | 14539 | } |
14442 | 14540 | ||
14541 | static void intel_update_fdi_pll_freq(struct drm_i915_private *dev_priv) | ||
14542 | { | ||
14543 | if (IS_GEN5(dev_priv)) { | ||
14544 | u32 fdi_pll_clk = | ||
14545 | I915_READ(FDI_PLL_BIOS_0) & FDI_PLL_FB_CLOCK_MASK; | ||
14546 | |||
14547 | dev_priv->fdi_pll_freq = (fdi_pll_clk + 2) * 10000; | ||
14548 | } else if (IS_GEN6(dev_priv) || IS_IVYBRIDGE(dev_priv)) { | ||
14549 | dev_priv->fdi_pll_freq = 270000; | ||
14550 | } else { | ||
14551 | return; | ||
14552 | } | ||
14553 | |||
14554 | DRM_DEBUG_DRIVER("FDI PLL freq=%d\n", dev_priv->fdi_pll_freq); | ||
14555 | } | ||
14556 | |||
14443 | int intel_modeset_init(struct drm_device *dev) | 14557 | int intel_modeset_init(struct drm_device *dev) |
14444 | { | 14558 | { |
14445 | struct drm_i915_private *dev_priv = to_i915(dev); | 14559 | struct drm_i915_private *dev_priv = to_i915(dev); |
@@ -14527,6 +14641,7 @@ int intel_modeset_init(struct drm_device *dev) | |||
14527 | } | 14641 | } |
14528 | 14642 | ||
14529 | intel_shared_dpll_init(dev); | 14643 | intel_shared_dpll_init(dev); |
14644 | intel_update_fdi_pll_freq(dev_priv); | ||
14530 | 14645 | ||
14531 | intel_update_czclk(dev_priv); | 14646 | intel_update_czclk(dev_priv); |
14532 | intel_modeset_init_hw(dev); | 14647 | intel_modeset_init_hw(dev); |
@@ -14716,7 +14831,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, | |||
14716 | enum transcoder cpu_transcoder = crtc->config->cpu_transcoder; | 14831 | enum transcoder cpu_transcoder = crtc->config->cpu_transcoder; |
14717 | 14832 | ||
14718 | /* Clear any frame start delays used for debugging left by the BIOS */ | 14833 | /* Clear any frame start delays used for debugging left by the BIOS */ |
14719 | if (!transcoder_is_dsi(cpu_transcoder)) { | 14834 | if (crtc->active && !transcoder_is_dsi(cpu_transcoder)) { |
14720 | i915_reg_t reg = PIPECONF(cpu_transcoder); | 14835 | i915_reg_t reg = PIPECONF(cpu_transcoder); |
14721 | 14836 | ||
14722 | I915_WRITE(reg, | 14837 | I915_WRITE(reg, |
@@ -14949,7 +15064,6 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
14949 | crtc_state = to_intel_crtc_state(crtc->base.state); | 15064 | crtc_state = to_intel_crtc_state(crtc->base.state); |
14950 | 15065 | ||
14951 | encoder->base.crtc = &crtc->base; | 15066 | encoder->base.crtc = &crtc->base; |
14952 | crtc_state->output_types |= 1 << encoder->type; | ||
14953 | encoder->get_config(encoder, crtc_state); | 15067 | encoder->get_config(encoder, crtc_state); |
14954 | } else { | 15068 | } else { |
14955 | encoder->base.crtc = NULL; | 15069 | encoder->base.crtc = NULL; |
@@ -15028,6 +15142,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
15028 | } | 15142 | } |
15029 | 15143 | ||
15030 | dev_priv->min_cdclk[crtc->pipe] = min_cdclk; | 15144 | dev_priv->min_cdclk[crtc->pipe] = min_cdclk; |
15145 | dev_priv->min_voltage_level[crtc->pipe] = | ||
15146 | crtc_state->min_voltage_level; | ||
15031 | 15147 | ||
15032 | intel_pipe_config_sanity_check(dev_priv, crtc_state); | 15148 | intel_pipe_config_sanity_check(dev_priv, crtc_state); |
15033 | } | 15149 | } |
@@ -15051,6 +15167,23 @@ get_encoder_power_domains(struct drm_i915_private *dev_priv) | |||
15051 | } | 15167 | } |
15052 | } | 15168 | } |
15053 | 15169 | ||
15170 | static void intel_early_display_was(struct drm_i915_private *dev_priv) | ||
15171 | { | ||
15172 | /* Display WA #1185 WaDisableDARBFClkGating:cnl,glk */ | ||
15173 | if (IS_CANNONLAKE(dev_priv) || IS_GEMINILAKE(dev_priv)) | ||
15174 | I915_WRITE(GEN9_CLKGATE_DIS_0, I915_READ(GEN9_CLKGATE_DIS_0) | | ||
15175 | DARBF_GATING_DIS); | ||
15176 | |||
15177 | if (IS_HASWELL(dev_priv)) { | ||
15178 | /* | ||
15179 | * WaRsPkgCStateDisplayPMReq:hsw | ||
15180 | * System hang if this isn't done before disabling all planes! | ||
15181 | */ | ||
15182 | I915_WRITE(CHICKEN_PAR1_1, | ||
15183 | I915_READ(CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES); | ||
15184 | } | ||
15185 | } | ||
15186 | |||
15054 | /* Scan out the current hw modeset state, | 15187 | /* Scan out the current hw modeset state, |
15055 | * and sanitizes it to the current state | 15188 | * and sanitizes it to the current state |
15056 | */ | 15189 | */ |
@@ -15064,15 +15197,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev, | |||
15064 | struct intel_encoder *encoder; | 15197 | struct intel_encoder *encoder; |
15065 | int i; | 15198 | int i; |
15066 | 15199 | ||
15067 | if (IS_HASWELL(dev_priv)) { | 15200 | intel_early_display_was(dev_priv); |
15068 | /* | ||
15069 | * WaRsPkgCStateDisplayPMReq:hsw | ||
15070 | * System hang if this isn't done before disabling all planes! | ||
15071 | */ | ||
15072 | I915_WRITE(CHICKEN_PAR1_1, | ||
15073 | I915_READ(CHICKEN_PAR1_1) | FORCE_ARB_IDLE_PLANES); | ||
15074 | } | ||
15075 | |||
15076 | intel_modeset_readout_hw_state(dev); | 15201 | intel_modeset_readout_hw_state(dev); |
15077 | 15202 | ||
15078 | /* HW state is read out, now we need to sanitize this mess. */ | 15203 | /* HW state is read out, now we need to sanitize this mess. */ |
@@ -15164,17 +15289,6 @@ void intel_display_resume(struct drm_device *dev) | |||
15164 | drm_atomic_state_put(state); | 15289 | drm_atomic_state_put(state); |
15165 | } | 15290 | } |
15166 | 15291 | ||
15167 | void intel_modeset_gem_init(struct drm_device *dev) | ||
15168 | { | ||
15169 | struct drm_i915_private *dev_priv = to_i915(dev); | ||
15170 | |||
15171 | intel_init_gt_powersave(dev_priv); | ||
15172 | |||
15173 | intel_init_clock_gating(dev_priv); | ||
15174 | |||
15175 | intel_setup_overlay(dev_priv); | ||
15176 | } | ||
15177 | |||
15178 | int intel_connector_register(struct drm_connector *connector) | 15292 | int intel_connector_register(struct drm_connector *connector) |
15179 | { | 15293 | { |
15180 | struct intel_connector *intel_connector = to_intel_connector(connector); | 15294 | struct intel_connector *intel_connector = to_intel_connector(connector); |