drm/radeon/kms/r600: clamp vram to aperture size
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 25 Sep 2009 14:06:39 +0000 (10:06 -0400)
committerDave Airlie <airlied@linux.ie>
Fri, 25 Sep 2009 21:48:58 +0000 (07:48 +1000)
r6xx and r7xx was missing this.  We don't support
non-CPU accessible vram yet.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/rv770.c

index 5f42fad19190b7bf45af6b6082fe9ceaa3fe0b7d..c7233ad5dd9438fa944ea62b3607050eb5c950d2 100644 (file)
@@ -380,6 +380,13 @@ int r600_mc_init(struct radeon_device *rdev)
        /* Setup GPU memory space */
        rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE);
        rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
+
+       if (rdev->mc.mc_vram_size > rdev->mc.aper_size)
+               rdev->mc.mc_vram_size = rdev->mc.aper_size;
+
+       if (rdev->mc.real_vram_size > rdev->mc.aper_size)
+               rdev->mc.real_vram_size = rdev->mc.aper_size;
+
        if (rdev->flags & RADEON_IS_AGP) {
                r = radeon_agp_init(rdev);
                if (r)
index b574c73a51092ff16f6878166ea0f55f55de11e5..efca509b24f6cf11f3b4a8512f3b4ac687dccb84 100644 (file)
@@ -801,6 +801,13 @@ int rv770_mc_init(struct radeon_device *rdev)
        /* Setup GPU memory space */
        rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE);
        rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
+
+       if (rdev->mc.mc_vram_size > rdev->mc.aper_size)
+               rdev->mc.mc_vram_size = rdev->mc.aper_size;
+
+       if (rdev->mc.real_vram_size > rdev->mc.aper_size)
+               rdev->mc.real_vram_size = rdev->mc.aper_size;
+
        if (rdev->flags & RADEON_IS_AGP) {
                r = radeon_agp_init(rdev);
                if (r)