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