aboutsummaryrefslogtreecommitdiffstats
path: root/src/freedreno/vulkan
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2019-10-14 11:24:27 -0400
committerJonathan Marek <[email protected]>2019-10-15 07:56:19 -0400
commiteef195c9cc90076702b9b87c290abb98d8da4d8d (patch)
treefca298245198217113ae858d21475d97bf5ce83f /src/freedreno/vulkan
parent03772df45016010e19fbd89564d587e0eef25e61 (diff)
turnip: fix segmentation fault in events
Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/freedreno/vulkan')
-rw-r--r--src/freedreno/vulkan/tu_device.c20
-rw-r--r--src/freedreno/vulkan/tu_private.h2
2 files changed, 18 insertions, 4 deletions
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 54988ac83cd..9d1169d6a66 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -1732,9 +1732,23 @@ tu_CreateEvent(VkDevice _device,
if (!event)
return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
+ VkResult result = tu_bo_init_new(device, &event->bo, 0x1000);
+ if (result != VK_SUCCESS)
+ goto fail_alloc;
+
+ result = tu_bo_map(device, &event->bo);
+ if (result != VK_SUCCESS)
+ goto fail_map;
+
*pEvent = tu_event_to_handle(event);
return VK_SUCCESS;
+
+fail_map:
+ tu_bo_finish(device, &event->bo);
+fail_alloc:
+ vk_free2(&device->alloc, pAllocator, event);
+ return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
}
void
@@ -1755,7 +1769,7 @@ tu_GetEventStatus(VkDevice _device, VkEvent _event)
{
TU_FROM_HANDLE(tu_event, event, _event);
- if (*event->map == 1)
+ if (*(uint64_t*) event->bo.map == 1)
return VK_EVENT_SET;
return VK_EVENT_RESET;
}
@@ -1764,7 +1778,7 @@ VkResult
tu_SetEvent(VkDevice _device, VkEvent _event)
{
TU_FROM_HANDLE(tu_event, event, _event);
- *event->map = 1;
+ *(uint64_t*) event->bo.map = 1;
return VK_SUCCESS;
}
@@ -1773,7 +1787,7 @@ VkResult
tu_ResetEvent(VkDevice _device, VkEvent _event)
{
TU_FROM_HANDLE(tu_event, event, _event);
- *event->map = 0;
+ *(uint64_t*) event->bo.map = 0;
return VK_SUCCESS;
}
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index ee00befd976..2537c3df9f9 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -981,7 +981,7 @@ tu_unaligned_dispatch(struct tu_cmd_buffer *cmd_buffer,
struct tu_event
{
- uint64_t *map;
+ struct tu_bo bo;
};
struct tu_shader_module;