Path: blob/21.2-virgl/src/amd/common/ac_surface_test_common.h
7170 views
/*1* Copyright © 2021 Advanced Micro Devices, Inc.2* All Rights Reserved.3*4* Permission is hereby granted, free of charge, to any person obtaining5* a copy of this software and associated documentation files (the6* "Software"), to deal in the Software without restriction, including7* without limitation the rights to use, copy, modify, merge, publish,8* distribute, sub license, and/or sell copies of the Software, and to9* permit persons to whom the Software is furnished to do so, subject to10* the following conditions:11*12* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES14* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND15* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS16* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER17* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE19* USE OR OTHER DEALINGS IN THE SOFTWARE.20*21* The above copyright notice and this permission notice (including the22* next paragraph) shall be included in all copies or substantial portions23* of the Software.24*/2526#ifndef AC_SURFACE_TEST_COMMON_H27#define AC_SURFACE_TEST_COMMON_H2829#include "ac_gpu_info.h"30#include "amdgfxregs.h"3132typedef void (*gpu_init_func)(struct radeon_info *info);3334static void init_vega10(struct radeon_info *info)35{36info->family = CHIP_VEGA10;37info->chip_class = GFX9;38info->family_id = AMDGPU_FAMILY_AI;39info->chip_external_rev = 0x01;40info->use_display_dcc_unaligned = false;41info->use_display_dcc_with_retile_blit = false;42info->has_graphics = true;43info->tcc_cache_line_size = 64;44info->max_render_backends = 16;4546info->gb_addr_config = 0x2a114042;47}4849static void init_vega20(struct radeon_info *info)50{51info->family = CHIP_VEGA20;52info->chip_class = GFX9;53info->family_id = AMDGPU_FAMILY_AI;54info->chip_external_rev = 0x30;55info->use_display_dcc_unaligned = false;56info->use_display_dcc_with_retile_blit = false;57info->has_graphics = true;58info->tcc_cache_line_size = 64;59info->max_render_backends = 16;6061info->gb_addr_config = 0x2a114042;62}636465static void init_raven(struct radeon_info *info)66{67info->family = CHIP_RAVEN;68info->chip_class = GFX9;69info->family_id = AMDGPU_FAMILY_RV;70info->chip_external_rev = 0x01;71info->use_display_dcc_unaligned = false;72info->use_display_dcc_with_retile_blit = true;73info->has_graphics = true;74info->tcc_cache_line_size = 64;75info->max_render_backends = 2;7677info->gb_addr_config = 0x24000042;78}7980static void init_raven2(struct radeon_info *info)81{82info->family = CHIP_RAVEN2;83info->chip_class = GFX9;84info->family_id = AMDGPU_FAMILY_RV;85info->chip_external_rev = 0x82;86info->use_display_dcc_unaligned = true;87info->use_display_dcc_with_retile_blit = false;88info->has_graphics = true;89info->tcc_cache_line_size = 64;90info->max_render_backends = 1;9192info->gb_addr_config = 0x26013041;93}9495static void init_navi10(struct radeon_info *info)96{97info->family = CHIP_NAVI10;98info->chip_class = GFX10;99info->family_id = AMDGPU_FAMILY_NV;100info->chip_external_rev = 3;101info->use_display_dcc_unaligned = false;102info->use_display_dcc_with_retile_blit = false;103info->has_graphics = true;104info->tcc_cache_line_size = 128;105info->max_render_backends = 16;106107info->gb_addr_config = 0x00100044;108}109110static void init_navi14(struct radeon_info *info)111{112info->family = CHIP_NAVI14;113info->chip_class = GFX10;114info->family_id = AMDGPU_FAMILY_NV;115info->chip_external_rev = 0x15;116info->use_display_dcc_unaligned = false;117info->use_display_dcc_with_retile_blit = false;118info->has_graphics = true;119info->tcc_cache_line_size = 128;120info->max_render_backends = 8;121122info->gb_addr_config = 0x00000043;123}124125static void init_sienna_cichlid(struct radeon_info *info)126{127info->family = CHIP_SIENNA_CICHLID;128info->chip_class = GFX10_3;129info->family_id = AMDGPU_FAMILY_NV;130info->chip_external_rev = 0x28;131info->use_display_dcc_unaligned = false;132info->use_display_dcc_with_retile_blit = true;133info->has_graphics = true;134info->tcc_cache_line_size = 128;135info->has_rbplus = true;136info->rbplus_allowed = true;137info->max_render_backends = 16;138139info->gb_addr_config = 0x00000444;140}141142static void init_navy_flounder(struct radeon_info *info)143{144info->family = CHIP_NAVY_FLOUNDER;145info->chip_class = GFX10_3;146info->family_id = AMDGPU_FAMILY_NV;147info->chip_external_rev = 0x32;148info->use_display_dcc_unaligned = false;149info->use_display_dcc_with_retile_blit = true;150info->has_graphics = true;151info->tcc_cache_line_size = 128;152info->has_rbplus = true;153info->rbplus_allowed = true;154info->max_render_backends = 8;155156info->gb_addr_config = 0x00000344;157}158159struct testcase {160const char *name;161gpu_init_func init;162int banks_or_pkrs;163int pipes;164int se;165int rb_per_se;166};167168static struct testcase testcases[] = {169{"vega10", init_vega10, 4, 2, 2, 2},170{"vega10_diff_bank", init_vega10, 3, 2, 2, 2},171{"vega10_diff_rb", init_vega10, 4, 2, 2, 0},172{"vega10_diff_pipe", init_vega10, 4, 0, 2, 2},173{"vega10_diff_se", init_vega10, 4, 2, 1, 2},174{"vega20", init_vega20, 4, 2, 2, 2},175{"raven", init_raven, 0, 2, 0, 1},176{"raven2", init_raven2, 3, 1, 0, 1},177{"navi10", init_navi10, 0, 4, 1, 0},178{"navi10_diff_pipe", init_navi10, 0, 3, 1, 0},179{"navi10_diff_pkr", init_navi10, 1, 4, 1, 0},180{"navi14", init_navi14, 1, 3, 1, 0},181{"sienna_cichlid", init_sienna_cichlid},182{"navy_flounder", init_navy_flounder},183};184185static struct radeon_info get_radeon_info(struct testcase *testcase)186{187struct radeon_info info = {188.drm_major = 3,189.drm_minor = 30,190};191192testcase->init(&info);193194switch(info.chip_class) {195case GFX10_3:196break;197case GFX10:198info.gb_addr_config = (info.gb_addr_config &199C_0098F8_NUM_PIPES &200C_0098F8_NUM_PKRS) |201S_0098F8_NUM_PIPES(testcase->pipes) |202S_0098F8_NUM_PKRS(testcase->banks_or_pkrs);203break;204case GFX9:205info.gb_addr_config = (info.gb_addr_config &206C_0098F8_NUM_PIPES &207C_0098F8_NUM_BANKS &208C_0098F8_NUM_SHADER_ENGINES_GFX9 &209C_0098F8_NUM_RB_PER_SE) |210S_0098F8_NUM_PIPES(testcase->pipes) |211S_0098F8_NUM_BANKS(testcase->banks_or_pkrs) |212S_0098F8_NUM_SHADER_ENGINES_GFX9(testcase->se) |213S_0098F8_NUM_RB_PER_SE(testcase->rb_per_se);214break;215default:216unreachable("Unhandled generation");217}218219return info;220}221222#endif223224225