aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-08-17 17:49:27 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-08-30 17:54:30 -0400
commit95844d20ae024b5d553c9923a0d3145c3956bf69 (patch)
treea2b95c430ed82db0b2085379c451499c5638b698 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
parent15f441db96adcac1dc86196b301f4204452bfe0c (diff)
drm/amdgpu: throttle buffer migrations at CS using a fixed MBps limit (v2)
The old mechanism used a per-submission limit that didn't take previous submissions within the same time frame into account. It also filled VRAM slowly when VRAM usage dropped due to a big eviction or buffer deallocation. This new method establishes a configurable MBps limit that is obeyed when VRAM usage is very high. When VRAM usage is not very high, it gives the driver the freedom to fill it quickly. The result is more consistent performance. It can't keep the BO move rate low if lots of evictions are happening due to VRAM fragmentation, or if a big buffer is being migrated. The amdgpu.moverate parameter can be used to set a non-default limit. Measurements can be done to find out which amdgpu.moverate setting gives the best results. Mainly APUs and cards with small VRAM will benefit from this. For F1 2015, anything with 2 GB VRAM or less will benefit. Some benchmark results - F1 2015 (Tonga 2GB): Limit MinFPS AvgFPS Old code: 14 32.6 128 MB/s: 28 41 64 MB/s: 15.5 43 32 MB/s: 28.7 43.4 8 MB/s: 27.8 44.4 8 MB/s: 21.9 42.8 (different run) Random drops in Min FPS can still occur (due to fragmented VRAM?), but the average FPS is much better. 8 MB/s is probably a good limit for this game & the current VRAM management. The random FPS drops are still to be tackled. v2: use a spinlock Signed-off-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 1ef4034b3be5..847583d8a3b3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1490,6 +1490,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1490{ 1490{
1491 int r, i; 1491 int r, i;
1492 bool runtime = false; 1492 bool runtime = false;
1493 u32 max_MBps;
1493 1494
1494 adev->shutdown = false; 1495 adev->shutdown = false;
1495 adev->dev = &pdev->dev; 1496 adev->dev = &pdev->dev;
@@ -1549,6 +1550,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1549 spin_lock_init(&adev->didt_idx_lock); 1550 spin_lock_init(&adev->didt_idx_lock);
1550 spin_lock_init(&adev->gc_cac_idx_lock); 1551 spin_lock_init(&adev->gc_cac_idx_lock);
1551 spin_lock_init(&adev->audio_endpt_idx_lock); 1552 spin_lock_init(&adev->audio_endpt_idx_lock);
1553 spin_lock_init(&adev->mm_stats.lock);
1552 1554
1553 INIT_LIST_HEAD(&adev->shadow_list); 1555 INIT_LIST_HEAD(&adev->shadow_list);
1554 mutex_init(&adev->shadow_list_lock); 1556 mutex_init(&adev->shadow_list_lock);
@@ -1660,6 +1662,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,
1660 1662
1661 adev->accel_working = true; 1663 adev->accel_working = true;
1662 1664
1665 /* Initialize the buffer migration limit. */
1666 if (amdgpu_moverate >= 0)
1667 max_MBps = amdgpu_moverate;
1668 else
1669 max_MBps = 8; /* Allow 8 MB/s. */
1670 /* Get a log2 for easy divisions. */
1671 adev->mm_stats.log2_max_MBps = ilog2(max(1u, max_MBps));
1672
1663 amdgpu_fbdev_init(adev); 1673 amdgpu_fbdev_init(adev);
1664 1674
1665 r = amdgpu_ib_pool_init(adev); 1675 r = amdgpu_ib_pool_init(adev);