1b0ab5608Smrg/* 2b0ab5608Smrg * Copyright 2022 Advanced Micro Devices, Inc. 3b0ab5608Smrg * 4b0ab5608Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5b0ab5608Smrg * copy of this software and associated documentation files (the "Software"), 6b0ab5608Smrg * to deal in the Software without restriction, including without limitation 7b0ab5608Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8b0ab5608Smrg * and/or sell copies of the Software, and to permit persons to whom the 9b0ab5608Smrg * Software is furnished to do so, subject to the following conditions: 10b0ab5608Smrg * 11b0ab5608Smrg * The above copyright notice and this permission notice shall be included in 12b0ab5608Smrg * all copies or substantial portions of the Software. 13b0ab5608Smrg * 14b0ab5608Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15b0ab5608Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16b0ab5608Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17b0ab5608Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18b0ab5608Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19b0ab5608Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20b0ab5608Smrg * OTHER DEALINGS IN THE SOFTWARE. 21b0ab5608Smrg * 22b0ab5608Smrg*/ 23b0ab5608Smrg 24b0ab5608Smrg#ifndef _shader_code_h_ 25b0ab5608Smrg#define _shader_code_h_ 26b0ab5608Smrg 27b0ab5608Smrg#ifndef ARRAY_SIZE 28b0ab5608Smrg#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 29b0ab5608Smrg#endif 30b0ab5608Smrg 31b0ab5608Smrgenum amdgpu_test_gfx_version { 32b0ab5608Smrg AMDGPU_TEST_GFX_V9 = 0, 33b0ab5608Smrg AMDGPU_TEST_GFX_V10, 34b0ab5608Smrg AMDGPU_TEST_GFX_V11, 35b0ab5608Smrg AMDGPU_TEST_GFX_MAX, 36b0ab5608Smrg}; 37b0ab5608Smrg 38b0ab5608Smrgenum cs_type { 39b0ab5608Smrg CS_BUFFERCLEAR = 0, 40b0ab5608Smrg CS_BUFFERCOPY, 41b0ab5608Smrg CS_HANG, 42b0ab5608Smrg CS_HANG_SLOW, 43b0ab5608Smrg}; 44b0ab5608Smrg 45b0ab5608Smrgenum ps_type { 46b0ab5608Smrg PS_CONST, 47b0ab5608Smrg PS_TEX, 48b0ab5608Smrg PS_HANG, 49b0ab5608Smrg PS_HANG_SLOW 50b0ab5608Smrg}; 51b0ab5608Smrg 52b0ab5608Smrgenum vs_type { 53b0ab5608Smrg VS_RECTPOSTEXFAST, 54b0ab5608Smrg}; 55b0ab5608Smrg 56b0ab5608Smrgstruct reg_info { 57b0ab5608Smrg uint32_t reg_offset; ///< Memory mapped register offset 58b0ab5608Smrg uint32_t reg_value; ///< register value 59b0ab5608Smrg}; 60b0ab5608Smrg 61b0ab5608Smrg#include "shader_code_hang.h" 62b0ab5608Smrg#include "shader_code_gfx9.h" 63b0ab5608Smrg#include "shader_code_gfx10.h" 64b0ab5608Smrg#include "shader_code_gfx11.h" 65b0ab5608Smrg 66b0ab5608Smrgstruct shader_test_cs_shader { 67b0ab5608Smrg const uint32_t *shader; 68b0ab5608Smrg uint32_t shader_size; 69b0ab5608Smrg const struct reg_info *sh_reg; 70b0ab5608Smrg uint32_t num_sh_reg; 71b0ab5608Smrg const struct reg_info *context_reg; 72b0ab5608Smrg uint32_t num_context_reg; 73b0ab5608Smrg}; 74b0ab5608Smrg 75b0ab5608Smrgstruct shader_test_ps_shader { 76b0ab5608Smrg const uint32_t *shader; 77b0ab5608Smrg unsigned shader_size; 78bbff01ceSmrg uint32_t patchinfo_code_size; 79b0ab5608Smrg const uint32_t *patchinfo_code; 80b0ab5608Smrg const uint32_t *patchinfo_code_offset; 81b0ab5608Smrg const struct reg_info *sh_reg; 82bbff01ceSmrg uint32_t num_sh_reg; 83b0ab5608Smrg const struct reg_info *context_reg; 84bbff01ceSmrg uint32_t num_context_reg; 85b0ab5608Smrg}; 86b0ab5608Smrg 87b0ab5608Smrgstruct shader_test_vs_shader { 88b0ab5608Smrg const uint32_t *shader; 89b0ab5608Smrg uint32_t shader_size; 90b0ab5608Smrg const struct reg_info *sh_reg; 91b0ab5608Smrg uint32_t num_sh_reg; 92b0ab5608Smrg const struct reg_info *context_reg; 93b0ab5608Smrg uint32_t num_context_reg; 94b0ab5608Smrg}; 95b0ab5608Smrg 96b0ab5608Smrgstatic const struct shader_test_cs_shader shader_test_cs[AMDGPU_TEST_GFX_MAX][2] = { 97b0ab5608Smrg // gfx9, cs_bufferclear 98b0ab5608Smrg {{bufferclear_cs_shader_gfx9, sizeof(bufferclear_cs_shader_gfx9), bufferclear_cs_shader_registers_gfx9, ARRAY_SIZE(bufferclear_cs_shader_registers_gfx9)}, 99b0ab5608Smrg // gfx9, cs_buffercopy 100b0ab5608Smrg {buffercopy_cs_shader_gfx9, sizeof(buffercopy_cs_shader_gfx9), bufferclear_cs_shader_registers_gfx9, ARRAY_SIZE(bufferclear_cs_shader_registers_gfx9)}}, 101b0ab5608Smrg // gfx10, cs_bufferclear 102b0ab5608Smrg {{bufferclear_cs_shader_gfx10, sizeof(bufferclear_cs_shader_gfx10), bufferclear_cs_shader_registers_gfx9, ARRAY_SIZE(bufferclear_cs_shader_registers_gfx9)}, 103b0ab5608Smrg // gfx10, cs_buffercopy 104b0ab5608Smrg {buffercopy_cs_shader_gfx10, sizeof(bufferclear_cs_shader_gfx10), bufferclear_cs_shader_registers_gfx9, ARRAY_SIZE(bufferclear_cs_shader_registers_gfx9)}}, 105b0ab5608Smrg // gfx11, cs_bufferclear 106b0ab5608Smrg {{bufferclear_cs_shader_gfx11, sizeof(bufferclear_cs_shader_gfx11), bufferclear_cs_shader_registers_gfx11, ARRAY_SIZE(bufferclear_cs_shader_registers_gfx11)}, 107b0ab5608Smrg // gfx11, cs_buffercopy 108b0ab5608Smrg {buffercopy_cs_shader_gfx11, sizeof(bufferclear_cs_shader_gfx11), bufferclear_cs_shader_registers_gfx11, ARRAY_SIZE(bufferclear_cs_shader_registers_gfx11)}}, 109b0ab5608Smrg}; 110b0ab5608Smrg 111b0ab5608Smrg#define SHADER_PS_INFO(_ps, _n) \ 112b0ab5608Smrg {ps_##_ps##_shader_gfx##_n, sizeof(ps_##_ps##_shader_gfx##_n), \ 113b0ab5608Smrg ps_##_ps##_shader_patchinfo_code_size_gfx##_n, \ 114bbff01ceSmrg &(ps_##_ps##_shader_patchinfo_code_gfx##_n)[0][0][0], \ 115b0ab5608Smrg ps_##_ps##_shader_patchinfo_offset_gfx##_n, \ 116b0ab5608Smrg ps_##_ps##_sh_registers_gfx##_n, ps_##_ps##_num_sh_registers_gfx##_n, \ 117b0ab5608Smrg ps_##_ps##_context_registers_gfx##_n, ps_##_ps##_num_context_registers_gfx##_n} 118b0ab5608Smrgstatic const struct shader_test_ps_shader shader_test_ps[AMDGPU_TEST_GFX_MAX][2] = { 119b0ab5608Smrg {SHADER_PS_INFO(const, 9), SHADER_PS_INFO(tex, 9)}, 120b0ab5608Smrg {SHADER_PS_INFO(const, 10), SHADER_PS_INFO(tex, 10)}, 121b0ab5608Smrg {SHADER_PS_INFO(const, 11), SHADER_PS_INFO(tex, 11)}, 122b0ab5608Smrg}; 123b0ab5608Smrg 124b0ab5608Smrg#define SHADER_VS_INFO(_vs, _n) \ 125b0ab5608Smrg {vs_##_vs##_shader_gfx##_n, sizeof(vs_##_vs##_shader_gfx##_n), \ 126b0ab5608Smrg vs_##_vs##_sh_registers_gfx##_n, vs_##_vs##_num_sh_registers_gfx##_n, \ 127b0ab5608Smrg vs_##_vs##_context_registers_gfx##_n, vs_##_vs##_num_context_registers_gfx##_n} 128b0ab5608Smrgstatic const struct shader_test_vs_shader shader_test_vs[AMDGPU_TEST_GFX_MAX][1] = { 129b0ab5608Smrg {SHADER_VS_INFO(RectPosTexFast, 9)}, 130b0ab5608Smrg {SHADER_VS_INFO(RectPosTexFast, 10)}, 131b0ab5608Smrg {SHADER_VS_INFO(RectPosTexFast, 11)}, 132b0ab5608Smrg}; 133b0ab5608Smrg 134b0ab5608Smrgstruct shader_test_gfx_info { 135b0ab5608Smrg const uint32_t *preamble_cache; 136b0ab5608Smrg uint32_t size_preamble_cache; 137b0ab5608Smrg const uint32_t *cached_cmd; 138b0ab5608Smrg uint32_t size_cached_cmd; 139b0ab5608Smrg uint32_t sh_reg_base; 140b0ab5608Smrg uint32_t context_reg_base; 141b0ab5608Smrg}; 142b0ab5608Smrg 143b0ab5608Smrg#define SHADER_TEST_GFX_INFO(_n) \ 144b0ab5608Smrg preamblecache_gfx##_n, sizeof(preamblecache_gfx##_n), \ 145b0ab5608Smrg cached_cmd_gfx##_n, sizeof(cached_cmd_gfx##_n), \ 146b0ab5608Smrg sh_reg_base_gfx##_n, context_reg_base_gfx##_n 147b0ab5608Smrg 148b0ab5608Smrgstatic struct shader_test_gfx_info shader_test_gfx_info[AMDGPU_TEST_GFX_MAX] = { 149b0ab5608Smrg {SHADER_TEST_GFX_INFO(9),}, 150b0ab5608Smrg {SHADER_TEST_GFX_INFO(10),}, 151b0ab5608Smrg {SHADER_TEST_GFX_INFO(11),}, 152b0ab5608Smrg}; 153b0ab5608Smrg#endif 154