lavapipe: add an env var to enable poisoning memory allocations
it's not random, but it's definitely not zero or any other expected value, which means it's going to break anything that was passing due to lucky uninitialized values Reviewed-by: Emma Anholt <emma@anholt.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15620>
This commit is contained in:
committed by
Marge Bot
parent
dcadeb9a47
commit
0be484ece4
@@ -1675,6 +1675,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDevice(
|
||||
return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
device->queue.state = device + 1;
|
||||
device->poison_mem = debug_get_bool_option("LVP_POISON_MEMORY", false);
|
||||
|
||||
struct vk_device_dispatch_table dispatch_table;
|
||||
vk_device_dispatch_table_from_entrypoints(&dispatch_table,
|
||||
@@ -1988,6 +1989,9 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory(
|
||||
if (!mem->pmem) {
|
||||
goto fail;
|
||||
}
|
||||
if (device->poison_mem)
|
||||
/* this is a value that will definitely break things */
|
||||
memset(mem->pmem, UINT8_MAX / 2 + 1, pAllocateInfo->allocationSize);
|
||||
}
|
||||
|
||||
mem->type_index = pAllocateInfo->memoryTypeIndex;
|
||||
|
||||
@@ -211,6 +211,7 @@ struct lvp_device {
|
||||
struct lvp_instance * instance;
|
||||
struct lvp_physical_device *physical_device;
|
||||
struct pipe_screen *pscreen;
|
||||
bool poison_mem;
|
||||
};
|
||||
|
||||
void lvp_device_get_cache_uuid(void *uuid);
|
||||
|
||||
Reference in New Issue
Block a user