Module: Mesa
Branch: staging/21.2
Commit: ccf0bd1aa64b2a806baa1429bd3b4ce33f2f8dc5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ccf0bd1aa64b2a806baa1429bd3b4ce33f2f8dc5

Author: Marek Olšák <[email protected]>
Date:   Sat Sep 25 04:53:47 2021 -0400

radeonsi: fix a depth texturing performance regression on gfx6-7

Fixes: 0580d4c1 "radeonsi: enable HTILE with mipmapping on gfx9+"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5398

Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13048>
(cherry picked from commit 4cb008719c0fc9705dd16416e99ff7ae1b3a7fa1)

---

 .pick_status.json                      |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.h | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 99b326999f4..b388dd10967 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -229,7 +229,7 @@
         "description": "radeonsi: fix a depth texturing performance regression 
on gfx6-7",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "0580d4c1a25b75616d1b8732624bf63a27a929a9"
     },
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h 
b/src/gallium/drivers/radeonsi/si_pipe.h
index e385c57b394..78efb52464f 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1856,7 +1856,19 @@ static inline bool si_htile_enabled(struct si_texture 
*tex, unsigned level, unsi
    if (zs_mask == PIPE_MASK_S && (tex->htile_stencil_disabled || 
!tex->surface.has_stencil))
       return false;
 
-   return tex->is_depth && tex->surface.meta_offset && level < 
tex->surface.num_meta_levels;
+   if (!tex->is_depth || !tex->surface.meta_offset)
+      return false;
+
+   struct si_screen *sscreen = (struct si_screen *)tex->buffer.b.b.screen;
+   if (sscreen->info.chip_class >= GFX8) {
+      return level < tex->surface.num_meta_levels;
+   } else {
+      /* GFX6-7 don't have TC-compatible HTILE, which means they have to run
+       * a decompression pass for every mipmap level before texturing, so 
compress
+       * only one level to reduce the number of decompression passes to a 
minimum.
+       */
+      return level == 0;
+   }
 }
 
 static inline bool vi_tc_compat_htile_enabled(struct si_texture *tex, unsigned 
level,

Reply via email to