freedreno/ir3: lower local_index using local_id
[mesa.git] / src / freedreno / fdl / fd5_layout_test.c
1 /*
2 * Copyright © 2020 Google LLC
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24 #include "freedreno_layout.h"
25 #include "fd_layout_test.h"
26 #include "adreno_common.xml.h"
27 #include "util/u_half.h"
28 #include "a5xx.xml.h"
29
30 #include <stdio.h>
31
32 /* Testcases generated from cffdump --script texturator-to-unit-test-5xx.lua
33 * on a Pixel 2
34 */
35 static const struct testcase testcases[] = {
36 /* Basic POT, non-UBWC layout test */
37 {
38 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
39 .layout = {
40 .tile_mode = TILE5_3,
41 .width0 = 32, .height0 = 32,
42 .slices = {
43 { .offset = 0, .pitch = 256 },
44 { .offset = 8192, .pitch = 256 },
45 { .offset = 12288, .pitch = 256 },
46 { .offset = 14336, .pitch = 256 },
47 { .offset = 15360, .pitch = 256 },
48 { .offset = 15872, .pitch = 256 },
49 },
50 },
51 },
52
53 /* Some 3D cases of sizes from the CTS, when I was suspicious of our 3D
54 * layout.
55 */
56 {
57 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
58 .is_3d = true,
59 .layout = {
60 .tile_mode = TILE5_3,
61 .ubwc = false,
62 .width0 = 59, .height0 = 37, .depth0 = 11,
63 .slices = {
64 { .offset = 0, .pitch = 256 },
65 { .offset = 135168, .pitch = 256 },
66 { .offset = 176128, .pitch = 256 },
67 { .offset = 192512, .pitch = 256 },
68 { .offset = 200704, .pitch = 256 },
69 { .offset = 208896, .pitch = 256 },
70 },
71 },
72 },
73 {
74 .format = PIPE_FORMAT_R32G32_FLOAT,
75 .is_3d = true,
76 .layout = {
77 .tile_mode = TILE5_3,
78 .ubwc = false,
79 .width0 = 63, .height0 = 29, .depth0 = 11,
80 .slices = {
81 { .offset = 0, .pitch = 512 },
82 { .offset = 180224, .pitch = 512 },
83 { .offset = 221184, .pitch = 512 },
84 { .offset = 237568, .pitch = 512 },
85 { .offset = 245760, .pitch = 512 },
86 { .offset = 253952, .pitch = 512 },
87 },
88 },
89 },
90 };
91
92 int
93 main(int argc, char **argv)
94 {
95 int ret = 0;
96
97 for (int i = 0; i < ARRAY_SIZE(testcases); i++) {
98 if (!fdl_test_layout(&testcases[i], 540))
99 ret = 1;
100 }
101
102 return ret;
103 }