Module: Mesa Branch: main Commit: 7a6fc25daabcced1c339a6685a5426444343d362 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7a6fc25daabcced1c339a6685a5426444343d362
Author: Emma Anholt <[email protected]> Date: Thu Nov 4 16:20:56 2021 -0700 freedreno/fdl: Add support for unit testing 3D texture array strides. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13733> --- .../decode/scripts/texturator-to-unit-test.lua | 19 +++++++++++++++---- src/freedreno/fdl/fd_layout_test.c | 13 +++++++++++++ src/freedreno/fdl/fd_layout_test.h | 1 + 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/freedreno/decode/scripts/texturator-to-unit-test.lua b/src/freedreno/decode/scripts/texturator-to-unit-test.lua index e08f29a35ea..81f8d6ec1cf 100644 --- a/src/freedreno/decode/scripts/texturator-to-unit-test.lua +++ b/src/freedreno/decode/scripts/texturator-to-unit-test.lua @@ -17,12 +17,12 @@ local found_tex = 0 local allblits = {} local nallblits = 0 -function get_first_blit(base, width, height) +function get_next_blit(base, width, height, prev_blit) local first_blit = nil for n = 0,nallblits-1 do local blit = allblits[n] - if blit.base == base and blit.width == width and blit.height == height then + if blit.base == base and blit.width == width and blit.height == height and (not prev_blit or prev_blit.addr < blit.addr) then if not first_blit or blit.addr < first_blit.addr then first_blit = blit end @@ -32,6 +32,10 @@ function get_first_blit(base, width, height) return first_blit end +function get_first_blit(base, width, height) + return get_next_blit(base, width, height, nil); +end + function minify(val, lvls) val = val >> lvls if val < 1 then @@ -153,7 +157,7 @@ function A6XX_TEX_CONST(pkt, size) end if (tostring(pkt[2].TYPE) == "A6XX_TEX_3D") then - printf(" .width0 = %d, .height0 = %d, .depth = %d,\n", width0, height0, depth0) + printf(" .width0 = %d, .height0 = %d, .depth0 = %d,\n", width0, height0, depth0) else printf(" .width0 = %d, .height0 = %d,\n", width0, height0) end @@ -167,9 +171,16 @@ function A6XX_TEX_CONST(pkt, size) local h = minify(height0, level) local blit = get_first_blit(basebase, w, h) if blit then - printf(" { .offset = %d, .pitch = %u },\n", + printf(" { .offset = %d, .pitch = %u", blit.addr - base, blit.pitch); + if (tostring(pkt[2].TYPE) == "A6XX_TEX_3D") then + local second = get_next_blit(basebase, w, h, blit); + if second then + printf(", .size0 = %u", second.addr - blit.addr); + end + end + printf(" },\n"); end level = level + 1 until w == 1 and h == 1 diff --git a/src/freedreno/fdl/fd_layout_test.c b/src/freedreno/fdl/fd_layout_test.c index b546ac36a06..0a2f78ab4ec 100644 --- a/src/freedreno/fdl/fd_layout_test.c +++ b/src/freedreno/fdl/fd_layout_test.c @@ -87,6 +87,19 @@ fdl_test_layout(const struct testcase *testcase, int gpu_id) ok = false; } + /* Test optional requirement of the slice size. Important for testing 3D + * layouts. + */ + if (testcase->layout.slices[l].size0 && layout.slices[l].size0 != + testcase->layout.slices[l].size0) { + fprintf(stderr, "%s %dx%dx%d@%dx lvl%d: slice size %d != %d\n", + util_format_short_name(testcase->format), layout.width0, + layout.height0, layout.depth0, layout.nr_samples, l, + layout.slices[l].size0, + testcase->layout.slices[l].size0); + ok = false; + } + if (layout.ubwc_slices[l].offset != testcase->layout.ubwc_slices[l].offset) { fprintf(stderr, "%s %dx%dx%d@%dx lvl%d: UBWC offset 0x%x != 0x%x\n", diff --git a/src/freedreno/fdl/fd_layout_test.h b/src/freedreno/fdl/fd_layout_test.h index 75280bf5dfe..9dda6c2e6a1 100644 --- a/src/freedreno/fdl/fd_layout_test.h +++ b/src/freedreno/fdl/fd_layout_test.h @@ -36,6 +36,7 @@ struct testcase { struct { uint32_t offset; uint32_t pitch; + uint32_t size0; } slices[FDL_MAX_MIP_LEVELS]; struct { uint32_t offset;
