Mesa (master): ac/surface: match get_display_flag() with expectations for is_displayable

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 29 15:03:24 UTC 2020


Module: Mesa
Branch: master
Commit: 5d785f99b75c92220205862e7d6d4d4a2f503143
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5d785f99b75c92220205862e7d6d4d4a2f503143

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Apr 17 20:19:26 2020 -0400

ac/surface: match get_display_flag() with expectations for is_displayable

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4697>

---

 src/amd/common/ac_surface.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index 943a9e13708..d455a0f12e3 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -413,7 +413,9 @@ static bool get_display_flag(const struct ac_surf_config *config,
 	unsigned num_channels = config->info.num_channels;
 	unsigned bpe = surf->bpe;
 
-	if (!(surf->flags & RADEON_SURF_Z_OR_SBUFFER) &&
+	if (!config->is_3d &&
+	    !config->is_cube &&
+	    !(surf->flags & RADEON_SURF_Z_OR_SBUFFER) &&
 	    surf->flags & RADEON_SURF_SCANOUT &&
 	    config->info.samples <= 1 &&
 	    surf->blk_w <= 2 && surf->blk_h == 1) {
@@ -1612,6 +1614,7 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
 	surf->tc_compatible_htile_allowed = surf->htile_size != 0;
 
 	/* Query whether the surface is displayable. */
+	/* This is only useful for surfaces that are allocated without SCANOUT. */
 	bool displayable = false;
 	if (!config->is_3d && !config->is_cube) {
 		r = Addr2IsValidDisplaySwizzleMode(addrlib, surf->u.gfx9.surf.swizzle_mode,
@@ -1628,6 +1631,9 @@ static int gfx9_compute_surface(ADDR_HANDLE addrlib,
 	}
 	surf->is_displayable = displayable;
 
+	/* Validate that we allocated a displayable surface if requested. */
+	assert(!AddrSurfInfoIn.flags.display || surf->is_displayable);
+
 	switch (surf->u.gfx9.surf.swizzle_mode) {
 		/* S = standard. */
 		case ADDR_SW_256B_S:



More information about the mesa-commit mailing list