aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/rv770.c
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-02-17 16:54:29 -0500
committerDave Airlie <airlied@redhat.com>2010-02-17 23:49:35 -0500
commitd594e46ace22afa1621254f6f669e65430048153 (patch)
treebefd5b54ce1b8284acc4ee450d085a7d2c7b01fd /drivers/gpu/drm/radeon/rv770.c
parent44ca7478d46aaad488d916f7262253e000ee60f9 (diff)
drm/radeon/kms: simplify memory controller setup V2
Get rid of _location and use _start/_end also simplify the computation of vram_start|end & gtt_start|end. For R1XX-R2XX we place VRAM at the same address of PCI aperture, those GPU shouldn't have much memory and seems to behave better when setup that way. For R3XX and newer we place VRAM at 0. For R6XX-R7XX AGP we place VRAM before or after AGP aperture this might limit to limit the VRAM size but it's very unlikely. For IGP we don't change the VRAM placement. Tested on (compiz,quake3,suspend/resume): PCI/PCIE:RV280,R420,RV515,RV570,RV610,RV710 AGP:RV100,RV280,R420,RV350,RV620(RPB*),RV730 IGP:RS480(RPB*),RS690,RS780(RPB*),RS880 RPB: resume previously broken V2 correct commit message to reflect more accurately the bug and move VRAM placement to 0 for most of the GPU to avoid limiting VRAM. Signed-off-by: Jerome Glisse <jglisse@redhat.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.c41
1 files changed, 5 insertions, 36 deletions
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 6f1f4abbe88c..323fa6be5082 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -820,45 +820,12 @@ int rv770_mc_init(struct radeon_device *rdev)
820 /* Setup GPU memory space */ 820 /* Setup GPU memory space */
821 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); 821 rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE);
822 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); 822 rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE);
823 823 /* FIXME remove this once we support unmappable VRAM */
824 if (rdev->mc.mc_vram_size > rdev->mc.aper_size) 824 if (rdev->mc.mc_vram_size > rdev->mc.aper_size) {
825 rdev->mc.mc_vram_size = rdev->mc.aper_size; 825 rdev->mc.mc_vram_size = rdev->mc.aper_size;
826
827 if (rdev->mc.real_vram_size > rdev->mc.aper_size)
828 rdev->mc.real_vram_size = rdev->mc.aper_size; 826 rdev->mc.real_vram_size = rdev->mc.aper_size;
829
830 if (rdev->flags & RADEON_IS_AGP) {
831 /* gtt_size is setup by radeon_agp_init */
832 rdev->mc.gtt_location = rdev->mc.agp_base;
833 tmp = 0xFFFFFFFFUL - rdev->mc.agp_base - rdev->mc.gtt_size;
834 /* Try to put vram before or after AGP because we
835 * we want SYSTEM_APERTURE to cover both VRAM and
836 * AGP so that GPU can catch out of VRAM/AGP access
837 */
838 if (rdev->mc.gtt_location > rdev->mc.mc_vram_size) {
839 /* Enought place before */
840 rdev->mc.vram_location = rdev->mc.gtt_location -
841 rdev->mc.mc_vram_size;
842 } else if (tmp > rdev->mc.mc_vram_size) {
843 /* Enought place after */
844 rdev->mc.vram_location = rdev->mc.gtt_location +
845 rdev->mc.gtt_size;
846 } else {
847 /* Try to setup VRAM then AGP might not
848 * not work on some card
849 */
850 rdev->mc.vram_location = 0x00000000UL;
851 rdev->mc.gtt_location = rdev->mc.mc_vram_size;
852 }
853 } else {
854 rdev->mc.vram_location = 0x00000000UL;
855 rdev->mc.gtt_location = rdev->mc.mc_vram_size;
856 rdev->mc.gtt_size = radeon_gart_size * 1024 * 1024;
857 } 827 }
858 rdev->mc.vram_start = rdev->mc.vram_location; 828 r600_vram_gtt_location(rdev, &rdev->mc);
859 rdev->mc.vram_end = rdev->mc.vram_location + rdev->mc.mc_vram_size - 1;
860 rdev->mc.gtt_start = rdev->mc.gtt_location;
861 rdev->mc.gtt_end = rdev->mc.gtt_location + rdev->mc.gtt_size - 1;
862 /* FIXME: we should enforce default clock in case GPU is not in 829 /* FIXME: we should enforce default clock in case GPU is not in
863 * default setup 830 * default setup
864 */ 831 */
@@ -867,6 +834,7 @@ int rv770_mc_init(struct radeon_device *rdev)
867 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); 834 rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a);
868 return 0; 835 return 0;
869} 836}
837
870int rv770_gpu_reset(struct radeon_device *rdev) 838int rv770_gpu_reset(struct radeon_device *rdev)
871{ 839{
872 /* FIXME: implement any rv770 specific bits */ 840 /* FIXME: implement any rv770 specific bits */
@@ -1042,6 +1010,7 @@ int rv770_init(struct radeon_device *rdev)
1042 r = radeon_fence_driver_init(rdev); 1010 r = radeon_fence_driver_init(rdev);
1043 if (r) 1011 if (r)
1044 return r; 1012 return r;
1013 /* initialize AGP */
1045 if (rdev->flags & RADEON_IS_AGP) { 1014 if (rdev->flags & RADEON_IS_AGP) {
1046 r = radeon_agp_init(rdev); 1015 r = radeon_agp_init(rdev);
1047 if (r) 1016 if (r)