aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBlaž Tomažič <[email protected]>2020-05-06 21:34:10 +0200
committerMarek Olšák <[email protected]>2020-05-07 17:00:08 -0400
commit808eb20186a23be1a1917668e374243151e6699e (patch)
treeb3a1430542c29a81937b6e2d419e650119ba977d /src
parent37e89e30276724932328edb7b8bf4909606052d1 (diff)
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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4925>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_descriptors.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h3
-rw-r--r--src/gallium/drivers/radeonsi/si_texture.c17
3 files changed, 16 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 572523992cc..7e1218d5d30 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -835,7 +835,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 a5dbf655928..ae5a043e28f 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1496,7 +1496,8 @@ void si_init_viewport_functions(struct si_context *ctx);
bool si_prepare_for_dma_blit(struct si_context *sctx, struct si_texture *dst, unsigned dst_level,
unsigned dstx, unsigned dsty, unsigned dstz, 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, struct pipe_resource *texture);
void si_print_texture_info(struct si_screen *sscreen, struct si_texture *tex,
diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c
index d84261d48e1..ab2a234f16a 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -314,7 +314,8 @@ static int si_init_surface(struct si_screen *sscreen, struct radeon_surf *surfac
return 0;
}
-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;
@@ -326,8 +327,14 @@ void si_eliminate_fast_color_clear(struct si_context *sctx, struct si_texture *t
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);
@@ -705,9 +712,11 @@ static bool si_texture_get_handle(struct pipe_screen *screen, struct pipe_contex
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.