2 * Copyright © 2017 Advanced Micro Devices, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16 * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
17 * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
27 // This class RB_MAP contains the top-level calculation functions which are used to generate rb id map based rb id equations
43 enum COMPRESSED_DATABLOCKS_IN_METABLOCK_PER_RB_LOG2
{
44 COMPRESSED_DATABLOCKS_IN_METABLOCK_PER_RB_LOG2_2D
= 10,
45 COMPRESSED_DATABLOCKS_IN_METABLOCK_PER_RB_LOG2_3D
= 18
50 void Get_Comp_Block_Screen_Space( CoordEq
& addr
, int bytes_log2
, int* w
, int* h
, int* d
= NULL
);
52 void Get_Meta_Block_Screen_Space( int num_comp_blocks_log2
, bool is_thick
, bool y_biased
,
53 int comp_block_width_log2
, int comp_block_height_log2
, int comp_block_depth_log2
,
54 int& meta_block_width_log2
, int& meta_block_height_log2
, int& meta_block_depth_log2
);
55 void cap_pipe( int xmode
, bool is_thick
, int& num_ses_log2
, int bpp_log2
, int num_samples_log2
, int pipe_interleave_log2
,
56 int& block_size_log2
, int& num_pipes_log2
);
58 void Get_Data_Offset_Equation( CoordEq
& data_eq
, int data_type
, int bpp_log2
, int num_samples_log2
, int block_size_log2
);
60 void Get_RB_Equation( CoordEq
& rb_equation
, int num_ses_log2
, int num_rbs_log2
);
62 void Get_Pipe_Equation( CoordEq
& pipe_equation
, CoordEq
& addr
,
63 int pipe_interleave_log2
,
67 int xmode
, int data_type
70 void get_meta_miptail_coord( int& x
, int& y
, int& z
, int mip_in_tail
, int blk_width_log2
, int blk_height_log2
, int blk_depth_log2
);
72 void get_mip_coord( int& x
, int& y
, int& z
, int mip
,
73 int meta_blk_width_log2
, int meta_blk_height_log2
, int meta_blk_depth_log2
,
74 int data_blk_width_log2
, int data_blk_height_log2
,
75 int& surf_width
, int& surf_height
, int& surf_depth
, int epitch
, int max_mip
,
76 int data_type
, int bpp_log2
, bool meta_linear
);
78 void get_mip_coord_linear( int& x
, int& y
, int& z
, int mip
, int data_blk_width_log2
, int data_blk_height_log2
,
79 int& surf_width
, int& surf_height
, int& surf_depth
, int epitch
, int max_mip
, int data_type
, int bpp_log2
);
81 void get_mip_coord_nonlinear( int& x
, int& y
, int& z
, int mip
, int meta_blk_width_log2
, int meta_blk_height_log2
, int meta_blk_depth_log2
,
82 int& surf_width
, int& surf_height
, int& surf_depth
, int epitch
, int max_mip
, int data_type
);
84 void get_meta_eq( CoordEq
& metaaddr
, int max_mip
, int num_ses_log2
, int num_rbs_log2
, int &num_pipes_log2
,
85 int block_size_log2
, int bpp_log2
, int num_samples_log2
, int max_comp_frag_log2
,
86 int pipe_interleave_log2
, int xmode
, int data_type
, int meta_alignment
, bool meta_linear
);
89 long get_meta_addr( int x
, int y
, int z
, int s
, int mip
,
90 int surf_width
, int surf_height
, int surf_depth
, int epitch
,
91 long surf_base
, int pipe_xor
, int max_mip
,
92 int num_ses_log2
, int num_rbs_log2
, int num_pipes_log2
,
93 int block_size_log2
, int bpp_log2
, int num_samples_log2
, int max_comp_frag_log2
,
94 int pipe_interleave_log2
, int xmode
, int data_type
, int meta_alignment
, bool meta_linear
);
97 long get_meta_addr_calc( int x
, int y
, int z
, int s
,
98 long surf_base
, int element_bytes_log2
, int num_samples_log2
, int max_comp_frag_log2
,
99 long pitch
, long slice
,
102 int xmode
, int pipe_xor
, int block_size_log2
,
103 /*int num_banks_log2,*/ int num_pipes_log2
,
104 int pipe_interleave_log2
, int meta_alignment
, int dim_type
, int x_mip_org
, int y_mip_org
,
105 int z_mip_org
, int num_ses_log2
, int num_rbs_log2
, /*bool se_affinity_enable,*/ int data_type
,
106 int l2_metablk_w
, int l2_metablk_h
, int l2_metablk_d
, bool meta_linear
);
108 void Initialize(void);
118 enum DATA_TYPE_ENUM
{
126 DATA_COLOR3D_D_NOT_USED
// should not be used; use COLOR2D instead
129 enum META_ALIGNMENT
{
136 CoordEq rb_equation
[MAX_SES_LOG2
+1][MAX_RBS_LOG2
+1];
137 CoordEq zaddr
[4][4];
138 CoordEq caddr
[5][4];
139 CoordEq c3addr
[5][2];