diff options
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_surface.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 1e1641daeec..b294cd85259 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -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; |