drm/radeon/kms: rs6xx/rs740: clamp vram to aperture size
authorAlex Deucher <alexdeucher@gmail.com>
Thu, 3 Dec 2009 21:28:02 +0000 (16:28 -0500)
committerDave Airlie <airlied@redhat.com>
Fri, 4 Dec 2009 00:32:35 +0000 (10:32 +1000)
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/rs600.c
drivers/gpu/drm/radeon/rs690.c

index 00bc71fe98d15ae8c11f3708e4be1de7977ac2a2..c4bdfaf9b54cb9e95638bf7ec876d3ad2611b990 100644 (file)
@@ -306,9 +306,7 @@ int rs600_mc_wait_for_idle(struct radeon_device *rdev)
 
 void rs600_gpu_init(struct radeon_device *rdev)
 {
-       /* FIXME: HDP same place on rs600 ? */
        r100_hdp_reset(rdev);
-       /* FIXME: is this correct ? */
        r420_pipes_init(rdev);
        /* Wait for mc idle */
        if (rs600_mc_wait_for_idle(rdev))
@@ -317,7 +315,6 @@ void rs600_gpu_init(struct radeon_device *rdev)
 
 void rs600_vram_info(struct radeon_device *rdev)
 {
-       /* FIXME: to do or is these values sane ? */
        rdev->mc.vram_is_ddr = true;
        rdev->mc.vram_width = 128;
 
@@ -326,6 +323,12 @@ void rs600_vram_info(struct radeon_device *rdev)
 
        rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
        rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
+
+       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;
 }
 
 void rs600_bandwidth_update(struct radeon_device *rdev)
index 81b8efcac4e86ce4389683e637e2aa74ea8e2029..30913c3b5ba1fdafd5d820ccc7471ba4424cde6c 100644 (file)
@@ -134,7 +134,7 @@ void rs690_vram_info(struct radeon_device *rdev)
        fixed20_12 a;
 
        rs400_gart_adjust_size(rdev);
-       /* DDR for all card after R300 & IGP */
+
        rdev->mc.vram_is_ddr = true;
        rdev->mc.vram_width = 128;
 
@@ -143,6 +143,13 @@ void rs690_vram_info(struct radeon_device *rdev)
 
        rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
        rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
+
+       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;
+
        rs690_pm_info(rdev);
        /* FIXME: we should enforce default clock in case GPU is not in
         * default setup