iris: Flush caches based on brw_compiler::indirect_ubos_use_sampler

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7230>
This commit is contained in:
Jason Ekstrand 2020-10-19 22:33:05 -05:00 committed by Marge Bot
parent fa483d8cd1
commit cdc546ae7f
4 changed files with 17 additions and 9 deletions

View File

@ -171,12 +171,14 @@ iris_upload_ubo_ssbo_surf_state(struct iris_context *ice,
struct iris_bo *surf_bo = iris_resource_bo(surf_state->res); struct iris_bo *surf_bo = iris_resource_bo(surf_state->res);
surf_state->offset += iris_bo_offset_from_base_address(surf_bo); surf_state->offset += iris_bo_offset_from_base_address(surf_bo);
const bool dataport = ssbo || !screen->compiler->indirect_ubos_use_sampler;
isl_buffer_fill_state(&screen->isl_dev, map, isl_buffer_fill_state(&screen->isl_dev, map,
.address = res->bo->gtt_offset + res->offset + .address = res->bo->gtt_offset + res->offset +
buf->buffer_offset, buf->buffer_offset,
.size_B = buf->buffer_size - res->offset, .size_B = buf->buffer_size - res->offset,
.format = ssbo ? ISL_FORMAT_RAW .format = dataport ? ISL_FORMAT_RAW
: ISL_FORMAT_R32G32B32A32_FLOAT, : ISL_FORMAT_R32G32B32A32_FLOAT,
.swizzle = ISL_SWIZZLE_IDENTITY, .swizzle = ISL_SWIZZLE_IDENTITY,
.stride_B = 1, .stride_B = 1,
.mocs = iris_mocs(res->bo, &screen->isl_dev, usage)); .mocs = iris_mocs(res->bo, &screen->isl_dev, usage));

View File

@ -1984,7 +1984,7 @@ iris_transfer_flush_region(struct pipe_context *ctx,
history_flush |= PIPE_CONTROL_RENDER_TARGET_FLUSH; history_flush |= PIPE_CONTROL_RENDER_TARGET_FLUSH;
if (map->dest_had_defined_contents) if (map->dest_had_defined_contents)
history_flush |= iris_flush_bits_for_history(res); history_flush |= iris_flush_bits_for_history(ice, res);
util_range_add(&res->base, &res->valid_buffer_range, box->x, box->x + box->width); util_range_add(&res->base, &res->valid_buffer_range, box->x, box->x + box->width);
} }
@ -2132,13 +2132,18 @@ iris_dirty_for_history(struct iris_context *ice,
* resource becomes visible, and any stale read cache data is invalidated. * resource becomes visible, and any stale read cache data is invalidated.
*/ */
uint32_t uint32_t
iris_flush_bits_for_history(struct iris_resource *res) iris_flush_bits_for_history(struct iris_context *ice,
struct iris_resource *res)
{ {
struct iris_screen *screen = (struct iris_screen *) ice->ctx.screen;
uint32_t flush = PIPE_CONTROL_CS_STALL; uint32_t flush = PIPE_CONTROL_CS_STALL;
if (res->bind_history & PIPE_BIND_CONSTANT_BUFFER) { if (res->bind_history & PIPE_BIND_CONSTANT_BUFFER) {
flush |= PIPE_CONTROL_CONST_CACHE_INVALIDATE | flush |= PIPE_CONTROL_CONST_CACHE_INVALIDATE;
PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE; flush |= screen->compiler->indirect_ubos_use_sampler ?
PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE :
PIPE_CONTROL_DATA_CACHE_FLUSH;
} }
if (res->bind_history & PIPE_BIND_SAMPLER_VIEW) if (res->bind_history & PIPE_BIND_SAMPLER_VIEW)
@ -2163,7 +2168,7 @@ iris_flush_and_dirty_for_history(struct iris_context *ice,
if (res->base.target != PIPE_BUFFER) if (res->base.target != PIPE_BUFFER)
return; return;
uint32_t flush = iris_flush_bits_for_history(res) | extra_flags; uint32_t flush = iris_flush_bits_for_history(ice, res) | extra_flags;
iris_emit_pipe_control_flush(batch, reason, flush); iris_emit_pipe_control_flush(batch, reason, flush);

View File

@ -320,7 +320,8 @@ void iris_init_screen_resource_functions(struct pipe_screen *pscreen);
void iris_dirty_for_history(struct iris_context *ice, void iris_dirty_for_history(struct iris_context *ice,
struct iris_resource *res); struct iris_resource *res);
uint32_t iris_flush_bits_for_history(struct iris_resource *res); uint32_t iris_flush_bits_for_history(struct iris_context *ice,
struct iris_resource *res);
void iris_flush_and_dirty_for_history(struct iris_context *ice, void iris_flush_and_dirty_for_history(struct iris_context *ice,
struct iris_batch *batch, struct iris_batch *batch,

View File

@ -3684,7 +3684,7 @@ iris_set_stream_output_targets(struct pipe_context *ctx,
if (tgt) { if (tgt) {
struct iris_resource *res = (void *) tgt->base.buffer; struct iris_resource *res = (void *) tgt->base.buffer;
flush |= iris_flush_bits_for_history(res); flush |= iris_flush_bits_for_history(ice, res);
iris_dirty_for_history(ice, res); iris_dirty_for_history(ice, res);
} }
} }