summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_device.c
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2015-12-01 15:37:12 -0800
committerKristian Høgsberg Kristensen <[email protected]>2015-12-04 09:51:47 -0800
commit773592051be92f3f8c3ac11492b22d2bf4e96020 (patch)
treea5314564a21cd17f7d6ec7f47313b2ea383519f7 /src/vulkan/anv_device.c
parentb431cf59a3f0412b7b7dd2660a793912a550bfc4 (diff)
vk: clflush all state for non-LLC GPUs
Diffstat (limited to 'src/vulkan/anv_device.c')
-rw-r--r--src/vulkan/anv_device.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c
index 724c4120a06..384a457742f 100644
--- a/src/vulkan/anv_device.c
+++ b/src/vulkan/anv_device.c
@@ -599,6 +599,20 @@ anv_queue_finish(struct anv_queue *queue)
{
}
+static struct anv_state
+anv_state_pool_emit_data(struct anv_state_pool *pool, size_t size, size_t align, const void *p)
+{
+ struct anv_state state;
+
+ state = anv_state_pool_alloc(pool, size, align);
+ memcpy(state.map, p, size);
+
+ if (!pool->block_pool->device->info.has_llc)
+ anv_state_clflush(state);
+
+ return state;
+}
+
static void
anv_device_init_border_colors(struct anv_device *device)
{
@@ -611,10 +625,8 @@ anv_device_init_border_colors(struct anv_device *device)
[VK_BORDER_COLOR_INT_OPAQUE_WHITE] = { .uint32 = { 1, 1, 1, 1 } },
};
- device->border_colors =
- anv_state_pool_alloc(&device->dynamic_state_pool,
- sizeof(border_colors), 32);
- memcpy(device->border_colors.map, border_colors, sizeof(border_colors));
+ device->border_colors = anv_state_pool_emit_data(&device->dynamic_state_pool,
+ sizeof(border_colors), 32, border_colors);
}
VkResult anv_CreateDevice(
@@ -885,6 +897,9 @@ VkResult anv_DeviceWaitIdle(
anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END);
anv_batch_emit(&batch, GEN7_MI_NOOP);
+ if (!device->info.has_llc)
+ anv_state_clflush(state);
+
exec2_objects[0].handle = bo->gem_handle;
exec2_objects[0].relocation_count = 0;
exec2_objects[0].relocs_ptr = 0;
@@ -1219,6 +1234,13 @@ VkResult anv_CreateFence(
anv_batch_emit(&batch, GEN7_MI_BATCH_BUFFER_END);
anv_batch_emit(&batch, GEN7_MI_NOOP);
+ if (!device->info.has_llc) {
+ assert(((uintptr_t) fence->bo.map & CACHELINE_MASK) == 0);
+ assert(batch.next - fence->bo.map <= CACHELINE_SIZE);
+ __builtin_ia32_sfence();
+ __builtin_ia32_clflush(fence->bo.map);
+ }
+
fence->exec2_objects[0].handle = fence->bo.gem_handle;
fence->exec2_objects[0].relocation_count = 0;
fence->exec2_objects[0].relocs_ptr = 0;