aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/rv770.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-11-22 17:56:26 -0500
committerDave Airlie <airlied@redhat.com>2010-11-22 18:23:23 -0500
commit0ef0c1f7349e782f6c79cb7e4bf8a4c3ce3371c6 (patch)
treeda4bacbd97cd8e704619adaa08c6929c53dc2d07 /drivers/gpu/drm/radeon/rv770.c
parent4339c442c0736db42329b68602308e95bcc75a30 (diff)
drm/radeon/kms: move r7xx/evergreen to its own vram_gtt setup function
MC_VM_FB_LOCATION is at a different offset between r6xx and r7xx/evergreen. The location is needed for vram setup on fusion chips. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/rv770.c')
-rw-r--r--drivers/gpu/drm/radeon/rv770.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 24ebd0879c4b..c23349a46fd2 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -1001,6 +1001,48 @@ static void rv770_vram_scratch_fini(struct radeon_device *rdev)
1001 radeon_bo_unref(&rdev->vram_scratch.robj); 1001 radeon_bo_unref(&rdev->vram_scratch.robj);
1002} 1002}
1003 1003
1004void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
1005{
1006 u64 size_bf, size_af;
1007
1008 if (mc->mc_vram_size > 0xE0000000) {
1009 /* leave room for at least 512M GTT */
1010 dev_warn(rdev->dev, "limiting VRAM\n");
1011 mc->real_vram_size = 0xE0000000;
1012 mc->mc_vram_size = 0xE0000000;
1013 }
1014 if (rdev->flags & RADEON_IS_AGP) {
1015 size_bf = mc->gtt_start;
1016 size_af = 0xFFFFFFFF - mc->gtt_end + 1;
1017 if (size_bf > size_af) {
1018 if (mc->mc_vram_size > size_bf) {
1019 dev_warn(rdev->dev, "limiting VRAM\n");
1020 mc->real_vram_size = size_bf;
1021 mc->mc_vram_size = size_bf;
1022 }
1023 mc->vram_start = mc->gtt_start - mc->mc_vram_size;
1024 } else {
1025 if (mc->mc_vram_size > size_af) {
1026 dev_warn(rdev->dev, "limiting VRAM\n");
1027 mc->real_vram_size = size_af;
1028 mc->mc_vram_size = size_af;
1029 }
1030 mc->vram_start = mc->gtt_end;
1031 }
1032 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
1033 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n",
1034 mc->mc_vram_size >> 20, mc->vram_start,
1035 mc->vram_end, mc->real_vram_size >> 20);
1036 } else {
1037 u64 base = 0;
1038 if (rdev->flags & RADEON_IS_IGP)
1039 base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24;
1040 radeon_vram_location(rdev, &rdev->mc, base);
1041 rdev->mc.gtt_base_align = 0;
1042 radeon_gtt_location(rdev, mc);
1043 }
1044}
1045
1004int rv770_mc_init(struct radeon_device *rdev) 1046int rv770_mc_init(struct radeon_device *rdev)
1005{ 1047{
1006 u32 tmp; 1048 u32 tmp;
@@ -1041,7 +1083,7 @@ int rv770_mc_init(struct radeon_device *rdev)
1041 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); 1083 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
1042 rdev->mc.visible_vram_size = rdev->mc.aper_size; 1084 rdev->mc.visible_vram_size = rdev->mc.aper_size;
1043 rdev->mc.active_vram_size = rdev->mc.visible_vram_size; 1085 rdev->mc.active_vram_size = rdev->mc.visible_vram_size;
1044 r600_vram_gtt_location(rdev, &rdev->mc); 1086 r700_vram_gtt_location(rdev, &rdev->mc);
1045 radeon_update_bandwidth_info(rdev); 1087 radeon_update_bandwidth_info(rdev);
1046 1088
1047 return 0; 1089 return 0;