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