]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/radeon/kms: respect TOM on rs100->rs480 IGP variants.
authorDave Airlie <airlied@redhat.com>
Thu, 9 Jul 2009 05:04:18 +0000 (15:04 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 15 Jul 2009 07:13:07 +0000 (17:13 +1000)
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>
drivers/gpu/drm/radeon/r100.c
drivers/gpu/drm/radeon/rs400.c

index 1b23106f95525a83d9fb5b01049f3036088a3ddf..a3db56bb013da80f140a59e126acec4eea69c983 100644 (file)
@@ -215,7 +215,6 @@ int r100_mc_init(struct radeon_device *rdev)
        r100_pci_gart_disable(rdev);
 
        /* Setup GPU memory space */
-       rdev->mc.vram_location = 0xFFFFFFFFUL;
        rdev->mc.gtt_location = 0xFFFFFFFFUL;
        if (rdev->flags & RADEON_IS_AGP) {
                r = radeon_agp_init(rdev);
@@ -1265,6 +1264,8 @@ void r100_vram_info(struct radeon_device *rdev)
                /* read NB_TOM to get the amount of ram stolen for the GPU */
                tom = RREG32(RADEON_NB_TOM);
                rdev->mc.vram_size = (((tom >> 16) - (tom & 0xffff) + 1) << 16);
+               /* for IGPs we need to keep VRAM where it was put by the BIOS */
+               rdev->mc.vram_location = (tom & 0xffff) << 16;
                WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size);
        } else {
                rdev->mc.vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
@@ -1275,6 +1276,8 @@ void r100_vram_info(struct radeon_device *rdev)
                        rdev->mc.vram_size = 8192 * 1024;
                        WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size);
                }
+               /* let driver place VRAM */
+               rdev->mc.vram_location = 0xFFFFFFFFUL;
        }
 
        rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
index 3275de4b6e3b707f1c3fc87b79a0bd8b0f0f10ea..a18d053065c0877b732824e9f1a82b04bbd4d0c5 100644 (file)
@@ -235,7 +235,6 @@ int rs400_mc_init(struct radeon_device *rdev)
        rdev->mc.gtt_location = rdev->mc.vram_size;
        rdev->mc.gtt_location += (rdev->mc.gtt_size - 1);
        rdev->mc.gtt_location &= ~(rdev->mc.gtt_size - 1);
-       rdev->mc.vram_location = 0xFFFFFFFFUL;
        r = radeon_mc_setup(rdev);
        if (r) {
                return r;
@@ -305,7 +304,10 @@ void rs400_vram_info(struct radeon_device *rdev)
        rdev->mc.vram_size = (((tom >> 16) - (tom & 0xffff) + 1) << 16);
        WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.vram_size);
 
-       /* Could aper size report 0 ? */
+       /* RS480 IGPs don't seem to translate to main RAM, they
+        * just reserve and scan out of it. So setting VRAM location
+        * to say 0, will actually trash the OS. */
+       rdev->mc.vram_location = (tom & 0xffff) << 16;
        rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
        rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
 }