Mesa (master): freedreno: Add perf_warn() for missed UBWC opportunities

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 23 18:41:49 UTC 2021


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Fri Jan 22 09:19:09 2021 -0800

freedreno: Add perf_warn() for missed UBWC opportunities

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8659>

---

 src/gallium/drivers/freedreno/a6xx/fd6_resource.c  | 12 +++++++++++
 src/gallium/drivers/freedreno/freedreno_resource.c | 25 +++++++++++++++++-----
 src/gallium/drivers/freedreno/freedreno_util.h     |  2 +-
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c
index 751a0880bb4..c7e8b217973 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_resource.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_resource.c
@@ -118,6 +118,9 @@ fd6_validate_format(struct fd_context *ctx, struct fd_resource *rsc,
 	if (ok_ubwc_format(rsc->base.screen, format))
 		return;
 
+	perf_debug_ctx(ctx, "%"PRSC_FMT": demoted to uncompressed due to use as %s",
+		PRSC_ARGS(&rsc->base), util_format_short_name(format));
+
 	fd_resource_uncompress(ctx, rsc);
 }
 
@@ -203,7 +206,16 @@ fd6_layout_resource_for_modifier(struct fd_resource *rsc, uint64_t modifier)
 	case DRM_FORMAT_MOD_QCOM_COMPRESSED:
 		return fill_ubwc_buffer_sizes(rsc);
 	case DRM_FORMAT_MOD_LINEAR:
+		if (can_do_ubwc(&rsc->base)) {
+			perf_debug("%"PRSC_FMT": not UBWC: imported with DRM_FORMAT_MOD_LINEAR!",
+					PRSC_ARGS(&rsc->base));
+		}
+		return 0;
 	case DRM_FORMAT_MOD_INVALID:
+		if (can_do_ubwc(&rsc->base)) {
+			perf_debug("%"PRSC_FMT": not UBWC: imported with DRM_FORMAT_MOD_INVALID!",
+					PRSC_ARGS(&rsc->base));
+		}
 		return 0;
 	default:
 		return -1;
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 442c3d2a7b1..84335c004e9 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -454,6 +454,7 @@ fd_alloc_staging(struct fd_context *ctx, struct fd_resource *rsc,
 	}
 	tmpl.last_level = 0;
 	tmpl.bind |= PIPE_BIND_LINEAR;
+	tmpl.usage = PIPE_USAGE_STAGING;
 
 	struct pipe_resource *pstaging =
 		pctx->screen->resource_create(pctx->screen, &tmpl);
@@ -911,8 +912,13 @@ fd_resource_allocate_and_resolve(struct pipe_screen *pscreen,
 	 PIPE_BIND_DISPLAY_TARGET)
 
 	bool linear = drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count);
-	if (tmpl->bind & LINEAR)
+	if (linear) {
+		perf_debug("%"PRSC_FMT": linear: DRM_FORMAT_MOD_LINEAR requested!", PRSC_ARGS(prsc));
+	} else if (tmpl->bind & LINEAR) {
+		if (tmpl->usage != PIPE_USAGE_STAGING)
+			perf_debug("%"PRSC_FMT": linear: LINEAR bind requested!", PRSC_ARGS(prsc));
 		linear = true;
+	}
 
 	if (fd_mesa_debug & FD_DBG_NOTILE)
 		linear = true;
@@ -925,11 +931,20 @@ fd_resource_allocate_and_resolve(struct pipe_screen *pscreen,
 	 * except we don't have a format modifier for tiled.  (We probably
 	 * should.)
 	 */
-	bool allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_INVALID, modifiers, count);
-	if (tmpl->bind & PIPE_BIND_SHARED) {
-		allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_QCOM_COMPRESSED, modifiers, count);
+	bool allow_ubwc = false;
+	if (!linear) {
+		allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_INVALID, modifiers, count);
 		if (!allow_ubwc) {
-			linear = true;
+			perf_debug("%"PRSC_FMT": not UBWC: DRM_FORMAT_MOD_INVALID not requested!",
+					PRSC_ARGS(prsc));
+		}
+		if (tmpl->bind & PIPE_BIND_SHARED) {
+			allow_ubwc = drm_find_modifier(DRM_FORMAT_MOD_QCOM_COMPRESSED, modifiers, count);
+			if (!allow_ubwc) {
+				perf_debug("%"PRSC_FMT": not UBWC: shared and DRM_FORMAT_MOD_QCOM_COMPRESSED not requested!",
+						PRSC_ARGS(prsc));
+				linear = true;
+			}
 		}
 	}
 
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index e184766f5dc..55f191b0a5b 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -101,7 +101,7 @@ extern bool fd_binning_enabled;
 				__FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
 
 #define perf_debug_ctx(ctx, ...) do { \
-		perf_warn(__VA_ARGS__); \
+		perf_debug(__VA_ARGS__); \
 		pipe_debug_message(&(ctx)->debug, PERF_INFO, __VA_ARGS__); \
 	} while(0)
 



More information about the mesa-commit mailing list