[Mesa-dev] [PATCH] ac/surface: handle error when choosing preferred swizzle mode

Nicolai Hähnle nhaehnle at gmail.com
Wed Sep 20 14:47:44 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

CID: 1418140
Fixes: c4ac522511d2 ("ac/surface: handle S8 on gfx9")
---
 src/amd/common/ac_surface.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index 850d70715e5..22c653f0c4f 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -1134,24 +1134,26 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
 	/* Calculate texture layout information. */
 	r = gfx9_compute_miptree(addrlib, surf, compressed, &AddrSurfInfoIn);
 	if (r)
 		return r;
 
 	/* Calculate texture layout information for stencil. */
 	if (surf->flags & RADEON_SURF_SBUFFER) {
 		AddrSurfInfoIn.flags.stencil = 1;
 		AddrSurfInfoIn.bpp = 8;
 
-		if (!AddrSurfInfoIn.flags.depth)
+		if (!AddrSurfInfoIn.flags.depth) {
 			r = gfx9_get_preferred_swizzle_mode(addrlib, &AddrSurfInfoIn, false,
 							    &AddrSurfInfoIn.swizzleMode);
-		else
+			if (r)
+				return r;
+		} else
 			AddrSurfInfoIn.flags.depth = 0;
 
 		r = gfx9_compute_miptree(addrlib, surf, compressed, &AddrSurfInfoIn);
 		if (r)
 			return r;
 	}
 
 	surf->is_linear = surf->u.gfx9.surf.swizzle_mode == ADDR_SW_LINEAR;
 
 	switch (surf->u.gfx9.surf.swizzle_mode) {
-- 
2.11.0



More information about the mesa-dev mailing list