radeonsi: Fix omitted flush when moving suballocated texture
Fixes: 5e805cc74b
"radeonsi: flush the context after resource_copy_region for buffer exports"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4925>
This commit is contained in:

committed by
Marek Olšák

parent
37e89e3027
commit
808eb20186
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user