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 "adreno_pm4.xml.h"
10 #include "a6xx.xml.h"
11
12 #include <stdio.h>
13
14 static const struct testcase
15 testcases[] =
16 {
17 /* A straightforward first testcase, linear, with an obvious format. */
18 {
19 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
20 .layout =
21 {
22 .width0 = 32,
23 .height0 = 32,
24 .slices =
25 {
26 {.offset = 0, .pitch = 256},
27 {.offset = 8192, .pitch = 256},
28 {.offset = 12288, .pitch = 256},
29 {.offset = 14336, .pitch = 256},
30 {.offset = 15360, .pitch = 256},
31 {.offset = 15872, .pitch = 256},
32 },
33 },
34 },
35
36 /* A tiled/ubwc layout from the blob driver, at a size where the a630
37 * blob driver does something interesting for linear.
38 */
39 {
40 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
41 .layout =
42 {
43 .tile_mode = TILE6_3,
44 .ubwc = true,
45 .width0 = 1024,
46 .height0 = 1,
47 .slices =
48 {
49 {.offset = 0, .pitch = 4096},
50 {.offset = 65536, .pitch = 2048},
51 {.offset = 98304, .pitch = 1024},
52 {.offset = 114688, .pitch = 512},
53 {.offset = 122880, .pitch = 256},
54 {.offset = 126976, .pitch = 256},
55 {.offset = 131072, .pitch = 256},
56 {.offset = 135168, .pitch = 256},
57 {.offset = 139264, .pitch = 256},
58 {.offset = 143360, .pitch = 256},
59 {.offset = 147456, .pitch = 256},
60 },
61 .ubwc_slices =
62 {
63 {.offset = 0, .pitch = 64},
64 {.offset = 4096, .pitch = 64},
65 {.offset = 8192, .pitch = 64},
66 {.offset = 12288, .pitch = 64},
67 {.offset = 16384, .pitch = 64},
68 {.offset = 20480, .pitch = 64},
69 {.offset = 24576, .pitch = 64},
70 {.offset = 28672, .pitch = 64},
71 {.offset = 32768, .pitch = 64},
72 {.offset = 36864, .pitch = 64},
73 {.offset = 40960, .pitch = 64},
74 },
75 },
76 },
77
78 /* An interesting layout from the blob driver on a630, showing that
79 * per-level pitch must be derived from level 0's pitch, not width0. We
80 * don't do this level 0 pitch disalignment (we pick 4096), so disabled
81 * this test for now.
82 */
83 #if 0
84 {
85 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
86 .layout = {
87 .width0 = 1024, .height0 = 1,
88 .slices = {
89 { .offset = 0, .pitch = 5120 },
90 { .offset = 5120, .pitch = 2560 },
91 { .offset = 7680, .pitch = 1280 },
92 { .offset = 8960, .pitch = 768 },
93 { .offset = 9728, .pitch = 512 },
94 { .offset = 10240, .pitch = 256 },
95 { .offset = 10496, .pitch = 256 },
96 { .offset = 10752, .pitch = 256 },
97 { .offset = 11008, .pitch = 256 },
98 { .offset = 11264, .pitch = 256 },
99 { .offset = 11520, .pitch = 256 },
100 },
101 },
102 },
103 #endif
104
105 /* A layout that we failed on (129 wide has a surprise level 1 pitch
106 * increase), and the sizes bracketing it.
107 */
108 {
109 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
110 .layout =
111 {
112 .width0 = 128,
113 .height0 = 1,
114 .slices =
115 {
116 {.offset = 0, .pitch = 512},
117 {.offset = 512, .pitch = 256},
118 {.offset = 768, .pitch = 256},
119 {.offset = 1024, .pitch = 256},
120 {.offset = 1280, .pitch = 256},
121 {.offset = 1536, .pitch = 256},
122 {.offset = 1792, .pitch = 256},
123 {.offset = 2048, .pitch = 256},
124 },
125 },
126 },
127 {
128 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
129 .layout =
130 {
131 .width0 = 129,
132 .height0 = 1,
133 .slices =
134 {
135 {.offset = 0, .pitch = 768},
136 {.offset = 768, .pitch = 512},
137 {.offset = 1280, .pitch = 256},
138 {.offset = 1536, .pitch = 256},
139 {.offset = 1792, .pitch = 256},
140 {.offset = 2048, .pitch = 256},
141 {.offset = 2304, .pitch = 256},
142 {.offset = 2560, .pitch = 256},
143 },
144 },
145 },
146 {
147 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
148 .layout =
149 {
150 .width0 = 130,
151 .height0 = 1,
152 .slices =
153 {
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 {
171 .width0 = 129,
172 .height0 = 1,
173 .slices =
174 {
175 {.offset = 0, .pitch = 192},
176 {.offset = 192, .pitch = 128},
177 {.offset = 320, .pitch = 64},
178 {.offset = 384, .pitch = 64},
179 {.offset = 448, .pitch = 64},
180 {.offset = 512, .pitch = 64},
181 {.offset = 576, .pitch = 64},
182 {.offset = 640, .pitch = 64},
183 },
184 },
185 },
186 {
187 .format = PIPE_FORMAT_R16_UINT,
188 .layout =
189 {
190 .width0 = 129,
191 .height0 = 1,
192 .slices =
193 {
194 {.offset = 0, .pitch = 384},
195 {.offset = 384, .pitch = 256},
196 {.offset = 640, .pitch = 128},
197 {.offset = 768, .pitch = 128},
198 {.offset = 896, .pitch = 128},
199 {.offset = 1024, .pitch = 128},
200 {.offset = 1152, .pitch = 128},
201 {.offset = 1280, .pitch = 128},
202 },
203 },
204 },
205 {
206 .format = PIPE_FORMAT_R32G32B32A32_FLOAT,
207 .layout =
208 {
209 .width0 = 129,
210 .height0 = 1,
211 .slices =
212 {
213 {.offset = 0, .pitch = 3072},
214 {.offset = 3072, .pitch = 2048},
215 {.offset = 5120, .pitch = 1024},
216 {.offset = 6144, .pitch = 1024},
217 {.offset = 7168, .pitch = 1024},
218 {.offset = 8192, .pitch = 1024},
219 {.offset = 9216, .pitch = 1024},
220 {.offset = 10240, .pitch = 1024},
221 },
222 },
223 },
224
225 /* The 129 failure replicated at every +256 pixels wide. Pick one of
226 * them, and this time increase the height as a new variable as well.
227 */
228 {
229 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
230 .layout =
231 {
232 .width0 = 385,
233 .height0 = 128,
234 .slices =
235 {
236 {.offset = 0, .pitch = 1792},
237 {.offset = 229376, .pitch = 1024},
238 {.offset = 294912, .pitch = 512},
239 {.offset = 311296, .pitch = 256},
240 {.offset = 315392, .pitch = 256},
241 {.offset = 317440, .pitch = 256},
242 {.offset = 318464, .pitch = 256},
243 {.offset = 318976, .pitch = 256},
244 {.offset = 319232, .pitch = 256},
245 },
246 },
247 },
248
249 /* At 257-259 (and replicated every +256 pixels) we had another
250 failure. */
251 {
252 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
253 .layout =
254 {
255 .width0 = 257,
256 .height0 = 1,
257 .slices =
258 {
259 {.offset = 0, .pitch = 1280},
260 {.offset = 1280, .pitch = 768},
261 {.offset = 2048, .pitch = 512},
262 {.offset = 2560, .pitch = 256},
263 {.offset = 2816, .pitch = 256},
264 {.offset = 3072, .pitch = 256},
265 {.offset = 3328, .pitch = 256},
266 {.offset = 3584, .pitch = 256},
267 {.offset = 3840, .pitch = 256},
268 },
269 },
270 },
271 {
272 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
273 .layout =
274 {
275 .width0 = 258,
276 .height0 = 1,
277 .slices =
278 {
279 {.offset = 0, .pitch = 1280},
280 {.offset = 1280, .pitch = 768},
281 {.offset = 2048, .pitch = 512},
282 {.offset = 2560, .pitch = 256},
283 {.offset = 2816, .pitch = 256},
284 {.offset = 3072, .pitch = 256},
285 {.offset = 3328, .pitch = 256},
286 {.offset = 3584, .pitch = 256},
287 {.offset = 3840, .pitch = 256},
288 },
289 },
290 },
291 {
292 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
293 .layout =
294 {
295 .width0 = 259,
296 .height0 = 1,
297 .slices =
298 {
299 {.offset = 0, .pitch = 1280},
300 {.offset = 1280, .pitch = 768},
301 {.offset = 2048, .pitch = 512},
302 {.offset = 2560, .pitch = 256},
303 {.offset = 2816, .pitch = 256},
304 {.offset = 3072, .pitch = 256},
305 {.offset = 3328, .pitch = 256},
306 {.offset = 3584, .pitch = 256},
307 {.offset = 3840, .pitch = 256},
308 },
309 },
310 },
311 {
312 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
313 .layout =
314 {
315 .width0 = 260,
316 .height0 = 1,
317 .slices =
318 {
319 {.offset = 0, .pitch = 1280},
320 {.offset = 1280, .pitch = 768},
321 {.offset = 2048, .pitch = 512},
322 {.offset = 2560, .pitch = 256},
323 {.offset = 2816, .pitch = 256},
324 {.offset = 3072, .pitch = 256},
325 {.offset = 3328, .pitch = 256},
326 {.offset = 3584, .pitch = 256},
327 {.offset = 3840, .pitch = 256},
328 },
329 },
330 },
331
332 /* And, again for the 257-9 failure, test a replica with a larger size*/
333 {
334 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
335 .layout =
336 {
337 .width0 = 513,
338 .height0 = 32,
339 .slices =
340 {
341 {.offset = 0, .pitch = 2304},
342 {.offset = 73728, .pitch = 1280},
343 {.offset = 94208, .pitch = 768},
344 {.offset = 100352, .pitch = 512},
345 {.offset = 102400, .pitch = 256},
346 {.offset = 102912, .pitch = 256},
347 {.offset = 103168, .pitch = 256},
348 {.offset = 103424, .pitch = 256},
349 {.offset = 103680, .pitch = 256},
350 {.offset = 103936, .pitch = 256},
351 },
352 },
353 },
354
355 /* Oh, look. The 513-517 failure extends up to 518 at the next texture
356 * level!
357 */
358 {
359 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
360 .layout =
361 {
362 .width0 = 518,
363 .height0 = 1,
364 .slices =
365 {
366 {.offset = 0, .pitch = 2304},
367 {.offset = 2304, .pitch = 1280},
368 {.offset = 3584, .pitch = 768},
369 {.offset = 4352, .pitch = 512},
370 {.offset = 4864, .pitch = 256},
371 {.offset = 5120, .pitch = 256},
372 {.offset = 5376, .pitch = 256},
373 {.offset = 5632, .pitch = 256},
374 {.offset = 5888, .pitch = 256},
375 {.offset = 6144, .pitch = 256},
376 },
377 },
378 },
379
380 /* Tiled mode testing of the unusual 1/2-bytes-per-pixel pitch
381 alignment */
382 {
383 .format = PIPE_FORMAT_R8_UNORM,
384 .layout =
385 {
386 .tile_mode = TILE6_3,
387 .width0 = 129,
388 .height0 = 1,
389 .slices =
390 {
391 {.offset = 0, .pitch = 256},
392 {.offset = 8192, .pitch = 128},
393 {.offset = 12288, .pitch = 128},
394 {.offset = 16384, .pitch = 128},
395 {.offset = 20480, .pitch = 128},
396 {.offset = 20608, .pitch = 128},
397 {.offset = 20736, .pitch = 128},
398 {.offset = 20864, .pitch = 128},
399 },
400 },
401 },
402
403 /* Single-level RGBA8888 UBWC following UBWC alignment rules laid out
404 * in msm_media_info.h to verify that we don't break buffer sharing.
405 */
406 {
407 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
408 .layout =
409 {
410 .tile_mode = TILE6_3,
411 .ubwc = true,
412 .width0 = 16384,
413 .height0 = 129,
414 .slices =
415 {
416 {.offset = 1024 * 48, .pitch = 16384 * 4},
417 },
418 .ubwc_slices =
419 {
420 {.offset = 0, .pitch = 1024},
421 },
422 },
423 },
424
425 /* UBWC: Pitch comes from POT-aligned level 0. */
426 /* Pitch fixed in this commit, but offsets broken. Will be fixed in
427 * following commits.
428 */
429 {
430 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
431 .layout =
432 {
433 .tile_mode = TILE6_3,
434 .ubwc = true,
435 .width0 = 2049,
436 .height0 = 128,
437 .slices =
438 {
439 {.offset = 0, .pitch = 8448},
440 {.offset = 1081344, .pitch = 4352},
441 {.offset = 1359872, .pitch = 2304},
442 {.offset = 1433600, .pitch = 1280},
443 {.offset = 1454080, .pitch = 768},
444 {.offset = 1466368, .pitch = 512},
445 {.offset = 1474560, .pitch = 256},
446 {.offset = 1478656, .pitch = 256},
447 {.offset = 1482752, .pitch = 256},
448 {.offset = 1486848, .pitch = 256},
449 {.offset = 1490944, .pitch = 256},
450 {.offset = 1495040, .pitch = 256},
451 },
452 .ubwc_slices =
453 {
454 {.offset = 0, .pitch = 256},
455 {.offset = 16384, .pitch = 128},
456 {.offset = 24576, .pitch = 64},
457 {.offset = 28672, .pitch = 64},
458 {.offset = 32768, .pitch = 64},
459 {.offset = 36864, .pitch = 64},
460 {.offset = 40960, .pitch = 64},
461 {.offset = 45056, .pitch = 64},
462 {.offset = 49152, .pitch = 64},
463 {.offset = 53248, .pitch = 64},
464 {.offset = 57344, .pitch = 64},
465 {.offset = 61440, .pitch = 64},
466 },
467 },
468 },
469 /* UBWC: Height comes from POT-aligned level 0. */
470 {
471 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
472 .layout =
473 {
474 .tile_mode = TILE6_3,
475 .ubwc = true,
476 .width0 = 1024,
477 .height0 = 1025,
478 .slices =
479 {
480 {.offset = 0, .pitch = 4096},
481 {.offset = 4259840, .pitch = 2048},
482 {.offset = 5308416, .pitch = 1024},
483 {.offset = 5570560, .pitch = 512},
484 {.offset = 5636096, .pitch = 256},
485 {.offset = 5652480, .pitch = 256},
486 {.offset = 5660672, .pitch = 256},
487 {.offset = 5664768, .pitch = 256},
488 {.offset = 5668864, .pitch = 256},
489 {.offset = 5672960, .pitch = 256},
490 {.offset = 5677056, .pitch = 256},
491 },
492 .ubwc_slices =
493 {
494 {.offset = 0, .pitch = 64},
495 {.offset = 32768, .pitch = 64},
496 {.offset = 49152, .pitch = 64},
497 {.offset = 57344, .pitch = 64},
498 {.offset = 61440, .pitch = 64},
499 {.offset = 65536, .pitch = 64},
500 {.offset = 69632, .pitch = 64},
501 {.offset = 73728, .pitch = 64},
502 {.offset = 77824, .pitch = 64},
503 {.offset = 81920, .pitch = 64},
504 {.offset = 86016, .pitch = 64},
505 },
506 },
507 },
508
509 /* UBWC: Get at minimum height of a level across cpps */
510 {
511 .format = PIPE_FORMAT_R16_UINT,
512 .layout =
513 {
514 .tile_mode = TILE6_3,
515 .ubwc = true,
516 .width0 = 16384,
517 .height0 = 1,
518 .slices =
519 {
520 {.offset = 0, .pitch = 32768},
521 {.offset = 524288, .pitch = 16384},
522 {.offset = 786432, .pitch = 8192},
523 {.offset = 917504, .pitch = 4096},
524 {.offset = 983040, .pitch = 2048},
525 {.offset = 1015808, .pitch = 1024},
526 {.offset = 1032192, .pitch = 512},
527 {.offset = 1040384, .pitch = 256},
528 {.offset = 1044480, .pitch = 256},
529 {.offset = 1048576, .pitch = 256},
530 {.offset = 1052672, .pitch = 256},
531 {.offset = 1056768, .pitch = 256},
532 {.offset = 1060864, .pitch = 256},
533 {.offset = 1064960, .pitch = 256},
534 {.offset = 1069056, .pitch = 256},
535 },
536 .ubwc_slices =
537 {
538 {.offset = 0, .pitch = 1024},
539 {.offset = 65536, .pitch = 512},
540 {.offset = 98304, .pitch = 256},
541 {.offset = 114688, .pitch = 128},
542 {.offset = 122880, .pitch = 64},
543 {.offset = 126976, .pitch = 64},
544 {.offset = 131072, .pitch = 64},
545 {.offset = 135168, .pitch = 64},
546 {.offset = 139264, .pitch = 64},
547 {.offset = 143360, .pitch = 64},
548 {.offset = 147456, .pitch = 64},
549 {.offset = 151552, .pitch = 64},
550 {.offset = 155648, .pitch = 64},
551 {.offset = 159744, .pitch = 64},
552 {.offset = 163840, .pitch = 64},
553 },
554 },
555 },
556 {
557 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
558 .layout =
559 {
560 .tile_mode = TILE6_3,
561 .ubwc = true,
562 .width0 = 16384,
563 .height0 = 1,
564 .slices =
565 {
566 {.offset = 0, .pitch = 65536},
567 {.offset = 1048576, .pitch = 32768},
568 {.offset = 1572864, .pitch = 16384},
569 {.offset = 1835008, .pitch = 8192},
570 {.offset = 1966080, .pitch = 4096},
571 {.offset = 2031616, .pitch = 2048},
572 {.offset = 2064384, .pitch = 1024},
573 {.offset = 2080768, .pitch = 512},
574 {.offset = 2088960, .pitch = 256},
575 {.offset = 2093056, .pitch = 256},
576 {.offset = 2097152, .pitch = 256},
577 {.offset = 2101248, .pitch = 256},
578 {.offset = 2105344, .pitch = 256},
579 {.offset = 2109440, .pitch = 256},
580 {.offset = 2113536, .pitch = 256},
581 },
582 .ubwc_slices =
583 {
584 {.offset = 0, .pitch = 1024},
585 {.offset = 65536, .pitch = 512},
586 {.offset = 98304, .pitch = 256},
587 {.offset = 114688, .pitch = 128},
588 {.offset = 122880, .pitch = 64},
589 {.offset = 126976, .pitch = 64},
590 {.offset = 131072, .pitch = 64},
591 {.offset = 135168, .pitch = 64},
592 {.offset = 139264, .pitch = 64},
593 {.offset = 143360, .pitch = 64},
594 {.offset = 147456, .pitch = 64},
595 {.offset = 151552, .pitch = 64},
596 {.offset = 155648, .pitch = 64},
597 {.offset = 159744, .pitch = 64},
598 {.offset = 163840, .pitch = 64},
599 },
600 },
601 },
602 {
603 .format = PIPE_FORMAT_R32G32B32A32_FLOAT,
604 .layout =
605 {
606 .tile_mode = TILE6_3,
607 .ubwc = true,
608 .width0 = 16384,
609 .height0 = 1,
610 .slices =
611 {
612 {.offset = 0, .pitch = 262144},
613 {.offset = 4194304, .pitch = 131072},
614 {.offset = 6291456, .pitch = 65536},
615 {.offset = 7340032, .pitch = 32768},
616 {.offset = 7864320, .pitch = 16384},
617 {.offset = 8126464, .pitch = 8192},
618 {.offset = 8257536, .pitch = 4096},
619 {.offset = 8323072, .pitch = 2048},
620 {.offset = 8355840, .pitch = 1024},
621 {.offset = 8372224, .pitch = 1024},
622 {.offset = 8388608, .pitch = 1024},
623 {.offset = 8404992, .pitch = 1024},
624 {.offset = 8421376, .pitch = 1024},
625 {.offset = 8437760, .pitch = 1024},
626 {.offset = 8454144, .pitch = 1024},
627 },
628 .ubwc_slices =
629 {
630 {.offset = 0, .pitch = 4096},
631 {.offset = 262144, .pitch = 2048},
632 {.offset = 393216, .pitch = 1024},
633 {.offset = 458752, .pitch = 512},
634 {.offset = 491520, .pitch = 256},
635 {.offset = 507904, .pitch = 128},
636 {.offset = 516096, .pitch = 64},
637 {.offset = 520192, .pitch = 64},
638 {.offset = 524288, .pitch = 64},
639 {.offset = 528384, .pitch = 64},
640 {.offset = 532480, .pitch = 64},
641 {.offset = 536576, .pitch = 64},
642 {.offset = 540672, .pitch = 64},
643 {.offset = 544768, .pitch = 64},
644 {.offset = 548864, .pitch = 64},
645 },
646 },
647 },
648
649 {
650 .format = PIPE_FORMAT_R8G8B8A8_UNORM,
651 .layout =
652 {
653 .tile_mode = TILE6_3,
654 .ubwc = true,
655 .nr_samples = 4,
656 .width0 = 412,
657 .height0 = 732,
658 .slices =
659 {
660 {.offset = 0, .pitch = 7168},
661 },
662 .ubwc_slices =
663 {
664 {.offset = 0, .pitch = 128},
665 },
666 },
667 },
668
669 /* Easy 32x32x32 3d case */
670 {
671 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
672 .is_3d = true,
673 .layout =
674 {
675 .tile_mode = TILE6_3,
676 .ubwc = false,
677 .width0 = 32,
678 .height0 = 32,
679 .depth0 = 32,
680 .slices =
681 {
682 {.offset = 0, .pitch = 256, .size0 = 8192},
683 {.offset = 262144, .pitch = 256, .size0 = 4096},
684 {.offset = 327680, .pitch = 256, .size0 = 4096},
685 {.offset = 360448, .pitch = 256, .size0 = 4096},
686 {.offset = 376832, .pitch = 256, .size0 = 4096},
687 {.offset = 385024, .pitch = 256},
688 },
689 },
690 },
691
692 /* Scale up a bit to 128x128x32 3d */
693 {
694 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
695 .is_3d = true,
696 .layout =
697 {
698 .tile_mode = TILE6_3,
699 .ubwc = false,
700 .width0 = 128,
701 .height0 = 128,
702 .depth0 = 32,
703 .slices =
704 {
705 {.offset = 0, .pitch = 512, .size0 = 65536},
706 {.offset = 2097152, .pitch = 256, .size0 = 16384},
707 {.offset = 2359296, .pitch = 256, .size0 = 8192},
708 {.offset = 2424832, .pitch = 256, .size0 = 8192},
709 {.offset = 2457600, .pitch = 256, .size0 = 8192},
710 {.offset = 2473984, .pitch = 256},
711 {.offset = 2482176, .pitch = 256},
712 {.offset = 2490368, .pitch = 256},
713 },
714 },
715 },
716
717 /* Changing width to 1 changes where minimum layer size happens. */
718 {
719 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
720 .is_3d = true,
721 .layout =
722 {
723 .tile_mode = TILE6_LINEAR,
724 .ubwc = false,
725 .width0 = 1,
726 .height0 = 128,
727 .depth0 = 32,
728 .slices =
729 {
730 {.offset = 0, .pitch = 256, .size0 = 32768},
731 {.offset = 1048576, .pitch = 256, .size0 = 16384},
732 {.offset = 1310720, .pitch = 256, .size0 = 16384},
733 {.offset = 1441792, .pitch = 256, .size0 = 16384},
734 {.offset = 1507328, .pitch = 256, .size0 = 16384},
735 {.offset = 1540096, .pitch = 256},
736 {.offset = 1556480, .pitch = 256},
737 {.offset = 1572864, .pitch = 256},
738 },
739 },
740 },
741
742 /* And increasing width makes it happen later. */
743 {
744 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
745 .is_3d = true,
746 .layout =
747 {
748 .tile_mode = TILE6_3,
749 .ubwc = false,
750 .width0 = 1024,
751 .height0 = 128,
752 .depth0 = 32,
753 .slices =
754 {
755 {.offset = 0, .pitch = 4096, .size0 = 524288},
756 {.offset = 16777216, .pitch = 2048, .size0 = 131072},
757 {.offset = 18874368, .pitch = 1024, .size0 = 32768},
758 {.offset = 19136512, .pitch = 512, .size0 = 8192},
759 {.offset = 19169280, .pitch = 256, .size0 = 4096},
760 {.offset = 19177472, .pitch = 256},
761 {.offset = 19181568, .pitch = 256},
762 {.offset = 19185664, .pitch = 256},
763 {.offset = 19189760, .pitch = 256},
764 {.offset = 19193856, .pitch = 256},
765 {.offset = 19197952, .pitch = 256},
766 },
767 },
768 },
769
770 /* NPOT height case that piglit was catching 3d texture failure in, we
771 * use a higher depth though to get more slice pitches detected from
772 * the blob.
773 */
774 {
775 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
776 .is_3d = true,
777 .layout =
778 {
779 .tile_mode = TILE6_3,
780 .ubwc = false,
781 .width0 = 128,
782 .height0 = 129,
783 .depth0 = 16,
784 .slices =
785 {
786 {.offset = 0, .pitch = 512, .size0 = 73728},
787 {.offset = 1179648, .pitch = 256, .size0 = 20480},
788 {.offset = 1343488, .pitch = 256, .size0 = 20480},
789 {.offset = 1425408, .pitch = 256, .size0 = 20480},
790 {.offset = 1466368, .pitch = 256},
791 {.offset = 1486848, .pitch = 256},
792 {.offset = 1507328, .pitch = 256},
793 {.offset = 1527808, .pitch = 256},
794 },
795 },
796 },
797
798 /* NPOT height case that my first 3d layout ideas failed on. */
799 {
800 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
801 .is_3d = true,
802 .layout =
803 {
804 .tile_mode = TILE6_3,
805 .ubwc = false,
806 .width0 = 128,
807 .height0 = 132,
808 .depth0 = 16,
809 .slices =
810 {
811 {.offset = 0, .pitch = 512, .size0 = 73728},
812 {.offset = 1179648, .pitch = 256, .size0 = 20480},
813 {.offset = 1343488, .pitch = 256, .size0 = 20480},
814 {.offset = 1425408, .pitch = 256, .size0 = 20480},
815 {.offset = 1466368, .pitch = 256},
816 {.offset = 1486848, .pitch = 256},
817 {.offset = 1507328, .pitch = 256},
818 {.offset = 1527808, .pitch = 256},
819 },
820 },
821 },
822
823 /* blob used MIN_LAYERSZ = 0x3000 here.
824 *
825 * This is an interesting case for 3d layout, since pitch stays NPOT for a while.
826 */
827 {
828 .format = PIPE_FORMAT_R9G9B9E5_FLOAT,
829 .is_3d = true,
830 .layout =
831 {
832 .tile_mode = TILE6_3,
833 .ubwc = false,
834 .width0 = 768,
835 .height0 = 32,
836 .depth0 = 128,
837 .slices =
838 {
839 {.offset = 0, .pitch = 3072, .size0 = 98304},
840 {.offset = 12582912, .pitch = 1536, .size0 = 24576},
841 {.offset = 14155776, .pitch = 768, .size0 = 12288},
842 {.offset = 14548992, .pitch = 512, .size0 = 12288},
843 {.offset = 14745600, .pitch = 256, .size0 = 12288},
844 {.offset = 14843904, .pitch = 256, .size0 = 12288},
845 {.offset = 14893056, .pitch = 256, .size0 = 12288},
846 {.offset = 14917632, .pitch = 256},
847 {.offset = 14929920, .pitch = 256},
848 {.offset = 14942208, .pitch = 256},
849 },
850 },
851 },
852
853 /* dEQP-GLES31.functional.copy_image.mixed.viewclass_128_bits_mixed.rgba32f_rg11_eac.texture3d_to_texture2d */
854 #if 0 /* XXX: We disagree with the blob about level 0 size0, but the testcase passes. */
855 {
856 .format = PIPE_FORMAT_R32G32B32A32_FLOAT,
857 .is_3d = true,
858 .layout =
859 {
860 .tile_mode = TILE6_3,
861 .ubwc = false,
862 .width0 = 129,
863 .height0 = 129,
864 .depth0 = 17,
865 .slices =
866 {
867 {.offset = 0, .pitch = 3072, .size0 = 524288},
868 {.offset = 8912896, .pitch = 2048, .size0 = 131072},
869 {.offset = 9961472, .pitch = 1024, .size0 = 32768},
870 {.offset = 10092544, .pitch = 1024, .size0 = 16384},
871 {.offset = 10125312, .pitch = 1024},
872 {.offset = 10141696, .pitch = 1024},
873 {.offset = 10158080, .pitch = 1024},
874 {.offset = 10174464, .pitch = 1024},
875 },
876 },
877 },
878 #endif
879
880 /* Size minification issue found while looking at the above test. */
881 {
882 .format = PIPE_FORMAT_R32G32B32A32_FLOAT,
883 .is_3d = true,
884 .layout =
885 {
886 .tile_mode = TILE6_3,
887 .ubwc = false,
888 .width0 = 129,
889 .height0 = 9,
890 .depth0 = 8,
891 .slices =
892 {
893 {.offset = 0, .pitch = 3072, .size0 = 49152},
894 {.offset = 393216, .pitch = 2048, .size0 = 32768},
895 {.offset = 524288, .pitch = 1024, .size0 = 32768},
896 {.offset = 589824, .pitch = 1024},
897 {.offset = 622592, .pitch = 1024},
898 {.offset = 655360, .pitch = 1024},
899 {.offset = 688128, .pitch = 1024},
900 {.offset = 720896, .pitch = 1024},
901 },
902 },
903 },
904
905 };
906
907 int
main(int argc,char ** argv)908 main(int argc, char **argv)
909 {
910 int ret = 0;
911
912 for (int i = 0; i < ARRAY_SIZE(testcases); i++) {
913 if (!fdl_test_layout(&testcases[i], 630))
914 ret = 1;
915 }
916
917 return ret;
918 }
919