amd/virtio: use AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT

To match what libdrm_amdgpu does in non-virtualized env.

Fixes: e0b5724e85 ("meson: bump required libdrm to 2.4.133 for AMDGPU")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41381>
This commit is contained in:
Pierre-Eric Pelloux-Prayer 2026-05-06 10:20:12 +02:00 committed by Marge Bot
parent e5e375593b
commit 760ed3e888

View file

@ -99,6 +99,8 @@ int amdvgpu_device_initialize(int fd, uint32_t *drm_major, uint32_t *drm_minor,
struct util_sync_provider **p) {
simple_mtx_lock(&dev_mutex);
amdvgpu_device_handle dev;
uint8_t gfx_ip_version_major = 0;
uint32_t va_mgr_flags = 0;
for (dev = dev_list; dev; dev = dev->next)
if (fd_compare(dev->fd, fd) == 0)
@ -166,17 +168,25 @@ int amdvgpu_device_initialize(int fd, uint32_t *drm_major, uint32_t *drm_minor,
int count = util_bitcount(ip_info.available_rings);
dev->virtio_ring_mapping[i] = next_ring_idx;
next_ring_idx += count;
if (i == AMD_IP_GFX)
gfx_ip_version_major = ip_info.hw_ip_version_major;
}
}
/* VIRTGPU_CONTEXT_PARAM_NUM_RINGS is hardcoded for now. */
assert(next_ring_idx <= 64);
dev->num_virtio_rings = next_ring_idx - 1;
if (gfx_ip_version_major >= 6 && gfx_ip_version_major <= 12 &&
gfx_ip_version_major != 9)
va_mgr_flags |= AMDGPU_VA_MGR_RESERVE_HALF_VA_FOR_PRT;
dev->va_mgr = amdgpu_va_manager_alloc();
amdgpu_va_manager_init(dev->va_mgr,
amdgpu_va_manager_init2(dev->va_mgr,
dev->dev_info.virtual_address_offset, dev->dev_info.virtual_address_max,
dev->dev_info.high_va_offset, dev->dev_info.high_va_max,
dev->dev_info.virtual_address_alignment);
dev->dev_info.virtual_address_alignment,
va_mgr_flags);
_mesa_hash_table_init(&dev->contexts, NULL,
_mesa_hash_pointer, _mesa_key_pointer_equal);