anv: Rename clflush_range and state_clflush
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. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
parent
075ed20614
commit
f9d7d27d6d
|
@ -1063,7 +1063,7 @@ write_reloc(const struct anv_device *device, void *p, uint64_t v, bool flush)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flush && !device->info.has_llc)
|
if (flush && !device->info.has_llc)
|
||||||
anv_clflush_range(p, reloc_size);
|
anv_flush_range(p, reloc_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -588,7 +588,7 @@ anv_cmd_buffer_emit_dynamic(struct anv_cmd_buffer *cmd_buffer,
|
||||||
memcpy(state.map, data, size);
|
memcpy(state.map, data, size);
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(state);
|
anv_state_flush(state);
|
||||||
|
|
||||||
VG(VALGRIND_CHECK_MEM_IS_DEFINED(state.map, size));
|
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];
|
p[i] = a[i] | b[i];
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(state);
|
anv_state_flush(state);
|
||||||
|
|
||||||
VG(VALGRIND_CHECK_MEM_IS_DEFINED(p, dwords * 4));
|
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)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(state);
|
anv_state_flush(state);
|
||||||
|
|
||||||
return 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)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(state);
|
anv_state_flush(state);
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -862,7 +862,7 @@ anv_state_pool_emit_data(struct anv_state_pool *pool, size_t size, size_t align,
|
||||||
memcpy(state.map, p, size);
|
memcpy(state.map, p, size);
|
||||||
|
|
||||||
if (!pool->block_pool->device->info.has_llc)
|
if (!pool->block_pool->device->info.has_llc)
|
||||||
anv_state_clflush(state);
|
anv_state_flush(state);
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -913,7 +913,7 @@ anv_device_submit_simple_batch(struct anv_device *device,
|
||||||
|
|
||||||
memcpy(bo.map, batch->start, size);
|
memcpy(bo.map, batch->start, size);
|
||||||
if (!device->info.has_llc)
|
if (!device->info.has_llc)
|
||||||
anv_clflush_range(bo.map, size);
|
anv_flush_range(bo.map, size);
|
||||||
|
|
||||||
exec_bos[0] = &bo;
|
exec_bos[0] = &bo;
|
||||||
exec2_objects[0].handle = bo.gem_handle;
|
exec2_objects[0].handle = bo.gem_handle;
|
||||||
|
@ -2063,7 +2063,7 @@ anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state,
|
||||||
.stride = stride);
|
.stride = stride);
|
||||||
|
|
||||||
if (!device->info.has_llc)
|
if (!device->info.has_llc)
|
||||||
anv_state_clflush(state);
|
anv_state_flush(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void anv_DestroySampler(
|
void anv_DestroySampler(
|
||||||
|
|
|
@ -575,7 +575,7 @@ anv_CreateImageView(VkDevice _device,
|
||||||
.mocs = device->default_mocs);
|
.mocs = device->default_mocs);
|
||||||
|
|
||||||
if (!device->info.has_llc)
|
if (!device->info.has_llc)
|
||||||
anv_state_clflush(iview->sampler_surface_state);
|
anv_state_flush(iview->sampler_surface_state);
|
||||||
} else {
|
} else {
|
||||||
iview->sampler_surface_state.alloc_size = 0;
|
iview->sampler_surface_state.alloc_size = 0;
|
||||||
}
|
}
|
||||||
|
@ -627,8 +627,8 @@ anv_CreateImageView(VkDevice _device,
|
||||||
&surface->isl, &iview->isl);
|
&surface->isl, &iview->isl);
|
||||||
|
|
||||||
if (!device->info.has_llc) {
|
if (!device->info.has_llc) {
|
||||||
anv_state_clflush(iview->storage_surface_state);
|
anv_state_flush(iview->storage_surface_state);
|
||||||
anv_state_clflush(iview->writeonly_storage_surface_state);
|
anv_state_flush(iview->writeonly_storage_surface_state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
iview->storage_surface_state.alloc_size = 0;
|
iview->storage_surface_state.alloc_size = 0;
|
||||||
|
|
|
@ -436,7 +436,7 @@ struct anv_state_stream {
|
||||||
#define CACHELINE_MASK 63
|
#define CACHELINE_MASK 63
|
||||||
|
|
||||||
static inline void
|
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 *p = (void *) (((uintptr_t) start) & ~CACHELINE_MASK);
|
||||||
void *end = start + size;
|
void *end = start + size;
|
||||||
|
@ -462,9 +462,9 @@ anv_invalidate_range(void *start, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void inline
|
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,
|
VkResult anv_block_pool_init(struct anv_block_pool *pool,
|
||||||
|
|
|
@ -91,7 +91,7 @@ gen7_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(scissor_state);
|
anv_state_flush(scissor_state);
|
||||||
}
|
}
|
||||||
#endif
|
#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);
|
GENX(COLOR_CALC_STATE_pack)(NULL, cc_state.map, &cc);
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
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) {
|
anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), ccp) {
|
||||||
ccp.ColorCalcStatePointer = cc_state.offset;
|
ccp.ColorCalcStatePointer = cc_state.offset;
|
||||||
|
|
|
@ -68,7 +68,7 @@ gen8_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
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,
|
anv_batch_emit(&cmd_buffer->batch,
|
||||||
GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP), clip) {
|
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)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(cc_state);
|
anv_state_flush(cc_state);
|
||||||
|
|
||||||
anv_batch_emit(&cmd_buffer->batch,
|
anv_batch_emit(&cmd_buffer->batch,
|
||||||
GENX(3DSTATE_VIEWPORT_STATE_POINTERS_CC), cc) {
|
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);
|
GENX(COLOR_CALC_STATE_pack)(NULL, cc_state.map, &cc);
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
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) {
|
anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), ccp) {
|
||||||
ccp.ColorCalcStatePointer = cc_state.offset;
|
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);
|
GEN9_COLOR_CALC_STATE_pack(NULL, cc_state.map, &cc);
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
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) {
|
anv_batch_emit(&cmd_buffer->batch, GEN9_3DSTATE_CC_STATE_POINTERS, ccp) {
|
||||||
ccp.ColorCalcStatePointer = cc_state.offset;
|
ccp.ColorCalcStatePointer = cc_state.offset;
|
||||||
|
|
|
@ -102,7 +102,7 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(bt_state);
|
anv_state_flush(bt_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -126,7 +126,7 @@ blorp_flush_range(struct blorp_batch *batch, void *start, size_t size)
|
||||||
{
|
{
|
||||||
struct anv_device *device = batch->blorp->driver_ctx;
|
struct anv_device *device = batch->blorp->driver_ctx;
|
||||||
if (!device->info.has_llc)
|
if (!device->info.has_llc)
|
||||||
anv_clflush_range(start, size);
|
anv_flush_range(start, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -580,7 +580,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
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:
|
out:
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(*bt_state);
|
anv_state_flush(*bt_state);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1334,7 +1334,7 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(*state);
|
anv_state_flush(*state);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
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;
|
((uint32_t *)id_state.map)[1] = base_instance;
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(id_state);
|
anv_state_flush(id_state);
|
||||||
|
|
||||||
emit_base_vertex_instance_bo(cmd_buffer,
|
emit_base_vertex_instance_bo(cmd_buffer,
|
||||||
&cmd_buffer->device->dynamic_state_block_pool.bo, id_state.offset);
|
&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;
|
((uint32_t *)state.map)[0] = draw_index;
|
||||||
|
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
if (!cmd_buffer->device->info.has_llc)
|
||||||
anv_state_clflush(state);
|
anv_state_flush(state);
|
||||||
|
|
||||||
emit_vertex_bo(cmd_buffer,
|
emit_vertex_bo(cmd_buffer,
|
||||||
&cmd_buffer->device->dynamic_state_block_pool.bo,
|
&cmd_buffer->device->dynamic_state_block_pool.bo,
|
||||||
|
@ -1947,7 +1947,7 @@ void genX(CmdDispatch)(
|
||||||
sizes[1] = y;
|
sizes[1] = y;
|
||||||
sizes[2] = z;
|
sizes[2] = z;
|
||||||
if (!cmd_buffer->device->info.has_llc)
|
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_offset = state.offset;
|
||||||
cmd_buffer->state.num_workgroups_bo =
|
cmd_buffer->state.num_workgroups_bo =
|
||||||
&cmd_buffer->device->dynamic_state_block_pool.bo;
|
&cmd_buffer->device->dynamic_state_block_pool.bo;
|
||||||
|
|
|
@ -977,7 +977,7 @@ emit_cb_state(struct anv_pipeline *pipeline,
|
||||||
|
|
||||||
GENX(BLEND_STATE_pack)(NULL, pipeline->blend_state.map, &blend_state);
|
GENX(BLEND_STATE_pack)(NULL, pipeline->blend_state.map, &blend_state);
|
||||||
if (!device->info.has_llc)
|
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) {
|
anv_batch_emit(&pipeline->batch, GENX(3DSTATE_BLEND_STATE_POINTERS), bsp) {
|
||||||
bsp.BlendStatePointer = pipeline->blend_state.offset;
|
bsp.BlendStatePointer = pipeline->blend_state.offset;
|
||||||
|
|
Loading…
Reference in New Issue