diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/atombios_crtc.c')
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 135 |
1 files changed, 69 insertions, 66 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index b0ab185b86f6..a4e5e53e0a62 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -48,29 +48,29 @@ static void atombios_overscan_setup(struct drm_crtc *crtc, | |||
48 | 48 | ||
49 | switch (radeon_crtc->rmx_type) { | 49 | switch (radeon_crtc->rmx_type) { |
50 | case RMX_CENTER: | 50 | case RMX_CENTER: |
51 | args.usOverscanTop = (adjusted_mode->crtc_vdisplay - mode->crtc_vdisplay) / 2; | 51 | args.usOverscanTop = cpu_to_le16((adjusted_mode->crtc_vdisplay - mode->crtc_vdisplay) / 2); |
52 | args.usOverscanBottom = (adjusted_mode->crtc_vdisplay - mode->crtc_vdisplay) / 2; | 52 | args.usOverscanBottom = cpu_to_le16((adjusted_mode->crtc_vdisplay - mode->crtc_vdisplay) / 2); |
53 | args.usOverscanLeft = (adjusted_mode->crtc_hdisplay - mode->crtc_hdisplay) / 2; | 53 | args.usOverscanLeft = cpu_to_le16((adjusted_mode->crtc_hdisplay - mode->crtc_hdisplay) / 2); |
54 | args.usOverscanRight = (adjusted_mode->crtc_hdisplay - mode->crtc_hdisplay) / 2; | 54 | args.usOverscanRight = cpu_to_le16((adjusted_mode->crtc_hdisplay - mode->crtc_hdisplay) / 2); |
55 | break; | 55 | break; |
56 | case RMX_ASPECT: | 56 | case RMX_ASPECT: |
57 | a1 = mode->crtc_vdisplay * adjusted_mode->crtc_hdisplay; | 57 | a1 = mode->crtc_vdisplay * adjusted_mode->crtc_hdisplay; |
58 | a2 = adjusted_mode->crtc_vdisplay * mode->crtc_hdisplay; | 58 | a2 = adjusted_mode->crtc_vdisplay * mode->crtc_hdisplay; |
59 | 59 | ||
60 | if (a1 > a2) { | 60 | if (a1 > a2) { |
61 | args.usOverscanLeft = (adjusted_mode->crtc_hdisplay - (a2 / mode->crtc_vdisplay)) / 2; | 61 | args.usOverscanLeft = cpu_to_le16((adjusted_mode->crtc_hdisplay - (a2 / mode->crtc_vdisplay)) / 2); |
62 | args.usOverscanRight = (adjusted_mode->crtc_hdisplay - (a2 / mode->crtc_vdisplay)) / 2; | 62 | args.usOverscanRight = cpu_to_le16((adjusted_mode->crtc_hdisplay - (a2 / mode->crtc_vdisplay)) / 2); |
63 | } else if (a2 > a1) { | 63 | } else if (a2 > a1) { |
64 | args.usOverscanLeft = (adjusted_mode->crtc_vdisplay - (a1 / mode->crtc_hdisplay)) / 2; | 64 | args.usOverscanLeft = cpu_to_le16((adjusted_mode->crtc_vdisplay - (a1 / mode->crtc_hdisplay)) / 2); |
65 | args.usOverscanRight = (adjusted_mode->crtc_vdisplay - (a1 / mode->crtc_hdisplay)) / 2; | 65 | args.usOverscanRight = cpu_to_le16((adjusted_mode->crtc_vdisplay - (a1 / mode->crtc_hdisplay)) / 2); |
66 | } | 66 | } |
67 | break; | 67 | break; |
68 | case RMX_FULL: | 68 | case RMX_FULL: |
69 | default: | 69 | default: |
70 | args.usOverscanRight = radeon_crtc->h_border; | 70 | args.usOverscanRight = cpu_to_le16(radeon_crtc->h_border); |
71 | args.usOverscanLeft = radeon_crtc->h_border; | 71 | args.usOverscanLeft = cpu_to_le16(radeon_crtc->h_border); |
72 | args.usOverscanBottom = radeon_crtc->v_border; | 72 | args.usOverscanBottom = cpu_to_le16(radeon_crtc->v_border); |
73 | args.usOverscanTop = radeon_crtc->v_border; | 73 | args.usOverscanTop = cpu_to_le16(radeon_crtc->v_border); |
74 | break; | 74 | break; |
75 | } | 75 | } |
76 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 76 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
@@ -419,23 +419,23 @@ static void atombios_crtc_program_ss(struct drm_crtc *crtc, | |||
419 | memset(&args, 0, sizeof(args)); | 419 | memset(&args, 0, sizeof(args)); |
420 | 420 | ||
421 | if (ASIC_IS_DCE5(rdev)) { | 421 | if (ASIC_IS_DCE5(rdev)) { |
422 | args.v3.usSpreadSpectrumAmountFrac = 0; | 422 | args.v3.usSpreadSpectrumAmountFrac = cpu_to_le16(0); |
423 | args.v3.ucSpreadSpectrumType = ss->type; | 423 | args.v3.ucSpreadSpectrumType = ss->type; |
424 | switch (pll_id) { | 424 | switch (pll_id) { |
425 | case ATOM_PPLL1: | 425 | case ATOM_PPLL1: |
426 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_P1PLL; | 426 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_P1PLL; |
427 | args.v3.usSpreadSpectrumAmount = ss->amount; | 427 | args.v3.usSpreadSpectrumAmount = cpu_to_le16(ss->amount); |
428 | args.v3.usSpreadSpectrumStep = ss->step; | 428 | args.v3.usSpreadSpectrumStep = cpu_to_le16(ss->step); |
429 | break; | 429 | break; |
430 | case ATOM_PPLL2: | 430 | case ATOM_PPLL2: |
431 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_P2PLL; | 431 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_P2PLL; |
432 | args.v3.usSpreadSpectrumAmount = ss->amount; | 432 | args.v3.usSpreadSpectrumAmount = cpu_to_le16(ss->amount); |
433 | args.v3.usSpreadSpectrumStep = ss->step; | 433 | args.v3.usSpreadSpectrumStep = cpu_to_le16(ss->step); |
434 | break; | 434 | break; |
435 | case ATOM_DCPLL: | 435 | case ATOM_DCPLL: |
436 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_DCPLL; | 436 | args.v3.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V3_DCPLL; |
437 | args.v3.usSpreadSpectrumAmount = 0; | 437 | args.v3.usSpreadSpectrumAmount = cpu_to_le16(0); |
438 | args.v3.usSpreadSpectrumStep = 0; | 438 | args.v3.usSpreadSpectrumStep = cpu_to_le16(0); |
439 | break; | 439 | break; |
440 | case ATOM_PPLL_INVALID: | 440 | case ATOM_PPLL_INVALID: |
441 | return; | 441 | return; |
@@ -447,18 +447,18 @@ static void atombios_crtc_program_ss(struct drm_crtc *crtc, | |||
447 | switch (pll_id) { | 447 | switch (pll_id) { |
448 | case ATOM_PPLL1: | 448 | case ATOM_PPLL1: |
449 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_P1PLL; | 449 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_P1PLL; |
450 | args.v2.usSpreadSpectrumAmount = ss->amount; | 450 | args.v2.usSpreadSpectrumAmount = cpu_to_le16(ss->amount); |
451 | args.v2.usSpreadSpectrumStep = ss->step; | 451 | args.v2.usSpreadSpectrumStep = cpu_to_le16(ss->step); |
452 | break; | 452 | break; |
453 | case ATOM_PPLL2: | 453 | case ATOM_PPLL2: |
454 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_P2PLL; | 454 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_P2PLL; |
455 | args.v2.usSpreadSpectrumAmount = ss->amount; | 455 | args.v2.usSpreadSpectrumAmount = cpu_to_le16(ss->amount); |
456 | args.v2.usSpreadSpectrumStep = ss->step; | 456 | args.v2.usSpreadSpectrumStep = cpu_to_le16(ss->step); |
457 | break; | 457 | break; |
458 | case ATOM_DCPLL: | 458 | case ATOM_DCPLL: |
459 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_DCPLL; | 459 | args.v2.ucSpreadSpectrumType |= ATOM_PPLL_SS_TYPE_V2_DCPLL; |
460 | args.v2.usSpreadSpectrumAmount = 0; | 460 | args.v2.usSpreadSpectrumAmount = cpu_to_le16(0); |
461 | args.v2.usSpreadSpectrumStep = 0; | 461 | args.v2.usSpreadSpectrumStep = cpu_to_le16(0); |
462 | break; | 462 | break; |
463 | case ATOM_PPLL_INVALID: | 463 | case ATOM_PPLL_INVALID: |
464 | return; | 464 | return; |
@@ -538,7 +538,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
538 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; | 538 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; |
539 | else | 539 | else |
540 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; | 540 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; |
541 | |||
542 | } | 541 | } |
543 | 542 | ||
544 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | 543 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
@@ -555,23 +554,28 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
555 | dp_clock = dig_connector->dp_clock; | 554 | dp_clock = dig_connector->dp_clock; |
556 | } | 555 | } |
557 | } | 556 | } |
558 | #if 0 /* doesn't work properly on some laptops */ | 557 | |
559 | /* use recommended ref_div for ss */ | 558 | /* use recommended ref_div for ss */ |
560 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 559 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
561 | if (ss_enabled) { | 560 | if (ss_enabled) { |
562 | if (ss->refdiv) { | 561 | if (ss->refdiv) { |
562 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | ||
563 | pll->flags |= RADEON_PLL_USE_REF_DIV; | 563 | pll->flags |= RADEON_PLL_USE_REF_DIV; |
564 | pll->reference_div = ss->refdiv; | 564 | pll->reference_div = ss->refdiv; |
565 | if (ASIC_IS_AVIVO(rdev)) | ||
566 | pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV; | ||
565 | } | 567 | } |
566 | } | 568 | } |
567 | } | 569 | } |
568 | #endif | 570 | |
569 | if (ASIC_IS_AVIVO(rdev)) { | 571 | if (ASIC_IS_AVIVO(rdev)) { |
570 | /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ | 572 | /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */ |
571 | if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1) | 573 | if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1) |
572 | adjusted_clock = mode->clock * 2; | 574 | adjusted_clock = mode->clock * 2; |
573 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) | 575 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) |
574 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; | 576 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; |
577 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
578 | pll->flags |= RADEON_PLL_IS_LCD; | ||
575 | } else { | 579 | } else { |
576 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) | 580 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) |
577 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; | 581 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; |
@@ -606,14 +610,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
606 | args.v1.usPixelClock = cpu_to_le16(mode->clock / 10); | 610 | args.v1.usPixelClock = cpu_to_le16(mode->clock / 10); |
607 | args.v1.ucTransmitterID = radeon_encoder->encoder_id; | 611 | args.v1.ucTransmitterID = radeon_encoder->encoder_id; |
608 | args.v1.ucEncodeMode = encoder_mode; | 612 | args.v1.ucEncodeMode = encoder_mode; |
609 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { | 613 | if (ss_enabled) |
610 | if (ss_enabled) | ||
611 | args.v1.ucConfig |= | ||
612 | ADJUST_DISPLAY_CONFIG_SS_ENABLE; | ||
613 | } else if (encoder_mode == ATOM_ENCODER_MODE_LVDS) { | ||
614 | args.v1.ucConfig |= | 614 | args.v1.ucConfig |= |
615 | ADJUST_DISPLAY_CONFIG_SS_ENABLE; | 615 | ADJUST_DISPLAY_CONFIG_SS_ENABLE; |
616 | } | ||
617 | 616 | ||
618 | atom_execute_table(rdev->mode_info.atom_context, | 617 | atom_execute_table(rdev->mode_info.atom_context, |
619 | index, (uint32_t *)&args); | 618 | index, (uint32_t *)&args); |
@@ -624,12 +623,12 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
624 | args.v3.sInput.ucTransmitterID = radeon_encoder->encoder_id; | 623 | args.v3.sInput.ucTransmitterID = radeon_encoder->encoder_id; |
625 | args.v3.sInput.ucEncodeMode = encoder_mode; | 624 | args.v3.sInput.ucEncodeMode = encoder_mode; |
626 | args.v3.sInput.ucDispPllConfig = 0; | 625 | args.v3.sInput.ucDispPllConfig = 0; |
626 | if (ss_enabled) | ||
627 | args.v3.sInput.ucDispPllConfig |= | ||
628 | DISPPLL_CONFIG_SS_ENABLE; | ||
627 | if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { | 629 | if (radeon_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { |
628 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 630 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
629 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { | 631 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { |
630 | if (ss_enabled) | ||
631 | args.v3.sInput.ucDispPllConfig |= | ||
632 | DISPPLL_CONFIG_SS_ENABLE; | ||
633 | args.v3.sInput.ucDispPllConfig |= | 632 | args.v3.sInput.ucDispPllConfig |= |
634 | DISPPLL_CONFIG_COHERENT_MODE; | 633 | DISPPLL_CONFIG_COHERENT_MODE; |
635 | /* 16200 or 27000 */ | 634 | /* 16200 or 27000 */ |
@@ -649,18 +648,11 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
649 | } | 648 | } |
650 | } else if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 649 | } else if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
651 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { | 650 | if (encoder_mode == ATOM_ENCODER_MODE_DP) { |
652 | if (ss_enabled) | ||
653 | args.v3.sInput.ucDispPllConfig |= | ||
654 | DISPPLL_CONFIG_SS_ENABLE; | ||
655 | args.v3.sInput.ucDispPllConfig |= | 651 | args.v3.sInput.ucDispPllConfig |= |
656 | DISPPLL_CONFIG_COHERENT_MODE; | 652 | DISPPLL_CONFIG_COHERENT_MODE; |
657 | /* 16200 or 27000 */ | 653 | /* 16200 or 27000 */ |
658 | args.v3.sInput.usPixelClock = cpu_to_le16(dp_clock / 10); | 654 | args.v3.sInput.usPixelClock = cpu_to_le16(dp_clock / 10); |
659 | } else if (encoder_mode == ATOM_ENCODER_MODE_LVDS) { | 655 | } else if (encoder_mode != ATOM_ENCODER_MODE_LVDS) { |
660 | if (ss_enabled) | ||
661 | args.v3.sInput.ucDispPllConfig |= | ||
662 | DISPPLL_CONFIG_SS_ENABLE; | ||
663 | } else { | ||
664 | if (mode->clock > 165000) | 656 | if (mode->clock > 165000) |
665 | args.v3.sInput.ucDispPllConfig |= | 657 | args.v3.sInput.ucDispPllConfig |= |
666 | DISPPLL_CONFIG_DUAL_LINK; | 658 | DISPPLL_CONFIG_DUAL_LINK; |
@@ -670,10 +662,12 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
670 | index, (uint32_t *)&args); | 662 | index, (uint32_t *)&args); |
671 | adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10; | 663 | adjusted_clock = le32_to_cpu(args.v3.sOutput.ulDispPllFreq) * 10; |
672 | if (args.v3.sOutput.ucRefDiv) { | 664 | if (args.v3.sOutput.ucRefDiv) { |
665 | pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV; | ||
673 | pll->flags |= RADEON_PLL_USE_REF_DIV; | 666 | pll->flags |= RADEON_PLL_USE_REF_DIV; |
674 | pll->reference_div = args.v3.sOutput.ucRefDiv; | 667 | pll->reference_div = args.v3.sOutput.ucRefDiv; |
675 | } | 668 | } |
676 | if (args.v3.sOutput.ucPostDiv) { | 669 | if (args.v3.sOutput.ucPostDiv) { |
670 | pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV; | ||
677 | pll->flags |= RADEON_PLL_USE_POST_DIV; | 671 | pll->flags |= RADEON_PLL_USE_POST_DIV; |
678 | pll->post_div = args.v3.sOutput.ucPostDiv; | 672 | pll->post_div = args.v3.sOutput.ucPostDiv; |
679 | } | 673 | } |
@@ -727,14 +721,14 @@ static void atombios_crtc_set_dcpll(struct drm_crtc *crtc, | |||
727 | * SetPixelClock provides the dividers | 721 | * SetPixelClock provides the dividers |
728 | */ | 722 | */ |
729 | args.v5.ucCRTC = ATOM_CRTC_INVALID; | 723 | args.v5.ucCRTC = ATOM_CRTC_INVALID; |
730 | args.v5.usPixelClock = dispclk; | 724 | args.v5.usPixelClock = cpu_to_le16(dispclk); |
731 | args.v5.ucPpll = ATOM_DCPLL; | 725 | args.v5.ucPpll = ATOM_DCPLL; |
732 | break; | 726 | break; |
733 | case 6: | 727 | case 6: |
734 | /* if the default dcpll clock is specified, | 728 | /* if the default dcpll clock is specified, |
735 | * SetPixelClock provides the dividers | 729 | * SetPixelClock provides the dividers |
736 | */ | 730 | */ |
737 | args.v6.ulDispEngClkFreq = dispclk; | 731 | args.v6.ulDispEngClkFreq = cpu_to_le32(dispclk); |
738 | args.v6.ucPpll = ATOM_DCPLL; | 732 | args.v6.ucPpll = ATOM_DCPLL; |
739 | break; | 733 | break; |
740 | default: | 734 | default: |
@@ -963,8 +957,12 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
963 | /* adjust pixel clock as needed */ | 957 | /* adjust pixel clock as needed */ |
964 | adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); | 958 | adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); |
965 | 959 | ||
966 | radeon_compute_pll(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | 960 | if (ASIC_IS_AVIVO(rdev)) |
967 | &ref_div, &post_div); | 961 | radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, |
962 | &ref_div, &post_div); | ||
963 | else | ||
964 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | ||
965 | &ref_div, &post_div); | ||
968 | 966 | ||
969 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); | 967 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); |
970 | 968 | ||
@@ -993,9 +991,9 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
993 | } | 991 | } |
994 | } | 992 | } |
995 | 993 | ||
996 | static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | 994 | static int dce4_crtc_do_set_base(struct drm_crtc *crtc, |
997 | struct drm_framebuffer *fb, | 995 | struct drm_framebuffer *fb, |
998 | int x, int y, int atomic) | 996 | int x, int y, int atomic) |
999 | { | 997 | { |
1000 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 998 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
1001 | struct drm_device *dev = crtc->dev; | 999 | struct drm_device *dev = crtc->dev; |
@@ -1006,6 +1004,7 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
1006 | struct radeon_bo *rbo; | 1004 | struct radeon_bo *rbo; |
1007 | uint64_t fb_location; | 1005 | uint64_t fb_location; |
1008 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1006 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
1007 | u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); | ||
1009 | int r; | 1008 | int r; |
1010 | 1009 | ||
1011 | /* no fb bound */ | 1010 | /* no fb bound */ |
@@ -1057,11 +1056,17 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
1057 | case 16: | 1056 | case 16: |
1058 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | | 1057 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_16BPP) | |
1059 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); | 1058 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB565)); |
1059 | #ifdef __BIG_ENDIAN | ||
1060 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN16); | ||
1061 | #endif | ||
1060 | break; | 1062 | break; |
1061 | case 24: | 1063 | case 24: |
1062 | case 32: | 1064 | case 32: |
1063 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | | 1065 | fb_format = (EVERGREEN_GRPH_DEPTH(EVERGREEN_GRPH_DEPTH_32BPP) | |
1064 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); | 1066 | EVERGREEN_GRPH_FORMAT(EVERGREEN_GRPH_FORMAT_ARGB8888)); |
1067 | #ifdef __BIG_ENDIAN | ||
1068 | fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_8IN32); | ||
1069 | #endif | ||
1065 | break; | 1070 | break; |
1066 | default: | 1071 | default: |
1067 | DRM_ERROR("Unsupported screen depth %d\n", | 1072 | DRM_ERROR("Unsupported screen depth %d\n", |
@@ -1106,6 +1111,7 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
1106 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, | 1111 | WREG32(EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS + radeon_crtc->crtc_offset, |
1107 | (u32) fb_location & EVERGREEN_GRPH_SURFACE_ADDRESS_MASK); | 1112 | (u32) fb_location & EVERGREEN_GRPH_SURFACE_ADDRESS_MASK); |
1108 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); | 1113 | WREG32(EVERGREEN_GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); |
1114 | WREG32(EVERGREEN_GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | ||
1109 | 1115 | ||
1110 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1116 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
1111 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1117 | WREG32(EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
@@ -1127,12 +1133,6 @@ static int evergreen_crtc_do_set_base(struct drm_crtc *crtc, | |||
1127 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1133 | WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1128 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); | 1134 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); |
1129 | 1135 | ||
1130 | if (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) | ||
1131 | WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset, | ||
1132 | EVERGREEN_INTERLEAVE_EN); | ||
1133 | else | ||
1134 | WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset, 0); | ||
1135 | |||
1136 | if (!atomic && fb && fb != crtc->fb) { | 1136 | if (!atomic && fb && fb != crtc->fb) { |
1137 | radeon_fb = to_radeon_framebuffer(fb); | 1137 | radeon_fb = to_radeon_framebuffer(fb); |
1138 | rbo = radeon_fb->obj->driver_private; | 1138 | rbo = radeon_fb->obj->driver_private; |
@@ -1162,6 +1162,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1162 | struct drm_framebuffer *target_fb; | 1162 | struct drm_framebuffer *target_fb; |
1163 | uint64_t fb_location; | 1163 | uint64_t fb_location; |
1164 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; | 1164 | uint32_t fb_format, fb_pitch_pixels, tiling_flags; |
1165 | u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; | ||
1165 | int r; | 1166 | int r; |
1166 | 1167 | ||
1167 | /* no fb bound */ | 1168 | /* no fb bound */ |
@@ -1215,12 +1216,18 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1215 | fb_format = | 1216 | fb_format = |
1216 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | | 1217 | AVIVO_D1GRPH_CONTROL_DEPTH_16BPP | |
1217 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; | 1218 | AVIVO_D1GRPH_CONTROL_16BPP_RGB565; |
1219 | #ifdef __BIG_ENDIAN | ||
1220 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_16BIT; | ||
1221 | #endif | ||
1218 | break; | 1222 | break; |
1219 | case 24: | 1223 | case 24: |
1220 | case 32: | 1224 | case 32: |
1221 | fb_format = | 1225 | fb_format = |
1222 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | | 1226 | AVIVO_D1GRPH_CONTROL_DEPTH_32BPP | |
1223 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; | 1227 | AVIVO_D1GRPH_CONTROL_32BPP_ARGB8888; |
1228 | #ifdef __BIG_ENDIAN | ||
1229 | fb_swap = R600_D1GRPH_SWAP_ENDIAN_32BIT; | ||
1230 | #endif | ||
1224 | break; | 1231 | break; |
1225 | default: | 1232 | default: |
1226 | DRM_ERROR("Unsupported screen depth %d\n", | 1233 | DRM_ERROR("Unsupported screen depth %d\n", |
@@ -1260,6 +1267,8 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1260 | WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + | 1267 | WREG32(AVIVO_D1GRPH_SECONDARY_SURFACE_ADDRESS + |
1261 | radeon_crtc->crtc_offset, (u32) fb_location); | 1268 | radeon_crtc->crtc_offset, (u32) fb_location); |
1262 | WREG32(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); | 1269 | WREG32(AVIVO_D1GRPH_CONTROL + radeon_crtc->crtc_offset, fb_format); |
1270 | if (rdev->family >= CHIP_R600) | ||
1271 | WREG32(R600_D1GRPH_SWAP_CONTROL + radeon_crtc->crtc_offset, fb_swap); | ||
1263 | 1272 | ||
1264 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); | 1273 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_X + radeon_crtc->crtc_offset, 0); |
1265 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); | 1274 | WREG32(AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset, 0); |
@@ -1281,12 +1290,6 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc, | |||
1281 | WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, | 1290 | WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, |
1282 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); | 1291 | (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); |
1283 | 1292 | ||
1284 | if (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) | ||
1285 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, | ||
1286 | AVIVO_D1MODE_INTERLEAVE_EN); | ||
1287 | else | ||
1288 | WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, 0); | ||
1289 | |||
1290 | if (!atomic && fb && fb != crtc->fb) { | 1293 | if (!atomic && fb && fb != crtc->fb) { |
1291 | radeon_fb = to_radeon_framebuffer(fb); | 1294 | radeon_fb = to_radeon_framebuffer(fb); |
1292 | rbo = radeon_fb->obj->driver_private; | 1295 | rbo = radeon_fb->obj->driver_private; |
@@ -1310,7 +1313,7 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, | |||
1310 | struct radeon_device *rdev = dev->dev_private; | 1313 | struct radeon_device *rdev = dev->dev_private; |
1311 | 1314 | ||
1312 | if (ASIC_IS_DCE4(rdev)) | 1315 | if (ASIC_IS_DCE4(rdev)) |
1313 | return evergreen_crtc_do_set_base(crtc, old_fb, x, y, 0); | 1316 | return dce4_crtc_do_set_base(crtc, old_fb, x, y, 0); |
1314 | else if (ASIC_IS_AVIVO(rdev)) | 1317 | else if (ASIC_IS_AVIVO(rdev)) |
1315 | return avivo_crtc_do_set_base(crtc, old_fb, x, y, 0); | 1318 | return avivo_crtc_do_set_base(crtc, old_fb, x, y, 0); |
1316 | else | 1319 | else |
@@ -1325,7 +1328,7 @@ int atombios_crtc_set_base_atomic(struct drm_crtc *crtc, | |||
1325 | struct radeon_device *rdev = dev->dev_private; | 1328 | struct radeon_device *rdev = dev->dev_private; |
1326 | 1329 | ||
1327 | if (ASIC_IS_DCE4(rdev)) | 1330 | if (ASIC_IS_DCE4(rdev)) |
1328 | return evergreen_crtc_do_set_base(crtc, fb, x, y, 1); | 1331 | return dce4_crtc_do_set_base(crtc, fb, x, y, 1); |
1329 | else if (ASIC_IS_AVIVO(rdev)) | 1332 | else if (ASIC_IS_AVIVO(rdev)) |
1330 | return avivo_crtc_do_set_base(crtc, fb, x, y, 1); | 1333 | return avivo_crtc_do_set_base(crtc, fb, x, y, 1); |
1331 | else | 1334 | else |