anv: Remove state flush.
authorRafael Antognolli <rafael.antognolli@intel.com>
Tue, 15 Jan 2019 23:48:43 +0000 (15:48 -0800)
committerRafael Antognolli <rafael.antognolli@intel.com>
Thu, 17 Jan 2019 23:08:22 +0000 (15:08 -0800)
We have all the state buffers snooped, so we don't need to clflush
everything anymore.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_blorp.c
src/intel/vulkan/anv_cmd_buffer.c
src/intel/vulkan/anv_device.c
src/intel/vulkan/anv_image.c
src/intel/vulkan/anv_private.h
src/intel/vulkan/gen7_cmd_buffer.c
src/intel/vulkan/gen8_cmd_buffer.c
src/intel/vulkan/genX_blorp_exec.c
src/intel/vulkan/genX_cmd_buffer.c
src/intel/vulkan/genX_pipeline.c

index 1be0e5a8b78e15d84659b0f3c52bcf94996866de..67e8d5abb042033a3444a0be4568311d4b88bd4c 100644 (file)
@@ -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,
index 8ef71b0ed9cfc387c33c0ffb87d76059f32df9f6..67e777b74b377886b28f6956669b5c8f5113c459 100644 (file)
@@ -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;
 }
 
index add0c498ac2db74cd8786906a57fe9f8ad4d9798..45b1ca868598d78cff52f349f691b29bc0fff5c3 100644 (file)
@@ -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(
index 3a672c24b21a247fcc0add393d66ae0bdaa0158d..3999c7399d04d36461c48b2678cc5ea49174f186 100644 (file)
@@ -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,
index cf0ec1dc8c6f1cbe903e7952839dc334bf1a22cd..ca1099591351918cf5e4571f6ddc5e9fdfa2daea 100644 (file)
@@ -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);
 
index 08bebd44adbfa83d50cdf469f8415320a8dc1a03..352892aee33fdc7038e307ae852baceeaf38bd45 100644 (file)
@@ -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;
index 6b6791eca4f59a8c72c5864bf8e71edc60d76b16..6568d2c75113d7e790d6938230dbd75883397af6 100644 (file)
@@ -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;
index 25d19deabfe12b510834bd294285123889a284fc..6b1f471850d5be4eb194d0a4166b060596f339e3 100644 (file)
@@ -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
index 85187deee6a6c9281b8c77ca4846422a5d42cf6f..6fb19661ebba5d0d39409dcaeb8ec1fb45173190 100644 (file)
@@ -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,
index e52e5d8304ac50ec34b3a977d713bf43b302f066..76766a89258cf05a8da25018d648600d0306c7cf 100644 (file)
@@ -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;