From 6840cc15136fb405abd999222f2b08a068ba2e3c Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Tue, 26 Jan 2016 14:50:52 -0800 Subject: [PATCH] anv/image: clflush surface state map in anv_fill_buffer_surface_state(). Some of its users had the required clflush on non-LLC platforms, some didn't. Put the clflush in anv_fill_buffer_surface_state() so we don't forget. --- src/vulkan/anv_cmd_buffer.c | 5 +---- src/vulkan/anv_descriptor_set.c | 5 +---- src/vulkan/anv_device.c | 15 ++++++++++----- src/vulkan/anv_image.c | 6 +++--- src/vulkan/anv_private.h | 3 ++- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 50ecf000167..0966e7658bf 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -762,12 +762,9 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer, const struct anv_format *format = anv_format_for_descriptor_type(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER); - anv_fill_buffer_surface_state(cmd_buffer->device, surface_state.map, + anv_fill_buffer_surface_state(cmd_buffer->device, surface_state, format->surface_format, bo_offset, 12, 1); - if (!cmd_buffer->device->info.has_llc) - anv_state_clflush(surface_state); - bt_map[0] = surface_state.offset + state_offset; add_surface_state_reloc(cmd_buffer, surface_state, bo, bo_offset); } diff --git a/src/vulkan/anv_descriptor_set.c b/src/vulkan/anv_descriptor_set.c index 8b3b5dfadbc..8997f50297a 100644 --- a/src/vulkan/anv_descriptor_set.c +++ b/src/vulkan/anv_descriptor_set.c @@ -565,13 +565,10 @@ void anv_UpdateDescriptorSets( else view->range = write->pBufferInfo[j].range; - anv_fill_buffer_surface_state(device, view->surface_state.map, + anv_fill_buffer_surface_state(device, view->surface_state, view->format, view->offset, view->range, 1); - if (!device->info.has_llc) - anv_state_clflush(view->surface_state); - desc[j] = (struct anv_descriptor) { .type = write->descriptorType, .buffer_view = view, diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index f9aa3149207..557f4ca16fb 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1618,26 +1618,31 @@ void anv_DestroyBuffer( } void -anv_fill_buffer_surface_state(struct anv_device *device, void *state, +anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride) { switch (device->info.gen) { case 7: if (device->info.is_haswell) - gen75_fill_buffer_surface_state(state, format, offset, range, stride); + gen75_fill_buffer_surface_state(state.map, format, offset, range, + stride); else - gen7_fill_buffer_surface_state(state, format, offset, range, stride); + gen7_fill_buffer_surface_state(state.map, format, offset, range, + stride); break; case 8: - gen8_fill_buffer_surface_state(state, format, offset, range, stride); + gen8_fill_buffer_surface_state(state.map, format, offset, range, stride); break; case 9: - gen9_fill_buffer_surface_state(state, format, offset, range, stride); + gen9_fill_buffer_surface_state(state.map, format, offset, range, stride); break; default: unreachable("unsupported gen\n"); } + + if (!device->info.has_llc) + anv_state_clflush(state); } void anv_DestroySampler( diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index d53363c627d..f3fced5e704 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -530,7 +530,7 @@ anv_image_view_init(struct anv_image_view *iview, iview, pCreateInfo, VK_IMAGE_USAGE_STORAGE_BIT); else - anv_fill_buffer_surface_state(device, iview->storage_surface_state.map, + anv_fill_buffer_surface_state(device, iview->storage_surface_state, ISL_FORMAT_RAW, iview->offset, iview->bo->size - iview->offset, 1); @@ -614,7 +614,7 @@ anv_CreateBufferView(VkDevice _device, view->surface_state = anv_state_pool_alloc(&device->surface_state_pool, 64, 64); - anv_fill_buffer_surface_state(device, view->surface_state.map, + anv_fill_buffer_surface_state(device, view->surface_state, view->format, view->offset, view->range, format->isl_layout->bs); @@ -631,7 +631,7 @@ anv_CreateBufferView(VkDevice _device, isl_lower_storage_image_format(&device->isl_dev, view->format) : ISL_FORMAT_RAW; - anv_fill_buffer_surface_state(device, view->storage_surface_state.map, + anv_fill_buffer_surface_state(device, view->storage_surface_state, storage_format, view->offset, view->range, (storage_format == ISL_FORMAT_RAW ? 1 : diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index a1a55ddca6b..215727163ed 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -1640,7 +1640,8 @@ struct anv_buffer_view { const struct anv_format * anv_format_for_descriptor_type(VkDescriptorType type); -void anv_fill_buffer_surface_state(struct anv_device *device, void *state, +void anv_fill_buffer_surface_state(struct anv_device *device, + struct anv_state state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride); -- 2.30.2