diff options
author | Rob Clark <[email protected]> | 2020-05-09 09:38:02 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-05-12 18:16:48 +0000 |
commit | ef5f238fd08bb470e0f6327ec76723d37704f13f (patch) | |
tree | 3b269159f5d8c590b717cc73cb14132a732353dc /src | |
parent | 6a49d9c396b61ef2556afba59c495c45bfab0202 (diff) |
freedreno/gmem: add helper to dump GMEM layout
Signed-off-by: Rob Clark <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4976>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_gmem.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 7110e2a7485..5bf809e652d 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -109,6 +109,54 @@ gmem_key_equals(const void *_a, const void *_b) return memcmp(a, b, sizeof(*a)) == 0; } +static void +dump_gmem_key(const struct gmem_key *key) +{ + printf("{ .minx=%u, .miny=%u, .width=%u, .height=%u", + key->minx, key->miny, key->width, key->height); + printf(", .gmem_page_align=%u, .nr_cbufs=%u", + key->gmem_page_align, key->nr_cbufs); + printf(", .cbuf_cpp = {"); + for (unsigned i = 0; i < ARRAY_SIZE(key->cbuf_cpp); i++) + printf("%u,", key->cbuf_cpp[i]); + printf("}, .zsbuf_cpp = {"); + for (unsigned i = 0; i < ARRAY_SIZE(key->zsbuf_cpp); i++) + printf("%u,", key->zsbuf_cpp[i]); + printf("}},\n"); +} + +static void +dump_gmem_state(const struct fd_gmem_stateobj *gmem) +{ + unsigned total = 0; + printf("GMEM LAYOUT: bin=%ux%u, nbins=%ux%u\n", + gmem->bin_w, gmem->bin_h, gmem->nbins_x, gmem->nbins_y); + for (int i = 0; i < ARRAY_SIZE(gmem->cbuf_base); i++) { + if (!gmem->cbuf_cpp[i]) + continue; + + unsigned size = gmem->cbuf_cpp[i] * gmem->bin_w * gmem->bin_h; + printf(" cbuf[%d]: base=0x%06x, size=0x%x, cpp=%u\n", i, + gmem->cbuf_base[i], size, gmem->cbuf_cpp[i]); + + total = gmem->cbuf_base[i] + size; + } + + for (int i = 0; i < ARRAY_SIZE(gmem->zsbuf_base); i++) { + if (!gmem->zsbuf_cpp[i]) + continue; + + unsigned size = gmem->zsbuf_cpp[i] * gmem->bin_w * gmem->bin_h; + printf(" zsbuf[%d]: base=0x%06x, size=0x%x, cpp=%u\n", i, + gmem->zsbuf_base[i], size, gmem->zsbuf_cpp[i]); + + total = gmem->zsbuf_base[i] + size; + } + + printf("total: 0x%06x (of 0x%06x)\n", total, + gmem->screen->gmemsize_bytes); +} + static uint32_t bin_width(struct fd_screen *screen) { if (is_a4xx(screen) || is_a5xx(screen) || is_a6xx(screen)) @@ -217,6 +265,11 @@ gmem_stateobj_init(struct fd_screen *screen, struct gmem_key *key) gmem->width = key->width; gmem->height = key->height; + if (BIN_DEBUG) { + dump_gmem_state(gmem); + dump_gmem_key(key); + } + /* * Assign tiles and pipes: * |