diff options
author | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2015-03-20 10:18:17 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-27 05:29:32 -0400 |
commit | a93e255f819cae49dff7319b6686f718b8069fec (patch) | |
tree | 96e86067778491c10f6272dbbfb93b4b0fc63cfe | |
parent | 679dacd430cac3f58fc80db69c1694621ede00fc (diff) |
drm/i915: Convert intel_pipe_will_have_type() to using atomic state
Pass a crtc_state to it and find whether the pipe has an encoder of a
given type by looking at the drm_atomic_state the crtc_state points to.
Until recently i9xx_get_refclk() used to be called indirectly from
vlv_force_pll_on() with a dummy crtc_state. That dummy crtc state is not
converted to be part of a full drm atomic state, so add a WARN in case
someone decides to call that again with a such dummy state. This was
removed in
commit 9cbe40c15a753e02f5da16f6de901decf3276cf1
Author: Vijay Purushothaman <vijay.a.purushothaman@linux.intel.com>
Date: Thu Mar 5 19:33:08 2015 +0530
drm/i915: Update prop, int co-eff and gain threshold for CHV
v2: Warn if there is no connectors for a given crtc. (Daniel)
Replace comment i9xx_get_refclk() with a WARN_ON(). (Ander)
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
[danvet: Add commit reference for when i9xx_get_refclk was removed.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 133 |
2 files changed, 83 insertions, 52 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index f80edab9e6cc..a4db7a7db444 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -546,7 +546,7 @@ struct drm_i915_display_funcs { | |||
546 | * Returns true on success, false on failure. | 546 | * Returns true on success, false on failure. |
547 | */ | 547 | */ |
548 | bool (*find_dpll)(const struct intel_limit *limit, | 548 | bool (*find_dpll)(const struct intel_limit *limit, |
549 | struct intel_crtc *crtc, | 549 | struct intel_crtc_state *crtc_state, |
550 | int target, int refclk, | 550 | int target, int refclk, |
551 | struct dpll *match_clock, | 551 | struct dpll *match_clock, |
552 | struct dpll *best_clock); | 552 | struct dpll *best_clock); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 871c61b1f7af..1c4efeee13c8 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -431,25 +431,41 @@ bool intel_pipe_has_type(struct intel_crtc *crtc, enum intel_output_type type) | |||
431 | * intel_pipe_has_type() but looking at encoder->new_crtc instead of | 431 | * intel_pipe_has_type() but looking at encoder->new_crtc instead of |
432 | * encoder->crtc. | 432 | * encoder->crtc. |
433 | */ | 433 | */ |
434 | static bool intel_pipe_will_have_type(struct intel_crtc *crtc, int type) | 434 | static bool intel_pipe_will_have_type(const struct intel_crtc_state *crtc_state, |
435 | int type) | ||
435 | { | 436 | { |
436 | struct drm_device *dev = crtc->base.dev; | 437 | struct drm_atomic_state *state = crtc_state->base.state; |
438 | struct drm_connector_state *connector_state; | ||
437 | struct intel_encoder *encoder; | 439 | struct intel_encoder *encoder; |
440 | int i, num_connectors = 0; | ||
441 | |||
442 | for (i = 0; i < state->num_connector; i++) { | ||
443 | if (!state->connectors[i]) | ||
444 | continue; | ||
445 | |||
446 | connector_state = state->connector_states[i]; | ||
447 | if (connector_state->crtc != crtc_state->base.crtc) | ||
448 | continue; | ||
449 | |||
450 | num_connectors++; | ||
438 | 451 | ||
439 | for_each_intel_encoder(dev, encoder) | 452 | encoder = to_intel_encoder(connector_state->best_encoder); |
440 | if (encoder->new_crtc == crtc && encoder->type == type) | 453 | if (encoder->type == type) |
441 | return true; | 454 | return true; |
455 | } | ||
456 | |||
457 | WARN_ON(num_connectors == 0); | ||
442 | 458 | ||
443 | return false; | 459 | return false; |
444 | } | 460 | } |
445 | 461 | ||
446 | static const intel_limit_t *intel_ironlake_limit(struct intel_crtc *crtc, | 462 | static const intel_limit_t * |
447 | int refclk) | 463 | intel_ironlake_limit(struct intel_crtc_state *crtc_state, int refclk) |
448 | { | 464 | { |
449 | struct drm_device *dev = crtc->base.dev; | 465 | struct drm_device *dev = crtc_state->base.crtc->dev; |
450 | const intel_limit_t *limit; | 466 | const intel_limit_t *limit; |
451 | 467 | ||
452 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { | 468 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) { |
453 | if (intel_is_dual_link_lvds(dev)) { | 469 | if (intel_is_dual_link_lvds(dev)) { |
454 | if (refclk == 100000) | 470 | if (refclk == 100000) |
455 | limit = &intel_limits_ironlake_dual_lvds_100m; | 471 | limit = &intel_limits_ironlake_dual_lvds_100m; |
@@ -467,20 +483,21 @@ static const intel_limit_t *intel_ironlake_limit(struct intel_crtc *crtc, | |||
467 | return limit; | 483 | return limit; |
468 | } | 484 | } |
469 | 485 | ||
470 | static const intel_limit_t *intel_g4x_limit(struct intel_crtc *crtc) | 486 | static const intel_limit_t * |
487 | intel_g4x_limit(struct intel_crtc_state *crtc_state) | ||
471 | { | 488 | { |
472 | struct drm_device *dev = crtc->base.dev; | 489 | struct drm_device *dev = crtc_state->base.crtc->dev; |
473 | const intel_limit_t *limit; | 490 | const intel_limit_t *limit; |
474 | 491 | ||
475 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { | 492 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) { |
476 | if (intel_is_dual_link_lvds(dev)) | 493 | if (intel_is_dual_link_lvds(dev)) |
477 | limit = &intel_limits_g4x_dual_channel_lvds; | 494 | limit = &intel_limits_g4x_dual_channel_lvds; |
478 | else | 495 | else |
479 | limit = &intel_limits_g4x_single_channel_lvds; | 496 | limit = &intel_limits_g4x_single_channel_lvds; |
480 | } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_HDMI) || | 497 | } else if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_HDMI) || |
481 | intel_pipe_will_have_type(crtc, INTEL_OUTPUT_ANALOG)) { | 498 | intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_ANALOG)) { |
482 | limit = &intel_limits_g4x_hdmi; | 499 | limit = &intel_limits_g4x_hdmi; |
483 | } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_SDVO)) { | 500 | } else if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_SDVO)) { |
484 | limit = &intel_limits_g4x_sdvo; | 501 | limit = &intel_limits_g4x_sdvo; |
485 | } else /* The option is for other outputs */ | 502 | } else /* The option is for other outputs */ |
486 | limit = &intel_limits_i9xx_sdvo; | 503 | limit = &intel_limits_i9xx_sdvo; |
@@ -488,17 +505,18 @@ static const intel_limit_t *intel_g4x_limit(struct intel_crtc *crtc) | |||
488 | return limit; | 505 | return limit; |
489 | } | 506 | } |
490 | 507 | ||
491 | static const intel_limit_t *intel_limit(struct intel_crtc *crtc, int refclk) | 508 | static const intel_limit_t * |
509 | intel_limit(struct intel_crtc_state *crtc_state, int refclk) | ||
492 | { | 510 | { |
493 | struct drm_device *dev = crtc->base.dev; | 511 | struct drm_device *dev = crtc_state->base.crtc->dev; |
494 | const intel_limit_t *limit; | 512 | const intel_limit_t *limit; |
495 | 513 | ||
496 | if (HAS_PCH_SPLIT(dev)) | 514 | if (HAS_PCH_SPLIT(dev)) |
497 | limit = intel_ironlake_limit(crtc, refclk); | 515 | limit = intel_ironlake_limit(crtc_state, refclk); |
498 | else if (IS_G4X(dev)) { | 516 | else if (IS_G4X(dev)) { |
499 | limit = intel_g4x_limit(crtc); | 517 | limit = intel_g4x_limit(crtc_state); |
500 | } else if (IS_PINEVIEW(dev)) { | 518 | } else if (IS_PINEVIEW(dev)) { |
501 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) | 519 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) |
502 | limit = &intel_limits_pineview_lvds; | 520 | limit = &intel_limits_pineview_lvds; |
503 | else | 521 | else |
504 | limit = &intel_limits_pineview_sdvo; | 522 | limit = &intel_limits_pineview_sdvo; |
@@ -507,14 +525,14 @@ static const intel_limit_t *intel_limit(struct intel_crtc *crtc, int refclk) | |||
507 | } else if (IS_VALLEYVIEW(dev)) { | 525 | } else if (IS_VALLEYVIEW(dev)) { |
508 | limit = &intel_limits_vlv; | 526 | limit = &intel_limits_vlv; |
509 | } else if (!IS_GEN2(dev)) { | 527 | } else if (!IS_GEN2(dev)) { |
510 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) | 528 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) |
511 | limit = &intel_limits_i9xx_lvds; | 529 | limit = &intel_limits_i9xx_lvds; |
512 | else | 530 | else |
513 | limit = &intel_limits_i9xx_sdvo; | 531 | limit = &intel_limits_i9xx_sdvo; |
514 | } else { | 532 | } else { |
515 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) | 533 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) |
516 | limit = &intel_limits_i8xx_lvds; | 534 | limit = &intel_limits_i8xx_lvds; |
517 | else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DVO)) | 535 | else if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_DVO)) |
518 | limit = &intel_limits_i8xx_dvo; | 536 | limit = &intel_limits_i8xx_dvo; |
519 | else | 537 | else |
520 | limit = &intel_limits_i8xx_dac; | 538 | limit = &intel_limits_i8xx_dac; |
@@ -601,15 +619,17 @@ static bool intel_PLL_is_valid(struct drm_device *dev, | |||
601 | } | 619 | } |
602 | 620 | ||
603 | static bool | 621 | static bool |
604 | i9xx_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | 622 | i9xx_find_best_dpll(const intel_limit_t *limit, |
623 | struct intel_crtc_state *crtc_state, | ||
605 | int target, int refclk, intel_clock_t *match_clock, | 624 | int target, int refclk, intel_clock_t *match_clock, |
606 | intel_clock_t *best_clock) | 625 | intel_clock_t *best_clock) |
607 | { | 626 | { |
627 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
608 | struct drm_device *dev = crtc->base.dev; | 628 | struct drm_device *dev = crtc->base.dev; |
609 | intel_clock_t clock; | 629 | intel_clock_t clock; |
610 | int err = target; | 630 | int err = target; |
611 | 631 | ||
612 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { | 632 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) { |
613 | /* | 633 | /* |
614 | * For LVDS just rely on its current settings for dual-channel. | 634 | * For LVDS just rely on its current settings for dual-channel. |
615 | * We haven't figured out how to reliably set up different | 635 | * We haven't figured out how to reliably set up different |
@@ -662,15 +682,17 @@ i9xx_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | |||
662 | } | 682 | } |
663 | 683 | ||
664 | static bool | 684 | static bool |
665 | pnv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | 685 | pnv_find_best_dpll(const intel_limit_t *limit, |
686 | struct intel_crtc_state *crtc_state, | ||
666 | int target, int refclk, intel_clock_t *match_clock, | 687 | int target, int refclk, intel_clock_t *match_clock, |
667 | intel_clock_t *best_clock) | 688 | intel_clock_t *best_clock) |
668 | { | 689 | { |
690 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
669 | struct drm_device *dev = crtc->base.dev; | 691 | struct drm_device *dev = crtc->base.dev; |
670 | intel_clock_t clock; | 692 | intel_clock_t clock; |
671 | int err = target; | 693 | int err = target; |
672 | 694 | ||
673 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { | 695 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) { |
674 | /* | 696 | /* |
675 | * For LVDS just rely on its current settings for dual-channel. | 697 | * For LVDS just rely on its current settings for dual-channel. |
676 | * We haven't figured out how to reliably set up different | 698 | * We haven't figured out how to reliably set up different |
@@ -721,10 +743,12 @@ pnv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | |||
721 | } | 743 | } |
722 | 744 | ||
723 | static bool | 745 | static bool |
724 | g4x_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | 746 | g4x_find_best_dpll(const intel_limit_t *limit, |
747 | struct intel_crtc_state *crtc_state, | ||
725 | int target, int refclk, intel_clock_t *match_clock, | 748 | int target, int refclk, intel_clock_t *match_clock, |
726 | intel_clock_t *best_clock) | 749 | intel_clock_t *best_clock) |
727 | { | 750 | { |
751 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
728 | struct drm_device *dev = crtc->base.dev; | 752 | struct drm_device *dev = crtc->base.dev; |
729 | intel_clock_t clock; | 753 | intel_clock_t clock; |
730 | int max_n; | 754 | int max_n; |
@@ -733,7 +757,7 @@ g4x_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | |||
733 | int err_most = (target >> 8) + (target >> 9); | 757 | int err_most = (target >> 8) + (target >> 9); |
734 | found = false; | 758 | found = false; |
735 | 759 | ||
736 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { | 760 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) { |
737 | if (intel_is_dual_link_lvds(dev)) | 761 | if (intel_is_dual_link_lvds(dev)) |
738 | clock.p2 = limit->p2.p2_fast; | 762 | clock.p2 = limit->p2.p2_fast; |
739 | else | 763 | else |
@@ -818,10 +842,12 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq, | |||
818 | } | 842 | } |
819 | 843 | ||
820 | static bool | 844 | static bool |
821 | vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | 845 | vlv_find_best_dpll(const intel_limit_t *limit, |
846 | struct intel_crtc_state *crtc_state, | ||
822 | int target, int refclk, intel_clock_t *match_clock, | 847 | int target, int refclk, intel_clock_t *match_clock, |
823 | intel_clock_t *best_clock) | 848 | intel_clock_t *best_clock) |
824 | { | 849 | { |
850 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
825 | struct drm_device *dev = crtc->base.dev; | 851 | struct drm_device *dev = crtc->base.dev; |
826 | intel_clock_t clock; | 852 | intel_clock_t clock; |
827 | unsigned int bestppm = 1000000; | 853 | unsigned int bestppm = 1000000; |
@@ -870,10 +896,12 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | |||
870 | } | 896 | } |
871 | 897 | ||
872 | static bool | 898 | static bool |
873 | chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, | 899 | chv_find_best_dpll(const intel_limit_t *limit, |
900 | struct intel_crtc_state *crtc_state, | ||
874 | int target, int refclk, intel_clock_t *match_clock, | 901 | int target, int refclk, intel_clock_t *match_clock, |
875 | intel_clock_t *best_clock) | 902 | intel_clock_t *best_clock) |
876 | { | 903 | { |
904 | struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); | ||
877 | struct drm_device *dev = crtc->base.dev; | 905 | struct drm_device *dev = crtc->base.dev; |
878 | unsigned int best_error_ppm; | 906 | unsigned int best_error_ppm; |
879 | intel_clock_t clock; | 907 | intel_clock_t clock; |
@@ -5795,7 +5823,7 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, | |||
5795 | * - LVDS dual channel mode | 5823 | * - LVDS dual channel mode |
5796 | * - Double wide pipe | 5824 | * - Double wide pipe |
5797 | */ | 5825 | */ |
5798 | if ((intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && | 5826 | if ((intel_pipe_will_have_type(pipe_config, INTEL_OUTPUT_LVDS) && |
5799 | intel_is_dual_link_lvds(dev)) || pipe_config->double_wide) | 5827 | intel_is_dual_link_lvds(dev)) || pipe_config->double_wide) |
5800 | pipe_config->pipe_src_w &= ~1; | 5828 | pipe_config->pipe_src_w &= ~1; |
5801 | 5829 | ||
@@ -5974,15 +6002,18 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) | |||
5974 | && !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE); | 6002 | && !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE); |
5975 | } | 6003 | } |
5976 | 6004 | ||
5977 | static int i9xx_get_refclk(struct intel_crtc *crtc, int num_connectors) | 6005 | static int i9xx_get_refclk(const struct intel_crtc_state *crtc_state, |
6006 | int num_connectors) | ||
5978 | { | 6007 | { |
5979 | struct drm_device *dev = crtc->base.dev; | 6008 | struct drm_device *dev = crtc_state->base.crtc->dev; |
5980 | struct drm_i915_private *dev_priv = dev->dev_private; | 6009 | struct drm_i915_private *dev_priv = dev->dev_private; |
5981 | int refclk; | 6010 | int refclk; |
5982 | 6011 | ||
6012 | WARN_ON(!crtc_state->base.state); | ||
6013 | |||
5983 | if (IS_VALLEYVIEW(dev)) { | 6014 | if (IS_VALLEYVIEW(dev)) { |
5984 | refclk = 100000; | 6015 | refclk = 100000; |
5985 | } else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && | 6016 | } else if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS) && |
5986 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) { | 6017 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) { |
5987 | refclk = dev_priv->vbt.lvds_ssc_freq; | 6018 | refclk = dev_priv->vbt.lvds_ssc_freq; |
5988 | DRM_DEBUG_KMS("using SSC reference clock of %d kHz\n", refclk); | 6019 | DRM_DEBUG_KMS("using SSC reference clock of %d kHz\n", refclk); |
@@ -6025,7 +6056,7 @@ static void i9xx_update_pll_dividers(struct intel_crtc *crtc, | |||
6025 | crtc_state->dpll_hw_state.fp0 = fp; | 6056 | crtc_state->dpll_hw_state.fp0 = fp; |
6026 | 6057 | ||
6027 | crtc->lowfreq_avail = false; | 6058 | crtc->lowfreq_avail = false; |
6028 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && | 6059 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS) && |
6029 | reduced_clock) { | 6060 | reduced_clock) { |
6030 | crtc_state->dpll_hw_state.fp1 = fp2; | 6061 | crtc_state->dpll_hw_state.fp1 = fp2; |
6031 | crtc->lowfreq_avail = true; | 6062 | crtc->lowfreq_avail = true; |
@@ -6383,6 +6414,7 @@ void vlv_force_pll_on(struct drm_device *dev, enum pipe pipe, | |||
6383 | struct intel_crtc *crtc = | 6414 | struct intel_crtc *crtc = |
6384 | to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe)); | 6415 | to_intel_crtc(intel_get_crtc_for_pipe(dev, pipe)); |
6385 | struct intel_crtc_state pipe_config = { | 6416 | struct intel_crtc_state pipe_config = { |
6417 | .base.crtc = &crtc->base, | ||
6386 | .pixel_multiplier = 1, | 6418 | .pixel_multiplier = 1, |
6387 | .dpll = *dpll, | 6419 | .dpll = *dpll, |
6388 | }; | 6420 | }; |
@@ -6427,12 +6459,12 @@ static void i9xx_update_pll(struct intel_crtc *crtc, | |||
6427 | 6459 | ||
6428 | i9xx_update_pll_dividers(crtc, crtc_state, reduced_clock); | 6460 | i9xx_update_pll_dividers(crtc, crtc_state, reduced_clock); |
6429 | 6461 | ||
6430 | is_sdvo = intel_pipe_will_have_type(crtc, INTEL_OUTPUT_SDVO) || | 6462 | is_sdvo = intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_SDVO) || |
6431 | intel_pipe_will_have_type(crtc, INTEL_OUTPUT_HDMI); | 6463 | intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_HDMI); |
6432 | 6464 | ||
6433 | dpll = DPLL_VGA_MODE_DIS; | 6465 | dpll = DPLL_VGA_MODE_DIS; |
6434 | 6466 | ||
6435 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) | 6467 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) |
6436 | dpll |= DPLLB_MODE_LVDS; | 6468 | dpll |= DPLLB_MODE_LVDS; |
6437 | else | 6469 | else |
6438 | dpll |= DPLLB_MODE_DAC_SERIAL; | 6470 | dpll |= DPLLB_MODE_DAC_SERIAL; |
@@ -6475,7 +6507,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc, | |||
6475 | 6507 | ||
6476 | if (crtc_state->sdvo_tv_clock) | 6508 | if (crtc_state->sdvo_tv_clock) |
6477 | dpll |= PLL_REF_INPUT_TVCLKINBC; | 6509 | dpll |= PLL_REF_INPUT_TVCLKINBC; |
6478 | else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && | 6510 | else if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS) && |
6479 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) | 6511 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) |
6480 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; | 6512 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; |
6481 | else | 6513 | else |
@@ -6505,7 +6537,7 @@ static void i8xx_update_pll(struct intel_crtc *crtc, | |||
6505 | 6537 | ||
6506 | dpll = DPLL_VGA_MODE_DIS; | 6538 | dpll = DPLL_VGA_MODE_DIS; |
6507 | 6539 | ||
6508 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS)) { | 6540 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS)) { |
6509 | dpll |= (1 << (clock->p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; | 6541 | dpll |= (1 << (clock->p1 - 1)) << DPLL_FPA01_P1_POST_DIV_SHIFT; |
6510 | } else { | 6542 | } else { |
6511 | if (clock->p1 == 2) | 6543 | if (clock->p1 == 2) |
@@ -6516,10 +6548,10 @@ static void i8xx_update_pll(struct intel_crtc *crtc, | |||
6516 | dpll |= PLL_P2_DIVIDE_BY_4; | 6548 | dpll |= PLL_P2_DIVIDE_BY_4; |
6517 | } | 6549 | } |
6518 | 6550 | ||
6519 | if (!IS_I830(dev) && intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DVO)) | 6551 | if (!IS_I830(dev) && intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_DVO)) |
6520 | dpll |= DPLL_DVO_2X_MODE; | 6552 | dpll |= DPLL_DVO_2X_MODE; |
6521 | 6553 | ||
6522 | if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) && | 6554 | if (intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS) && |
6523 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) | 6555 | intel_panel_use_ssc(dev_priv) && num_connectors < 2) |
6524 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; | 6556 | dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN; |
6525 | else | 6557 | else |
@@ -6756,7 +6788,7 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc, | |||
6756 | return 0; | 6788 | return 0; |
6757 | 6789 | ||
6758 | if (!crtc_state->clock_set) { | 6790 | if (!crtc_state->clock_set) { |
6759 | refclk = i9xx_get_refclk(crtc, num_connectors); | 6791 | refclk = i9xx_get_refclk(crtc_state, num_connectors); |
6760 | 6792 | ||
6761 | /* | 6793 | /* |
6762 | * Returns a set of divisors for the desired target clock with | 6794 | * Returns a set of divisors for the desired target clock with |
@@ -6764,8 +6796,8 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc, | |||
6764 | * the clock equation: reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + | 6796 | * the clock equation: reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + |
6765 | * 2) / p1 / p2. | 6797 | * 2) / p1 / p2. |
6766 | */ | 6798 | */ |
6767 | limit = intel_limit(crtc, refclk); | 6799 | limit = intel_limit(crtc_state, refclk); |
6768 | ok = dev_priv->display.find_dpll(limit, crtc, | 6800 | ok = dev_priv->display.find_dpll(limit, crtc_state, |
6769 | crtc_state->port_clock, | 6801 | crtc_state->port_clock, |
6770 | refclk, NULL, &clock); | 6802 | refclk, NULL, &clock); |
6771 | if (!ok) { | 6803 | if (!ok) { |
@@ -6781,7 +6813,7 @@ static int i9xx_crtc_compute_clock(struct intel_crtc *crtc, | |||
6781 | * we will disable the LVDS downclock feature. | 6813 | * we will disable the LVDS downclock feature. |
6782 | */ | 6814 | */ |
6783 | has_reduced_clock = | 6815 | has_reduced_clock = |
6784 | dev_priv->display.find_dpll(limit, crtc, | 6816 | dev_priv->display.find_dpll(limit, crtc_state, |
6785 | dev_priv->lvds_downclock, | 6817 | dev_priv->lvds_downclock, |
6786 | refclk, &clock, | 6818 | refclk, &clock, |
6787 | &reduced_clock); | 6819 | &reduced_clock); |
@@ -7609,12 +7641,11 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, | |||
7609 | { | 7641 | { |
7610 | struct drm_device *dev = crtc->dev; | 7642 | struct drm_device *dev = crtc->dev; |
7611 | struct drm_i915_private *dev_priv = dev->dev_private; | 7643 | struct drm_i915_private *dev_priv = dev->dev_private; |
7612 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
7613 | int refclk; | 7644 | int refclk; |
7614 | const intel_limit_t *limit; | 7645 | const intel_limit_t *limit; |
7615 | bool ret, is_lvds = false; | 7646 | bool ret, is_lvds = false; |
7616 | 7647 | ||
7617 | is_lvds = intel_pipe_will_have_type(intel_crtc, INTEL_OUTPUT_LVDS); | 7648 | is_lvds = intel_pipe_will_have_type(crtc_state, INTEL_OUTPUT_LVDS); |
7618 | 7649 | ||
7619 | refclk = ironlake_get_refclk(crtc); | 7650 | refclk = ironlake_get_refclk(crtc); |
7620 | 7651 | ||
@@ -7623,8 +7654,8 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, | |||
7623 | * refclk, or FALSE. The returned values represent the clock equation: | 7654 | * refclk, or FALSE. The returned values represent the clock equation: |
7624 | * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2. | 7655 | * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2. |
7625 | */ | 7656 | */ |
7626 | limit = intel_limit(intel_crtc, refclk); | 7657 | limit = intel_limit(crtc_state, refclk); |
7627 | ret = dev_priv->display.find_dpll(limit, intel_crtc, | 7658 | ret = dev_priv->display.find_dpll(limit, crtc_state, |
7628 | crtc_state->port_clock, | 7659 | crtc_state->port_clock, |
7629 | refclk, NULL, clock); | 7660 | refclk, NULL, clock); |
7630 | if (!ret) | 7661 | if (!ret) |
@@ -7638,7 +7669,7 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, | |||
7638 | * downclock feature. | 7669 | * downclock feature. |
7639 | */ | 7670 | */ |
7640 | *has_reduced_clock = | 7671 | *has_reduced_clock = |
7641 | dev_priv->display.find_dpll(limit, intel_crtc, | 7672 | dev_priv->display.find_dpll(limit, crtc_state, |
7642 | dev_priv->lvds_downclock, | 7673 | dev_priv->lvds_downclock, |
7643 | refclk, clock, | 7674 | refclk, clock, |
7644 | reduced_clock); | 7675 | reduced_clock); |