Mesa (staging/20.0): radeonsi: Fix omitted flush when moving suballocated texture
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 11 17:22:55 UTC 2020
Module: Mesa
Branch: staging/20.0
Commit: f2237b1381498a0c0d5c319f83af116429155151
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2237b1381498a0c0d5c319f83af116429155151
Author: Blaž Tomažič <blaz.tomazic at gmail.com>
Date: Wed May 6 21:34:10 2020 +0200
radeonsi: Fix omitted flush when moving suballocated texture
Fixes: 5e805cc74bc52f97de8f6308fc06bc96623e7e09 "radeonsi: flush the context after resource_copy_region for buffer exports"
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4925>
(cherry picked from commit 808eb20186a23be1a1917668e374243151e6699e)
---
.pick_status.json | 2 +-
src/gallium/drivers/radeonsi/si_descriptors.c | 2 +-
src/gallium/drivers/radeonsi/si_pipe.h | 4 ++--
src/gallium/drivers/radeonsi/si_texture.c | 18 +++++++++++++-----
4 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index bf11a0695a1..8d6a7180ea0 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -112,7 +112,7 @@
"description": "radeonsi: Fix omitted flush when moving suballocated texture",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "5e805cc74bc52f97de8f6308fc06bc96623e7e09"
},
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index ea53697c503..bf2717a571e 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -916,7 +916,7 @@ void si_update_ps_colorbuf0_slot(struct si_context *sctx)
if (tex->buffer.b.b.nr_samples <= 1 && tex->cmask_buffer) {
/* Disable CMASK. */
assert(tex->cmask_buffer != &tex->buffer);
- si_eliminate_fast_color_clear(sctx, tex);
+ si_eliminate_fast_color_clear(sctx, tex, NULL);
si_texture_discard_cmask(sctx->screen, tex);
}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 5c349fb322d..772e2443881 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1536,8 +1536,8 @@ bool si_prepare_for_dma_blit(struct si_context *sctx,
struct si_texture *src,
unsigned src_level,
const struct pipe_box *src_box);
-void si_eliminate_fast_color_clear(struct si_context *sctx,
- struct si_texture *tex);
+void si_eliminate_fast_color_clear(struct si_context *sctx, struct si_texture *tex,
+ bool *ctx_flushed);
void si_texture_discard_cmask(struct si_screen *sscreen,
struct si_texture *tex);
bool si_init_flushed_depth_texture(struct pipe_context *ctx,
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index cfe5d41fadd..593b013d64a 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -406,8 +406,8 @@ static void si_get_display_metadata(struct si_screen *sscreen,
}
}
-void si_eliminate_fast_color_clear(struct si_context *sctx,
- struct si_texture *tex)
+void si_eliminate_fast_color_clear(struct si_context *sctx, struct si_texture *tex,
+ bool *ctx_flushed)
{
struct si_screen *sscreen = sctx->screen;
struct pipe_context *ctx = &sctx->b;
@@ -419,8 +419,14 @@ void si_eliminate_fast_color_clear(struct si_context *sctx,
ctx->flush_resource(ctx, &tex->buffer.b.b);
/* Flush only if any fast clear elimination took place. */
+ bool flushed = false;
if (n != sctx->num_decompress_calls)
+ {
ctx->flush(ctx, NULL, 0);
+ flushed = true;
+ }
+ if (ctx_flushed)
+ *ctx_flushed = flushed;
if (ctx == sscreen->aux_context)
simple_mtx_unlock(&sscreen->aux_context_lock);
@@ -1029,9 +1035,11 @@ static bool si_texture_get_handle(struct pipe_screen* screen,
if (!(usage & PIPE_HANDLE_USAGE_EXPLICIT_FLUSH) &&
(tex->cmask_buffer || tex->surface.dcc_offset)) {
/* Eliminate fast clear (both CMASK and DCC) */
- si_eliminate_fast_color_clear(sctx, tex);
- /* eliminate_fast_color_clear flushes the context */
- flush = false;
+ bool flushed;
+ si_eliminate_fast_color_clear(sctx, tex, &flushed);
+ /* eliminate_fast_color_clear sometimes flushes the context */
+ if (flushed)
+ flush = false;
/* Disable CMASK if flush_resource isn't going
* to be called.
More information about the mesa-commit
mailing list