1 /*
2 * Copyright © 2020 Google LLC
3 * SPDX-License-Identifier: MIT
4 */
5
6 #include "freedreno_layout.h"
7 #include "fd_layout_test.h"
8 #include "adreno_common.xml.h"
9 #include "util/half_float.h"
10 #include "util/u_math.h"
11 #include "a5xx.xml.h"
12
13 #include <stdio.h>
14
15 /* Testcases generated from cffdump --script texturator-to-unit-test-5xx.lua
16 * on a Pixel 2
17 */
18 static const struct testcase testcases[] = {
19 /* Basic POT, non-UBWC layout test */
20 {
21 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
22 .layout =
23 {
24 .tile_mode = TILE5_3,
25 .width0 = 32,
26 .height0 = 32,
27 .slices =
28 {
29 {.offset = 0, .pitch = 256},
30 {.offset = 8192, .pitch = 256},
31 {.offset = 12288, .pitch = 256},
32 {.offset = 14336, .pitch = 256},
33 {.offset = 15360, .pitch = 256},
34 {.offset = 15872, .pitch = 256},
35 },
36 },
37 },
38
39 /* Some 3D cases of sizes from the CTS, when I was suspicious of our 3D
40 * layout.
41 */
42 {
43 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
44 .is_3d = true,
45 .layout =
46 {
47 .tile_mode = TILE5_3,
48 .ubwc = false,
49 .width0 = 59,
50 .height0 = 37,
51 .depth0 = 11,
52 .slices =
53 {
54 {.offset = 0, .pitch = 256},
55 {.offset = 135168, .pitch = 256},
56 {.offset = 176128, .pitch = 256},
57 {.offset = 192512, .pitch = 256},
58 {.offset = 200704, .pitch = 256},
59 {.offset = 208896, .pitch = 256},
60 },
61 },
62 },
63 {
64 .format = PIPE_FORMAT_R32G32_FLOAT,
65 .is_3d = true,
66 .layout =
67 {
68 .tile_mode = TILE5_3,
69 .ubwc = false,
70 .width0 = 63,
71 .height0 = 29,
72 .depth0 = 11,
73 .slices =
74 {
75 {.offset = 0, .pitch = 512},
76 {.offset = 180224, .pitch = 512},
77 {.offset = 221184, .pitch = 512},
78 {.offset = 237568, .pitch = 512},
79 {.offset = 245760, .pitch = 512},
80 {.offset = 253952, .pitch = 512},
81 },
82 },
83 },
84 };
85
86 int
main(int argc,char ** argv)87 main(int argc, char **argv)
88 {
89 int ret = 0;
90
91 for (int i = 0; i < ARRAY_SIZE(testcases); i++) {
92 if (!fdl_test_layout(&testcases[i], 540))
93 ret = 1;
94 }
95
96 return ret;
97 }
98