From 643248b66a265242ef3de3dffdae79e1283eee31 Mon Sep 17 00:00:00 2001 From: Rafael Antognolli Date: Tue, 15 Jan 2019 15:48:43 -0800 Subject: [PATCH] anv: Remove state flush. We have all the state buffers snooped, so we don't need to clflush everything anymore. Reviewed-by: Jason Ekstrand --- src/intel/vulkan/anv_blorp.c | 2 -- src/intel/vulkan/anv_cmd_buffer.c | 8 -------- src/intel/vulkan/anv_device.c | 4 ---- src/intel/vulkan/anv_image.c | 2 -- src/intel/vulkan/anv_private.h | 9 --------- src/intel/vulkan/gen7_cmd_buffer.c | 3 --- src/intel/vulkan/gen8_cmd_buffer.c | 8 -------- src/intel/vulkan/genX_blorp_exec.c | 7 ++----- src/intel/vulkan/genX_cmd_buffer.c | 9 --------- src/intel/vulkan/genX_pipeline.c | 1 - 10 files changed, 2 insertions(+), 51 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 1be0e5a8b78..67e8d5abb04 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -718,8 +718,6 @@ void anv_CmdUpdateBuffer( memcpy(tmp_data.map, pData, copy_size); - anv_state_flush(cmd_buffer->device, tmp_data); - struct blorp_address src = { .buffer = cmd_buffer->device->dynamic_state_pool.block_pool.bo, .offset = tmp_data.offset, diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 8ef71b0ed9c..67e777b74b3 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -671,8 +671,6 @@ 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); - anv_state_flush(cmd_buffer->device, state); - VG(VALGRIND_CHECK_MEM_IS_DEFINED(state.map, size)); return state; @@ -692,8 +690,6 @@ 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]; - anv_state_flush(cmd_buffer->device, state); - VG(VALGRIND_CHECK_MEM_IS_DEFINED(p, dwords * 4)); return state; @@ -754,8 +750,6 @@ anv_cmd_buffer_push_constants(struct anv_cmd_buffer *cmd_buffer, for (unsigned i = 0; i < prog_data->nr_params; i++) u32_map[i] = anv_push_constant_value(data, prog_data->param[i]); - anv_state_flush(cmd_buffer->device, state); - return state; } @@ -810,8 +804,6 @@ anv_cmd_buffer_cs_push_constants(struct anv_cmd_buffer *cmd_buffer) } } - 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 add0c498ac2..45b1ca86859 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1512,8 +1512,6 @@ 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); - anv_state_flush(pool->block_pool.device, state); - return state; } @@ -3073,8 +3071,6 @@ anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state, .size_B = range, .format = format, .stride_B = stride); - - 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 3a672c24b21..3999c7399d0 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -1327,8 +1327,6 @@ anv_image_fill_surface_state(struct anv_device *device, } } - anv_state_flush(device, state_inout->state); - if (image_param_out) { assert(view_usage == ISL_SURF_USAGE_STORAGE_BIT); isl_surf_fill_image_param(&device->isl_dev, image_param_out, diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index cf0ec1dc8c6..ca109959135 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1125,15 +1125,6 @@ anv_mocs_for_bo(const struct anv_device *device, const struct anv_bo *bo) return device->default_mocs; } -static void inline -anv_state_flush(struct anv_device *device, struct anv_state state) -{ - if (device->info.has_llc) - return; - - gen_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 08bebd44adb..352892aee33 100644 --- a/src/intel/vulkan/gen7_cmd_buffer.c +++ b/src/intel/vulkan/gen7_cmd_buffer.c @@ -90,8 +90,6 @@ gen7_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer) GEN7_3DSTATE_SCISSOR_STATE_POINTERS, ssp) { ssp.ScissorRectPointer = scissor_state.offset; } - - anv_state_flush(cmd_buffer->device, scissor_state); } #endif @@ -191,7 +189,6 @@ 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); - 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 6b6791eca4f..6568d2c7511 100644 --- a/src/intel/vulkan/gen8_cmd_buffer.c +++ b/src/intel/vulkan/gen8_cmd_buffer.c @@ -68,8 +68,6 @@ gen8_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer) &sf_clip_viewport); } - anv_state_flush(cmd_buffer->device, sf_clip_state); - anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP), clip) { clip.SFClipViewportPointer = sf_clip_state.offset; @@ -97,8 +95,6 @@ gen8_cmd_buffer_emit_depth_viewport(struct anv_cmd_buffer *cmd_buffer, GENX(CC_VIEWPORT_pack)(NULL, cc_state.map + i * 8, &cc_viewport); } - anv_state_flush(cmd_buffer->device, cc_state); - anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_CC), cc) { cc.CCViewportPointer = cc_state.offset; @@ -441,8 +437,6 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) }; GENX(COLOR_CALC_STATE_pack)(NULL, cc_state.map, &cc); - 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; ccp.ColorCalcStatePointerValid = true; @@ -491,8 +485,6 @@ genX(cmd_buffer_flush_dynamic_state)(struct anv_cmd_buffer *cmd_buffer) }; GENX(COLOR_CALC_STATE_pack)(NULL, cc_state.map, &cc); - 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; ccp.ColorCalcStatePointerValid = true; diff --git a/src/intel/vulkan/genX_blorp_exec.c b/src/intel/vulkan/genX_blorp_exec.c index 25d19deabfe..6b1f471850d 100644 --- a/src/intel/vulkan/genX_blorp_exec.c +++ b/src/intel/vulkan/genX_blorp_exec.c @@ -132,8 +132,6 @@ blorp_alloc_binding_table(struct blorp_batch *batch, unsigned num_entries, surface_offsets[i] = surface_state.offset; surface_maps[i] = surface_state.map; } - - anv_state_flush(cmd_buffer->device, bt_state); } static void * @@ -191,9 +189,8 @@ blorp_get_workaround_page(struct blorp_batch *batch) static void 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) - gen_flush_range(start, size); + /* We don't need to flush states anymore, since everything will be snooped. + */ } static void diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 85187deee6a..6fb19661ebb 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2251,8 +2251,6 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, assert(image == map->image_count); out: - anv_state_flush(cmd_buffer->device, *bt_state); - #if GEN_GEN >= 11 /* The PIPE_CONTROL command description says: * @@ -2324,8 +2322,6 @@ emit_samplers(struct anv_cmd_buffer *cmd_buffer, sampler->state[binding->plane], sizeof(sampler->state[0])); } - anv_state_flush(cmd_buffer->device, *state); - return VK_SUCCESS; } @@ -2741,8 +2737,6 @@ 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; - anv_state_flush(cmd_buffer->device, id_state); - struct anv_address addr = { .bo = cmd_buffer->device->dynamic_state_pool.block_pool.bo, .offset = id_state.offset, @@ -2759,8 +2753,6 @@ emit_draw_index(struct anv_cmd_buffer *cmd_buffer, uint32_t draw_index) ((uint32_t *)state.map)[0] = draw_index; - anv_state_flush(cmd_buffer->device, state); - struct anv_address addr = { .bo = cmd_buffer->device->dynamic_state_pool.block_pool.bo, .offset = state.offset, @@ -3222,7 +3214,6 @@ void genX(CmdDispatchBase)( sizes[0] = groupCountX; sizes[1] = groupCountY; sizes[2] = groupCountZ; - anv_state_flush(cmd_buffer->device, state); cmd_buffer->state.compute.num_workgroups = (struct anv_address) { .bo = cmd_buffer->device->dynamic_state_pool.block_pool.bo, .offset = state.offset, diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index e52e5d8304a..76766a89258 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -1055,7 +1055,6 @@ emit_cb_state(struct anv_pipeline *pipeline, #endif GENX(BLEND_STATE_pack)(NULL, pipeline->blend_state.map, &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; -- 2.30.2