summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_device.c
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2015-12-19 22:17:19 -0800
committerKristian Høgsberg Kristensen <[email protected]>2015-12-19 22:17:19 -0800
commitc4802bc44c0625fd3bb8b7da7068ce5673ce3d1e (patch)
tree3fc202271dae0b1886352eecf678f7614b15b9c7 /src/vulkan/anv_device.c
parent8ac46d84ff6ed45671832590d143ad4dfa7ff66c (diff)
vk/gen8: Implement VkEvent for gen8
We use PIPE_CONTROL for setting and resetting the event from cmd buffers and MI_SEMAPHORE_WAIT in polling mode for waiting on an event.
Diffstat (limited to 'src/vulkan/anv_device.c')
-rw-r--r--src/vulkan/anv_device.c82
1 files changed, 68 insertions, 14 deletions
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c
index e276cc0b9c0..746fecb760f 100644
--- a/src/vulkan/anv_device.c
+++ b/src/vulkan/anv_device.c
@@ -1443,41 +1443,95 @@ void anv_DestroySemaphore(
// Event functions
VkResult anv_CreateEvent(
- VkDevice device,
+ VkDevice _device,
const VkEventCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkEvent* pEvent)
{
- stub_return(VK_ERROR_INCOMPATIBLE_DRIVER);
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ struct anv_state state;
+ struct anv_event *event;
+
+ assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_EVENT_CREATE_INFO);
+
+ state = anv_state_pool_alloc(&device->dynamic_state_pool,
+ sizeof(*event), 4);
+ event = state.map;
+ event->state = state;
+ event->semaphore = VK_EVENT_RESET;
+
+ if (!device->info.has_llc) {
+ /* Make sure the writes we're flushing have landed. */
+ __builtin_ia32_sfence();
+ __builtin_ia32_clflush(event);
+ }
+
+ *pEvent = anv_event_to_handle(event);
+
+ return VK_SUCCESS;
}
void anv_DestroyEvent(
- VkDevice device,
- VkEvent event,
+ VkDevice _device,
+ VkEvent _event,
const VkAllocationCallbacks* pAllocator)
{
- stub();
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ ANV_FROM_HANDLE(anv_event, event, _event);
+
+ anv_state_pool_free(&device->dynamic_state_pool, event->state);
}
VkResult anv_GetEventStatus(
- VkDevice device,
- VkEvent event)
+ VkDevice _device,
+ VkEvent _event)
{
- stub_return(VK_ERROR_INCOMPATIBLE_DRIVER);
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ ANV_FROM_HANDLE(anv_event, event, _event);
+
+ if (!device->info.has_llc) {
+ /* Make sure the writes we're flushing have landed. */
+ __builtin_ia32_clflush(event);
+ __builtin_ia32_lfence();
+ }
+
+ return event->semaphore;
}
VkResult anv_SetEvent(
- VkDevice device,
- VkEvent event)
+ VkDevice _device,
+ VkEvent _event)
{
- stub_return(VK_ERROR_INCOMPATIBLE_DRIVER);
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ ANV_FROM_HANDLE(anv_event, event, _event);
+
+ event->semaphore = VK_EVENT_SET;
+
+ if (!device->info.has_llc) {
+ /* Make sure the writes we're flushing have landed. */
+ __builtin_ia32_sfence();
+ __builtin_ia32_clflush(event);
+ }
+
+ return VK_SUCCESS;
}
VkResult anv_ResetEvent(
- VkDevice device,
- VkEvent event)
+ VkDevice _device,
+ VkEvent _event)
{
- stub_return(VK_ERROR_INCOMPATIBLE_DRIVER);
+ ANV_FROM_HANDLE(anv_device, device, _device);
+ ANV_FROM_HANDLE(anv_event, event, _event);
+
+ event->semaphore = VK_EVENT_RESET;
+
+ if (!device->info.has_llc) {
+ /* Make sure the writes we're flushing have landed. */
+ __builtin_ia32_sfence();
+ __builtin_ia32_clflush(event);
+ }
+
+ return VK_SUCCESS;
}
// Buffer functions