aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-03-16 20:54:38 -0400
committerDave Airlie <airlied@redhat.com>2010-03-30 23:02:06 -0400
commitf47299c55a837af1727bc601e1fc0fa33adaeda5 (patch)
tree3cb63394f5fc9d2adb24922f048e17d688c3c371 /drivers
parent9e7b414edbf5e037c1462bbd8676465ed2ae0ac3 (diff)
drm/radeon/kms: display watermark fixes
- rs780/880 were using the wrong bandwidth functions - convert r1xx-r4xx to use the same pm sclk/mclk structs as r5xx+ - move bandwidth setup to a common function Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c9
-rw-r--r--drivers/gpu/drm/radeon/r100.c8
-rw-r--r--drivers/gpu/drm/radeon/r300.c1
-rw-r--r--drivers/gpu/drm/radeon/r520.c8
-rw-r--r--drivers/gpu/drm/radeon/r600.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c41
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c30
-rw-r--r--drivers/gpu/drm/radeon/rs600.c2
-rw-r--r--drivers/gpu/drm/radeon/rs690.c11
-rw-r--r--drivers/gpu/drm/radeon/rv515.c8
-rw-r--r--drivers/gpu/drm/radeon/rv770.c9
12 files changed, 87 insertions, 51 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index db78d93f7f20..647a0efdc353 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -437,7 +437,6 @@ static void evergreen_gpu_init(struct radeon_device *rdev)
437 437
438int evergreen_mc_init(struct radeon_device *rdev) 438int evergreen_mc_init(struct radeon_device *rdev)
439{ 439{
440 fixed20_12 a;
441 u32 tmp; 440 u32 tmp;
442 int chansize, numchan; 441 int chansize, numchan;
443 442
@@ -482,12 +481,8 @@ int evergreen_mc_init(struct radeon_device *rdev)
482 rdev->mc.real_vram_size = rdev->mc.aper_size; 481 rdev->mc.real_vram_size = rdev->mc.aper_size;
483 } 482 }
484 r600_vram_gtt_location(rdev, &rdev->mc); 483 r600_vram_gtt_location(rdev, &rdev->mc);
485 /* FIXME: we should enforce default clock in case GPU is not in 484 radeon_update_bandwidth_info(rdev);
486 * default setup 485
487 */
488 a.full = rfixed_const(100);
489 rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk);
490 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
491 return 0; 486 return 0;
492} 487}
493 488
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 9d634c8a322a..e35cf1932829 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -2025,6 +2025,7 @@ void r100_mc_init(struct radeon_device *rdev)
2025 radeon_vram_location(rdev, &rdev->mc, base); 2025 radeon_vram_location(rdev, &rdev->mc, base);
2026 if (!(rdev->flags & RADEON_IS_AGP)) 2026 if (!(rdev->flags & RADEON_IS_AGP))
2027 radeon_gtt_location(rdev, &rdev->mc); 2027 radeon_gtt_location(rdev, &rdev->mc);
2028 radeon_update_bandwidth_info(rdev);
2028} 2029}
2029 2030
2030 2031
@@ -2416,11 +2417,8 @@ void r100_bandwidth_update(struct radeon_device *rdev)
2416 /* 2417 /*
2417 * determine is there is enough bw for current mode 2418 * determine is there is enough bw for current mode
2418 */ 2419 */
2419 mclk_ff.full = rfixed_const(rdev->clock.default_mclk); 2420 sclk_ff = rdev->pm.sclk;
2420 temp_ff.full = rfixed_const(100); 2421 mclk_ff = rdev->pm.mclk;
2421 mclk_ff.full = rfixed_div(mclk_ff, temp_ff);
2422 sclk_ff.full = rfixed_const(rdev->clock.default_sclk);
2423 sclk_ff.full = rfixed_div(sclk_ff, temp_ff);
2424 2422
2425 temp = (rdev->mc.vram_width / 8) * (rdev->mc.vram_is_ddr ? 2 : 1); 2423 temp = (rdev->mc.vram_width / 8) * (rdev->mc.vram_is_ddr ? 2 : 1);
2426 temp_ff.full = rfixed_const(temp); 2424 temp_ff.full = rfixed_const(temp);
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 6d75f8117967..63fe2750f3aa 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -482,6 +482,7 @@ void r300_mc_init(struct radeon_device *rdev)
482 radeon_vram_location(rdev, &rdev->mc, base); 482 radeon_vram_location(rdev, &rdev->mc, base);
483 if (!(rdev->flags & RADEON_IS_AGP)) 483 if (!(rdev->flags & RADEON_IS_AGP))
484 radeon_gtt_location(rdev, &rdev->mc); 484 radeon_gtt_location(rdev, &rdev->mc);
485 radeon_update_bandwidth_info(rdev);
485} 486}
486 487
487void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes) 488void rv370_set_pcie_lanes(struct radeon_device *rdev, int lanes)
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
index f6d8541ebb99..3c44b8d39318 100644
--- a/drivers/gpu/drm/radeon/r520.c
+++ b/drivers/gpu/drm/radeon/r520.c
@@ -122,19 +122,13 @@ static void r520_vram_get_type(struct radeon_device *rdev)
122 122
123void r520_mc_init(struct radeon_device *rdev) 123void r520_mc_init(struct radeon_device *rdev)
124{ 124{
125 fixed20_12 a;
126 125
127 r520_vram_get_type(rdev); 126 r520_vram_get_type(rdev);
128 r100_vram_init_sizes(rdev); 127 r100_vram_init_sizes(rdev);
129 radeon_vram_location(rdev, &rdev->mc, 0); 128 radeon_vram_location(rdev, &rdev->mc, 0);
130 if (!(rdev->flags & RADEON_IS_AGP)) 129 if (!(rdev->flags & RADEON_IS_AGP))
131 radeon_gtt_location(rdev, &rdev->mc); 130 radeon_gtt_location(rdev, &rdev->mc);
132 /* FIXME: we should enforce default clock in case GPU is not in 131 radeon_update_bandwidth_info(rdev);
133 * default setup
134 */
135 a.full = rfixed_const(100);
136 rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk);
137 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
138} 132}
139 133
140void r520_mc_program(struct radeon_device *rdev) 134void r520_mc_program(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index d568262160e1..1aac8bf40864 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -676,7 +676,6 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
676 676
677int r600_mc_init(struct radeon_device *rdev) 677int r600_mc_init(struct radeon_device *rdev)
678{ 678{
679 fixed20_12 a;
680 u32 tmp; 679 u32 tmp;
681 int chansize, numchan; 680 int chansize, numchan;
682 681
@@ -720,14 +719,10 @@ int r600_mc_init(struct radeon_device *rdev)
720 rdev->mc.real_vram_size = rdev->mc.aper_size; 719 rdev->mc.real_vram_size = rdev->mc.aper_size;
721 } 720 }
722 r600_vram_gtt_location(rdev, &rdev->mc); 721 r600_vram_gtt_location(rdev, &rdev->mc);
723 /* FIXME: we should enforce default clock in case GPU is not in 722
724 * default setup
725 */
726 a.full = rfixed_const(100);
727 rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk);
728 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
729 if (rdev->flags & RADEON_IS_IGP) 723 if (rdev->flags & RADEON_IS_IGP)
730 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 724 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
725 radeon_update_bandwidth_info(rdev);
731 return 0; 726 return 0;
732} 727}
733 728
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 46bfff932504..4ee5cb98956d 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -699,6 +699,7 @@ struct radeon_pm {
699 fixed20_12 ht_bandwidth; 699 fixed20_12 ht_bandwidth;
700 fixed20_12 core_bandwidth; 700 fixed20_12 core_bandwidth;
701 fixed20_12 sclk; 701 fixed20_12 sclk;
702 fixed20_12 mclk;
702 fixed20_12 needed_bandwidth; 703 fixed20_12 needed_bandwidth;
703 /* XXX: use a define for num power modes */ 704 /* XXX: use a define for num power modes */
704 struct radeon_power_state power_state[8]; 705 struct radeon_power_state power_state[8];
@@ -1179,6 +1180,7 @@ extern void radeon_gart_restore(struct radeon_device *rdev);
1179extern int radeon_modeset_init(struct radeon_device *rdev); 1180extern int radeon_modeset_init(struct radeon_device *rdev);
1180extern void radeon_modeset_fini(struct radeon_device *rdev); 1181extern void radeon_modeset_fini(struct radeon_device *rdev);
1181extern bool radeon_card_posted(struct radeon_device *rdev); 1182extern bool radeon_card_posted(struct radeon_device *rdev);
1183extern void radeon_update_bandwidth_info(struct radeon_device *rdev);
1182extern bool radeon_boot_test_post_card(struct radeon_device *rdev); 1184extern bool radeon_boot_test_post_card(struct radeon_device *rdev);
1183extern int radeon_clocks_init(struct radeon_device *rdev); 1185extern int radeon_clocks_init(struct radeon_device *rdev);
1184extern void radeon_clocks_fini(struct radeon_device *rdev); 1186extern void radeon_clocks_fini(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index dd23dcfbde17..a4b4bc9fa322 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -543,6 +543,43 @@ static struct radeon_asic r600_asic = {
543 .ioctl_wait_idle = r600_ioctl_wait_idle, 543 .ioctl_wait_idle = r600_ioctl_wait_idle,
544}; 544};
545 545
546static struct radeon_asic rs780_asic = {
547 .init = &r600_init,
548 .fini = &r600_fini,
549 .suspend = &r600_suspend,
550 .resume = &r600_resume,
551 .cp_commit = &r600_cp_commit,
552 .vga_set_state = &r600_vga_set_state,
553 .gpu_reset = &r600_gpu_reset,
554 .gart_tlb_flush = &r600_pcie_gart_tlb_flush,
555 .gart_set_page = &rs600_gart_set_page,
556 .ring_test = &r600_ring_test,
557 .ring_ib_execute = &r600_ring_ib_execute,
558 .irq_set = &r600_irq_set,
559 .irq_process = &r600_irq_process,
560 .get_vblank_counter = &rs600_get_vblank_counter,
561 .fence_ring_emit = &r600_fence_ring_emit,
562 .cs_parse = &r600_cs_parse,
563 .copy_blit = &r600_copy_blit,
564 .copy_dma = &r600_copy_blit,
565 .copy = &r600_copy_blit,
566 .get_engine_clock = &radeon_atom_get_engine_clock,
567 .set_engine_clock = &radeon_atom_set_engine_clock,
568 .get_memory_clock = NULL,
569 .set_memory_clock = NULL,
570 .get_pcie_lanes = NULL,
571 .set_pcie_lanes = NULL,
572 .set_clock_gating = NULL,
573 .set_surface_reg = r600_set_surface_reg,
574 .clear_surface_reg = r600_clear_surface_reg,
575 .bandwidth_update = &rs690_bandwidth_update,
576 .hpd_init = &r600_hpd_init,
577 .hpd_fini = &r600_hpd_fini,
578 .hpd_sense = &r600_hpd_sense,
579 .hpd_set_polarity = &r600_hpd_set_polarity,
580 .ioctl_wait_idle = r600_ioctl_wait_idle,
581};
582
546static struct radeon_asic rv770_asic = { 583static struct radeon_asic rv770_asic = {
547 .init = &rv770_init, 584 .init = &rv770_init,
548 .fini = &rv770_fini, 585 .fini = &rv770_fini,
@@ -673,9 +710,11 @@ int radeon_asic_init(struct radeon_device *rdev)
673 case CHIP_RV620: 710 case CHIP_RV620:
674 case CHIP_RV635: 711 case CHIP_RV635:
675 case CHIP_RV670: 712 case CHIP_RV670:
713 rdev->asic = &r600_asic;
714 break;
676 case CHIP_RS780: 715 case CHIP_RS780:
677 case CHIP_RS880: 716 case CHIP_RS880:
678 rdev->asic = &r600_asic; 717 rdev->asic = &rs780_asic;
679 break; 718 break;
680 case CHIP_RV770: 719 case CHIP_RV770:
681 case CHIP_RV730: 720 case CHIP_RV730:
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 581b75ad6ce7..6bedc2117f7f 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -241,6 +241,36 @@ bool radeon_card_posted(struct radeon_device *rdev)
241 241
242} 242}
243 243
244void radeon_update_bandwidth_info(struct radeon_device *rdev)
245{
246 fixed20_12 a;
247 u32 sclk, mclk;
248
249 if (rdev->flags & RADEON_IS_IGP) {
250 sclk = radeon_get_engine_clock(rdev);
251 mclk = rdev->clock.default_mclk;
252
253 a.full = rfixed_const(100);
254 rdev->pm.sclk.full = rfixed_const(sclk);
255 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
256 rdev->pm.mclk.full = rfixed_const(mclk);
257 rdev->pm.mclk.full = rfixed_div(rdev->pm.mclk, a);
258
259 a.full = rfixed_const(16);
260 /* core_bandwidth = sclk(Mhz) * 16 */
261 rdev->pm.core_bandwidth.full = rfixed_div(rdev->pm.sclk, a);
262 } else {
263 sclk = radeon_get_engine_clock(rdev);
264 mclk = radeon_get_memory_clock(rdev);
265
266 a.full = rfixed_const(100);
267 rdev->pm.sclk.full = rfixed_const(sclk);
268 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
269 rdev->pm.mclk.full = rfixed_const(mclk);
270 rdev->pm.mclk.full = rfixed_div(rdev->pm.mclk, a);
271 }
272}
273
244bool radeon_boot_test_post_card(struct radeon_device *rdev) 274bool radeon_boot_test_post_card(struct radeon_device *rdev)
245{ 275{
246 if (radeon_card_posted(rdev)) 276 if (radeon_card_posted(rdev))
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 3630c165d9c9..df7a855c18ea 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -475,8 +475,10 @@ void rs600_mc_init(struct radeon_device *rdev)
475 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 475 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
476 base = RREG32_MC(R_000004_MC_FB_LOCATION); 476 base = RREG32_MC(R_000004_MC_FB_LOCATION);
477 base = G_000004_MC_FB_START(base) << 16; 477 base = G_000004_MC_FB_START(base) << 16;
478 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
478 radeon_vram_location(rdev, &rdev->mc, base); 479 radeon_vram_location(rdev, &rdev->mc, base);
479 radeon_gtt_location(rdev, &rdev->mc); 480 radeon_gtt_location(rdev, &rdev->mc);
481 radeon_update_bandwidth_info(rdev);
480} 482}
481 483
482void rs600_bandwidth_update(struct radeon_device *rdev) 484void rs600_bandwidth_update(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 6c92ae3c184a..e356935b0283 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -132,7 +132,6 @@ void rs690_pm_info(struct radeon_device *rdev)
132 132
133void rs690_mc_init(struct radeon_device *rdev) 133void rs690_mc_init(struct radeon_device *rdev)
134{ 134{
135 fixed20_12 a;
136 u64 base; 135 u64 base;
137 136
138 rs400_gart_adjust_size(rdev); 137 rs400_gart_adjust_size(rdev);
@@ -146,18 +145,10 @@ void rs690_mc_init(struct radeon_device *rdev)
146 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); 145 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION);
147 base = G_000100_MC_FB_START(base) << 16; 146 base = G_000100_MC_FB_START(base) << 16;
148 rs690_pm_info(rdev); 147 rs690_pm_info(rdev);
149 /* FIXME: we should enforce default clock in case GPU is not in
150 * default setup
151 */
152 a.full = rfixed_const(100);
153 rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk);
154 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
155 a.full = rfixed_const(16);
156 /* core_bandwidth = sclk(Mhz) * 16 */
157 rdev->pm.core_bandwidth.full = rfixed_div(rdev->pm.sclk, a);
158 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 148 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
159 radeon_vram_location(rdev, &rdev->mc, base); 149 radeon_vram_location(rdev, &rdev->mc, base);
160 radeon_gtt_location(rdev, &rdev->mc); 150 radeon_gtt_location(rdev, &rdev->mc);
151 radeon_update_bandwidth_info(rdev);
161} 152}
162 153
163void rs690_line_buffer_adjust(struct radeon_device *rdev, 154void rs690_line_buffer_adjust(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index f85499fa1968..d94291add6db 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -280,19 +280,13 @@ static void rv515_vram_get_type(struct radeon_device *rdev)
280 280
281void rv515_mc_init(struct radeon_device *rdev) 281void rv515_mc_init(struct radeon_device *rdev)
282{ 282{
283 fixed20_12 a;
284 283
285 rv515_vram_get_type(rdev); 284 rv515_vram_get_type(rdev);
286 r100_vram_init_sizes(rdev); 285 r100_vram_init_sizes(rdev);
287 radeon_vram_location(rdev, &rdev->mc, 0); 286 radeon_vram_location(rdev, &rdev->mc, 0);
288 if (!(rdev->flags & RADEON_IS_AGP)) 287 if (!(rdev->flags & RADEON_IS_AGP))
289 radeon_gtt_location(rdev, &rdev->mc); 288 radeon_gtt_location(rdev, &rdev->mc);
290 /* FIXME: we should enforce default clock in case GPU is not in 289 radeon_update_bandwidth_info(rdev);
291 * default setup
292 */
293 a.full = rfixed_const(100);
294 rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk);
295 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
296} 290}
297 291
298uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg) 292uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 86d39cb35fe2..ef946a3af746 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -868,7 +868,6 @@ static void rv770_gpu_init(struct radeon_device *rdev)
868 868
869int rv770_mc_init(struct radeon_device *rdev) 869int rv770_mc_init(struct radeon_device *rdev)
870{ 870{
871 fixed20_12 a;
872 u32 tmp; 871 u32 tmp;
873 int chansize, numchan; 872 int chansize, numchan;
874 873
@@ -912,12 +911,8 @@ int rv770_mc_init(struct radeon_device *rdev)
912 rdev->mc.real_vram_size = rdev->mc.aper_size; 911 rdev->mc.real_vram_size = rdev->mc.aper_size;
913 } 912 }
914 r600_vram_gtt_location(rdev, &rdev->mc); 913 r600_vram_gtt_location(rdev, &rdev->mc);
915 /* FIXME: we should enforce default clock in case GPU is not in 914 radeon_update_bandwidth_info(rdev);
916 * default setup 915
917 */
918 a.full = rfixed_const(100);
919 rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk);
920 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
921 return 0; 916 return 0;
922} 917}
923 918