anv/image: clflush surface state map in anv_fill_buffer_surface_state().
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 26 Jan 2016 22:50:52 +0000 (14:50 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 26 Jan 2016 23:14:50 +0000 (15:14 -0800)
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
src/vulkan/anv_descriptor_set.c
src/vulkan/anv_device.c
src/vulkan/anv_image.c
src/vulkan/anv_private.h

index 50ecf0001677d563b61c1722093a045f7ce13e39..0966e7658bfb95d5118383a9cfb474f240d5a501 100644 (file)
@@ -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);
    }
index 8b3b5dfadbc4f1b4b22daabb32858c66ffad133f..8997f50297afa3ce138bfb124bcd9f0a1bf1e37c 100644 (file)
@@ -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,
index f9aa3149207c0528e18f72e6c9c0f54662143f43..557f4ca16fb7c507014036caf0a5f17132a77f1c 100644 (file)
@@ -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(
index d53363c627dbc225e37128cb37eacaa66dc7495c..f3fced5e70424da7e886b717f5c84d2e080162c7 100644 (file)
@@ -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 :
index a1a55ddca6b45c8f73cf36c374010fa1ba4c0f71..215727163edf8eeffce5fb07d1d18c64e50771b7 100644 (file)
@@ -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);