From 38b073ebfef63d625ddf195b3ef8f11db8109e9f Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 22 Jan 2021 08:42:29 -0800 Subject: [PATCH] freedreno: Add fmt/args macros for pipe_resource Deduplicate some long debug prints before adding more. Signed-off-by: Rob Clark Part-of: --- .../drivers/freedreno/freedreno_resource.c | 29 +++++-------------- .../drivers/freedreno/freedreno_resource.h | 12 ++++++++ 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 15273842985..442c3d2a7b1 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -838,13 +838,7 @@ fd_resource_get_handle(struct pipe_screen *pscreen, handle->modifier = fd_resource_modifier(rsc); - DBG("%p: target=%d, format=%s, %ux%ux%u, array_size=%u, last_level=%u, " - "nr_samples=%u, usage=%u, bind=%x, flags=%x, modifier=%"PRIx64, - prsc, prsc->target, util_format_name(prsc->format), - prsc->width0, prsc->height0, prsc->depth0, - prsc->array_size, prsc->last_level, prsc->nr_samples, - prsc->usage, prsc->bind, prsc->flags, - handle->modifier); + DBG("%"PRSC_FMT", modifier=%"PRIx64, PRSC_ARGS(prsc), handle->modifier); return fd_screen_bo_get_handle(pscreen, rsc->bo, rsc->scanout, fd_resource_pitch(rsc, 0), handle); @@ -902,17 +896,13 @@ fd_resource_allocate_and_resolve(struct pipe_screen *pscreen, rsc = CALLOC_STRUCT(fd_resource); prsc = &rsc->base; - DBG("%p: target=%d, format=%s, %ux%ux%u, array_size=%u, last_level=%u, " - "nr_samples=%u, usage=%u, bind=%x, flags=%x", prsc, - tmpl->target, util_format_name(format), - tmpl->width0, tmpl->height0, tmpl->depth0, - tmpl->array_size, tmpl->last_level, tmpl->nr_samples, - tmpl->usage, tmpl->bind, tmpl->flags); - if (!rsc) return NULL; *prsc = *tmpl; + + DBG("%"PRSC_FMT, PRSC_ARGS(prsc)); + fd_resource_layout_init(prsc); #define LINEAR \ @@ -1084,15 +1074,10 @@ fd_resource_from_handle(struct pipe_screen *pscreen, struct fdl_slice *slice = fd_resource_slice(rsc, 0); struct pipe_resource *prsc = &rsc->base; - DBG("%p: target=%d, format=%s, %ux%ux%u, array_size=%u, last_level=%u, " - "nr_samples=%u, usage=%u, bind=%x, flags=%x, modifier=%"PRIx64, - prsc, tmpl->target, util_format_name(tmpl->format), - tmpl->width0, tmpl->height0, tmpl->depth0, - tmpl->array_size, tmpl->last_level, tmpl->nr_samples, - tmpl->usage, tmpl->bind, tmpl->flags, - handle->modifier); - *prsc = *tmpl; + + DBG("%"PRSC_FMT", modifier=%"PRIx64, PRSC_ARGS(prsc), handle->modifier); + fd_resource_layout_init(prsc); pipe_reference_init(&prsc->reference, 1); diff --git a/src/gallium/drivers/freedreno/freedreno_resource.h b/src/gallium/drivers/freedreno/freedreno_resource.h index 77beda2bbc2..49216bc5244 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.h +++ b/src/gallium/drivers/freedreno/freedreno_resource.h @@ -28,6 +28,7 @@ #define FREEDRENO_RESOURCE_H_ #include "util/list.h" +#include "util/u_dump.h" #include "util/u_range.h" #include "util/u_transfer_helper.h" #include "util/simple_mtx.h" @@ -36,6 +37,17 @@ #include "freedreno_util.h" #include "freedreno/fdl/freedreno_layout.h" + +#define PRSC_FMT \ + "p: target=%s, format=%s, %ux%ux%u, " \ + "array_size=%u, last_level=%u, " \ + "nr_samples=%u, usage=%u, bind=%x, flags=%x" +#define PRSC_ARGS(p) \ + (p), util_str_tex_target((p)->target, true), util_format_short_name((p)->format), \ + (p)->width0, (p)->height0, (p)->depth0, (p)->array_size, (p)->last_level, \ + (p)->nr_samples, (p)->usage, (p)->bind, (p)->flags + + enum fd_lrz_direction { FD_LRZ_UNKNOWN, /* Depth func less/less-than: */