ail: Add unit tests for miptree layouts

The equations for calculating miptree offsets are complicated,
nonobvious, and full of subtle footguns. Worse, the driver doesn't
control the offsets -- it must simply agree with the offsets
implicitly calculated in the hardware. The CTS doesn't adequately
exercise all the corner cases. Make sure we have unit tests that do.

The tests themselves are generated by instrumenting agxdecode to scan
GPU memory after uploading test patterns in a variety of layout with a
Metal application.

Thank you to Asahi Lina and Dougall Johnson for the reverse-engineering
that led to this. The tests selected here are a subset of those used for
the reverse-engineering. The full set may be found in Lina's tilecalc
repo:

   https://github.com/asahilina/tilecalc

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18167>
This commit is contained in:
Alyssa Rosenzweig 2022-08-20 21:47:57 -04:00 committed by Marge Bot
parent 1f89e67883
commit 65c00ba7cb
2 changed files with 1320 additions and 0 deletions

View file

@ -31,3 +31,22 @@ libasahi_layout = static_library(
gnu_symbol_visibility : 'hidden',
build_by_default : false,
)
if with_tests
test(
'asahi_layout_tests',
executable(
'asahi_layout_tests',
files(
'tests/test-layout.cpp',
),
c_args : [c_msvc_compat_args, no_override_init_args],
gnu_symbol_visibility : 'hidden',
include_directories : [inc_include, inc_src],
dependencies: [idep_gtest, idep_mesautil],
link_with : [libasahi_layout],
),
suite : ['asahi'],
protocol : gtest_test_protocol,
)
endif

File diff suppressed because it is too large Load diff