ac/surface/gfx9: request desired micro tile mode explicitly
authorMarek Olšák <marek.olsak@amd.com>
Mon, 2 Apr 2018 16:54:52 +0000 (12:54 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 10 Apr 2018 16:44:41 +0000 (12:44 -0400)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/amd/common/ac_surface.c

index 1e1641daeec28378edf7209eab24ca031e274c84..b294cd85259a9c5386fe7fd8f2ccd5e5256dc703 100644 (file)
@@ -814,7 +814,8 @@ static int gfx6_compute_surface(ADDR_HANDLE addrlib,
 static int
 gfx9_get_preferred_swizzle_mode(ADDR_HANDLE addrlib,
                                ADDR2_COMPUTE_SURFACE_INFO_INPUT *in,
-                               bool is_fmask, AddrSwizzleMode *swizzle_mode)
+                               bool is_fmask, unsigned flags,
+                               AddrSwizzleMode *swizzle_mode)
 {
        ADDR_E_RETURNCODE ret;
        ADDR2_GET_PREFERRED_SURF_SETTING_INPUT sin = {0};
@@ -839,6 +840,13 @@ gfx9_get_preferred_swizzle_mode(ADDR_HANDLE addrlib,
        sin.numSamples = in->numSamples;
        sin.numFrags = in->numFrags;
 
+       if (flags & RADEON_SURF_SCANOUT)
+               sin.preferredSwSet.sw_D = 1;
+       else if (in->flags.depth || in->flags.stencil || is_fmask)
+               sin.preferredSwSet.sw_Z = 1;
+       else
+               sin.preferredSwSet.sw_S = 1;
+
        if (is_fmask) {
                sin.flags.color = 0;
                sin.flags.fmask = 1;
@@ -1036,7 +1044,9 @@ static int gfx9_compute_miptree(ADDR_HANDLE addrlib,
                        fin.size = sizeof(ADDR2_COMPUTE_FMASK_INFO_INPUT);
                        fout.size = sizeof(ADDR2_COMPUTE_FMASK_INFO_OUTPUT);
 
-                       ret = gfx9_get_preferred_swizzle_mode(addrlib, in, true, &fin.swizzleMode);
+                       ret = gfx9_get_preferred_swizzle_mode(addrlib, in,
+                                                             true, surf->flags,
+                                                             &fin.swizzleMode);
                        if (ret != ADDR_OK)
                                return ret;
 
@@ -1232,7 +1242,8 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
                        break;
                }
 
-               r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn, false,
+               r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn,
+                                                   false, surf->flags,
                                                    &AddrSurfInfoIn.swizzleMode);
                if (r)
                        return r;
@@ -1268,7 +1279,8 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
                AddrSurfInfoIn.format = ADDR_FMT_8;
 
                if (!AddrSurfInfoIn.flags.depth) {
-                       r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn, false,
+                       r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn,
+                                                           false, surf->flags,
                                                            &AddrSurfInfoIn.swizzleMode);
                        if (r)
                                return r;