diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 622 |
1 files changed, 324 insertions, 298 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 836bbdc239b6..8b7b8b64b008 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1343,18 +1343,21 @@ void assert_pipe(struct drm_i915_private *dev_priv, | |||
1343 | bool cur_state; | 1343 | bool cur_state; |
1344 | enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, | 1344 | enum transcoder cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, |
1345 | pipe); | 1345 | pipe); |
1346 | enum intel_display_power_domain power_domain; | ||
1346 | 1347 | ||
1347 | /* if we need the pipe quirk it must be always on */ | 1348 | /* if we need the pipe quirk it must be always on */ |
1348 | if ((pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE) || | 1349 | if ((pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE) || |
1349 | (pipe == PIPE_B && dev_priv->quirks & QUIRK_PIPEB_FORCE)) | 1350 | (pipe == PIPE_B && dev_priv->quirks & QUIRK_PIPEB_FORCE)) |
1350 | state = true; | 1351 | state = true; |
1351 | 1352 | ||
1352 | if (!intel_display_power_is_enabled(dev_priv, | 1353 | power_domain = POWER_DOMAIN_TRANSCODER(cpu_transcoder); |
1353 | POWER_DOMAIN_TRANSCODER(cpu_transcoder))) { | 1354 | if (intel_display_power_get_if_enabled(dev_priv, power_domain)) { |
1354 | cur_state = false; | ||
1355 | } else { | ||
1356 | u32 val = I915_READ(PIPECONF(cpu_transcoder)); | 1355 | u32 val = I915_READ(PIPECONF(cpu_transcoder)); |
1357 | cur_state = !!(val & PIPECONF_ENABLE); | 1356 | cur_state = !!(val & PIPECONF_ENABLE); |
1357 | |||
1358 | intel_display_power_put(dev_priv, power_domain); | ||
1359 | } else { | ||
1360 | cur_state = false; | ||
1358 | } | 1361 | } |
1359 | 1362 | ||
1360 | I915_STATE_WARN(cur_state != state, | 1363 | I915_STATE_WARN(cur_state != state, |
@@ -2551,12 +2554,16 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc, | |||
2551 | if (size_aligned * 2 > dev_priv->gtt.stolen_usable_size) | 2554 | if (size_aligned * 2 > dev_priv->gtt.stolen_usable_size) |
2552 | return false; | 2555 | return false; |
2553 | 2556 | ||
2557 | mutex_lock(&dev->struct_mutex); | ||
2558 | |||
2554 | obj = i915_gem_object_create_stolen_for_preallocated(dev, | 2559 | obj = i915_gem_object_create_stolen_for_preallocated(dev, |
2555 | base_aligned, | 2560 | base_aligned, |
2556 | base_aligned, | 2561 | base_aligned, |
2557 | size_aligned); | 2562 | size_aligned); |
2558 | if (!obj) | 2563 | if (!obj) { |
2564 | mutex_unlock(&dev->struct_mutex); | ||
2559 | return false; | 2565 | return false; |
2566 | } | ||
2560 | 2567 | ||
2561 | obj->tiling_mode = plane_config->tiling; | 2568 | obj->tiling_mode = plane_config->tiling; |
2562 | if (obj->tiling_mode == I915_TILING_X) | 2569 | if (obj->tiling_mode == I915_TILING_X) |
@@ -2569,12 +2576,12 @@ intel_alloc_initial_plane_obj(struct intel_crtc *crtc, | |||
2569 | mode_cmd.modifier[0] = fb->modifier[0]; | 2576 | mode_cmd.modifier[0] = fb->modifier[0]; |
2570 | mode_cmd.flags = DRM_MODE_FB_MODIFIERS; | 2577 | mode_cmd.flags = DRM_MODE_FB_MODIFIERS; |
2571 | 2578 | ||
2572 | mutex_lock(&dev->struct_mutex); | ||
2573 | if (intel_framebuffer_init(dev, to_intel_framebuffer(fb), | 2579 | if (intel_framebuffer_init(dev, to_intel_framebuffer(fb), |
2574 | &mode_cmd, obj)) { | 2580 | &mode_cmd, obj)) { |
2575 | DRM_DEBUG_KMS("intel fb init failed\n"); | 2581 | DRM_DEBUG_KMS("intel fb init failed\n"); |
2576 | goto out_unref_obj; | 2582 | goto out_unref_obj; |
2577 | } | 2583 | } |
2584 | |||
2578 | mutex_unlock(&dev->struct_mutex); | 2585 | mutex_unlock(&dev->struct_mutex); |
2579 | 2586 | ||
2580 | DRM_DEBUG_KMS("initial plane fb obj %p\n", obj); | 2587 | DRM_DEBUG_KMS("initial plane fb obj %p\n", obj); |
@@ -4785,9 +4792,6 @@ static void intel_post_plane_update(struct intel_crtc *crtc) | |||
4785 | to_intel_crtc_state(crtc->base.state); | 4792 | to_intel_crtc_state(crtc->base.state); |
4786 | struct drm_device *dev = crtc->base.dev; | 4793 | struct drm_device *dev = crtc->base.dev; |
4787 | 4794 | ||
4788 | if (atomic->wait_vblank) | ||
4789 | intel_wait_for_vblank(dev, crtc->pipe); | ||
4790 | |||
4791 | intel_frontbuffer_flip(dev, atomic->fb_bits); | 4795 | intel_frontbuffer_flip(dev, atomic->fb_bits); |
4792 | 4796 | ||
4793 | crtc->wm.cxsr_allowed = true; | 4797 | crtc->wm.cxsr_allowed = true; |
@@ -5301,31 +5305,37 @@ intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder) | |||
5301 | } | 5305 | } |
5302 | } | 5306 | } |
5303 | 5307 | ||
5304 | static unsigned long get_crtc_power_domains(struct drm_crtc *crtc) | 5308 | static unsigned long get_crtc_power_domains(struct drm_crtc *crtc, |
5309 | struct intel_crtc_state *crtc_state) | ||
5305 | { | 5310 | { |
5306 | struct drm_device *dev = crtc->dev; | 5311 | struct drm_device *dev = crtc->dev; |
5307 | struct intel_encoder *intel_encoder; | 5312 | struct drm_encoder *encoder; |
5308 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5313 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
5309 | enum pipe pipe = intel_crtc->pipe; | 5314 | enum pipe pipe = intel_crtc->pipe; |
5310 | unsigned long mask; | 5315 | unsigned long mask; |
5311 | enum transcoder transcoder = intel_crtc->config->cpu_transcoder; | 5316 | enum transcoder transcoder = crtc_state->cpu_transcoder; |
5312 | 5317 | ||
5313 | if (!crtc->state->active) | 5318 | if (!crtc_state->base.active) |
5314 | return 0; | 5319 | return 0; |
5315 | 5320 | ||
5316 | mask = BIT(POWER_DOMAIN_PIPE(pipe)); | 5321 | mask = BIT(POWER_DOMAIN_PIPE(pipe)); |
5317 | mask |= BIT(POWER_DOMAIN_TRANSCODER(transcoder)); | 5322 | mask |= BIT(POWER_DOMAIN_TRANSCODER(transcoder)); |
5318 | if (intel_crtc->config->pch_pfit.enabled || | 5323 | if (crtc_state->pch_pfit.enabled || |
5319 | intel_crtc->config->pch_pfit.force_thru) | 5324 | crtc_state->pch_pfit.force_thru) |
5320 | mask |= BIT(POWER_DOMAIN_PIPE_PANEL_FITTER(pipe)); | 5325 | mask |= BIT(POWER_DOMAIN_PIPE_PANEL_FITTER(pipe)); |
5321 | 5326 | ||
5322 | for_each_encoder_on_crtc(dev, crtc, intel_encoder) | 5327 | drm_for_each_encoder_mask(encoder, dev, crtc_state->base.encoder_mask) { |
5328 | struct intel_encoder *intel_encoder = to_intel_encoder(encoder); | ||
5329 | |||
5323 | mask |= BIT(intel_display_port_power_domain(intel_encoder)); | 5330 | mask |= BIT(intel_display_port_power_domain(intel_encoder)); |
5331 | } | ||
5324 | 5332 | ||
5325 | return mask; | 5333 | return mask; |
5326 | } | 5334 | } |
5327 | 5335 | ||
5328 | static unsigned long modeset_get_crtc_power_domains(struct drm_crtc *crtc) | 5336 | static unsigned long |
5337 | modeset_get_crtc_power_domains(struct drm_crtc *crtc, | ||
5338 | struct intel_crtc_state *crtc_state) | ||
5329 | { | 5339 | { |
5330 | struct drm_i915_private *dev_priv = crtc->dev->dev_private; | 5340 | struct drm_i915_private *dev_priv = crtc->dev->dev_private; |
5331 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5341 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
@@ -5333,7 +5343,8 @@ static unsigned long modeset_get_crtc_power_domains(struct drm_crtc *crtc) | |||
5333 | unsigned long domains, new_domains, old_domains; | 5343 | unsigned long domains, new_domains, old_domains; |
5334 | 5344 | ||
5335 | old_domains = intel_crtc->enabled_power_domains; | 5345 | old_domains = intel_crtc->enabled_power_domains; |
5336 | intel_crtc->enabled_power_domains = new_domains = get_crtc_power_domains(crtc); | 5346 | intel_crtc->enabled_power_domains = new_domains = |
5347 | get_crtc_power_domains(crtc, crtc_state); | ||
5337 | 5348 | ||
5338 | domains = new_domains & ~old_domains; | 5349 | domains = new_domains & ~old_domains; |
5339 | 5350 | ||
@@ -5352,31 +5363,6 @@ static void modeset_put_power_domains(struct drm_i915_private *dev_priv, | |||
5352 | intel_display_power_put(dev_priv, domain); | 5363 | intel_display_power_put(dev_priv, domain); |
5353 | } | 5364 | } |
5354 | 5365 | ||
5355 | static void modeset_update_crtc_power_domains(struct drm_atomic_state *state) | ||
5356 | { | ||
5357 | struct intel_atomic_state *intel_state = to_intel_atomic_state(state); | ||
5358 | struct drm_device *dev = state->dev; | ||
5359 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5360 | unsigned long put_domains[I915_MAX_PIPES] = {}; | ||
5361 | struct drm_crtc_state *crtc_state; | ||
5362 | struct drm_crtc *crtc; | ||
5363 | int i; | ||
5364 | |||
5365 | for_each_crtc_in_state(state, crtc, crtc_state, i) { | ||
5366 | if (needs_modeset(crtc->state)) | ||
5367 | put_domains[to_intel_crtc(crtc)->pipe] = | ||
5368 | modeset_get_crtc_power_domains(crtc); | ||
5369 | } | ||
5370 | |||
5371 | if (dev_priv->display.modeset_commit_cdclk && | ||
5372 | intel_state->dev_cdclk != dev_priv->cdclk_freq) | ||
5373 | dev_priv->display.modeset_commit_cdclk(state); | ||
5374 | |||
5375 | for (i = 0; i < I915_MAX_PIPES; i++) | ||
5376 | if (put_domains[i]) | ||
5377 | modeset_put_power_domains(dev_priv, put_domains[i]); | ||
5378 | } | ||
5379 | |||
5380 | static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) | 5366 | static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv) |
5381 | { | 5367 | { |
5382 | int max_cdclk_freq = dev_priv->max_cdclk_freq; | 5368 | int max_cdclk_freq = dev_priv->max_cdclk_freq; |
@@ -6039,8 +6025,7 @@ static int broxton_calc_cdclk(struct drm_i915_private *dev_priv, | |||
6039 | return 144000; | 6025 | return 144000; |
6040 | } | 6026 | } |
6041 | 6027 | ||
6042 | /* Compute the max pixel clock for new configuration. Uses atomic state if | 6028 | /* Compute the max pixel clock for new configuration. */ |
6043 | * that's non-NULL, look at current state otherwise. */ | ||
6044 | static int intel_mode_max_pixclk(struct drm_device *dev, | 6029 | static int intel_mode_max_pixclk(struct drm_device *dev, |
6045 | struct drm_atomic_state *state) | 6030 | struct drm_atomic_state *state) |
6046 | { | 6031 | { |
@@ -6063,9 +6048,6 @@ static int intel_mode_max_pixclk(struct drm_device *dev, | |||
6063 | intel_state->min_pixclk[i] = pixclk; | 6048 | intel_state->min_pixclk[i] = pixclk; |
6064 | } | 6049 | } |
6065 | 6050 | ||
6066 | if (!intel_state->active_crtcs) | ||
6067 | return 0; | ||
6068 | |||
6069 | for_each_pipe(dev_priv, pipe) | 6051 | for_each_pipe(dev_priv, pipe) |
6070 | max_pixclk = max(intel_state->min_pixclk[pipe], max_pixclk); | 6052 | max_pixclk = max(intel_state->min_pixclk[pipe], max_pixclk); |
6071 | 6053 | ||
@@ -6393,55 +6375,16 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc) | |||
6393 | */ | 6375 | */ |
6394 | int intel_display_suspend(struct drm_device *dev) | 6376 | int intel_display_suspend(struct drm_device *dev) |
6395 | { | 6377 | { |
6396 | struct drm_mode_config *config = &dev->mode_config; | 6378 | struct drm_i915_private *dev_priv = to_i915(dev); |
6397 | struct drm_modeset_acquire_ctx *ctx = config->acquire_ctx; | ||
6398 | struct drm_atomic_state *state; | 6379 | struct drm_atomic_state *state; |
6399 | struct drm_crtc *crtc; | 6380 | int ret; |
6400 | unsigned crtc_mask = 0; | ||
6401 | int ret = 0; | ||
6402 | |||
6403 | if (WARN_ON(!ctx)) | ||
6404 | return 0; | ||
6405 | |||
6406 | lockdep_assert_held(&ctx->ww_ctx); | ||
6407 | state = drm_atomic_state_alloc(dev); | ||
6408 | if (WARN_ON(!state)) | ||
6409 | return -ENOMEM; | ||
6410 | |||
6411 | state->acquire_ctx = ctx; | ||
6412 | state->allow_modeset = true; | ||
6413 | |||
6414 | for_each_crtc(dev, crtc) { | ||
6415 | struct drm_crtc_state *crtc_state = | ||
6416 | drm_atomic_get_crtc_state(state, crtc); | ||
6417 | |||
6418 | ret = PTR_ERR_OR_ZERO(crtc_state); | ||
6419 | if (ret) | ||
6420 | goto free; | ||
6421 | |||
6422 | if (!crtc_state->active) | ||
6423 | continue; | ||
6424 | |||
6425 | crtc_state->active = false; | ||
6426 | crtc_mask |= 1 << drm_crtc_index(crtc); | ||
6427 | } | ||
6428 | |||
6429 | if (crtc_mask) { | ||
6430 | ret = drm_atomic_commit(state); | ||
6431 | |||
6432 | if (!ret) { | ||
6433 | for_each_crtc(dev, crtc) | ||
6434 | if (crtc_mask & (1 << drm_crtc_index(crtc))) | ||
6435 | crtc->state->active = true; | ||
6436 | |||
6437 | return ret; | ||
6438 | } | ||
6439 | } | ||
6440 | 6381 | ||
6441 | free: | 6382 | state = drm_atomic_helper_suspend(dev); |
6383 | ret = PTR_ERR_OR_ZERO(state); | ||
6442 | if (ret) | 6384 | if (ret) |
6443 | DRM_ERROR("Suspending crtc's failed with %i\n", ret); | 6385 | DRM_ERROR("Suspending crtc's failed with %i\n", ret); |
6444 | drm_atomic_state_free(state); | 6386 | else |
6387 | dev_priv->modeset_restore_state = state; | ||
6445 | return ret; | 6388 | return ret; |
6446 | } | 6389 | } |
6447 | 6390 | ||
@@ -8181,18 +8124,22 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc, | |||
8181 | { | 8124 | { |
8182 | struct drm_device *dev = crtc->base.dev; | 8125 | struct drm_device *dev = crtc->base.dev; |
8183 | struct drm_i915_private *dev_priv = dev->dev_private; | 8126 | struct drm_i915_private *dev_priv = dev->dev_private; |
8127 | enum intel_display_power_domain power_domain; | ||
8184 | uint32_t tmp; | 8128 | uint32_t tmp; |
8129 | bool ret; | ||
8185 | 8130 | ||
8186 | if (!intel_display_power_is_enabled(dev_priv, | 8131 | power_domain = POWER_DOMAIN_PIPE(crtc->pipe); |
8187 | POWER_DOMAIN_PIPE(crtc->pipe))) | 8132 | if (!intel_display_power_get_if_enabled(dev_priv, power_domain)) |
8188 | return false; | 8133 | return false; |
8189 | 8134 | ||
8190 | pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe; | 8135 | pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe; |
8191 | pipe_config->shared_dpll = DPLL_ID_PRIVATE; | 8136 | pipe_config->shared_dpll = DPLL_ID_PRIVATE; |
8192 | 8137 | ||
8138 | ret = false; | ||
8139 | |||
8193 | tmp = I915_READ(PIPECONF(crtc->pipe)); | 8140 | tmp = I915_READ(PIPECONF(crtc->pipe)); |
8194 | if (!(tmp & PIPECONF_ENABLE)) | 8141 | if (!(tmp & PIPECONF_ENABLE)) |
8195 | return false; | 8142 | goto out; |
8196 | 8143 | ||
8197 | if (IS_G4X(dev) || IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { | 8144 | if (IS_G4X(dev) || IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) { |
8198 | switch (tmp & PIPECONF_BPC_MASK) { | 8145 | switch (tmp & PIPECONF_BPC_MASK) { |
@@ -8272,7 +8219,12 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc, | |||
8272 | pipe_config->base.adjusted_mode.crtc_clock = | 8219 | pipe_config->base.adjusted_mode.crtc_clock = |
8273 | pipe_config->port_clock / pipe_config->pixel_multiplier; | 8220 | pipe_config->port_clock / pipe_config->pixel_multiplier; |
8274 | 8221 | ||
8275 | return true; | 8222 | ret = true; |
8223 | |||
8224 | out: | ||
8225 | intel_display_power_put(dev_priv, power_domain); | ||
8226 | |||
8227 | return ret; | ||
8276 | } | 8228 | } |
8277 | 8229 | ||
8278 | static void ironlake_init_pch_refclk(struct drm_device *dev) | 8230 | static void ironlake_init_pch_refclk(struct drm_device *dev) |
@@ -9376,18 +9328,21 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc, | |||
9376 | { | 9328 | { |
9377 | struct drm_device *dev = crtc->base.dev; | 9329 | struct drm_device *dev = crtc->base.dev; |
9378 | struct drm_i915_private *dev_priv = dev->dev_private; | 9330 | struct drm_i915_private *dev_priv = dev->dev_private; |
9331 | enum intel_display_power_domain power_domain; | ||
9379 | uint32_t tmp; | 9332 | uint32_t tmp; |
9333 | bool ret; | ||
9380 | 9334 | ||
9381 | if (!intel_display_power_is_enabled(dev_priv, | 9335 | power_domain = POWER_DOMAIN_PIPE(crtc->pipe); |
9382 | POWER_DOMAIN_PIPE(crtc->pipe))) | 9336 | if (!intel_display_power_get_if_enabled(dev_priv, power_domain)) |
9383 | return false; | 9337 | return false; |
9384 | 9338 | ||
9385 | pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe; | 9339 | pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe; |
9386 | pipe_config->shared_dpll = DPLL_ID_PRIVATE; | 9340 | pipe_config->shared_dpll = DPLL_ID_PRIVATE; |
9387 | 9341 | ||
9342 | ret = false; | ||
9388 | tmp = I915_READ(PIPECONF(crtc->pipe)); | 9343 | tmp = I915_READ(PIPECONF(crtc->pipe)); |
9389 | if (!(tmp & PIPECONF_ENABLE)) | 9344 | if (!(tmp & PIPECONF_ENABLE)) |
9390 | return false; | 9345 | goto out; |
9391 | 9346 | ||
9392 | switch (tmp & PIPECONF_BPC_MASK) { | 9347 | switch (tmp & PIPECONF_BPC_MASK) { |
9393 | case PIPECONF_6BPC: | 9348 | case PIPECONF_6BPC: |
@@ -9450,7 +9405,12 @@ static bool ironlake_get_pipe_config(struct intel_crtc *crtc, | |||
9450 | 9405 | ||
9451 | ironlake_get_pfit_config(crtc, pipe_config); | 9406 | ironlake_get_pfit_config(crtc, pipe_config); |
9452 | 9407 | ||
9453 | return true; | 9408 | ret = true; |
9409 | |||
9410 | out: | ||
9411 | intel_display_power_put(dev_priv, power_domain); | ||
9412 | |||
9413 | return ret; | ||
9454 | } | 9414 | } |
9455 | 9415 | ||
9456 | static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv) | 9416 | static void assert_can_disable_lcpll(struct drm_i915_private *dev_priv) |
@@ -9716,9 +9676,6 @@ static int ilk_max_pixel_rate(struct drm_atomic_state *state) | |||
9716 | intel_state->min_pixclk[i] = pixel_rate; | 9676 | intel_state->min_pixclk[i] = pixel_rate; |
9717 | } | 9677 | } |
9718 | 9678 | ||
9719 | if (!intel_state->active_crtcs) | ||
9720 | return 0; | ||
9721 | |||
9722 | for_each_pipe(dev_priv, pipe) | 9679 | for_each_pipe(dev_priv, pipe) |
9723 | max_pixel_rate = max(intel_state->min_pixclk[pipe], max_pixel_rate); | 9680 | max_pixel_rate = max(intel_state->min_pixclk[pipe], max_pixel_rate); |
9724 | 9681 | ||
@@ -9982,12 +9939,17 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, | |||
9982 | { | 9939 | { |
9983 | struct drm_device *dev = crtc->base.dev; | 9940 | struct drm_device *dev = crtc->base.dev; |
9984 | struct drm_i915_private *dev_priv = dev->dev_private; | 9941 | struct drm_i915_private *dev_priv = dev->dev_private; |
9985 | enum intel_display_power_domain pfit_domain; | 9942 | enum intel_display_power_domain power_domain; |
9943 | unsigned long power_domain_mask; | ||
9986 | uint32_t tmp; | 9944 | uint32_t tmp; |
9945 | bool ret; | ||
9987 | 9946 | ||
9988 | if (!intel_display_power_is_enabled(dev_priv, | 9947 | power_domain = POWER_DOMAIN_PIPE(crtc->pipe); |
9989 | POWER_DOMAIN_PIPE(crtc->pipe))) | 9948 | if (!intel_display_power_get_if_enabled(dev_priv, power_domain)) |
9990 | return false; | 9949 | return false; |
9950 | power_domain_mask = BIT(power_domain); | ||
9951 | |||
9952 | ret = false; | ||
9991 | 9953 | ||
9992 | pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe; | 9954 | pipe_config->cpu_transcoder = (enum transcoder) crtc->pipe; |
9993 | pipe_config->shared_dpll = DPLL_ID_PRIVATE; | 9955 | pipe_config->shared_dpll = DPLL_ID_PRIVATE; |
@@ -10014,13 +9976,14 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, | |||
10014 | pipe_config->cpu_transcoder = TRANSCODER_EDP; | 9976 | pipe_config->cpu_transcoder = TRANSCODER_EDP; |
10015 | } | 9977 | } |
10016 | 9978 | ||
10017 | if (!intel_display_power_is_enabled(dev_priv, | 9979 | power_domain = POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder); |
10018 | POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder))) | 9980 | if (!intel_display_power_get_if_enabled(dev_priv, power_domain)) |
10019 | return false; | 9981 | goto out; |
9982 | power_domain_mask |= BIT(power_domain); | ||
10020 | 9983 | ||
10021 | tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder)); | 9984 | tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder)); |
10022 | if (!(tmp & PIPECONF_ENABLE)) | 9985 | if (!(tmp & PIPECONF_ENABLE)) |
10023 | return false; | 9986 | goto out; |
10024 | 9987 | ||
10025 | haswell_get_ddi_port_state(crtc, pipe_config); | 9988 | haswell_get_ddi_port_state(crtc, pipe_config); |
10026 | 9989 | ||
@@ -10030,14 +9993,14 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, | |||
10030 | skl_init_scalers(dev, crtc, pipe_config); | 9993 | skl_init_scalers(dev, crtc, pipe_config); |
10031 | } | 9994 | } |
10032 | 9995 | ||
10033 | pfit_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe); | ||
10034 | |||
10035 | if (INTEL_INFO(dev)->gen >= 9) { | 9996 | if (INTEL_INFO(dev)->gen >= 9) { |
10036 | pipe_config->scaler_state.scaler_id = -1; | 9997 | pipe_config->scaler_state.scaler_id = -1; |
10037 | pipe_config->scaler_state.scaler_users &= ~(1 << SKL_CRTC_INDEX); | 9998 | pipe_config->scaler_state.scaler_users &= ~(1 << SKL_CRTC_INDEX); |
10038 | } | 9999 | } |
10039 | 10000 | ||
10040 | if (intel_display_power_is_enabled(dev_priv, pfit_domain)) { | 10001 | power_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe); |
10002 | if (intel_display_power_get_if_enabled(dev_priv, power_domain)) { | ||
10003 | power_domain_mask |= BIT(power_domain); | ||
10041 | if (INTEL_INFO(dev)->gen >= 9) | 10004 | if (INTEL_INFO(dev)->gen >= 9) |
10042 | skylake_get_pfit_config(crtc, pipe_config); | 10005 | skylake_get_pfit_config(crtc, pipe_config); |
10043 | else | 10006 | else |
@@ -10055,7 +10018,13 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, | |||
10055 | pipe_config->pixel_multiplier = 1; | 10018 | pipe_config->pixel_multiplier = 1; |
10056 | } | 10019 | } |
10057 | 10020 | ||
10058 | return true; | 10021 | ret = true; |
10022 | |||
10023 | out: | ||
10024 | for_each_power_domain(power_domain, power_domain_mask) | ||
10025 | intel_display_power_put(dev_priv, power_domain); | ||
10026 | |||
10027 | return ret; | ||
10059 | } | 10028 | } |
10060 | 10029 | ||
10061 | static void i845_update_cursor(struct drm_crtc *crtc, u32 base, | 10030 | static void i845_update_cursor(struct drm_crtc *crtc, u32 base, |
@@ -10376,6 +10345,7 @@ mode_fits_in_fbdev(struct drm_device *dev, | |||
10376 | if (obj->base.size < mode->vdisplay * fb->pitches[0]) | 10345 | if (obj->base.size < mode->vdisplay * fb->pitches[0]) |
10377 | return NULL; | 10346 | return NULL; |
10378 | 10347 | ||
10348 | drm_framebuffer_reference(fb); | ||
10379 | return fb; | 10349 | return fb; |
10380 | #else | 10350 | #else |
10381 | return NULL; | 10351 | return NULL; |
@@ -10431,7 +10401,7 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, | |||
10431 | struct drm_device *dev = encoder->dev; | 10401 | struct drm_device *dev = encoder->dev; |
10432 | struct drm_framebuffer *fb; | 10402 | struct drm_framebuffer *fb; |
10433 | struct drm_mode_config *config = &dev->mode_config; | 10403 | struct drm_mode_config *config = &dev->mode_config; |
10434 | struct drm_atomic_state *state = NULL; | 10404 | struct drm_atomic_state *state = NULL, *restore_state = NULL; |
10435 | struct drm_connector_state *connector_state; | 10405 | struct drm_connector_state *connector_state; |
10436 | struct intel_crtc_state *crtc_state; | 10406 | struct intel_crtc_state *crtc_state; |
10437 | int ret, i = -1; | 10407 | int ret, i = -1; |
@@ -10440,6 +10410,8 @@ bool intel_get_load_detect_pipe(struct drm_connector *connector, | |||
10440 | connector->base.id, connector->name, | 10410 | connector->base.id, connector->name, |
10441 | encoder->base.id, encoder->name); | 10411 | encoder->base.id, encoder->name); |
10442 | 10412 | ||
10413 | old->restore_state = NULL; | ||
10414 | |||
10443 | retry: | 10415 | retry: |
10444 | ret = drm_modeset_lock(&config->connection_mutex, ctx); | 10416 | ret = drm_modeset_lock(&config->connection_mutex, ctx); |
10445 | if (ret) | 10417 | if (ret) |
@@ -10456,24 +10428,15 @@ retry: | |||
10456 | */ | 10428 | */ |
10457 | 10429 | ||
10458 | /* See if we already have a CRTC for this connector */ | 10430 | /* See if we already have a CRTC for this connector */ |
10459 | if (encoder->crtc) { | 10431 | if (connector->state->crtc) { |
10460 | crtc = encoder->crtc; | 10432 | crtc = connector->state->crtc; |
10461 | 10433 | ||
10462 | ret = drm_modeset_lock(&crtc->mutex, ctx); | 10434 | ret = drm_modeset_lock(&crtc->mutex, ctx); |
10463 | if (ret) | 10435 | if (ret) |
10464 | goto fail; | 10436 | goto fail; |
10465 | ret = drm_modeset_lock(&crtc->primary->mutex, ctx); | ||
10466 | if (ret) | ||
10467 | goto fail; | ||
10468 | |||
10469 | old->dpms_mode = connector->dpms; | ||
10470 | old->load_detect_temp = false; | ||
10471 | 10437 | ||
10472 | /* Make sure the crtc and connector are running */ | 10438 | /* Make sure the crtc and connector are running */ |
10473 | if (connector->dpms != DRM_MODE_DPMS_ON) | 10439 | goto found; |
10474 | connector->funcs->dpms(connector, DRM_MODE_DPMS_ON); | ||
10475 | |||
10476 | return true; | ||
10477 | } | 10440 | } |
10478 | 10441 | ||
10479 | /* Find an unused one (if possible) */ | 10442 | /* Find an unused one (if possible) */ |
@@ -10481,8 +10444,15 @@ retry: | |||
10481 | i++; | 10444 | i++; |
10482 | if (!(encoder->possible_crtcs & (1 << i))) | 10445 | if (!(encoder->possible_crtcs & (1 << i))) |
10483 | continue; | 10446 | continue; |
10484 | if (possible_crtc->state->enable) | 10447 | |
10448 | ret = drm_modeset_lock(&possible_crtc->mutex, ctx); | ||
10449 | if (ret) | ||
10450 | goto fail; | ||
10451 | |||
10452 | if (possible_crtc->state->enable) { | ||
10453 | drm_modeset_unlock(&possible_crtc->mutex); | ||
10485 | continue; | 10454 | continue; |
10455 | } | ||
10486 | 10456 | ||
10487 | crtc = possible_crtc; | 10457 | crtc = possible_crtc; |
10488 | break; | 10458 | break; |
@@ -10496,23 +10466,22 @@ retry: | |||
10496 | goto fail; | 10466 | goto fail; |
10497 | } | 10467 | } |
10498 | 10468 | ||
10499 | ret = drm_modeset_lock(&crtc->mutex, ctx); | 10469 | found: |
10500 | if (ret) | 10470 | intel_crtc = to_intel_crtc(crtc); |
10501 | goto fail; | 10471 | |
10502 | ret = drm_modeset_lock(&crtc->primary->mutex, ctx); | 10472 | ret = drm_modeset_lock(&crtc->primary->mutex, ctx); |
10503 | if (ret) | 10473 | if (ret) |
10504 | goto fail; | 10474 | goto fail; |
10505 | 10475 | ||
10506 | intel_crtc = to_intel_crtc(crtc); | ||
10507 | old->dpms_mode = connector->dpms; | ||
10508 | old->load_detect_temp = true; | ||
10509 | old->release_fb = NULL; | ||
10510 | |||
10511 | state = drm_atomic_state_alloc(dev); | 10476 | state = drm_atomic_state_alloc(dev); |
10512 | if (!state) | 10477 | restore_state = drm_atomic_state_alloc(dev); |
10513 | return false; | 10478 | if (!state || !restore_state) { |
10479 | ret = -ENOMEM; | ||
10480 | goto fail; | ||
10481 | } | ||
10514 | 10482 | ||
10515 | state->acquire_ctx = ctx; | 10483 | state->acquire_ctx = ctx; |
10484 | restore_state->acquire_ctx = ctx; | ||
10516 | 10485 | ||
10517 | connector_state = drm_atomic_get_connector_state(state, connector); | 10486 | connector_state = drm_atomic_get_connector_state(state, connector); |
10518 | if (IS_ERR(connector_state)) { | 10487 | if (IS_ERR(connector_state)) { |
@@ -10520,7 +10489,9 @@ retry: | |||
10520 | goto fail; | 10489 | goto fail; |
10521 | } | 10490 | } |
10522 | 10491 | ||
10523 | connector_state->crtc = crtc; | 10492 | ret = drm_atomic_set_crtc_for_connector(connector_state, crtc); |
10493 | if (ret) | ||
10494 | goto fail; | ||
10524 | 10495 | ||
10525 | crtc_state = intel_atomic_get_crtc_state(state, intel_crtc); | 10496 | crtc_state = intel_atomic_get_crtc_state(state, intel_crtc); |
10526 | if (IS_ERR(crtc_state)) { | 10497 | if (IS_ERR(crtc_state)) { |
@@ -10544,7 +10515,6 @@ retry: | |||
10544 | if (fb == NULL) { | 10515 | if (fb == NULL) { |
10545 | DRM_DEBUG_KMS("creating tmp fb for load-detection\n"); | 10516 | DRM_DEBUG_KMS("creating tmp fb for load-detection\n"); |
10546 | fb = intel_framebuffer_create_for_mode(dev, mode, 24, 32); | 10517 | fb = intel_framebuffer_create_for_mode(dev, mode, 24, 32); |
10547 | old->release_fb = fb; | ||
10548 | } else | 10518 | } else |
10549 | DRM_DEBUG_KMS("reusing fbdev for load-detection framebuffer\n"); | 10519 | DRM_DEBUG_KMS("reusing fbdev for load-detection framebuffer\n"); |
10550 | if (IS_ERR(fb)) { | 10520 | if (IS_ERR(fb)) { |
@@ -10556,15 +10526,28 @@ retry: | |||
10556 | if (ret) | 10526 | if (ret) |
10557 | goto fail; | 10527 | goto fail; |
10558 | 10528 | ||
10559 | drm_mode_copy(&crtc_state->base.mode, mode); | 10529 | drm_framebuffer_unreference(fb); |
10530 | |||
10531 | ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode); | ||
10532 | if (ret) | ||
10533 | goto fail; | ||
10534 | |||
10535 | ret = PTR_ERR_OR_ZERO(drm_atomic_get_connector_state(restore_state, connector)); | ||
10536 | if (!ret) | ||
10537 | ret = PTR_ERR_OR_ZERO(drm_atomic_get_crtc_state(restore_state, crtc)); | ||
10538 | if (!ret) | ||
10539 | ret = PTR_ERR_OR_ZERO(drm_atomic_get_plane_state(restore_state, crtc->primary)); | ||
10540 | if (ret) { | ||
10541 | DRM_DEBUG_KMS("Failed to create a copy of old state to restore: %i\n", ret); | ||
10542 | goto fail; | ||
10543 | } | ||
10560 | 10544 | ||
10561 | if (drm_atomic_commit(state)) { | 10545 | if (drm_atomic_commit(state)) { |
10562 | DRM_DEBUG_KMS("failed to set mode on load-detect pipe\n"); | 10546 | DRM_DEBUG_KMS("failed to set mode on load-detect pipe\n"); |
10563 | if (old->release_fb) | ||
10564 | old->release_fb->funcs->destroy(old->release_fb); | ||
10565 | goto fail; | 10547 | goto fail; |
10566 | } | 10548 | } |
10567 | crtc->primary->crtc = crtc; | 10549 | |
10550 | old->restore_state = restore_state; | ||
10568 | 10551 | ||
10569 | /* let the connector get through one full cycle before testing */ | 10552 | /* let the connector get through one full cycle before testing */ |
10570 | intel_wait_for_vblank(dev, intel_crtc->pipe); | 10553 | intel_wait_for_vblank(dev, intel_crtc->pipe); |
@@ -10572,7 +10555,8 @@ retry: | |||
10572 | 10555 | ||
10573 | fail: | 10556 | fail: |
10574 | drm_atomic_state_free(state); | 10557 | drm_atomic_state_free(state); |
10575 | state = NULL; | 10558 | drm_atomic_state_free(restore_state); |
10559 | restore_state = state = NULL; | ||
10576 | 10560 | ||
10577 | if (ret == -EDEADLK) { | 10561 | if (ret == -EDEADLK) { |
10578 | drm_modeset_backoff(ctx); | 10562 | drm_modeset_backoff(ctx); |
@@ -10586,65 +10570,24 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, | |||
10586 | struct intel_load_detect_pipe *old, | 10570 | struct intel_load_detect_pipe *old, |
10587 | struct drm_modeset_acquire_ctx *ctx) | 10571 | struct drm_modeset_acquire_ctx *ctx) |
10588 | { | 10572 | { |
10589 | struct drm_device *dev = connector->dev; | ||
10590 | struct intel_encoder *intel_encoder = | 10573 | struct intel_encoder *intel_encoder = |
10591 | intel_attached_encoder(connector); | 10574 | intel_attached_encoder(connector); |
10592 | struct drm_encoder *encoder = &intel_encoder->base; | 10575 | struct drm_encoder *encoder = &intel_encoder->base; |
10593 | struct drm_crtc *crtc = encoder->crtc; | 10576 | struct drm_atomic_state *state = old->restore_state; |
10594 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
10595 | struct drm_atomic_state *state; | ||
10596 | struct drm_connector_state *connector_state; | ||
10597 | struct intel_crtc_state *crtc_state; | ||
10598 | int ret; | 10577 | int ret; |
10599 | 10578 | ||
10600 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", | 10579 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", |
10601 | connector->base.id, connector->name, | 10580 | connector->base.id, connector->name, |
10602 | encoder->base.id, encoder->name); | 10581 | encoder->base.id, encoder->name); |
10603 | 10582 | ||
10604 | if (old->load_detect_temp) { | 10583 | if (!state) |
10605 | state = drm_atomic_state_alloc(dev); | ||
10606 | if (!state) | ||
10607 | goto fail; | ||
10608 | |||
10609 | state->acquire_ctx = ctx; | ||
10610 | |||
10611 | connector_state = drm_atomic_get_connector_state(state, connector); | ||
10612 | if (IS_ERR(connector_state)) | ||
10613 | goto fail; | ||
10614 | |||
10615 | crtc_state = intel_atomic_get_crtc_state(state, intel_crtc); | ||
10616 | if (IS_ERR(crtc_state)) | ||
10617 | goto fail; | ||
10618 | |||
10619 | connector_state->crtc = NULL; | ||
10620 | |||
10621 | crtc_state->base.enable = crtc_state->base.active = false; | ||
10622 | |||
10623 | ret = intel_modeset_setup_plane_state(state, crtc, NULL, NULL, | ||
10624 | 0, 0); | ||
10625 | if (ret) | ||
10626 | goto fail; | ||
10627 | |||
10628 | ret = drm_atomic_commit(state); | ||
10629 | if (ret) | ||
10630 | goto fail; | ||
10631 | |||
10632 | if (old->release_fb) { | ||
10633 | drm_framebuffer_unregister_private(old->release_fb); | ||
10634 | drm_framebuffer_unreference(old->release_fb); | ||
10635 | } | ||
10636 | |||
10637 | return; | 10584 | return; |
10638 | } | ||
10639 | |||
10640 | /* Switch crtc and encoder back off if necessary */ | ||
10641 | if (old->dpms_mode != DRM_MODE_DPMS_ON) | ||
10642 | connector->funcs->dpms(connector, old->dpms_mode); | ||
10643 | 10585 | ||
10644 | return; | 10586 | ret = drm_atomic_commit(state); |
10645 | fail: | 10587 | if (ret) { |
10646 | DRM_DEBUG_KMS("Couldn't release load detect pipe.\n"); | 10588 | DRM_DEBUG_KMS("Couldn't release load detect pipe: %i\n", ret); |
10647 | drm_atomic_state_free(state); | 10589 | drm_atomic_state_free(state); |
10590 | } | ||
10648 | } | 10591 | } |
10649 | 10592 | ||
10650 | static int i9xx_pll_refclk(struct drm_device *dev, | 10593 | static int i9xx_pll_refclk(struct drm_device *dev, |
@@ -10996,6 +10939,12 @@ static bool page_flip_finished(struct intel_crtc *crtc) | |||
10996 | return true; | 10939 | return true; |
10997 | 10940 | ||
10998 | /* | 10941 | /* |
10942 | * BDW signals flip done immediately if the plane | ||
10943 | * is disabled, even if the plane enable is already | ||
10944 | * armed to occur at the next vblank :( | ||
10945 | */ | ||
10946 | |||
10947 | /* | ||
10999 | * A DSPSURFLIVE check isn't enough in case the mmio and CS flips | 10948 | * A DSPSURFLIVE check isn't enough in case the mmio and CS flips |
11000 | * used the same base address. In that case the mmio flip might | 10949 | * used the same base address. In that case the mmio flip might |
11001 | * have completed, but the CS hasn't even executed the flip yet. | 10950 | * have completed, but the CS hasn't even executed the flip yet. |
@@ -11839,7 +11788,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, | |||
11839 | struct intel_plane_state *old_plane_state = | 11788 | struct intel_plane_state *old_plane_state = |
11840 | to_intel_plane_state(plane->state); | 11789 | to_intel_plane_state(plane->state); |
11841 | int idx = intel_crtc->base.base.id, ret; | 11790 | int idx = intel_crtc->base.base.id, ret; |
11842 | int i = drm_plane_index(plane); | ||
11843 | bool mode_changed = needs_modeset(crtc_state); | 11791 | bool mode_changed = needs_modeset(crtc_state); |
11844 | bool was_crtc_enabled = crtc->state->active; | 11792 | bool was_crtc_enabled = crtc->state->active; |
11845 | bool is_crtc_enabled = crtc_state->active; | 11793 | bool is_crtc_enabled = crtc_state->active; |
@@ -11872,6 +11820,9 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, | |||
11872 | if (!was_visible && !visible) | 11820 | if (!was_visible && !visible) |
11873 | return 0; | 11821 | return 0; |
11874 | 11822 | ||
11823 | if (fb != old_plane_state->base.fb) | ||
11824 | pipe_config->fb_changed = true; | ||
11825 | |||
11875 | turn_off = was_visible && (!visible || mode_changed); | 11826 | turn_off = was_visible && (!visible || mode_changed); |
11876 | turn_on = visible && (!was_visible || mode_changed); | 11827 | turn_on = visible && (!was_visible || mode_changed); |
11877 | 11828 | ||
@@ -11886,11 +11837,8 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, | |||
11886 | pipe_config->wm_changed = true; | 11837 | pipe_config->wm_changed = true; |
11887 | 11838 | ||
11888 | /* must disable cxsr around plane enable/disable */ | 11839 | /* must disable cxsr around plane enable/disable */ |
11889 | if (plane->type != DRM_PLANE_TYPE_CURSOR) { | 11840 | if (plane->type != DRM_PLANE_TYPE_CURSOR) |
11890 | if (is_crtc_enabled) | ||
11891 | intel_crtc->atomic.wait_vblank = true; | ||
11892 | pipe_config->disable_cxsr = true; | 11841 | pipe_config->disable_cxsr = true; |
11893 | } | ||
11894 | } else if (intel_wm_need_update(plane, plane_state)) { | 11842 | } else if (intel_wm_need_update(plane, plane_state)) { |
11895 | pipe_config->wm_changed = true; | 11843 | pipe_config->wm_changed = true; |
11896 | } | 11844 | } |
@@ -11904,14 +11852,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, | |||
11904 | intel_crtc->atomic.post_enable_primary = turn_on; | 11852 | intel_crtc->atomic.post_enable_primary = turn_on; |
11905 | intel_crtc->atomic.update_fbc = true; | 11853 | intel_crtc->atomic.update_fbc = true; |
11906 | 11854 | ||
11907 | /* | ||
11908 | * BDW signals flip done immediately if the plane | ||
11909 | * is disabled, even if the plane enable is already | ||
11910 | * armed to occur at the next vblank :( | ||
11911 | */ | ||
11912 | if (turn_on && IS_BROADWELL(dev)) | ||
11913 | intel_crtc->atomic.wait_vblank = true; | ||
11914 | |||
11915 | break; | 11855 | break; |
11916 | case DRM_PLANE_TYPE_CURSOR: | 11856 | case DRM_PLANE_TYPE_CURSOR: |
11917 | break; | 11857 | break; |
@@ -11924,13 +11864,8 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state, | |||
11924 | */ | 11864 | */ |
11925 | if (IS_IVYBRIDGE(dev) && | 11865 | if (IS_IVYBRIDGE(dev) && |
11926 | needs_scaling(to_intel_plane_state(plane_state)) && | 11866 | needs_scaling(to_intel_plane_state(plane_state)) && |
11927 | !needs_scaling(old_plane_state)) { | 11867 | !needs_scaling(old_plane_state)) |
11928 | to_intel_crtc_state(crtc_state)->disable_lp_wm = true; | 11868 | pipe_config->disable_lp_wm = true; |
11929 | } else if (turn_off && !mode_changed) { | ||
11930 | intel_crtc->atomic.wait_vblank = true; | ||
11931 | intel_crtc->atomic.update_sprite_watermarks |= | ||
11932 | 1 << i; | ||
11933 | } | ||
11934 | 11869 | ||
11935 | break; | 11870 | break; |
11936 | } | 11871 | } |
@@ -13098,8 +13033,6 @@ static void intel_modeset_clear_plls(struct drm_atomic_state *state) | |||
13098 | struct drm_device *dev = state->dev; | 13033 | struct drm_device *dev = state->dev; |
13099 | struct drm_i915_private *dev_priv = to_i915(dev); | 13034 | struct drm_i915_private *dev_priv = to_i915(dev); |
13100 | struct intel_shared_dpll_config *shared_dpll = NULL; | 13035 | struct intel_shared_dpll_config *shared_dpll = NULL; |
13101 | struct intel_crtc *intel_crtc; | ||
13102 | struct intel_crtc_state *intel_crtc_state; | ||
13103 | struct drm_crtc *crtc; | 13036 | struct drm_crtc *crtc; |
13104 | struct drm_crtc_state *crtc_state; | 13037 | struct drm_crtc_state *crtc_state; |
13105 | int i; | 13038 | int i; |
@@ -13108,21 +13041,21 @@ static void intel_modeset_clear_plls(struct drm_atomic_state *state) | |||
13108 | return; | 13041 | return; |
13109 | 13042 | ||
13110 | for_each_crtc_in_state(state, crtc, crtc_state, i) { | 13043 | for_each_crtc_in_state(state, crtc, crtc_state, i) { |
13111 | int dpll; | 13044 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
13112 | 13045 | int old_dpll = to_intel_crtc_state(crtc->state)->shared_dpll; | |
13113 | intel_crtc = to_intel_crtc(crtc); | ||
13114 | intel_crtc_state = to_intel_crtc_state(crtc_state); | ||
13115 | dpll = intel_crtc_state->shared_dpll; | ||
13116 | 13046 | ||
13117 | if (!needs_modeset(crtc_state) || dpll == DPLL_ID_PRIVATE) | 13047 | if (!needs_modeset(crtc_state)) |
13118 | continue; | 13048 | continue; |
13119 | 13049 | ||
13120 | intel_crtc_state->shared_dpll = DPLL_ID_PRIVATE; | 13050 | to_intel_crtc_state(crtc_state)->shared_dpll = DPLL_ID_PRIVATE; |
13051 | |||
13052 | if (old_dpll == DPLL_ID_PRIVATE) | ||
13053 | continue; | ||
13121 | 13054 | ||
13122 | if (!shared_dpll) | 13055 | if (!shared_dpll) |
13123 | shared_dpll = intel_atomic_get_shared_dpll_state(state); | 13056 | shared_dpll = intel_atomic_get_shared_dpll_state(state); |
13124 | 13057 | ||
13125 | shared_dpll[dpll].crtc_mask &= ~(1 << intel_crtc->pipe); | 13058 | shared_dpll[old_dpll].crtc_mask &= ~(1 << intel_crtc->pipe); |
13126 | } | 13059 | } |
13127 | } | 13060 | } |
13128 | 13061 | ||
@@ -13258,6 +13191,9 @@ static int intel_modeset_checks(struct drm_atomic_state *state) | |||
13258 | 13191 | ||
13259 | if (ret < 0) | 13192 | if (ret < 0) |
13260 | return ret; | 13193 | return ret; |
13194 | |||
13195 | DRM_DEBUG_KMS("New cdclk calculated to be atomic %u, actual %u\n", | ||
13196 | intel_state->cdclk, intel_state->dev_cdclk); | ||
13261 | } else | 13197 | } else |
13262 | to_intel_atomic_state(state)->cdclk = dev_priv->atomic_cdclk_freq; | 13198 | to_intel_atomic_state(state)->cdclk = dev_priv->atomic_cdclk_freq; |
13263 | 13199 | ||
@@ -13463,6 +13399,71 @@ static int intel_atomic_prepare_commit(struct drm_device *dev, | |||
13463 | return ret; | 13399 | return ret; |
13464 | } | 13400 | } |
13465 | 13401 | ||
13402 | static void intel_atomic_wait_for_vblanks(struct drm_device *dev, | ||
13403 | struct drm_i915_private *dev_priv, | ||
13404 | unsigned crtc_mask) | ||
13405 | { | ||
13406 | unsigned last_vblank_count[I915_MAX_PIPES]; | ||
13407 | enum pipe pipe; | ||
13408 | int ret; | ||
13409 | |||
13410 | if (!crtc_mask) | ||
13411 | return; | ||
13412 | |||
13413 | for_each_pipe(dev_priv, pipe) { | ||
13414 | struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; | ||
13415 | |||
13416 | if (!((1 << pipe) & crtc_mask)) | ||
13417 | continue; | ||
13418 | |||
13419 | ret = drm_crtc_vblank_get(crtc); | ||
13420 | if (WARN_ON(ret != 0)) { | ||
13421 | crtc_mask &= ~(1 << pipe); | ||
13422 | continue; | ||
13423 | } | ||
13424 | |||
13425 | last_vblank_count[pipe] = drm_crtc_vblank_count(crtc); | ||
13426 | } | ||
13427 | |||
13428 | for_each_pipe(dev_priv, pipe) { | ||
13429 | struct drm_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; | ||
13430 | long lret; | ||
13431 | |||
13432 | if (!((1 << pipe) & crtc_mask)) | ||
13433 | continue; | ||
13434 | |||
13435 | lret = wait_event_timeout(dev->vblank[pipe].queue, | ||
13436 | last_vblank_count[pipe] != | ||
13437 | drm_crtc_vblank_count(crtc), | ||
13438 | msecs_to_jiffies(50)); | ||
13439 | |||
13440 | WARN_ON(!lret); | ||
13441 | |||
13442 | drm_crtc_vblank_put(crtc); | ||
13443 | } | ||
13444 | } | ||
13445 | |||
13446 | static bool needs_vblank_wait(struct intel_crtc_state *crtc_state) | ||
13447 | { | ||
13448 | /* fb updated, need to unpin old fb */ | ||
13449 | if (crtc_state->fb_changed) | ||
13450 | return true; | ||
13451 | |||
13452 | /* wm changes, need vblank before final wm's */ | ||
13453 | if (crtc_state->wm_changed) | ||
13454 | return true; | ||
13455 | |||
13456 | /* | ||
13457 | * cxsr is re-enabled after vblank. | ||
13458 | * This is already handled by crtc_state->wm_changed, | ||
13459 | * but added for clarity. | ||
13460 | */ | ||
13461 | if (crtc_state->disable_cxsr) | ||
13462 | return true; | ||
13463 | |||
13464 | return false; | ||
13465 | } | ||
13466 | |||
13466 | /** | 13467 | /** |
13467 | * intel_atomic_commit - commit validated state object | 13468 | * intel_atomic_commit - commit validated state object |
13468 | * @dev: DRM device | 13469 | * @dev: DRM device |
@@ -13489,6 +13490,8 @@ static int intel_atomic_commit(struct drm_device *dev, | |||
13489 | struct drm_crtc *crtc; | 13490 | struct drm_crtc *crtc; |
13490 | int ret = 0, i; | 13491 | int ret = 0, i; |
13491 | bool hw_check = intel_state->modeset; | 13492 | bool hw_check = intel_state->modeset; |
13493 | unsigned long put_domains[I915_MAX_PIPES] = {}; | ||
13494 | unsigned crtc_vblank_mask = 0; | ||
13492 | 13495 | ||
13493 | ret = intel_atomic_prepare_commit(dev, state, async); | 13496 | ret = intel_atomic_prepare_commit(dev, state, async); |
13494 | if (ret) { | 13497 | if (ret) { |
@@ -13504,11 +13507,22 @@ static int intel_atomic_commit(struct drm_device *dev, | |||
13504 | sizeof(intel_state->min_pixclk)); | 13507 | sizeof(intel_state->min_pixclk)); |
13505 | dev_priv->active_crtcs = intel_state->active_crtcs; | 13508 | dev_priv->active_crtcs = intel_state->active_crtcs; |
13506 | dev_priv->atomic_cdclk_freq = intel_state->cdclk; | 13509 | dev_priv->atomic_cdclk_freq = intel_state->cdclk; |
13510 | |||
13511 | intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET); | ||
13507 | } | 13512 | } |
13508 | 13513 | ||
13509 | for_each_crtc_in_state(state, crtc, crtc_state, i) { | 13514 | for_each_crtc_in_state(state, crtc, crtc_state, i) { |
13510 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 13515 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
13511 | 13516 | ||
13517 | if (needs_modeset(crtc->state) || | ||
13518 | to_intel_crtc_state(crtc->state)->update_pipe) { | ||
13519 | hw_check = true; | ||
13520 | |||
13521 | put_domains[to_intel_crtc(crtc)->pipe] = | ||
13522 | modeset_get_crtc_power_domains(crtc, | ||
13523 | to_intel_crtc_state(crtc->state)); | ||
13524 | } | ||
13525 | |||
13512 | if (!needs_modeset(crtc->state)) | 13526 | if (!needs_modeset(crtc->state)) |
13513 | continue; | 13527 | continue; |
13514 | 13528 | ||
@@ -13541,32 +13555,25 @@ static int intel_atomic_commit(struct drm_device *dev, | |||
13541 | intel_shared_dpll_commit(state); | 13555 | intel_shared_dpll_commit(state); |
13542 | 13556 | ||
13543 | drm_atomic_helper_update_legacy_modeset_state(state->dev, state); | 13557 | drm_atomic_helper_update_legacy_modeset_state(state->dev, state); |
13544 | modeset_update_crtc_power_domains(state); | 13558 | |
13559 | if (dev_priv->display.modeset_commit_cdclk && | ||
13560 | intel_state->dev_cdclk != dev_priv->cdclk_freq) | ||
13561 | dev_priv->display.modeset_commit_cdclk(state); | ||
13545 | } | 13562 | } |
13546 | 13563 | ||
13547 | /* Now enable the clocks, plane, pipe, and connectors that we set up. */ | 13564 | /* Now enable the clocks, plane, pipe, and connectors that we set up. */ |
13548 | for_each_crtc_in_state(state, crtc, crtc_state, i) { | 13565 | for_each_crtc_in_state(state, crtc, crtc_state, i) { |
13549 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 13566 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
13550 | bool modeset = needs_modeset(crtc->state); | 13567 | bool modeset = needs_modeset(crtc->state); |
13551 | bool update_pipe = !modeset && | 13568 | struct intel_crtc_state *pipe_config = |
13552 | to_intel_crtc_state(crtc->state)->update_pipe; | 13569 | to_intel_crtc_state(crtc->state); |
13553 | unsigned long put_domains = 0; | 13570 | bool update_pipe = !modeset && pipe_config->update_pipe; |
13554 | |||
13555 | if (modeset) | ||
13556 | intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET); | ||
13557 | 13571 | ||
13558 | if (modeset && crtc->state->active) { | 13572 | if (modeset && crtc->state->active) { |
13559 | update_scanline_offset(to_intel_crtc(crtc)); | 13573 | update_scanline_offset(to_intel_crtc(crtc)); |
13560 | dev_priv->display.crtc_enable(crtc); | 13574 | dev_priv->display.crtc_enable(crtc); |
13561 | } | 13575 | } |
13562 | 13576 | ||
13563 | if (update_pipe) { | ||
13564 | put_domains = modeset_get_crtc_power_domains(crtc); | ||
13565 | |||
13566 | /* make sure intel_modeset_check_state runs */ | ||
13567 | hw_check = true; | ||
13568 | } | ||
13569 | |||
13570 | if (!modeset) | 13577 | if (!modeset) |
13571 | intel_pre_plane_update(to_intel_crtc_state(crtc_state)); | 13578 | intel_pre_plane_update(to_intel_crtc_state(crtc_state)); |
13572 | 13579 | ||
@@ -13577,18 +13584,24 @@ static int intel_atomic_commit(struct drm_device *dev, | |||
13577 | (crtc->state->planes_changed || update_pipe)) | 13584 | (crtc->state->planes_changed || update_pipe)) |
13578 | drm_atomic_helper_commit_planes_on_crtc(crtc_state); | 13585 | drm_atomic_helper_commit_planes_on_crtc(crtc_state); |
13579 | 13586 | ||
13580 | if (put_domains) | 13587 | if (pipe_config->base.active && needs_vblank_wait(pipe_config)) |
13581 | modeset_put_power_domains(dev_priv, put_domains); | 13588 | crtc_vblank_mask |= 1 << i; |
13582 | |||
13583 | intel_post_plane_update(intel_crtc); | ||
13584 | |||
13585 | if (modeset) | ||
13586 | intel_display_power_put(dev_priv, POWER_DOMAIN_MODESET); | ||
13587 | } | 13589 | } |
13588 | 13590 | ||
13589 | /* FIXME: add subpixel order */ | 13591 | /* FIXME: add subpixel order */ |
13590 | 13592 | ||
13591 | drm_atomic_helper_wait_for_vblanks(dev, state); | 13593 | if (!state->legacy_cursor_update) |
13594 | intel_atomic_wait_for_vblanks(dev, dev_priv, crtc_vblank_mask); | ||
13595 | |||
13596 | for_each_crtc_in_state(state, crtc, crtc_state, i) { | ||
13597 | intel_post_plane_update(to_intel_crtc(crtc)); | ||
13598 | |||
13599 | if (put_domains[i]) | ||
13600 | modeset_put_power_domains(dev_priv, put_domains[i]); | ||
13601 | } | ||
13602 | |||
13603 | if (intel_state->modeset) | ||
13604 | intel_display_power_put(dev_priv, POWER_DOMAIN_MODESET); | ||
13592 | 13605 | ||
13593 | mutex_lock(&dev->struct_mutex); | 13606 | mutex_lock(&dev->struct_mutex); |
13594 | drm_atomic_helper_cleanup_planes(dev, state); | 13607 | drm_atomic_helper_cleanup_planes(dev, state); |
@@ -13670,7 +13683,7 @@ static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv, | |||
13670 | { | 13683 | { |
13671 | uint32_t val; | 13684 | uint32_t val; |
13672 | 13685 | ||
13673 | if (!intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_PLLS)) | 13686 | if (!intel_display_power_get_if_enabled(dev_priv, POWER_DOMAIN_PLLS)) |
13674 | return false; | 13687 | return false; |
13675 | 13688 | ||
13676 | val = I915_READ(PCH_DPLL(pll->id)); | 13689 | val = I915_READ(PCH_DPLL(pll->id)); |
@@ -13678,6 +13691,8 @@ static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv, | |||
13678 | hw_state->fp0 = I915_READ(PCH_FP0(pll->id)); | 13691 | hw_state->fp0 = I915_READ(PCH_FP0(pll->id)); |
13679 | hw_state->fp1 = I915_READ(PCH_FP1(pll->id)); | 13692 | hw_state->fp1 = I915_READ(PCH_FP1(pll->id)); |
13680 | 13693 | ||
13694 | intel_display_power_put(dev_priv, POWER_DOMAIN_PLLS); | ||
13695 | |||
13681 | return val & DPLL_VCO_ENABLE; | 13696 | return val & DPLL_VCO_ENABLE; |
13682 | } | 13697 | } |
13683 | 13698 | ||
@@ -15493,6 +15508,17 @@ static bool intel_crtc_has_encoders(struct intel_crtc *crtc) | |||
15493 | return false; | 15508 | return false; |
15494 | } | 15509 | } |
15495 | 15510 | ||
15511 | static bool intel_encoder_has_connectors(struct intel_encoder *encoder) | ||
15512 | { | ||
15513 | struct drm_device *dev = encoder->base.dev; | ||
15514 | struct intel_connector *connector; | ||
15515 | |||
15516 | for_each_connector_on_encoder(dev, &encoder->base, connector) | ||
15517 | return true; | ||
15518 | |||
15519 | return false; | ||
15520 | } | ||
15521 | |||
15496 | static void intel_sanitize_crtc(struct intel_crtc *crtc) | 15522 | static void intel_sanitize_crtc(struct intel_crtc *crtc) |
15497 | { | 15523 | { |
15498 | struct drm_device *dev = crtc->base.dev; | 15524 | struct drm_device *dev = crtc->base.dev; |
@@ -15603,7 +15629,6 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) | |||
15603 | { | 15629 | { |
15604 | struct intel_connector *connector; | 15630 | struct intel_connector *connector; |
15605 | struct drm_device *dev = encoder->base.dev; | 15631 | struct drm_device *dev = encoder->base.dev; |
15606 | bool active = false; | ||
15607 | 15632 | ||
15608 | /* We need to check both for a crtc link (meaning that the | 15633 | /* We need to check both for a crtc link (meaning that the |
15609 | * encoder is active and trying to read from a pipe) and the | 15634 | * encoder is active and trying to read from a pipe) and the |
@@ -15611,15 +15636,7 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder) | |||
15611 | bool has_active_crtc = encoder->base.crtc && | 15636 | bool has_active_crtc = encoder->base.crtc && |
15612 | to_intel_crtc(encoder->base.crtc)->active; | 15637 | to_intel_crtc(encoder->base.crtc)->active; |
15613 | 15638 | ||
15614 | for_each_intel_connector(dev, connector) { | 15639 | if (intel_encoder_has_connectors(encoder) && !has_active_crtc) { |
15615 | if (connector->base.encoder != &encoder->base) | ||
15616 | continue; | ||
15617 | |||
15618 | active = true; | ||
15619 | break; | ||
15620 | } | ||
15621 | |||
15622 | if (active && !has_active_crtc) { | ||
15623 | DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no active pipe!\n", | 15640 | DRM_DEBUG_KMS("[ENCODER:%d:%s] has active connectors but no active pipe!\n", |
15624 | encoder->base.base.id, | 15641 | encoder->base.base.id, |
15625 | encoder->base.name); | 15642 | encoder->base.name); |
@@ -15674,10 +15691,12 @@ void i915_redisable_vga(struct drm_device *dev) | |||
15674 | * level, just check if the power well is enabled instead of trying to | 15691 | * level, just check if the power well is enabled instead of trying to |
15675 | * follow the "don't touch the power well if we don't need it" policy | 15692 | * follow the "don't touch the power well if we don't need it" policy |
15676 | * the rest of the driver uses. */ | 15693 | * the rest of the driver uses. */ |
15677 | if (!intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_VGA)) | 15694 | if (!intel_display_power_get_if_enabled(dev_priv, POWER_DOMAIN_VGA)) |
15678 | return; | 15695 | return; |
15679 | 15696 | ||
15680 | i915_redisable_vga_power_on(dev); | 15697 | i915_redisable_vga_power_on(dev); |
15698 | |||
15699 | intel_display_power_put(dev_priv, POWER_DOMAIN_VGA); | ||
15681 | } | 15700 | } |
15682 | 15701 | ||
15683 | static bool primary_get_hw_state(struct intel_plane *plane) | 15702 | static bool primary_get_hw_state(struct intel_plane *plane) |
@@ -15905,7 +15924,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev) | |||
15905 | for_each_intel_crtc(dev, crtc) { | 15924 | for_each_intel_crtc(dev, crtc) { |
15906 | unsigned long put_domains; | 15925 | unsigned long put_domains; |
15907 | 15926 | ||
15908 | put_domains = modeset_get_crtc_power_domains(&crtc->base); | 15927 | put_domains = modeset_get_crtc_power_domains(&crtc->base, crtc->config); |
15909 | if (WARN_ON(put_domains)) | 15928 | if (WARN_ON(put_domains)) |
15910 | modeset_put_power_domains(dev_priv, put_domains); | 15929 | modeset_put_power_domains(dev_priv, put_domains); |
15911 | } | 15930 | } |
@@ -15916,54 +15935,65 @@ intel_modeset_setup_hw_state(struct drm_device *dev) | |||
15916 | 15935 | ||
15917 | void intel_display_resume(struct drm_device *dev) | 15936 | void intel_display_resume(struct drm_device *dev) |
15918 | { | 15937 | { |
15919 | struct drm_atomic_state *state = drm_atomic_state_alloc(dev); | 15938 | struct drm_i915_private *dev_priv = to_i915(dev); |
15920 | struct intel_connector *conn; | 15939 | struct drm_atomic_state *state = dev_priv->modeset_restore_state; |
15921 | struct intel_plane *plane; | 15940 | struct drm_modeset_acquire_ctx ctx; |
15922 | struct drm_crtc *crtc; | ||
15923 | int ret; | 15941 | int ret; |
15942 | bool setup = false; | ||
15924 | 15943 | ||
15925 | if (!state) | 15944 | dev_priv->modeset_restore_state = NULL; |
15926 | return; | ||
15927 | |||
15928 | state->acquire_ctx = dev->mode_config.acquire_ctx; | ||
15929 | 15945 | ||
15930 | /* preserve complete old state, including dpll */ | 15946 | /* |
15931 | intel_atomic_get_shared_dpll_state(state); | 15947 | * This is a cludge because with real atomic modeset mode_config.mutex |
15948 | * won't be taken. Unfortunately some probed state like | ||
15949 | * audio_codec_enable is still protected by mode_config.mutex, so lock | ||
15950 | * it here for now. | ||
15951 | */ | ||
15952 | mutex_lock(&dev->mode_config.mutex); | ||
15953 | drm_modeset_acquire_init(&ctx, 0); | ||
15932 | 15954 | ||
15933 | for_each_crtc(dev, crtc) { | 15955 | retry: |
15934 | struct drm_crtc_state *crtc_state = | 15956 | ret = drm_modeset_lock_all_ctx(dev, &ctx); |
15935 | drm_atomic_get_crtc_state(state, crtc); | ||
15936 | 15957 | ||
15937 | ret = PTR_ERR_OR_ZERO(crtc_state); | 15958 | if (ret == 0 && !setup) { |
15938 | if (ret) | 15959 | setup = true; |
15939 | goto err; | ||
15940 | 15960 | ||
15941 | /* force a restore */ | 15961 | intel_modeset_setup_hw_state(dev); |
15942 | crtc_state->mode_changed = true; | 15962 | i915_redisable_vga(dev); |
15943 | } | 15963 | } |
15944 | 15964 | ||
15945 | for_each_intel_plane(dev, plane) { | 15965 | if (ret == 0 && state) { |
15946 | ret = PTR_ERR_OR_ZERO(drm_atomic_get_plane_state(state, &plane->base)); | 15966 | struct drm_crtc_state *crtc_state; |
15947 | if (ret) | 15967 | struct drm_crtc *crtc; |
15948 | goto err; | 15968 | int i; |
15949 | } | ||
15950 | 15969 | ||
15951 | for_each_intel_connector(dev, conn) { | 15970 | state->acquire_ctx = &ctx; |
15952 | ret = PTR_ERR_OR_ZERO(drm_atomic_get_connector_state(state, &conn->base)); | 15971 | |
15953 | if (ret) | 15972 | for_each_crtc_in_state(state, crtc, crtc_state, i) { |
15954 | goto err; | 15973 | /* |
15974 | * Force recalculation even if we restore | ||
15975 | * current state. With fast modeset this may not result | ||
15976 | * in a modeset when the state is compatible. | ||
15977 | */ | ||
15978 | crtc_state->mode_changed = true; | ||
15979 | } | ||
15980 | |||
15981 | ret = drm_atomic_commit(state); | ||
15955 | } | 15982 | } |
15956 | 15983 | ||
15957 | intel_modeset_setup_hw_state(dev); | 15984 | if (ret == -EDEADLK) { |
15985 | drm_modeset_backoff(&ctx); | ||
15986 | goto retry; | ||
15987 | } | ||
15958 | 15988 | ||
15959 | i915_redisable_vga(dev); | 15989 | drm_modeset_drop_locks(&ctx); |
15960 | ret = drm_atomic_commit(state); | 15990 | drm_modeset_acquire_fini(&ctx); |
15961 | if (!ret) | 15991 | mutex_unlock(&dev->mode_config.mutex); |
15962 | return; | ||
15963 | 15992 | ||
15964 | err: | 15993 | if (ret) { |
15965 | DRM_ERROR("Restoring old state failed with %i\n", ret); | 15994 | DRM_ERROR("Restoring old state failed with %i\n", ret); |
15966 | drm_atomic_state_free(state); | 15995 | drm_atomic_state_free(state); |
15996 | } | ||
15967 | } | 15997 | } |
15968 | 15998 | ||
15969 | void intel_modeset_gem_init(struct drm_device *dev) | 15999 | void intel_modeset_gem_init(struct drm_device *dev) |
@@ -15972,9 +16002,7 @@ void intel_modeset_gem_init(struct drm_device *dev) | |||
15972 | struct drm_i915_gem_object *obj; | 16002 | struct drm_i915_gem_object *obj; |
15973 | int ret; | 16003 | int ret; |
15974 | 16004 | ||
15975 | mutex_lock(&dev->struct_mutex); | ||
15976 | intel_init_gt_powersave(dev); | 16005 | intel_init_gt_powersave(dev); |
15977 | mutex_unlock(&dev->struct_mutex); | ||
15978 | 16006 | ||
15979 | intel_modeset_init_hw(dev); | 16007 | intel_modeset_init_hw(dev); |
15980 | 16008 | ||
@@ -16054,9 +16082,7 @@ void intel_modeset_cleanup(struct drm_device *dev) | |||
16054 | 16082 | ||
16055 | intel_cleanup_overlay(dev); | 16083 | intel_cleanup_overlay(dev); |
16056 | 16084 | ||
16057 | mutex_lock(&dev->struct_mutex); | ||
16058 | intel_cleanup_gt_powersave(dev); | 16085 | intel_cleanup_gt_powersave(dev); |
16059 | mutex_unlock(&dev->struct_mutex); | ||
16060 | 16086 | ||
16061 | intel_teardown_gmbus(dev); | 16087 | intel_teardown_gmbus(dev); |
16062 | } | 16088 | } |