From: Samuel Pitoiset Date: Thu, 20 Feb 2020 06:19:27 +0000 (+0100) Subject: radv/winsys: add a new flag that requests zerovram allocations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37650bf93803822d6e3aefae7c2f4c7eef5d6171;p=mesa.git radv/winsys: add a new flag that requests zerovram allocations This introduces RADON_FLAG_ZERO_VRAM. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: --- diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h index 5c7b1ab5118..59c628b730f 100644 --- a/src/amd/vulkan/radv_radeon_winsys.h +++ b/src/amd/vulkan/radv_radeon_winsys.h @@ -61,6 +61,7 @@ enum radeon_bo_flag { /* bitfield */ RADEON_FLAG_READ_ONLY = (1 << 7), RADEON_FLAG_32BIT = (1 << 8), RADEON_FLAG_PREFER_LOCAL_BO = (1 << 9), + RADEON_FLAG_ZERO_VRAM = (1 << 10), }; enum radeon_bo_usage { /* bitfield */ diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c index 9e19b7b1f89..c07641d6ab8 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c @@ -382,8 +382,11 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws, } /* this won't do anything on pre 4.9 kernels */ - if (ws->zero_all_vram_allocs && (initial_domain & RADEON_DOMAIN_VRAM)) - request.flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED; + if (initial_domain & RADEON_DOMAIN_VRAM) { + if (ws->zero_all_vram_allocs || (flags & RADEON_FLAG_ZERO_VRAM)) + request.flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED; + } + r = amdgpu_bo_alloc(ws->dev, &request, &buf_handle); if (r) { fprintf(stderr, "amdgpu: Failed to allocate a buffer:\n");