Rev 1321 | Rev 1430 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1321 | Rev 1404 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | WREG32(RADEON_OVR_WID_LEFT_RIGHT + radeon_crtc->crtc_offset, 0); |
41 | WREG32(RADEON_OVR_WID_LEFT_RIGHT + radeon_crtc->crtc_offset, 0); |
42 | WREG32(RADEON_OVR_WID_TOP_BOTTOM + radeon_crtc->crtc_offset, 0); |
42 | WREG32(RADEON_OVR_WID_TOP_BOTTOM + radeon_crtc->crtc_offset, 0); |
43 | } |
43 | } |
Line 44... | Line 44... | ||
44 | 44 | ||
45 | static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, |
45 | static void radeon_legacy_rmx_mode_set(struct drm_crtc *crtc, |
46 | struct drm_display_mode *mode, |
- | |
47 | struct drm_display_mode *adjusted_mode) |
46 | struct drm_display_mode *mode) |
48 | { |
47 | { |
49 | struct drm_device *dev = crtc->dev; |
48 | struct drm_device *dev = crtc->dev; |
50 | struct radeon_device *rdev = dev->dev_private; |
49 | struct radeon_device *rdev = dev->dev_private; |
51 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
50 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
Line 320... | Line 319... | ||
320 | else { |
319 | else { |
321 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN | |
320 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN | |
322 | RADEON_CRTC_DISP_REQ_EN_B)); |
321 | RADEON_CRTC_DISP_REQ_EN_B)); |
323 | WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask); |
322 | WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask); |
324 | } |
323 | } |
325 | // drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); |
- | |
326 | radeon_crtc_load_lut(crtc); |
324 | radeon_crtc_load_lut(crtc); |
327 | break; |
325 | break; |
328 | case DRM_MODE_DPMS_STANDBY: |
326 | case DRM_MODE_DPMS_STANDBY: |
329 | case DRM_MODE_DPMS_SUSPEND: |
327 | case DRM_MODE_DPMS_SUSPEND: |
330 | case DRM_MODE_DPMS_OFF: |
328 | case DRM_MODE_DPMS_OFF: |
331 | // drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); |
- | |
332 | if (radeon_crtc->crtc_id) |
329 | if (radeon_crtc->crtc_id) |
333 | WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~(RADEON_CRTC2_EN | mask)); |
330 | WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~(RADEON_CRTC2_EN | mask)); |
334 | else { |
331 | else { |
335 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN | |
332 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN | |
336 | RADEON_CRTC_DISP_REQ_EN_B)); |
333 | RADEON_CRTC_DISP_REQ_EN_B)); |
Line 338... | Line 335... | ||
338 | } |
335 | } |
339 | break; |
336 | break; |
340 | } |
337 | } |
341 | } |
338 | } |
Line 342... | Line -... | ||
342 | - | ||
343 | /* properly set crtc bpp when using atombios */ |
- | |
344 | void radeon_legacy_atom_set_surface(struct drm_crtc *crtc) |
- | |
345 | { |
- | |
346 | struct drm_device *dev = crtc->dev; |
- | |
347 | struct radeon_device *rdev = dev->dev_private; |
- | |
348 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
- | |
349 | int format; |
- | |
350 | uint32_t crtc_gen_cntl; |
- | |
351 | uint32_t disp_merge_cntl; |
- | |
352 | uint32_t crtc_pitch; |
- | |
353 | - | ||
354 | switch (crtc->fb->bits_per_pixel) { |
- | |
355 | case 8: |
- | |
356 | format = 2; |
- | |
357 | break; |
- | |
358 | case 15: /* 555 */ |
- | |
359 | format = 3; |
- | |
360 | break; |
- | |
361 | case 16: /* 565 */ |
- | |
362 | format = 4; |
- | |
363 | break; |
- | |
364 | case 24: /* RGB */ |
- | |
365 | format = 5; |
- | |
366 | break; |
- | |
367 | case 32: /* xRGB */ |
- | |
368 | format = 6; |
- | |
369 | break; |
- | |
370 | default: |
- | |
371 | return; |
- | |
372 | } |
- | |
373 | - | ||
374 | crtc_pitch = ((((crtc->fb->pitch / (crtc->fb->bits_per_pixel / 8)) * crtc->fb->bits_per_pixel) + |
- | |
375 | ((crtc->fb->bits_per_pixel * 8) - 1)) / |
- | |
376 | (crtc->fb->bits_per_pixel * 8)); |
- | |
377 | crtc_pitch |= crtc_pitch << 16; |
- | |
378 | - | ||
379 | WREG32(RADEON_CRTC_PITCH + radeon_crtc->crtc_offset, crtc_pitch); |
- | |
380 | - | ||
381 | switch (radeon_crtc->crtc_id) { |
- | |
382 | case 0: |
- | |
383 | disp_merge_cntl = RREG32(RADEON_DISP_MERGE_CNTL); |
- | |
384 | disp_merge_cntl &= ~RADEON_DISP_RGB_OFFSET_EN; |
- | |
385 | WREG32(RADEON_DISP_MERGE_CNTL, disp_merge_cntl); |
- | |
386 | - | ||
387 | crtc_gen_cntl = RREG32(RADEON_CRTC_GEN_CNTL) & 0xfffff0ff; |
- | |
388 | crtc_gen_cntl |= (format << 8); |
- | |
389 | crtc_gen_cntl |= RADEON_CRTC_EXT_DISP_EN; |
- | |
390 | WREG32(RADEON_CRTC_GEN_CNTL, crtc_gen_cntl); |
- | |
391 | break; |
- | |
392 | case 1: |
- | |
393 | disp_merge_cntl = RREG32(RADEON_DISP2_MERGE_CNTL); |
- | |
394 | disp_merge_cntl &= ~RADEON_DISP2_RGB_OFFSET_EN; |
- | |
395 | WREG32(RADEON_DISP2_MERGE_CNTL, disp_merge_cntl); |
- | |
396 | - | ||
397 | crtc_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL) & 0xfffff0ff; |
- | |
398 | crtc_gen_cntl |= (format << 8); |
- | |
399 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc_gen_cntl); |
- | |
400 | WREG32(RADEON_FP_H2_SYNC_STRT_WID, RREG32(RADEON_CRTC2_H_SYNC_STRT_WID)); |
- | |
401 | WREG32(RADEON_FP_V2_SYNC_STRT_WID, RREG32(RADEON_CRTC2_V_SYNC_STRT_WID)); |
- | |
402 | break; |
- | |
403 | } |
- | |
404 | } |
- | |
405 | 339 | ||
406 | int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, |
340 | int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, |
407 | struct drm_framebuffer *old_fb) |
341 | struct drm_framebuffer *old_fb) |
408 | { |
342 | { |
409 | struct drm_device *dev = crtc->dev; |
343 | struct drm_device *dev = crtc->dev; |
Line 754... | Line 688... | ||
754 | uint32_t frac_fb_div = 0; |
688 | uint32_t frac_fb_div = 0; |
755 | uint32_t reference_div = 0; |
689 | uint32_t reference_div = 0; |
756 | uint32_t post_divider = 0; |
690 | uint32_t post_divider = 0; |
757 | uint32_t freq = 0; |
691 | uint32_t freq = 0; |
758 | uint8_t pll_gain; |
692 | uint8_t pll_gain; |
759 | int pll_flags = RADEON_PLL_LEGACY; |
- | |
760 | bool use_bios_divs = false; |
693 | bool use_bios_divs = false; |
761 | /* PLL registers */ |
694 | /* PLL registers */ |
762 | uint32_t pll_ref_div = 0; |
695 | uint32_t pll_ref_div = 0; |
763 | uint32_t pll_fb_post_div = 0; |
696 | uint32_t pll_fb_post_div = 0; |
764 | uint32_t htotal_cntl = 0; |
697 | uint32_t htotal_cntl = 0; |
Line 788... | Line 721... | ||
788 | if (radeon_crtc->crtc_id) |
721 | if (radeon_crtc->crtc_id) |
789 | pll = &rdev->clock.p2pll; |
722 | pll = &rdev->clock.p2pll; |
790 | else |
723 | else |
791 | pll = &rdev->clock.p1pll; |
724 | pll = &rdev->clock.p1pll; |
Line -... | Line 725... | ||
- | 725 | ||
- | 726 | pll->flags = RADEON_PLL_LEGACY; |
|
792 | 727 | ||
793 | if (mode->clock > 200000) /* range limits??? */ |
728 | if (mode->clock > 200000) /* range limits??? */ |
794 | pll_flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; |
729 | pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; |
795 | else |
730 | else |
Line 796... | Line 731... | ||
796 | pll_flags |= RADEON_PLL_PREFER_LOW_REF_DIV; |
731 | pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; |
797 | 732 | ||
798 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
733 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
Line 803... | Line 738... | ||
803 | is_tv = true; |
738 | is_tv = true; |
804 | break; |
739 | break; |
805 | } |
740 | } |
Line 806... | Line 741... | ||
806 | 741 | ||
807 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) |
742 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) |
808 | pll_flags |= RADEON_PLL_NO_ODD_POST_DIV; |
743 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; |
809 | if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) { |
744 | if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) { |
810 | if (!rdev->is_atom_bios) { |
745 | if (!rdev->is_atom_bios) { |
811 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
746 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
812 | struct radeon_encoder_lvds *lvds = (struct radeon_encoder_lvds *)radeon_encoder->enc_priv; |
747 | struct radeon_encoder_lvds *lvds = (struct radeon_encoder_lvds *)radeon_encoder->enc_priv; |
Line 818... | Line 753... | ||
818 | htotal_cntl = 0; |
753 | htotal_cntl = 0; |
819 | use_bios_divs = true; |
754 | use_bios_divs = true; |
820 | } |
755 | } |
821 | } |
756 | } |
822 | } |
757 | } |
823 | pll_flags |= RADEON_PLL_USE_REF_DIV; |
758 | pll->flags |= RADEON_PLL_USE_REF_DIV; |
824 | } |
759 | } |
825 | } |
760 | } |
826 | } |
761 | } |
Line 827... | Line 762... | ||
827 | 762 | ||
Line 828... | Line 763... | ||
828 | DRM_DEBUG("\n"); |
763 | DRM_DEBUG("\n"); |
829 | 764 | ||
830 | if (!use_bios_divs) { |
765 | if (!use_bios_divs) { |
831 | radeon_compute_pll(pll, mode->clock, |
766 | radeon_compute_pll(pll, mode->clock, |
832 | &freq, &feedback_div, &frac_fb_div, |
- | |
Line 833... | Line 767... | ||
833 | &reference_div, &post_divider, |
767 | &freq, &feedback_div, &frac_fb_div, |
834 | pll_flags); |
768 | &reference_div, &post_divider); |
835 | 769 | ||
836 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { |
770 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { |
Line 1057... | Line 991... | ||
1057 | radeon_crtc_set_base(crtc, x, y, old_fb); |
991 | radeon_crtc_set_base(crtc, x, y, old_fb); |
1058 | radeon_set_crtc_timing(crtc, adjusted_mode); |
992 | radeon_set_crtc_timing(crtc, adjusted_mode); |
1059 | radeon_set_pll(crtc, adjusted_mode); |
993 | radeon_set_pll(crtc, adjusted_mode); |
1060 | radeon_overscan_setup(crtc, adjusted_mode); |
994 | radeon_overscan_setup(crtc, adjusted_mode); |
1061 | if (radeon_crtc->crtc_id == 0) { |
995 | if (radeon_crtc->crtc_id == 0) { |
1062 | radeon_legacy_rmx_mode_set(crtc, mode, adjusted_mode); |
996 | radeon_legacy_rmx_mode_set(crtc, adjusted_mode); |
1063 | } else { |
997 | } else { |
1064 | if (radeon_crtc->rmx_type != RMX_OFF) { |
998 | if (radeon_crtc->rmx_type != RMX_OFF) { |
1065 | /* FIXME: only first crtc has rmx what should we |
999 | /* FIXME: only first crtc has rmx what should we |
1066 | * do ? |
1000 | * do ? |
1067 | */ |
1001 | */ |