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