From 743ad7bf6b8023c9bfdc98e793ed937d0f567d07 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 21 Aug 2020 12:50:34 -0700 Subject: [PATCH] freedreno: add debug helper to dump buffers Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/freedreno_resource.c | 13 +++++++++++++ src/gallium/drivers/freedreno/freedreno_resource.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 45bff983bdc..ed7daaaf63a 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -34,6 +34,8 @@ #include "util/set.h" #include "util/u_drm.h" +#include "decode/util.h" + #include "freedreno_resource.h" #include "freedreno_batch_cache.h" #include "freedreno_blitter.h" @@ -392,6 +394,17 @@ fd_resource_uncompress(struct fd_context *ctx, struct fd_resource *rsc) debug_assert(success); } +/** + * Debug helper to hexdump a resource. + */ +void +fd_resource_dump(struct fd_resource *rsc, const char *name) +{ + fd_bo_cpu_prep(rsc->bo, NULL, DRM_FREEDRENO_PREP_READ); + printf("%s: \n", name); + dump_hex(fd_bo_map(rsc->bo), fd_bo_size(rsc->bo)); +} + static struct fd_resource * fd_alloc_staging(struct fd_context *ctx, struct fd_resource *rsc, unsigned level, const struct pipe_box *box) diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h b/src/gallium/drivers/freedreno/freedreno_resource.h index f2382d75be2..a88f6cd45ad 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.h +++ b/src/gallium/drivers/freedreno/freedreno_resource.h @@ -272,6 +272,7 @@ void fd_resource_context_init(struct pipe_context *pctx); uint32_t fd_setup_slices(struct fd_resource *rsc); void fd_resource_resize(struct pipe_resource *prsc, uint32_t sz); void fd_resource_uncompress(struct fd_context *ctx, struct fd_resource *rsc); +void fd_resource_dump(struct fd_resource *rsc, const char *name); bool fd_render_condition_check(struct pipe_context *pctx); -- 2.30.2