winsys/amdgpu: clean up code around BO VM alignment
authorMarek Olšák <marek.olsak@amd.com>
Fri, 23 Nov 2018 23:20:49 +0000 (18:20 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 29 Nov 2018 01:20:27 +0000 (20:20 -0500)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/gallium/winsys/amdgpu/drm/amdgpu_bo.c

index e7db383c69b6359d6b9aefe221959e9603bc6546..dd3e8984dac7d2c316724dc8e689027d41db6427 100644 (file)
@@ -488,10 +488,15 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
    }
 
    va_gap_size = ws->check_vm ? MAX2(4 * alignment, 64 * 1024) : 0;
+
+   unsigned vm_alignment = alignment;
+
+   /* Increase the VM alignment for faster address translation. */
    if (size > ws->info.pte_fragment_size)
-          alignment = MAX2(alignment, ws->info.pte_fragment_size);
+      vm_alignment = MAX2(vm_alignment, ws->info.pte_fragment_size);
+
    r = amdgpu_va_range_alloc(ws->dev, amdgpu_gpu_va_range_general,
-                             size + va_gap_size, alignment, 0, &va, &va_handle,
+                             size + va_gap_size, vm_alignment, 0, &va, &va_handle,
                              (flags & RADEON_FLAG_32BIT ? AMDGPU_VA_RANGE_32_BIT : 0) |
                             AMDGPU_VA_RANGE_HIGH);
    if (r)