etnaviv: rs: flush TS cache before making configuration changes
authorLucas Stach <l.stach@pengutronix.de>
Thu, 8 Jun 2023 19:58:19 +0000 (21:58 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 9 Jun 2023 10:17:42 +0000 (10:17 +0000)
Move the TS cache flush into the same conditional block where
the TS setup is changed. TS cache always needs to be flushed
before making any changes to the TS setup.

CC: mesa-stable
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23530>

src/gallium/drivers/etnaviv/etnaviv_rs.c

index 83dc49f..4d15200 100644 (file)
@@ -745,9 +745,6 @@ etna_try_rs_blit(struct pipe_context *pctx,
       etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE,
                     VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_DEPTH);
       etna_stall(ctx->stream, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE);
-
-      if (src_lev->ts_size && src_lev->ts_valid)
-         etna_set_state(ctx->stream, VIVS_TS_FLUSH_CACHE, VIVS_TS_FLUSH_CACHE_FLUSH);
    }
 
    /* Set up color TS to source surface before blit, if needed */
@@ -758,6 +755,9 @@ etna_try_rs_blit(struct pipe_context *pctx,
          src_lev->ts_offset + blit_info->src.box.z * src_lev->ts_layer_stride;
       uint32_t ts_mem_config = 0;
 
+      /* flush TS cache before changing to another TS configuration */
+      etna_set_state(ctx->stream, VIVS_TS_FLUSH_CACHE, VIVS_TS_FLUSH_CACHE_FLUSH);
+
       if (src_lev->ts_compress_fmt >= 0) {
          ts_mem_config |= VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION |
                           VIVS_TS_MEM_CONFIG_COLOR_COMPRESSION_FORMAT(src_lev->ts_compress_fmt);