freedreno: Add fmt/args macros for pipe_resource

Deduplicate some long debug prints before adding more.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8659>
This commit is contained in:
Rob Clark 2021-01-22 08:42:29 -08:00
parent a065682f30
commit 38b073ebfe
2 changed files with 19 additions and 22 deletions

View File

@ -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);

View File

@ -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: */