Mesa (staging/20.1): ac/surface: don't free dcc_retile_map on failure

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 17 21:17:58 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: a1f46ab788b784c45f64da66c4f4989047535a9a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1f46ab788b784c45f64da66c4f4989047535a9a

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Thu Jun 11 05:00:44 2020 -0400

ac/surface: don't free dcc_retile_map on failure

because the hash table now owns it.

Fixes: bd553f0546d - ac/surface: cache DCC retile maps (v2)

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
(cherry picked from commit 0b3e344212698296d448a757aa5ca776b6cd3a42)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5422>

---

 .pick_status.json           |  2 +-
 src/amd/common/ac_surface.c | 13 ++++---------
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 3e22a091280..888b8577756 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1705,7 +1705,7 @@
         "description": "ac/surface: don't free dcc_retile_map on failure",
         "nominated": false,
         "nomination_type": 1,
-        "resolution": 4,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "bd553f0546dc361fc7e8abba649e1e9c9ea2010b"
     },
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index e0ab6cb42c8..252e703d377 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -1872,7 +1872,7 @@ static int gfx9_compute_surface(struct ac_addrlib *addrlib,
 	r = gfx9_compute_miptree(addrlib, info, config, surf, compressed,
 				 &AddrSurfInfoIn);
 	if (r)
-		goto error;
+		return r;
 
 	/* Calculate texture layout information for stencil. */
 	if (surf->flags & RADEON_SURF_SBUFFER) {
@@ -1884,14 +1884,14 @@ static int gfx9_compute_surface(struct ac_addrlib *addrlib,
 			r = gfx9_get_preferred_swizzle_mode(addrlib->handle, surf, &AddrSurfInfoIn,
 							    false, &AddrSurfInfoIn.swizzleMode);
 			if (r)
-				goto error;
+				return r;
 		} else
 			AddrSurfInfoIn.flags.depth = 0;
 
 		r = gfx9_compute_miptree(addrlib, info, config, surf, compressed,
 					 &AddrSurfInfoIn);
 		if (r)
-			goto error;
+			return r;
 	}
 
 	surf->is_linear = surf->u.gfx9.surf.swizzle_mode == ADDR_SW_LINEAR;
@@ -1903,7 +1903,7 @@ static int gfx9_compute_surface(struct ac_addrlib *addrlib,
 		r = Addr2IsValidDisplaySwizzleMode(addrlib->handle, surf->u.gfx9.surf.swizzle_mode,
 						   surf->bpe * 8, &displayable);
 		if (r)
-			goto error;
+			return r;
 
 		/* Display needs unaligned DCC. */
 		if (surf->num_dcc_levels &&
@@ -2006,11 +2006,6 @@ static int gfx9_compute_surface(struct ac_addrlib *addrlib,
 	}
 
 	return 0;
-
-error:
-	free(surf->u.gfx9.dcc_retile_map);
-	surf->u.gfx9.dcc_retile_map = NULL;
-	return r;
 }
 
 int ac_compute_surface(struct ac_addrlib *addrlib, const struct radeon_info *info,



More information about the mesa-commit mailing list