diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/rv770.c')
-rw-r--r-- | drivers/gpu/drm/radeon/rv770.c | 44 |
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 | ||
1004 | void 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 | |||
1004 | int rv770_mc_init(struct radeon_device *rdev) | 1046 | int 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; |