Mesa (main): freedreno: Add more detailed blit debug in FD_MESA_DEBUG=msgs.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 17 23:04:41 UTC 2021
Module: Mesa
Branch: main
Commit: 4018c5f928b01c1536a7361c0f04bbf314a1f598
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4018c5f928b01c1536a7361c0f04bbf314a1f598
Author: Emma Anholt <emma at anholt.net>
Date: Thu Jun 17 12:06:25 2021 -0700
freedreno: Add more detailed blit debug in FD_MESA_DEBUG=msgs.
For debugging the batch cache, it really helps to see the blits that
happen, and which are staging blits in the transfer map process.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11452>
---
src/gallium/drivers/freedreno/a5xx/fd5_blitter.c | 2 ++
src/gallium/drivers/freedreno/a6xx/fd6_blitter.c | 4 +---
src/gallium/drivers/freedreno/freedreno_blitter.c | 2 ++
src/gallium/drivers/freedreno/freedreno_blitter.h | 23 ++++++++++++++++++++++
src/gallium/drivers/freedreno/freedreno_resource.c | 2 ++
src/gallium/drivers/freedreno/freedreno_resource.h | 6 ++++++
6 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
index 1b82a6993ad..0cc1661ef5e 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_blitter.c
@@ -443,6 +443,8 @@ fd5_blitter_blit(struct fd_context *ctx,
batch = fd_bc_alloc_batch(ctx, true);
+ DBG_BLIT(info, batch);
+
fd_batch_update_queries(batch);
emit_setup(batch->draw);
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
index 4e5555a3f04..be4503606e0 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blitter.c
@@ -934,9 +934,7 @@ handle_rgba_blit(struct fd_context *ctx,
emit_setup(batch);
- DBG("%p: %s (%p) -> %s (%p)", batch,
- util_str_tex_target(info->src.resource->target, true), info->src.resource,
- util_str_tex_target(info->dst.resource->target, true), info->dst.resource);
+ DBG_BLIT(info, batch);
trace_start_blit(&batch->trace, info->src.resource->target,
info->dst.resource->target);
diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.c b/src/gallium/drivers/freedreno/freedreno_blitter.c
index e1eb343864a..15bf9e315d8 100644
--- a/src/gallium/drivers/freedreno/freedreno_blitter.c
+++ b/src/gallium/drivers/freedreno/freedreno_blitter.c
@@ -152,6 +152,8 @@ fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
info->dst.box.depth);
}
+ DBG_BLIT(info, NULL);
+
fd_blitter_pipe_begin(ctx, info->render_condition_enable, discard);
/* Initialize the surface. */
diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.h b/src/gallium/drivers/freedreno/freedreno_blitter.h
index 07ca736510e..c6f04bc834a 100644
--- a/src/gallium/drivers/freedreno/freedreno_blitter.h
+++ b/src/gallium/drivers/freedreno/freedreno_blitter.h
@@ -28,6 +28,7 @@
#define FREEDRENO_BLIT_H_
#include "pipe/p_state.h"
+#include "util/u_dump.h"
#include "freedreno_context.h"
@@ -47,4 +48,26 @@ void fd_resource_copy_region(struct pipe_context *pctx,
bool fd_blit(struct pipe_context *pctx,
const struct pipe_blit_info *blit_info) assert_dt;
+#define DBG_BLIT(blit, batch) do { \
+ if (FD_DBG(MSGS)) { \
+ const struct fd_resource *src = fd_resource((blit)->src.resource); \
+ const struct fd_resource *dst = fd_resource((blit)->dst.resource); \
+ const char *src_target = util_str_tex_target((blit)->src.resource->target, true); \
+ const char *dst_target = util_str_tex_target((blit)->dst.resource->target, true); \
+ const char *src_format = util_format_short_name((blit)->src.format); \
+ const char *dst_format = util_format_short_name((blit)->dst.format); \
+ const char *src_tiling = fd_resource_tile_mode_desc(src, (blit)->src.level); \
+ const char *dst_tiling = fd_resource_tile_mode_desc(dst, (blit)->dst.level); \
+ if (batch) { \
+ DBG("%p: %s %s %s (%p) -> %s %s %s (%p)", (batch), \
+ src_target, src_format, src_tiling, src, \
+ dst_target, dst_format, dst_tiling, dst); \
+ } else { \
+ DBG("%s %s %s (%p) -> %s %s %s (%p)", \
+ src_target, src_format, src_tiling, src, \
+ dst_target, dst_format, dst_tiling, dst); \
+ } \
+ } \
+} while (0)
+
#endif /* FREEDRENO_BLIT_H_ */
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index bc66046a277..913355a392e 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -610,6 +610,7 @@ static void
fd_blit_from_staging(struct fd_context *ctx,
struct fd_transfer *trans) assert_dt
{
+ DBG("");
struct pipe_resource *dst = trans->b.b.resource;
struct pipe_blit_info blit = {};
@@ -630,6 +631,7 @@ fd_blit_from_staging(struct fd_context *ctx,
static void
fd_blit_to_staging(struct fd_context *ctx, struct fd_transfer *trans) assert_dt
{
+ DBG("");
struct pipe_resource *src = trans->b.b.resource;
struct pipe_blit_info blit = {};
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h b/src/gallium/drivers/freedreno/freedreno_resource.h
index d4666b06e10..b7cc41d1263 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.h
+++ b/src/gallium/drivers/freedreno/freedreno_resource.h
@@ -322,6 +322,12 @@ fd_resource_tile_mode(struct pipe_resource *prsc, int level)
return fdl_tile_mode(&fd_resource(prsc)->layout, level);
}
+static inline const char *
+fd_resource_tile_mode_desc(const struct fd_resource *rsc, int level)
+{
+ return fdl_tile_mode_desc(&rsc->layout, level);
+}
+
static inline bool
fd_resource_ubwc_enabled(struct fd_resource *rsc, int level)
{
More information about the mesa-commit
mailing list