aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSamuel Li <samuel.li@amd.com>2013-04-08 17:25:47 -0400
committerAlex Deucher <alexander.deucher@amd.com>2013-04-09 10:31:31 -0400
commita0a53aa8c7b491a43e2ef66786f9511bae8cbc35 (patch)
treeba99c19682038634fece39989fef348baaebab1b /drivers/gpu
parent7c1c7c18fc752b2a1d07597286467ef186312463 (diff)
drm/radeon: Use direct mapping for fast fb access on RS690
This patch allows the CPU to map the stolen vram segment directly rather than going through the PCI BAR. This significantly improves performance for certain workloads with a properly patched ddx. Use radeon.fastfb=1 to enable it (disabled by default). Currently only supported on RS690, but support for RS780/880 and newer APUs may be added eventually. Signed-off-by: Samuel Li <samuel.li@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/radeon.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c4
-rw-r--r--drivers/gpu/drm/radeon/rs690.c23
-rw-r--r--drivers/gpu/drm/radeon/rs690d.h3
6 files changed, 40 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 8bd875304441..730d3359af60 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -95,6 +95,7 @@ extern int radeon_hw_i2c;
95extern int radeon_pcie_gen2; 95extern int radeon_pcie_gen2;
96extern int radeon_msi; 96extern int radeon_msi;
97extern int radeon_lockup_timeout; 97extern int radeon_lockup_timeout;
98extern int radeon_fastfb;
98 99
99/* 100/*
100 * Copy from radeon_drv.h so we don't have to include both and have conflicting 101 * Copy from radeon_drv.h so we don't have to include both and have conflicting
@@ -1616,6 +1617,7 @@ struct radeon_device {
1616 bool suspend; 1617 bool suspend;
1617 bool need_dma32; 1618 bool need_dma32;
1618 bool accel_working; 1619 bool accel_working;
1620 bool fastfb_working; /* IGP feature*/
1619 struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES]; 1621 struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES];
1620 const struct firmware *me_fw; /* all family ME firmware */ 1622 const struct firmware *me_fw; /* all family ME firmware */
1621 const struct firmware *pfp_fw; /* r6/700 PFP firmware */ 1623 const struct firmware *pfp_fw; /* r6/700 PFP firmware */
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 66a7f0fd9620..b500bbc3e411 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -71,9 +71,10 @@
71 * 2.28.0 - r600-eg: Add MEM_WRITE packet support 71 * 2.28.0 - r600-eg: Add MEM_WRITE packet support
72 * 2.29.0 - R500 FP16 color clear registers 72 * 2.29.0 - R500 FP16 color clear registers
73 * 2.30.0 - fix for FMASK texturing 73 * 2.30.0 - fix for FMASK texturing
74 * 2.31.0 - Add fastfb support for rs690
74 */ 75 */
75#define KMS_DRIVER_MAJOR 2 76#define KMS_DRIVER_MAJOR 2
76#define KMS_DRIVER_MINOR 30 77#define KMS_DRIVER_MINOR 31
77#define KMS_DRIVER_PATCHLEVEL 0 78#define KMS_DRIVER_PATCHLEVEL 0
78int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 79int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
79int radeon_driver_unload_kms(struct drm_device *dev); 80int radeon_driver_unload_kms(struct drm_device *dev);
@@ -160,6 +161,7 @@ int radeon_hw_i2c = 0;
160int radeon_pcie_gen2 = -1; 161int radeon_pcie_gen2 = -1;
161int radeon_msi = -1; 162int radeon_msi = -1;
162int radeon_lockup_timeout = 10000; 163int radeon_lockup_timeout = 10000;
164int radeon_fastfb = 0;
163 165
164MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); 166MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
165module_param_named(no_wb, radeon_no_wb, int, 0444); 167module_param_named(no_wb, radeon_no_wb, int, 0444);
@@ -212,6 +214,9 @@ module_param_named(msi, radeon_msi, int, 0444);
212MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (defaul 10000 = 10 seconds, 0 = disable)"); 214MODULE_PARM_DESC(lockup_timeout, "GPU lockup timeout in ms (defaul 10000 = 10 seconds, 0 = disable)");
213module_param_named(lockup_timeout, radeon_lockup_timeout, int, 0444); 215module_param_named(lockup_timeout, radeon_lockup_timeout, int, 0444);
214 216
217MODULE_PARM_DESC(fastfb, "Direct FB access for IGP chips (0 = disable, 1 = enable)");
218module_param_named(fastfb, radeon_fastfb, int, 0444);
219
215static struct pci_device_id pciidlist[] = { 220static struct pci_device_id pciidlist[] = {
216 radeon_PCI_IDS 221 radeon_PCI_IDS
217}; 222};
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index c75cb2c6ba71..f5464482dee8 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -376,6 +376,9 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
376 else 376 else
377 return -EINVAL; 377 return -EINVAL;
378 break; 378 break;
379 case RADEON_INFO_FASTFB_WORKING:
380 value = rdev->fastfb_working;
381 break;
379 default: 382 default:
380 DRM_DEBUG_KMS("Invalid request %d\n", info->request); 383 DRM_DEBUG_KMS("Invalid request %d\n", info->request);
381 return -EINVAL; 384 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index d3aface2d12d..58e026afec17 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -321,8 +321,10 @@ void radeon_bo_force_delete(struct radeon_device *rdev)
321int radeon_bo_init(struct radeon_device *rdev) 321int radeon_bo_init(struct radeon_device *rdev)
322{ 322{
323 /* Add an MTRR for the VRAM */ 323 /* Add an MTRR for the VRAM */
324 rdev->mc.vram_mtrr = mtrr_add(rdev->mc.aper_base, rdev->mc.aper_size, 324 if (!rdev->fastfb_working) {
325 rdev->mc.vram_mtrr = mtrr_add(rdev->mc.aper_base, rdev->mc.aper_size,
325 MTRR_TYPE_WRCOMB, 1); 326 MTRR_TYPE_WRCOMB, 1);
327 }
326 DRM_INFO("Detected VRAM RAM=%lluM, BAR=%lluM\n", 328 DRM_INFO("Detected VRAM RAM=%lluM, BAR=%lluM\n",
327 rdev->mc.mc_vram_size >> 20, 329 rdev->mc.mc_vram_size >> 20,
328 (unsigned long long)rdev->mc.aper_size >> 20); 330 (unsigned long long)rdev->mc.aper_size >> 20);
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 5706d2ac75ab..ab4c86cfd552 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -148,6 +148,8 @@ void rs690_pm_info(struct radeon_device *rdev)
148static void rs690_mc_init(struct radeon_device *rdev) 148static void rs690_mc_init(struct radeon_device *rdev)
149{ 149{
150 u64 base; 150 u64 base;
151 uint32_t h_addr, l_addr;
152 unsigned long long k8_addr;
151 153
152 rs400_gart_adjust_size(rdev); 154 rs400_gart_adjust_size(rdev);
153 rdev->mc.vram_is_ddr = true; 155 rdev->mc.vram_is_ddr = true;
@@ -160,6 +162,27 @@ static void rs690_mc_init(struct radeon_device *rdev)
160 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); 162 base = RREG32_MC(R_000100_MCCFG_FB_LOCATION);
161 base = G_000100_MC_FB_START(base) << 16; 163 base = G_000100_MC_FB_START(base) << 16;
162 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); 164 rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev);
165
166 /* Use K8 direct mapping for fast fb access. */
167 rdev->fastfb_working = false;
168 h_addr = G_00005F_K8_ADDR_EXT(RREG32_MC(R_00005F_MC_MISC_UMA_CNTL));
169 l_addr = RREG32_MC(R_00001E_K8_FB_LOCATION);
170 k8_addr = ((unsigned long long)h_addr) << 32 | l_addr;
171#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
172 if (k8_addr + rdev->mc.visible_vram_size < 0x100000000ULL)
173#endif
174 {
175 /* FastFB shall be used with UMA memory. Here it is simply disabled when sideport
176 * memory is present.
177 */
178 if (rdev->mc.igp_sideport_enabled == false && radeon_fastfb == 1) {
179 DRM_INFO("Direct mapping: aper base at 0x%llx, replaced by direct mapping base 0x%llx.\n",
180 (unsigned long long)rdev->mc.aper_base, k8_addr);
181 rdev->mc.aper_base = (resource_size_t)k8_addr;
182 rdev->fastfb_working = true;
183 }
184 }
185
163 rs690_pm_info(rdev); 186 rs690_pm_info(rdev);
164 radeon_vram_location(rdev, &rdev->mc, base); 187 radeon_vram_location(rdev, &rdev->mc, base);
165 rdev->mc.gtt_base_align = rdev->mc.gtt_size - 1; 188 rdev->mc.gtt_base_align = rdev->mc.gtt_size - 1;
diff --git a/drivers/gpu/drm/radeon/rs690d.h b/drivers/gpu/drm/radeon/rs690d.h
index 36e6398a98ae..8af3ccf20cc0 100644
--- a/drivers/gpu/drm/radeon/rs690d.h
+++ b/drivers/gpu/drm/radeon/rs690d.h
@@ -29,6 +29,9 @@
29#define __RS690D_H__ 29#define __RS690D_H__
30 30
31/* Registers */ 31/* Registers */
32#define R_00001E_K8_FB_LOCATION 0x00001E
33#define R_00005F_MC_MISC_UMA_CNTL 0x00005F
34#define G_00005F_K8_ADDR_EXT(x) (((x) >> 0) & 0xFF)
32#define R_000078_MC_INDEX 0x000078 35#define R_000078_MC_INDEX 0x000078
33#define S_000078_MC_IND_ADDR(x) (((x) & 0x1FF) << 0) 36#define S_000078_MC_IND_ADDR(x) (((x) & 0x1FF) << 0)
34#define G_000078_MC_IND_ADDR(x) (((x) >> 0) & 0x1FF) 37#define G_000078_MC_IND_ADDR(x) (((x) >> 0) & 0x1FF)