aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r100.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-07-21 06:39:30 -0400
committerDave Airlie <airlied@redhat.com>2009-07-29 01:53:25 -0400
commit7a50f01a4ab89d5c05eb2cf62e206ac0bfc61d2c (patch)
treea73ed14d4f0bc51e52fa68563f9a26117ea6fed6 /drivers/gpu/drm/radeon/r100.c
parent664f86590295217b2319edf88830e87b800f6c4a (diff)
drm/radeon/kms: vram sizing on certain r100 chips needs workaround.
If an rn50/r100/m6/m7 GPU has < 64MB RAM, i.e. 8/16/32, the aperture used to calculate the MC_FB_LOCATION needs to be worked out from the CONFIG_APER_SIZE register, and not the actual vram size. TTM VRAM size was also being initialised wrong, use actual vram size to initialise it. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r100.c')
-rw-r--r--drivers/gpu/drm/radeon/r100.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 0e00fef0b84f..05a44896dffb 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -173,8 +173,12 @@ void r100_mc_setup(struct radeon_device *rdev)
173 DRM_ERROR("Failed to register debugfs file for R100 MC !\n"); 173 DRM_ERROR("Failed to register debugfs file for R100 MC !\n");
174 } 174 }
175 /* Write VRAM size in case we are limiting it */ 175 /* Write VRAM size in case we are limiting it */
176 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size); 176 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.real_vram_size);
177 tmp = rdev->mc.vram_location + rdev->mc.vram_size - 1; 177 /* Novell bug 204882 for RN50/M6/M7 with 8/16/32MB VRAM,
178 * if the aperture is 64MB but we have 32MB VRAM
179 * we report only 32MB VRAM but we have to set MC_FB_LOCATION
180 * to 64MB, otherwise the gpu accidentially dies */
181 tmp = rdev->mc.vram_location + rdev->mc.mc_vram_size - 1;
178 tmp = REG_SET(RADEON_MC_FB_TOP, tmp >> 16); 182 tmp = REG_SET(RADEON_MC_FB_TOP, tmp >> 16);
179 tmp |= REG_SET(RADEON_MC_FB_START, rdev->mc.vram_location >> 16); 183 tmp |= REG_SET(RADEON_MC_FB_START, rdev->mc.vram_location >> 16);
180 WREG32(RADEON_MC_FB_LOCATION, tmp); 184 WREG32(RADEON_MC_FB_LOCATION, tmp);
@@ -1447,25 +1451,28 @@ void r100_vram_init_sizes(struct radeon_device *rdev)
1447 uint32_t tom; 1451 uint32_t tom;
1448 /* read NB_TOM to get the amount of ram stolen for the GPU */ 1452 /* read NB_TOM to get the amount of ram stolen for the GPU */
1449 tom = RREG32(RADEON_NB_TOM); 1453 tom = RREG32(RADEON_NB_TOM);
1450 rdev->mc.vram_size = (((tom >> 16) - (tom & 0xffff) + 1) << 16); 1454 rdev->mc.real_vram_size = (((tom >> 16) - (tom & 0xffff) + 1) << 16);
1451 /* for IGPs we need to keep VRAM where it was put by the BIOS */ 1455 /* for IGPs we need to keep VRAM where it was put by the BIOS */
1452 rdev->mc.vram_location = (tom & 0xffff) << 16; 1456 rdev->mc.vram_location = (tom & 0xffff) << 16;
1453 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size); 1457 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.real_vram_size);
1458 rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
1454 } else { 1459 } else {
1455 rdev->mc.vram_size = RREG32(RADEON_CONFIG_MEMSIZE); 1460 rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
1456 /* Some production boards of m6 will report 0 1461 /* Some production boards of m6 will report 0
1457 * if it's 8 MB 1462 * if it's 8 MB
1458 */ 1463 */
1459 if (rdev->mc.vram_size == 0) { 1464 if (rdev->mc.real_vram_size == 0) {
1460 rdev->mc.vram_size = 8192 * 1024; 1465 rdev->mc.real_vram_size = 8192 * 1024;
1461 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size); 1466 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.real_vram_size);
1462 } 1467 }
1463 /* let driver place VRAM */ 1468 /* let driver place VRAM */
1464 rdev->mc.vram_location = 0xFFFFFFFFUL; 1469 rdev->mc.vram_location = 0xFFFFFFFFUL;
1465 /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM - 1470 /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM -
1466 * Novell bug 204882 + along with lots of ubuntu ones */ 1471 * Novell bug 204882 + along with lots of ubuntu ones */
1467 if (config_aper_size > rdev->mc.vram_size) 1472 if (config_aper_size > rdev->mc.real_vram_size)
1468 rdev->mc.vram_size = config_aper_size; 1473 rdev->mc.mc_vram_size = config_aper_size;
1474 else
1475 rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
1469 } 1476 }
1470 1477
1471 /* work out accessible VRAM */ 1478 /* work out accessible VRAM */
@@ -1477,8 +1484,11 @@ void r100_vram_init_sizes(struct radeon_device *rdev)
1477 if (accessible > rdev->mc.aper_size) 1484 if (accessible > rdev->mc.aper_size)
1478 accessible = rdev->mc.aper_size; 1485 accessible = rdev->mc.aper_size;
1479 1486
1480 if (rdev->mc.vram_size > rdev->mc.aper_size) 1487 if (rdev->mc.mc_vram_size > rdev->mc.aper_size)
1481 rdev->mc.vram_size = rdev->mc.aper_size; 1488 rdev->mc.mc_vram_size = rdev->mc.aper_size;
1489
1490 if (rdev->mc.real_vram_size > rdev->mc.aper_size)
1491 rdev->mc.real_vram_size = rdev->mc.aper_size;
1482} 1492}
1483 1493
1484void r100_vram_info(struct radeon_device *rdev) 1494void r100_vram_info(struct radeon_device *rdev)