- si_blit_decompress_zs_in_place(
- sctx, tex,
- levels_z, levels_s,
- first_layer, last_layer);
+ if (!tex->tc_compatible_htile) {
+ si_blit_decompress_zs_in_place(
+ sctx, tex,
+ levels_z, levels_s,
+ first_layer, last_layer);
+ }
+
+ /* Only in-place decompression needs to flush DB caches, or
+ * when we don't decompress but TC-compatible planes are dirty.
+ */
+ sctx->b.flags |= SI_CONTEXT_FLUSH_AND_INV_DB |
+ SI_CONTEXT_INV_GLOBAL_L2 |
+ SI_CONTEXT_INV_VMEM_L1;
+
+ /* If we flush DB caches for TC-compatible depth, the dirty
+ * state becomes 0 for the whole mipmap tree and all planes.
+ * (there is nothing else to flush)
+ */
+ if (tex->tc_compatible_htile) {
+ if (r600_can_sample_zs(tex, false))
+ tex->dirty_level_mask = 0;
+ if (r600_can_sample_zs(tex, true))
+ tex->stencil_dirty_level_mask = 0;
+ }