amdgpu: Add vamgr for capture/replay.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 23 Nov 2020 01:18:05 +0000 (02:18 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 15 Jun 2021 13:08:20 +0000 (13:08 +0000)
commit085ee3e488b48453a3ed82ae3b95dbcb6920a8c6
tree3f7819d98a455e7f921fab1c6971c6a861e18419
parentd615430c6843c19b0e7bc3ad6fb3f4b1074e2d4c
amdgpu: Add vamgr for capture/replay.

In Vulkan we have extensions to assist with capture in replay in a
world where addresses are returned to the application. This involves
creating buffers at the same VA during replay as they were during
capture.

By itself libdrm_amdgpu already has support for this, but there is
the obvious failure mode that if another buffer is already allocated
at that VA things fail spectacularly. This is an actual issue as
internal buffers, like winsys images or shader binaries also
participate in the same VA allocation.

To avoid this problem applications have to create buffers which
are going to be captured with a flag, and the implementation is to
separate VA allocation for those buffers to reduce the collision risk:

"Implementations are expected to separate such buffers in the GPU address
space so normal allocations will avoid using these addresses. Apps/tools
should avoid mixing app-provided and implementation-provided addresses for
buffers created with VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT,
to avoid address space allocation conflicts."

This patch implements that by adding a flag for these buffers and allocating
address space from the top of the address range instead of the bottom.

Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Christian König <christian.koenig@amd.com>
amdgpu/amdgpu.h
amdgpu/amdgpu_vamgr.c