diff options
| author | Mike Stroyan <stroyan@google.com> | 2017-11-02 10:39:34 -0600 |
|---|---|---|
| committer | Mike Stroyan <stroyan@users.noreply.github.com> | 2017-11-02 11:24:03 -0600 |
| commit | 833d282dabe29bc28e5bdec8825b68d3be35f359 (patch) | |
| tree | cab548aebaa29c909f6a1d763bf7ce0bb3e0abd6 | |
| parent | 03082b77aeb3c8661ca9b74c603da7b03037ab38 (diff) | |
| download | usermoji-833d282dabe29bc28e5bdec8825b68d3be35f359.tar.xz | |
icd: thread protect maps
Lock to protect threaded access to queue_map and mapped_memory_map.
| -rw-r--r-- | scripts/mock_icd_generator.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/mock_icd_generator.py b/scripts/mock_icd_generator.py index 4d6c105d..606436a4 100644 --- a/scripts/mock_icd_generator.py +++ b/scripts/mock_icd_generator.py @@ -449,6 +449,7 @@ CUSTOM_C_INTERCEPTS = { return VK_SUCCESS; ''', 'vkDestroyDevice': ''' + unique_lock_t lock(global_lock); // First destroy sub-device objects // Destroy Queues for (auto dev_queue_map_pair : queue_map) { @@ -464,6 +465,7 @@ CUSTOM_C_INTERCEPTS = { // TODO: If emulating specific device caps, will need to add intelligence here ''', 'vkGetDeviceQueue': ''' + unique_lock_t lock(global_lock); auto queue = queue_map[device][queueFamilyIndex][queueIndex]; if (queue) { *pQueue = queue; @@ -641,6 +643,7 @@ CUSTOM_C_INTERCEPTS = { GetImageMemoryRequirements(device, pInfo->image, &pMemoryRequirements->memoryRequirements); ''', 'vkMapMemory': ''' + unique_lock_t lock(global_lock); // TODO: Just hard-coding 4k whole size for now if (VK_WHOLE_SIZE == size) size = 4096; @@ -650,6 +653,7 @@ CUSTOM_C_INTERCEPTS = { return VK_SUCCESS; ''', 'vkUnmapMemory': ''' + unique_lock_t lock(global_lock); for (auto map_addr : mapped_memory_map[memory]) { free(map_addr); } |
