ac/surface: handle S8 on gfx9
authorDave Airlie <airlied@redhat.com>
Mon, 18 Sep 2017 03:17:33 +0000 (20:17 -0700)
committerDave Airlie <airlied@redhat.com>
Wed, 20 Sep 2017 05:32:05 +0000 (15:32 +1000)
If we don't have a depth piece, we don't get a correct
swizzle mode and we hit an assert in addrlib.

In case of no depth get the preferrred swizzle mode for
stencil alone.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_surface.c

index 88cc8a106814f3d7213480cd323562d6c6262e2d..850d70715e5b8ac8ef38fce87055680b506d860c 100644 (file)
@@ -1138,9 +1138,14 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
 
        /* Calculate texture layout information for stencil. */
        if (surf->flags & RADEON_SURF_SBUFFER) {
-               AddrSurfInfoIn.bpp = 8;
-               AddrSurfInfoIn.flags.depth = 0;
                AddrSurfInfoIn.flags.stencil = 1;
+               AddrSurfInfoIn.bpp = 8;
+
+               if (!AddrSurfInfoIn.flags.depth)
+                       r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn, false,
+                                                           &AddrSurfInfoIn.swizzleMode);
+               else
+                       AddrSurfInfoIn.flags.depth = 0;
 
                r = gfx9_compute_miptree(addrlib, surf, compressed, &AddrSurfInfoIn);
                if (r)