aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu.h
diff options
context:
space:
mode:
authorJohn Brooks <john@fastquake.com>2017-06-27 22:33:18 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-07-14 11:06:33 -0400
commit00f06b246a3056bbaa901a90a5a93c9f81ab8e36 (patch)
tree097060002ba3b1340935941ff5a12c9fb5a60cec /drivers/gpu/drm/amd/amdgpu/amdgpu.h
parent218b5dcde4d30e071eec4201a36af665ccfa7e1c (diff)
drm/amdgpu: Throttle visible VRAM moves separately
The BO move throttling code is designed to allow VRAM to fill quickly if it is relatively empty. However, this does not take into account situations where the visible VRAM is smaller than total VRAM, and total VRAM may not be close to full but the visible VRAM segment is under pressure. In such situations, visible VRAM would experience unrestricted swapping and performance would drop. Add a separate counter specifically for moves involving visible VRAM, and check it before moving BOs there. v2: Only perform calculations for separate counter if visible VRAM is smaller than total VRAM. (Michel Dänzer) v3: [Michel Dänzer] * Use BO's location rather than the AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED flag to determine whether to account a move for visible VRAM in most cases. * Use a single if (adev->mc.visible_vram_size < adev->mc.real_vram_size) { block in amdgpu_cs_get_threshold_for_moves. Fixes: 95844d20ae02 (drm/amdgpu: throttle buffer migrations at CS using a fixed MBps limit (v2)) Signed-off-by: John Brooks <john@fastquake.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 0d6b0617cdf0..c290b262d7da 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1117,7 +1117,9 @@ struct amdgpu_cs_parser {
1117 struct list_head validated; 1117 struct list_head validated;
1118 struct dma_fence *fence; 1118 struct dma_fence *fence;
1119 uint64_t bytes_moved_threshold; 1119 uint64_t bytes_moved_threshold;
1120 uint64_t bytes_moved_vis_threshold;
1120 uint64_t bytes_moved; 1121 uint64_t bytes_moved;
1122 uint64_t bytes_moved_vis;
1121 struct amdgpu_bo_list_entry *evictable; 1123 struct amdgpu_bo_list_entry *evictable;
1122 1124
1123 /* user fence */ 1125 /* user fence */
@@ -1555,6 +1557,7 @@ struct amdgpu_device {
1555 spinlock_t lock; 1557 spinlock_t lock;
1556 s64 last_update_us; 1558 s64 last_update_us;
1557 s64 accum_us; /* accumulated microseconds */ 1559 s64 accum_us; /* accumulated microseconds */
1560 s64 accum_us_vis; /* for visible VRAM */
1558 u32 log2_max_MBps; 1561 u32 log2_max_MBps;
1559 } mm_stats; 1562 } mm_stats;
1560 1563
@@ -1846,7 +1849,8 @@ void amdgpu_pci_config_reset(struct amdgpu_device *adev);
1846bool amdgpu_need_post(struct amdgpu_device *adev); 1849bool amdgpu_need_post(struct amdgpu_device *adev);
1847void amdgpu_update_display_priority(struct amdgpu_device *adev); 1850void amdgpu_update_display_priority(struct amdgpu_device *adev);
1848 1851
1849void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes); 1852void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
1853 u64 num_vis_bytes);
1850void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain); 1854void amdgpu_ttm_placement_from_domain(struct amdgpu_bo *abo, u32 domain);
1851bool amdgpu_ttm_bo_is_amdgpu_bo(struct ttm_buffer_object *bo); 1855bool amdgpu_ttm_bo_is_amdgpu_bo(struct ttm_buffer_object *bo);
1852int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages); 1856int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, struct page **pages);