[Mesa-dev] [PATCH 2/5] anv: Rename clflush_range and state_clflush

Jason Ekstrand jason at jlekstrand.net
Mon Feb 20 19:21:56 UTC 2017


It's a bit shorter and easier to work with.  Also, we're about to add a
helper called clflush which does the clflush but without any memory
fencing.
---
 src/intel/vulkan/anv_batch_chain.c |  2 +-
 src/intel/vulkan/anv_cmd_buffer.c  |  8 ++++----
 src/intel/vulkan/anv_device.c      |  6 +++---
 src/intel/vulkan/anv_image.c       |  6 +++---
 src/intel/vulkan/anv_private.h     |  6 +++---
 src/intel/vulkan/gen7_cmd_buffer.c |  4 ++--
 src/intel/vulkan/gen8_cmd_buffer.c |  8 ++++----
 src/intel/vulkan/genX_blorp_exec.c |  2 +-
 src/intel/vulkan/genX_cmd_buffer.c | 12 ++++++------
 src/intel/vulkan/genX_pipeline.c   |  2 +-
 10 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c
index f585946..3f6039e 100644
--- a/src/intel/vulkan/anv_batch_chain.c
+++ b/src/intel/vulkan/anv_batch_chain.c
@@ -1063,7 +1063,7 @@ write_reloc(const struct anv_device *device, void *p, uint64_t v, bool flush)
    }
 
    if (flush && !device->info.has_llc)
-      anv_clflush_range(p, reloc_size);
+      anv_flush_range(p, reloc_size);
 }
 
 static void
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index 8c08f8d..e82cfd2 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -588,7 +588,7 @@ anv_cmd_buffer_emit_dynamic(struct anv_cmd_buffer *cmd_buffer,
    memcpy(state.map, data, size);
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(state);
+      anv_state_flush(state);
 
    VG(VALGRIND_CHECK_MEM_IS_DEFINED(state.map, size));
 
@@ -610,7 +610,7 @@ anv_cmd_buffer_merge_dynamic(struct anv_cmd_buffer *cmd_buffer,
       p[i] = a[i] | b[i];
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(state);
+      anv_state_flush(state);
 
    VG(VALGRIND_CHECK_MEM_IS_DEFINED(p, dwords * 4));
 
@@ -647,7 +647,7 @@ anv_cmd_buffer_push_constants(struct anv_cmd_buffer *cmd_buffer,
    }
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(state);
+      anv_state_flush(state);
 
    return state;
 }
@@ -707,7 +707,7 @@ anv_cmd_buffer_cs_push_constants(struct anv_cmd_buffer *cmd_buffer)
    }
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(state);
+      anv_state_flush(state);
 
    return state;
 }
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index cae5fef..c8277cb 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -863,7 +863,7 @@ anv_state_pool_emit_data(struct anv_state_pool *pool, size_t size, size_t align,
    memcpy(state.map, p, size);
 
    if (!pool->block_pool->device->info.has_llc)
-      anv_state_clflush(state);
+      anv_state_flush(state);
 
    return state;
 }
@@ -914,7 +914,7 @@ anv_device_submit_simple_batch(struct anv_device *device,
 
    memcpy(bo.map, batch->start, size);
    if (!device->info.has_llc)
-      anv_clflush_range(bo.map, size);
+      anv_flush_range(bo.map, size);
 
    exec_bos[0] = &bo;
    exec2_objects[0].handle = bo.gem_handle;
@@ -2064,7 +2064,7 @@ anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state,
                          .stride = stride);
 
    if (!device->info.has_llc)
-      anv_state_clflush(state);
+      anv_state_flush(state);
 }
 
 void anv_DestroySampler(
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index cf4304a..c0142c8 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -575,7 +575,7 @@ anv_CreateImageView(VkDevice _device,
                           .mocs = device->default_mocs);
 
       if (!device->info.has_llc)
-         anv_state_clflush(iview->sampler_surface_state);
+         anv_state_flush(iview->sampler_surface_state);
    } else {
       iview->sampler_surface_state.alloc_size = 0;
    }
@@ -627,8 +627,8 @@ anv_CreateImageView(VkDevice _device,
                                 &surface->isl, &iview->isl);
 
       if (!device->info.has_llc) {
-         anv_state_clflush(iview->storage_surface_state);
-         anv_state_clflush(iview->writeonly_storage_surface_state);
+         anv_state_flush(iview->storage_surface_state);
+         anv_state_flush(iview->writeonly_storage_surface_state);
       }
    } else {
       iview->storage_surface_state.alloc_size = 0;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 5344f07..7bdbfab 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -440,7 +440,7 @@ struct anv_state_stream {
 #define CACHELINE_MASK 63
 
 static inline void
-anv_clflush_range(void *start, size_t size)
+anv_flush_range(void *start, size_t size)
 {
    void *p = (void *) (((uintptr_t) start) & ~CACHELINE_MASK);
    void *end = start + size;
@@ -466,9 +466,9 @@ anv_invalidate_range(void *start, size_t size)
 }
 
 static void inline
-anv_state_clflush(struct anv_state state)
+anv_state_flush(struct anv_state state)
 {
-   anv_clflush_range(state.map, state.alloc_size);
+   anv_flush_range(state.map, state.alloc_size);
 }
 
 VkResult anv_block_pool_init(struct anv_block_pool *pool,
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c
index c1a25e8..3f7376c 100644
--- a/src/intel/vulkan/gen7_cmd_buffer.c
+++ b/src/intel/vulkan/gen7_cmd_buffer.c
@@ -91,7 +91,7 @@ gen7_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer)
    }
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(scissor_state);
+      anv_state_flush(scissor_state);
 }
 #endif
 
@@ -192,7 +192,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
       };
       GENX(COLOR_CALC_STATE_pack)(NULL, cc_state.map, &cc);
       if (!cmd_buffer->device->info.has_llc)
-         anv_state_clflush(cc_state);
+         anv_state_flush(cc_state);
 
       anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), ccp) {
          ccp.ColorCalcStatePointer = cc_state.offset;
diff --git a/src/intel/vulkan/gen8_cmd_buffer.c b/src/intel/vulkan/gen8_cmd_buffer.c
index 59fd537..7c9bfd0 100644
--- a/src/intel/vulkan/gen8_cmd_buffer.c
+++ b/src/intel/vulkan/gen8_cmd_buffer.c
@@ -68,7 +68,7 @@ gen8_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer)
    }
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(sf_clip_state);
+      anv_state_flush(sf_clip_state);
 
    anv_batch_emit(&cmd_buffer->batch,
                   GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP), clip) {
@@ -97,7 +97,7 @@ gen8_cmd_buffer_emit_depth_viewport(struct anv_cmd_buffer *cmd_buffer,
    }
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(cc_state);
+      anv_state_flush(cc_state);
 
    anv_batch_emit(&cmd_buffer->batch,
                   GENX(3DSTATE_VIEWPORT_STATE_POINTERS_CC), cc) {
@@ -474,7 +474,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
       GENX(COLOR_CALC_STATE_pack)(NULL, cc_state.map, &cc);
 
       if (!cmd_buffer->device->info.has_llc)
-         anv_state_clflush(cc_state);
+         anv_state_flush(cc_state);
 
       anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), ccp) {
          ccp.ColorCalcStatePointer        = cc_state.offset;
@@ -526,7 +526,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
       GEN9_COLOR_CALC_STATE_pack(NULL, cc_state.map, &cc);
 
       if (!cmd_buffer->device->info.has_llc)
-         anv_state_clflush(cc_state);
+         anv_state_flush(cc_state);
 
       anv_batch_emit(&cmd_buffer->batch, GEN9_3DSTATE_CC_STATE_POINTERS, ccp) {
          ccp.ColorCalcStatePointer = cc_state.offset;
diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c
index f7969e5..1e254c3 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -123,7 +123,7 @@ blorp_flush_range(struct blorp_batch *batch, void *start, size_t size)
 {
    struct anv_device *device = batch->blorp->driver_ctx;
    if (device->info.has_llc)
-      anv_clflush_range(start, size);
+      anv_flush_range(start, size);
 }
 
 static void
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index f45b714..ebf54fd 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -580,7 +580,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
       }
 
       if (!cmd_buffer->device->info.has_llc)
-         anv_state_clflush(state->render_pass_states);
+         anv_state_flush(state->render_pass_states);
    }
 }
 
@@ -1276,7 +1276,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
 
  out:
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(*bt_state);
+      anv_state_flush(*bt_state);
 
    return VK_SUCCESS;
 }
@@ -1334,7 +1334,7 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer,
    }
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(*state);
+      anv_state_flush(*state);
 
    return VK_SUCCESS;
 }
@@ -1653,7 +1653,7 @@ emit_base_vertex_instance(struct anv_cmd_buffer *cmd_buffer,
    ((uint32_t *)id_state.map)[1] = base_instance;
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(id_state);
+      anv_state_flush(id_state);
 
    emit_base_vertex_instance_bo(cmd_buffer,
       &cmd_buffer->device->dynamic_state_block_pool.bo, id_state.offset);
@@ -1668,7 +1668,7 @@ emit_draw_index(struct anv_cmd_buffer *cmd_buffer, uint32_t draw_index)
    ((uint32_t *)state.map)[0] = draw_index;
 
    if (!cmd_buffer->device->info.has_llc)
-      anv_state_clflush(state);
+      anv_state_flush(state);
 
    emit_vertex_bo(cmd_buffer,
                   &cmd_buffer->device->dynamic_state_block_pool.bo,
@@ -1947,7 +1947,7 @@ void genX(CmdDispatch)(
       sizes[1] = y;
       sizes[2] = z;
       if (!cmd_buffer->device->info.has_llc)
-         anv_state_clflush(state);
+         anv_state_flush(state);
       cmd_buffer->state.num_workgroups_offset = state.offset;
       cmd_buffer->state.num_workgroups_bo =
          &cmd_buffer->device->dynamic_state_block_pool.bo;
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index a9396da..e461e6e 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -977,7 +977,7 @@ emit_cb_state(struct anv_pipeline *pipeline,
 
    GENX(BLEND_STATE_pack)(NULL, pipeline->blend_state.map, &blend_state);
    if (!device->info.has_llc)
-      anv_state_clflush(pipeline->blend_state);
+      anv_state_flush(pipeline->blend_state);
 
    anv_batch_emit(&pipeline->batch, GENX(3DSTATE_BLEND_STATE_POINTERS), bsp) {
       bsp.BlendStatePointer      = pipeline->blend_state.offset;
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list