From: Timur Kristóf Date: Mon, 10 Apr 2023 23:54:22 +0000 (+0200) Subject: radv/amdgpu: Place secondary CS without IB2 in non-WC GTT. X-Git-Tag: upstream/23.3.3~10151 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b51e858d680dc689eac2d8fcba19025df8052693;p=platform%2Fupstream%2Fmesa.git radv/amdgpu: Place secondary CS without IB2 in non-WC GTT. When using a secondary CS without IB2, we have to memcpy the contents into the primary CS. Use these flags to improve perf by preventing memcpy from VRAM. Signed-off-by: Timur Kristóf Reviewed-by: Bas Nieuwenhuizen Part-of: --- diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c index 9f7197c..7107fc0 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c @@ -231,9 +231,13 @@ radv_amdgpu_cs_bo_create(struct radv_amdgpu_cs *cs, uint32_t ib_size) { struct radeon_winsys *ws = &cs->ws->base; - const enum radeon_bo_domain domain = radv_amdgpu_cs_domain(ws); + /* Avoid memcpy from VRAM when a secondary cmdbuf can't always rely on IB2. */ + const bool can_always_use_ib2 = cs->ws->info.gfx_level >= GFX8 && cs->hw_ip == AMD_IP_GFX; + const bool avoid_vram = cs->is_secondary && !can_always_use_ib2; + const enum radeon_bo_domain domain = avoid_vram ? RADEON_DOMAIN_GTT : radv_amdgpu_cs_domain(ws); + const enum radeon_bo_flag gtt_wc_flag = avoid_vram ? 0 : RADEON_FLAG_GTT_WC; const enum radeon_bo_flag flags = RADEON_FLAG_CPU_ACCESS | RADEON_FLAG_NO_INTERPROCESS_SHARING | - RADEON_FLAG_READ_ONLY | RADEON_FLAG_GTT_WC; + RADEON_FLAG_READ_ONLY | gtt_wc_flag; return ws->buffer_create(ws, ib_size, cs->ws->info.ib_alignment, domain, flags, RADV_BO_PRIORITY_CS, 0, &cs->ib_buffer);