mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 01:50:10 +01:00
freedreno/a5xx: Add the outline of a unit test for a5xx layout.
Includes a few 3D cases from CTS layouts (since I was looking at CTS failures) which do justify that a5xx's 3D layout workaround is actually different from a6xx's. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5127>
This commit is contained in:
parent
e7003df717
commit
9f62566ef6
3 changed files with 149 additions and 33 deletions
103
src/freedreno/fdl/fd5_layout_test.c
Normal file
103
src/freedreno/fdl/fd5_layout_test.c
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
* Copyright © 2020 Google LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "freedreno_layout.h"
|
||||
#include "fd_layout_test.h"
|
||||
#include "adreno_common.xml.h"
|
||||
#include "util/u_half.h"
|
||||
#include "a5xx.xml.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Testcases generated from cffdump --script texturator-to-unit-test-5xx.lua
|
||||
* on a Pixel 2
|
||||
*/
|
||||
static const struct testcase testcases[] = {
|
||||
/* Basic POT, non-UBWC layout test */
|
||||
{
|
||||
.format = PIPE_FORMAT_R9G9B9E5_FLOAT,
|
||||
.layout = {
|
||||
.tile_mode = TILE5_3,
|
||||
.width0 = 32, .height0 = 32,
|
||||
.slices = {
|
||||
{ .offset = 0, .pitch = 256 },
|
||||
{ .offset = 8192, .pitch = 256 },
|
||||
{ .offset = 12288, .pitch = 256 },
|
||||
{ .offset = 14336, .pitch = 256 },
|
||||
{ .offset = 15360, .pitch = 256 },
|
||||
{ .offset = 15872, .pitch = 256 },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
/* Some 3D cases of sizes from the CTS, when I was suspicious of our 3D
|
||||
* layout.
|
||||
*/
|
||||
{
|
||||
.format = PIPE_FORMAT_R9G9B9E5_FLOAT,
|
||||
.is_3d = true,
|
||||
.layout = {
|
||||
.tile_mode = TILE5_3,
|
||||
.ubwc = false,
|
||||
.width0 = 59, .height0 = 37, .depth0 = 11,
|
||||
.slices = {
|
||||
{ .offset = 0, .pitch = 256 },
|
||||
{ .offset = 135168, .pitch = 256 },
|
||||
{ .offset = 176128, .pitch = 256 },
|
||||
{ .offset = 192512, .pitch = 256 },
|
||||
{ .offset = 200704, .pitch = 256 },
|
||||
{ .offset = 208896, .pitch = 256 },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
.format = PIPE_FORMAT_R32G32_FLOAT,
|
||||
.is_3d = true,
|
||||
.layout = {
|
||||
.tile_mode = TILE5_3,
|
||||
.ubwc = false,
|
||||
.width0 = 63, .height0 = 29, .depth0 = 11,
|
||||
.slices = {
|
||||
{ .offset = 0, .pitch = 512 },
|
||||
{ .offset = 180224, .pitch = 512 },
|
||||
{ .offset = 221184, .pitch = 512 },
|
||||
{ .offset = 237568, .pitch = 512 },
|
||||
{ .offset = 245760, .pitch = 512 },
|
||||
{ .offset = 253952, .pitch = 512 },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(testcases); i++) {
|
||||
if (!fdl_test_layout(&testcases[i], 540))
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -43,16 +43,28 @@ bool fdl_test_layout(const struct testcase *testcase, int gpu_id)
|
|||
max_size = u_minify(max_size, 1);
|
||||
}
|
||||
|
||||
assert(gpu_id >= 600);
|
||||
fdl6_layout(&layout,
|
||||
testcase->format,
|
||||
MAX2(testcase->layout.nr_samples, 1),
|
||||
testcase->layout.width0,
|
||||
MAX2(testcase->layout.height0, 1),
|
||||
MAX2(testcase->layout.depth0, 1),
|
||||
mip_levels,
|
||||
MAX2(testcase->array_size, 1),
|
||||
testcase->is_3d);
|
||||
if (gpu_id >= 600) {
|
||||
fdl6_layout(&layout,
|
||||
testcase->format,
|
||||
MAX2(testcase->layout.nr_samples, 1),
|
||||
testcase->layout.width0,
|
||||
MAX2(testcase->layout.height0, 1),
|
||||
MAX2(testcase->layout.depth0, 1),
|
||||
mip_levels,
|
||||
MAX2(testcase->array_size, 1),
|
||||
testcase->is_3d);
|
||||
} else {
|
||||
assert(gpu_id >= 500);
|
||||
fdl5_layout(&layout,
|
||||
testcase->format,
|
||||
MAX2(testcase->layout.nr_samples, 1),
|
||||
testcase->layout.width0,
|
||||
MAX2(testcase->layout.height0, 1),
|
||||
MAX2(testcase->layout.depth0, 1),
|
||||
mip_levels,
|
||||
MAX2(testcase->array_size, 1),
|
||||
testcase->is_3d);
|
||||
}
|
||||
|
||||
/* fdl lays out UBWC data before the color data, while all we have
|
||||
* recorded in this testcase are the color offsets (other than the UBWC
|
||||
|
|
|
|||
|
|
@ -32,26 +32,27 @@ libfreedreno_layout = static_library(
|
|||
build_by_default : false,
|
||||
)
|
||||
|
||||
|
||||
test(
|
||||
'fd6_layout',
|
||||
executable(
|
||||
'fd6_layout',
|
||||
[
|
||||
'fd_layout_test.c',
|
||||
'fd6_layout_test.c',
|
||||
freedreno_xml_header_files,
|
||||
],
|
||||
link_with: libfreedreno_layout,
|
||||
dependencies : idep_mesautil,
|
||||
include_directories: [
|
||||
inc_include,
|
||||
inc_src,
|
||||
inc_mapi,
|
||||
inc_mesa,
|
||||
inc_gallium,
|
||||
inc_gallium_aux,
|
||||
inc_freedreno],
|
||||
),
|
||||
suite : ['freedreno'],
|
||||
)
|
||||
foreach major : ['5', '6']
|
||||
test(
|
||||
'fd' + major + '_layout',
|
||||
executable(
|
||||
'fd' + major + '_layout',
|
||||
[
|
||||
'fd_layout_test.c',
|
||||
'fd' + major + '_layout_test.c',
|
||||
freedreno_xml_header_files,
|
||||
],
|
||||
link_with: libfreedreno_layout,
|
||||
dependencies : idep_mesautil,
|
||||
include_directories: [
|
||||
inc_include,
|
||||
inc_src,
|
||||
inc_mapi,
|
||||
inc_mesa,
|
||||
inc_gallium,
|
||||
inc_gallium_aux,
|
||||
inc_freedreno],
|
||||
),
|
||||
suite : ['freedreno'],
|
||||
)
|
||||
endforeach
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue