summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimur Kristóf <timur.kristof@gmail.com>2023-01-10 20:34:27 +0100
committerMarge Bot <emma+marge@anholt.net>2023-02-02 02:13:10 +0000
commit95d06343c693aa12b4cda5cda31d81fae138b0ec (patch)
tree27a7c1e26e308f8add5da99292acfb15faaadf53
parentef668f3714112e665a42b63dc971b0fe266547d1 (diff)
radv: Don't place CS in VRAM when bandwidth is too low.
People who use RADV on eGPU have reported poor performance by default. They also noted that the "nosam" option helps. This commit disables placing CS objects in VRAM when the bandwidth is below that of PCIe 3.0 x8. Note that eGPUs are typically PCIe 3.0 x4. Contributes-to: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7340 Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20842>
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
index b24cf814cec..38007160bc8 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
@@ -217,8 +217,14 @@ radv_amdgpu_cs_domain(const struct radeon_winsys *_ws)
bool enough_vram = ws->info.all_vram_visible ||
p_atomic_read_relaxed(&ws->allocated_vram_vis) * 2 <= (uint64_t)ws->info.vram_vis_size_kb * 1024;
+
+ /* Bandwidth should be equivalent to at least PCIe 3.0 x8.
+ * If there is no PCIe info, assume there is enough bandwidth.
+ */
+ bool enough_bandwidth = !ws->info.has_pcie_bandwidth_info || ws->info.pcie_bandwidth_mbps >= 8 * 0.985 * 1024;
+
bool use_sam =
- (enough_vram && ws->info.has_dedicated_vram && !(ws->perftest & RADV_PERFTEST_NO_SAM)) ||
+ (enough_vram && enough_bandwidth && ws->info.has_dedicated_vram && !(ws->perftest & RADV_PERFTEST_NO_SAM)) ||
(ws->perftest & RADV_PERFTEST_SAM);
return use_sam ? RADEON_DOMAIN_VRAM : RADEON_DOMAIN_GTT;
}