radv/gfx9: allocate events from uncached VA space
authorDave Airlie <airlied@redhat.com>
Thu, 7 Sep 2017 03:40:57 +0000 (20:40 -0700)
committerDave Airlie <airlied@redhat.com>
Thu, 7 Sep 2017 20:04:54 +0000 (21:04 +0100)
This copies what amdgpu-pro does, and allocates the memory
for an event with an uncached mtype.

This fixes hangs with:
dEQP-VK.api.command_buffers.record_simul_use_primary

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_radeon_winsys.h
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c

index b64a02380d69b711e70f054c3c899d8f200137e6..ae0a76137e74512b254478dbbf46e2e6857fb21a 100644 (file)
@@ -2789,7 +2789,7 @@ VkResult radv_CreateEvent(
 
        event->bo = device->ws->buffer_create(device->ws, 8, 8,
                                              RADEON_DOMAIN_GTT,
-                                             RADEON_FLAG_CPU_ACCESS);
+                                             RADEON_FLAG_VA_UNCACHED | RADEON_FLAG_CPU_ACCESS);
        if (!event->bo) {
                vk_free2(&device->alloc, pAllocator, event);
                return VK_ERROR_OUT_OF_DEVICE_MEMORY;
index 8e2ba7431a7e3c87e5b935983c3c5ff3a7e083fd..a9c1f54c238b967358d17a8ca92ce0cd2e4b547b 100644 (file)
@@ -51,7 +51,8 @@ enum radeon_bo_flag { /* bitfield */
        RADEON_FLAG_GTT_WC =        (1 << 0),
        RADEON_FLAG_CPU_ACCESS =    (1 << 1),
        RADEON_FLAG_NO_CPU_ACCESS = (1 << 2),
-       RADEON_FLAG_VIRTUAL =       (1 << 3)
+       RADEON_FLAG_VIRTUAL =       (1 << 3),
+       RADEON_FLAG_VA_UNCACHED =   (1 << 4),
 };
 
 enum radeon_bo_usage { /* bitfield */
index 95290a468e74ac5b999203cf87135bb829257a8e..325f87528742f38870a6073c8ecc1c1f54774543 100644 (file)
@@ -340,7 +340,11 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
                goto error_bo_alloc;
        }
 
-       r = radv_amdgpu_bo_va_op(ws->dev, buf_handle, 0, size, va, 0, AMDGPU_VA_OP_MAP);
+
+       uint32_t va_flags = 0;
+       if (flags & RADEON_FLAG_VA_UNCACHED)
+               va_flags |= AMDGPU_VM_MTYPE_UC;
+       r = radv_amdgpu_bo_va_op(ws->dev, buf_handle, 0, size, va, flags, AMDGPU_VA_OP_MAP);
        if (r)
                goto error_va_map;