From: Marek Olšák <marek.ol...@amd.com>

It's always good to have fewer decompress blits.
---
 src/gallium/drivers/radeon/r600_texture.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 48ae788..f0c1bec 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -1274,42 +1274,52 @@ r600_texture_create_object(struct pipe_screen *screen,
 
        return rtex;
 }
 
 static enum radeon_surf_mode
 r600_choose_tiling(struct r600_common_screen *rscreen,
                   const struct pipe_resource *templ)
 {
        const struct util_format_description *desc = 
util_format_description(templ->format);
        bool force_tiling = templ->flags & R600_RESOURCE_FLAG_FORCE_TILING;
+       bool is_depth_stencil = util_format_is_depth_or_stencil(templ->format) 
&&
+                               !(templ->flags & 
R600_RESOURCE_FLAG_FLUSHED_DEPTH);
 
        /* MSAA resources must be 2D tiled. */
        if (templ->nr_samples > 1)
                return RADEON_SURF_MODE_2D;
 
        /* Transfer resources should be linear. */
        if (templ->flags & R600_RESOURCE_FLAG_TRANSFER)
                return RADEON_SURF_MODE_LINEAR_ALIGNED;
 
+       /* Avoid Z/S decompress blits by forcing TC-compatible HTILE on VI,
+        * which requires 2D tiling.
+        */
+       if (rscreen->chip_class == VI &&
+           is_depth_stencil &&
+           (templ->flags & PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY))
+               return RADEON_SURF_MODE_2D;
+
        /* r600g: force tiling on TEXTURE_2D and TEXTURE_3D compute resources. 
*/
        if (rscreen->chip_class >= R600 && rscreen->chip_class <= CAYMAN &&
            (templ->bind & PIPE_BIND_COMPUTE_RESOURCE) &&
            (templ->target == PIPE_TEXTURE_2D ||
             templ->target == PIPE_TEXTURE_3D))
                force_tiling = true;
 
        /* Handle common candidates for the linear mode.
         * Compressed textures and DB surfaces must always be tiled.
         */
-       if (!force_tiling && !util_format_is_compressed(templ->format) &&
-           (!util_format_is_depth_or_stencil(templ->format) ||
-            templ->flags & R600_RESOURCE_FLAG_FLUSHED_DEPTH)) {
+       if (!force_tiling &&
+           !is_depth_stencil &&
+           !util_format_is_compressed(templ->format)) {
                if (rscreen->debug_flags & DBG_NO_TILING)
                        return RADEON_SURF_MODE_LINEAR_ALIGNED;
 
                /* Tiling doesn't work with the 422 (SUBSAMPLED) formats on 
R600+. */
                if (desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED)
                        return RADEON_SURF_MODE_LINEAR_ALIGNED;
 
                /* Cursors are linear on SI.
                 * (XXX double-check, maybe also use RADEON_SURF_SCANOUT) */
                if (rscreen->chip_class >= SI &&
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to