diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-01-05 11:27:29 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-01-07 22:08:56 -0500 |
commit | 06b6476d6b291473d0928ed242158a001d50c0f0 (patch) | |
tree | a3ffaddfc117b839073ac5c8c52fdf9415a7947e /drivers/gpu/drm/radeon | |
parent | fc9a89f97e532152ae614d5ce717b81c8f8b0e91 (diff) |
drm/radeon/kms: detect sideport memory on IGP chips
This detects if the sideport memory is enabled and
if it is VRAM is evicted on suspend/resume.
This should fix s/r issues on some IGPs.
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/r600.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 37 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_combios.c | 14 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_object.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs400.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs600.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/rs690.c | 1 |
8 files changed, 64 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 5c6058c6ddde..921926f3d1f3 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -726,6 +726,10 @@ int r600_mc_init(struct radeon_device *rdev) | |||
726 | a.full = rfixed_const(100); | 726 | a.full = rfixed_const(100); |
727 | rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); | 727 | rdev->pm.sclk.full = rfixed_const(rdev->clock.default_sclk); |
728 | rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); | 728 | rdev->pm.sclk.full = rfixed_div(rdev->pm.sclk, a); |
729 | |||
730 | if (rdev->flags & RADEON_IS_IGP) | ||
731 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
732 | |||
729 | return 0; | 733 | return 0; |
730 | } | 734 | } |
731 | 735 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 53b55608102b..a7e349dc4b97 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -319,10 +319,12 @@ struct radeon_mc { | |||
319 | u64 real_vram_size; | 319 | u64 real_vram_size; |
320 | int vram_mtrr; | 320 | int vram_mtrr; |
321 | bool vram_is_ddr; | 321 | bool vram_is_ddr; |
322 | bool igp_sideport_enabled; | ||
322 | }; | 323 | }; |
323 | 324 | ||
324 | int radeon_mc_setup(struct radeon_device *rdev); | 325 | int radeon_mc_setup(struct radeon_device *rdev); |
325 | 326 | bool radeon_combios_sideport_present(struct radeon_device *rdev); | |
327 | bool radeon_atombios_sideport_present(struct radeon_device *rdev); | ||
326 | 328 | ||
327 | /* | 329 | /* |
328 | * GPU scratch registers structures, functions & helpers | 330 | * GPU scratch registers structures, functions & helpers |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 183403540113..fa82ca74324e 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -938,6 +938,43 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
938 | return false; | 938 | return false; |
939 | } | 939 | } |
940 | 940 | ||
941 | union igp_info { | ||
942 | struct _ATOM_INTEGRATED_SYSTEM_INFO info; | ||
943 | struct _ATOM_INTEGRATED_SYSTEM_INFO_V2 info_2; | ||
944 | }; | ||
945 | |||
946 | bool radeon_atombios_sideport_present(struct radeon_device *rdev) | ||
947 | { | ||
948 | struct radeon_mode_info *mode_info = &rdev->mode_info; | ||
949 | int index = GetIndexIntoMasterTable(DATA, IntegratedSystemInfo); | ||
950 | union igp_info *igp_info; | ||
951 | u8 frev, crev; | ||
952 | u16 data_offset; | ||
953 | |||
954 | atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, | ||
955 | &crev, &data_offset); | ||
956 | |||
957 | igp_info = (union igp_info *)(mode_info->atom_context->bios + | ||
958 | data_offset); | ||
959 | |||
960 | if (igp_info) { | ||
961 | switch (crev) { | ||
962 | case 1: | ||
963 | if (igp_info->info.ucMemoryType & 0xf0) | ||
964 | return true; | ||
965 | break; | ||
966 | case 2: | ||
967 | if (igp_info->info_2.ucMemoryType & 0x0f) | ||
968 | return true; | ||
969 | break; | ||
970 | default: | ||
971 | DRM_ERROR("Unsupported IGP table: %d %d\n", frev, crev); | ||
972 | break; | ||
973 | } | ||
974 | } | ||
975 | return false; | ||
976 | } | ||
977 | |||
941 | bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, | 978 | bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, |
942 | struct radeon_encoder_int_tmds *tmds) | 979 | struct radeon_encoder_int_tmds *tmds) |
943 | { | 980 | { |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 58f342659cc7..7914455c96ca 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -595,6 +595,20 @@ bool radeon_combios_get_clock_info(struct drm_device *dev) | |||
595 | return false; | 595 | return false; |
596 | } | 596 | } |
597 | 597 | ||
598 | bool radeon_combios_sideport_present(struct radeon_device *rdev) | ||
599 | { | ||
600 | struct drm_device *dev = rdev->ddev; | ||
601 | u16 igp_info; | ||
602 | |||
603 | igp_info = combios_get_table_offset(dev, COMBIOS_INTEGRATED_SYSTEM_INFO_TABLE); | ||
604 | |||
605 | if (igp_info) { | ||
606 | if (RBIOS16(igp_info + 0x4)) | ||
607 | return true; | ||
608 | } | ||
609 | return false; | ||
610 | } | ||
611 | |||
598 | static const uint32_t default_primarydac_adj[CHIP_LAST] = { | 612 | static const uint32_t default_primarydac_adj[CHIP_LAST] = { |
599 | 0x00000808, /* r100 */ | 613 | 0x00000808, /* r100 */ |
600 | 0x00000808, /* rv100 */ | 614 | 0x00000808, /* rv100 */ |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index d9ffe1f56e8f..4e636de877b2 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -221,8 +221,9 @@ int radeon_bo_unpin(struct radeon_bo *bo) | |||
221 | int radeon_bo_evict_vram(struct radeon_device *rdev) | 221 | int radeon_bo_evict_vram(struct radeon_device *rdev) |
222 | { | 222 | { |
223 | if (rdev->flags & RADEON_IS_IGP) { | 223 | if (rdev->flags & RADEON_IS_IGP) { |
224 | /* Useless to evict on IGP chips */ | 224 | if (rdev->mc.igp_sideport_enabled == false) |
225 | return 0; | 225 | /* Useless to evict on IGP chips */ |
226 | return 0; | ||
226 | } | 227 | } |
227 | return ttm_bo_evict_mm(&rdev->mman.bdev, TTM_PL_VRAM); | 228 | return ttm_bo_evict_mm(&rdev->mman.bdev, TTM_PL_VRAM); |
228 | } | 229 | } |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 368415df5f3a..bf7b3cf80ed7 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -356,6 +356,7 @@ static int rs400_mc_init(struct radeon_device *rdev) | |||
356 | rdev->mc.vram_location = G_00015C_MC_FB_START(tmp) << 16; | 356 | rdev->mc.vram_location = G_00015C_MC_FB_START(tmp) << 16; |
357 | rdev->mc.gtt_location = 0xFFFFFFFFUL; | 357 | rdev->mc.gtt_location = 0xFFFFFFFFUL; |
358 | r = radeon_mc_setup(rdev); | 358 | r = radeon_mc_setup(rdev); |
359 | rdev->mc.igp_sideport_enabled = radeon_combios_sideport_present(rdev); | ||
359 | if (r) | 360 | if (r) |
360 | return r; | 361 | return r; |
361 | return 0; | 362 | return 0; |
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 4245218e954f..19258943a370 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -56,6 +56,7 @@ int rs600_mc_init(struct radeon_device *rdev) | |||
56 | rdev->mc.vram_location = G_000004_MC_FB_START(tmp) << 16; | 56 | rdev->mc.vram_location = G_000004_MC_FB_START(tmp) << 16; |
57 | rdev->mc.gtt_location = 0xffffffffUL; | 57 | rdev->mc.gtt_location = 0xffffffffUL; |
58 | r = radeon_mc_setup(rdev); | 58 | r = radeon_mc_setup(rdev); |
59 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
59 | if (r) | 60 | if (r) |
60 | return r; | 61 | return r; |
61 | return 0; | 62 | return 0; |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 1e22f52d6039..42f27205a597 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -172,6 +172,7 @@ static int rs690_mc_init(struct radeon_device *rdev) | |||
172 | rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16; | 172 | rdev->mc.vram_location = G_000100_MC_FB_START(tmp) << 16; |
173 | rdev->mc.gtt_location = 0xFFFFFFFFUL; | 173 | rdev->mc.gtt_location = 0xFFFFFFFFUL; |
174 | r = radeon_mc_setup(rdev); | 174 | r = radeon_mc_setup(rdev); |
175 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | ||
175 | if (r) | 176 | if (r) |
176 | return r; | 177 | return r; |
177 | return 0; | 178 | return 0; |