Mesa (master): vc4: Add some useful debug printfs for miptrees.
Eric Anholt
anholt at kemper.freedesktop.org
Tue Mar 24 17:39:47 UTC 2015
Module: Mesa
Branch: master
Commit: 9bafcf630ab009b3b39bbe3c0f4370386bc5a6b2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9bafcf630ab009b3b39bbe3c0f4370386bc5a6b2
Author: Eric Anholt <eric at anholt.net>
Date: Mon Mar 23 17:38:29 2015 -0700
vc4: Add some useful debug printfs for miptrees.
I keep rewriting these.
---
src/gallium/drivers/vc4/vc4_resource.c | 37 ++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/src/gallium/drivers/vc4/vc4_resource.c b/src/gallium/drivers/vc4/vc4_resource.c
index a26b346..b8efa0d 100644
--- a/src/gallium/drivers/vc4/vc4_resource.c
+++ b/src/gallium/drivers/vc4/vc4_resource.c
@@ -33,12 +33,24 @@
#include "vc4_resource.h"
#include "vc4_tiling.h"
+static bool miptree_debug = false;
+
static void
vc4_resource_bo_alloc(struct vc4_resource *rsc)
{
struct pipe_resource *prsc = &rsc->base.b;
struct pipe_screen *pscreen = prsc->screen;
+ if (miptree_debug) {
+ fprintf(stderr, "alloc %p: size %d + offset %d -> %d\n",
+ rsc,
+ rsc->slices[0].size,
+ rsc->slices[0].offset,
+ rsc->slices[0].offset +
+ rsc->slices[0].size +
+ rsc->cube_map_stride * (prsc->array_size - 1));
+ }
+
vc4_bo_unreference(&rsc->bo);
rsc->bo = vc4_bo_alloc(vc4_screen(pscreen),
rsc->slices[0].offset +
@@ -267,6 +279,22 @@ vc4_setup_slices(struct vc4_resource *rsc)
slice->size = level_height * slice->stride;
offset += slice->size;
+
+ if (miptree_debug) {
+ static const char tiling_chars[] = {
+ [VC4_TILING_FORMAT_LINEAR] = 'R',
+ [VC4_TILING_FORMAT_LT] = 'L',
+ [VC4_TILING_FORMAT_T] = 'T'
+ };
+ fprintf(stderr,
+ "rsc setup %p (format %d), %dx%d: "
+ "level %d (%c) -> %dx%d, stride %d at 0x%08x\n",
+ rsc, rsc->vc4_format,
+ prsc->width0, prsc->height0,
+ i, tiling_chars[slice->tiling],
+ level_width, level_height,
+ slice->stride, slice->offset);
+ }
}
/* The texture base pointer that has to point to level 0 doesn't have
@@ -385,6 +413,15 @@ vc4_resource_from_handle(struct pipe_screen *pscreen,
rsc->vc4_format = get_resource_texture_format(prsc);
+ if (miptree_debug) {
+ fprintf(stderr,
+ "rsc import %p (format %d), %dx%d: "
+ "level 0 (R) -> stride %d at 0x%08x\n",
+ rsc, rsc->vc4_format,
+ prsc->width0, prsc->height0,
+ slice->stride, slice->offset);
+ }
+
return prsc;
fail:
More information about the mesa-commit
mailing list