radv: Align large buffers to the fragment size.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 26 Nov 2018 02:28:05 +0000 (03:28 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 27 Nov 2018 21:17:42 +0000 (22:17 +0100)
Improves performance in Talos by about 15% (and significant improvements
in RotR and possibly other but did not bench with final patch) on
kernel 4.19 and earlier.

On 4.20+ a similar effect comes from

433ca054949a "drm/amdgpu: try allocating VRAM as power of two"

v2: Do not impact the alignment of the physical memory.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
CC: <mesa-stable@lists.freedesktop.org>
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c

index 25764d9..482cf0f 100644 (file)
@@ -304,8 +304,12 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
                return NULL;
        }
 
+       unsigned virt_alignment = alignment;
+       if (size >= ws->info.pte_fragment_size)
+               virt_alignment = MAX2(virt_alignment, ws->info.pte_fragment_size);
+
        r = amdgpu_va_range_alloc(ws->dev, amdgpu_gpu_va_range_general,
-                                 size, alignment, 0, &va, &va_handle,
+                                 size, virt_alignment, 0, &va, &va_handle,
                                  (flags & RADEON_FLAG_32BIT ? AMDGPU_VA_RANGE_32_BIT : 0) |
                                   AMDGPU_VA_RANGE_HIGH);
        if (r)