freedreno/fdl: Add support for unit testing 3D texture array strides.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13733>
This commit is contained in:
Emma Anholt 2021-11-04 16:20:56 -07:00 committed by Marge Bot
parent 0d7c6eedc7
commit 7a6fc25daa
3 changed files with 29 additions and 4 deletions

View file

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

View file

@ -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",

View file

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