This introduces RADON_FLAG_ZERO_VRAM.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3888>
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 */
}
/* 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");