From 94b9f50e63c5094ab3784bc6a310c500e5218a2d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 17 Jun 2019 09:39:46 -0500 Subject: [PATCH] iris: Be more aggressive at post-format-reintepret TC invalidate hack When copying/blitting with format reinterpretation, we invalidate the texture cache before/after. Before is so the source of the copy works, and after is to get rid of our new data in the "wrong" format to protect future attempts to sample. When I ported these hacks to iris, I tried to be cautious by only bothering with the hacks if the batch referenced the BO. This makes some sense for the before case. If it isn't referenced, the texture cache can't really have any data for the BO (since it's also invalidated between batches). But we still need to do the after case regardless, as we've just polluted the cache with hazardous entries. --- src/gallium/drivers/iris/iris_blit.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c index 0ee2046481b..5861c965c06 100644 --- a/src/gallium/drivers/iris/iris_blit.c +++ b/src/gallium/drivers/iris/iris_blit.c @@ -423,10 +423,9 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info) filter = BLORP_FILTER_NEAREST; } - bool flush_hack = src_fmt.fmt != src_res->surf.format && - iris_batch_references(batch, src_res->bo); + bool format_mismatch = src_fmt.fmt != src_res->surf.format; - if (flush_hack) + if (format_mismatch && iris_batch_references(batch, src_res->bo)) tex_cache_flush_hack(batch); if (dst_res->base.target == PIPE_BUFFER) @@ -483,7 +482,7 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info) blorp_batch_finish(&blorp_batch); - if (flush_hack) + if (format_mismatch) tex_cache_flush_hack(batch); iris_resource_finish_write(ice, dst_res, info->dst.level, info->dst.box.z, @@ -549,8 +548,7 @@ iris_copy_region(struct blorp_context *blorp, get_copy_region_aux_settings(devinfo, dst_res, &dst_aux_usage, &dst_clear_supported); - bool flush_hack = iris_batch_references(batch, src_res->bo); - if (flush_hack) + if (iris_batch_references(batch, src_res->bo)) tex_cache_flush_hack(batch); if (dst->target == PIPE_BUFFER) @@ -605,8 +603,7 @@ iris_copy_region(struct blorp_context *blorp, src_box->depth, dst_aux_usage); } - if (flush_hack) - tex_cache_flush_hack(batch); + tex_cache_flush_hack(batch); } -- 2.30.2