Mesa (main): anv: allocate zeroed device object
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Oct 6 15:40:22 UTC 2021
Module: Mesa
Branch: main
Commit: 434df667929b6c2561ddf8ebf1be4b111884f456
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=434df667929b6c2561ddf8ebf1be4b111884f456
Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date: Wed Oct 6 13:14:20 2021 +0200
anv: allocate zeroed device object
When enabling a new feature we made the mistake of initializing some fields
of the device object conditionally, which leads to crashes later. Initializing
those fields would be a trivial fix, but it's probably better to just zero
everything at allocation time and prevent any future screwups. Device objects
are allocated rarely enough for this additional memset to not matter for
performance.
Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13221>
---
src/intel/vulkan/anv_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 17c2df0c2aa..8c334302bd1 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2922,7 +2922,7 @@ VkResult anv_CreateDevice(
queue_priority ? queue_priority->globalPriority :
VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT;
- device = vk_alloc2(&physical_device->instance->vk.alloc, pAllocator,
+ device = vk_zalloc2(&physical_device->instance->vk.alloc, pAllocator,
sizeof(*device), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!device)
More information about the mesa-commit
mailing list