1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci************************************************************************************************************************ 3bf215546Sopenharmony_ci* 4bf215546Sopenharmony_ci* Copyright (C) 2007-2022 Advanced Micro Devices, Inc. All rights reserved. 5bf215546Sopenharmony_ci* 6bf215546Sopenharmony_ci* Permission is hereby granted, free of charge, to any person obtaining a 7bf215546Sopenharmony_ci* copy of this software and associated documentation files (the "Software"), 8bf215546Sopenharmony_ci* to deal in the Software without restriction, including without limitation 9bf215546Sopenharmony_ci* the rights to use, copy, modify, merge, publish, distribute, sublicense, 10bf215546Sopenharmony_ci* and/or sell copies of the Software, and to permit persons to whom the 11bf215546Sopenharmony_ci* Software is furnished to do so, subject to the following conditions: 12bf215546Sopenharmony_ci* 13bf215546Sopenharmony_ci* The above copyright notice and this permission notice shall be included in 14bf215546Sopenharmony_ci* all copies or substantial portions of the Software. 15bf215546Sopenharmony_ci* 16bf215546Sopenharmony_ci* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17bf215546Sopenharmony_ci* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18bf215546Sopenharmony_ci* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19bf215546Sopenharmony_ci* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20bf215546Sopenharmony_ci* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21bf215546Sopenharmony_ci* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22bf215546Sopenharmony_ci* OTHER DEALINGS IN THE SOFTWARE 23bf215546Sopenharmony_ci* 24bf215546Sopenharmony_ci***********************************************************************************************************************/ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci/** 27bf215546Sopenharmony_ci**************************************************************************************************** 28bf215546Sopenharmony_ci* @file addrinterface.h 29bf215546Sopenharmony_ci* @brief Contains the addrlib interfaces declaration and parameter defines 30bf215546Sopenharmony_ci**************************************************************************************************** 31bf215546Sopenharmony_ci*/ 32bf215546Sopenharmony_ci#ifndef __ADDR_INTERFACE_H__ 33bf215546Sopenharmony_ci#define __ADDR_INTERFACE_H__ 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_ci// Includes should be before extern "C" 36bf215546Sopenharmony_ci#include "addrtypes.h" 37bf215546Sopenharmony_ci 38bf215546Sopenharmony_ci#if defined(__cplusplus) 39bf215546Sopenharmony_ciextern "C" 40bf215546Sopenharmony_ci{ 41bf215546Sopenharmony_ci#endif 42bf215546Sopenharmony_ci 43bf215546Sopenharmony_ci#define ADDRLIB_VERSION_MAJOR 6 44bf215546Sopenharmony_ci#define ADDRLIB_VERSION_MINOR 2 45bf215546Sopenharmony_ci#define ADDRLIB_VERSION ((ADDRLIB_VERSION_MAJOR << 16) | ADDRLIB_VERSION_MINOR) 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci/// Virtually all interface functions need ADDR_HANDLE as first parameter 48bf215546Sopenharmony_citypedef VOID* ADDR_HANDLE; 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_ci/// Client handle used in callbacks 51bf215546Sopenharmony_citypedef VOID* ADDR_CLIENT_HANDLE; 52bf215546Sopenharmony_ci 53bf215546Sopenharmony_ci/** 54bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 55bf215546Sopenharmony_ci* // Callback functions 56bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 57bf215546Sopenharmony_ci* typedef VOID* (ADDR_API* ADDR_ALLOCSYSMEM)( 58bf215546Sopenharmony_ci* const ADDR_ALLOCSYSMEM_INPUT* pInput); 59bf215546Sopenharmony_ci* typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_FREESYSMEM)( 60bf215546Sopenharmony_ci* VOID* pVirtAddr); 61bf215546Sopenharmony_ci* typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)( 62bf215546Sopenharmony_ci* const ADDR_DEBUGPRINT_INPUT* pInput); 63bf215546Sopenharmony_ci* 64bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 65bf215546Sopenharmony_ci* // Create/Destroy/Config functions 66bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 67bf215546Sopenharmony_ci* AddrCreate() 68bf215546Sopenharmony_ci* AddrDestroy() 69bf215546Sopenharmony_ci* 70bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 71bf215546Sopenharmony_ci* // Surface functions 72bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 73bf215546Sopenharmony_ci* AddrComputeSurfaceInfo() 74bf215546Sopenharmony_ci* AddrComputeSurfaceAddrFromCoord() 75bf215546Sopenharmony_ci* AddrComputeSurfaceCoordFromAddr() 76bf215546Sopenharmony_ci* 77bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 78bf215546Sopenharmony_ci* // HTile functions 79bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 80bf215546Sopenharmony_ci* AddrComputeHtileInfo() 81bf215546Sopenharmony_ci* AddrComputeHtileAddrFromCoord() 82bf215546Sopenharmony_ci* AddrComputeHtileCoordFromAddr() 83bf215546Sopenharmony_ci* 84bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 85bf215546Sopenharmony_ci* // C-mask functions 86bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 87bf215546Sopenharmony_ci* AddrComputeCmaskInfo() 88bf215546Sopenharmony_ci* AddrComputeCmaskAddrFromCoord() 89bf215546Sopenharmony_ci* AddrComputeCmaskCoordFromAddr() 90bf215546Sopenharmony_ci* 91bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 92bf215546Sopenharmony_ci* // F-mask functions 93bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 94bf215546Sopenharmony_ci* AddrComputeFmaskInfo() 95bf215546Sopenharmony_ci* AddrComputeFmaskAddrFromCoord() 96bf215546Sopenharmony_ci* AddrComputeFmaskCoordFromAddr() 97bf215546Sopenharmony_ci* 98bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 99bf215546Sopenharmony_ci* // Element/Utility functions 100bf215546Sopenharmony_ci* ///////////////////////////////////////////////////////////////////////////////////////////////// 101bf215546Sopenharmony_ci* ElemFlt32ToDepthPixel() 102bf215546Sopenharmony_ci* ElemFlt32ToColorPixel() 103bf215546Sopenharmony_ci* AddrExtractBankPipeSwizzle() 104bf215546Sopenharmony_ci* AddrCombineBankPipeSwizzle() 105bf215546Sopenharmony_ci* AddrComputeSliceSwizzle() 106bf215546Sopenharmony_ci* AddrConvertTileInfoToHW() 107bf215546Sopenharmony_ci* AddrConvertTileIndex() 108bf215546Sopenharmony_ci* AddrConvertTileIndex1() 109bf215546Sopenharmony_ci* AddrGetTileIndex() 110bf215546Sopenharmony_ci* AddrComputeBaseSwizzle() 111bf215546Sopenharmony_ci* AddrUseTileIndex() 112bf215546Sopenharmony_ci* AddrUseCombinedSwizzle() 113bf215546Sopenharmony_ci* 114bf215546Sopenharmony_ci**/ 115bf215546Sopenharmony_ci 116bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 117bf215546Sopenharmony_ci// Callback functions 118bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 119bf215546Sopenharmony_ci 120bf215546Sopenharmony_ci/** 121bf215546Sopenharmony_ci**************************************************************************************************** 122bf215546Sopenharmony_ci* @brief channel setting structure 123bf215546Sopenharmony_ci**************************************************************************************************** 124bf215546Sopenharmony_ci*/ 125bf215546Sopenharmony_citypedef union _ADDR_CHANNEL_SETTING 126bf215546Sopenharmony_ci{ 127bf215546Sopenharmony_ci struct 128bf215546Sopenharmony_ci { 129bf215546Sopenharmony_ci UINT_8 valid : 1; ///< Indicate whehter this channel setting is valid 130bf215546Sopenharmony_ci UINT_8 channel : 2; ///< 0 for x channel, 1 for y channel, 2 for z channel 131bf215546Sopenharmony_ci UINT_8 index : 5; ///< Channel index 132bf215546Sopenharmony_ci }; 133bf215546Sopenharmony_ci UINT_8 value; ///< Value 134bf215546Sopenharmony_ci} ADDR_CHANNEL_SETTING; 135bf215546Sopenharmony_ci 136bf215546Sopenharmony_ci/** 137bf215546Sopenharmony_ci**************************************************************************************************** 138bf215546Sopenharmony_ci* @brief address equation key structure 139bf215546Sopenharmony_ci**************************************************************************************************** 140bf215546Sopenharmony_ci*/ 141bf215546Sopenharmony_citypedef union _ADDR_EQUATION_KEY 142bf215546Sopenharmony_ci{ 143bf215546Sopenharmony_ci struct 144bf215546Sopenharmony_ci { 145bf215546Sopenharmony_ci UINT_32 log2ElementBytes : 3; ///< Log2 of Bytes per pixel 146bf215546Sopenharmony_ci UINT_32 tileMode : 5; ///< Tile mode 147bf215546Sopenharmony_ci UINT_32 microTileType : 3; ///< Micro tile type 148bf215546Sopenharmony_ci UINT_32 pipeConfig : 5; ///< pipe config 149bf215546Sopenharmony_ci UINT_32 numBanksLog2 : 3; ///< Number of banks log2 150bf215546Sopenharmony_ci UINT_32 bankWidth : 4; ///< Bank width 151bf215546Sopenharmony_ci UINT_32 bankHeight : 4; ///< Bank height 152bf215546Sopenharmony_ci UINT_32 macroAspectRatio : 3; ///< Macro tile aspect ratio 153bf215546Sopenharmony_ci UINT_32 prt : 1; ///< SI only, indicate whether this equation is for prt 154bf215546Sopenharmony_ci UINT_32 reserved : 1; ///< Reserved bit 155bf215546Sopenharmony_ci } fields; 156bf215546Sopenharmony_ci UINT_32 value; 157bf215546Sopenharmony_ci} ADDR_EQUATION_KEY; 158bf215546Sopenharmony_ci 159bf215546Sopenharmony_ci/** 160bf215546Sopenharmony_ci**************************************************************************************************** 161bf215546Sopenharmony_ci* @brief address equation structure 162bf215546Sopenharmony_ci**************************************************************************************************** 163bf215546Sopenharmony_ci*/ 164bf215546Sopenharmony_ci#define ADDR_MAX_EQUATION_BIT 20u 165bf215546Sopenharmony_ci 166bf215546Sopenharmony_ci// Invalid equation index 167bf215546Sopenharmony_ci#define ADDR_INVALID_EQUATION_INDEX 0xFFFFFFFF 168bf215546Sopenharmony_ci 169bf215546Sopenharmony_citypedef struct _ADDR_EQUATION 170bf215546Sopenharmony_ci{ 171bf215546Sopenharmony_ci ADDR_CHANNEL_SETTING addr[ADDR_MAX_EQUATION_BIT]; ///< addr setting 172bf215546Sopenharmony_ci ///< each bit is result of addr ^ xor ^ xor2 173bf215546Sopenharmony_ci ADDR_CHANNEL_SETTING xor1[ADDR_MAX_EQUATION_BIT]; ///< xor setting 174bf215546Sopenharmony_ci ADDR_CHANNEL_SETTING xor2[ADDR_MAX_EQUATION_BIT]; ///< xor2 setting 175bf215546Sopenharmony_ci UINT_32 numBits; ///< The number of bits in equation 176bf215546Sopenharmony_ci BOOL_32 stackedDepthSlices; ///< TRUE if depth slices are treated as being 177bf215546Sopenharmony_ci ///< stacked vertically prior to swizzling 178bf215546Sopenharmony_ci} ADDR_EQUATION; 179bf215546Sopenharmony_ci 180bf215546Sopenharmony_ci 181bf215546Sopenharmony_ci/** 182bf215546Sopenharmony_ci**************************************************************************************************** 183bf215546Sopenharmony_ci* @brief Alloc system memory flags. 184bf215546Sopenharmony_ci* @note These flags are reserved for future use and if flags are added will minimize the impact 185bf215546Sopenharmony_ci* of the client. 186bf215546Sopenharmony_ci**************************************************************************************************** 187bf215546Sopenharmony_ci*/ 188bf215546Sopenharmony_citypedef union _ADDR_ALLOCSYSMEM_FLAGS 189bf215546Sopenharmony_ci{ 190bf215546Sopenharmony_ci struct 191bf215546Sopenharmony_ci { 192bf215546Sopenharmony_ci UINT_32 reserved : 32; ///< Reserved for future use. 193bf215546Sopenharmony_ci } fields; 194bf215546Sopenharmony_ci UINT_32 value; 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_ci} ADDR_ALLOCSYSMEM_FLAGS; 197bf215546Sopenharmony_ci 198bf215546Sopenharmony_ci/** 199bf215546Sopenharmony_ci**************************************************************************************************** 200bf215546Sopenharmony_ci* @brief Alloc system memory input structure 201bf215546Sopenharmony_ci**************************************************************************************************** 202bf215546Sopenharmony_ci*/ 203bf215546Sopenharmony_citypedef struct _ADDR_ALLOCSYSMEM_INPUT 204bf215546Sopenharmony_ci{ 205bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 206bf215546Sopenharmony_ci 207bf215546Sopenharmony_ci ADDR_ALLOCSYSMEM_FLAGS flags; ///< System memory flags. 208bf215546Sopenharmony_ci UINT_32 sizeInBytes; ///< System memory allocation size in bytes. 209bf215546Sopenharmony_ci ADDR_CLIENT_HANDLE hClient; ///< Client handle 210bf215546Sopenharmony_ci} ADDR_ALLOCSYSMEM_INPUT; 211bf215546Sopenharmony_ci 212bf215546Sopenharmony_ci/** 213bf215546Sopenharmony_ci**************************************************************************************************** 214bf215546Sopenharmony_ci* ADDR_ALLOCSYSMEM 215bf215546Sopenharmony_ci* @brief 216bf215546Sopenharmony_ci* Allocate system memory callback function. Returns valid pointer on success. 217bf215546Sopenharmony_ci**************************************************************************************************** 218bf215546Sopenharmony_ci*/ 219bf215546Sopenharmony_citypedef VOID* (ADDR_API* ADDR_ALLOCSYSMEM)( 220bf215546Sopenharmony_ci const ADDR_ALLOCSYSMEM_INPUT* pInput); 221bf215546Sopenharmony_ci 222bf215546Sopenharmony_ci/** 223bf215546Sopenharmony_ci**************************************************************************************************** 224bf215546Sopenharmony_ci* @brief Free system memory input structure 225bf215546Sopenharmony_ci**************************************************************************************************** 226bf215546Sopenharmony_ci*/ 227bf215546Sopenharmony_citypedef struct _ADDR_FREESYSMEM_INPUT 228bf215546Sopenharmony_ci{ 229bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 230bf215546Sopenharmony_ci 231bf215546Sopenharmony_ci VOID* pVirtAddr; ///< Virtual address 232bf215546Sopenharmony_ci ADDR_CLIENT_HANDLE hClient; ///< Client handle 233bf215546Sopenharmony_ci} ADDR_FREESYSMEM_INPUT; 234bf215546Sopenharmony_ci 235bf215546Sopenharmony_ci/** 236bf215546Sopenharmony_ci**************************************************************************************************** 237bf215546Sopenharmony_ci* ADDR_FREESYSMEM 238bf215546Sopenharmony_ci* @brief 239bf215546Sopenharmony_ci* Free system memory callback function. 240bf215546Sopenharmony_ci* Returns ADDR_OK on success. 241bf215546Sopenharmony_ci**************************************************************************************************** 242bf215546Sopenharmony_ci*/ 243bf215546Sopenharmony_citypedef ADDR_E_RETURNCODE (ADDR_API* ADDR_FREESYSMEM)( 244bf215546Sopenharmony_ci const ADDR_FREESYSMEM_INPUT* pInput); 245bf215546Sopenharmony_ci 246bf215546Sopenharmony_ci/** 247bf215546Sopenharmony_ci**************************************************************************************************** 248bf215546Sopenharmony_ci* @brief Print debug message input structure 249bf215546Sopenharmony_ci**************************************************************************************************** 250bf215546Sopenharmony_ci*/ 251bf215546Sopenharmony_citypedef struct _ADDR_DEBUGPRINT_INPUT 252bf215546Sopenharmony_ci{ 253bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 254bf215546Sopenharmony_ci 255bf215546Sopenharmony_ci CHAR* pDebugString; ///< Debug print string 256bf215546Sopenharmony_ci va_list ap; ///< Variable argument list 257bf215546Sopenharmony_ci ADDR_CLIENT_HANDLE hClient; ///< Client handle 258bf215546Sopenharmony_ci} ADDR_DEBUGPRINT_INPUT; 259bf215546Sopenharmony_ci 260bf215546Sopenharmony_ci/** 261bf215546Sopenharmony_ci**************************************************************************************************** 262bf215546Sopenharmony_ci* ADDR_DEBUGPRINT 263bf215546Sopenharmony_ci* @brief 264bf215546Sopenharmony_ci* Print debug message callback function. 265bf215546Sopenharmony_ci* Returns ADDR_OK on success. 266bf215546Sopenharmony_ci**************************************************************************************************** 267bf215546Sopenharmony_ci*/ 268bf215546Sopenharmony_citypedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)( 269bf215546Sopenharmony_ci const ADDR_DEBUGPRINT_INPUT* pInput); 270bf215546Sopenharmony_ci 271bf215546Sopenharmony_ci/** 272bf215546Sopenharmony_ci**************************************************************************************************** 273bf215546Sopenharmony_ci* ADDR_CALLBACKS 274bf215546Sopenharmony_ci* 275bf215546Sopenharmony_ci* @brief 276bf215546Sopenharmony_ci* Address Library needs client to provide system memory alloc/free routines. 277bf215546Sopenharmony_ci**************************************************************************************************** 278bf215546Sopenharmony_ci*/ 279bf215546Sopenharmony_citypedef struct _ADDR_CALLBACKS 280bf215546Sopenharmony_ci{ 281bf215546Sopenharmony_ci ADDR_ALLOCSYSMEM allocSysMem; ///< Routine to allocate system memory 282bf215546Sopenharmony_ci ADDR_FREESYSMEM freeSysMem; ///< Routine to free system memory 283bf215546Sopenharmony_ci ADDR_DEBUGPRINT debugPrint; ///< Routine to print debug message 284bf215546Sopenharmony_ci} ADDR_CALLBACKS; 285bf215546Sopenharmony_ci 286bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 287bf215546Sopenharmony_ci// Create/Destroy functions 288bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 289bf215546Sopenharmony_ci 290bf215546Sopenharmony_ci/** 291bf215546Sopenharmony_ci**************************************************************************************************** 292bf215546Sopenharmony_ci* ADDR_CREATE_FLAGS 293bf215546Sopenharmony_ci* 294bf215546Sopenharmony_ci* @brief 295bf215546Sopenharmony_ci* This structure is used to pass some setup in creation of AddrLib 296bf215546Sopenharmony_ci* @note 297bf215546Sopenharmony_ci**************************************************************************************************** 298bf215546Sopenharmony_ci*/ 299bf215546Sopenharmony_citypedef union _ADDR_CREATE_FLAGS 300bf215546Sopenharmony_ci{ 301bf215546Sopenharmony_ci struct 302bf215546Sopenharmony_ci { 303bf215546Sopenharmony_ci UINT_32 noCubeMipSlicesPad : 1; ///< Turn cubemap faces padding off 304bf215546Sopenharmony_ci UINT_32 fillSizeFields : 1; ///< If clients fill size fields in all input and 305bf215546Sopenharmony_ci /// output structure 306bf215546Sopenharmony_ci UINT_32 useTileIndex : 1; ///< Make tileIndex field in input valid 307bf215546Sopenharmony_ci UINT_32 useCombinedSwizzle : 1; ///< Use combined tile swizzle 308bf215546Sopenharmony_ci UINT_32 checkLast2DLevel : 1; ///< Check the last 2D mip sub level 309bf215546Sopenharmony_ci UINT_32 useHtileSliceAlign : 1; ///< Do htile single slice alignment 310bf215546Sopenharmony_ci UINT_32 allowLargeThickTile : 1; ///< Allow 64*thickness*bytesPerPixel > rowSize 311bf215546Sopenharmony_ci UINT_32 forceDccAndTcCompat : 1; ///< Force enable DCC and TC compatibility 312bf215546Sopenharmony_ci UINT_32 nonPower2MemConfig : 1; ///< Video memory bit width is not power of 2 313bf215546Sopenharmony_ci UINT_32 enableAltTiling : 1; ///< Enable alt tile mode 314bf215546Sopenharmony_ci UINT_32 reserved : 22; ///< Reserved bits for future use 315bf215546Sopenharmony_ci }; 316bf215546Sopenharmony_ci 317bf215546Sopenharmony_ci UINT_32 value; 318bf215546Sopenharmony_ci} ADDR_CREATE_FLAGS; 319bf215546Sopenharmony_ci 320bf215546Sopenharmony_ci/** 321bf215546Sopenharmony_ci**************************************************************************************************** 322bf215546Sopenharmony_ci* ADDR_REGISTER_VALUE 323bf215546Sopenharmony_ci* 324bf215546Sopenharmony_ci* @brief 325bf215546Sopenharmony_ci* Data from registers to setup AddrLib global data, used in AddrCreate 326bf215546Sopenharmony_ci**************************************************************************************************** 327bf215546Sopenharmony_ci*/ 328bf215546Sopenharmony_citypedef struct _ADDR_REGISTER_VALUE 329bf215546Sopenharmony_ci{ 330bf215546Sopenharmony_ci UINT_32 gbAddrConfig; ///< For R8xx, use GB_ADDR_CONFIG register value. 331bf215546Sopenharmony_ci /// For R6xx/R7xx, use GB_TILING_CONFIG. 332bf215546Sopenharmony_ci /// But they can be treated as the same. 333bf215546Sopenharmony_ci /// if this value is 0, use chip to set default value 334bf215546Sopenharmony_ci UINT_32 backendDisables; ///< 1 bit per backend, starting with LSB. 1=disabled,0=enabled. 335bf215546Sopenharmony_ci /// Register value of CC_RB_BACKEND_DISABLE.BACKEND_DISABLE 336bf215546Sopenharmony_ci 337bf215546Sopenharmony_ci /// R800 registers----------------------------------------------- 338bf215546Sopenharmony_ci UINT_32 noOfBanks; ///< Number of h/w ram banks - For r800: MC_ARB_RAMCFG.NOOFBANK 339bf215546Sopenharmony_ci /// No enums for this value in h/w header files 340bf215546Sopenharmony_ci /// 0: 4 341bf215546Sopenharmony_ci /// 1: 8 342bf215546Sopenharmony_ci /// 2: 16 343bf215546Sopenharmony_ci UINT_32 noOfRanks; /// MC_ARB_RAMCFG.NOOFRANK 344bf215546Sopenharmony_ci /// 0: 1 345bf215546Sopenharmony_ci /// 1: 2 346bf215546Sopenharmony_ci /// SI (R1000) registers----------------------------------------- 347bf215546Sopenharmony_ci const UINT_32* pTileConfig; ///< Global tile setting tables 348bf215546Sopenharmony_ci UINT_32 noOfEntries; ///< Number of entries in pTileConfig 349bf215546Sopenharmony_ci 350bf215546Sopenharmony_ci ///< CI registers------------------------------------------------- 351bf215546Sopenharmony_ci const UINT_32* pMacroTileConfig; ///< Global macro tile mode table 352bf215546Sopenharmony_ci UINT_32 noOfMacroEntries; ///< Number of entries in pMacroTileConfig 353bf215546Sopenharmony_ci} ADDR_REGISTER_VALUE; 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_ci/** 356bf215546Sopenharmony_ci**************************************************************************************************** 357bf215546Sopenharmony_ci* ADDR_CREATE_INPUT 358bf215546Sopenharmony_ci* 359bf215546Sopenharmony_ci* @brief 360bf215546Sopenharmony_ci* Parameters use to create an AddrLib Object. Caller must provide all fields. 361bf215546Sopenharmony_ci* 362bf215546Sopenharmony_ci**************************************************************************************************** 363bf215546Sopenharmony_ci*/ 364bf215546Sopenharmony_citypedef struct _ADDR_CREATE_INPUT 365bf215546Sopenharmony_ci{ 366bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 367bf215546Sopenharmony_ci 368bf215546Sopenharmony_ci UINT_32 chipEngine; ///< Chip Engine 369bf215546Sopenharmony_ci UINT_32 chipFamily; ///< Chip Family 370bf215546Sopenharmony_ci UINT_32 chipRevision; ///< Chip Revision 371bf215546Sopenharmony_ci ADDR_CALLBACKS callbacks; ///< Callbacks for sysmem alloc/free/print 372bf215546Sopenharmony_ci ADDR_CREATE_FLAGS createFlags; ///< Flags to setup AddrLib 373bf215546Sopenharmony_ci ADDR_REGISTER_VALUE regValue; ///< Data from registers to setup AddrLib global data 374bf215546Sopenharmony_ci ADDR_CLIENT_HANDLE hClient; ///< Client handle 375bf215546Sopenharmony_ci UINT_32 minPitchAlignPixels; ///< Minimum pitch alignment in pixels 376bf215546Sopenharmony_ci} ADDR_CREATE_INPUT; 377bf215546Sopenharmony_ci 378bf215546Sopenharmony_ci/** 379bf215546Sopenharmony_ci**************************************************************************************************** 380bf215546Sopenharmony_ci* ADDR_CREATEINFO_OUTPUT 381bf215546Sopenharmony_ci* 382bf215546Sopenharmony_ci* @brief 383bf215546Sopenharmony_ci* Return AddrLib handle to client driver 384bf215546Sopenharmony_ci* 385bf215546Sopenharmony_ci**************************************************************************************************** 386bf215546Sopenharmony_ci*/ 387bf215546Sopenharmony_citypedef struct _ADDR_CREATE_OUTPUT 388bf215546Sopenharmony_ci{ 389bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 390bf215546Sopenharmony_ci 391bf215546Sopenharmony_ci ADDR_HANDLE hLib; ///< Address lib handle 392bf215546Sopenharmony_ci 393bf215546Sopenharmony_ci UINT_32 numEquations; ///< Number of equations in the table 394bf215546Sopenharmony_ci const ADDR_EQUATION* pEquationTable; ///< Pointer to the equation table 395bf215546Sopenharmony_ci} ADDR_CREATE_OUTPUT; 396bf215546Sopenharmony_ci 397bf215546Sopenharmony_ci/** 398bf215546Sopenharmony_ci**************************************************************************************************** 399bf215546Sopenharmony_ci* AddrCreate 400bf215546Sopenharmony_ci* 401bf215546Sopenharmony_ci* @brief 402bf215546Sopenharmony_ci* Create AddrLib object, must be called before any interface calls 403bf215546Sopenharmony_ci* 404bf215546Sopenharmony_ci* @return 405bf215546Sopenharmony_ci* ADDR_OK if successful 406bf215546Sopenharmony_ci**************************************************************************************************** 407bf215546Sopenharmony_ci*/ 408bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrCreate( 409bf215546Sopenharmony_ci const ADDR_CREATE_INPUT* pAddrCreateIn, 410bf215546Sopenharmony_ci ADDR_CREATE_OUTPUT* pAddrCreateOut); 411bf215546Sopenharmony_ci 412bf215546Sopenharmony_ci 413bf215546Sopenharmony_ci 414bf215546Sopenharmony_ci/** 415bf215546Sopenharmony_ci**************************************************************************************************** 416bf215546Sopenharmony_ci* AddrDestroy 417bf215546Sopenharmony_ci* 418bf215546Sopenharmony_ci* @brief 419bf215546Sopenharmony_ci* Destroy AddrLib object, must be called to free internally allocated resources. 420bf215546Sopenharmony_ci* 421bf215546Sopenharmony_ci* @return 422bf215546Sopenharmony_ci* ADDR_OK if successful 423bf215546Sopenharmony_ci**************************************************************************************************** 424bf215546Sopenharmony_ci*/ 425bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrDestroy( 426bf215546Sopenharmony_ci ADDR_HANDLE hLib); 427bf215546Sopenharmony_ci 428bf215546Sopenharmony_ci 429bf215546Sopenharmony_ci 430bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 431bf215546Sopenharmony_ci// Surface functions 432bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 433bf215546Sopenharmony_ci 434bf215546Sopenharmony_ci/** 435bf215546Sopenharmony_ci**************************************************************************************************** 436bf215546Sopenharmony_ci* @brief 437bf215546Sopenharmony_ci* Bank/tiling parameters. On function input, these can be set as desired or 438bf215546Sopenharmony_ci* left 0 for AddrLib to calculate/default. On function output, these are the actual 439bf215546Sopenharmony_ci* parameters used. 440bf215546Sopenharmony_ci* @note 441bf215546Sopenharmony_ci* Valid bankWidth/bankHeight value: 442bf215546Sopenharmony_ci* 1,2,4,8. They are factors instead of pixels or bytes. 443bf215546Sopenharmony_ci* 444bf215546Sopenharmony_ci* The bank number remains constant across each row of the 445bf215546Sopenharmony_ci* macro tile as each pipe is selected, so the number of 446bf215546Sopenharmony_ci* tiles in the x direction with the same bank number will 447bf215546Sopenharmony_ci* be bank_width * num_pipes. 448bf215546Sopenharmony_ci**************************************************************************************************** 449bf215546Sopenharmony_ci*/ 450bf215546Sopenharmony_citypedef struct _ADDR_TILEINFO 451bf215546Sopenharmony_ci{ 452bf215546Sopenharmony_ci /// Any of these parameters can be set to 0 to use the HW default. 453bf215546Sopenharmony_ci UINT_32 banks; ///< Number of banks, numerical value 454bf215546Sopenharmony_ci UINT_32 bankWidth; ///< Number of tiles in the X direction in the same bank 455bf215546Sopenharmony_ci UINT_32 bankHeight; ///< Number of tiles in the Y direction in the same bank 456bf215546Sopenharmony_ci UINT_32 macroAspectRatio; ///< Macro tile aspect ratio. 1-1:1, 2-4:1, 4-16:1, 8-64:1 457bf215546Sopenharmony_ci UINT_32 tileSplitBytes; ///< Tile split size, in bytes 458bf215546Sopenharmony_ci AddrPipeCfg pipeConfig; ///< Pipe Config = HW enum + 1 459bf215546Sopenharmony_ci} ADDR_TILEINFO; 460bf215546Sopenharmony_ci 461bf215546Sopenharmony_ci// Create a define to avoid client change. The removal of R800 is because we plan to implement SI 462bf215546Sopenharmony_ci// within 800 HWL - An AddrPipeCfg is added in above data structure 463bf215546Sopenharmony_citypedef ADDR_TILEINFO ADDR_R800_TILEINFO; 464bf215546Sopenharmony_ci 465bf215546Sopenharmony_ci/** 466bf215546Sopenharmony_ci**************************************************************************************************** 467bf215546Sopenharmony_ci* @brief 468bf215546Sopenharmony_ci* Information needed by quad buffer stereo support 469bf215546Sopenharmony_ci**************************************************************************************************** 470bf215546Sopenharmony_ci*/ 471bf215546Sopenharmony_citypedef struct _ADDR_QBSTEREOINFO 472bf215546Sopenharmony_ci{ 473bf215546Sopenharmony_ci UINT_32 eyeHeight; ///< Height (in pixel rows) to right eye 474bf215546Sopenharmony_ci UINT_32 rightOffset; ///< Offset (in bytes) to right eye 475bf215546Sopenharmony_ci UINT_32 rightSwizzle; ///< TileSwizzle for right eyes 476bf215546Sopenharmony_ci} ADDR_QBSTEREOINFO; 477bf215546Sopenharmony_ci 478bf215546Sopenharmony_ci/** 479bf215546Sopenharmony_ci**************************************************************************************************** 480bf215546Sopenharmony_ci* ADDR_SURFACE_FLAGS 481bf215546Sopenharmony_ci* 482bf215546Sopenharmony_ci* @brief 483bf215546Sopenharmony_ci* Surface flags 484bf215546Sopenharmony_ci**************************************************************************************************** 485bf215546Sopenharmony_ci*/ 486bf215546Sopenharmony_citypedef union _ADDR_SURFACE_FLAGS 487bf215546Sopenharmony_ci{ 488bf215546Sopenharmony_ci struct 489bf215546Sopenharmony_ci { 490bf215546Sopenharmony_ci UINT_32 color : 1; ///< Flag indicates this is a color buffer 491bf215546Sopenharmony_ci UINT_32 depth : 1; ///< Flag indicates this is a depth/stencil buffer 492bf215546Sopenharmony_ci UINT_32 stencil : 1; ///< Flag indicates this is a stencil buffer 493bf215546Sopenharmony_ci UINT_32 texture : 1; ///< Flag indicates this is a texture 494bf215546Sopenharmony_ci UINT_32 cube : 1; ///< Flag indicates this is a cubemap 495bf215546Sopenharmony_ci UINT_32 volume : 1; ///< Flag indicates this is a volume texture 496bf215546Sopenharmony_ci UINT_32 fmask : 1; ///< Flag indicates this is an fmask 497bf215546Sopenharmony_ci UINT_32 cubeAsArray : 1; ///< Flag indicates if treat cubemap as arrays 498bf215546Sopenharmony_ci UINT_32 compressZ : 1; ///< Flag indicates z buffer is compressed 499bf215546Sopenharmony_ci UINT_32 overlay : 1; ///< Flag indicates this is an overlay surface 500bf215546Sopenharmony_ci UINT_32 noStencil : 1; ///< Flag indicates this depth has no separate stencil 501bf215546Sopenharmony_ci UINT_32 display : 1; ///< Flag indicates this should match display controller req. 502bf215546Sopenharmony_ci UINT_32 opt4Space : 1; ///< Flag indicates this surface should be optimized for space 503bf215546Sopenharmony_ci /// i.e. save some memory but may lose performance 504bf215546Sopenharmony_ci UINT_32 prt : 1; ///< Flag for partially resident texture 505bf215546Sopenharmony_ci UINT_32 qbStereo : 1; ///< Quad buffer stereo surface 506bf215546Sopenharmony_ci UINT_32 pow2Pad : 1; ///< SI: Pad to pow2, must set for mipmap (include level0) 507bf215546Sopenharmony_ci UINT_32 interleaved : 1; ///< Special flag for interleaved YUV surface padding 508bf215546Sopenharmony_ci UINT_32 tcCompatible : 1; ///< Flag indicates surface needs to be shader readable 509bf215546Sopenharmony_ci UINT_32 dispTileType : 1; ///< NI: force display Tiling for 128 bit shared resoruce 510bf215546Sopenharmony_ci UINT_32 dccCompatible : 1; ///< VI: whether to make MSAA surface support dcc fast clear 511bf215546Sopenharmony_ci UINT_32 dccPipeWorkaround : 1; ///< VI: whether to workaround the HW limit that 512bf215546Sopenharmony_ci /// dcc can't be enabled if pipe config of tile mode 513bf215546Sopenharmony_ci /// is different from that of ASIC, this flag 514bf215546Sopenharmony_ci /// is address lib internal flag, client should ignore it 515bf215546Sopenharmony_ci UINT_32 czDispCompatible : 1; ///< SI+: CZ family has a HW bug needs special alignment. 516bf215546Sopenharmony_ci /// This flag indicates we need to follow the 517bf215546Sopenharmony_ci /// alignment with CZ families or other ASICs under 518bf215546Sopenharmony_ci /// PX configuration + CZ. 519bf215546Sopenharmony_ci UINT_32 nonSplit : 1; ///< CI: depth texture should not be split 520bf215546Sopenharmony_ci UINT_32 disableLinearOpt : 1; ///< Disable tile mode optimization to linear 521bf215546Sopenharmony_ci UINT_32 needEquation : 1; ///< Make the surface tile setting equation compatible. 522bf215546Sopenharmony_ci /// This flag indicates we need to override tile 523bf215546Sopenharmony_ci /// mode to PRT_* tile mode to disable slice rotation, 524bf215546Sopenharmony_ci /// which is needed by swizzle pattern equation. 525bf215546Sopenharmony_ci UINT_32 skipIndicesOutput : 1; ///< Skipping indices in output. 526bf215546Sopenharmony_ci UINT_32 rotateDisplay : 1; ///< Rotate micro tile type 527bf215546Sopenharmony_ci UINT_32 minimizeAlignment : 1; ///< Minimize alignment 528bf215546Sopenharmony_ci UINT_32 preferEquation : 1; ///< Return equation index without adjusting tile mode 529bf215546Sopenharmony_ci UINT_32 matchStencilTileCfg : 1; ///< Select tile index of stencil as well as depth surface 530bf215546Sopenharmony_ci /// to make sure they share same tile config parameters 531bf215546Sopenharmony_ci UINT_32 disallowLargeThickDegrade : 1; ///< Disallow large thick tile degrade 532bf215546Sopenharmony_ci UINT_32 reserved : 1; ///< Reserved bits 533bf215546Sopenharmony_ci }; 534bf215546Sopenharmony_ci 535bf215546Sopenharmony_ci UINT_32 value; 536bf215546Sopenharmony_ci} ADDR_SURFACE_FLAGS; 537bf215546Sopenharmony_ci 538bf215546Sopenharmony_ci/** 539bf215546Sopenharmony_ci**************************************************************************************************** 540bf215546Sopenharmony_ci* ADDR_COMPUTE_SURFACE_INFO_INPUT 541bf215546Sopenharmony_ci* 542bf215546Sopenharmony_ci* @brief 543bf215546Sopenharmony_ci* Input structure for AddrComputeSurfaceInfo 544bf215546Sopenharmony_ci**************************************************************************************************** 545bf215546Sopenharmony_ci*/ 546bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_SURFACE_INFO_INPUT 547bf215546Sopenharmony_ci{ 548bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 549bf215546Sopenharmony_ci 550bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode 551bf215546Sopenharmony_ci AddrFormat format; ///< If format is set to valid one, bpp/width/height 552bf215546Sopenharmony_ci /// might be overwritten 553bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 554bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 555bf215546Sopenharmony_ci UINT_32 width; ///< Width, in pixels 556bf215546Sopenharmony_ci UINT_32 height; ///< Height, in pixels 557bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of surface slices or depth 558bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 559bf215546Sopenharmony_ci UINT_32 mipLevel; ///< Current mipmap level 560bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Number of mips in mip chain 561bf215546Sopenharmony_ci ADDR_SURFACE_FLAGS flags; ///< Surface type flags 562bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 563bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 564bf215546Sopenharmony_ci /// number of fragments for EQAA 565bf215546Sopenharmony_ci /// r800 and later HWL parameters 566bf215546Sopenharmony_ci // Needed by 2D tiling, for linear and 1D tiling, just keep them 0's 567bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Set to 0 to default/calculate 568bf215546Sopenharmony_ci AddrTileType tileType; ///< Micro tiling type, not needed when tileIndex != -1 569bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 570bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 571bf215546Sopenharmony_ci UINT_32 basePitch; ///< Base level pitch in pixels, 0 means ignored, is a 572bf215546Sopenharmony_ci /// must for mip levels from SI+. 573bf215546Sopenharmony_ci /// Don't use pitch in blocks for compressed formats! 574bf215546Sopenharmony_ci UINT_32 maxBaseAlign; ///< Max base alignment request from client 575bf215546Sopenharmony_ci UINT_32 pitchAlign; ///< Pitch alignment request from client 576bf215546Sopenharmony_ci UINT_32 heightAlign; ///< Height alignment request from client 577bf215546Sopenharmony_ci} ADDR_COMPUTE_SURFACE_INFO_INPUT; 578bf215546Sopenharmony_ci 579bf215546Sopenharmony_ci/** 580bf215546Sopenharmony_ci**************************************************************************************************** 581bf215546Sopenharmony_ci* ADDR_COMPUTE_SURFACE_INFO_OUTPUT 582bf215546Sopenharmony_ci* 583bf215546Sopenharmony_ci* @brief 584bf215546Sopenharmony_ci* Output structure for AddrComputeSurfInfo 585bf215546Sopenharmony_ci* @note 586bf215546Sopenharmony_ci Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch 587bf215546Sopenharmony_ci Pixel: Original pixel 588bf215546Sopenharmony_ci**************************************************************************************************** 589bf215546Sopenharmony_ci*/ 590bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_SURFACE_INFO_OUTPUT 591bf215546Sopenharmony_ci{ 592bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 593bf215546Sopenharmony_ci 594bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch in elements (in blocks for compressed formats) 595bf215546Sopenharmony_ci UINT_32 height; ///< Height in elements (in blocks for compressed formats) 596bf215546Sopenharmony_ci UINT_32 depth; ///< Number of slice/depth 597bf215546Sopenharmony_ci UINT_64 surfSize; ///< Surface size in bytes 598bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Actual tile mode. May differ from that in input 599bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Base address alignment 600bf215546Sopenharmony_ci UINT_32 pitchAlign; ///< Pitch alignment, in elements 601bf215546Sopenharmony_ci UINT_32 heightAlign; ///< Height alignment, in elements 602bf215546Sopenharmony_ci UINT_32 depthAlign; ///< Depth alignment, aligned to thickness, for 3d texture 603bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per elements (e.g. blocks for BCn, 1/3 for 96bit) 604bf215546Sopenharmony_ci UINT_32 pixelPitch; ///< Pitch in original pixels 605bf215546Sopenharmony_ci UINT_32 pixelHeight; ///< Height in original pixels 606bf215546Sopenharmony_ci UINT_32 pixelBits; ///< Original bits per pixel, passed from input 607bf215546Sopenharmony_ci UINT_64 sliceSize; ///< Size of slice specified by input's slice 608bf215546Sopenharmony_ci /// The result is controlled by surface flags & createFlags 609bf215546Sopenharmony_ci /// By default this value equals to surfSize for volume 610bf215546Sopenharmony_ci UINT_32 pitchTileMax; ///< PITCH_TILE_MAX value for h/w register 611bf215546Sopenharmony_ci UINT_32 heightTileMax; ///< HEIGHT_TILE_MAX value for h/w register 612bf215546Sopenharmony_ci UINT_32 sliceTileMax; ///< SLICE_TILE_MAX value for h/w register 613bf215546Sopenharmony_ci 614bf215546Sopenharmony_ci UINT_32 numSamples; ///< Pass the effective numSamples processed in this call 615bf215546Sopenharmony_ci 616bf215546Sopenharmony_ci /// r800 and later HWL parameters 617bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile parameters used. Filled in if 0 on input 618bf215546Sopenharmony_ci AddrTileType tileType; ///< Micro tiling type, only valid when tileIndex != -1 619bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MAY be "downgraded" 620bf215546Sopenharmony_ci 621bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 622bf215546Sopenharmony_ci /// Output flags 623bf215546Sopenharmony_ci struct 624bf215546Sopenharmony_ci { 625bf215546Sopenharmony_ci /// Special information to work around SI mipmap swizzle bug UBTS #317508 626bf215546Sopenharmony_ci UINT_32 last2DLevel : 1; ///< TRUE if this is the last 2D(3D) tiled 627bf215546Sopenharmony_ci ///< Only meaningful when create flag checkLast2DLevel is set 628bf215546Sopenharmony_ci UINT_32 tcCompatible : 1; ///< If the surface can be shader compatible 629bf215546Sopenharmony_ci UINT_32 dccUnsupport : 1; ///< If the surface can support DCC compressed rendering 630bf215546Sopenharmony_ci UINT_32 prtTileIndex : 1; ///< SI only, indicate the returned tile index is for PRT 631bf215546Sopenharmony_ci ///< If address lib return true for mip 0, client should set prt flag 632bf215546Sopenharmony_ci ///< for child mips in subsequent compute surface info calls 633bf215546Sopenharmony_ci UINT_32 reserved :28; ///< Reserved bits 634bf215546Sopenharmony_ci }; 635bf215546Sopenharmony_ci 636bf215546Sopenharmony_ci UINT_32 equationIndex; ///< Equation index in the equation table; 637bf215546Sopenharmony_ci 638bf215546Sopenharmony_ci UINT_32 blockWidth; ///< Width in element inside one block(1D->Micro, 2D->Macro) 639bf215546Sopenharmony_ci UINT_32 blockHeight; ///< Height in element inside one block(1D->Micro, 2D->Macro) 640bf215546Sopenharmony_ci UINT_32 blockSlices; ///< Slice number inside one block(1D->Micro, 2D->Macro) 641bf215546Sopenharmony_ci 642bf215546Sopenharmony_ci /// Stereo info 643bf215546Sopenharmony_ci ADDR_QBSTEREOINFO* pStereoInfo;///< Stereo information, needed when .qbStereo flag is TRUE 644bf215546Sopenharmony_ci 645bf215546Sopenharmony_ci INT_32 stencilTileIdx; ///< stencil tile index output when matchStencilTileCfg was set 646bf215546Sopenharmony_ci} ADDR_COMPUTE_SURFACE_INFO_OUTPUT; 647bf215546Sopenharmony_ci 648bf215546Sopenharmony_ci/** 649bf215546Sopenharmony_ci**************************************************************************************************** 650bf215546Sopenharmony_ci* AddrComputeSurfaceInfo 651bf215546Sopenharmony_ci* 652bf215546Sopenharmony_ci* @brief 653bf215546Sopenharmony_ci* Compute surface width/height/depth/alignments and suitable tiling mode 654bf215546Sopenharmony_ci**************************************************************************************************** 655bf215546Sopenharmony_ci*/ 656bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceInfo( 657bf215546Sopenharmony_ci ADDR_HANDLE hLib, 658bf215546Sopenharmony_ci const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, 659bf215546Sopenharmony_ci ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut); 660bf215546Sopenharmony_ci 661bf215546Sopenharmony_ci 662bf215546Sopenharmony_ci 663bf215546Sopenharmony_ci/** 664bf215546Sopenharmony_ci**************************************************************************************************** 665bf215546Sopenharmony_ci* ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT 666bf215546Sopenharmony_ci* 667bf215546Sopenharmony_ci* @brief 668bf215546Sopenharmony_ci* Input structure for AddrComputeSurfaceAddrFromCoord 669bf215546Sopenharmony_ci**************************************************************************************************** 670bf215546Sopenharmony_ci*/ 671bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT 672bf215546Sopenharmony_ci{ 673bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 674bf215546Sopenharmony_ci 675bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 676bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 677bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 678bf215546Sopenharmony_ci UINT_32 sample; ///< Sample index, use fragment index for EQAA 679bf215546Sopenharmony_ci 680bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 681bf215546Sopenharmony_ci UINT_32 pitch; ///< Surface pitch, in pixels 682bf215546Sopenharmony_ci UINT_32 height; ///< Surface height, in pixels 683bf215546Sopenharmony_ci UINT_32 numSlices; ///< Surface depth 684bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 685bf215546Sopenharmony_ci 686bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode 687bf215546Sopenharmony_ci BOOL_32 isDepth; ///< TRUE if the surface uses depth sample ordering within 688bf215546Sopenharmony_ci /// micro tile. Textures can also choose depth sample order 689bf215546Sopenharmony_ci UINT_32 tileBase; ///< Base offset (in bits) inside micro tile which handles 690bf215546Sopenharmony_ci /// the case that components are stored separately 691bf215546Sopenharmony_ci UINT_32 compBits; ///< The component bits actually needed(for planar surface) 692bf215546Sopenharmony_ci 693bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 694bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 695bf215546Sopenharmony_ci /// number of fragments for EQAA 696bf215546Sopenharmony_ci /// r800 and later HWL parameters 697bf215546Sopenharmony_ci // Used for 1D tiling above 698bf215546Sopenharmony_ci AddrTileType tileType; ///< See defintion of AddrTileType 699bf215546Sopenharmony_ci struct 700bf215546Sopenharmony_ci { 701bf215546Sopenharmony_ci UINT_32 ignoreSE : 1; ///< TRUE if shader engines are ignored. This is texture 702bf215546Sopenharmony_ci /// only flag. Only non-RT texture can set this to TRUE 703bf215546Sopenharmony_ci UINT_32 reserved :31; ///< Reserved for future use. 704bf215546Sopenharmony_ci }; 705bf215546Sopenharmony_ci // 2D tiling needs following structure 706bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 707bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 708bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 709bf215546Sopenharmony_ci union 710bf215546Sopenharmony_ci { 711bf215546Sopenharmony_ci struct 712bf215546Sopenharmony_ci { 713bf215546Sopenharmony_ci UINT_32 bankSwizzle; ///< Bank swizzle 714bf215546Sopenharmony_ci UINT_32 pipeSwizzle; ///< Pipe swizzle 715bf215546Sopenharmony_ci }; 716bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Combined swizzle, if useCombinedSwizzle is TRUE 717bf215546Sopenharmony_ci }; 718bf215546Sopenharmony_ci} ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT; 719bf215546Sopenharmony_ci 720bf215546Sopenharmony_ci/** 721bf215546Sopenharmony_ci**************************************************************************************************** 722bf215546Sopenharmony_ci* ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT 723bf215546Sopenharmony_ci* 724bf215546Sopenharmony_ci* @brief 725bf215546Sopenharmony_ci* Output structure for AddrComputeSurfaceAddrFromCoord 726bf215546Sopenharmony_ci**************************************************************************************************** 727bf215546Sopenharmony_ci*/ 728bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT 729bf215546Sopenharmony_ci{ 730bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 731bf215546Sopenharmony_ci 732bf215546Sopenharmony_ci UINT_64 addr; ///< Byte address 733bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within surfaceAddr, 0-7. 734bf215546Sopenharmony_ci /// For surface bpp < 8, e.g. FMT_1. 735bf215546Sopenharmony_ci UINT_32 prtBlockIndex; ///< Index of a PRT tile (64K block) 736bf215546Sopenharmony_ci} ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT; 737bf215546Sopenharmony_ci 738bf215546Sopenharmony_ci/** 739bf215546Sopenharmony_ci**************************************************************************************************** 740bf215546Sopenharmony_ci* AddrComputeSurfaceAddrFromCoord 741bf215546Sopenharmony_ci* 742bf215546Sopenharmony_ci* @brief 743bf215546Sopenharmony_ci* Compute surface address from a given coordinate. 744bf215546Sopenharmony_ci**************************************************************************************************** 745bf215546Sopenharmony_ci*/ 746bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceAddrFromCoord( 747bf215546Sopenharmony_ci ADDR_HANDLE hLib, 748bf215546Sopenharmony_ci const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn, 749bf215546Sopenharmony_ci ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut); 750bf215546Sopenharmony_ci 751bf215546Sopenharmony_ci 752bf215546Sopenharmony_ci 753bf215546Sopenharmony_ci/** 754bf215546Sopenharmony_ci**************************************************************************************************** 755bf215546Sopenharmony_ci* ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT 756bf215546Sopenharmony_ci* 757bf215546Sopenharmony_ci* @brief 758bf215546Sopenharmony_ci* Input structure for AddrComputeSurfaceCoordFromAddr 759bf215546Sopenharmony_ci**************************************************************************************************** 760bf215546Sopenharmony_ci*/ 761bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT 762bf215546Sopenharmony_ci{ 763bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 764bf215546Sopenharmony_ci 765bf215546Sopenharmony_ci UINT_64 addr; ///< Address in bytes 766bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position in addr. 0-7. for surface bpp < 8, 767bf215546Sopenharmony_ci /// e.g. FMT_1; 768bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 769bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch, in pixels 770bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels 771bf215546Sopenharmony_ci UINT_32 numSlices; ///< Surface depth 772bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 773bf215546Sopenharmony_ci 774bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode 775bf215546Sopenharmony_ci BOOL_32 isDepth; ///< Surface uses depth sample ordering within micro tile. 776bf215546Sopenharmony_ci /// Note: Textures can choose depth sample order as well. 777bf215546Sopenharmony_ci UINT_32 tileBase; ///< Base offset (in bits) inside micro tile which handles 778bf215546Sopenharmony_ci /// the case that components are stored separately 779bf215546Sopenharmony_ci UINT_32 compBits; ///< The component bits actually needed(for planar surface) 780bf215546Sopenharmony_ci 781bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 782bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 783bf215546Sopenharmony_ci /// number of fragments for EQAA 784bf215546Sopenharmony_ci /// r800 and later HWL parameters 785bf215546Sopenharmony_ci // Used for 1D tiling above 786bf215546Sopenharmony_ci AddrTileType tileType; ///< See defintion of AddrTileType 787bf215546Sopenharmony_ci struct 788bf215546Sopenharmony_ci { 789bf215546Sopenharmony_ci UINT_32 ignoreSE : 1; ///< TRUE if shader engines are ignored. This is texture 790bf215546Sopenharmony_ci /// only flag. Only non-RT texture can set this to TRUE 791bf215546Sopenharmony_ci UINT_32 reserved :31; ///< Reserved for future use. 792bf215546Sopenharmony_ci }; 793bf215546Sopenharmony_ci // 2D tiling needs following structure 794bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 795bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 796bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 797bf215546Sopenharmony_ci union 798bf215546Sopenharmony_ci { 799bf215546Sopenharmony_ci struct 800bf215546Sopenharmony_ci { 801bf215546Sopenharmony_ci UINT_32 bankSwizzle; ///< Bank swizzle 802bf215546Sopenharmony_ci UINT_32 pipeSwizzle; ///< Pipe swizzle 803bf215546Sopenharmony_ci }; 804bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Combined swizzle, if useCombinedSwizzle is TRUE 805bf215546Sopenharmony_ci }; 806bf215546Sopenharmony_ci} ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT; 807bf215546Sopenharmony_ci 808bf215546Sopenharmony_ci/** 809bf215546Sopenharmony_ci**************************************************************************************************** 810bf215546Sopenharmony_ci* ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT 811bf215546Sopenharmony_ci* 812bf215546Sopenharmony_ci* @brief 813bf215546Sopenharmony_ci* Output structure for AddrComputeSurfaceCoordFromAddr 814bf215546Sopenharmony_ci**************************************************************************************************** 815bf215546Sopenharmony_ci*/ 816bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT 817bf215546Sopenharmony_ci{ 818bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 819bf215546Sopenharmony_ci 820bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 821bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 822bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slices 823bf215546Sopenharmony_ci UINT_32 sample; ///< Index of samples, means fragment index for EQAA 824bf215546Sopenharmony_ci} ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT; 825bf215546Sopenharmony_ci 826bf215546Sopenharmony_ci/** 827bf215546Sopenharmony_ci**************************************************************************************************** 828bf215546Sopenharmony_ci* AddrComputeSurfaceCoordFromAddr 829bf215546Sopenharmony_ci* 830bf215546Sopenharmony_ci* @brief 831bf215546Sopenharmony_ci* Compute coordinate from a given surface address 832bf215546Sopenharmony_ci**************************************************************************************************** 833bf215546Sopenharmony_ci*/ 834bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceCoordFromAddr( 835bf215546Sopenharmony_ci ADDR_HANDLE hLib, 836bf215546Sopenharmony_ci const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn, 837bf215546Sopenharmony_ci ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut); 838bf215546Sopenharmony_ci 839bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 840bf215546Sopenharmony_ci// HTile functions 841bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 842bf215546Sopenharmony_ci 843bf215546Sopenharmony_ci/** 844bf215546Sopenharmony_ci**************************************************************************************************** 845bf215546Sopenharmony_ci* ADDR_HTILE_FLAGS 846bf215546Sopenharmony_ci* 847bf215546Sopenharmony_ci* @brief 848bf215546Sopenharmony_ci* HTILE flags 849bf215546Sopenharmony_ci**************************************************************************************************** 850bf215546Sopenharmony_ci*/ 851bf215546Sopenharmony_citypedef union _ADDR_HTILE_FLAGS 852bf215546Sopenharmony_ci{ 853bf215546Sopenharmony_ci struct 854bf215546Sopenharmony_ci { 855bf215546Sopenharmony_ci UINT_32 tcCompatible : 1; ///< Flag indicates surface needs to be shader readable 856bf215546Sopenharmony_ci UINT_32 skipTcCompatSizeAlign : 1; ///< Flag indicates that addrLib will not align htile 857bf215546Sopenharmony_ci /// size to 256xBankxPipe when computing tc-compatible 858bf215546Sopenharmony_ci /// htile info. 859bf215546Sopenharmony_ci UINT_32 reserved : 30; ///< Reserved bits 860bf215546Sopenharmony_ci }; 861bf215546Sopenharmony_ci 862bf215546Sopenharmony_ci UINT_32 value; 863bf215546Sopenharmony_ci} ADDR_HTILE_FLAGS; 864bf215546Sopenharmony_ci 865bf215546Sopenharmony_ci/** 866bf215546Sopenharmony_ci**************************************************************************************************** 867bf215546Sopenharmony_ci* ADDR_COMPUTE_HTILE_INFO_INPUT 868bf215546Sopenharmony_ci* 869bf215546Sopenharmony_ci* @brief 870bf215546Sopenharmony_ci* Input structure of AddrComputeHtileInfo 871bf215546Sopenharmony_ci**************************************************************************************************** 872bf215546Sopenharmony_ci*/ 873bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_HTILE_INFO_INPUT 874bf215546Sopenharmony_ci{ 875bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 876bf215546Sopenharmony_ci 877bf215546Sopenharmony_ci ADDR_HTILE_FLAGS flags; ///< HTILE flags 878bf215546Sopenharmony_ci UINT_32 pitch; ///< Surface pitch, in pixels 879bf215546Sopenharmony_ci UINT_32 height; ///< Surface height, in pixels 880bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices 881bf215546Sopenharmony_ci BOOL_32 isLinear; ///< Linear or tiled HTILE layout 882bf215546Sopenharmony_ci AddrHtileBlockSize blockWidth; ///< 4 or 8. EG above only support 8 883bf215546Sopenharmony_ci AddrHtileBlockSize blockHeight; ///< 4 or 8. EG above only support 8 884bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile info 885bf215546Sopenharmony_ci 886bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 887bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 888bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 889bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 890bf215546Sopenharmony_ci} ADDR_COMPUTE_HTILE_INFO_INPUT; 891bf215546Sopenharmony_ci 892bf215546Sopenharmony_ci/** 893bf215546Sopenharmony_ci**************************************************************************************************** 894bf215546Sopenharmony_ci* ADDR_COMPUTE_HTILE_INFO_OUTPUT 895bf215546Sopenharmony_ci* 896bf215546Sopenharmony_ci* @brief 897bf215546Sopenharmony_ci* Output structure of AddrComputeHtileInfo 898bf215546Sopenharmony_ci**************************************************************************************************** 899bf215546Sopenharmony_ci*/ 900bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_HTILE_INFO_OUTPUT 901bf215546Sopenharmony_ci{ 902bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 903bf215546Sopenharmony_ci 904bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch in pixels of depth buffer represented in this 905bf215546Sopenharmony_ci /// HTile buffer. This might be larger than original depth 906bf215546Sopenharmony_ci /// buffer pitch when called with an unaligned pitch. 907bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels, as above 908bf215546Sopenharmony_ci UINT_64 htileBytes; ///< Size of HTILE buffer, in bytes 909bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Base alignment 910bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel for HTILE is how many bits for an 8x8 block! 911bf215546Sopenharmony_ci UINT_32 macroWidth; ///< Macro width in pixels, actually squared cache shape 912bf215546Sopenharmony_ci UINT_32 macroHeight; ///< Macro height in pixels 913bf215546Sopenharmony_ci UINT_64 sliceSize; ///< Slice size, in bytes. 914bf215546Sopenharmony_ci BOOL_32 sliceInterleaved; ///< Flag to indicate if different slice's htile is interleaved 915bf215546Sopenharmony_ci /// Compute engine clear can't be used if htile is interleaved 916bf215546Sopenharmony_ci BOOL_32 nextMipLevelCompressible; ///< Flag to indicate whether HTILE can be enabled in 917bf215546Sopenharmony_ci /// next mip level, it also indicates if memory set based 918bf215546Sopenharmony_ci /// fast clear can be used for current mip level. 919bf215546Sopenharmony_ci} ADDR_COMPUTE_HTILE_INFO_OUTPUT; 920bf215546Sopenharmony_ci 921bf215546Sopenharmony_ci/** 922bf215546Sopenharmony_ci**************************************************************************************************** 923bf215546Sopenharmony_ci* AddrComputeHtileInfo 924bf215546Sopenharmony_ci* 925bf215546Sopenharmony_ci* @brief 926bf215546Sopenharmony_ci* Compute Htile pitch, height, base alignment and size in bytes 927bf215546Sopenharmony_ci**************************************************************************************************** 928bf215546Sopenharmony_ci*/ 929bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeHtileInfo( 930bf215546Sopenharmony_ci ADDR_HANDLE hLib, 931bf215546Sopenharmony_ci const ADDR_COMPUTE_HTILE_INFO_INPUT* pIn, 932bf215546Sopenharmony_ci ADDR_COMPUTE_HTILE_INFO_OUTPUT* pOut); 933bf215546Sopenharmony_ci 934bf215546Sopenharmony_ci 935bf215546Sopenharmony_ci 936bf215546Sopenharmony_ci/** 937bf215546Sopenharmony_ci**************************************************************************************************** 938bf215546Sopenharmony_ci* ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT 939bf215546Sopenharmony_ci* 940bf215546Sopenharmony_ci* @brief 941bf215546Sopenharmony_ci* Input structure for AddrComputeHtileAddrFromCoord 942bf215546Sopenharmony_ci**************************************************************************************************** 943bf215546Sopenharmony_ci*/ 944bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT 945bf215546Sopenharmony_ci{ 946bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 947bf215546Sopenharmony_ci 948bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch, in pixels 949bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels 950bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 951bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 952bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slice 953bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices 954bf215546Sopenharmony_ci BOOL_32 isLinear; ///< Linear or tiled HTILE layout 955bf215546Sopenharmony_ci ADDR_HTILE_FLAGS flags; ///< htile flags 956bf215546Sopenharmony_ci AddrHtileBlockSize blockWidth; ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8 957bf215546Sopenharmony_ci AddrHtileBlockSize blockHeight; ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8 958bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile info 959bf215546Sopenharmony_ci 960bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 961bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 962bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 963bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 964bf215546Sopenharmony_ci UINT_32 bpp; ///< depth/stencil buffer bit per pixel size 965bf215546Sopenharmony_ci UINT_32 zStencilAddr; ///< tcCompatible Z/Stencil surface address 966bf215546Sopenharmony_ci} ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT; 967bf215546Sopenharmony_ci 968bf215546Sopenharmony_ci/** 969bf215546Sopenharmony_ci**************************************************************************************************** 970bf215546Sopenharmony_ci* ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT 971bf215546Sopenharmony_ci* 972bf215546Sopenharmony_ci* @brief 973bf215546Sopenharmony_ci* Output structure for AddrComputeHtileAddrFromCoord 974bf215546Sopenharmony_ci**************************************************************************************************** 975bf215546Sopenharmony_ci*/ 976bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT 977bf215546Sopenharmony_ci{ 978bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 979bf215546Sopenharmony_ci 980bf215546Sopenharmony_ci UINT_64 addr; ///< Address in bytes 981bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position, 0 or 4. CMASK and HTILE shares some lib method. 982bf215546Sopenharmony_ci /// So we keep bitPosition for HTILE as well 983bf215546Sopenharmony_ci} ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT; 984bf215546Sopenharmony_ci 985bf215546Sopenharmony_ci/** 986bf215546Sopenharmony_ci**************************************************************************************************** 987bf215546Sopenharmony_ci* AddrComputeHtileAddrFromCoord 988bf215546Sopenharmony_ci* 989bf215546Sopenharmony_ci* @brief 990bf215546Sopenharmony_ci* Compute Htile address according to coordinates (of depth buffer) 991bf215546Sopenharmony_ci**************************************************************************************************** 992bf215546Sopenharmony_ci*/ 993bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeHtileAddrFromCoord( 994bf215546Sopenharmony_ci ADDR_HANDLE hLib, 995bf215546Sopenharmony_ci const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn, 996bf215546Sopenharmony_ci ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut); 997bf215546Sopenharmony_ci 998bf215546Sopenharmony_ci 999bf215546Sopenharmony_ci 1000bf215546Sopenharmony_ci/** 1001bf215546Sopenharmony_ci**************************************************************************************************** 1002bf215546Sopenharmony_ci* ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT 1003bf215546Sopenharmony_ci* 1004bf215546Sopenharmony_ci* @brief 1005bf215546Sopenharmony_ci* Input structure for AddrComputeHtileCoordFromAddr 1006bf215546Sopenharmony_ci**************************************************************************************************** 1007bf215546Sopenharmony_ci*/ 1008bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT 1009bf215546Sopenharmony_ci{ 1010bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1011bf215546Sopenharmony_ci 1012bf215546Sopenharmony_ci UINT_64 addr; ///< Address 1013bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position 0 or 4. CMASK and HTILE share some methods 1014bf215546Sopenharmony_ci /// so we keep bitPosition for HTILE as well 1015bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch, in pixels 1016bf215546Sopenharmony_ci UINT_32 height; ///< Height, in pixels 1017bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices 1018bf215546Sopenharmony_ci BOOL_32 isLinear; ///< Linear or tiled HTILE layout 1019bf215546Sopenharmony_ci AddrHtileBlockSize blockWidth; ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8 1020bf215546Sopenharmony_ci AddrHtileBlockSize blockHeight; ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8 1021bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile info 1022bf215546Sopenharmony_ci 1023bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1024bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1025bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1026bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1027bf215546Sopenharmony_ci} ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT; 1028bf215546Sopenharmony_ci 1029bf215546Sopenharmony_ci/** 1030bf215546Sopenharmony_ci**************************************************************************************************** 1031bf215546Sopenharmony_ci* ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT 1032bf215546Sopenharmony_ci* 1033bf215546Sopenharmony_ci* @brief 1034bf215546Sopenharmony_ci* Output structure for AddrComputeHtileCoordFromAddr 1035bf215546Sopenharmony_ci**************************************************************************************************** 1036bf215546Sopenharmony_ci*/ 1037bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT 1038bf215546Sopenharmony_ci{ 1039bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1040bf215546Sopenharmony_ci 1041bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 1042bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 1043bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 1044bf215546Sopenharmony_ci} ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT; 1045bf215546Sopenharmony_ci 1046bf215546Sopenharmony_ci/** 1047bf215546Sopenharmony_ci**************************************************************************************************** 1048bf215546Sopenharmony_ci* AddrComputeHtileCoordFromAddr 1049bf215546Sopenharmony_ci* 1050bf215546Sopenharmony_ci* @brief 1051bf215546Sopenharmony_ci* Compute coordinates within depth buffer (1st pixel of a micro tile) according to 1052bf215546Sopenharmony_ci* Htile address 1053bf215546Sopenharmony_ci**************************************************************************************************** 1054bf215546Sopenharmony_ci*/ 1055bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeHtileCoordFromAddr( 1056bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1057bf215546Sopenharmony_ci const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn, 1058bf215546Sopenharmony_ci ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut); 1059bf215546Sopenharmony_ci 1060bf215546Sopenharmony_ci 1061bf215546Sopenharmony_ci 1062bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 1063bf215546Sopenharmony_ci// C-mask functions 1064bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 1065bf215546Sopenharmony_ci 1066bf215546Sopenharmony_ci/** 1067bf215546Sopenharmony_ci**************************************************************************************************** 1068bf215546Sopenharmony_ci* ADDR_CMASK_FLAGS 1069bf215546Sopenharmony_ci* 1070bf215546Sopenharmony_ci* @brief 1071bf215546Sopenharmony_ci* CMASK flags 1072bf215546Sopenharmony_ci**************************************************************************************************** 1073bf215546Sopenharmony_ci*/ 1074bf215546Sopenharmony_citypedef union _ADDR_CMASK_FLAGS 1075bf215546Sopenharmony_ci{ 1076bf215546Sopenharmony_ci struct 1077bf215546Sopenharmony_ci { 1078bf215546Sopenharmony_ci UINT_32 tcCompatible : 1; ///< Flag indicates surface needs to be shader readable 1079bf215546Sopenharmony_ci UINT_32 reserved :31; ///< Reserved bits 1080bf215546Sopenharmony_ci }; 1081bf215546Sopenharmony_ci 1082bf215546Sopenharmony_ci UINT_32 value; 1083bf215546Sopenharmony_ci} ADDR_CMASK_FLAGS; 1084bf215546Sopenharmony_ci 1085bf215546Sopenharmony_ci/** 1086bf215546Sopenharmony_ci**************************************************************************************************** 1087bf215546Sopenharmony_ci* ADDR_COMPUTE_CMASK_INFO_INPUT 1088bf215546Sopenharmony_ci* 1089bf215546Sopenharmony_ci* @brief 1090bf215546Sopenharmony_ci* Input structure of AddrComputeCmaskInfo 1091bf215546Sopenharmony_ci**************************************************************************************************** 1092bf215546Sopenharmony_ci*/ 1093bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_CMASKINFO_INPUT 1094bf215546Sopenharmony_ci{ 1095bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1096bf215546Sopenharmony_ci 1097bf215546Sopenharmony_ci ADDR_CMASK_FLAGS flags; ///< CMASK flags 1098bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch, in pixels, of color buffer 1099bf215546Sopenharmony_ci UINT_32 height; ///< Height, in pixels, of color buffer 1100bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices, of color buffer 1101bf215546Sopenharmony_ci BOOL_32 isLinear; ///< Linear or tiled layout, Only SI can be linear 1102bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile info 1103bf215546Sopenharmony_ci 1104bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1105bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1106bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1107bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1108bf215546Sopenharmony_ci} ADDR_COMPUTE_CMASK_INFO_INPUT; 1109bf215546Sopenharmony_ci 1110bf215546Sopenharmony_ci/** 1111bf215546Sopenharmony_ci**************************************************************************************************** 1112bf215546Sopenharmony_ci* ADDR_COMPUTE_CMASK_INFO_OUTPUT 1113bf215546Sopenharmony_ci* 1114bf215546Sopenharmony_ci* @brief 1115bf215546Sopenharmony_ci* Output structure of AddrComputeCmaskInfo 1116bf215546Sopenharmony_ci**************************************************************************************************** 1117bf215546Sopenharmony_ci*/ 1118bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_CMASK_INFO_OUTPUT 1119bf215546Sopenharmony_ci{ 1120bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1121bf215546Sopenharmony_ci 1122bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch in pixels of color buffer which 1123bf215546Sopenharmony_ci /// this Cmask matches. The size might be larger than 1124bf215546Sopenharmony_ci /// original color buffer pitch when called with 1125bf215546Sopenharmony_ci /// an unaligned pitch. 1126bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels, as above 1127bf215546Sopenharmony_ci UINT_64 cmaskBytes; ///< Size in bytes of CMask buffer 1128bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Base alignment 1129bf215546Sopenharmony_ci UINT_32 blockMax; ///< Cmask block size. Need this to set CB_COLORn_MASK register 1130bf215546Sopenharmony_ci UINT_32 macroWidth; ///< Macro width in pixels, actually squared cache shape 1131bf215546Sopenharmony_ci UINT_32 macroHeight; ///< Macro height in pixels 1132bf215546Sopenharmony_ci UINT_64 sliceSize; ///< Slice size, in bytes. 1133bf215546Sopenharmony_ci} ADDR_COMPUTE_CMASK_INFO_OUTPUT; 1134bf215546Sopenharmony_ci 1135bf215546Sopenharmony_ci/** 1136bf215546Sopenharmony_ci**************************************************************************************************** 1137bf215546Sopenharmony_ci* AddrComputeCmaskInfo 1138bf215546Sopenharmony_ci* 1139bf215546Sopenharmony_ci* @brief 1140bf215546Sopenharmony_ci* Compute Cmask pitch, height, base alignment and size in bytes from color buffer 1141bf215546Sopenharmony_ci* info 1142bf215546Sopenharmony_ci**************************************************************************************************** 1143bf215546Sopenharmony_ci*/ 1144bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeCmaskInfo( 1145bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1146bf215546Sopenharmony_ci const ADDR_COMPUTE_CMASK_INFO_INPUT* pIn, 1147bf215546Sopenharmony_ci ADDR_COMPUTE_CMASK_INFO_OUTPUT* pOut); 1148bf215546Sopenharmony_ci 1149bf215546Sopenharmony_ci 1150bf215546Sopenharmony_ci 1151bf215546Sopenharmony_ci/** 1152bf215546Sopenharmony_ci**************************************************************************************************** 1153bf215546Sopenharmony_ci* ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT 1154bf215546Sopenharmony_ci* 1155bf215546Sopenharmony_ci* @brief 1156bf215546Sopenharmony_ci* Input structure for AddrComputeCmaskAddrFromCoord 1157bf215546Sopenharmony_ci* 1158bf215546Sopenharmony_ci**************************************************************************************************** 1159bf215546Sopenharmony_ci*/ 1160bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT 1161bf215546Sopenharmony_ci{ 1162bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1163bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 1164bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 1165bf215546Sopenharmony_ci UINT_64 fmaskAddr; ///< Fmask addr for tc compatible Cmask 1166bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 1167bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch in pixels, of color buffer 1168bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels, of color buffer 1169bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices 1170bf215546Sopenharmony_ci UINT_32 bpp; 1171bf215546Sopenharmony_ci BOOL_32 isLinear; ///< Linear or tiled layout, Only SI can be linear 1172bf215546Sopenharmony_ci ADDR_CMASK_FLAGS flags; ///< CMASK flags 1173bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile info 1174bf215546Sopenharmony_ci 1175bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1176bf215546Sopenharmony_ci ///< while the global useTileIndex is set to 1 1177bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1178bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1179bf215546Sopenharmony_ci} ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT; 1180bf215546Sopenharmony_ci 1181bf215546Sopenharmony_ci/** 1182bf215546Sopenharmony_ci**************************************************************************************************** 1183bf215546Sopenharmony_ci* ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT 1184bf215546Sopenharmony_ci* 1185bf215546Sopenharmony_ci* @brief 1186bf215546Sopenharmony_ci* Output structure for AddrComputeCmaskAddrFromCoord 1187bf215546Sopenharmony_ci**************************************************************************************************** 1188bf215546Sopenharmony_ci*/ 1189bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT 1190bf215546Sopenharmony_ci{ 1191bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1192bf215546Sopenharmony_ci 1193bf215546Sopenharmony_ci UINT_64 addr; ///< CMASK address in bytes 1194bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within addr, 0-7. CMASK is 4 bpp, 1195bf215546Sopenharmony_ci /// so the address may be located in bit 0 (0) or 4 (4) 1196bf215546Sopenharmony_ci} ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT; 1197bf215546Sopenharmony_ci 1198bf215546Sopenharmony_ci/** 1199bf215546Sopenharmony_ci**************************************************************************************************** 1200bf215546Sopenharmony_ci* AddrComputeCmaskAddrFromCoord 1201bf215546Sopenharmony_ci* 1202bf215546Sopenharmony_ci* @brief 1203bf215546Sopenharmony_ci* Compute Cmask address according to coordinates (of MSAA color buffer) 1204bf215546Sopenharmony_ci**************************************************************************************************** 1205bf215546Sopenharmony_ci*/ 1206bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeCmaskAddrFromCoord( 1207bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1208bf215546Sopenharmony_ci const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn, 1209bf215546Sopenharmony_ci ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut); 1210bf215546Sopenharmony_ci 1211bf215546Sopenharmony_ci 1212bf215546Sopenharmony_ci 1213bf215546Sopenharmony_ci/** 1214bf215546Sopenharmony_ci**************************************************************************************************** 1215bf215546Sopenharmony_ci* ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT 1216bf215546Sopenharmony_ci* 1217bf215546Sopenharmony_ci* @brief 1218bf215546Sopenharmony_ci* Input structure for AddrComputeCmaskCoordFromAddr 1219bf215546Sopenharmony_ci**************************************************************************************************** 1220bf215546Sopenharmony_ci*/ 1221bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT 1222bf215546Sopenharmony_ci{ 1223bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1224bf215546Sopenharmony_ci 1225bf215546Sopenharmony_ci UINT_64 addr; ///< CMASK address in bytes 1226bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within addr, 0-7. CMASK is 4 bpp, 1227bf215546Sopenharmony_ci /// so the address may be located in bit 0 (0) or 4 (4) 1228bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch, in pixels 1229bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels 1230bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices 1231bf215546Sopenharmony_ci BOOL_32 isLinear; ///< Linear or tiled layout, Only SI can be linear 1232bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile info 1233bf215546Sopenharmony_ci 1234bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1235bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1236bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1237bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1238bf215546Sopenharmony_ci} ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT; 1239bf215546Sopenharmony_ci 1240bf215546Sopenharmony_ci/** 1241bf215546Sopenharmony_ci**************************************************************************************************** 1242bf215546Sopenharmony_ci* ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT 1243bf215546Sopenharmony_ci* 1244bf215546Sopenharmony_ci* @brief 1245bf215546Sopenharmony_ci* Output structure for AddrComputeCmaskCoordFromAddr 1246bf215546Sopenharmony_ci**************************************************************************************************** 1247bf215546Sopenharmony_ci*/ 1248bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT 1249bf215546Sopenharmony_ci{ 1250bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1251bf215546Sopenharmony_ci 1252bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 1253bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 1254bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 1255bf215546Sopenharmony_ci} ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT; 1256bf215546Sopenharmony_ci 1257bf215546Sopenharmony_ci/** 1258bf215546Sopenharmony_ci**************************************************************************************************** 1259bf215546Sopenharmony_ci* AddrComputeCmaskCoordFromAddr 1260bf215546Sopenharmony_ci* 1261bf215546Sopenharmony_ci* @brief 1262bf215546Sopenharmony_ci* Compute coordinates within color buffer (1st pixel of a micro tile) according to 1263bf215546Sopenharmony_ci* Cmask address 1264bf215546Sopenharmony_ci**************************************************************************************************** 1265bf215546Sopenharmony_ci*/ 1266bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeCmaskCoordFromAddr( 1267bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1268bf215546Sopenharmony_ci const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT* pIn, 1269bf215546Sopenharmony_ci ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut); 1270bf215546Sopenharmony_ci 1271bf215546Sopenharmony_ci 1272bf215546Sopenharmony_ci 1273bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 1274bf215546Sopenharmony_ci// F-mask functions 1275bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 1276bf215546Sopenharmony_ci 1277bf215546Sopenharmony_ci/** 1278bf215546Sopenharmony_ci**************************************************************************************************** 1279bf215546Sopenharmony_ci* ADDR_COMPUTE_FMASK_INFO_INPUT 1280bf215546Sopenharmony_ci* 1281bf215546Sopenharmony_ci* @brief 1282bf215546Sopenharmony_ci* Input structure for AddrComputeFmaskInfo 1283bf215546Sopenharmony_ci**************************************************************************************************** 1284bf215546Sopenharmony_ci*/ 1285bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_FMASK_INFO_INPUT 1286bf215546Sopenharmony_ci{ 1287bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1288bf215546Sopenharmony_ci 1289bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode 1290bf215546Sopenharmony_ci UINT_32 pitch; ///< Surface pitch, in pixels 1291bf215546Sopenharmony_ci UINT_32 height; ///< Surface height, in pixels 1292bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slice/depth 1293bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 1294bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 1295bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 1296bf215546Sopenharmony_ci /// number of fragments for EQAA 1297bf215546Sopenharmony_ci /// r800 and later HWL parameters 1298bf215546Sopenharmony_ci struct 1299bf215546Sopenharmony_ci { 1300bf215546Sopenharmony_ci UINT_32 resolved: 1; ///< TRUE if the surface is for resolved fmask, only used 1301bf215546Sopenharmony_ci /// by H/W clients. S/W should always set it to FALSE. 1302bf215546Sopenharmony_ci UINT_32 reserved: 31; ///< Reserved for future use. 1303bf215546Sopenharmony_ci }; 1304bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tiling parameters. Clients must give valid data 1305bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1306bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1307bf215546Sopenharmony_ci} ADDR_COMPUTE_FMASK_INFO_INPUT; 1308bf215546Sopenharmony_ci 1309bf215546Sopenharmony_ci/** 1310bf215546Sopenharmony_ci**************************************************************************************************** 1311bf215546Sopenharmony_ci* ADDR_COMPUTE_FMASK_INFO_OUTPUT 1312bf215546Sopenharmony_ci* 1313bf215546Sopenharmony_ci* @brief 1314bf215546Sopenharmony_ci* Output structure for AddrComputeFmaskInfo 1315bf215546Sopenharmony_ci**************************************************************************************************** 1316bf215546Sopenharmony_ci*/ 1317bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_FMASK_INFO_OUTPUT 1318bf215546Sopenharmony_ci{ 1319bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1320bf215546Sopenharmony_ci 1321bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch of fmask in pixels 1322bf215546Sopenharmony_ci UINT_32 height; ///< Height of fmask in pixels 1323bf215546Sopenharmony_ci UINT_32 numSlices; ///< Slices of fmask 1324bf215546Sopenharmony_ci UINT_64 fmaskBytes; ///< Size of fmask in bytes 1325bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Base address alignment 1326bf215546Sopenharmony_ci UINT_32 pitchAlign; ///< Pitch alignment 1327bf215546Sopenharmony_ci UINT_32 heightAlign; ///< Height alignment 1328bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel of FMASK is: number of bit planes 1329bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples, used for dump, export this since input 1330bf215546Sopenharmony_ci /// may be changed in 9xx and above 1331bf215546Sopenharmony_ci /// r800 and later HWL parameters 1332bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile parameters used. Fmask can have different 1333bf215546Sopenharmony_ci /// bank_height from color buffer 1334bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1335bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1336bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1337bf215546Sopenharmony_ci UINT_64 sliceSize; ///< Size of slice in bytes 1338bf215546Sopenharmony_ci} ADDR_COMPUTE_FMASK_INFO_OUTPUT; 1339bf215546Sopenharmony_ci 1340bf215546Sopenharmony_ci/** 1341bf215546Sopenharmony_ci**************************************************************************************************** 1342bf215546Sopenharmony_ci* AddrComputeFmaskInfo 1343bf215546Sopenharmony_ci* 1344bf215546Sopenharmony_ci* @brief 1345bf215546Sopenharmony_ci* Compute Fmask pitch/height/depth/alignments and size in bytes 1346bf215546Sopenharmony_ci**************************************************************************************************** 1347bf215546Sopenharmony_ci*/ 1348bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeFmaskInfo( 1349bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1350bf215546Sopenharmony_ci const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn, 1351bf215546Sopenharmony_ci ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut); 1352bf215546Sopenharmony_ci 1353bf215546Sopenharmony_ci 1354bf215546Sopenharmony_ci 1355bf215546Sopenharmony_ci/** 1356bf215546Sopenharmony_ci**************************************************************************************************** 1357bf215546Sopenharmony_ci* ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT 1358bf215546Sopenharmony_ci* 1359bf215546Sopenharmony_ci* @brief 1360bf215546Sopenharmony_ci* Input structure for AddrComputeFmaskAddrFromCoord 1361bf215546Sopenharmony_ci**************************************************************************************************** 1362bf215546Sopenharmony_ci*/ 1363bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT 1364bf215546Sopenharmony_ci{ 1365bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1366bf215546Sopenharmony_ci 1367bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 1368bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 1369bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 1370bf215546Sopenharmony_ci UINT_32 plane; ///< Plane number 1371bf215546Sopenharmony_ci UINT_32 sample; ///< Sample index (fragment index for EQAA) 1372bf215546Sopenharmony_ci 1373bf215546Sopenharmony_ci UINT_32 pitch; ///< Surface pitch, in pixels 1374bf215546Sopenharmony_ci UINT_32 height; ///< Surface height, in pixels 1375bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 1376bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 1377bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 1378bf215546Sopenharmony_ci /// number of fragments for EQAA 1379bf215546Sopenharmony_ci 1380bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode 1381bf215546Sopenharmony_ci union 1382bf215546Sopenharmony_ci { 1383bf215546Sopenharmony_ci struct 1384bf215546Sopenharmony_ci { 1385bf215546Sopenharmony_ci UINT_32 bankSwizzle; ///< Bank swizzle 1386bf215546Sopenharmony_ci UINT_32 pipeSwizzle; ///< Pipe swizzle 1387bf215546Sopenharmony_ci }; 1388bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Combined swizzle, if useCombinedSwizzle is TRUE 1389bf215546Sopenharmony_ci }; 1390bf215546Sopenharmony_ci 1391bf215546Sopenharmony_ci /// r800 and later HWL parameters 1392bf215546Sopenharmony_ci struct 1393bf215546Sopenharmony_ci { 1394bf215546Sopenharmony_ci UINT_32 resolved: 1; ///< TRUE if this is a resolved fmask, used by H/W clients 1395bf215546Sopenharmony_ci UINT_32 ignoreSE: 1; ///< TRUE if shader engines are ignored. 1396bf215546Sopenharmony_ci UINT_32 reserved: 30; ///< Reserved for future use. 1397bf215546Sopenharmony_ci }; 1398bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tiling parameters. Client must provide all data 1399bf215546Sopenharmony_ci 1400bf215546Sopenharmony_ci} ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT; 1401bf215546Sopenharmony_ci 1402bf215546Sopenharmony_ci/** 1403bf215546Sopenharmony_ci**************************************************************************************************** 1404bf215546Sopenharmony_ci* ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT 1405bf215546Sopenharmony_ci* 1406bf215546Sopenharmony_ci* @brief 1407bf215546Sopenharmony_ci* Output structure for AddrComputeFmaskAddrFromCoord 1408bf215546Sopenharmony_ci**************************************************************************************************** 1409bf215546Sopenharmony_ci*/ 1410bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT 1411bf215546Sopenharmony_ci{ 1412bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1413bf215546Sopenharmony_ci 1414bf215546Sopenharmony_ci UINT_64 addr; ///< Fmask address 1415bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within fmaskAddr, 0-7. 1416bf215546Sopenharmony_ci} ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT; 1417bf215546Sopenharmony_ci 1418bf215546Sopenharmony_ci/** 1419bf215546Sopenharmony_ci**************************************************************************************************** 1420bf215546Sopenharmony_ci* AddrComputeFmaskAddrFromCoord 1421bf215546Sopenharmony_ci* 1422bf215546Sopenharmony_ci* @brief 1423bf215546Sopenharmony_ci* Compute Fmask address according to coordinates (x,y,slice,sample,plane) 1424bf215546Sopenharmony_ci**************************************************************************************************** 1425bf215546Sopenharmony_ci*/ 1426bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeFmaskAddrFromCoord( 1427bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1428bf215546Sopenharmony_ci const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn, 1429bf215546Sopenharmony_ci ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut); 1430bf215546Sopenharmony_ci 1431bf215546Sopenharmony_ci 1432bf215546Sopenharmony_ci 1433bf215546Sopenharmony_ci/** 1434bf215546Sopenharmony_ci**************************************************************************************************** 1435bf215546Sopenharmony_ci* ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT 1436bf215546Sopenharmony_ci* 1437bf215546Sopenharmony_ci* @brief 1438bf215546Sopenharmony_ci* Input structure for AddrComputeFmaskCoordFromAddr 1439bf215546Sopenharmony_ci**************************************************************************************************** 1440bf215546Sopenharmony_ci*/ 1441bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT 1442bf215546Sopenharmony_ci{ 1443bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1444bf215546Sopenharmony_ci 1445bf215546Sopenharmony_ci UINT_64 addr; ///< Address 1446bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within addr, 0-7. 1447bf215546Sopenharmony_ci 1448bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch, in pixels 1449bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels 1450bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 1451bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments 1452bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode 1453bf215546Sopenharmony_ci union 1454bf215546Sopenharmony_ci { 1455bf215546Sopenharmony_ci struct 1456bf215546Sopenharmony_ci { 1457bf215546Sopenharmony_ci UINT_32 bankSwizzle; ///< Bank swizzle 1458bf215546Sopenharmony_ci UINT_32 pipeSwizzle; ///< Pipe swizzle 1459bf215546Sopenharmony_ci }; 1460bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Combined swizzle, if useCombinedSwizzle is TRUE 1461bf215546Sopenharmony_ci }; 1462bf215546Sopenharmony_ci 1463bf215546Sopenharmony_ci /// r800 and later HWL parameters 1464bf215546Sopenharmony_ci struct 1465bf215546Sopenharmony_ci { 1466bf215546Sopenharmony_ci UINT_32 resolved: 1; ///< TRUE if this is a resolved fmask, used by HW components 1467bf215546Sopenharmony_ci UINT_32 ignoreSE: 1; ///< TRUE if shader engines are ignored. 1468bf215546Sopenharmony_ci UINT_32 reserved: 30; ///< Reserved for future use. 1469bf215546Sopenharmony_ci }; 1470bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 1471bf215546Sopenharmony_ci 1472bf215546Sopenharmony_ci} ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT; 1473bf215546Sopenharmony_ci 1474bf215546Sopenharmony_ci/** 1475bf215546Sopenharmony_ci**************************************************************************************************** 1476bf215546Sopenharmony_ci* ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT 1477bf215546Sopenharmony_ci* 1478bf215546Sopenharmony_ci* @brief 1479bf215546Sopenharmony_ci* Output structure for AddrComputeFmaskCoordFromAddr 1480bf215546Sopenharmony_ci**************************************************************************************************** 1481bf215546Sopenharmony_ci*/ 1482bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT 1483bf215546Sopenharmony_ci{ 1484bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1485bf215546Sopenharmony_ci 1486bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 1487bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 1488bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 1489bf215546Sopenharmony_ci UINT_32 plane; ///< Plane number 1490bf215546Sopenharmony_ci UINT_32 sample; ///< Sample index (fragment index for EQAA) 1491bf215546Sopenharmony_ci} ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT; 1492bf215546Sopenharmony_ci 1493bf215546Sopenharmony_ci/** 1494bf215546Sopenharmony_ci**************************************************************************************************** 1495bf215546Sopenharmony_ci* AddrComputeFmaskCoordFromAddr 1496bf215546Sopenharmony_ci* 1497bf215546Sopenharmony_ci* @brief 1498bf215546Sopenharmony_ci* Compute FMASK coordinate from an given address 1499bf215546Sopenharmony_ci**************************************************************************************************** 1500bf215546Sopenharmony_ci*/ 1501bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeFmaskCoordFromAddr( 1502bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1503bf215546Sopenharmony_ci const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn, 1504bf215546Sopenharmony_ci ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut); 1505bf215546Sopenharmony_ci 1506bf215546Sopenharmony_ci 1507bf215546Sopenharmony_ci 1508bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 1509bf215546Sopenharmony_ci// Element/utility functions 1510bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 1511bf215546Sopenharmony_ci 1512bf215546Sopenharmony_ci/** 1513bf215546Sopenharmony_ci**************************************************************************************************** 1514bf215546Sopenharmony_ci* AddrGetVersion 1515bf215546Sopenharmony_ci* 1516bf215546Sopenharmony_ci* @brief 1517bf215546Sopenharmony_ci* Get AddrLib version number 1518bf215546Sopenharmony_ci**************************************************************************************************** 1519bf215546Sopenharmony_ci*/ 1520bf215546Sopenharmony_ciUINT_32 ADDR_API AddrGetVersion(ADDR_HANDLE hLib); 1521bf215546Sopenharmony_ci 1522bf215546Sopenharmony_ci/** 1523bf215546Sopenharmony_ci**************************************************************************************************** 1524bf215546Sopenharmony_ci* AddrUseTileIndex 1525bf215546Sopenharmony_ci* 1526bf215546Sopenharmony_ci* @brief 1527bf215546Sopenharmony_ci* Return TRUE if tileIndex is enabled in this address library 1528bf215546Sopenharmony_ci**************************************************************************************************** 1529bf215546Sopenharmony_ci*/ 1530bf215546Sopenharmony_ciBOOL_32 ADDR_API AddrUseTileIndex(ADDR_HANDLE hLib); 1531bf215546Sopenharmony_ci 1532bf215546Sopenharmony_ci/** 1533bf215546Sopenharmony_ci**************************************************************************************************** 1534bf215546Sopenharmony_ci* AddrUseCombinedSwizzle 1535bf215546Sopenharmony_ci* 1536bf215546Sopenharmony_ci* @brief 1537bf215546Sopenharmony_ci* Return TRUE if combined swizzle is enabled in this address library 1538bf215546Sopenharmony_ci**************************************************************************************************** 1539bf215546Sopenharmony_ci*/ 1540bf215546Sopenharmony_ciBOOL_32 ADDR_API AddrUseCombinedSwizzle(ADDR_HANDLE hLib); 1541bf215546Sopenharmony_ci 1542bf215546Sopenharmony_ci/** 1543bf215546Sopenharmony_ci**************************************************************************************************** 1544bf215546Sopenharmony_ci* ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT 1545bf215546Sopenharmony_ci* 1546bf215546Sopenharmony_ci* @brief 1547bf215546Sopenharmony_ci* Input structure of AddrExtractBankPipeSwizzle 1548bf215546Sopenharmony_ci**************************************************************************************************** 1549bf215546Sopenharmony_ci*/ 1550bf215546Sopenharmony_citypedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT 1551bf215546Sopenharmony_ci{ 1552bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1553bf215546Sopenharmony_ci 1554bf215546Sopenharmony_ci UINT_32 base256b; ///< Base256b value 1555bf215546Sopenharmony_ci 1556bf215546Sopenharmony_ci /// r800 and later HWL parameters 1557bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 1558bf215546Sopenharmony_ci 1559bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1560bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1561bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1562bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1563bf215546Sopenharmony_ci} ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT; 1564bf215546Sopenharmony_ci 1565bf215546Sopenharmony_ci/** 1566bf215546Sopenharmony_ci**************************************************************************************************** 1567bf215546Sopenharmony_ci* ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT 1568bf215546Sopenharmony_ci* 1569bf215546Sopenharmony_ci* @brief 1570bf215546Sopenharmony_ci* Output structure of AddrExtractBankPipeSwizzle 1571bf215546Sopenharmony_ci**************************************************************************************************** 1572bf215546Sopenharmony_ci*/ 1573bf215546Sopenharmony_citypedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT 1574bf215546Sopenharmony_ci{ 1575bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1576bf215546Sopenharmony_ci 1577bf215546Sopenharmony_ci UINT_32 bankSwizzle; ///< Bank swizzle 1578bf215546Sopenharmony_ci UINT_32 pipeSwizzle; ///< Pipe swizzle 1579bf215546Sopenharmony_ci} ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT; 1580bf215546Sopenharmony_ci 1581bf215546Sopenharmony_ci/** 1582bf215546Sopenharmony_ci**************************************************************************************************** 1583bf215546Sopenharmony_ci* AddrExtractBankPipeSwizzle 1584bf215546Sopenharmony_ci* 1585bf215546Sopenharmony_ci* @brief 1586bf215546Sopenharmony_ci* Extract Bank and Pipe swizzle from base256b 1587bf215546Sopenharmony_ci* @return 1588bf215546Sopenharmony_ci* ADDR_OK if no error 1589bf215546Sopenharmony_ci**************************************************************************************************** 1590bf215546Sopenharmony_ci*/ 1591bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrExtractBankPipeSwizzle( 1592bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1593bf215546Sopenharmony_ci const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn, 1594bf215546Sopenharmony_ci ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut); 1595bf215546Sopenharmony_ci 1596bf215546Sopenharmony_ci 1597bf215546Sopenharmony_ci/** 1598bf215546Sopenharmony_ci**************************************************************************************************** 1599bf215546Sopenharmony_ci* ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT 1600bf215546Sopenharmony_ci* 1601bf215546Sopenharmony_ci* @brief 1602bf215546Sopenharmony_ci* Input structure of AddrCombineBankPipeSwizzle 1603bf215546Sopenharmony_ci**************************************************************************************************** 1604bf215546Sopenharmony_ci*/ 1605bf215546Sopenharmony_citypedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT 1606bf215546Sopenharmony_ci{ 1607bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1608bf215546Sopenharmony_ci 1609bf215546Sopenharmony_ci UINT_32 bankSwizzle; ///< Bank swizzle 1610bf215546Sopenharmony_ci UINT_32 pipeSwizzle; ///< Pipe swizzle 1611bf215546Sopenharmony_ci UINT_64 baseAddr; ///< Base address (leave it zero for driver clients) 1612bf215546Sopenharmony_ci 1613bf215546Sopenharmony_ci /// r800 and later HWL parameters 1614bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 1615bf215546Sopenharmony_ci 1616bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1617bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1618bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1619bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1620bf215546Sopenharmony_ci} ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT; 1621bf215546Sopenharmony_ci 1622bf215546Sopenharmony_ci/** 1623bf215546Sopenharmony_ci**************************************************************************************************** 1624bf215546Sopenharmony_ci* ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT 1625bf215546Sopenharmony_ci* 1626bf215546Sopenharmony_ci* @brief 1627bf215546Sopenharmony_ci* Output structure of AddrCombineBankPipeSwizzle 1628bf215546Sopenharmony_ci**************************************************************************************************** 1629bf215546Sopenharmony_ci*/ 1630bf215546Sopenharmony_citypedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT 1631bf215546Sopenharmony_ci{ 1632bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1633bf215546Sopenharmony_ci 1634bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Combined swizzle 1635bf215546Sopenharmony_ci} ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT; 1636bf215546Sopenharmony_ci 1637bf215546Sopenharmony_ci/** 1638bf215546Sopenharmony_ci**************************************************************************************************** 1639bf215546Sopenharmony_ci* AddrCombineBankPipeSwizzle 1640bf215546Sopenharmony_ci* 1641bf215546Sopenharmony_ci* @brief 1642bf215546Sopenharmony_ci* Combine Bank and Pipe swizzle 1643bf215546Sopenharmony_ci* @return 1644bf215546Sopenharmony_ci* ADDR_OK if no error 1645bf215546Sopenharmony_ci* @note 1646bf215546Sopenharmony_ci* baseAddr here is full MCAddress instead of base256b 1647bf215546Sopenharmony_ci**************************************************************************************************** 1648bf215546Sopenharmony_ci*/ 1649bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrCombineBankPipeSwizzle( 1650bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1651bf215546Sopenharmony_ci const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT* pIn, 1652bf215546Sopenharmony_ci ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT* pOut); 1653bf215546Sopenharmony_ci 1654bf215546Sopenharmony_ci 1655bf215546Sopenharmony_ci 1656bf215546Sopenharmony_ci/** 1657bf215546Sopenharmony_ci**************************************************************************************************** 1658bf215546Sopenharmony_ci* ADDR_COMPUTE_SLICESWIZZLE_INPUT 1659bf215546Sopenharmony_ci* 1660bf215546Sopenharmony_ci* @brief 1661bf215546Sopenharmony_ci* Input structure of AddrComputeSliceSwizzle 1662bf215546Sopenharmony_ci**************************************************************************************************** 1663bf215546Sopenharmony_ci*/ 1664bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_SLICESWIZZLE_INPUT 1665bf215546Sopenharmony_ci{ 1666bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1667bf215546Sopenharmony_ci 1668bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile Mode 1669bf215546Sopenharmony_ci UINT_32 baseSwizzle; ///< Base tile swizzle 1670bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 1671bf215546Sopenharmony_ci UINT_64 baseAddr; ///< Base address, driver should leave it 0 in most cases 1672bf215546Sopenharmony_ci 1673bf215546Sopenharmony_ci /// r800 and later HWL parameters 1674bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Actually banks needed here! 1675bf215546Sopenharmony_ci 1676bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1677bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1678bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1679bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1680bf215546Sopenharmony_ci} ADDR_COMPUTE_SLICESWIZZLE_INPUT; 1681bf215546Sopenharmony_ci 1682bf215546Sopenharmony_ci 1683bf215546Sopenharmony_ci 1684bf215546Sopenharmony_ci/** 1685bf215546Sopenharmony_ci**************************************************************************************************** 1686bf215546Sopenharmony_ci* ADDR_COMPUTE_SLICESWIZZLE_OUTPUT 1687bf215546Sopenharmony_ci* 1688bf215546Sopenharmony_ci* @brief 1689bf215546Sopenharmony_ci* Output structure of AddrComputeSliceSwizzle 1690bf215546Sopenharmony_ci**************************************************************************************************** 1691bf215546Sopenharmony_ci*/ 1692bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_SLICESWIZZLE_OUTPUT 1693bf215546Sopenharmony_ci{ 1694bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1695bf215546Sopenharmony_ci 1696bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Recalculated tileSwizzle value 1697bf215546Sopenharmony_ci} ADDR_COMPUTE_SLICESWIZZLE_OUTPUT; 1698bf215546Sopenharmony_ci 1699bf215546Sopenharmony_ci/** 1700bf215546Sopenharmony_ci**************************************************************************************************** 1701bf215546Sopenharmony_ci* AddrComputeSliceSwizzle 1702bf215546Sopenharmony_ci* 1703bf215546Sopenharmony_ci* @brief 1704bf215546Sopenharmony_ci* Extract Bank and Pipe swizzle from base256b 1705bf215546Sopenharmony_ci* @return 1706bf215546Sopenharmony_ci* ADDR_OK if no error 1707bf215546Sopenharmony_ci**************************************************************************************************** 1708bf215546Sopenharmony_ci*/ 1709bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeSliceSwizzle( 1710bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1711bf215546Sopenharmony_ci const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn, 1712bf215546Sopenharmony_ci ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut); 1713bf215546Sopenharmony_ci 1714bf215546Sopenharmony_ci 1715bf215546Sopenharmony_ci/** 1716bf215546Sopenharmony_ci**************************************************************************************************** 1717bf215546Sopenharmony_ci* AddrSwizzleGenOption 1718bf215546Sopenharmony_ci* 1719bf215546Sopenharmony_ci* @brief 1720bf215546Sopenharmony_ci* Which swizzle generating options: legacy or linear 1721bf215546Sopenharmony_ci**************************************************************************************************** 1722bf215546Sopenharmony_ci*/ 1723bf215546Sopenharmony_citypedef enum _AddrSwizzleGenOption 1724bf215546Sopenharmony_ci{ 1725bf215546Sopenharmony_ci ADDR_SWIZZLE_GEN_DEFAULT = 0, ///< As is in client driver implemention for swizzle 1726bf215546Sopenharmony_ci ADDR_SWIZZLE_GEN_LINEAR = 1, ///< Using a linear increment of swizzle 1727bf215546Sopenharmony_ci} AddrSwizzleGenOption; 1728bf215546Sopenharmony_ci 1729bf215546Sopenharmony_ci/** 1730bf215546Sopenharmony_ci**************************************************************************************************** 1731bf215546Sopenharmony_ci* AddrSwizzleOption 1732bf215546Sopenharmony_ci* 1733bf215546Sopenharmony_ci* @brief 1734bf215546Sopenharmony_ci* Controls how swizzle is generated 1735bf215546Sopenharmony_ci**************************************************************************************************** 1736bf215546Sopenharmony_ci*/ 1737bf215546Sopenharmony_citypedef union _ADDR_SWIZZLE_OPTION 1738bf215546Sopenharmony_ci{ 1739bf215546Sopenharmony_ci struct 1740bf215546Sopenharmony_ci { 1741bf215546Sopenharmony_ci UINT_32 genOption : 1; ///< The way swizzle is generated, see AddrSwizzleGenOption 1742bf215546Sopenharmony_ci UINT_32 reduceBankBit : 1; ///< TRUE if we need reduce swizzle bits 1743bf215546Sopenharmony_ci UINT_32 reserved :30; ///< Reserved bits 1744bf215546Sopenharmony_ci }; 1745bf215546Sopenharmony_ci 1746bf215546Sopenharmony_ci UINT_32 value; 1747bf215546Sopenharmony_ci 1748bf215546Sopenharmony_ci} ADDR_SWIZZLE_OPTION; 1749bf215546Sopenharmony_ci 1750bf215546Sopenharmony_ci/** 1751bf215546Sopenharmony_ci**************************************************************************************************** 1752bf215546Sopenharmony_ci* ADDR_COMPUTE_BASE_SWIZZLE_INPUT 1753bf215546Sopenharmony_ci* 1754bf215546Sopenharmony_ci* @brief 1755bf215546Sopenharmony_ci* Input structure of AddrComputeBaseSwizzle 1756bf215546Sopenharmony_ci**************************************************************************************************** 1757bf215546Sopenharmony_ci*/ 1758bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_BASE_SWIZZLE_INPUT 1759bf215546Sopenharmony_ci{ 1760bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1761bf215546Sopenharmony_ci 1762bf215546Sopenharmony_ci ADDR_SWIZZLE_OPTION option; ///< Swizzle option 1763bf215546Sopenharmony_ci UINT_32 surfIndex; ///< Index of this surface type 1764bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile Mode 1765bf215546Sopenharmony_ci 1766bf215546Sopenharmony_ci /// r800 and later HWL parameters 1767bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Actually banks needed here! 1768bf215546Sopenharmony_ci 1769bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1770bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1771bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1772bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1773bf215546Sopenharmony_ci} ADDR_COMPUTE_BASE_SWIZZLE_INPUT; 1774bf215546Sopenharmony_ci 1775bf215546Sopenharmony_ci/** 1776bf215546Sopenharmony_ci**************************************************************************************************** 1777bf215546Sopenharmony_ci* ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT 1778bf215546Sopenharmony_ci* 1779bf215546Sopenharmony_ci* @brief 1780bf215546Sopenharmony_ci* Output structure of AddrComputeBaseSwizzle 1781bf215546Sopenharmony_ci**************************************************************************************************** 1782bf215546Sopenharmony_ci*/ 1783bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT 1784bf215546Sopenharmony_ci{ 1785bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1786bf215546Sopenharmony_ci 1787bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Combined swizzle 1788bf215546Sopenharmony_ci} ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT; 1789bf215546Sopenharmony_ci 1790bf215546Sopenharmony_ci/** 1791bf215546Sopenharmony_ci**************************************************************************************************** 1792bf215546Sopenharmony_ci* AddrComputeBaseSwizzle 1793bf215546Sopenharmony_ci* 1794bf215546Sopenharmony_ci* @brief 1795bf215546Sopenharmony_ci* Return a Combined Bank and Pipe swizzle base on surface based on surface type/index 1796bf215546Sopenharmony_ci* @return 1797bf215546Sopenharmony_ci* ADDR_OK if no error 1798bf215546Sopenharmony_ci**************************************************************************************************** 1799bf215546Sopenharmony_ci*/ 1800bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeBaseSwizzle( 1801bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1802bf215546Sopenharmony_ci const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn, 1803bf215546Sopenharmony_ci ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut); 1804bf215546Sopenharmony_ci 1805bf215546Sopenharmony_ci 1806bf215546Sopenharmony_ci 1807bf215546Sopenharmony_ci/** 1808bf215546Sopenharmony_ci**************************************************************************************************** 1809bf215546Sopenharmony_ci* ELEM_GETEXPORTNORM_INPUT 1810bf215546Sopenharmony_ci* 1811bf215546Sopenharmony_ci* @brief 1812bf215546Sopenharmony_ci* Input structure for ElemGetExportNorm 1813bf215546Sopenharmony_ci* 1814bf215546Sopenharmony_ci**************************************************************************************************** 1815bf215546Sopenharmony_ci*/ 1816bf215546Sopenharmony_citypedef struct _ELEM_GETEXPORTNORM_INPUT 1817bf215546Sopenharmony_ci{ 1818bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1819bf215546Sopenharmony_ci 1820bf215546Sopenharmony_ci AddrColorFormat format; ///< Color buffer format; Client should use ColorFormat 1821bf215546Sopenharmony_ci AddrSurfaceNumber num; ///< Surface number type; Client should use NumberType 1822bf215546Sopenharmony_ci AddrSurfaceSwap swap; ///< Surface swap byte swap; Client should use SurfaceSwap 1823bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 1824bf215546Sopenharmony_ci} ELEM_GETEXPORTNORM_INPUT; 1825bf215546Sopenharmony_ci 1826bf215546Sopenharmony_ci/** 1827bf215546Sopenharmony_ci**************************************************************************************************** 1828bf215546Sopenharmony_ci* ElemGetExportNorm 1829bf215546Sopenharmony_ci* 1830bf215546Sopenharmony_ci* @brief 1831bf215546Sopenharmony_ci* Helper function to check one format can be EXPORT_NUM, which is a register 1832bf215546Sopenharmony_ci* CB_COLOR_INFO.SURFACE_FORMAT. FP16 can be reported as EXPORT_NORM for rv770 in r600 1833bf215546Sopenharmony_ci* family 1834bf215546Sopenharmony_ci* @note 1835bf215546Sopenharmony_ci* The implementation is only for r600. 1836bf215546Sopenharmony_ci* 00 - EXPORT_FULL: PS exports are 4 pixels with 4 components with 32-bits-per-component. (two 1837bf215546Sopenharmony_ci* clocks per export) 1838bf215546Sopenharmony_ci* 01 - EXPORT_NORM: PS exports are 4 pixels with 4 components with 16-bits-per-component. (one 1839bf215546Sopenharmony_ci* clock per export) 1840bf215546Sopenharmony_ci* 1841bf215546Sopenharmony_ci**************************************************************************************************** 1842bf215546Sopenharmony_ci*/ 1843bf215546Sopenharmony_ciBOOL_32 ADDR_API ElemGetExportNorm( 1844bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1845bf215546Sopenharmony_ci const ELEM_GETEXPORTNORM_INPUT* pIn); 1846bf215546Sopenharmony_ci 1847bf215546Sopenharmony_ci 1848bf215546Sopenharmony_ci 1849bf215546Sopenharmony_ci/** 1850bf215546Sopenharmony_ci**************************************************************************************************** 1851bf215546Sopenharmony_ci* ELEM_FLT32TODEPTHPIXEL_INPUT 1852bf215546Sopenharmony_ci* 1853bf215546Sopenharmony_ci* @brief 1854bf215546Sopenharmony_ci* Input structure for addrFlt32ToDepthPixel 1855bf215546Sopenharmony_ci* 1856bf215546Sopenharmony_ci**************************************************************************************************** 1857bf215546Sopenharmony_ci*/ 1858bf215546Sopenharmony_citypedef struct _ELEM_FLT32TODEPTHPIXEL_INPUT 1859bf215546Sopenharmony_ci{ 1860bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1861bf215546Sopenharmony_ci 1862bf215546Sopenharmony_ci AddrDepthFormat format; ///< Depth buffer format 1863bf215546Sopenharmony_ci ADDR_FLT_32 comps[2]; ///< Component values (Z/stencil) 1864bf215546Sopenharmony_ci} ELEM_FLT32TODEPTHPIXEL_INPUT; 1865bf215546Sopenharmony_ci 1866bf215546Sopenharmony_ci/** 1867bf215546Sopenharmony_ci**************************************************************************************************** 1868bf215546Sopenharmony_ci* ELEM_FLT32TODEPTHPIXEL_INPUT 1869bf215546Sopenharmony_ci* 1870bf215546Sopenharmony_ci* @brief 1871bf215546Sopenharmony_ci* Output structure for ElemFlt32ToDepthPixel 1872bf215546Sopenharmony_ci* 1873bf215546Sopenharmony_ci**************************************************************************************************** 1874bf215546Sopenharmony_ci*/ 1875bf215546Sopenharmony_citypedef struct _ELEM_FLT32TODEPTHPIXEL_OUTPUT 1876bf215546Sopenharmony_ci{ 1877bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1878bf215546Sopenharmony_ci 1879bf215546Sopenharmony_ci UINT_8* pPixel; ///< Real depth value. Same data type as depth buffer. 1880bf215546Sopenharmony_ci /// Client must provide enough storage for this type. 1881bf215546Sopenharmony_ci UINT_32 depthBase; ///< Tile base in bits for depth bits 1882bf215546Sopenharmony_ci UINT_32 stencilBase; ///< Tile base in bits for stencil bits 1883bf215546Sopenharmony_ci UINT_32 depthBits; ///< Bits for depth 1884bf215546Sopenharmony_ci UINT_32 stencilBits; ///< Bits for stencil 1885bf215546Sopenharmony_ci} ELEM_FLT32TODEPTHPIXEL_OUTPUT; 1886bf215546Sopenharmony_ci 1887bf215546Sopenharmony_ci/** 1888bf215546Sopenharmony_ci**************************************************************************************************** 1889bf215546Sopenharmony_ci* ElemFlt32ToDepthPixel 1890bf215546Sopenharmony_ci* 1891bf215546Sopenharmony_ci* @brief 1892bf215546Sopenharmony_ci* Convert a FLT_32 value to a depth/stencil pixel value 1893bf215546Sopenharmony_ci* 1894bf215546Sopenharmony_ci* @return 1895bf215546Sopenharmony_ci* Return code 1896bf215546Sopenharmony_ci* 1897bf215546Sopenharmony_ci**************************************************************************************************** 1898bf215546Sopenharmony_ci*/ 1899bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API ElemFlt32ToDepthPixel( 1900bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1901bf215546Sopenharmony_ci const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn, 1902bf215546Sopenharmony_ci ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut); 1903bf215546Sopenharmony_ci 1904bf215546Sopenharmony_ci 1905bf215546Sopenharmony_ci 1906bf215546Sopenharmony_ci/** 1907bf215546Sopenharmony_ci**************************************************************************************************** 1908bf215546Sopenharmony_ci* ELEM_FLT32TOCOLORPIXEL_INPUT 1909bf215546Sopenharmony_ci* 1910bf215546Sopenharmony_ci* @brief 1911bf215546Sopenharmony_ci* Input structure for addrFlt32ToColorPixel 1912bf215546Sopenharmony_ci* 1913bf215546Sopenharmony_ci**************************************************************************************************** 1914bf215546Sopenharmony_ci*/ 1915bf215546Sopenharmony_citypedef struct _ELEM_FLT32TOCOLORPIXEL_INPUT 1916bf215546Sopenharmony_ci{ 1917bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1918bf215546Sopenharmony_ci 1919bf215546Sopenharmony_ci AddrColorFormat format; ///< Color buffer format 1920bf215546Sopenharmony_ci AddrSurfaceNumber surfNum; ///< Surface number 1921bf215546Sopenharmony_ci AddrSurfaceSwap surfSwap; ///< Surface swap 1922bf215546Sopenharmony_ci ADDR_FLT_32 comps[4]; ///< Component values (r/g/b/a) 1923bf215546Sopenharmony_ci} ELEM_FLT32TOCOLORPIXEL_INPUT; 1924bf215546Sopenharmony_ci 1925bf215546Sopenharmony_ci/** 1926bf215546Sopenharmony_ci**************************************************************************************************** 1927bf215546Sopenharmony_ci* ELEM_FLT32TOCOLORPIXEL_INPUT 1928bf215546Sopenharmony_ci* 1929bf215546Sopenharmony_ci* @brief 1930bf215546Sopenharmony_ci* Output structure for ElemFlt32ToColorPixel 1931bf215546Sopenharmony_ci* 1932bf215546Sopenharmony_ci**************************************************************************************************** 1933bf215546Sopenharmony_ci*/ 1934bf215546Sopenharmony_citypedef struct _ELEM_FLT32TOCOLORPIXEL_OUTPUT 1935bf215546Sopenharmony_ci{ 1936bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1937bf215546Sopenharmony_ci 1938bf215546Sopenharmony_ci UINT_8* pPixel; ///< Real color value. Same data type as color buffer. 1939bf215546Sopenharmony_ci /// Client must provide enough storage for this type. 1940bf215546Sopenharmony_ci} ELEM_FLT32TOCOLORPIXEL_OUTPUT; 1941bf215546Sopenharmony_ci 1942bf215546Sopenharmony_ci/** 1943bf215546Sopenharmony_ci**************************************************************************************************** 1944bf215546Sopenharmony_ci* ElemFlt32ToColorPixel 1945bf215546Sopenharmony_ci* 1946bf215546Sopenharmony_ci* @brief 1947bf215546Sopenharmony_ci* Convert a FLT_32 value to a red/green/blue/alpha pixel value 1948bf215546Sopenharmony_ci* 1949bf215546Sopenharmony_ci* @return 1950bf215546Sopenharmony_ci* Return code 1951bf215546Sopenharmony_ci* 1952bf215546Sopenharmony_ci**************************************************************************************************** 1953bf215546Sopenharmony_ci*/ 1954bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API ElemFlt32ToColorPixel( 1955bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1956bf215546Sopenharmony_ci const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn, 1957bf215546Sopenharmony_ci ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut); 1958bf215546Sopenharmony_ci 1959bf215546Sopenharmony_ci/** 1960bf215546Sopenharmony_ci**************************************************************************************************** 1961bf215546Sopenharmony_ci* ElemSize 1962bf215546Sopenharmony_ci* 1963bf215546Sopenharmony_ci* @brief 1964bf215546Sopenharmony_ci* Get bits-per-element for specified format 1965bf215546Sopenharmony_ci* 1966bf215546Sopenharmony_ci* @return 1967bf215546Sopenharmony_ci* Bits-per-element of specified format 1968bf215546Sopenharmony_ci* 1969bf215546Sopenharmony_ci**************************************************************************************************** 1970bf215546Sopenharmony_ci*/ 1971bf215546Sopenharmony_ciUINT_32 ADDR_API ElemSize( 1972bf215546Sopenharmony_ci ADDR_HANDLE hLib, 1973bf215546Sopenharmony_ci AddrFormat format); 1974bf215546Sopenharmony_ci 1975bf215546Sopenharmony_ci/** 1976bf215546Sopenharmony_ci**************************************************************************************************** 1977bf215546Sopenharmony_ci* ADDR_CONVERT_TILEINFOTOHW_INPUT 1978bf215546Sopenharmony_ci* 1979bf215546Sopenharmony_ci* @brief 1980bf215546Sopenharmony_ci* Input structure for AddrConvertTileInfoToHW 1981bf215546Sopenharmony_ci* @note 1982bf215546Sopenharmony_ci* When reverse is TRUE, indices are igonred 1983bf215546Sopenharmony_ci**************************************************************************************************** 1984bf215546Sopenharmony_ci*/ 1985bf215546Sopenharmony_citypedef struct _ADDR_CONVERT_TILEINFOTOHW_INPUT 1986bf215546Sopenharmony_ci{ 1987bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 1988bf215546Sopenharmony_ci BOOL_32 reverse; ///< Convert control flag. 1989bf215546Sopenharmony_ci /// FALSE: convert from real value to HW value; 1990bf215546Sopenharmony_ci /// TRUE: convert from HW value to real value. 1991bf215546Sopenharmony_ci 1992bf215546Sopenharmony_ci /// r800 and later HWL parameters 1993bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile parameters with real value 1994bf215546Sopenharmony_ci 1995bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1996bf215546Sopenharmony_ci /// while the global useTileIndex is set to 1 1997bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1998bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 1999bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 2000bf215546Sopenharmony_ci} ADDR_CONVERT_TILEINFOTOHW_INPUT; 2001bf215546Sopenharmony_ci 2002bf215546Sopenharmony_ci/** 2003bf215546Sopenharmony_ci**************************************************************************************************** 2004bf215546Sopenharmony_ci* ADDR_CONVERT_TILEINFOTOHW_OUTPUT 2005bf215546Sopenharmony_ci* 2006bf215546Sopenharmony_ci* @brief 2007bf215546Sopenharmony_ci* Output structure for AddrConvertTileInfoToHW 2008bf215546Sopenharmony_ci**************************************************************************************************** 2009bf215546Sopenharmony_ci*/ 2010bf215546Sopenharmony_citypedef struct _ADDR_CONVERT_TILEINFOTOHW_OUTPUT 2011bf215546Sopenharmony_ci{ 2012bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2013bf215546Sopenharmony_ci 2014bf215546Sopenharmony_ci /// r800 and later HWL parameters 2015bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile parameters with hardware register value 2016bf215546Sopenharmony_ci 2017bf215546Sopenharmony_ci} ADDR_CONVERT_TILEINFOTOHW_OUTPUT; 2018bf215546Sopenharmony_ci 2019bf215546Sopenharmony_ci/** 2020bf215546Sopenharmony_ci**************************************************************************************************** 2021bf215546Sopenharmony_ci* AddrConvertTileInfoToHW 2022bf215546Sopenharmony_ci* 2023bf215546Sopenharmony_ci* @brief 2024bf215546Sopenharmony_ci* Convert tile info from real value to hardware register value 2025bf215546Sopenharmony_ci**************************************************************************************************** 2026bf215546Sopenharmony_ci*/ 2027bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrConvertTileInfoToHW( 2028bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2029bf215546Sopenharmony_ci const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, 2030bf215546Sopenharmony_ci ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut); 2031bf215546Sopenharmony_ci 2032bf215546Sopenharmony_ci 2033bf215546Sopenharmony_ci 2034bf215546Sopenharmony_ci/** 2035bf215546Sopenharmony_ci**************************************************************************************************** 2036bf215546Sopenharmony_ci* ADDR_CONVERT_TILEINDEX_INPUT 2037bf215546Sopenharmony_ci* 2038bf215546Sopenharmony_ci* @brief 2039bf215546Sopenharmony_ci* Input structure for AddrConvertTileIndex 2040bf215546Sopenharmony_ci**************************************************************************************************** 2041bf215546Sopenharmony_ci*/ 2042bf215546Sopenharmony_citypedef struct _ADDR_CONVERT_TILEINDEX_INPUT 2043bf215546Sopenharmony_ci{ 2044bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2045bf215546Sopenharmony_ci 2046bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index 2047bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 2048bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 2049bf215546Sopenharmony_ci BOOL_32 tileInfoHw; ///< Set to TRUE if client wants HW enum, otherwise actual 2050bf215546Sopenharmony_ci} ADDR_CONVERT_TILEINDEX_INPUT; 2051bf215546Sopenharmony_ci 2052bf215546Sopenharmony_ci/** 2053bf215546Sopenharmony_ci**************************************************************************************************** 2054bf215546Sopenharmony_ci* ADDR_CONVERT_TILEINDEX_OUTPUT 2055bf215546Sopenharmony_ci* 2056bf215546Sopenharmony_ci* @brief 2057bf215546Sopenharmony_ci* Output structure for AddrConvertTileIndex 2058bf215546Sopenharmony_ci**************************************************************************************************** 2059bf215546Sopenharmony_ci*/ 2060bf215546Sopenharmony_citypedef struct _ADDR_CONVERT_TILEINDEX_OUTPUT 2061bf215546Sopenharmony_ci{ 2062bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2063bf215546Sopenharmony_ci 2064bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode 2065bf215546Sopenharmony_ci AddrTileType tileType; ///< Tile type 2066bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Tile info 2067bf215546Sopenharmony_ci 2068bf215546Sopenharmony_ci} ADDR_CONVERT_TILEINDEX_OUTPUT; 2069bf215546Sopenharmony_ci 2070bf215546Sopenharmony_ci/** 2071bf215546Sopenharmony_ci**************************************************************************************************** 2072bf215546Sopenharmony_ci* AddrConvertTileIndex 2073bf215546Sopenharmony_ci* 2074bf215546Sopenharmony_ci* @brief 2075bf215546Sopenharmony_ci* Convert tile index to tile mode/type/info 2076bf215546Sopenharmony_ci**************************************************************************************************** 2077bf215546Sopenharmony_ci*/ 2078bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex( 2079bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2080bf215546Sopenharmony_ci const ADDR_CONVERT_TILEINDEX_INPUT* pIn, 2081bf215546Sopenharmony_ci ADDR_CONVERT_TILEINDEX_OUTPUT* pOut); 2082bf215546Sopenharmony_ci 2083bf215546Sopenharmony_ci/** 2084bf215546Sopenharmony_ci**************************************************************************************************** 2085bf215546Sopenharmony_ci* ADDR_GET_MACROMODEINDEX_INPUT 2086bf215546Sopenharmony_ci* 2087bf215546Sopenharmony_ci* @brief 2088bf215546Sopenharmony_ci* Input structure for AddrGetMacroModeIndex 2089bf215546Sopenharmony_ci**************************************************************************************************** 2090bf215546Sopenharmony_ci*/ 2091bf215546Sopenharmony_citypedef struct _ADDR_GET_MACROMODEINDEX_INPUT 2092bf215546Sopenharmony_ci{ 2093bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2094bf215546Sopenharmony_ci ADDR_SURFACE_FLAGS flags; ///< Surface flag 2095bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index 2096bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 2097bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of color fragments 2098bf215546Sopenharmony_ci} ADDR_GET_MACROMODEINDEX_INPUT; 2099bf215546Sopenharmony_ci 2100bf215546Sopenharmony_ci/** 2101bf215546Sopenharmony_ci**************************************************************************************************** 2102bf215546Sopenharmony_ci* ADDR_GET_MACROMODEINDEX_OUTPUT 2103bf215546Sopenharmony_ci* 2104bf215546Sopenharmony_ci* @brief 2105bf215546Sopenharmony_ci* Output structure for AddrGetMacroModeIndex 2106bf215546Sopenharmony_ci**************************************************************************************************** 2107bf215546Sopenharmony_ci*/ 2108bf215546Sopenharmony_citypedef struct _ADDR_GET_MACROMODEINDEX_OUTPUT 2109bf215546Sopenharmony_ci{ 2110bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2111bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 2112bf215546Sopenharmony_ci} ADDR_GET_MACROMODEINDEX_OUTPUT; 2113bf215546Sopenharmony_ci 2114bf215546Sopenharmony_ci/** 2115bf215546Sopenharmony_ci**************************************************************************************************** 2116bf215546Sopenharmony_ci* AddrGetMacroModeIndex 2117bf215546Sopenharmony_ci* 2118bf215546Sopenharmony_ci* @brief 2119bf215546Sopenharmony_ci* Get macro mode index based on input parameters 2120bf215546Sopenharmony_ci**************************************************************************************************** 2121bf215546Sopenharmony_ci*/ 2122bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrGetMacroModeIndex( 2123bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2124bf215546Sopenharmony_ci const ADDR_GET_MACROMODEINDEX_INPUT* pIn, 2125bf215546Sopenharmony_ci ADDR_GET_MACROMODEINDEX_OUTPUT* pOut); 2126bf215546Sopenharmony_ci 2127bf215546Sopenharmony_ci/** 2128bf215546Sopenharmony_ci**************************************************************************************************** 2129bf215546Sopenharmony_ci* ADDR_CONVERT_TILEINDEX1_INPUT 2130bf215546Sopenharmony_ci* 2131bf215546Sopenharmony_ci* @brief 2132bf215546Sopenharmony_ci* Input structure for AddrConvertTileIndex1 (without macro mode index) 2133bf215546Sopenharmony_ci**************************************************************************************************** 2134bf215546Sopenharmony_ci*/ 2135bf215546Sopenharmony_citypedef struct _ADDR_CONVERT_TILEINDEX1_INPUT 2136bf215546Sopenharmony_ci{ 2137bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2138bf215546Sopenharmony_ci 2139bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index 2140bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 2141bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 2142bf215546Sopenharmony_ci BOOL_32 tileInfoHw; ///< Set to TRUE if client wants HW enum, otherwise actual 2143bf215546Sopenharmony_ci} ADDR_CONVERT_TILEINDEX1_INPUT; 2144bf215546Sopenharmony_ci 2145bf215546Sopenharmony_ci/** 2146bf215546Sopenharmony_ci**************************************************************************************************** 2147bf215546Sopenharmony_ci* AddrConvertTileIndex1 2148bf215546Sopenharmony_ci* 2149bf215546Sopenharmony_ci* @brief 2150bf215546Sopenharmony_ci* Convert tile index to tile mode/type/info 2151bf215546Sopenharmony_ci**************************************************************************************************** 2152bf215546Sopenharmony_ci*/ 2153bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex1( 2154bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2155bf215546Sopenharmony_ci const ADDR_CONVERT_TILEINDEX1_INPUT* pIn, 2156bf215546Sopenharmony_ci ADDR_CONVERT_TILEINDEX_OUTPUT* pOut); 2157bf215546Sopenharmony_ci 2158bf215546Sopenharmony_ci 2159bf215546Sopenharmony_ci 2160bf215546Sopenharmony_ci/** 2161bf215546Sopenharmony_ci**************************************************************************************************** 2162bf215546Sopenharmony_ci* ADDR_GET_TILEINDEX_INPUT 2163bf215546Sopenharmony_ci* 2164bf215546Sopenharmony_ci* @brief 2165bf215546Sopenharmony_ci* Input structure for AddrGetTileIndex 2166bf215546Sopenharmony_ci**************************************************************************************************** 2167bf215546Sopenharmony_ci*/ 2168bf215546Sopenharmony_citypedef struct _ADDR_GET_TILEINDEX_INPUT 2169bf215546Sopenharmony_ci{ 2170bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2171bf215546Sopenharmony_ci 2172bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode 2173bf215546Sopenharmony_ci AddrTileType tileType; ///< Tile-type: disp/non-disp/... 2174bf215546Sopenharmony_ci ADDR_TILEINFO* pTileInfo; ///< Pointer to tile-info structure, can be NULL for linear/1D 2175bf215546Sopenharmony_ci} ADDR_GET_TILEINDEX_INPUT; 2176bf215546Sopenharmony_ci 2177bf215546Sopenharmony_ci/** 2178bf215546Sopenharmony_ci**************************************************************************************************** 2179bf215546Sopenharmony_ci* ADDR_GET_TILEINDEX_OUTPUT 2180bf215546Sopenharmony_ci* 2181bf215546Sopenharmony_ci* @brief 2182bf215546Sopenharmony_ci* Output structure for AddrGetTileIndex 2183bf215546Sopenharmony_ci**************************************************************************************************** 2184bf215546Sopenharmony_ci*/ 2185bf215546Sopenharmony_citypedef struct _ADDR_GET_TILEINDEX_OUTPUT 2186bf215546Sopenharmony_ci{ 2187bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2188bf215546Sopenharmony_ci 2189bf215546Sopenharmony_ci INT_32 index; ///< index in table 2190bf215546Sopenharmony_ci} ADDR_GET_TILEINDEX_OUTPUT; 2191bf215546Sopenharmony_ci 2192bf215546Sopenharmony_ci/** 2193bf215546Sopenharmony_ci**************************************************************************************************** 2194bf215546Sopenharmony_ci* AddrGetTileIndex 2195bf215546Sopenharmony_ci* 2196bf215546Sopenharmony_ci* @brief 2197bf215546Sopenharmony_ci* Get the tiling mode index in table 2198bf215546Sopenharmony_ci**************************************************************************************************** 2199bf215546Sopenharmony_ci*/ 2200bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrGetTileIndex( 2201bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2202bf215546Sopenharmony_ci const ADDR_GET_TILEINDEX_INPUT* pIn, 2203bf215546Sopenharmony_ci ADDR_GET_TILEINDEX_OUTPUT* pOut); 2204bf215546Sopenharmony_ci 2205bf215546Sopenharmony_ci 2206bf215546Sopenharmony_ci 2207bf215546Sopenharmony_ci/** 2208bf215546Sopenharmony_ci**************************************************************************************************** 2209bf215546Sopenharmony_ci* ADDR_PRT_INFO_INPUT 2210bf215546Sopenharmony_ci* 2211bf215546Sopenharmony_ci* @brief 2212bf215546Sopenharmony_ci* Input structure for AddrComputePrtInfo 2213bf215546Sopenharmony_ci**************************************************************************************************** 2214bf215546Sopenharmony_ci*/ 2215bf215546Sopenharmony_citypedef struct _ADDR_PRT_INFO_INPUT 2216bf215546Sopenharmony_ci{ 2217bf215546Sopenharmony_ci AddrFormat format; ///< Surface format 2218bf215546Sopenharmony_ci UINT_32 baseMipWidth; ///< Base mipmap width 2219bf215546Sopenharmony_ci UINT_32 baseMipHeight; ///< Base mipmap height 2220bf215546Sopenharmony_ci UINT_32 baseMipDepth; ///< Base mipmap depth 2221bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, 2222bf215546Sopenharmony_ci} ADDR_PRT_INFO_INPUT; 2223bf215546Sopenharmony_ci 2224bf215546Sopenharmony_ci/** 2225bf215546Sopenharmony_ci**************************************************************************************************** 2226bf215546Sopenharmony_ci* ADDR_PRT_INFO_OUTPUT 2227bf215546Sopenharmony_ci* 2228bf215546Sopenharmony_ci* @brief 2229bf215546Sopenharmony_ci* Input structure for AddrComputePrtInfo 2230bf215546Sopenharmony_ci**************************************************************************************************** 2231bf215546Sopenharmony_ci*/ 2232bf215546Sopenharmony_citypedef struct _ADDR_PRT_INFO_OUTPUT 2233bf215546Sopenharmony_ci{ 2234bf215546Sopenharmony_ci UINT_32 prtTileWidth; 2235bf215546Sopenharmony_ci UINT_32 prtTileHeight; 2236bf215546Sopenharmony_ci} ADDR_PRT_INFO_OUTPUT; 2237bf215546Sopenharmony_ci 2238bf215546Sopenharmony_ci/** 2239bf215546Sopenharmony_ci**************************************************************************************************** 2240bf215546Sopenharmony_ci* AddrComputePrtInfo 2241bf215546Sopenharmony_ci* 2242bf215546Sopenharmony_ci* @brief 2243bf215546Sopenharmony_ci* Compute prt surface related information 2244bf215546Sopenharmony_ci**************************************************************************************************** 2245bf215546Sopenharmony_ci*/ 2246bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputePrtInfo( 2247bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2248bf215546Sopenharmony_ci const ADDR_PRT_INFO_INPUT* pIn, 2249bf215546Sopenharmony_ci ADDR_PRT_INFO_OUTPUT* pOut); 2250bf215546Sopenharmony_ci 2251bf215546Sopenharmony_ci 2252bf215546Sopenharmony_ci 2253bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 2254bf215546Sopenharmony_ci// DCC key functions 2255bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 2256bf215546Sopenharmony_ci 2257bf215546Sopenharmony_ci/** 2258bf215546Sopenharmony_ci**************************************************************************************************** 2259bf215546Sopenharmony_ci* _ADDR_COMPUTE_DCCINFO_INPUT 2260bf215546Sopenharmony_ci* 2261bf215546Sopenharmony_ci* @brief 2262bf215546Sopenharmony_ci* Input structure of AddrComputeDccInfo 2263bf215546Sopenharmony_ci**************************************************************************************************** 2264bf215546Sopenharmony_ci*/ 2265bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_DCCINFO_INPUT 2266bf215546Sopenharmony_ci{ 2267bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2268bf215546Sopenharmony_ci UINT_32 bpp; ///< BitPP of color surface 2269bf215546Sopenharmony_ci UINT_32 numSamples; ///< Sample number of color surface 2270bf215546Sopenharmony_ci UINT_64 colorSurfSize; ///< Size of color surface to which dcc key is bound 2271bf215546Sopenharmony_ci AddrTileMode tileMode; ///< Tile mode of color surface 2272bf215546Sopenharmony_ci ADDR_TILEINFO tileInfo; ///< Tile info of color surface 2273bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Tile swizzle 2274bf215546Sopenharmony_ci INT_32 tileIndex; ///< Tile index of color surface, 2275bf215546Sopenharmony_ci ///< MUST be -1 if you don't want to use it 2276bf215546Sopenharmony_ci ///< while the global useTileIndex is set to 1 2277bf215546Sopenharmony_ci INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 2278bf215546Sopenharmony_ci ///< README: When tileIndex is not -1, this must be valid 2279bf215546Sopenharmony_ci} ADDR_COMPUTE_DCCINFO_INPUT; 2280bf215546Sopenharmony_ci 2281bf215546Sopenharmony_ci/** 2282bf215546Sopenharmony_ci**************************************************************************************************** 2283bf215546Sopenharmony_ci* ADDR_COMPUTE_DCCINFO_OUTPUT 2284bf215546Sopenharmony_ci* 2285bf215546Sopenharmony_ci* @brief 2286bf215546Sopenharmony_ci* Output structure of AddrComputeDccInfo 2287bf215546Sopenharmony_ci**************************************************************************************************** 2288bf215546Sopenharmony_ci*/ 2289bf215546Sopenharmony_citypedef struct _ADDR_COMPUTE_DCCINFO_OUTPUT 2290bf215546Sopenharmony_ci{ 2291bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2292bf215546Sopenharmony_ci UINT_32 dccRamBaseAlign; ///< Base alignment of dcc key 2293bf215546Sopenharmony_ci UINT_64 dccRamSize; ///< Size of dcc key 2294bf215546Sopenharmony_ci UINT_64 dccFastClearSize; ///< Size of dcc key portion that can be fast cleared 2295bf215546Sopenharmony_ci BOOL_32 subLvlCompressible; ///< Whether sub resource is compressiable 2296bf215546Sopenharmony_ci BOOL_32 dccRamSizeAligned; ///< Whether the dcc key size is aligned 2297bf215546Sopenharmony_ci} ADDR_COMPUTE_DCCINFO_OUTPUT; 2298bf215546Sopenharmony_ci 2299bf215546Sopenharmony_ci/** 2300bf215546Sopenharmony_ci**************************************************************************************************** 2301bf215546Sopenharmony_ci* AddrComputeDccInfo 2302bf215546Sopenharmony_ci* 2303bf215546Sopenharmony_ci* @brief 2304bf215546Sopenharmony_ci* Compute DCC key size, base alignment 2305bf215546Sopenharmony_ci* info 2306bf215546Sopenharmony_ci**************************************************************************************************** 2307bf215546Sopenharmony_ci*/ 2308bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrComputeDccInfo( 2309bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2310bf215546Sopenharmony_ci const ADDR_COMPUTE_DCCINFO_INPUT* pIn, 2311bf215546Sopenharmony_ci ADDR_COMPUTE_DCCINFO_OUTPUT* pOut); 2312bf215546Sopenharmony_ci 2313bf215546Sopenharmony_ci 2314bf215546Sopenharmony_ci 2315bf215546Sopenharmony_ci/** 2316bf215546Sopenharmony_ci**************************************************************************************************** 2317bf215546Sopenharmony_ci* ADDR_GET_MAX_ALIGNMENTS_OUTPUT 2318bf215546Sopenharmony_ci* 2319bf215546Sopenharmony_ci* @brief 2320bf215546Sopenharmony_ci* Output structure of AddrGetMaxAlignments 2321bf215546Sopenharmony_ci**************************************************************************************************** 2322bf215546Sopenharmony_ci*/ 2323bf215546Sopenharmony_citypedef struct ADDR_GET_MAX_ALINGMENTS_OUTPUT 2324bf215546Sopenharmony_ci{ 2325bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2326bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Maximum base alignment in bytes 2327bf215546Sopenharmony_ci} ADDR_GET_MAX_ALIGNMENTS_OUTPUT; 2328bf215546Sopenharmony_ci 2329bf215546Sopenharmony_ci/** 2330bf215546Sopenharmony_ci**************************************************************************************************** 2331bf215546Sopenharmony_ci* AddrGetMaxAlignments 2332bf215546Sopenharmony_ci* 2333bf215546Sopenharmony_ci* @brief 2334bf215546Sopenharmony_ci* Gets maximnum alignments 2335bf215546Sopenharmony_ci**************************************************************************************************** 2336bf215546Sopenharmony_ci*/ 2337bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrGetMaxAlignments( 2338bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2339bf215546Sopenharmony_ci ADDR_GET_MAX_ALIGNMENTS_OUTPUT* pOut); 2340bf215546Sopenharmony_ci 2341bf215546Sopenharmony_ci/** 2342bf215546Sopenharmony_ci**************************************************************************************************** 2343bf215546Sopenharmony_ci* AddrGetMaxMetaAlignments 2344bf215546Sopenharmony_ci* 2345bf215546Sopenharmony_ci* @brief 2346bf215546Sopenharmony_ci* Gets maximnum alignments for metadata 2347bf215546Sopenharmony_ci**************************************************************************************************** 2348bf215546Sopenharmony_ci*/ 2349bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API AddrGetMaxMetaAlignments( 2350bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2351bf215546Sopenharmony_ci ADDR_GET_MAX_ALIGNMENTS_OUTPUT* pOut); 2352bf215546Sopenharmony_ci 2353bf215546Sopenharmony_ci/** 2354bf215546Sopenharmony_ci**************************************************************************************************** 2355bf215546Sopenharmony_ci* Address library interface version 2 2356bf215546Sopenharmony_ci* available from Gfx9 hardware 2357bf215546Sopenharmony_ci**************************************************************************************************** 2358bf215546Sopenharmony_ci* Addr2ComputeSurfaceInfo() 2359bf215546Sopenharmony_ci* Addr2ComputeSurfaceAddrFromCoord() 2360bf215546Sopenharmony_ci* Addr2ComputeSurfaceCoordFromAddr() 2361bf215546Sopenharmony_ci 2362bf215546Sopenharmony_ci* Addr2ComputeHtileInfo() 2363bf215546Sopenharmony_ci* Addr2ComputeHtileAddrFromCoord() 2364bf215546Sopenharmony_ci* Addr2ComputeHtileCoordFromAddr() 2365bf215546Sopenharmony_ci* 2366bf215546Sopenharmony_ci* Addr2ComputeCmaskInfo() 2367bf215546Sopenharmony_ci* Addr2ComputeCmaskAddrFromCoord() 2368bf215546Sopenharmony_ci* Addr2ComputeCmaskCoordFromAddr() 2369bf215546Sopenharmony_ci* 2370bf215546Sopenharmony_ci* Addr2ComputeFmaskInfo() 2371bf215546Sopenharmony_ci* Addr2ComputeFmaskAddrFromCoord() 2372bf215546Sopenharmony_ci* Addr2ComputeFmaskCoordFromAddr() 2373bf215546Sopenharmony_ci* 2374bf215546Sopenharmony_ci* Addr2ComputeDccInfo() 2375bf215546Sopenharmony_ci* 2376bf215546Sopenharmony_ci**/ 2377bf215546Sopenharmony_ci 2378bf215546Sopenharmony_ci 2379bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 2380bf215546Sopenharmony_ci// Surface functions for Gfx9 2381bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 2382bf215546Sopenharmony_ci 2383bf215546Sopenharmony_ci/** 2384bf215546Sopenharmony_ci**************************************************************************************************** 2385bf215546Sopenharmony_ci* ADDR2_SURFACE_FLAGS 2386bf215546Sopenharmony_ci* 2387bf215546Sopenharmony_ci* @brief 2388bf215546Sopenharmony_ci* Surface flags 2389bf215546Sopenharmony_ci**************************************************************************************************** 2390bf215546Sopenharmony_ci*/ 2391bf215546Sopenharmony_citypedef union _ADDR2_SURFACE_FLAGS 2392bf215546Sopenharmony_ci{ 2393bf215546Sopenharmony_ci struct 2394bf215546Sopenharmony_ci { 2395bf215546Sopenharmony_ci UINT_32 color : 1; ///< This resource is a color buffer, can be used with RTV 2396bf215546Sopenharmony_ci UINT_32 depth : 1; ///< Thie resource is a depth buffer, can be used with DSV 2397bf215546Sopenharmony_ci UINT_32 stencil : 1; ///< Thie resource is a stencil buffer, can be used with DSV 2398bf215546Sopenharmony_ci UINT_32 fmask : 1; ///< This is an fmask surface 2399bf215546Sopenharmony_ci UINT_32 overlay : 1; ///< This is an overlay surface 2400bf215546Sopenharmony_ci UINT_32 display : 1; ///< This resource is displable, can be used with DRV 2401bf215546Sopenharmony_ci UINT_32 prt : 1; ///< This is a partially resident texture 2402bf215546Sopenharmony_ci UINT_32 qbStereo : 1; ///< This is a quad buffer stereo surface 2403bf215546Sopenharmony_ci UINT_32 interleaved : 1; ///< Special flag for interleaved YUV surface padding 2404bf215546Sopenharmony_ci UINT_32 texture : 1; ///< This resource can be used with SRV 2405bf215546Sopenharmony_ci UINT_32 unordered : 1; ///< This resource can be used with UAV 2406bf215546Sopenharmony_ci UINT_32 rotated : 1; ///< This resource is rotated and displable 2407bf215546Sopenharmony_ci UINT_32 needEquation : 1; ///< This resource needs equation to be generated if possible 2408bf215546Sopenharmony_ci UINT_32 opt4space : 1; ///< This resource should be optimized for space 2409bf215546Sopenharmony_ci UINT_32 minimizeAlign : 1; ///< This resource should use minimum alignment 2410bf215546Sopenharmony_ci UINT_32 noMetadata : 1; ///< This resource has no metadata 2411bf215546Sopenharmony_ci UINT_32 metaRbUnaligned : 1; ///< This resource has rb unaligned metadata 2412bf215546Sopenharmony_ci UINT_32 metaPipeUnaligned : 1; ///< This resource has pipe unaligned metadata 2413bf215546Sopenharmony_ci UINT_32 view3dAs2dArray : 1; ///< This resource is a 3D resource viewed as 2D array 2414bf215546Sopenharmony_ci UINT_32 reserved : 13; ///< Reserved bits 2415bf215546Sopenharmony_ci }; 2416bf215546Sopenharmony_ci 2417bf215546Sopenharmony_ci UINT_32 value; 2418bf215546Sopenharmony_ci} ADDR2_SURFACE_FLAGS; 2419bf215546Sopenharmony_ci 2420bf215546Sopenharmony_ci/** 2421bf215546Sopenharmony_ci**************************************************************************************************** 2422bf215546Sopenharmony_ci* ADDR2_COMPUTE_SURFACE_INFO_INPUT 2423bf215546Sopenharmony_ci* 2424bf215546Sopenharmony_ci* @brief 2425bf215546Sopenharmony_ci* Input structure for Addr2ComputeSurfaceInfo 2426bf215546Sopenharmony_ci**************************************************************************************************** 2427bf215546Sopenharmony_ci*/ 2428bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SURFACE_INFO_INPUT 2429bf215546Sopenharmony_ci{ 2430bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2431bf215546Sopenharmony_ci 2432bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS flags; ///< Surface flags 2433bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Swizzle Mode for Gfx9 2434bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Surface type 2435bf215546Sopenharmony_ci AddrFormat format; ///< Surface format 2436bf215546Sopenharmony_ci UINT_32 bpp; ///< bits per pixel 2437bf215546Sopenharmony_ci UINT_32 width; ///< Width (of mip0), in pixels 2438bf215546Sopenharmony_ci UINT_32 height; ///< Height (of mip0), in pixels 2439bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number surface slice/depth (of mip0), 2440bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Total mipmap levels. 2441bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 2442bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 2443bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 2444bf215546Sopenharmony_ci /// number of fragments for EQAA 2445bf215546Sopenharmony_ci UINT_32 pitchInElement; ///< Pitch in elements (blocks for compressed formats) 2446bf215546Sopenharmony_ci UINT_32 sliceAlign; ///< Required slice size in bytes 2447bf215546Sopenharmony_ci} ADDR2_COMPUTE_SURFACE_INFO_INPUT; 2448bf215546Sopenharmony_ci 2449bf215546Sopenharmony_ci/** 2450bf215546Sopenharmony_ci**************************************************************************************************** 2451bf215546Sopenharmony_ci* ADDR2_MIP_INFO 2452bf215546Sopenharmony_ci* 2453bf215546Sopenharmony_ci* @brief 2454bf215546Sopenharmony_ci* Structure that contains information for mip level 2455bf215546Sopenharmony_ci* 2456bf215546Sopenharmony_ci**************************************************************************************************** 2457bf215546Sopenharmony_ci*/ 2458bf215546Sopenharmony_citypedef struct _ADDR2_MIP_INFO 2459bf215546Sopenharmony_ci{ 2460bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch in elements 2461bf215546Sopenharmony_ci UINT_32 height; ///< Padded height in elements 2462bf215546Sopenharmony_ci UINT_32 depth; ///< Padded depth 2463bf215546Sopenharmony_ci UINT_32 pixelPitch; ///< Pitch in pixels 2464bf215546Sopenharmony_ci UINT_32 pixelHeight; ///< Padded height in pixels 2465bf215546Sopenharmony_ci UINT_32 equationIndex; ///< Equation index in the equation table 2466bf215546Sopenharmony_ci UINT_64 offset; ///< Offset in bytes from mip base, should only be used 2467bf215546Sopenharmony_ci ///< to setup vam surface descriptor, can't be used 2468bf215546Sopenharmony_ci ///< to setup swizzle pattern 2469bf215546Sopenharmony_ci UINT_64 macroBlockOffset; ///< macro block offset in bytes from mip base 2470bf215546Sopenharmony_ci UINT_32 mipTailOffset; ///< mip tail offset in bytes 2471bf215546Sopenharmony_ci UINT_32 mipTailCoordX; ///< mip tail coord x 2472bf215546Sopenharmony_ci UINT_32 mipTailCoordY; ///< mip tail coord y 2473bf215546Sopenharmony_ci UINT_32 mipTailCoordZ; ///< mip tail coord z 2474bf215546Sopenharmony_ci} ADDR2_MIP_INFO; 2475bf215546Sopenharmony_ci 2476bf215546Sopenharmony_ci/** 2477bf215546Sopenharmony_ci**************************************************************************************************** 2478bf215546Sopenharmony_ci* ADDR2_COMPUTE_SURFACE_INFO_OUTPUT 2479bf215546Sopenharmony_ci* 2480bf215546Sopenharmony_ci* @brief 2481bf215546Sopenharmony_ci* Output structure for Addr2ComputeSurfInfo 2482bf215546Sopenharmony_ci* @note 2483bf215546Sopenharmony_ci Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch 2484bf215546Sopenharmony_ci Pixel: Original pixel 2485bf215546Sopenharmony_ci**************************************************************************************************** 2486bf215546Sopenharmony_ci*/ 2487bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SURFACE_INFO_OUTPUT 2488bf215546Sopenharmony_ci{ 2489bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2490bf215546Sopenharmony_ci 2491bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch in elements (blocks for compressed formats) 2492bf215546Sopenharmony_ci UINT_32 height; ///< Padded height (of mip0) in elements 2493bf215546Sopenharmony_ci UINT_32 numSlices; ///< Padded depth for 3d resource 2494bf215546Sopenharmony_ci ///< or padded number of slices for 2d array resource 2495bf215546Sopenharmony_ci UINT_32 mipChainPitch; ///< Pitch (of total mip chain) in elements 2496bf215546Sopenharmony_ci UINT_32 mipChainHeight; ///< Padded height (of total mip chain) in elements 2497bf215546Sopenharmony_ci UINT_32 mipChainSlice; ///< Padded depth (of total mip chain) 2498bf215546Sopenharmony_ci UINT_64 sliceSize; ///< Slice (total mip chain) size in bytes 2499bf215546Sopenharmony_ci UINT_64 surfSize; ///< Surface (total mip chain) size in bytes 2500bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Base address alignment 2501bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per elements 2502bf215546Sopenharmony_ci /// (e.g. blocks for BCn, 1/3 for 96bit) 2503bf215546Sopenharmony_ci UINT_32 pixelMipChainPitch; ///< Mip chain pitch in original pixels 2504bf215546Sopenharmony_ci UINT_32 pixelMipChainHeight; ///< Mip chain height in original pixels 2505bf215546Sopenharmony_ci UINT_32 pixelPitch; ///< Pitch in original pixels 2506bf215546Sopenharmony_ci UINT_32 pixelHeight; ///< Height in original pixels 2507bf215546Sopenharmony_ci UINT_32 pixelBits; ///< Original bits per pixel, passed from input 2508bf215546Sopenharmony_ci 2509bf215546Sopenharmony_ci UINT_32 blockWidth; ///< Width in element inside one block 2510bf215546Sopenharmony_ci UINT_32 blockHeight; ///< Height in element inside one block 2511bf215546Sopenharmony_ci UINT_32 blockSlices; ///< Slice number inside one block 2512bf215546Sopenharmony_ci ///< Prt tile is one block, its width/height/slice 2513bf215546Sopenharmony_ci ///< equals to blcok width/height/slice 2514bf215546Sopenharmony_ci 2515bf215546Sopenharmony_ci BOOL_32 epitchIsHeight; ///< Whether to use height to program epitch register 2516bf215546Sopenharmony_ci /// Stereo info 2517bf215546Sopenharmony_ci ADDR_QBSTEREOINFO* pStereoInfo; ///< Stereo info, needed if qbStereo flag is TRUE 2518bf215546Sopenharmony_ci /// Mip info 2519bf215546Sopenharmony_ci ADDR2_MIP_INFO* pMipInfo; ///< Pointer to mip information array 2520bf215546Sopenharmony_ci /// if it is not NULL, the array is assumed to 2521bf215546Sopenharmony_ci /// contain numMipLevels entries 2522bf215546Sopenharmony_ci 2523bf215546Sopenharmony_ci UINT_32 equationIndex; ///< Equation index in the equation table of mip0 2524bf215546Sopenharmony_ci BOOL_32 mipChainInTail; ///< If whole mipchain falls into mip tail block 2525bf215546Sopenharmony_ci UINT_32 firstMipIdInTail; ///< The id of first mip in tail, if there is no mip 2526bf215546Sopenharmony_ci /// in tail, it will be set to number of mip levels 2527bf215546Sopenharmony_ci} ADDR2_COMPUTE_SURFACE_INFO_OUTPUT; 2528bf215546Sopenharmony_ci 2529bf215546Sopenharmony_ci/** 2530bf215546Sopenharmony_ci**************************************************************************************************** 2531bf215546Sopenharmony_ci* Addr2ComputeSurfaceInfo 2532bf215546Sopenharmony_ci* 2533bf215546Sopenharmony_ci* @brief 2534bf215546Sopenharmony_ci* Compute surface width/height/slices/alignments and suitable tiling mode 2535bf215546Sopenharmony_ci**************************************************************************************************** 2536bf215546Sopenharmony_ci*/ 2537bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceInfo( 2538bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2539bf215546Sopenharmony_ci const ADDR2_COMPUTE_SURFACE_INFO_INPUT* pIn, 2540bf215546Sopenharmony_ci ADDR2_COMPUTE_SURFACE_INFO_OUTPUT* pOut); 2541bf215546Sopenharmony_ci 2542bf215546Sopenharmony_ci 2543bf215546Sopenharmony_ci 2544bf215546Sopenharmony_ci/** 2545bf215546Sopenharmony_ci**************************************************************************************************** 2546bf215546Sopenharmony_ci* ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT 2547bf215546Sopenharmony_ci* 2548bf215546Sopenharmony_ci* @brief 2549bf215546Sopenharmony_ci* Input structure for Addr2ComputeSurfaceAddrFromCoord 2550bf215546Sopenharmony_ci**************************************************************************************************** 2551bf215546Sopenharmony_ci*/ 2552bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT 2553bf215546Sopenharmony_ci{ 2554bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2555bf215546Sopenharmony_ci 2556bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 2557bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 2558bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 2559bf215546Sopenharmony_ci UINT_32 sample; ///< Sample index, use fragment index for EQAA 2560bf215546Sopenharmony_ci UINT_32 mipId; ///< the mip ID in mip chain 2561bf215546Sopenharmony_ci 2562bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Swizzle mode for Gfx9 2563bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS flags; ///< Surface flags 2564bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Surface type 2565bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 2566bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Surface original width (of mip0) 2567bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Surface original height (of mip0) 2568bf215546Sopenharmony_ci UINT_32 numSlices; ///< Surface original slices (of mip0) 2569bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Total mipmap levels 2570bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 2571bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 2572bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 2573bf215546Sopenharmony_ci /// number of fragments for EQAA 2574bf215546Sopenharmony_ci 2575bf215546Sopenharmony_ci UINT_32 pipeBankXor; ///< Combined swizzle used to do bank/pipe rotation 2576bf215546Sopenharmony_ci UINT_32 pitchInElement; ///< Pitch in elements (blocks for compressed formats) 2577bf215546Sopenharmony_ci} ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT; 2578bf215546Sopenharmony_ci 2579bf215546Sopenharmony_ci/** 2580bf215546Sopenharmony_ci**************************************************************************************************** 2581bf215546Sopenharmony_ci* ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT 2582bf215546Sopenharmony_ci* 2583bf215546Sopenharmony_ci* @brief 2584bf215546Sopenharmony_ci* Output structure for Addr2ComputeSurfaceAddrFromCoord 2585bf215546Sopenharmony_ci**************************************************************************************************** 2586bf215546Sopenharmony_ci*/ 2587bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT 2588bf215546Sopenharmony_ci{ 2589bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2590bf215546Sopenharmony_ci 2591bf215546Sopenharmony_ci UINT_64 addr; ///< Byte address 2592bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within surfaceAddr, 0-7. 2593bf215546Sopenharmony_ci /// For surface bpp < 8, e.g. FMT_1. 2594bf215546Sopenharmony_ci UINT_32 prtBlockIndex; ///< Index of a PRT tile (64K block) 2595bf215546Sopenharmony_ci} ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT; 2596bf215546Sopenharmony_ci 2597bf215546Sopenharmony_ci/** 2598bf215546Sopenharmony_ci**************************************************************************************************** 2599bf215546Sopenharmony_ci* Addr2ComputeSurfaceAddrFromCoord 2600bf215546Sopenharmony_ci* 2601bf215546Sopenharmony_ci* @brief 2602bf215546Sopenharmony_ci* Compute surface address from a given coordinate. 2603bf215546Sopenharmony_ci**************************************************************************************************** 2604bf215546Sopenharmony_ci*/ 2605bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceAddrFromCoord( 2606bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2607bf215546Sopenharmony_ci const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn, 2608bf215546Sopenharmony_ci ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut); 2609bf215546Sopenharmony_ci 2610bf215546Sopenharmony_ci 2611bf215546Sopenharmony_ci 2612bf215546Sopenharmony_ci/** 2613bf215546Sopenharmony_ci**************************************************************************************************** 2614bf215546Sopenharmony_ci* ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT 2615bf215546Sopenharmony_ci* 2616bf215546Sopenharmony_ci* @brief 2617bf215546Sopenharmony_ci* Input structure for Addr2ComputeSurfaceCoordFromAddr 2618bf215546Sopenharmony_ci**************************************************************************************************** 2619bf215546Sopenharmony_ci*/ 2620bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT 2621bf215546Sopenharmony_ci{ 2622bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2623bf215546Sopenharmony_ci 2624bf215546Sopenharmony_ci UINT_64 addr; ///< Address in bytes 2625bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position in addr. 0-7. for surface bpp < 8, 2626bf215546Sopenharmony_ci /// e.g. FMT_1; 2627bf215546Sopenharmony_ci 2628bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Swizzle mode for Gfx9 2629bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS flags; ///< Surface flags 2630bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Surface type 2631bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel 2632bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Surface original width (of mip0) 2633bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Surface original height (of mip0) 2634bf215546Sopenharmony_ci UINT_32 numSlices; ///< Surface original slices (of mip0) 2635bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Total mipmap levels. 2636bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 2637bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 2638bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 2639bf215546Sopenharmony_ci /// number of fragments for EQAA 2640bf215546Sopenharmony_ci 2641bf215546Sopenharmony_ci UINT_32 pipeBankXor; ///< Combined swizzle used to do bank/pipe rotation 2642bf215546Sopenharmony_ci UINT_32 pitchInElement; ///< Pitch in elements (blocks for compressed formats) 2643bf215546Sopenharmony_ci} ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT; 2644bf215546Sopenharmony_ci 2645bf215546Sopenharmony_ci/** 2646bf215546Sopenharmony_ci**************************************************************************************************** 2647bf215546Sopenharmony_ci* ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT 2648bf215546Sopenharmony_ci* 2649bf215546Sopenharmony_ci* @brief 2650bf215546Sopenharmony_ci* Output structure for Addr2ComputeSurfaceCoordFromAddr 2651bf215546Sopenharmony_ci**************************************************************************************************** 2652bf215546Sopenharmony_ci*/ 2653bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT 2654bf215546Sopenharmony_ci{ 2655bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2656bf215546Sopenharmony_ci 2657bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 2658bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 2659bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slices 2660bf215546Sopenharmony_ci UINT_32 sample; ///< Index of samples, means fragment index for EQAA 2661bf215546Sopenharmony_ci UINT_32 mipId; ///< mipmap level id 2662bf215546Sopenharmony_ci} ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT; 2663bf215546Sopenharmony_ci 2664bf215546Sopenharmony_ci/** 2665bf215546Sopenharmony_ci**************************************************************************************************** 2666bf215546Sopenharmony_ci* Addr2ComputeSurfaceCoordFromAddr 2667bf215546Sopenharmony_ci* 2668bf215546Sopenharmony_ci* @brief 2669bf215546Sopenharmony_ci* Compute coordinate from a given surface address 2670bf215546Sopenharmony_ci**************************************************************************************************** 2671bf215546Sopenharmony_ci*/ 2672bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeSurfaceCoordFromAddr( 2673bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2674bf215546Sopenharmony_ci const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn, 2675bf215546Sopenharmony_ci ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut); 2676bf215546Sopenharmony_ci 2677bf215546Sopenharmony_ci 2678bf215546Sopenharmony_ci 2679bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 2680bf215546Sopenharmony_ci// HTile functions for Gfx9 2681bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 2682bf215546Sopenharmony_ci 2683bf215546Sopenharmony_ci/** 2684bf215546Sopenharmony_ci**************************************************************************************************** 2685bf215546Sopenharmony_ci* ADDR2_META_FLAGS 2686bf215546Sopenharmony_ci* 2687bf215546Sopenharmony_ci* @brief 2688bf215546Sopenharmony_ci* Metadata flags 2689bf215546Sopenharmony_ci**************************************************************************************************** 2690bf215546Sopenharmony_ci*/ 2691bf215546Sopenharmony_citypedef union _ADDR2_META_FLAGS 2692bf215546Sopenharmony_ci{ 2693bf215546Sopenharmony_ci struct 2694bf215546Sopenharmony_ci { 2695bf215546Sopenharmony_ci UINT_32 pipeAligned : 1; ///< if Metadata being pipe aligned 2696bf215546Sopenharmony_ci UINT_32 rbAligned : 1; ///< if Metadata being RB aligned 2697bf215546Sopenharmony_ci UINT_32 linear : 1; ///< if Metadata linear, GFX9 does not suppord this! 2698bf215546Sopenharmony_ci UINT_32 reserved : 29; ///< Reserved bits 2699bf215546Sopenharmony_ci }; 2700bf215546Sopenharmony_ci 2701bf215546Sopenharmony_ci UINT_32 value; 2702bf215546Sopenharmony_ci} ADDR2_META_FLAGS; 2703bf215546Sopenharmony_ci 2704bf215546Sopenharmony_ci/** 2705bf215546Sopenharmony_ci**************************************************************************************************** 2706bf215546Sopenharmony_ci* ADDR2_META_MIP_INFO 2707bf215546Sopenharmony_ci* 2708bf215546Sopenharmony_ci* @brief 2709bf215546Sopenharmony_ci* Structure to store per mip metadata information 2710bf215546Sopenharmony_ci**************************************************************************************************** 2711bf215546Sopenharmony_ci*/ 2712bf215546Sopenharmony_citypedef struct _ADDR2_META_MIP_INFO 2713bf215546Sopenharmony_ci{ 2714bf215546Sopenharmony_ci BOOL_32 inMiptail; 2715bf215546Sopenharmony_ci union 2716bf215546Sopenharmony_ci { 2717bf215546Sopenharmony_ci struct 2718bf215546Sopenharmony_ci { 2719bf215546Sopenharmony_ci UINT_32 startX; 2720bf215546Sopenharmony_ci UINT_32 startY; 2721bf215546Sopenharmony_ci UINT_32 startZ; 2722bf215546Sopenharmony_ci UINT_32 width; 2723bf215546Sopenharmony_ci UINT_32 height; 2724bf215546Sopenharmony_ci UINT_32 depth; 2725bf215546Sopenharmony_ci }; 2726bf215546Sopenharmony_ci 2727bf215546Sopenharmony_ci // GFX10 2728bf215546Sopenharmony_ci struct 2729bf215546Sopenharmony_ci { 2730bf215546Sopenharmony_ci UINT_32 offset; ///< Metadata offset within one slice, 2731bf215546Sopenharmony_ci /// the thickness of a slice is meta block depth. 2732bf215546Sopenharmony_ci UINT_32 sliceSize; ///< Metadata size within one slice, 2733bf215546Sopenharmony_ci /// the thickness of a slice is meta block depth. 2734bf215546Sopenharmony_ci }; 2735bf215546Sopenharmony_ci }; 2736bf215546Sopenharmony_ci} ADDR2_META_MIP_INFO; 2737bf215546Sopenharmony_ci 2738bf215546Sopenharmony_ci/** 2739bf215546Sopenharmony_ci**************************************************************************************************** 2740bf215546Sopenharmony_ci* ADDR2_COMPUTE_HTILE_INFO_INPUT 2741bf215546Sopenharmony_ci* 2742bf215546Sopenharmony_ci* @brief 2743bf215546Sopenharmony_ci* Input structure of Addr2ComputeHtileInfo 2744bf215546Sopenharmony_ci**************************************************************************************************** 2745bf215546Sopenharmony_ci*/ 2746bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_HTILE_INFO_INPUT 2747bf215546Sopenharmony_ci{ 2748bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2749bf215546Sopenharmony_ci 2750bf215546Sopenharmony_ci ADDR2_META_FLAGS hTileFlags; ///< HTILE flags 2751bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS depthFlags; ///< Depth surface flags 2752bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Depth surface swizzle mode 2753bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Depth surface original width (of mip0) 2754bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Depth surface original height (of mip0) 2755bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices of depth surface (of mip0) 2756bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Total mipmap levels of color surface 2757bf215546Sopenharmony_ci UINT_32 firstMipIdInTail; /// Id of the first mip in tail, 2758bf215546Sopenharmony_ci /// if no mip is in tail, it should be set to 2759bf215546Sopenharmony_ci /// number of mip levels 2760bf215546Sopenharmony_ci /// Only for GFX10 2761bf215546Sopenharmony_ci} ADDR2_COMPUTE_HTILE_INFO_INPUT; 2762bf215546Sopenharmony_ci 2763bf215546Sopenharmony_ci/** 2764bf215546Sopenharmony_ci**************************************************************************************************** 2765bf215546Sopenharmony_ci* ADDR2_COMPUTE_HTILE_INFO_OUTPUT 2766bf215546Sopenharmony_ci* 2767bf215546Sopenharmony_ci* @brief 2768bf215546Sopenharmony_ci* Output structure of Addr2ComputeHtileInfo 2769bf215546Sopenharmony_ci**************************************************************************************************** 2770bf215546Sopenharmony_ci*/ 2771bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_HTILE_INFO_OUTPUT 2772bf215546Sopenharmony_ci{ 2773bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2774bf215546Sopenharmony_ci 2775bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch in pixels of depth buffer represented in this 2776bf215546Sopenharmony_ci /// HTile buffer. This might be larger than original depth 2777bf215546Sopenharmony_ci /// buffer pitch when called with an unaligned pitch. 2778bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels, as above 2779bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Base alignment 2780bf215546Sopenharmony_ci UINT_32 sliceSize; ///< Slice size, in bytes. 2781bf215546Sopenharmony_ci UINT_32 htileBytes; ///< Size of HTILE buffer, in bytes 2782bf215546Sopenharmony_ci UINT_32 metaBlkWidth; ///< Meta block width 2783bf215546Sopenharmony_ci UINT_32 metaBlkHeight; ///< Meta block height 2784bf215546Sopenharmony_ci UINT_32 metaBlkNumPerSlice; ///< Number of metablock within one slice 2785bf215546Sopenharmony_ci 2786bf215546Sopenharmony_ci ADDR2_META_MIP_INFO* pMipInfo; ///< HTILE mip information 2787bf215546Sopenharmony_ci 2788bf215546Sopenharmony_ci struct { 2789bf215546Sopenharmony_ci UINT_16* gfx10_bits; /* 72 2-byte elements */ 2790bf215546Sopenharmony_ci } equation; 2791bf215546Sopenharmony_ci} ADDR2_COMPUTE_HTILE_INFO_OUTPUT; 2792bf215546Sopenharmony_ci 2793bf215546Sopenharmony_ci/** 2794bf215546Sopenharmony_ci**************************************************************************************************** 2795bf215546Sopenharmony_ci* Addr2ComputeHtileInfo 2796bf215546Sopenharmony_ci* 2797bf215546Sopenharmony_ci* @brief 2798bf215546Sopenharmony_ci* Compute Htile pitch, height, base alignment and size in bytes 2799bf215546Sopenharmony_ci**************************************************************************************************** 2800bf215546Sopenharmony_ci*/ 2801bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileInfo( 2802bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2803bf215546Sopenharmony_ci const ADDR2_COMPUTE_HTILE_INFO_INPUT* pIn, 2804bf215546Sopenharmony_ci ADDR2_COMPUTE_HTILE_INFO_OUTPUT* pOut); 2805bf215546Sopenharmony_ci 2806bf215546Sopenharmony_ci 2807bf215546Sopenharmony_ci 2808bf215546Sopenharmony_ci/** 2809bf215546Sopenharmony_ci**************************************************************************************************** 2810bf215546Sopenharmony_ci* ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT 2811bf215546Sopenharmony_ci* 2812bf215546Sopenharmony_ci* @brief 2813bf215546Sopenharmony_ci* Input structure for Addr2ComputeHtileAddrFromCoord 2814bf215546Sopenharmony_ci**************************************************************************************************** 2815bf215546Sopenharmony_ci*/ 2816bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT 2817bf215546Sopenharmony_ci{ 2818bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2819bf215546Sopenharmony_ci 2820bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 2821bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 2822bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slices 2823bf215546Sopenharmony_ci UINT_32 mipId; ///< mipmap level id 2824bf215546Sopenharmony_ci 2825bf215546Sopenharmony_ci ADDR2_META_FLAGS hTileFlags; ///< HTILE flags 2826bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS depthflags; ///< Depth surface flags 2827bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Depth surface swizzle mode 2828bf215546Sopenharmony_ci UINT_32 bpp; ///< Depth surface bits per pixel 2829bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Depth surface original width (of mip0) 2830bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Depth surface original height (of mip0) 2831bf215546Sopenharmony_ci UINT_32 numSlices; ///< Depth surface original depth (of mip0) 2832bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Depth surface total mipmap levels 2833bf215546Sopenharmony_ci UINT_32 numSamples; ///< Depth surface number of samples 2834bf215546Sopenharmony_ci UINT_32 pipeXor; ///< Pipe xor setting 2835bf215546Sopenharmony_ci} ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT; 2836bf215546Sopenharmony_ci 2837bf215546Sopenharmony_ci/** 2838bf215546Sopenharmony_ci**************************************************************************************************** 2839bf215546Sopenharmony_ci* ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT 2840bf215546Sopenharmony_ci* 2841bf215546Sopenharmony_ci* @brief 2842bf215546Sopenharmony_ci* Output structure for Addr2ComputeHtileAddrFromCoord 2843bf215546Sopenharmony_ci**************************************************************************************************** 2844bf215546Sopenharmony_ci*/ 2845bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT 2846bf215546Sopenharmony_ci{ 2847bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2848bf215546Sopenharmony_ci 2849bf215546Sopenharmony_ci UINT_64 addr; ///< Address in bytes 2850bf215546Sopenharmony_ci} ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT; 2851bf215546Sopenharmony_ci 2852bf215546Sopenharmony_ci/** 2853bf215546Sopenharmony_ci**************************************************************************************************** 2854bf215546Sopenharmony_ci* Addr2ComputeHtileAddrFromCoord 2855bf215546Sopenharmony_ci* 2856bf215546Sopenharmony_ci* @brief 2857bf215546Sopenharmony_ci* Compute Htile address according to coordinates (of depth buffer) 2858bf215546Sopenharmony_ci**************************************************************************************************** 2859bf215546Sopenharmony_ci*/ 2860bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileAddrFromCoord( 2861bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2862bf215546Sopenharmony_ci const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn, 2863bf215546Sopenharmony_ci ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut); 2864bf215546Sopenharmony_ci 2865bf215546Sopenharmony_ci 2866bf215546Sopenharmony_ci 2867bf215546Sopenharmony_ci/** 2868bf215546Sopenharmony_ci**************************************************************************************************** 2869bf215546Sopenharmony_ci* ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT 2870bf215546Sopenharmony_ci* 2871bf215546Sopenharmony_ci* @brief 2872bf215546Sopenharmony_ci* Input structure for Addr2ComputeHtileCoordFromAddr 2873bf215546Sopenharmony_ci**************************************************************************************************** 2874bf215546Sopenharmony_ci*/ 2875bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT 2876bf215546Sopenharmony_ci{ 2877bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2878bf215546Sopenharmony_ci 2879bf215546Sopenharmony_ci UINT_64 addr; ///< Address 2880bf215546Sopenharmony_ci 2881bf215546Sopenharmony_ci ADDR2_META_FLAGS hTileFlags; ///< HTILE flags 2882bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS depthFlags; ///< Depth surface flags 2883bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Depth surface swizzle mode 2884bf215546Sopenharmony_ci UINT_32 bpp; ///< Depth surface bits per pixel 2885bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Depth surface original width (of mip0) 2886bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Depth surface original height (of mip0) 2887bf215546Sopenharmony_ci UINT_32 numSlices; ///< Depth surface original depth (of mip0) 2888bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Depth surface total mipmap levels 2889bf215546Sopenharmony_ci UINT_32 numSamples; ///< Depth surface number of samples 2890bf215546Sopenharmony_ci UINT_32 pipeXor; ///< Pipe xor setting 2891bf215546Sopenharmony_ci} ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT; 2892bf215546Sopenharmony_ci 2893bf215546Sopenharmony_ci/** 2894bf215546Sopenharmony_ci**************************************************************************************************** 2895bf215546Sopenharmony_ci* ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT 2896bf215546Sopenharmony_ci* 2897bf215546Sopenharmony_ci* @brief 2898bf215546Sopenharmony_ci* Output structure for Addr2ComputeHtileCoordFromAddr 2899bf215546Sopenharmony_ci**************************************************************************************************** 2900bf215546Sopenharmony_ci*/ 2901bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT 2902bf215546Sopenharmony_ci{ 2903bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2904bf215546Sopenharmony_ci 2905bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 2906bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 2907bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slices 2908bf215546Sopenharmony_ci UINT_32 mipId; ///< mipmap level id 2909bf215546Sopenharmony_ci} ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT; 2910bf215546Sopenharmony_ci 2911bf215546Sopenharmony_ci/** 2912bf215546Sopenharmony_ci**************************************************************************************************** 2913bf215546Sopenharmony_ci* Addr2ComputeHtileCoordFromAddr 2914bf215546Sopenharmony_ci* 2915bf215546Sopenharmony_ci* @brief 2916bf215546Sopenharmony_ci* Compute coordinates within depth buffer (1st pixel of a micro tile) according to 2917bf215546Sopenharmony_ci* Htile address 2918bf215546Sopenharmony_ci**************************************************************************************************** 2919bf215546Sopenharmony_ci*/ 2920bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeHtileCoordFromAddr( 2921bf215546Sopenharmony_ci ADDR_HANDLE hLib, 2922bf215546Sopenharmony_ci const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn, 2923bf215546Sopenharmony_ci ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut); 2924bf215546Sopenharmony_ci 2925bf215546Sopenharmony_ci 2926bf215546Sopenharmony_ci 2927bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 2928bf215546Sopenharmony_ci// C-mask functions for Gfx9 2929bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 2930bf215546Sopenharmony_ci 2931bf215546Sopenharmony_ci/** 2932bf215546Sopenharmony_ci**************************************************************************************************** 2933bf215546Sopenharmony_ci* ADDR2_COMPUTE_CMASK_INFO_INPUT 2934bf215546Sopenharmony_ci* 2935bf215546Sopenharmony_ci* @brief 2936bf215546Sopenharmony_ci* Input structure of Addr2ComputeCmaskInfo 2937bf215546Sopenharmony_ci**************************************************************************************************** 2938bf215546Sopenharmony_ci*/ 2939bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_CMASKINFO_INPUT 2940bf215546Sopenharmony_ci{ 2941bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2942bf215546Sopenharmony_ci 2943bf215546Sopenharmony_ci ADDR2_META_FLAGS cMaskFlags; ///< CMASK flags 2944bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS colorFlags; ///< Color surface flags 2945bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Color surface type 2946bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< FMask surface swizzle mode 2947bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Color surface original width 2948bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Color surface original height 2949bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices of color buffer 2950bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Number of mip levels 2951bf215546Sopenharmony_ci UINT_32 firstMipIdInTail; ///< The id of first mip in tail, if no mip is in tail, 2952bf215546Sopenharmony_ci /// it should be number of mip levels 2953bf215546Sopenharmony_ci /// Only for GFX10 2954bf215546Sopenharmony_ci} ADDR2_COMPUTE_CMASK_INFO_INPUT; 2955bf215546Sopenharmony_ci 2956bf215546Sopenharmony_ci/* DCC addr meta equation for GFX9. */ 2957bf215546Sopenharmony_cistruct gfx9_addr_meta_equation { 2958bf215546Sopenharmony_ci UINT_8 num_bits; 2959bf215546Sopenharmony_ci 2960bf215546Sopenharmony_ci struct { 2961bf215546Sopenharmony_ci struct { 2962bf215546Sopenharmony_ci UINT_8 dim; /* 0..4 as index, 5 means invalid */ 2963bf215546Sopenharmony_ci UINT_8 ord; /* 0..31 */ 2964bf215546Sopenharmony_ci } coord[8]; /* 0..num_coords */ 2965bf215546Sopenharmony_ci } bit[32]; /* 0..num_bits */ 2966bf215546Sopenharmony_ci 2967bf215546Sopenharmony_ci UINT_8 numPipeBits; 2968bf215546Sopenharmony_ci}; 2969bf215546Sopenharmony_ci 2970bf215546Sopenharmony_ci/** 2971bf215546Sopenharmony_ci**************************************************************************************************** 2972bf215546Sopenharmony_ci* ADDR2_COMPUTE_CMASK_INFO_OUTPUT 2973bf215546Sopenharmony_ci* 2974bf215546Sopenharmony_ci* @brief 2975bf215546Sopenharmony_ci* Output structure of Addr2ComputeCmaskInfo 2976bf215546Sopenharmony_ci**************************************************************************************************** 2977bf215546Sopenharmony_ci*/ 2978bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_CMASK_INFO_OUTPUT 2979bf215546Sopenharmony_ci{ 2980bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 2981bf215546Sopenharmony_ci 2982bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch in pixels of color buffer which 2983bf215546Sopenharmony_ci /// this Cmask matches. The size might be larger than 2984bf215546Sopenharmony_ci /// original color buffer pitch when called with 2985bf215546Sopenharmony_ci /// an unaligned pitch. 2986bf215546Sopenharmony_ci UINT_32 height; ///< Height in pixels, as above 2987bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Base alignment 2988bf215546Sopenharmony_ci UINT_32 sliceSize; ///< Slice size, in bytes. 2989bf215546Sopenharmony_ci UINT_32 cmaskBytes; ///< Size in bytes of CMask buffer 2990bf215546Sopenharmony_ci UINT_32 metaBlkWidth; ///< Meta block width 2991bf215546Sopenharmony_ci UINT_32 metaBlkHeight; ///< Meta block height 2992bf215546Sopenharmony_ci 2993bf215546Sopenharmony_ci UINT_32 metaBlkNumPerSlice; ///< Number of metablock within one slice 2994bf215546Sopenharmony_ci 2995bf215546Sopenharmony_ci ADDR2_META_MIP_INFO* pMipInfo; ///< CMASK mip information 2996bf215546Sopenharmony_ci 2997bf215546Sopenharmony_ci /* The equation for doing CMASK address computations in shaders. */ 2998bf215546Sopenharmony_ci union { 2999bf215546Sopenharmony_ci /* This is chip-specific, and it varies with: 3000bf215546Sopenharmony_ci * - resource type 3001bf215546Sopenharmony_ci * - swizzle_mode 3002bf215546Sopenharmony_ci * - bpp 3003bf215546Sopenharmony_ci * - pipe_aligned 3004bf215546Sopenharmony_ci * - rb_aligned 3005bf215546Sopenharmony_ci */ 3006bf215546Sopenharmony_ci struct gfx9_addr_meta_equation gfx9; 3007bf215546Sopenharmony_ci 3008bf215546Sopenharmony_ci /* This is chip-specific, it requires 64KB_Z_X. */ 3009bf215546Sopenharmony_ci UINT_16 *gfx10_bits; /* 68 2-byte elements */ 3010bf215546Sopenharmony_ci } equation; 3011bf215546Sopenharmony_ci} ADDR2_COMPUTE_CMASK_INFO_OUTPUT; 3012bf215546Sopenharmony_ci 3013bf215546Sopenharmony_ci/** 3014bf215546Sopenharmony_ci**************************************************************************************************** 3015bf215546Sopenharmony_ci* Addr2ComputeCmaskInfo 3016bf215546Sopenharmony_ci* 3017bf215546Sopenharmony_ci* @brief 3018bf215546Sopenharmony_ci* Compute Cmask pitch, height, base alignment and size in bytes from color buffer 3019bf215546Sopenharmony_ci* info 3020bf215546Sopenharmony_ci**************************************************************************************************** 3021bf215546Sopenharmony_ci*/ 3022bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskInfo( 3023bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3024bf215546Sopenharmony_ci const ADDR2_COMPUTE_CMASK_INFO_INPUT* pIn, 3025bf215546Sopenharmony_ci ADDR2_COMPUTE_CMASK_INFO_OUTPUT* pOut); 3026bf215546Sopenharmony_ci 3027bf215546Sopenharmony_ci 3028bf215546Sopenharmony_ci 3029bf215546Sopenharmony_ci/** 3030bf215546Sopenharmony_ci**************************************************************************************************** 3031bf215546Sopenharmony_ci* ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT 3032bf215546Sopenharmony_ci* 3033bf215546Sopenharmony_ci* @brief 3034bf215546Sopenharmony_ci* Input structure for Addr2ComputeCmaskAddrFromCoord 3035bf215546Sopenharmony_ci* 3036bf215546Sopenharmony_ci**************************************************************************************************** 3037bf215546Sopenharmony_ci*/ 3038bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT 3039bf215546Sopenharmony_ci{ 3040bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3041bf215546Sopenharmony_ci 3042bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 3043bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 3044bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slices 3045bf215546Sopenharmony_ci 3046bf215546Sopenharmony_ci ADDR2_META_FLAGS cMaskFlags; ///< CMASK flags 3047bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS colorFlags; ///< Color surface flags 3048bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Color surface type 3049bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< FMask surface swizzle mode 3050bf215546Sopenharmony_ci 3051bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Color surface original width (of mip0) 3052bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Color surface original height (of mip0) 3053bf215546Sopenharmony_ci UINT_32 numSlices; ///< Color surface original slices (of mip0) 3054bf215546Sopenharmony_ci 3055bf215546Sopenharmony_ci UINT_32 numSamples; ///< Color surfae sample number 3056bf215546Sopenharmony_ci UINT_32 numFrags; ///< Color surface fragment number 3057bf215546Sopenharmony_ci 3058bf215546Sopenharmony_ci UINT_32 pipeXor; ///< pipe Xor setting 3059bf215546Sopenharmony_ci} ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT; 3060bf215546Sopenharmony_ci 3061bf215546Sopenharmony_ci/** 3062bf215546Sopenharmony_ci**************************************************************************************************** 3063bf215546Sopenharmony_ci* ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT 3064bf215546Sopenharmony_ci* 3065bf215546Sopenharmony_ci* @brief 3066bf215546Sopenharmony_ci* Output structure for Addr2ComputeCmaskAddrFromCoord 3067bf215546Sopenharmony_ci**************************************************************************************************** 3068bf215546Sopenharmony_ci*/ 3069bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT 3070bf215546Sopenharmony_ci{ 3071bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3072bf215546Sopenharmony_ci 3073bf215546Sopenharmony_ci UINT_64 addr; ///< CMASK address in bytes 3074bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within addr, 0 or 4 3075bf215546Sopenharmony_ci} ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT; 3076bf215546Sopenharmony_ci 3077bf215546Sopenharmony_ci/** 3078bf215546Sopenharmony_ci**************************************************************************************************** 3079bf215546Sopenharmony_ci* Addr2ComputeCmaskAddrFromCoord 3080bf215546Sopenharmony_ci* 3081bf215546Sopenharmony_ci* @brief 3082bf215546Sopenharmony_ci* Compute Cmask address according to coordinates (of MSAA color buffer) 3083bf215546Sopenharmony_ci**************************************************************************************************** 3084bf215546Sopenharmony_ci*/ 3085bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskAddrFromCoord( 3086bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3087bf215546Sopenharmony_ci const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn, 3088bf215546Sopenharmony_ci ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut); 3089bf215546Sopenharmony_ci 3090bf215546Sopenharmony_ci 3091bf215546Sopenharmony_ci 3092bf215546Sopenharmony_ci/** 3093bf215546Sopenharmony_ci**************************************************************************************************** 3094bf215546Sopenharmony_ci* ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT 3095bf215546Sopenharmony_ci* 3096bf215546Sopenharmony_ci* @brief 3097bf215546Sopenharmony_ci* Input structure for Addr2ComputeCmaskCoordFromAddr 3098bf215546Sopenharmony_ci**************************************************************************************************** 3099bf215546Sopenharmony_ci*/ 3100bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT 3101bf215546Sopenharmony_ci{ 3102bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3103bf215546Sopenharmony_ci 3104bf215546Sopenharmony_ci UINT_64 addr; ///< CMASK address in bytes 3105bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within addr, 0 or 4 3106bf215546Sopenharmony_ci 3107bf215546Sopenharmony_ci ADDR2_META_FLAGS cMaskFlags; ///< CMASK flags 3108bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS colorFlags; ///< Color surface flags 3109bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Color surface type 3110bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< FMask surface swizzle mode 3111bf215546Sopenharmony_ci 3112bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Color surface original width (of mip0) 3113bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Color surface original height (of mip0) 3114bf215546Sopenharmony_ci UINT_32 numSlices; ///< Color surface original slices (of mip0) 3115bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Color surface total mipmap levels. 3116bf215546Sopenharmony_ci} ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT; 3117bf215546Sopenharmony_ci 3118bf215546Sopenharmony_ci/** 3119bf215546Sopenharmony_ci**************************************************************************************************** 3120bf215546Sopenharmony_ci* ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT 3121bf215546Sopenharmony_ci* 3122bf215546Sopenharmony_ci* @brief 3123bf215546Sopenharmony_ci* Output structure for Addr2ComputeCmaskCoordFromAddr 3124bf215546Sopenharmony_ci**************************************************************************************************** 3125bf215546Sopenharmony_ci*/ 3126bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT 3127bf215546Sopenharmony_ci{ 3128bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3129bf215546Sopenharmony_ci 3130bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 3131bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 3132bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slices 3133bf215546Sopenharmony_ci UINT_32 mipId; ///< mipmap level id 3134bf215546Sopenharmony_ci} ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT; 3135bf215546Sopenharmony_ci 3136bf215546Sopenharmony_ci/** 3137bf215546Sopenharmony_ci**************************************************************************************************** 3138bf215546Sopenharmony_ci* Addr2ComputeCmaskCoordFromAddr 3139bf215546Sopenharmony_ci* 3140bf215546Sopenharmony_ci* @brief 3141bf215546Sopenharmony_ci* Compute coordinates within color buffer (1st pixel of a micro tile) according to 3142bf215546Sopenharmony_ci* Cmask address 3143bf215546Sopenharmony_ci**************************************************************************************************** 3144bf215546Sopenharmony_ci*/ 3145bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeCmaskCoordFromAddr( 3146bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3147bf215546Sopenharmony_ci const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT* pIn, 3148bf215546Sopenharmony_ci ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut); 3149bf215546Sopenharmony_ci 3150bf215546Sopenharmony_ci 3151bf215546Sopenharmony_ci 3152bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 3153bf215546Sopenharmony_ci// F-mask functions for Gfx9 3154bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 3155bf215546Sopenharmony_ci 3156bf215546Sopenharmony_ci/** 3157bf215546Sopenharmony_ci**************************************************************************************************** 3158bf215546Sopenharmony_ci* ADDR2_FMASK_FLAGS 3159bf215546Sopenharmony_ci* 3160bf215546Sopenharmony_ci* @brief 3161bf215546Sopenharmony_ci* FMASK flags 3162bf215546Sopenharmony_ci**************************************************************************************************** 3163bf215546Sopenharmony_ci*/ 3164bf215546Sopenharmony_citypedef union _ADDR2_FMASK_FLAGS 3165bf215546Sopenharmony_ci{ 3166bf215546Sopenharmony_ci struct 3167bf215546Sopenharmony_ci { 3168bf215546Sopenharmony_ci UINT_32 resolved : 1; ///< TRUE if this is a resolved fmask, used by H/W clients 3169bf215546Sopenharmony_ci /// by H/W clients. S/W should always set it to FALSE. 3170bf215546Sopenharmony_ci UINT_32 reserved : 31; ///< Reserved for future use. 3171bf215546Sopenharmony_ci }; 3172bf215546Sopenharmony_ci 3173bf215546Sopenharmony_ci UINT_32 value; 3174bf215546Sopenharmony_ci} ADDR2_FMASK_FLAGS; 3175bf215546Sopenharmony_ci 3176bf215546Sopenharmony_ci/** 3177bf215546Sopenharmony_ci**************************************************************************************************** 3178bf215546Sopenharmony_ci* ADDR2_COMPUTE_FMASK_INFO_INPUT 3179bf215546Sopenharmony_ci* 3180bf215546Sopenharmony_ci* @brief 3181bf215546Sopenharmony_ci* Input structure for Addr2ComputeFmaskInfo 3182bf215546Sopenharmony_ci**************************************************************************************************** 3183bf215546Sopenharmony_ci*/ 3184bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_FMASK_INFO_INPUT 3185bf215546Sopenharmony_ci{ 3186bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3187bf215546Sopenharmony_ci 3188bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< FMask surface swizzle mode 3189bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Color surface original width 3190bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Color surface original height 3191bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices/depth 3192bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 3193bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 3194bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 3195bf215546Sopenharmony_ci /// number of fragments for EQAA 3196bf215546Sopenharmony_ci ADDR2_FMASK_FLAGS fMaskFlags; ///< FMASK flags 3197bf215546Sopenharmony_ci} ADDR2_COMPUTE_FMASK_INFO_INPUT; 3198bf215546Sopenharmony_ci 3199bf215546Sopenharmony_ci/** 3200bf215546Sopenharmony_ci**************************************************************************************************** 3201bf215546Sopenharmony_ci* ADDR2_COMPUTE_FMASK_INFO_OUTPUT 3202bf215546Sopenharmony_ci* 3203bf215546Sopenharmony_ci* @brief 3204bf215546Sopenharmony_ci* Output structure for Addr2ComputeFmaskInfo 3205bf215546Sopenharmony_ci**************************************************************************************************** 3206bf215546Sopenharmony_ci*/ 3207bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_FMASK_INFO_OUTPUT 3208bf215546Sopenharmony_ci{ 3209bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3210bf215546Sopenharmony_ci 3211bf215546Sopenharmony_ci UINT_32 pitch; ///< Pitch of fmask in pixels 3212bf215546Sopenharmony_ci UINT_32 height; ///< Height of fmask in pixels 3213bf215546Sopenharmony_ci UINT_32 baseAlign; ///< Base alignment 3214bf215546Sopenharmony_ci UINT_32 numSlices; ///< Slices of fmask 3215bf215546Sopenharmony_ci UINT_32 fmaskBytes; ///< Size of fmask in bytes 3216bf215546Sopenharmony_ci UINT_32 bpp; ///< Bits per pixel of FMASK is: number of bit planes 3217bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 3218bf215546Sopenharmony_ci UINT_32 sliceSize; ///< Size of slice in bytes 3219bf215546Sopenharmony_ci} ADDR2_COMPUTE_FMASK_INFO_OUTPUT; 3220bf215546Sopenharmony_ci 3221bf215546Sopenharmony_ci/** 3222bf215546Sopenharmony_ci**************************************************************************************************** 3223bf215546Sopenharmony_ci* Addr2ComputeFmaskInfo 3224bf215546Sopenharmony_ci* 3225bf215546Sopenharmony_ci* @brief 3226bf215546Sopenharmony_ci* Compute Fmask pitch/height/slices/alignments and size in bytes 3227bf215546Sopenharmony_ci**************************************************************************************************** 3228bf215546Sopenharmony_ci*/ 3229bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskInfo( 3230bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3231bf215546Sopenharmony_ci const ADDR2_COMPUTE_FMASK_INFO_INPUT* pIn, 3232bf215546Sopenharmony_ci ADDR2_COMPUTE_FMASK_INFO_OUTPUT* pOut); 3233bf215546Sopenharmony_ci 3234bf215546Sopenharmony_ci 3235bf215546Sopenharmony_ci 3236bf215546Sopenharmony_ci/** 3237bf215546Sopenharmony_ci**************************************************************************************************** 3238bf215546Sopenharmony_ci* ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT 3239bf215546Sopenharmony_ci* 3240bf215546Sopenharmony_ci* @brief 3241bf215546Sopenharmony_ci* Input structure for Addr2ComputeFmaskAddrFromCoord 3242bf215546Sopenharmony_ci**************************************************************************************************** 3243bf215546Sopenharmony_ci*/ 3244bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT 3245bf215546Sopenharmony_ci{ 3246bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3247bf215546Sopenharmony_ci 3248bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< FMask surface swizzle mode 3249bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 3250bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 3251bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 3252bf215546Sopenharmony_ci UINT_32 sample; ///< Sample index (fragment index for EQAA) 3253bf215546Sopenharmony_ci UINT_32 plane; ///< Plane number 3254bf215546Sopenharmony_ci 3255bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Color surface original width 3256bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Color surface original height 3257bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 3258bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 3259bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 3260bf215546Sopenharmony_ci /// number of fragments for EQAA 3261bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Combined swizzle used to do bank/pipe rotation 3262bf215546Sopenharmony_ci 3263bf215546Sopenharmony_ci ADDR2_FMASK_FLAGS fMaskFlags; ///< FMASK flags 3264bf215546Sopenharmony_ci} ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT; 3265bf215546Sopenharmony_ci 3266bf215546Sopenharmony_ci/** 3267bf215546Sopenharmony_ci**************************************************************************************************** 3268bf215546Sopenharmony_ci* ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT 3269bf215546Sopenharmony_ci* 3270bf215546Sopenharmony_ci* @brief 3271bf215546Sopenharmony_ci* Output structure for Addr2ComputeFmaskAddrFromCoord 3272bf215546Sopenharmony_ci**************************************************************************************************** 3273bf215546Sopenharmony_ci*/ 3274bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT 3275bf215546Sopenharmony_ci{ 3276bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3277bf215546Sopenharmony_ci 3278bf215546Sopenharmony_ci UINT_64 addr; ///< Fmask address 3279bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within fmaskAddr, 0-7. 3280bf215546Sopenharmony_ci} ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT; 3281bf215546Sopenharmony_ci 3282bf215546Sopenharmony_ci/** 3283bf215546Sopenharmony_ci**************************************************************************************************** 3284bf215546Sopenharmony_ci* Addr2ComputeFmaskAddrFromCoord 3285bf215546Sopenharmony_ci* 3286bf215546Sopenharmony_ci* @brief 3287bf215546Sopenharmony_ci* Compute Fmask address according to coordinates (x,y,slice,sample,plane) 3288bf215546Sopenharmony_ci**************************************************************************************************** 3289bf215546Sopenharmony_ci*/ 3290bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskAddrFromCoord( 3291bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3292bf215546Sopenharmony_ci const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn, 3293bf215546Sopenharmony_ci ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut); 3294bf215546Sopenharmony_ci 3295bf215546Sopenharmony_ci 3296bf215546Sopenharmony_ci 3297bf215546Sopenharmony_ci/** 3298bf215546Sopenharmony_ci**************************************************************************************************** 3299bf215546Sopenharmony_ci* ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT 3300bf215546Sopenharmony_ci* 3301bf215546Sopenharmony_ci* @brief 3302bf215546Sopenharmony_ci* Input structure for Addr2ComputeFmaskCoordFromAddr 3303bf215546Sopenharmony_ci**************************************************************************************************** 3304bf215546Sopenharmony_ci*/ 3305bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT 3306bf215546Sopenharmony_ci{ 3307bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3308bf215546Sopenharmony_ci 3309bf215546Sopenharmony_ci UINT_64 addr; ///< Address 3310bf215546Sopenharmony_ci UINT_32 bitPosition; ///< Bit position within addr, 0-7. 3311bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< FMask surface swizzle mode 3312bf215546Sopenharmony_ci 3313bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Color surface original width 3314bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Color surface original height 3315bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 3316bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments 3317bf215546Sopenharmony_ci 3318bf215546Sopenharmony_ci UINT_32 tileSwizzle; ///< Combined swizzle used to do bank/pipe rotation 3319bf215546Sopenharmony_ci 3320bf215546Sopenharmony_ci ADDR2_FMASK_FLAGS fMaskFlags; ///< FMASK flags 3321bf215546Sopenharmony_ci} ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT; 3322bf215546Sopenharmony_ci 3323bf215546Sopenharmony_ci/** 3324bf215546Sopenharmony_ci**************************************************************************************************** 3325bf215546Sopenharmony_ci* ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT 3326bf215546Sopenharmony_ci* 3327bf215546Sopenharmony_ci* @brief 3328bf215546Sopenharmony_ci* Output structure for Addr2ComputeFmaskCoordFromAddr 3329bf215546Sopenharmony_ci**************************************************************************************************** 3330bf215546Sopenharmony_ci*/ 3331bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT 3332bf215546Sopenharmony_ci{ 3333bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3334bf215546Sopenharmony_ci 3335bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 3336bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 3337bf215546Sopenharmony_ci UINT_32 slice; ///< Slice index 3338bf215546Sopenharmony_ci UINT_32 sample; ///< Sample index (fragment index for EQAA) 3339bf215546Sopenharmony_ci UINT_32 plane; ///< Plane number 3340bf215546Sopenharmony_ci} ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT; 3341bf215546Sopenharmony_ci 3342bf215546Sopenharmony_ci/** 3343bf215546Sopenharmony_ci**************************************************************************************************** 3344bf215546Sopenharmony_ci* Addr2ComputeFmaskCoordFromAddr 3345bf215546Sopenharmony_ci* 3346bf215546Sopenharmony_ci* @brief 3347bf215546Sopenharmony_ci* Compute FMASK coordinate from an given address 3348bf215546Sopenharmony_ci**************************************************************************************************** 3349bf215546Sopenharmony_ci*/ 3350bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeFmaskCoordFromAddr( 3351bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3352bf215546Sopenharmony_ci const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn, 3353bf215546Sopenharmony_ci ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut); 3354bf215546Sopenharmony_ci 3355bf215546Sopenharmony_ci 3356bf215546Sopenharmony_ci 3357bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 3358bf215546Sopenharmony_ci// DCC key functions for Gfx9 3359bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 3360bf215546Sopenharmony_ci 3361bf215546Sopenharmony_ci/** 3362bf215546Sopenharmony_ci**************************************************************************************************** 3363bf215546Sopenharmony_ci* _ADDR2_COMPUTE_DCCINFO_INPUT 3364bf215546Sopenharmony_ci* 3365bf215546Sopenharmony_ci* @brief 3366bf215546Sopenharmony_ci* Input structure of Addr2ComputeDccInfo 3367bf215546Sopenharmony_ci**************************************************************************************************** 3368bf215546Sopenharmony_ci*/ 3369bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_DCCINFO_INPUT 3370bf215546Sopenharmony_ci{ 3371bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3372bf215546Sopenharmony_ci 3373bf215546Sopenharmony_ci ADDR2_META_FLAGS dccKeyFlags; ///< DCC key flags 3374bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS colorFlags; ///< Color surface flags 3375bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Color surface type 3376bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Color surface swizzle mode 3377bf215546Sopenharmony_ci UINT_32 bpp; ///< bits per pixel 3378bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Color surface original width (of mip0) 3379bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Color surface original height (of mip0) 3380bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number of slices, of color surface (of mip0) 3381bf215546Sopenharmony_ci UINT_32 numFrags; ///< Fragment number of color surface 3382bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Total mipmap levels of color surface 3383bf215546Sopenharmony_ci UINT_32 dataSurfaceSize; ///< The padded size of all slices and mip levels 3384bf215546Sopenharmony_ci ///< useful in meta linear case 3385bf215546Sopenharmony_ci UINT_32 firstMipIdInTail; ///< The id of first mip in tail, if no mip is in tail, 3386bf215546Sopenharmony_ci /// it should be number of mip levels 3387bf215546Sopenharmony_ci /// Only for GFX10 3388bf215546Sopenharmony_ci} ADDR2_COMPUTE_DCCINFO_INPUT; 3389bf215546Sopenharmony_ci 3390bf215546Sopenharmony_ci/** 3391bf215546Sopenharmony_ci**************************************************************************************************** 3392bf215546Sopenharmony_ci* ADDR2_COMPUTE_DCCINFO_OUTPUT 3393bf215546Sopenharmony_ci* 3394bf215546Sopenharmony_ci* @brief 3395bf215546Sopenharmony_ci* Output structure of Addr2ComputeDccInfo 3396bf215546Sopenharmony_ci**************************************************************************************************** 3397bf215546Sopenharmony_ci*/ 3398bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_DCCINFO_OUTPUT 3399bf215546Sopenharmony_ci{ 3400bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3401bf215546Sopenharmony_ci 3402bf215546Sopenharmony_ci UINT_32 dccRamBaseAlign; ///< Base alignment of dcc key 3403bf215546Sopenharmony_ci UINT_32 dccRamSize; ///< Size of dcc key 3404bf215546Sopenharmony_ci 3405bf215546Sopenharmony_ci UINT_32 pitch; ///< DCC surface mip chain pitch 3406bf215546Sopenharmony_ci UINT_32 height; ///< DCC surface mip chain height 3407bf215546Sopenharmony_ci UINT_32 depth; ///< DCC surface mip chain depth 3408bf215546Sopenharmony_ci 3409bf215546Sopenharmony_ci UINT_32 compressBlkWidth; ///< DCC compress block width 3410bf215546Sopenharmony_ci UINT_32 compressBlkHeight; ///< DCC compress block height 3411bf215546Sopenharmony_ci UINT_32 compressBlkDepth; ///< DCC compress block depth 3412bf215546Sopenharmony_ci 3413bf215546Sopenharmony_ci UINT_32 metaBlkWidth; ///< DCC meta block width 3414bf215546Sopenharmony_ci UINT_32 metaBlkHeight; ///< DCC meta block height 3415bf215546Sopenharmony_ci UINT_32 metaBlkDepth; ///< DCC meta block depth 3416bf215546Sopenharmony_ci UINT_32 metaBlkSize; ///< DCC meta block size in bytes 3417bf215546Sopenharmony_ci UINT_32 metaBlkNumPerSlice; ///< Number of metablock within one slice 3418bf215546Sopenharmony_ci 3419bf215546Sopenharmony_ci union 3420bf215546Sopenharmony_ci { 3421bf215546Sopenharmony_ci UINT_32 fastClearSizePerSlice; ///< Size of DCC within a slice should be fast cleared 3422bf215546Sopenharmony_ci UINT_32 dccRamSliceSize; ///< DCC ram size per slice. For mipmap, it's 3423bf215546Sopenharmony_ci /// the slize size of a mip chain, the thickness of a 3424bf215546Sopenharmony_ci /// a slice is meta block depth 3425bf215546Sopenharmony_ci /// Only for GFX10 3426bf215546Sopenharmony_ci }; 3427bf215546Sopenharmony_ci 3428bf215546Sopenharmony_ci ADDR2_META_MIP_INFO* pMipInfo; ///< DCC mip information 3429bf215546Sopenharmony_ci 3430bf215546Sopenharmony_ci /* The equation for doing DCC address computations in shaders. */ 3431bf215546Sopenharmony_ci union { 3432bf215546Sopenharmony_ci /* This is chip-specific, and it varies with: 3433bf215546Sopenharmony_ci * - resource type 3434bf215546Sopenharmony_ci * - swizzle_mode 3435bf215546Sopenharmony_ci * - bpp 3436bf215546Sopenharmony_ci * - number of fragments 3437bf215546Sopenharmony_ci * - pipe_aligned 3438bf215546Sopenharmony_ci * - rb_aligned 3439bf215546Sopenharmony_ci */ 3440bf215546Sopenharmony_ci struct gfx9_addr_meta_equation gfx9; 3441bf215546Sopenharmony_ci 3442bf215546Sopenharmony_ci /* This is chip-specific, it requires 64KB_R_X, and it varies with: 3443bf215546Sopenharmony_ci * - bpp 3444bf215546Sopenharmony_ci * - pipe_aligned 3445bf215546Sopenharmony_ci */ 3446bf215546Sopenharmony_ci UINT_16 *gfx10_bits; /* 68 2-byte elements */ 3447bf215546Sopenharmony_ci } equation; 3448bf215546Sopenharmony_ci} ADDR2_COMPUTE_DCCINFO_OUTPUT; 3449bf215546Sopenharmony_ci 3450bf215546Sopenharmony_ci/** 3451bf215546Sopenharmony_ci**************************************************************************************************** 3452bf215546Sopenharmony_ci* Addr2ComputeDccInfo 3453bf215546Sopenharmony_ci* 3454bf215546Sopenharmony_ci* @brief 3455bf215546Sopenharmony_ci* Compute DCC key size, base alignment 3456bf215546Sopenharmony_ci* info 3457bf215546Sopenharmony_ci**************************************************************************************************** 3458bf215546Sopenharmony_ci*/ 3459bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeDccInfo( 3460bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3461bf215546Sopenharmony_ci const ADDR2_COMPUTE_DCCINFO_INPUT* pIn, 3462bf215546Sopenharmony_ci ADDR2_COMPUTE_DCCINFO_OUTPUT* pOut); 3463bf215546Sopenharmony_ci 3464bf215546Sopenharmony_ci 3465bf215546Sopenharmony_ci/** 3466bf215546Sopenharmony_ci**************************************************************************************************** 3467bf215546Sopenharmony_ci* ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT 3468bf215546Sopenharmony_ci* 3469bf215546Sopenharmony_ci* @brief 3470bf215546Sopenharmony_ci* Input structure for Addr2ComputeDccAddrFromCoord 3471bf215546Sopenharmony_ci* 3472bf215546Sopenharmony_ci**************************************************************************************************** 3473bf215546Sopenharmony_ci*/ 3474bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT 3475bf215546Sopenharmony_ci{ 3476bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3477bf215546Sopenharmony_ci 3478bf215546Sopenharmony_ci UINT_32 x; ///< X coordinate 3479bf215546Sopenharmony_ci UINT_32 y; ///< Y coordinate 3480bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slices 3481bf215546Sopenharmony_ci UINT_32 sample; ///< Index of samples, means fragment index for EQAA 3482bf215546Sopenharmony_ci UINT_32 mipId; ///< mipmap level id 3483bf215546Sopenharmony_ci 3484bf215546Sopenharmony_ci ADDR2_META_FLAGS dccKeyFlags; ///< DCC flags 3485bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS colorFlags; ///< Color surface flags 3486bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Color surface type 3487bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Color surface swizzle mode 3488bf215546Sopenharmony_ci UINT_32 bpp; ///< Color surface bits per pixel 3489bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Color surface original width (of mip0) 3490bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Color surface original height (of mip0) 3491bf215546Sopenharmony_ci UINT_32 numSlices; ///< Color surface original slices (of mip0) 3492bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Color surface mipmap levels 3493bf215546Sopenharmony_ci UINT_32 numFrags; ///< Color surface fragment number 3494bf215546Sopenharmony_ci 3495bf215546Sopenharmony_ci UINT_32 pipeXor; ///< pipe Xor setting 3496bf215546Sopenharmony_ci UINT_32 pitch; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::pitch 3497bf215546Sopenharmony_ci UINT_32 height; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::height 3498bf215546Sopenharmony_ci UINT_32 compressBlkWidth; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::compressBlkWidth 3499bf215546Sopenharmony_ci UINT_32 compressBlkHeight; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::compressBlkHeight 3500bf215546Sopenharmony_ci UINT_32 compressBlkDepth; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::compressBlkDepth 3501bf215546Sopenharmony_ci UINT_32 metaBlkWidth; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::metaBlkWidth 3502bf215546Sopenharmony_ci UINT_32 metaBlkHeight; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::metaBlkHeight 3503bf215546Sopenharmony_ci UINT_32 metaBlkDepth; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::metaBlkDepth 3504bf215546Sopenharmony_ci UINT_32 dccRamSliceSize; ///< ADDR2_COMPUTE_DCC_INFO_OUTPUT::dccRamSliceSize 3505bf215546Sopenharmony_ci} ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT; 3506bf215546Sopenharmony_ci 3507bf215546Sopenharmony_ci/** 3508bf215546Sopenharmony_ci**************************************************************************************************** 3509bf215546Sopenharmony_ci* ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT 3510bf215546Sopenharmony_ci* 3511bf215546Sopenharmony_ci* @brief 3512bf215546Sopenharmony_ci* Output structure for Addr2ComputeDccAddrFromCoord 3513bf215546Sopenharmony_ci**************************************************************************************************** 3514bf215546Sopenharmony_ci*/ 3515bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT 3516bf215546Sopenharmony_ci{ 3517bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3518bf215546Sopenharmony_ci 3519bf215546Sopenharmony_ci UINT_64 addr; ///< DCC address in bytes 3520bf215546Sopenharmony_ci} ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT; 3521bf215546Sopenharmony_ci 3522bf215546Sopenharmony_ci/** 3523bf215546Sopenharmony_ci**************************************************************************************************** 3524bf215546Sopenharmony_ci* Addr2ComputeDccAddrFromCoord 3525bf215546Sopenharmony_ci* 3526bf215546Sopenharmony_ci* @brief 3527bf215546Sopenharmony_ci* Compute DCC address according to coordinates (of MSAA color buffer) 3528bf215546Sopenharmony_ci**************************************************************************************************** 3529bf215546Sopenharmony_ci*/ 3530bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeDccAddrFromCoord( 3531bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3532bf215546Sopenharmony_ci const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT* pIn, 3533bf215546Sopenharmony_ci ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT* pOut); 3534bf215546Sopenharmony_ci 3535bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 3536bf215546Sopenharmony_ci// Misc functions for Gfx9 3537bf215546Sopenharmony_ci//////////////////////////////////////////////////////////////////////////////////////////////////// 3538bf215546Sopenharmony_ci 3539bf215546Sopenharmony_ci/** 3540bf215546Sopenharmony_ci**************************************************************************************************** 3541bf215546Sopenharmony_ci* ADDR2_COMPUTE_PIPEBANKXOR_INPUT 3542bf215546Sopenharmony_ci* 3543bf215546Sopenharmony_ci* @brief 3544bf215546Sopenharmony_ci* Input structure of Addr2ComputePipebankXor 3545bf215546Sopenharmony_ci**************************************************************************************************** 3546bf215546Sopenharmony_ci*/ 3547bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_PIPEBANKXOR_INPUT 3548bf215546Sopenharmony_ci{ 3549bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3550bf215546Sopenharmony_ci UINT_32 surfIndex; ///< Input surface index 3551bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS flags; ///< Surface flag 3552bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Surface swizzle mode 3553bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Surface resource type 3554bf215546Sopenharmony_ci AddrFormat format; ///< Surface format 3555bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 3556bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 3557bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 3558bf215546Sopenharmony_ci /// number of fragments for EQAA 3559bf215546Sopenharmony_ci} ADDR2_COMPUTE_PIPEBANKXOR_INPUT; 3560bf215546Sopenharmony_ci 3561bf215546Sopenharmony_ci/** 3562bf215546Sopenharmony_ci**************************************************************************************************** 3563bf215546Sopenharmony_ci* ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT 3564bf215546Sopenharmony_ci* 3565bf215546Sopenharmony_ci* @brief 3566bf215546Sopenharmony_ci* Output structure of Addr2ComputePipebankXor 3567bf215546Sopenharmony_ci**************************************************************************************************** 3568bf215546Sopenharmony_ci*/ 3569bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT 3570bf215546Sopenharmony_ci{ 3571bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3572bf215546Sopenharmony_ci UINT_32 pipeBankXor; ///< Pipe bank xor 3573bf215546Sopenharmony_ci} ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT; 3574bf215546Sopenharmony_ci 3575bf215546Sopenharmony_ci/** 3576bf215546Sopenharmony_ci**************************************************************************************************** 3577bf215546Sopenharmony_ci* Addr2ComputePipeBankXor 3578bf215546Sopenharmony_ci* 3579bf215546Sopenharmony_ci* @brief 3580bf215546Sopenharmony_ci* Calculate a valid bank pipe xor value for client to use. 3581bf215546Sopenharmony_ci**************************************************************************************************** 3582bf215546Sopenharmony_ci*/ 3583bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputePipeBankXor( 3584bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3585bf215546Sopenharmony_ci const ADDR2_COMPUTE_PIPEBANKXOR_INPUT* pIn, 3586bf215546Sopenharmony_ci ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT* pOut); 3587bf215546Sopenharmony_ci 3588bf215546Sopenharmony_ci/** 3589bf215546Sopenharmony_ci**************************************************************************************************** 3590bf215546Sopenharmony_ci* ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT 3591bf215546Sopenharmony_ci* 3592bf215546Sopenharmony_ci* @brief 3593bf215546Sopenharmony_ci* Input structure of Addr2ComputeSlicePipeBankXor 3594bf215546Sopenharmony_ci**************************************************************************************************** 3595bf215546Sopenharmony_ci*/ 3596bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT 3597bf215546Sopenharmony_ci{ 3598bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3599bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Surface swizzle mode 3600bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Surface resource type 3601bf215546Sopenharmony_ci UINT_32 bpe; ///< bits per element (e.g. block size for BCn format) 3602bf215546Sopenharmony_ci UINT_32 basePipeBankXor; ///< Base pipe bank xor 3603bf215546Sopenharmony_ci UINT_32 slice; ///< Slice id 3604bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 3605bf215546Sopenharmony_ci} ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT; 3606bf215546Sopenharmony_ci 3607bf215546Sopenharmony_ci/** 3608bf215546Sopenharmony_ci**************************************************************************************************** 3609bf215546Sopenharmony_ci* ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT 3610bf215546Sopenharmony_ci* 3611bf215546Sopenharmony_ci* @brief 3612bf215546Sopenharmony_ci* Output structure of Addr2ComputeSlicePipeBankXor 3613bf215546Sopenharmony_ci**************************************************************************************************** 3614bf215546Sopenharmony_ci*/ 3615bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT 3616bf215546Sopenharmony_ci{ 3617bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3618bf215546Sopenharmony_ci UINT_32 pipeBankXor; ///< Pipe bank xor 3619bf215546Sopenharmony_ci} ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT; 3620bf215546Sopenharmony_ci 3621bf215546Sopenharmony_ci/** 3622bf215546Sopenharmony_ci**************************************************************************************************** 3623bf215546Sopenharmony_ci* Addr2ComputeSlicePipeBankXor 3624bf215546Sopenharmony_ci* 3625bf215546Sopenharmony_ci* @brief 3626bf215546Sopenharmony_ci* Calculate slice pipe bank xor value based on base pipe bank xor and slice id. 3627bf215546Sopenharmony_ci**************************************************************************************************** 3628bf215546Sopenharmony_ci*/ 3629bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeSlicePipeBankXor( 3630bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3631bf215546Sopenharmony_ci const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT* pIn, 3632bf215546Sopenharmony_ci ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT* pOut); 3633bf215546Sopenharmony_ci 3634bf215546Sopenharmony_ci/** 3635bf215546Sopenharmony_ci**************************************************************************************************** 3636bf215546Sopenharmony_ci* ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT 3637bf215546Sopenharmony_ci* 3638bf215546Sopenharmony_ci* @brief 3639bf215546Sopenharmony_ci* Input structure of Addr2ComputeSubResourceOffsetForSwizzlePattern 3640bf215546Sopenharmony_ci**************************************************************************************************** 3641bf215546Sopenharmony_ci*/ 3642bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT 3643bf215546Sopenharmony_ci{ 3644bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3645bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Surface swizzle mode 3646bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Surface resource type 3647bf215546Sopenharmony_ci UINT_32 pipeBankXor; ///< Per resource xor 3648bf215546Sopenharmony_ci UINT_32 slice; ///< Slice id 3649bf215546Sopenharmony_ci UINT_64 sliceSize; ///< Slice size of a mip chain 3650bf215546Sopenharmony_ci UINT_64 macroBlockOffset; ///< Macro block offset, returned in ADDR2_MIP_INFO 3651bf215546Sopenharmony_ci UINT_32 mipTailOffset; ///< Mip tail offset, returned in ADDR2_MIP_INFO 3652bf215546Sopenharmony_ci} ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT; 3653bf215546Sopenharmony_ci 3654bf215546Sopenharmony_ci/** 3655bf215546Sopenharmony_ci**************************************************************************************************** 3656bf215546Sopenharmony_ci* ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT 3657bf215546Sopenharmony_ci* 3658bf215546Sopenharmony_ci* @brief 3659bf215546Sopenharmony_ci* Output structure of Addr2ComputeSubResourceOffsetForSwizzlePattern 3660bf215546Sopenharmony_ci**************************************************************************************************** 3661bf215546Sopenharmony_ci*/ 3662bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT 3663bf215546Sopenharmony_ci{ 3664bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3665bf215546Sopenharmony_ci UINT_64 offset; ///< offset 3666bf215546Sopenharmony_ci} ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT; 3667bf215546Sopenharmony_ci 3668bf215546Sopenharmony_ci/** 3669bf215546Sopenharmony_ci**************************************************************************************************** 3670bf215546Sopenharmony_ci* Addr2ComputeSubResourceOffsetForSwizzlePattern 3671bf215546Sopenharmony_ci* 3672bf215546Sopenharmony_ci* @brief 3673bf215546Sopenharmony_ci* Calculate sub resource offset to support swizzle pattern. 3674bf215546Sopenharmony_ci**************************************************************************************************** 3675bf215546Sopenharmony_ci*/ 3676bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeSubResourceOffsetForSwizzlePattern( 3677bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3678bf215546Sopenharmony_ci const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT* pIn, 3679bf215546Sopenharmony_ci ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT* pOut); 3680bf215546Sopenharmony_ci 3681bf215546Sopenharmony_ci/** 3682bf215546Sopenharmony_ci**************************************************************************************************** 3683bf215546Sopenharmony_ci* ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_INPUT 3684bf215546Sopenharmony_ci* 3685bf215546Sopenharmony_ci* @brief 3686bf215546Sopenharmony_ci* Input structure of Addr2ComputeNonBlockCompressedView 3687bf215546Sopenharmony_ci**************************************************************************************************** 3688bf215546Sopenharmony_ci*/ 3689bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_INPUT 3690bf215546Sopenharmony_ci{ 3691bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3692bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS flags; ///< Surface flags 3693bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Swizzle Mode for Gfx9 3694bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Surface type 3695bf215546Sopenharmony_ci AddrFormat format; ///< Surface format 3696bf215546Sopenharmony_ci UINT_32 width; ///< Width of mip0 in texels (not in compressed block) 3697bf215546Sopenharmony_ci UINT_32 height; ///< Height of mip0 in texels (not in compressed block) 3698bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number surface slice/depth of mip0 3699bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Total mipmap levels. 3700bf215546Sopenharmony_ci UINT_32 pipeBankXor; ///< Combined swizzle used to do bank/pipe rotation 3701bf215546Sopenharmony_ci UINT_32 slice; ///< Index of slice to view 3702bf215546Sopenharmony_ci UINT_32 mipId; ///< Id of mip to view 3703bf215546Sopenharmony_ci} ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_INPUT; 3704bf215546Sopenharmony_ci 3705bf215546Sopenharmony_ci/** 3706bf215546Sopenharmony_ci**************************************************************************************************** 3707bf215546Sopenharmony_ci* ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_OUTPUT 3708bf215546Sopenharmony_ci* 3709bf215546Sopenharmony_ci* @brief 3710bf215546Sopenharmony_ci* Output structure of Addr2ComputeNonBlockCompressedView 3711bf215546Sopenharmony_ci**************************************************************************************************** 3712bf215546Sopenharmony_ci*/ 3713bf215546Sopenharmony_citypedef struct _ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_OUTPUT 3714bf215546Sopenharmony_ci{ 3715bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3716bf215546Sopenharmony_ci UINT_64 offset; ///< Offset shifted from resource base for the view 3717bf215546Sopenharmony_ci UINT_32 pipeBankXor; ///< Pipe bank xor for the view 3718bf215546Sopenharmony_ci UINT_32 unalignedWidth; ///< Mip0 width (in element) for the view 3719bf215546Sopenharmony_ci UINT_32 unalignedHeight; ///< Mip0 height (in element) for the view 3720bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Total mipmap levels for the view 3721bf215546Sopenharmony_ci UINT_32 mipId; ///< Mip ID for the view 3722bf215546Sopenharmony_ci} ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_OUTPUT; 3723bf215546Sopenharmony_ci 3724bf215546Sopenharmony_ci/** 3725bf215546Sopenharmony_ci**************************************************************************************************** 3726bf215546Sopenharmony_ci* Addr2ComputeNonBlockCompressedView 3727bf215546Sopenharmony_ci* 3728bf215546Sopenharmony_ci* @brief 3729bf215546Sopenharmony_ci* Compute non-block-compressed view for a given mipmap level/slice 3730bf215546Sopenharmony_ci**************************************************************************************************** 3731bf215546Sopenharmony_ci*/ 3732bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2ComputeNonBlockCompressedView( 3733bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3734bf215546Sopenharmony_ci const ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_INPUT* pIn, 3735bf215546Sopenharmony_ci ADDR2_COMPUTE_NONBLOCKCOMPRESSEDVIEW_OUTPUT* pOut); 3736bf215546Sopenharmony_ci 3737bf215546Sopenharmony_ci/** 3738bf215546Sopenharmony_ci**************************************************************************************************** 3739bf215546Sopenharmony_ci* ADDR2_BLOCK_SET 3740bf215546Sopenharmony_ci* 3741bf215546Sopenharmony_ci* @brief 3742bf215546Sopenharmony_ci* Bit field that defines block type 3743bf215546Sopenharmony_ci**************************************************************************************************** 3744bf215546Sopenharmony_ci*/ 3745bf215546Sopenharmony_citypedef union _ADDR2_BLOCK_SET 3746bf215546Sopenharmony_ci{ 3747bf215546Sopenharmony_ci struct 3748bf215546Sopenharmony_ci { 3749bf215546Sopenharmony_ci UINT_32 micro : 1; // 256B block for 2D resource 3750bf215546Sopenharmony_ci UINT_32 macroThin4KB : 1; // Thin 4KB for 2D/3D resource 3751bf215546Sopenharmony_ci UINT_32 macroThick4KB : 1; // Thick 4KB for 3D resource 3752bf215546Sopenharmony_ci UINT_32 macroThin64KB : 1; // Thin 64KB for 2D/3D resource 3753bf215546Sopenharmony_ci UINT_32 macroThick64KB : 1; // Thick 64KB for 3D resource 3754bf215546Sopenharmony_ci UINT_32 var : 1; // VAR block 3755bf215546Sopenharmony_ci UINT_32 : 1; 3756bf215546Sopenharmony_ci UINT_32 linear : 1; // Linear block 3757bf215546Sopenharmony_ci UINT_32 reserved : 24; 3758bf215546Sopenharmony_ci }; 3759bf215546Sopenharmony_ci 3760bf215546Sopenharmony_ci struct 3761bf215546Sopenharmony_ci { 3762bf215546Sopenharmony_ci UINT_32 : 5; 3763bf215546Sopenharmony_ci UINT_32 thin256KB : 1; // Thin 256KB block 3764bf215546Sopenharmony_ci UINT_32 thick256KB : 1; // Thick 256KB block 3765bf215546Sopenharmony_ci UINT_32 : 25; 3766bf215546Sopenharmony_ci } gfx11; 3767bf215546Sopenharmony_ci 3768bf215546Sopenharmony_ci UINT_32 value; 3769bf215546Sopenharmony_ci} ADDR2_BLOCK_SET; 3770bf215546Sopenharmony_ci 3771bf215546Sopenharmony_ci/** 3772bf215546Sopenharmony_ci**************************************************************************************************** 3773bf215546Sopenharmony_ci* ADDR2_SWTYPE_SET 3774bf215546Sopenharmony_ci* 3775bf215546Sopenharmony_ci* @brief 3776bf215546Sopenharmony_ci* Bit field that defines swizzle type 3777bf215546Sopenharmony_ci**************************************************************************************************** 3778bf215546Sopenharmony_ci*/ 3779bf215546Sopenharmony_citypedef union _ADDR2_SWTYPE_SET 3780bf215546Sopenharmony_ci{ 3781bf215546Sopenharmony_ci struct 3782bf215546Sopenharmony_ci { 3783bf215546Sopenharmony_ci UINT_32 sw_Z : 1; // SW_*_Z_* 3784bf215546Sopenharmony_ci UINT_32 sw_S : 1; // SW_*_S_* 3785bf215546Sopenharmony_ci UINT_32 sw_D : 1; // SW_*_D_* 3786bf215546Sopenharmony_ci UINT_32 sw_R : 1; // SW_*_R_* 3787bf215546Sopenharmony_ci UINT_32 reserved : 28; 3788bf215546Sopenharmony_ci }; 3789bf215546Sopenharmony_ci 3790bf215546Sopenharmony_ci UINT_32 value; 3791bf215546Sopenharmony_ci} ADDR2_SWTYPE_SET; 3792bf215546Sopenharmony_ci 3793bf215546Sopenharmony_ci/** 3794bf215546Sopenharmony_ci**************************************************************************************************** 3795bf215546Sopenharmony_ci* ADDR2_SWMODE_SET 3796bf215546Sopenharmony_ci* 3797bf215546Sopenharmony_ci* @brief 3798bf215546Sopenharmony_ci* Bit field that defines swizzle type 3799bf215546Sopenharmony_ci**************************************************************************************************** 3800bf215546Sopenharmony_ci*/ 3801bf215546Sopenharmony_citypedef union _ADDR2_SWMODE_SET 3802bf215546Sopenharmony_ci{ 3803bf215546Sopenharmony_ci struct 3804bf215546Sopenharmony_ci { 3805bf215546Sopenharmony_ci UINT_32 swLinear : 1; 3806bf215546Sopenharmony_ci UINT_32 sw256B_S : 1; 3807bf215546Sopenharmony_ci UINT_32 sw256B_D : 1; 3808bf215546Sopenharmony_ci UINT_32 sw256B_R : 1; 3809bf215546Sopenharmony_ci UINT_32 sw4KB_Z : 1; 3810bf215546Sopenharmony_ci UINT_32 sw4KB_S : 1; 3811bf215546Sopenharmony_ci UINT_32 sw4KB_D : 1; 3812bf215546Sopenharmony_ci UINT_32 sw4KB_R : 1; 3813bf215546Sopenharmony_ci UINT_32 sw64KB_Z : 1; 3814bf215546Sopenharmony_ci UINT_32 sw64KB_S : 1; 3815bf215546Sopenharmony_ci UINT_32 sw64KB_D : 1; 3816bf215546Sopenharmony_ci UINT_32 sw64KB_R : 1; 3817bf215546Sopenharmony_ci UINT_32 swMiscDef12 : 1; 3818bf215546Sopenharmony_ci UINT_32 swMiscDef13 : 1; 3819bf215546Sopenharmony_ci UINT_32 swMiscDef14 : 1; 3820bf215546Sopenharmony_ci UINT_32 swMiscDef15 : 1; 3821bf215546Sopenharmony_ci UINT_32 sw64KB_Z_T : 1; 3822bf215546Sopenharmony_ci UINT_32 sw64KB_S_T : 1; 3823bf215546Sopenharmony_ci UINT_32 sw64KB_D_T : 1; 3824bf215546Sopenharmony_ci UINT_32 sw64KB_R_T : 1; 3825bf215546Sopenharmony_ci UINT_32 sw4KB_Z_X : 1; 3826bf215546Sopenharmony_ci UINT_32 sw4KB_S_X : 1; 3827bf215546Sopenharmony_ci UINT_32 sw4KB_D_X : 1; 3828bf215546Sopenharmony_ci UINT_32 sw4KB_R_X : 1; 3829bf215546Sopenharmony_ci UINT_32 sw64KB_Z_X : 1; 3830bf215546Sopenharmony_ci UINT_32 sw64KB_S_X : 1; 3831bf215546Sopenharmony_ci UINT_32 sw64KB_D_X : 1; 3832bf215546Sopenharmony_ci UINT_32 sw64KB_R_X : 1; 3833bf215546Sopenharmony_ci UINT_32 swMiscDef28 : 1; 3834bf215546Sopenharmony_ci UINT_32 swMiscDef29 : 1; 3835bf215546Sopenharmony_ci UINT_32 swMiscDef30 : 1; 3836bf215546Sopenharmony_ci UINT_32 swMiscDef31 : 1; 3837bf215546Sopenharmony_ci }; 3838bf215546Sopenharmony_ci 3839bf215546Sopenharmony_ci struct 3840bf215546Sopenharmony_ci { 3841bf215546Sopenharmony_ci UINT_32 : 28; 3842bf215546Sopenharmony_ci UINT_32 swVar_Z_X : 1; 3843bf215546Sopenharmony_ci UINT_32 : 2; 3844bf215546Sopenharmony_ci UINT_32 swVar_R_X : 1; 3845bf215546Sopenharmony_ci } gfx10; 3846bf215546Sopenharmony_ci 3847bf215546Sopenharmony_ci struct 3848bf215546Sopenharmony_ci { 3849bf215546Sopenharmony_ci UINT_32 : 28; 3850bf215546Sopenharmony_ci UINT_32 sw256KB_Z_X : 1; 3851bf215546Sopenharmony_ci UINT_32 sw256KB_S_X : 1; 3852bf215546Sopenharmony_ci UINT_32 sw256KB_D_X : 1; 3853bf215546Sopenharmony_ci UINT_32 sw256KB_R_X : 1; 3854bf215546Sopenharmony_ci } gfx11; 3855bf215546Sopenharmony_ci 3856bf215546Sopenharmony_ci UINT_32 value; 3857bf215546Sopenharmony_ci} ADDR2_SWMODE_SET; 3858bf215546Sopenharmony_ci 3859bf215546Sopenharmony_ci/** 3860bf215546Sopenharmony_ci**************************************************************************************************** 3861bf215546Sopenharmony_ci* ADDR2_GET_PREFERRED_SURF_SETTING_INPUT 3862bf215546Sopenharmony_ci* 3863bf215546Sopenharmony_ci* @brief 3864bf215546Sopenharmony_ci* Input structure of Addr2GetPreferredSurfaceSetting 3865bf215546Sopenharmony_ci**************************************************************************************************** 3866bf215546Sopenharmony_ci*/ 3867bf215546Sopenharmony_citypedef struct _ADDR2_GET_PREFERRED_SURF_SETTING_INPUT 3868bf215546Sopenharmony_ci{ 3869bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3870bf215546Sopenharmony_ci 3871bf215546Sopenharmony_ci ADDR2_SURFACE_FLAGS flags; ///< Surface flags 3872bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Surface type 3873bf215546Sopenharmony_ci AddrFormat format; ///< Surface format 3874bf215546Sopenharmony_ci AddrResrouceLocation resourceLoction; ///< Surface heap choice 3875bf215546Sopenharmony_ci ADDR2_BLOCK_SET forbiddenBlock; ///< Client can use it to disable some block setting 3876bf215546Sopenharmony_ci ///< such as linear for DXTn, tiled for YUV 3877bf215546Sopenharmony_ci ADDR2_SWTYPE_SET preferredSwSet; ///< Client can use it to specify sw type(s) wanted 3878bf215546Sopenharmony_ci BOOL_32 noXor; ///< Do not use xor mode for this resource 3879bf215546Sopenharmony_ci UINT_32 bpp; ///< bits per pixel 3880bf215546Sopenharmony_ci UINT_32 width; ///< Width (of mip0), in pixels 3881bf215546Sopenharmony_ci UINT_32 height; ///< Height (of mip0), in pixels 3882bf215546Sopenharmony_ci UINT_32 numSlices; ///< Number surface slice/depth (of mip0), 3883bf215546Sopenharmony_ci UINT_32 numMipLevels; ///< Total mipmap levels. 3884bf215546Sopenharmony_ci UINT_32 numSamples; ///< Number of samples 3885bf215546Sopenharmony_ci UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 3886bf215546Sopenharmony_ci /// number of samples for normal AA; Set it to the 3887bf215546Sopenharmony_ci /// number of fragments for EQAA 3888bf215546Sopenharmony_ci UINT_32 maxAlign; ///< maximum base/size alignment requested by client 3889bf215546Sopenharmony_ci UINT_32 minSizeAlign; ///< memory allocated for surface in client driver will 3890bf215546Sopenharmony_ci /// be padded to multiple of this value (in bytes) 3891bf215546Sopenharmony_ci DOUBLE memoryBudget; ///< Memory consumption ratio based on minimum possible 3892bf215546Sopenharmony_ci /// size. 3893bf215546Sopenharmony_ci} ADDR2_GET_PREFERRED_SURF_SETTING_INPUT; 3894bf215546Sopenharmony_ci 3895bf215546Sopenharmony_ci/** 3896bf215546Sopenharmony_ci**************************************************************************************************** 3897bf215546Sopenharmony_ci* ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT 3898bf215546Sopenharmony_ci* 3899bf215546Sopenharmony_ci* @brief 3900bf215546Sopenharmony_ci* Output structure of Addr2GetPreferredSurfaceSetting 3901bf215546Sopenharmony_ci**************************************************************************************************** 3902bf215546Sopenharmony_ci*/ 3903bf215546Sopenharmony_citypedef struct _ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT 3904bf215546Sopenharmony_ci{ 3905bf215546Sopenharmony_ci UINT_32 size; ///< Size of this structure in bytes 3906bf215546Sopenharmony_ci 3907bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode; ///< Suggested swizzle mode to be used 3908bf215546Sopenharmony_ci AddrResourceType resourceType; ///< Suggested resource type to program HW 3909bf215546Sopenharmony_ci ADDR2_BLOCK_SET validBlockSet; ///< Valid block type bit conbination 3910bf215546Sopenharmony_ci BOOL_32 canXor; ///< If client can use xor on a valid macro block 3911bf215546Sopenharmony_ci /// type 3912bf215546Sopenharmony_ci ADDR2_SWTYPE_SET validSwTypeSet; ///< Valid swizzle type bit combination 3913bf215546Sopenharmony_ci ADDR2_SWTYPE_SET clientPreferredSwSet; ///< Client-preferred swizzle type bit combination 3914bf215546Sopenharmony_ci ADDR2_SWMODE_SET validSwModeSet; ///< Valid swizzle mode bit combination 3915bf215546Sopenharmony_ci} ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT; 3916bf215546Sopenharmony_ci 3917bf215546Sopenharmony_ci/** 3918bf215546Sopenharmony_ci**************************************************************************************************** 3919bf215546Sopenharmony_ci* Addr2GetPreferredSurfaceSetting 3920bf215546Sopenharmony_ci* 3921bf215546Sopenharmony_ci* @brief 3922bf215546Sopenharmony_ci* Suggest a preferred setting for client driver to program HW register 3923bf215546Sopenharmony_ci**************************************************************************************************** 3924bf215546Sopenharmony_ci*/ 3925bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2GetPreferredSurfaceSetting( 3926bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3927bf215546Sopenharmony_ci const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT* pIn, 3928bf215546Sopenharmony_ci ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT* pOut); 3929bf215546Sopenharmony_ci 3930bf215546Sopenharmony_ci/** 3931bf215546Sopenharmony_ci**************************************************************************************************** 3932bf215546Sopenharmony_ci* Addr2IsValidDisplaySwizzleMode 3933bf215546Sopenharmony_ci* 3934bf215546Sopenharmony_ci* @brief 3935bf215546Sopenharmony_ci* Return whether the swizzle mode is supported by display engine 3936bf215546Sopenharmony_ci**************************************************************************************************** 3937bf215546Sopenharmony_ci*/ 3938bf215546Sopenharmony_ciADDR_E_RETURNCODE ADDR_API Addr2IsValidDisplaySwizzleMode( 3939bf215546Sopenharmony_ci ADDR_HANDLE hLib, 3940bf215546Sopenharmony_ci AddrSwizzleMode swizzleMode, 3941bf215546Sopenharmony_ci UINT_32 bpp, 3942bf215546Sopenharmony_ci BOOL_32 *pResult); 3943bf215546Sopenharmony_ci 3944bf215546Sopenharmony_ci#if defined(__cplusplus) 3945bf215546Sopenharmony_ci} 3946bf215546Sopenharmony_ci#endif 3947bf215546Sopenharmony_ci 3948bf215546Sopenharmony_ci#endif // __ADDR_INTERFACE_H__ 3949