aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-07-09 01:04:18 -0400
committerDave Airlie <airlied@redhat.com>2009-07-15 03:13:07 -0400
commit3e43d82125952826202a8cd20ba84a66f3ff8808 (patch)
treeb6358e40dc857b0917d7d76d8a90ff999f2860d8 /drivers/gpu
parent4162338a1dab388474d4115289d1d7071623f04d (diff)
drm/radeon/kms: respect TOM on rs100->rs480 IGP variants.
Normally we are free to place VRAM where we want in the GPUs memory address space, however on IGP chips the VRAM is actual RAM, and no special translation or aperture is used inside the GPU MC. So when you move the VRAM aperture away from the TOM register, you actually move it into main memory and can trash things quite badly. This commit makes the code respect the TOM location for MC_FB_LOCATION. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/r100.c5
-rw-r--r--drivers/gpu/drm/radeon/rs400.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 1b23106f9552..a3db56bb013d 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -215,7 +215,6 @@ int r100_mc_init(struct radeon_device *rdev)
215 r100_pci_gart_disable(rdev); 215 r100_pci_gart_disable(rdev);
216 216
217 /* Setup GPU memory space */ 217 /* Setup GPU memory space */
218 rdev->mc.vram_location = 0xFFFFFFFFUL;
219 rdev->mc.gtt_location = 0xFFFFFFFFUL; 218 rdev->mc.gtt_location = 0xFFFFFFFFUL;
220 if (rdev->flags & RADEON_IS_AGP) { 219 if (rdev->flags & RADEON_IS_AGP) {
221 r = radeon_agp_init(rdev); 220 r = radeon_agp_init(rdev);
@@ -1265,6 +1264,8 @@ void r100_vram_info(struct radeon_device *rdev)
1265 /* read NB_TOM to get the amount of ram stolen for the GPU */ 1264 /* read NB_TOM to get the amount of ram stolen for the GPU */
1266 tom = RREG32(RADEON_NB_TOM); 1265 tom = RREG32(RADEON_NB_TOM);
1267 rdev->mc.vram_size = (((tom >> 16) - (tom & 0xffff) + 1) << 16); 1266 rdev->mc.vram_size = (((tom >> 16) - (tom & 0xffff) + 1) << 16);
1267 /* for IGPs we need to keep VRAM where it was put by the BIOS */
1268 rdev->mc.vram_location = (tom & 0xffff) << 16;
1268 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size); 1269 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size);
1269 } else { 1270 } else {
1270 rdev->mc.vram_size = RREG32(RADEON_CONFIG_MEMSIZE); 1271 rdev->mc.vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
@@ -1275,6 +1276,8 @@ void r100_vram_info(struct radeon_device *rdev)
1275 rdev->mc.vram_size = 8192 * 1024; 1276 rdev->mc.vram_size = 8192 * 1024;
1276 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size); 1277 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size);
1277 } 1278 }
1279 /* let driver place VRAM */
1280 rdev->mc.vram_location = 0xFFFFFFFFUL;
1278 } 1281 }
1279 1282
1280 rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0); 1283 rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index 3275de4b6e3b..a18d053065c0 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -235,7 +235,6 @@ int rs400_mc_init(struct radeon_device *rdev)
235 rdev->mc.gtt_location = rdev->mc.vram_size; 235 rdev->mc.gtt_location = rdev->mc.vram_size;
236 rdev->mc.gtt_location += (rdev->mc.gtt_size - 1); 236 rdev->mc.gtt_location += (rdev->mc.gtt_size - 1);
237 rdev->mc.gtt_location &= ~(rdev->mc.gtt_size - 1); 237 rdev->mc.gtt_location &= ~(rdev->mc.gtt_size - 1);
238 rdev->mc.vram_location = 0xFFFFFFFFUL;
239 r = radeon_mc_setup(rdev); 238 r = radeon_mc_setup(rdev);
240 if (r) { 239 if (r) {
241 return r; 240 return r;
@@ -305,7 +304,10 @@ void rs400_vram_info(struct radeon_device *rdev)
305 rdev->mc.vram_size = (((tom >> 16) - (tom & 0xffff) + 1) << 16); 304 rdev->mc.vram_size = (((tom >> 16) - (tom & 0xffff) + 1) << 16);
306 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size); 305 WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size);
307 306
308 /* Could aper size report 0 ? */ 307 /* RS480 IGPs don't seem to translate to main RAM, they
308 * just reserve and scan out of it. So setting VRAM location
309 * to say 0, will actually trash the OS. */
310 rdev->mc.vram_location = (tom & 0xffff) << 16;
309 rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0); 311 rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
310 rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0); 312 rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
311} 313}