• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "adreno_pm4.xml.h"
28 #include "a6xx.xml.h"
29 
30 #include <stdio.h>
31 
32 static const struct testcase testcases[] = {
33 	/* A straightforward first testcase, linear, with an obvious format. */
34 	{
35 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
36 		.layout = {
37 			.width0 = 32, .height0 = 32,
38 			.slices = {
39 				{ .offset = 0, .pitch = 256 },
40 				{ .offset = 8192, .pitch = 256 },
41 				{ .offset = 12288, .pitch = 256 },
42 				{ .offset = 14336, .pitch = 256 },
43 				{ .offset = 15360, .pitch = 256 },
44 				{ .offset = 15872, .pitch = 256 },
45 			},
46 		},
47 	},
48 
49 	/* A tiled/ubwc layout from the blob driver, at a size where the a630 blob
50 	 * driver does something interesting for linear.
51 	 */
52 	{
53 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
54 		.layout = {
55 			.tile_mode = TILE6_3,
56 			.ubwc = true,
57 			.width0 = 1024, .height0 = 1,
58 			.slices = {
59 				{ .offset = 0, .pitch = 4096 },
60 				{ .offset = 65536, .pitch = 2048 },
61 				{ .offset = 98304, .pitch = 1024 },
62 				{ .offset = 114688, .pitch = 512 },
63 				{ .offset = 122880, .pitch = 256 },
64 				{ .offset = 126976, .pitch = 256 },
65 				{ .offset = 131072, .pitch = 256 },
66 				{ .offset = 135168, .pitch = 256 },
67 				{ .offset = 139264, .pitch = 256 },
68 				{ .offset = 143360, .pitch = 256 },
69 				{ .offset = 147456, .pitch = 256 },
70 			},
71 			.ubwc_slices = {
72 				{ .offset = 0, .pitch = 64 },
73 				{ .offset = 4096, .pitch = 64 },
74 				{ .offset = 8192, .pitch = 64 },
75 				{ .offset = 12288, .pitch = 64 },
76 				{ .offset = 16384, .pitch = 64 },
77 				{ .offset = 20480, .pitch = 64 },
78 				{ .offset = 24576, .pitch = 64 },
79 				{ .offset = 28672, .pitch = 64 },
80 				{ .offset = 32768, .pitch = 64 },
81 				{ .offset = 36864, .pitch = 64 },
82 				{ .offset = 40960, .pitch = 64 },
83 			},
84 		},
85 	},
86 
87 	/* An interesting layout from the blob driver on a630, showing that
88 	 * per-level pitch must be derived from level 0's pitch, not width0.  We
89 	 * don't do this level 0 pitch disalignment (we pick 4096), so disabled
90 	 * this test for now.
91 	 */
92 #if 0
93 	{
94 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
95 		.layout = {
96 			.width0 = 1024, .height0 = 1,
97 			.slices = {
98 				{ .offset = 0, .pitch = 5120 },
99 				{ .offset = 5120, .pitch = 2560 },
100 				{ .offset = 7680, .pitch = 1280 },
101 				{ .offset = 8960, .pitch = 768 },
102 				{ .offset = 9728, .pitch = 512 },
103 				{ .offset = 10240, .pitch = 256 },
104 				{ .offset = 10496, .pitch = 256 },
105 				{ .offset = 10752, .pitch = 256 },
106 				{ .offset = 11008, .pitch = 256 },
107 				{ .offset = 11264, .pitch = 256 },
108 				{ .offset = 11520, .pitch = 256 },
109 			},
110 		},
111 	},
112 #endif
113 
114 	/* A layout that we failed on (129 wide has a surprise level 1 pitch
115 	 * increase), and the sizes bracketing it.
116 	 */
117 	{
118 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
119 		.layout = {
120 			.width0 = 128, .height0 = 1,
121 			.slices = {
122 				{ .offset = 0, .pitch = 512 },
123 				{ .offset = 512, .pitch = 256 },
124 				{ .offset = 768, .pitch = 256 },
125 				{ .offset = 1024, .pitch = 256 },
126 				{ .offset = 1280, .pitch = 256 },
127 				{ .offset = 1536, .pitch = 256 },
128 				{ .offset = 1792, .pitch = 256 },
129 				{ .offset = 2048, .pitch = 256 },
130 			},
131 		},
132 	},
133 	{
134 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
135 		.layout = {
136 			.width0 = 129, .height0 = 1,
137 			.slices = {
138 				{ .offset = 0, .pitch = 768 },
139 				{ .offset = 768, .pitch = 512 },
140 				{ .offset = 1280, .pitch = 256 },
141 				{ .offset = 1536, .pitch = 256 },
142 				{ .offset = 1792, .pitch = 256 },
143 				{ .offset = 2048, .pitch = 256 },
144 				{ .offset = 2304, .pitch = 256 },
145 				{ .offset = 2560, .pitch = 256 },
146 			},
147 		},
148 	},
149 	{
150 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
151 		.layout = {
152 			.width0 = 130, .height0 = 1,
153 			.slices = {
154 				{ .offset = 0, .pitch = 768 },
155 				{ .offset = 768, .pitch = 512 },
156 				{ .offset = 1280, .pitch = 256 },
157 				{ .offset = 1536, .pitch = 256 },
158 				{ .offset = 1792, .pitch = 256 },
159 				{ .offset = 2048, .pitch = 256 },
160 				{ .offset = 2304, .pitch = 256 },
161 				{ .offset = 2560, .pitch = 256 },
162 			},
163 		},
164 	},
165 
166 	/* The 129 failure seems to be across formats, let's test some cpps */
167 	{
168 		.format = PIPE_FORMAT_R8_UNORM,
169 		.layout = {
170 			.width0 = 129, .height0 = 1,
171 			.slices = {
172 				{ .offset = 0, .pitch = 192 },
173 				{ .offset = 192, .pitch = 128 },
174 				{ .offset = 320, .pitch = 64 },
175 				{ .offset = 384, .pitch = 64 },
176 				{ .offset = 448, .pitch = 64 },
177 				{ .offset = 512, .pitch = 64 },
178 				{ .offset = 576, .pitch = 64 },
179 				{ .offset = 640, .pitch = 64 },
180 			},
181 		},
182 	},
183 	{
184 		.format = PIPE_FORMAT_R16_UINT,
185 		.layout = {
186 			.width0 = 129, .height0 = 1,
187 			.slices = {
188 				{ .offset = 0, .pitch = 384 },
189 				{ .offset = 384, .pitch = 256 },
190 				{ .offset = 640, .pitch = 128 },
191 				{ .offset = 768, .pitch = 128 },
192 				{ .offset = 896, .pitch = 128 },
193 				{ .offset = 1024, .pitch = 128 },
194 				{ .offset = 1152, .pitch = 128 },
195 				{ .offset = 1280, .pitch = 128 },
196 			},
197 		},
198 	},
199 	{
200 		.format = PIPE_FORMAT_R32G32B32A32_FLOAT,
201 		.layout = {
202 			.width0 = 129, .height0 = 1,
203 			.slices = {
204 				{ .offset = 0, .pitch = 3072 },
205 				{ .offset = 3072, .pitch = 2048 },
206 				{ .offset = 5120, .pitch = 1024 },
207 				{ .offset = 6144, .pitch = 1024 },
208 				{ .offset = 7168, .pitch = 1024 },
209 				{ .offset = 8192, .pitch = 1024 },
210 				{ .offset = 9216, .pitch = 1024 },
211 				{ .offset = 10240, .pitch = 1024 },
212 			},
213 		},
214 	},
215 
216 	/* The 129 failure replicated at every +256 pixels wide.  Pick one of
217 	 * them, and this time increase the height as a new variable as well.
218 	 */
219 	{
220 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
221 		.layout = {
222 			.width0 = 385, .height0 = 128,
223 			.slices = {
224 				{ .offset = 0, .pitch = 1792 },
225 				{ .offset = 229376, .pitch = 1024 },
226 				{ .offset = 294912, .pitch = 512 },
227 				{ .offset = 311296, .pitch = 256 },
228 				{ .offset = 315392, .pitch = 256 },
229 				{ .offset = 317440, .pitch = 256 },
230 				{ .offset = 318464, .pitch = 256 },
231 				{ .offset = 318976, .pitch = 256 },
232 				{ .offset = 319232, .pitch = 256 },
233 			},
234 		},
235 	},
236 
237 	/* At 257-259 (and replicated every +256 pixels) we had another failure. */
238 	{
239 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
240 		.layout = {
241 			.width0 = 257, .height0 = 1,
242 			.slices = {
243 				{ .offset = 0, .pitch = 1280 },
244 				{ .offset = 1280, .pitch = 768 },
245 				{ .offset = 2048, .pitch = 512 },
246 				{ .offset = 2560, .pitch = 256 },
247 				{ .offset = 2816, .pitch = 256 },
248 				{ .offset = 3072, .pitch = 256 },
249 				{ .offset = 3328, .pitch = 256 },
250 				{ .offset = 3584, .pitch = 256 },
251 				{ .offset = 3840, .pitch = 256 },
252 			},
253 		},
254 	},
255 	{
256 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
257 		.layout = {
258 			.width0 = 258, .height0 = 1,
259 			.slices = {
260 				{ .offset = 0, .pitch = 1280 },
261 				{ .offset = 1280, .pitch = 768 },
262 				{ .offset = 2048, .pitch = 512 },
263 				{ .offset = 2560, .pitch = 256 },
264 				{ .offset = 2816, .pitch = 256 },
265 				{ .offset = 3072, .pitch = 256 },
266 				{ .offset = 3328, .pitch = 256 },
267 				{ .offset = 3584, .pitch = 256 },
268 				{ .offset = 3840, .pitch = 256 },
269 			},
270 		},
271 	},
272 	{
273 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
274 		.layout = {
275 			.width0 = 259, .height0 = 1,
276 			.slices = {
277 				{ .offset = 0, .pitch = 1280 },
278 				{ .offset = 1280, .pitch = 768 },
279 				{ .offset = 2048, .pitch = 512 },
280 				{ .offset = 2560, .pitch = 256 },
281 				{ .offset = 2816, .pitch = 256 },
282 				{ .offset = 3072, .pitch = 256 },
283 				{ .offset = 3328, .pitch = 256 },
284 				{ .offset = 3584, .pitch = 256 },
285 				{ .offset = 3840, .pitch = 256 },
286 			},
287 		},
288 	},
289 	{
290 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
291 		.layout = {
292 			.width0 = 260, .height0 = 1,
293 			.slices = {
294 				{ .offset = 0, .pitch = 1280 },
295 				{ .offset = 1280, .pitch = 768 },
296 				{ .offset = 2048, .pitch = 512 },
297 				{ .offset = 2560, .pitch = 256 },
298 				{ .offset = 2816, .pitch = 256 },
299 				{ .offset = 3072, .pitch = 256 },
300 				{ .offset = 3328, .pitch = 256 },
301 				{ .offset = 3584, .pitch = 256 },
302 				{ .offset = 3840, .pitch = 256 },
303 			},
304 		},
305 	},
306 
307 	/* And, again for the 257-9 failure, test a replica with a larger size*/
308 	{
309 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
310 		.layout = {
311 			.width0 = 513, .height0 = 32,
312 			.slices = {
313 				{ .offset = 0, .pitch = 2304 },
314 				{ .offset = 73728, .pitch = 1280 },
315 				{ .offset = 94208, .pitch = 768 },
316 				{ .offset = 100352, .pitch = 512 },
317 				{ .offset = 102400, .pitch = 256 },
318 				{ .offset = 102912, .pitch = 256 },
319 				{ .offset = 103168, .pitch = 256 },
320 				{ .offset = 103424, .pitch = 256 },
321 				{ .offset = 103680, .pitch = 256 },
322 				{ .offset = 103936, .pitch = 256 },
323 			},
324 		},
325 	},
326 
327 	/* Oh, look.  The 513-517 failure extends up to 518 at the next texture
328 	 * level!
329 	 */
330 	{
331 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
332 		.layout = {
333 			.width0 = 518, .height0 = 1,
334 			.slices = {
335 				{ .offset = 0, .pitch = 2304 },
336 				{ .offset = 2304, .pitch = 1280 },
337 				{ .offset = 3584, .pitch = 768 },
338 				{ .offset = 4352, .pitch = 512 },
339 				{ .offset = 4864, .pitch = 256 },
340 				{ .offset = 5120, .pitch = 256 },
341 				{ .offset = 5376, .pitch = 256 },
342 				{ .offset = 5632, .pitch = 256 },
343 				{ .offset = 5888, .pitch = 256 },
344 				{ .offset = 6144, .pitch = 256 },
345 			},
346 		},
347 	},
348 
349 	/* Tiled mode testing of the unusual 1/2-bytes-per-pixel pitch alignment */
350 	{
351 		.format = PIPE_FORMAT_R8_UNORM,
352 		.layout = {
353 			.tile_mode = TILE6_3,
354 			.width0 = 129, .height0 = 1,
355 			.slices = {
356 				{ .offset = 0, .pitch = 256 },
357 				{ .offset = 8192, .pitch = 128 },
358 				{ .offset = 12288, .pitch = 128 },
359 				{ .offset = 16384, .pitch = 128 },
360 				{ .offset = 20480, .pitch = 128 },
361 				{ .offset = 20608, .pitch = 128 },
362 				{ .offset = 20736, .pitch = 128 },
363 				{ .offset = 20864, .pitch = 128 },
364 			},
365 		},
366 	},
367 
368 	/* Single-level RGBA8888 UBWC following UBWC alignment rules laid out in
369 	 * msm_media_info.h to verify that we don't break buffer sharing.
370 	 */
371 	{
372 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
373 		.layout = {
374 			.tile_mode = TILE6_3,
375 			.ubwc = true,
376 			.width0 = 16384, .height0 = 129,
377 			.slices = {
378 				{ .offset = 1024 * 48, .pitch = 16384 * 4 },
379 			},
380 			.ubwc_slices = {
381 				{ .offset = 0, .pitch = 1024 },
382 			},
383 		},
384 	},
385 
386 	/* UBWC: Pitch comes from POT-aligned level 0. */
387 	/* Pitch fixed in this commit, but offsets broken.  Will be fixed in
388 	 * following commits.
389 	 */
390 	{
391 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
392 		.layout = {
393 			.tile_mode = TILE6_3,
394 			.ubwc = true,
395 			.width0 = 2049, .height0 = 128,
396 			.slices = {
397 				{ .offset = 0, .pitch = 8448 },
398 				{ .offset = 1081344, .pitch = 4352 },
399 				{ .offset = 1359872, .pitch = 2304 },
400 				{ .offset = 1433600, .pitch = 1280 },
401 				{ .offset = 1454080, .pitch = 768 },
402 				{ .offset = 1466368, .pitch = 512 },
403 				{ .offset = 1474560, .pitch = 256 },
404 				{ .offset = 1478656, .pitch = 256 },
405 				{ .offset = 1482752, .pitch = 256 },
406 				{ .offset = 1486848, .pitch = 256 },
407 				{ .offset = 1490944, .pitch = 256 },
408 				{ .offset = 1495040, .pitch = 256 },
409 			},
410 			.ubwc_slices = {
411 				{ .offset = 0, .pitch = 256 },
412 				{ .offset = 16384, .pitch = 128 },
413 				{ .offset = 24576, .pitch = 64 },
414 				{ .offset = 28672, .pitch = 64 },
415 				{ .offset = 32768, .pitch = 64 },
416 				{ .offset = 36864, .pitch = 64 },
417 				{ .offset = 40960, .pitch = 64 },
418 				{ .offset = 45056, .pitch = 64 },
419 				{ .offset = 49152, .pitch = 64 },
420 				{ .offset = 53248, .pitch = 64 },
421 				{ .offset = 57344, .pitch = 64 },
422 				{ .offset = 61440, .pitch = 64 },
423 			},
424 		},
425 	},
426 	/* UBWC: Height comes from POT-aligned level 0. */
427 	{
428 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
429 		.layout = {
430 			.tile_mode = TILE6_3,
431 			.ubwc = true,
432 			.width0 = 1024, .height0 = 1025,
433 			.slices = {
434 				{ .offset = 0, .pitch = 4096 },
435 				{ .offset = 4259840, .pitch = 2048 },
436 				{ .offset = 5308416, .pitch = 1024 },
437 				{ .offset = 5570560, .pitch = 512 },
438 				{ .offset = 5636096, .pitch = 256 },
439 				{ .offset = 5652480, .pitch = 256 },
440 				{ .offset = 5660672, .pitch = 256 },
441 				{ .offset = 5664768, .pitch = 256 },
442 				{ .offset = 5668864, .pitch = 256 },
443 				{ .offset = 5672960, .pitch = 256 },
444 				{ .offset = 5677056, .pitch = 256 },
445 			},
446 			.ubwc_slices = {
447 				{ .offset = 0, .pitch = 64 },
448 				{ .offset = 32768, .pitch = 64 },
449 				{ .offset = 49152, .pitch = 64 },
450 				{ .offset = 57344, .pitch = 64 },
451 				{ .offset = 61440, .pitch = 64 },
452 				{ .offset = 65536, .pitch = 64 },
453 				{ .offset = 69632, .pitch = 64 },
454 				{ .offset = 73728, .pitch = 64 },
455 				{ .offset = 77824, .pitch = 64 },
456 				{ .offset = 81920, .pitch = 64 },
457 				{ .offset = 86016, .pitch = 64 },
458 			},
459 		},
460 	},
461 
462 	/* UBWC: Get at minimum height of a level across cpps */
463 	{
464 		.format = PIPE_FORMAT_R16_UINT,
465 		.layout = {
466 			.tile_mode = TILE6_3,
467 			.ubwc = true,
468 			.width0 = 16384, .height0 = 1,
469 			.slices = {
470 				{ .offset = 0, .pitch = 32768 },
471 				{ .offset = 524288, .pitch = 16384 },
472 				{ .offset = 786432, .pitch = 8192 },
473 				{ .offset = 917504, .pitch = 4096 },
474 				{ .offset = 983040, .pitch = 2048 },
475 				{ .offset = 1015808, .pitch = 1024 },
476 				{ .offset = 1032192, .pitch = 512 },
477 				{ .offset = 1040384, .pitch = 256 },
478 				{ .offset = 1044480, .pitch = 256 },
479 				{ .offset = 1048576, .pitch = 256 },
480 				{ .offset = 1052672, .pitch = 256 },
481 				{ .offset = 1056768, .pitch = 256 },
482 				{ .offset = 1060864, .pitch = 256 },
483 				{ .offset = 1064960, .pitch = 256 },
484 				{ .offset = 1069056, .pitch = 256 },
485 			},
486 			.ubwc_slices = {
487 				{ .offset = 0, .pitch = 1024 },
488 				{ .offset = 65536, .pitch = 512 },
489 				{ .offset = 98304, .pitch = 256 },
490 				{ .offset = 114688, .pitch = 128 },
491 				{ .offset = 122880, .pitch = 64 },
492 				{ .offset = 126976, .pitch = 64 },
493 				{ .offset = 131072, .pitch = 64 },
494 				{ .offset = 135168, .pitch = 64 },
495 				{ .offset = 139264, .pitch = 64 },
496 				{ .offset = 143360, .pitch = 64 },
497 				{ .offset = 147456, .pitch = 64 },
498 				{ .offset = 151552, .pitch = 64 },
499 				{ .offset = 155648, .pitch = 64 },
500 				{ .offset = 159744, .pitch = 64 },
501 				{ .offset = 163840, .pitch = 64 },
502 			},
503 		},
504 	},
505 	{
506 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
507 		.layout = {
508 			.tile_mode = TILE6_3,
509 			.ubwc = true,
510 			.width0 = 16384, .height0 = 1,
511 			.slices = {
512 				{ .offset = 0, .pitch = 65536 },
513 				{ .offset = 1048576, .pitch = 32768 },
514 				{ .offset = 1572864, .pitch = 16384 },
515 				{ .offset = 1835008, .pitch = 8192 },
516 				{ .offset = 1966080, .pitch = 4096 },
517 				{ .offset = 2031616, .pitch = 2048 },
518 				{ .offset = 2064384, .pitch = 1024 },
519 				{ .offset = 2080768, .pitch = 512 },
520 				{ .offset = 2088960, .pitch = 256 },
521 				{ .offset = 2093056, .pitch = 256 },
522 				{ .offset = 2097152, .pitch = 256 },
523 				{ .offset = 2101248, .pitch = 256 },
524 				{ .offset = 2105344, .pitch = 256 },
525 				{ .offset = 2109440, .pitch = 256 },
526 				{ .offset = 2113536, .pitch = 256 },
527 			},
528 			.ubwc_slices = {
529 				{ .offset = 0, .pitch = 1024 },
530 				{ .offset = 65536, .pitch = 512 },
531 				{ .offset = 98304, .pitch = 256 },
532 				{ .offset = 114688, .pitch = 128 },
533 				{ .offset = 122880, .pitch = 64 },
534 				{ .offset = 126976, .pitch = 64 },
535 				{ .offset = 131072, .pitch = 64 },
536 				{ .offset = 135168, .pitch = 64 },
537 				{ .offset = 139264, .pitch = 64 },
538 				{ .offset = 143360, .pitch = 64 },
539 				{ .offset = 147456, .pitch = 64 },
540 				{ .offset = 151552, .pitch = 64 },
541 				{ .offset = 155648, .pitch = 64 },
542 				{ .offset = 159744, .pitch = 64 },
543 				{ .offset = 163840, .pitch = 64 },
544 			},
545 		},
546 	},
547 	{
548 		.format = PIPE_FORMAT_R32G32B32A32_FLOAT,
549 		.layout = {
550 			.tile_mode = TILE6_3,
551 			.ubwc = true,
552 			.width0 = 16384, .height0 = 1,
553 			.slices = {
554 				{ .offset = 0, .pitch = 262144 },
555 				{ .offset = 4194304, .pitch = 131072 },
556 				{ .offset = 6291456, .pitch = 65536 },
557 				{ .offset = 7340032, .pitch = 32768 },
558 				{ .offset = 7864320, .pitch = 16384 },
559 				{ .offset = 8126464, .pitch = 8192 },
560 				{ .offset = 8257536, .pitch = 4096 },
561 				{ .offset = 8323072, .pitch = 2048 },
562 				{ .offset = 8355840, .pitch = 1024 },
563 				{ .offset = 8372224, .pitch = 1024 },
564 				{ .offset = 8388608, .pitch = 1024 },
565 				{ .offset = 8404992, .pitch = 1024 },
566 				{ .offset = 8421376, .pitch = 1024 },
567 				{ .offset = 8437760, .pitch = 1024 },
568 				{ .offset = 8454144, .pitch = 1024 },
569 			},
570 			.ubwc_slices = {
571 				{ .offset = 0, .pitch = 4096 },
572 				{ .offset = 262144, .pitch = 2048 },
573 				{ .offset = 393216, .pitch = 1024 },
574 				{ .offset = 458752, .pitch = 512 },
575 				{ .offset = 491520, .pitch = 256 },
576 				{ .offset = 507904, .pitch = 128 },
577 				{ .offset = 516096, .pitch = 64 },
578 				{ .offset = 520192, .pitch = 64 },
579 				{ .offset = 524288, .pitch = 64 },
580 				{ .offset = 528384, .pitch = 64 },
581 				{ .offset = 532480, .pitch = 64 },
582 				{ .offset = 536576, .pitch = 64 },
583 				{ .offset = 540672, .pitch = 64 },
584 				{ .offset = 544768, .pitch = 64 },
585 				{ .offset = 548864, .pitch = 64 },
586 			},
587 		},
588 	},
589 
590 	{
591 		.format = PIPE_FORMAT_R8G8B8A8_UNORM,
592 		.layout = {
593 			.tile_mode = TILE6_3,
594 			.ubwc = true,
595 			.nr_samples = 4,
596 			.width0 = 412, .height0 = 732,
597 			.slices = {
598 				{ .offset = 0, .pitch = 7168 },
599 			},
600 			.ubwc_slices = {
601 				{ .offset = 0, .pitch = 128 },
602 			},
603 		},
604 	},
605 };
606 
607 int
main(int argc,char ** argv)608 main(int argc, char **argv)
609 {
610 	int ret = 0;
611 
612 	for (int i = 0; i < ARRAY_SIZE(testcases); i++) {
613 		if (!fdl_test_layout(&testcases[i], 630))
614 			ret = 1;
615 	}
616 
617 	return ret;
618 }
619