freedreno/a6xx: handle z24s8/z24x8 blits with u_blitter
authorRob Clark <robdclark@chromium.org>
Tue, 11 Jun 2019 17:38:19 +0000 (10:38 -0700)
committerRob Clark <robdclark@chromium.org>
Sat, 15 Jun 2019 14:33:04 +0000 (07:33 -0700)
Now that it can turn these blits into rendering to RB6_Z24_UNORM_S8_UINT
it can properly handle cases where only one of depth+stencil is being
blit.  And this avoids lying about he format, which completely doesn't
work when UBWC is used.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com>
src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
src/gallium/drivers/freedreno/a6xx/fd6_format.c

index a196a4c427ee3909fd7f085d611f8d99da485b08..3b7020510b06370382cf982967b1a84e5a2beb53 100644 (file)
@@ -638,32 +638,15 @@ handle_zs_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
                return do_rewritten_blit(ctx, &blit);
 
        case PIPE_FORMAT_Z24X8_UNORM:
-               blit.mask = PIPE_MASK_R;
-               blit.src.format = PIPE_FORMAT_R32_UINT;
-               blit.dst.format = PIPE_FORMAT_R32_UINT;
-               return do_rewritten_blit(ctx, &blit);
-
        case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-               switch (info->mask) {
-               case PIPE_MASK_ZS:
-                       blit.mask = PIPE_MASK_R;
-                       blit.src.format = PIPE_FORMAT_R32_UINT;
-                       blit.dst.format = PIPE_FORMAT_R32_UINT;
-                       return do_rewritten_blit(ctx, &blit);
-               case PIPE_MASK_Z:
-                       blit.mask = PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B;
-                       blit.src.format = PIPE_FORMAT_R8G8B8A8_UNORM;
-                       blit.dst.format = PIPE_FORMAT_R8G8B8A8_UNORM;
-                       return fd_blitter_blit(ctx, &blit);
-               case PIPE_MASK_S:
-                       blit.mask = PIPE_MASK_A;
-                       blit.src.format = PIPE_FORMAT_R8G8B8A8_UNORM;
-                       blit.dst.format = PIPE_FORMAT_R8G8B8A8_UNORM;
-                       return fd_blitter_blit(ctx, &blit);
-               default:
-                       unreachable("");
-               }
-               return true;
+               blit.mask = 0;
+               if (info->mask & PIPE_MASK_Z)
+                       blit.mask |= PIPE_MASK_R | PIPE_MASK_G | PIPE_MASK_B;
+               if (info->mask & PIPE_MASK_S)
+                       blit.mask |= PIPE_MASK_A;
+               blit.src.format = PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8;
+               blit.dst.format = PIPE_FORMAT_Z24_UNORM_S8_UINT_AS_R8G8B8A8;
+               return fd_blitter_blit(ctx, &blit);
 
        default:
                return false;
index 9448ff18e54329bf49df262bbf926fa25229fc06..492de2edfcd41392e39e733f2e080cd0541446ee 100644 (file)
@@ -222,6 +222,9 @@ static struct fd6_format formats[PIPE_FORMAT_COUNT] = {
        _T(Z32_FLOAT_S8X24_UINT, 32_FLOAT,  R32_FLOAT,     WZYX),
        _T(X32_S8X24_UINT,    8_UINT,      R8_UINT,        WZYX),
 
+       /* special format for blits: */
+       _T(Z24_UNORM_S8_UINT_AS_R8G8B8A8, Z24_UNORM_S8_UINT,  Z24_UNORM_S8_UINT,   WZYX),
+
        /* 48-bit */
        V_(R16G16B16_UNORM,   16_16_16_UNORM, NONE, WZYX),
        V_(R16G16B16_SNORM,   16_16_16_SNORM, NONE, WZYX),