summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-02-20 11:04:12 -0800
committerJason Ekstrand <[email protected]>2017-02-21 12:26:35 -0800
commitf31ed6d0cd3c6b66304bb060a0c204ecf8621e6a (patch)
tree14a3f2ba7984256b209405d0a43993795b62358e /src
parentf408971deb7821cc140f1d373a104c2e1cb24eeb (diff)
anv: Take a device parameter in anv_state_flush
This allows the helper to check for llc instead of having to do it manually at all the call sites. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/anv_cmd_buffer.c12
-rw-r--r--src/intel/vulkan/anv_device.c6
-rw-r--r--src/intel/vulkan/anv_image.c9
-rw-r--r--src/intel/vulkan/anv_private.h15
-rw-r--r--src/intel/vulkan/gen7_cmd_buffer.c6
-rw-r--r--src/intel/vulkan/gen8_cmd_buffer.c12
-rw-r--r--src/intel/vulkan/genX_blorp_exec.c3
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c18
-rw-r--r--src/intel/vulkan/genX_pipeline.c3
9 files changed, 32 insertions, 52 deletions
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index e82cfd298cb..d7e50db1397 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -587,8 +587,7 @@ anv_cmd_buffer_emit_dynamic(struct anv_cmd_buffer *cmd_buffer,
state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, size, alignment);
memcpy(state.map, data, size);
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(state);
+ anv_state_flush(cmd_buffer->device, state);
VG(VALGRIND_CHECK_MEM_IS_DEFINED(state.map, size));
@@ -609,8 +608,7 @@ anv_cmd_buffer_merge_dynamic(struct anv_cmd_buffer *cmd_buffer,
for (uint32_t i = 0; i < dwords; i++)
p[i] = a[i] | b[i];
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(state);
+ anv_state_flush(cmd_buffer->device, state);
VG(VALGRIND_CHECK_MEM_IS_DEFINED(p, dwords * 4));
@@ -646,8 +644,7 @@ anv_cmd_buffer_push_constants(struct anv_cmd_buffer *cmd_buffer,
u32_map[i] = *(uint32_t *)((uint8_t *)data + offset);
}
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(state);
+ anv_state_flush(cmd_buffer->device, state);
return state;
}
@@ -706,8 +703,7 @@ anv_cmd_buffer_cs_push_constants(struct anv_cmd_buffer *cmd_buffer)
}
}
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(state);
+ anv_state_flush(cmd_buffer->device, state);
return state;
}
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index f52b42a542f..6f570d8f541 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -861,8 +861,7 @@ anv_state_pool_emit_data(struct anv_state_pool *pool, size_t size, size_t align,
state = anv_state_pool_alloc(pool, size, align);
memcpy(state.map, p, size);
- if (!pool->block_pool->device->info.has_llc)
- anv_state_flush(state);
+ anv_state_flush(pool->block_pool->device, state);
return state;
}
@@ -2055,8 +2054,7 @@ anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state,
.format = format,
.stride = stride);
- if (!device->info.has_llc)
- anv_state_flush(state);
+ anv_state_flush(device, state);
}
void anv_DestroySampler(
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index c0142c80c4d..e2f7ca340fd 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -574,8 +574,7 @@ anv_CreateImageView(VkDevice _device,
.aux_usage = surf_usage,
.mocs = device->default_mocs);
- if (!device->info.has_llc)
- anv_state_flush(iview->sampler_surface_state);
+ anv_state_flush(device, iview->sampler_surface_state);
} else {
iview->sampler_surface_state.alloc_size = 0;
}
@@ -626,10 +625,8 @@ anv_CreateImageView(VkDevice _device,
&iview->storage_image_param,
&surface->isl, &iview->isl);
- if (!device->info.has_llc) {
- anv_state_flush(iview->storage_surface_state);
- anv_state_flush(iview->writeonly_storage_surface_state);
- }
+ anv_state_flush(device, iview->storage_surface_state);
+ anv_state_flush(device, iview->writeonly_storage_surface_state);
} else {
iview->storage_surface_state.alloc_size = 0;
iview->writeonly_storage_surface_state.alloc_size = 0;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 7bf340b4339..2527c2cc5a2 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -461,12 +461,6 @@ anv_invalidate_range(void *start, size_t size)
__builtin_ia32_mfence();
}
-static void inline
-anv_state_flush(struct anv_state state)
-{
- anv_flush_range(state.map, state.alloc_size);
-}
-
VkResult anv_block_pool_init(struct anv_block_pool *pool,
struct anv_device *device, uint32_t block_size);
void anv_block_pool_finish(struct anv_block_pool *pool);
@@ -630,6 +624,15 @@ struct anv_device {
pthread_cond_t queue_submit;
};
+static void inline
+anv_state_flush(struct anv_device *device, struct anv_state state)
+{
+ if (device->info.has_llc)
+ return;
+
+ anv_flush_range(state.map, state.alloc_size);
+}
+
void anv_device_init_blorp(struct anv_device *device);
void anv_device_finish_blorp(struct anv_device *device);
diff --git a/src/intel/vulkan/gen7_cmd_buffer.c b/src/intel/vulkan/gen7_cmd_buffer.c
index 3f7376c9a7d..4ea3158a0f5 100644
--- a/src/intel/vulkan/gen7_cmd_buffer.c
+++ b/src/intel/vulkan/gen7_cmd_buffer.c
@@ -90,8 +90,7 @@ gen7_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer)
ssp.ScissorRectPointer = scissor_state.offset;
}
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(scissor_state);
+ anv_state_flush(cmd_buffer->device, scissor_state);
}
#endif
@@ -191,8 +190,7 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer)
.BackfaceStencilReferenceValue = d->stencil_reference.back & 0xff,
};
GENX(COLOR_CALC_STATE_pack)(NULL, cc_state.map, &cc);
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(cc_state);
+ anv_state_flush(cmd_buffer->device, 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 7c9bfd01cff..c891a76723d 100644
--- a/src/intel/vulkan/gen8_cmd_buffer.c
+++ b/src/intel/vulkan/gen8_cmd_buffer.c
@@ -67,8 +67,7 @@ gen8_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer)
&sf_clip_viewport);
}
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(sf_clip_state);
+ anv_state_flush(cmd_buffer->device, sf_clip_state);
anv_batch_emit(&cmd_buffer->batch,
GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP), clip) {
@@ -96,8 +95,7 @@ gen8_cmd_buffer_emit_depth_viewport(struct anv_cmd_buffer *cmd_buffer,
GENX(CC_VIEWPORT_pack)(NULL, cc_state.map + i * 8, &cc_viewport);
}
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(cc_state);
+ anv_state_flush(cmd_buffer->device, cc_state);
anv_batch_emit(&cmd_buffer->batch,
GENX(3DSTATE_VIEWPORT_STATE_POINTERS_CC), cc) {
@@ -473,8 +471,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_flush(cc_state);
+ anv_state_flush(cmd_buffer->device, cc_state);
anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_CC_STATE_POINTERS), ccp) {
ccp.ColorCalcStatePointer = cc_state.offset;
@@ -525,8 +522,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_flush(cc_state);
+ anv_state_flush(cmd_buffer->device, 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 b617e781573..c1499fbb727 100644
--- a/src/intel/vulkan/genX_blorp_exec.c
+++ b/src/intel/vulkan/genX_blorp_exec.c
@@ -101,8 +101,7 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries,
surface_maps[i] = surface_state.map;
}
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(bt_state);
+ anv_state_flush(cmd_buffer->device, bt_state);
}
static void *
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index ebf54fd9f18..7af2b316795 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -579,8 +579,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
}
}
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(state->render_pass_states);
+ anv_state_flush(cmd_buffer->device, state->render_pass_states);
}
}
@@ -1275,8 +1274,7 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
assert(image == map->image_count);
out:
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(*bt_state);
+ anv_state_flush(cmd_buffer->device, *bt_state);
return VK_SUCCESS;
}
@@ -1333,8 +1331,7 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer,
sampler->state, sizeof(sampler->state));
}
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(*state);
+ anv_state_flush(cmd_buffer->device, *state);
return VK_SUCCESS;
}
@@ -1652,8 +1649,7 @@ emit_base_vertex_instance(struct anv_cmd_buffer *cmd_buffer,
((uint32_t *)id_state.map)[0] = base_vertex;
((uint32_t *)id_state.map)[1] = base_instance;
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(id_state);
+ anv_state_flush(cmd_buffer->device, id_state);
emit_base_vertex_instance_bo(cmd_buffer,
&cmd_buffer->device->dynamic_state_block_pool.bo, id_state.offset);
@@ -1667,8 +1663,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_flush(state);
+ anv_state_flush(cmd_buffer->device, state);
emit_vertex_bo(cmd_buffer,
&cmd_buffer->device->dynamic_state_block_pool.bo,
@@ -1946,8 +1941,7 @@ void genX(CmdDispatch)(
sizes[0] = x;
sizes[1] = y;
sizes[2] = z;
- if (!cmd_buffer->device->info.has_llc)
- anv_state_flush(state);
+ anv_state_flush(cmd_buffer->device, 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 e461e6e3563..2a7e5527462 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -976,8 +976,7 @@ emit_cb_state(struct anv_pipeline *pipeline,
#endif
GENX(BLEND_STATE_pack)(NULL, pipeline->blend_state.map, &blend_state);
- if (!device->info.has_llc)
- anv_state_flush(pipeline->blend_state);
+ anv_state_flush(device, pipeline->blend_state);
anv_batch_emit(&pipeline->batch, GENX(3DSTATE_BLEND_STATE_POINTERS), bsp) {
bsp.BlendStatePointer = pipeline->blend_state.offset;