1 /* 2 * Copyright © 2014 Advanced Micro Devices, Inc. 3 * All Rights Reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining 6 * a copy of this software and associated documentation files (the 7 * "Software"), to deal in the Software without restriction, including 8 * without limitation the rights to use, copy, modify, merge, publish, 9 * distribute, sub license, and/or sell copies of the Software, and to 10 * permit persons to whom the Software is furnished to do so, subject to 11 * the following conditions: 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 15 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 16 * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS 17 * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 20 * USE OR OTHER DEALINGS IN THE SOFTWARE. 21 * 22 * The above copyright notice and this permission notice (including the 23 * next paragraph) shall be included in all copies or substantial portions 24 * of the Software. 25 */ 26 27 /** 28 *************************************************************************************************** 29 * @file addrinterface.h 30 * @brief Contains the addrlib interfaces declaration and parameter defines 31 *************************************************************************************************** 32 */ 33 #ifndef __ADDR_INTERFACE_H__ 34 #define __ADDR_INTERFACE_H__ 35 36 #include "addrtypes.h" 37 38 #if defined(__cplusplus) 39 extern "C" 40 { 41 #endif 42 43 #define ADDRLIB_VERSION_MAJOR 5 44 #define ADDRLIB_VERSION_MINOR 25 45 #define ADDRLIB_VERSION ((ADDRLIB_VERSION_MAJOR << 16) | ADDRLIB_VERSION_MINOR) 46 47 /// Virtually all interface functions need ADDR_HANDLE as first parameter 48 typedef VOID* ADDR_HANDLE; 49 50 /// Client handle used in callbacks 51 typedef VOID* ADDR_CLIENT_HANDLE; 52 53 /** 54 * ///////////////////////////////////////////////////////////////////////////////////////////////// 55 * // Callback functions 56 * ///////////////////////////////////////////////////////////////////////////////////////////////// 57 * typedef VOID* (ADDR_API* ADDR_ALLOCSYSMEM)( 58 * const ADDR_ALLOCSYSMEM_INPUT* pInput); 59 * typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_FREESYSMEM)( 60 * VOID* pVirtAddr); 61 * typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)( 62 * const ADDR_DEBUGPRINT_INPUT* pInput); 63 * 64 * ///////////////////////////////////////////////////////////////////////////////////////////////// 65 * // Create/Destroy/Config functions 66 * ///////////////////////////////////////////////////////////////////////////////////////////////// 67 * AddrCreate() 68 * AddrDestroy() 69 * 70 * ///////////////////////////////////////////////////////////////////////////////////////////////// 71 * // Surface functions 72 * ///////////////////////////////////////////////////////////////////////////////////////////////// 73 * AddrComputeSurfaceInfo() 74 * AddrComputeSurfaceAddrFromCoord() 75 * AddrComputeSurfaceCoordFromAddr() 76 * 77 * ///////////////////////////////////////////////////////////////////////////////////////////////// 78 * // HTile functions 79 * ///////////////////////////////////////////////////////////////////////////////////////////////// 80 * AddrComputeHtileInfo() 81 * AddrComputeHtileAddrFromCoord() 82 * AddrComputeHtileCoordFromAddr() 83 * 84 * ///////////////////////////////////////////////////////////////////////////////////////////////// 85 * // C-mask functions 86 * ///////////////////////////////////////////////////////////////////////////////////////////////// 87 * AddrComputeCmaskInfo() 88 * AddrComputeCmaskAddrFromCoord() 89 * AddrComputeCmaskCoordFromAddr() 90 * 91 * ///////////////////////////////////////////////////////////////////////////////////////////////// 92 * // F-mask functions 93 * ///////////////////////////////////////////////////////////////////////////////////////////////// 94 * AddrComputeFmaskInfo() 95 * AddrComputeFmaskAddrFromCoord() 96 * AddrComputeFmaskCoordFromAddr() 97 * 98 * ///////////////////////////////////////////////////////////////////////////////////////////////// 99 * // Element/Utility functions 100 * ///////////////////////////////////////////////////////////////////////////////////////////////// 101 * ElemFlt32ToDepthPixel() 102 * ElemFlt32ToColorPixel() 103 * AddrExtractBankPipeSwizzle() 104 * AddrCombineBankPipeSwizzle() 105 * AddrComputeSliceSwizzle() 106 * AddrConvertTileInfoToHW() 107 * AddrConvertTileIndex() 108 * AddrConvertTileIndex1() 109 * AddrGetTileIndex() 110 * AddrComputeBaseSwizzle() 111 * AddrUseTileIndex() 112 * AddrUseCombinedSwizzle() 113 * 114 * ///////////////////////////////////////////////////////////////////////////////////////////////// 115 * // Dump functions 116 * ///////////////////////////////////////////////////////////////////////////////////////////////// 117 * AddrDumpSurfaceInfo() 118 * AddrDumpFmaskInfo() 119 * AddrDumpCmaskInfo() 120 * AddrDumpHtileInfo() 121 * 122 **/ 123 124 /////////////////////////////////////////////////////////////////////////////////////////////////// 125 // Callback functions 126 /////////////////////////////////////////////////////////////////////////////////////////////////// 127 128 /** 129 *************************************************************************************************** 130 * @brief Alloc system memory flags. 131 * @note These flags are reserved for future use and if flags are added will minimize the impact 132 * of the client. 133 *************************************************************************************************** 134 */ 135 typedef union _ADDR_ALLOCSYSMEM_FLAGS 136 { 137 struct 138 { 139 UINT_32 reserved : 32; ///< Reserved for future use. 140 } fields; 141 UINT_32 value; 142 143 } ADDR_ALLOCSYSMEM_FLAGS; 144 145 /** 146 *************************************************************************************************** 147 * @brief Alloc system memory input structure 148 *************************************************************************************************** 149 */ 150 typedef struct _ADDR_ALLOCSYSMEM_INPUT 151 { 152 UINT_32 size; ///< Size of this structure in bytes 153 154 ADDR_ALLOCSYSMEM_FLAGS flags; ///< System memory flags. 155 UINT_32 sizeInBytes; ///< System memory allocation size in bytes. 156 ADDR_CLIENT_HANDLE hClient; ///< Client handle 157 } ADDR_ALLOCSYSMEM_INPUT; 158 159 /** 160 *************************************************************************************************** 161 * ADDR_ALLOCSYSMEM 162 * @brief 163 * Allocate system memory callback function. Returns valid pointer on success. 164 *************************************************************************************************** 165 */ 166 typedef VOID* (ADDR_API* ADDR_ALLOCSYSMEM)( 167 const ADDR_ALLOCSYSMEM_INPUT* pInput); 168 169 /** 170 *************************************************************************************************** 171 * @brief Free system memory input structure 172 *************************************************************************************************** 173 */ 174 typedef struct _ADDR_FREESYSMEM_INPUT 175 { 176 UINT_32 size; ///< Size of this structure in bytes 177 178 VOID* pVirtAddr; ///< Virtual address 179 ADDR_CLIENT_HANDLE hClient; ///< Client handle 180 } ADDR_FREESYSMEM_INPUT; 181 182 /** 183 *************************************************************************************************** 184 * ADDR_FREESYSMEM 185 * @brief 186 * Free system memory callback function. 187 * Returns ADDR_OK on success. 188 *************************************************************************************************** 189 */ 190 typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_FREESYSMEM)( 191 const ADDR_FREESYSMEM_INPUT* pInput); 192 193 /** 194 *************************************************************************************************** 195 * @brief Print debug message input structure 196 *************************************************************************************************** 197 */ 198 typedef struct _ADDR_DEBUGPRINT_INPUT 199 { 200 UINT_32 size; ///< Size of this structure in bytes 201 202 CHAR* pDebugString; ///< Debug print string 203 va_list ap; ///< Variable argument list 204 ADDR_CLIENT_HANDLE hClient; ///< Client handle 205 } ADDR_DEBUGPRINT_INPUT; 206 207 /** 208 *************************************************************************************************** 209 * ADDR_DEBUGPRINT 210 * @brief 211 * Print debug message callback function. 212 * Returns ADDR_OK on success. 213 *************************************************************************************************** 214 */ 215 typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)( 216 const ADDR_DEBUGPRINT_INPUT* pInput); 217 218 /** 219 *************************************************************************************************** 220 * ADDR_CALLBACKS 221 * 222 * @brief 223 * Address Library needs client to provide system memory alloc/free routines. 224 *************************************************************************************************** 225 */ 226 typedef struct _ADDR_CALLBACKS 227 { 228 ADDR_ALLOCSYSMEM allocSysMem; ///< Routine to allocate system memory 229 ADDR_FREESYSMEM freeSysMem; ///< Routine to free system memory 230 ADDR_DEBUGPRINT debugPrint; ///< Routine to print debug message 231 } ADDR_CALLBACKS; 232 233 /////////////////////////////////////////////////////////////////////////////////////////////////// 234 // Create/Destroy functions 235 /////////////////////////////////////////////////////////////////////////////////////////////////// 236 237 /** 238 *************************************************************************************************** 239 * ADDR_CREATE_FLAGS 240 * 241 * @brief 242 * This structure is used to pass some setup in creation of AddrLib 243 * @note 244 *************************************************************************************************** 245 */ 246 typedef union _ADDR_CREATE_FLAGS 247 { 248 struct 249 { 250 UINT_32 noCubeMipSlicesPad : 1; ///< Turn cubemap faces padding off 251 UINT_32 fillSizeFields : 1; ///< If clients fill size fields in all input and 252 /// output structure 253 UINT_32 useTileIndex : 1; ///< Make tileIndex field in input valid 254 UINT_32 useCombinedSwizzle : 1; ///< Use combined tile swizzle 255 UINT_32 checkLast2DLevel : 1; ///< Check the last 2D mip sub level 256 UINT_32 useHtileSliceAlign : 1; ///< Do htile single slice alignment 257 UINT_32 degradeBaseLevel : 1; ///< Degrade to 1D modes automatically for base level 258 UINT_32 allowLargeThickTile : 1; ///< Allow 64*thickness*bytesPerPixel > rowSize 259 UINT_32 reserved : 24; ///< Reserved bits for future use 260 }; 261 262 UINT_32 value; 263 } ADDR_CREATE_FLAGS; 264 265 /** 266 *************************************************************************************************** 267 * ADDR_REGISTER_VALUE 268 * 269 * @brief 270 * Data from registers to setup AddrLib global data, used in AddrCreate 271 *************************************************************************************************** 272 */ 273 typedef struct _ADDR_REGISTER_VALUE 274 { 275 UINT_32 gbAddrConfig; ///< For R8xx, use GB_ADDR_CONFIG register value. 276 /// For R6xx/R7xx, use GB_TILING_CONFIG. 277 /// But they can be treated as the same. 278 /// if this value is 0, use chip to set default value 279 UINT_32 backendDisables; ///< 1 bit per backend, starting with LSB. 1=disabled,0=enabled. 280 /// Register value of CC_RB_BACKEND_DISABLE.BACKEND_DISABLE 281 282 /// R800 registers----------------------------------------------- 283 UINT_32 noOfBanks; ///< Number of h/w ram banks - For r800: MC_ARB_RAMCFG.NOOFBANK 284 /// No enums for this value in h/w header files 285 /// 0: 4 286 /// 1: 8 287 /// 2: 16 288 UINT_32 noOfRanks; /// MC_ARB_RAMCFG.NOOFRANK 289 /// 0: 1 290 /// 1: 2 291 /// SI (R1000) registers----------------------------------------- 292 const UINT_32* pTileConfig; ///< Global tile setting tables 293 UINT_32 noOfEntries; ///< Number of entries in pTileConfig 294 295 ///< CI registers------------------------------------------------- 296 const UINT_32* pMacroTileConfig; ///< Global macro tile mode table 297 UINT_32 noOfMacroEntries; ///< Number of entries in pMacroTileConfig 298 299 } ADDR_REGISTER_VALUE; 300 301 /** 302 *************************************************************************************************** 303 * ADDR_CREATE_INPUT 304 * 305 * @brief 306 * Parameters use to create an AddrLib Object. Caller must provide all fields. 307 * 308 *************************************************************************************************** 309 */ 310 typedef struct _ADDR_CREATE_INPUT 311 { 312 UINT_32 size; ///< Size of this structure in bytes 313 314 UINT_32 chipEngine; ///< Chip Engine 315 UINT_32 chipFamily; ///< Chip Family 316 UINT_32 chipRevision; ///< Chip Revision 317 ADDR_CALLBACKS callbacks; ///< Callbacks for sysmem alloc/free/print 318 ADDR_CREATE_FLAGS createFlags; ///< Flags to setup AddrLib 319 ADDR_REGISTER_VALUE regValue; ///< Data from registers to setup AddrLib global data 320 ADDR_CLIENT_HANDLE hClient; ///< Client handle 321 UINT_32 minPitchAlignPixels; ///< Minimum pitch alignment in pixels 322 } ADDR_CREATE_INPUT; 323 324 /** 325 *************************************************************************************************** 326 * ADDR_CREATEINFO_OUTPUT 327 * 328 * @brief 329 * Return AddrLib handle to client driver 330 * 331 *************************************************************************************************** 332 */ 333 typedef struct _ADDR_CREATE_OUTPUT 334 { 335 UINT_32 size; ///< Size of this structure in bytes 336 337 ADDR_HANDLE hLib; ///< Address lib handle 338 } ADDR_CREATE_OUTPUT; 339 340 /** 341 *************************************************************************************************** 342 * AddrCreate 343 * 344 * @brief 345 * Create AddrLib object, must be called before any interface calls 346 * 347 * @return 348 * ADDR_OK if successful 349 *************************************************************************************************** 350 */ 351 ADDR_E_RETURNCODE ADDR_API AddrCreate( 352 const ADDR_CREATE_INPUT* pAddrCreateIn, 353 ADDR_CREATE_OUTPUT* pAddrCreateOut); 354 355 356 357 /** 358 *************************************************************************************************** 359 * AddrDestroy 360 * 361 * @brief 362 * Destroy AddrLib object, must be called to free internally allocated resources. 363 * 364 * @return 365 * ADDR_OK if successful 366 *************************************************************************************************** 367 */ 368 ADDR_E_RETURNCODE ADDR_API AddrDestroy( 369 ADDR_HANDLE hLib); 370 371 372 373 /////////////////////////////////////////////////////////////////////////////////////////////////// 374 // Surface functions 375 /////////////////////////////////////////////////////////////////////////////////////////////////// 376 377 /** 378 *************************************************************************************************** 379 * @brief 380 * Bank/tiling parameters. On function input, these can be set as desired or 381 * left 0 for AddrLib to calculate/default. On function output, these are the actual 382 * parameters used. 383 * @note 384 * Valid bankWidth/bankHeight value: 385 * 1,2,4,8. They are factors instead of pixels or bytes. 386 * 387 * The bank number remains constant across each row of the 388 * macro tile as each pipe is selected, so the number of 389 * tiles in the x direction with the same bank number will 390 * be bank_width * num_pipes. 391 *************************************************************************************************** 392 */ 393 typedef struct _ADDR_TILEINFO 394 { 395 /// Any of these parameters can be set to 0 to use the HW default. 396 UINT_32 banks; ///< Number of banks, numerical value 397 UINT_32 bankWidth; ///< Number of tiles in the X direction in the same bank 398 UINT_32 bankHeight; ///< Number of tiles in the Y direction in the same bank 399 UINT_32 macroAspectRatio; ///< Macro tile aspect ratio. 1-1:1, 2-4:1, 4-16:1, 8-64:1 400 UINT_32 tileSplitBytes; ///< Tile split size, in bytes 401 AddrPipeCfg pipeConfig; ///< Pipe Config = HW enum + 1 402 } ADDR_TILEINFO; 403 404 // Create a define to avoid client change. The removal of R800 is because we plan to implement SI 405 // within 800 HWL - An AddrPipeCfg is added in above data structure 406 typedef ADDR_TILEINFO ADDR_R800_TILEINFO; 407 408 /** 409 *************************************************************************************************** 410 * @brief 411 * Information needed by quad buffer stereo support 412 *************************************************************************************************** 413 */ 414 typedef struct _ADDR_QBSTEREOINFO 415 { 416 UINT_32 eyeHeight; ///< Height (in pixel rows) to right eye 417 UINT_32 rightOffset; ///< Offset (in bytes) to right eye 418 UINT_32 rightSwizzle; ///< TileSwizzle for right eyes 419 } ADDR_QBSTEREOINFO; 420 421 /** 422 *************************************************************************************************** 423 * ADDR_SURFACE_FLAGS 424 * 425 * @brief 426 * Surface flags 427 *************************************************************************************************** 428 */ 429 typedef union _ADDR_SURFACE_FLAGS 430 { 431 struct 432 { 433 UINT_32 color : 1; ///< Flag indicates this is a color buffer 434 UINT_32 depth : 1; ///< Flag indicates this is a depth/stencil buffer 435 UINT_32 stencil : 1; ///< Flag indicates this is a stencil buffer 436 UINT_32 texture : 1; ///< Flag indicates this is a texture 437 UINT_32 cube : 1; ///< Flag indicates this is a cubemap 438 439 UINT_32 volume : 1; ///< Flag indicates this is a volume texture 440 UINT_32 fmask : 1; ///< Flag indicates this is an fmask 441 UINT_32 cubeAsArray : 1; ///< Flag indicates if treat cubemap as arrays 442 UINT_32 compressZ : 1; ///< Flag indicates z buffer is compressed 443 UINT_32 overlay : 1; ///< Flag indicates this is an overlay surface 444 UINT_32 noStencil : 1; ///< Flag indicates this depth has no separate stencil 445 UINT_32 display : 1; ///< Flag indicates this should match display controller req. 446 UINT_32 opt4Space : 1; ///< Flag indicates this surface should be optimized for space 447 /// i.e. save some memory but may lose performance 448 UINT_32 prt : 1; ///< Flag for partially resident texture 449 UINT_32 qbStereo : 1; ///< Quad buffer stereo surface 450 UINT_32 pow2Pad : 1; ///< SI: Pad to pow2, must set for mipmap (include level0) 451 UINT_32 interleaved : 1; ///< Special flag for interleaved YUV surface padding 452 UINT_32 degrade4Space : 1; ///< Degrade base level's tile mode to save memory 453 UINT_32 tcCompatible : 1; ///< Flag indicates surface needs to be shader readable 454 UINT_32 dispTileType : 1; ///< NI: force display Tiling for 128 bit shared resoruce 455 UINT_32 dccCompatible : 1; ///< VI: whether to support dcc fast clear 456 UINT_32 czDispCompatible: 1; ///< SI+: CZ family (Carrizo) has a HW bug needs special alignment. 457 ///< This flag indicates we need to follow the alignment with 458 ///< CZ families or other ASICs under PX configuration + CZ. 459 UINT_32 reserved :10; ///< Reserved bits 460 }; 461 462 UINT_32 value; 463 } ADDR_SURFACE_FLAGS; 464 465 /** 466 *************************************************************************************************** 467 * ADDR_COMPUTE_SURFACE_INFO_INPUT 468 * 469 * @brief 470 * Input structure for AddrComputeSurfaceInfo 471 *************************************************************************************************** 472 */ 473 typedef struct _ADDR_COMPUTE_SURFACE_INFO_INPUT 474 { 475 UINT_32 size; ///< Size of this structure in bytes 476 477 AddrTileMode tileMode; ///< Tile mode 478 AddrFormat format; ///< If format is set to valid one, bpp/width/height 479 /// might be overwritten 480 UINT_32 bpp; ///< Bits per pixel 481 UINT_32 numSamples; ///< Number of samples 482 UINT_32 width; ///< Width, in pixels 483 UINT_32 height; ///< Height, in pixels 484 UINT_32 numSlices; ///< Number surface slice/depth, 485 /// Note: 486 /// For cubemap, driver clients usually set numSlices 487 /// to 1 in per-face calc. 488 /// For 7xx and above, we need pad faces as slices. 489 /// In this case, clients should set numSlices to 6 and 490 /// this is also can be turned off by createFlags when 491 /// calling AddrCreate 492 UINT_32 slice; ///< Slice index 493 UINT_32 mipLevel; ///< Current mipmap level. 494 /// Padding/tiling have different rules for level0 and 495 /// sublevels 496 ADDR_SURFACE_FLAGS flags; ///< Surface type flags 497 UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 498 /// number of samples for normal AA; Set it to the 499 /// number of fragments for EQAA 500 /// r800 and later HWL parameters 501 // Needed by 2D tiling, for linear and 1D tiling, just keep them 0's 502 ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Set to 0 to default/calculate 503 AddrTileType tileType; ///< Micro tiling type, not needed when tileIndex != -1 504 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 505 /// while the global useTileIndex is set to 1 506 UINT_32 basePitch; ///< Base level pitch in pixels, 0 means ignored, is a 507 /// must for mip levels from SI+. 508 /// Don't use pitch in blocks for compressed formats! 509 } ADDR_COMPUTE_SURFACE_INFO_INPUT; 510 511 /** 512 *************************************************************************************************** 513 * ADDR_COMPUTE_SURFACE_INFO_OUTPUT 514 * 515 * @brief 516 * Output structure for AddrComputeSurfInfo 517 * @note 518 Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch 519 Pixel: Original pixel 520 *************************************************************************************************** 521 */ 522 typedef struct _ADDR_COMPUTE_SURFACE_INFO_OUTPUT 523 { 524 UINT_32 size; ///< Size of this structure in bytes 525 526 UINT_32 pitch; ///< Pitch in elements (in blocks for compressed formats) 527 UINT_32 height; ///< Height in elements (in blocks for compressed formats) 528 UINT_32 depth; ///< Number of slice/depth 529 UINT_64 surfSize; ///< Surface size in bytes 530 AddrTileMode tileMode; ///< Actual tile mode. May differ from that in input 531 UINT_32 baseAlign; ///< Base address alignment 532 UINT_32 pitchAlign; ///< Pitch alignment, in elements 533 UINT_32 heightAlign; ///< Height alignment, in elements 534 UINT_32 depthAlign; ///< Depth alignment, aligned to thickness, for 3d texture 535 UINT_32 bpp; ///< Bits per elements (e.g. blocks for BCn, 1/3 for 96bit) 536 UINT_32 pixelPitch; ///< Pitch in original pixels 537 UINT_32 pixelHeight; ///< Height in original pixels 538 UINT_32 pixelBits; ///< Original bits per pixel, passed from input 539 UINT_64 sliceSize; ///< Size of slice specified by input's slice 540 /// The result is controlled by surface flags & createFlags 541 /// By default this value equals to surfSize for volume 542 UINT_32 pitchTileMax; ///< PITCH_TILE_MAX value for h/w register 543 UINT_32 heightTileMax; ///< HEIGHT_TILE_MAX value for h/w register 544 UINT_32 sliceTileMax; ///< SLICE_TILE_MAX value for h/w register 545 546 UINT_32 numSamples; ///< Pass the effective numSamples processed in this call 547 548 /// r800 and later HWL parameters 549 ADDR_TILEINFO* pTileInfo; ///< Tile parameters used. Filled in if 0 on input 550 AddrTileType tileType; ///< Micro tiling type, only valid when tileIndex != -1 551 INT_32 tileIndex; ///< Tile index, MAY be "downgraded" 552 553 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 554 /// Special information to work around SI mipmap swizzle bug UBTS #317508 555 BOOL_32 last2DLevel; ///< TRUE if this is the last 2D(3D) tiled 556 ///< Only meaningful when create flag checkLast2DLevel is set 557 /// Stereo info 558 ADDR_QBSTEREOINFO* pStereoInfo;///< Stereo information, needed when .qbStereo flag is TRUE 559 } ADDR_COMPUTE_SURFACE_INFO_OUTPUT; 560 561 /** 562 *************************************************************************************************** 563 * AddrComputeSurfaceInfo 564 * 565 * @brief 566 * Compute surface width/height/depth/alignments and suitable tiling mode 567 *************************************************************************************************** 568 */ 569 ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceInfo( 570 ADDR_HANDLE hLib, 571 const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, 572 ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut); 573 574 575 576 /** 577 *************************************************************************************************** 578 * ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT 579 * 580 * @brief 581 * Input structure for AddrComputeSurfaceAddrFromCoord 582 *************************************************************************************************** 583 */ 584 typedef struct _ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT 585 { 586 UINT_32 size; ///< Size of this structure in bytes 587 588 UINT_32 x; ///< X coordinate 589 UINT_32 y; ///< Y coordinate 590 UINT_32 slice; ///< Slice index 591 UINT_32 sample; ///< Sample index, use fragment index for EQAA 592 593 UINT_32 bpp; ///< Bits per pixel 594 UINT_32 pitch; ///< Surface pitch, in pixels 595 UINT_32 height; ///< Surface height, in pixels 596 UINT_32 numSlices; ///< Surface depth 597 UINT_32 numSamples; ///< Number of samples 598 599 AddrTileMode tileMode; ///< Tile mode 600 BOOL_32 isDepth; ///< TRUE if the surface uses depth sample ordering within 601 /// micro tile. Textures can also choose depth sample order 602 UINT_32 tileBase; ///< Base offset (in bits) inside micro tile which handles 603 /// the case that components are stored separately 604 UINT_32 compBits; ///< The component bits actually needed(for planar surface) 605 606 UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 607 /// number of samples for normal AA; Set it to the 608 /// number of fragments for EQAA 609 /// r800 and later HWL parameters 610 // Used for 1D tiling above 611 AddrTileType tileType; ///< See defintion of AddrTileType 612 struct 613 { 614 UINT_32 ignoreSE : 1; ///< TRUE if shader engines are ignored. This is texture 615 /// only flag. Only non-RT texture can set this to TRUE 616 UINT_32 reserved :31; ///< Reserved for future use. 617 }; 618 // 2D tiling needs following structure 619 ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 620 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 621 /// while the global useTileIndex is set to 1 622 union 623 { 624 struct 625 { 626 UINT_32 bankSwizzle; ///< Bank swizzle 627 UINT_32 pipeSwizzle; ///< Pipe swizzle 628 }; 629 UINT_32 tileSwizzle; ///< Combined swizzle, if useCombinedSwizzle is TRUE 630 }; 631 632 #if ADDR_AM_BUILD // These two fields are not valid in SW blt since no HTILE access 633 UINT_32 addr5Swizzle; ///< ADDR5_SWIZZLE_MASK of DB_DEPTH_INFO 634 BOOL_32 is32ByteTile; ///< Caller must have access to HTILE buffer and know if 635 /// this tile is compressed to 32B 636 #endif 637 } ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT; 638 639 /** 640 *************************************************************************************************** 641 * ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT 642 * 643 * @brief 644 * Output structure for AddrComputeSurfaceAddrFromCoord 645 *************************************************************************************************** 646 */ 647 typedef struct _ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT 648 { 649 UINT_32 size; ///< Size of this structure in bytes 650 651 UINT_64 addr; ///< Byte address 652 UINT_32 bitPosition; ///< Bit position within surfaceAddr, 0-7. 653 /// For surface bpp < 8, e.g. FMT_1. 654 UINT_32 prtBlockIndex; ///< Index of a PRT tile (64K block) 655 } ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT; 656 657 /** 658 *************************************************************************************************** 659 * AddrComputeSurfaceAddrFromCoord 660 * 661 * @brief 662 * Compute surface address from a given coordinate. 663 *************************************************************************************************** 664 */ 665 ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceAddrFromCoord( 666 ADDR_HANDLE hLib, 667 const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT* pIn, 668 ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT* pOut); 669 670 671 672 /** 673 *************************************************************************************************** 674 * ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT 675 * 676 * @brief 677 * Input structure for AddrComputeSurfaceCoordFromAddr 678 *************************************************************************************************** 679 */ 680 typedef struct _ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT 681 { 682 UINT_32 size; ///< Size of this structure in bytes 683 684 UINT_64 addr; ///< Address in bytes 685 UINT_32 bitPosition; ///< Bit position in addr. 0-7. for surface bpp < 8, 686 /// e.g. FMT_1; 687 UINT_32 bpp; ///< Bits per pixel 688 UINT_32 pitch; ///< Pitch, in pixels 689 UINT_32 height; ///< Height in pixels 690 UINT_32 numSlices; ///< Surface depth 691 UINT_32 numSamples; ///< Number of samples 692 693 AddrTileMode tileMode; ///< Tile mode 694 BOOL_32 isDepth; ///< Surface uses depth sample ordering within micro tile. 695 /// Note: Textures can choose depth sample order as well. 696 UINT_32 tileBase; ///< Base offset (in bits) inside micro tile which handles 697 /// the case that components are stored separately 698 UINT_32 compBits; ///< The component bits actually needed(for planar surface) 699 700 UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 701 /// number of samples for normal AA; Set it to the 702 /// number of fragments for EQAA 703 /// r800 and later HWL parameters 704 // Used for 1D tiling above 705 AddrTileType tileType; ///< See defintion of AddrTileType 706 struct 707 { 708 UINT_32 ignoreSE : 1; ///< TRUE if shader engines are ignored. This is texture 709 /// only flag. Only non-RT texture can set this to TRUE 710 UINT_32 reserved :31; ///< Reserved for future use. 711 }; 712 // 2D tiling needs following structure 713 ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 714 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 715 /// while the global useTileIndex is set to 1 716 union 717 { 718 struct 719 { 720 UINT_32 bankSwizzle; ///< Bank swizzle 721 UINT_32 pipeSwizzle; ///< Pipe swizzle 722 }; 723 UINT_32 tileSwizzle; ///< Combined swizzle, if useCombinedSwizzle is TRUE 724 }; 725 } ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT; 726 727 /** 728 *************************************************************************************************** 729 * ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT 730 * 731 * @brief 732 * Output structure for AddrComputeSurfaceCoordFromAddr 733 *************************************************************************************************** 734 */ 735 typedef struct _ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT 736 { 737 UINT_32 size; ///< Size of this structure in bytes 738 739 UINT_32 x; ///< X coordinate 740 UINT_32 y; ///< Y coordinate 741 UINT_32 slice; ///< Index of slices 742 UINT_32 sample; ///< Index of samples, means fragment index for EQAA 743 } ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT; 744 745 /** 746 *************************************************************************************************** 747 * AddrComputeSurfaceCoordFromAddr 748 * 749 * @brief 750 * Compute coordinate from a given surface address 751 *************************************************************************************************** 752 */ 753 ADDR_E_RETURNCODE ADDR_API AddrComputeSurfaceCoordFromAddr( 754 ADDR_HANDLE hLib, 755 const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT* pIn, 756 ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT* pOut); 757 758 /////////////////////////////////////////////////////////////////////////////////////////////////// 759 // HTile functions 760 /////////////////////////////////////////////////////////////////////////////////////////////////// 761 762 /** 763 *************************************************************************************************** 764 * ADDR_HTILE_FLAGS 765 * 766 * @brief 767 * HTILE flags 768 *************************************************************************************************** 769 */ 770 typedef union _ADDR_HTILE_FLAGS 771 { 772 struct 773 { 774 UINT_32 tcCompatible : 1; ///< Flag indicates surface needs to be shader readable 775 UINT_32 reserved :31; ///< Reserved bits 776 }; 777 778 UINT_32 value; 779 } ADDR_HTILE_FLAGS; 780 781 /** 782 *************************************************************************************************** 783 * ADDR_COMPUTE_HTILE_INFO_INPUT 784 * 785 * @brief 786 * Input structure of AddrComputeHtileInfo 787 *************************************************************************************************** 788 */ 789 typedef struct _ADDR_COMPUTE_HTILE_INFO_INPUT 790 { 791 UINT_32 size; ///< Size of this structure in bytes 792 793 ADDR_HTILE_FLAGS flags; ///< HTILE flags 794 UINT_32 pitch; ///< Surface pitch, in pixels 795 UINT_32 height; ///< Surface height, in pixels 796 UINT_32 numSlices; ///< Number of slices 797 BOOL_32 isLinear; ///< Linear or tiled HTILE layout 798 AddrHtileBlockSize blockWidth; ///< 4 or 8. EG above only support 8 799 AddrHtileBlockSize blockHeight; ///< 4 or 8. EG above only support 8 800 ADDR_TILEINFO* pTileInfo; ///< Tile info 801 802 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 803 /// while the global useTileIndex is set to 1 804 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 805 ///< README: When tileIndex is not -1, this must be valid 806 } ADDR_COMPUTE_HTILE_INFO_INPUT; 807 808 /** 809 *************************************************************************************************** 810 * ADDR_COMPUTE_HTILE_INFO_OUTPUT 811 * 812 * @brief 813 * Output structure of AddrComputeHtileInfo 814 *************************************************************************************************** 815 */ 816 typedef struct _ADDR_COMPUTE_HTILE_INFO_OUTPUT 817 { 818 UINT_32 size; ///< Size of this structure in bytes 819 820 UINT_32 pitch; ///< Pitch in pixels of depth buffer represented in this 821 /// HTile buffer. This might be larger than original depth 822 /// buffer pitch when called with an unaligned pitch. 823 UINT_32 height; ///< Height in pixels, as above 824 UINT_64 htileBytes; ///< Size of HTILE buffer, in bytes 825 UINT_32 baseAlign; ///< Base alignment 826 UINT_32 bpp; ///< Bits per pixel for HTILE is how many bits for an 8x8 block! 827 UINT_32 macroWidth; ///< Macro width in pixels, actually squared cache shape 828 UINT_32 macroHeight; ///< Macro height in pixels 829 UINT_64 sliceSize; ///< Slice size, in bytes. 830 } ADDR_COMPUTE_HTILE_INFO_OUTPUT; 831 832 /** 833 *************************************************************************************************** 834 * AddrComputeHtileInfo 835 * 836 * @brief 837 * Compute Htile pitch, height, base alignment and size in bytes 838 *************************************************************************************************** 839 */ 840 ADDR_E_RETURNCODE ADDR_API AddrComputeHtileInfo( 841 ADDR_HANDLE hLib, 842 const ADDR_COMPUTE_HTILE_INFO_INPUT* pIn, 843 ADDR_COMPUTE_HTILE_INFO_OUTPUT* pOut); 844 845 846 847 /** 848 *************************************************************************************************** 849 * ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT 850 * 851 * @brief 852 * Input structure for AddrComputeHtileAddrFromCoord 853 *************************************************************************************************** 854 */ 855 typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT 856 { 857 UINT_32 size; ///< Size of this structure in bytes 858 859 UINT_32 pitch; ///< Pitch, in pixels 860 UINT_32 height; ///< Height in pixels 861 UINT_32 x; ///< X coordinate 862 UINT_32 y; ///< Y coordinate 863 UINT_32 slice; ///< Index of slice 864 UINT_32 numSlices; ///< Number of slices 865 BOOL_32 isLinear; ///< Linear or tiled HTILE layout 866 AddrHtileBlockSize blockWidth; ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8 867 AddrHtileBlockSize blockHeight; ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8 868 ADDR_TILEINFO* pTileInfo; ///< Tile info 869 870 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 871 /// while the global useTileIndex is set to 1 872 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 873 ///< README: When tileIndex is not -1, this must be valid 874 } ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT; 875 876 /** 877 *************************************************************************************************** 878 * ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT 879 * 880 * @brief 881 * Output structure for AddrComputeHtileAddrFromCoord 882 *************************************************************************************************** 883 */ 884 typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT 885 { 886 UINT_32 size; ///< Size of this structure in bytes 887 888 UINT_64 addr; ///< Address in bytes 889 UINT_32 bitPosition; ///< Bit position, 0 or 4. CMASK and HTILE shares some lib method. 890 /// So we keep bitPosition for HTILE as well 891 } ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT; 892 893 /** 894 *************************************************************************************************** 895 * AddrComputeHtileAddrFromCoord 896 * 897 * @brief 898 * Compute Htile address according to coordinates (of depth buffer) 899 *************************************************************************************************** 900 */ 901 ADDR_E_RETURNCODE ADDR_API AddrComputeHtileAddrFromCoord( 902 ADDR_HANDLE hLib, 903 const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT* pIn, 904 ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT* pOut); 905 906 907 908 /** 909 *************************************************************************************************** 910 * ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT 911 * 912 * @brief 913 * Input structure for AddrComputeHtileCoordFromAddr 914 *************************************************************************************************** 915 */ 916 typedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT 917 { 918 UINT_32 size; ///< Size of this structure in bytes 919 920 UINT_64 addr; ///< Address 921 UINT_32 bitPosition; ///< Bit position 0 or 4. CMASK and HTILE share some methods 922 /// so we keep bitPosition for HTILE as well 923 UINT_32 pitch; ///< Pitch, in pixels 924 UINT_32 height; ///< Height, in pixels 925 UINT_32 numSlices; ///< Number of slices 926 BOOL_32 isLinear; ///< Linear or tiled HTILE layout 927 AddrHtileBlockSize blockWidth; ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8 928 AddrHtileBlockSize blockHeight; ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8 929 ADDR_TILEINFO* pTileInfo; ///< Tile info 930 931 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 932 /// while the global useTileIndex is set to 1 933 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 934 ///< README: When tileIndex is not -1, this must be valid 935 } ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT; 936 937 /** 938 *************************************************************************************************** 939 * ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT 940 * 941 * @brief 942 * Output structure for AddrComputeHtileCoordFromAddr 943 *************************************************************************************************** 944 */ 945 typedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT 946 { 947 UINT_32 size; ///< Size of this structure in bytes 948 949 UINT_32 x; ///< X coordinate 950 UINT_32 y; ///< Y coordinate 951 UINT_32 slice; ///< Slice index 952 } ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT; 953 954 /** 955 *************************************************************************************************** 956 * AddrComputeHtileCoordFromAddr 957 * 958 * @brief 959 * Compute coordinates within depth buffer (1st pixel of a micro tile) according to 960 * Htile address 961 *************************************************************************************************** 962 */ 963 ADDR_E_RETURNCODE ADDR_API AddrComputeHtileCoordFromAddr( 964 ADDR_HANDLE hLib, 965 const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT* pIn, 966 ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT* pOut); 967 968 969 970 /////////////////////////////////////////////////////////////////////////////////////////////////// 971 // C-mask functions 972 /////////////////////////////////////////////////////////////////////////////////////////////////// 973 974 /** 975 *************************************************************************************************** 976 * ADDR_CMASK_FLAGS 977 * 978 * @brief 979 * CMASK flags 980 *************************************************************************************************** 981 */ 982 typedef union _ADDR_CMASK_FLAGS 983 { 984 struct 985 { 986 UINT_32 tcCompatible : 1; ///< Flag indicates surface needs to be shader readable 987 UINT_32 reserved :31; ///< Reserved bits 988 }; 989 990 UINT_32 value; 991 } ADDR_CMASK_FLAGS; 992 993 /** 994 *************************************************************************************************** 995 * ADDR_COMPUTE_CMASK_INFO_INPUT 996 * 997 * @brief 998 * Input structure of AddrComputeCmaskInfo 999 *************************************************************************************************** 1000 */ 1001 typedef struct _ADDR_COMPUTE_CMASKINFO_INPUT 1002 { 1003 UINT_32 size; ///< Size of this structure in bytes 1004 1005 ADDR_CMASK_FLAGS flags; ///< CMASK flags 1006 UINT_32 pitch; ///< Pitch, in pixels, of color buffer 1007 UINT_32 height; ///< Height, in pixels, of color buffer 1008 UINT_32 numSlices; ///< Number of slices, of color buffer 1009 BOOL_32 isLinear; ///< Linear or tiled layout, Only SI can be linear 1010 ADDR_TILEINFO* pTileInfo; ///< Tile info 1011 1012 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1013 /// while the global useTileIndex is set to 1 1014 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1015 ///< README: When tileIndex is not -1, this must be valid 1016 } ADDR_COMPUTE_CMASK_INFO_INPUT; 1017 1018 /** 1019 *************************************************************************************************** 1020 * ADDR_COMPUTE_CMASK_INFO_OUTPUT 1021 * 1022 * @brief 1023 * Output structure of AddrComputeCmaskInfo 1024 *************************************************************************************************** 1025 */ 1026 typedef struct _ADDR_COMPUTE_CMASK_INFO_OUTPUT 1027 { 1028 UINT_32 size; ///< Size of this structure in bytes 1029 1030 UINT_32 pitch; ///< Pitch in pixels of color buffer which 1031 /// this Cmask matches. The size might be larger than 1032 /// original color buffer pitch when called with 1033 /// an unaligned pitch. 1034 UINT_32 height; ///< Height in pixels, as above 1035 UINT_64 cmaskBytes; ///< Size in bytes of CMask buffer 1036 UINT_32 baseAlign; ///< Base alignment 1037 UINT_32 blockMax; ///< Cmask block size. Need this to set CB_COLORn_MASK register 1038 UINT_32 macroWidth; ///< Macro width in pixels, actually squared cache shape 1039 UINT_32 macroHeight; ///< Macro height in pixels 1040 UINT_64 sliceSize; ///< Slice size, in bytes. 1041 } ADDR_COMPUTE_CMASK_INFO_OUTPUT; 1042 1043 /** 1044 *************************************************************************************************** 1045 * AddrComputeCmaskInfo 1046 * 1047 * @brief 1048 * Compute Cmask pitch, height, base alignment and size in bytes from color buffer 1049 * info 1050 *************************************************************************************************** 1051 */ 1052 ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskInfo( 1053 ADDR_HANDLE hLib, 1054 const ADDR_COMPUTE_CMASK_INFO_INPUT* pIn, 1055 ADDR_COMPUTE_CMASK_INFO_OUTPUT* pOut); 1056 1057 1058 1059 /** 1060 *************************************************************************************************** 1061 * ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT 1062 * 1063 * @brief 1064 * Input structure for AddrComputeCmaskAddrFromCoord 1065 * 1066 *************************************************************************************************** 1067 */ 1068 typedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT 1069 { 1070 UINT_32 size; ///< Size of this structure in bytes 1071 UINT_32 x; ///< X coordinate 1072 UINT_32 y; ///< Y coordinate 1073 UINT_64 fmaskAddr; ///< Fmask addr for tc compatible Cmask 1074 UINT_32 slice; ///< Slice index 1075 UINT_32 pitch; ///< Pitch in pixels, of color buffer 1076 UINT_32 height; ///< Height in pixels, of color buffer 1077 UINT_32 numSlices; ///< Number of slices 1078 UINT_32 bpp; 1079 BOOL_32 isLinear; ///< Linear or tiled layout, Only SI can be linear 1080 ADDR_CMASK_FLAGS flags; ///< CMASK flags 1081 ADDR_TILEINFO* pTileInfo; ///< Tile info 1082 1083 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1084 ///< while the global useTileIndex is set to 1 1085 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1086 ///< README: When tileIndex is not -1, this must be valid 1087 } ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT; 1088 1089 /** 1090 *************************************************************************************************** 1091 * ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT 1092 * 1093 * @brief 1094 * Output structure for AddrComputeCmaskAddrFromCoord 1095 *************************************************************************************************** 1096 */ 1097 typedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT 1098 { 1099 UINT_32 size; ///< Size of this structure in bytes 1100 1101 UINT_64 addr; ///< CMASK address in bytes 1102 UINT_32 bitPosition; ///< Bit position within addr, 0-7. CMASK is 4 bpp, 1103 /// so the address may be located in bit 0 (0) or 4 (4) 1104 } ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT; 1105 1106 /** 1107 *************************************************************************************************** 1108 * AddrComputeCmaskAddrFromCoord 1109 * 1110 * @brief 1111 * Compute Cmask address according to coordinates (of MSAA color buffer) 1112 *************************************************************************************************** 1113 */ 1114 ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskAddrFromCoord( 1115 ADDR_HANDLE hLib, 1116 const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn, 1117 ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut); 1118 1119 1120 1121 /** 1122 *************************************************************************************************** 1123 * ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT 1124 * 1125 * @brief 1126 * Input structure for AddrComputeCmaskCoordFromAddr 1127 *************************************************************************************************** 1128 */ 1129 typedef struct _ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT 1130 { 1131 UINT_32 size; ///< Size of this structure in bytes 1132 1133 UINT_64 addr; ///< CMASK address in bytes 1134 UINT_32 bitPosition; ///< Bit position within addr, 0-7. CMASK is 4 bpp, 1135 /// so the address may be located in bit 0 (0) or 4 (4) 1136 UINT_32 pitch; ///< Pitch, in pixels 1137 UINT_32 height; ///< Height in pixels 1138 UINT_32 numSlices; ///< Number of slices 1139 BOOL_32 isLinear; ///< Linear or tiled layout, Only SI can be linear 1140 ADDR_TILEINFO* pTileInfo; ///< Tile info 1141 1142 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1143 /// while the global useTileIndex is set to 1 1144 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1145 ///< README: When tileIndex is not -1, this must be valid 1146 } ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT; 1147 1148 /** 1149 *************************************************************************************************** 1150 * ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT 1151 * 1152 * @brief 1153 * Output structure for AddrComputeCmaskCoordFromAddr 1154 *************************************************************************************************** 1155 */ 1156 typedef struct _ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT 1157 { 1158 UINT_32 size; ///< Size of this structure in bytes 1159 1160 UINT_32 x; ///< X coordinate 1161 UINT_32 y; ///< Y coordinate 1162 UINT_32 slice; ///< Slice index 1163 } ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT; 1164 1165 /** 1166 *************************************************************************************************** 1167 * AddrComputeCmaskCoordFromAddr 1168 * 1169 * @brief 1170 * Compute coordinates within color buffer (1st pixel of a micro tile) according to 1171 * Cmask address 1172 *************************************************************************************************** 1173 */ 1174 ADDR_E_RETURNCODE ADDR_API AddrComputeCmaskCoordFromAddr( 1175 ADDR_HANDLE hLib, 1176 const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT* pIn, 1177 ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT* pOut); 1178 1179 1180 1181 /////////////////////////////////////////////////////////////////////////////////////////////////// 1182 // F-mask functions 1183 /////////////////////////////////////////////////////////////////////////////////////////////////// 1184 1185 /** 1186 *************************************************************************************************** 1187 * ADDR_COMPUTE_FMASK_INFO_INPUT 1188 * 1189 * @brief 1190 * Input structure for AddrComputeFmaskInfo 1191 *************************************************************************************************** 1192 */ 1193 typedef struct _ADDR_COMPUTE_FMASK_INFO_INPUT 1194 { 1195 UINT_32 size; ///< Size of this structure in bytes 1196 1197 AddrTileMode tileMode; ///< Tile mode 1198 UINT_32 pitch; ///< Surface pitch, in pixels 1199 UINT_32 height; ///< Surface height, in pixels 1200 UINT_32 numSlices; ///< Number of slice/depth 1201 UINT_32 numSamples; ///< Number of samples 1202 UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 1203 /// number of samples for normal AA; Set it to the 1204 /// number of fragments for EQAA 1205 /// r800 and later HWL parameters 1206 struct 1207 { 1208 UINT_32 resolved: 1; ///< TRUE if the surface is for resolved fmask, only used 1209 /// by H/W clients. S/W should always set it to FALSE. 1210 UINT_32 reserved: 31; ///< Reserved for future use. 1211 }; 1212 ADDR_TILEINFO* pTileInfo; ///< 2D tiling parameters. Clients must give valid data 1213 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1214 /// while the global useTileIndex is set to 1 1215 } ADDR_COMPUTE_FMASK_INFO_INPUT; 1216 1217 /** 1218 *************************************************************************************************** 1219 * ADDR_COMPUTE_FMASK_INFO_OUTPUT 1220 * 1221 * @brief 1222 * Output structure for AddrComputeFmaskInfo 1223 *************************************************************************************************** 1224 */ 1225 typedef struct _ADDR_COMPUTE_FMASK_INFO_OUTPUT 1226 { 1227 UINT_32 size; ///< Size of this structure in bytes 1228 1229 UINT_32 pitch; ///< Pitch of fmask in pixels 1230 UINT_32 height; ///< Height of fmask in pixels 1231 UINT_32 numSlices; ///< Slices of fmask 1232 UINT_64 fmaskBytes; ///< Size of fmask in bytes 1233 UINT_32 baseAlign; ///< Base address alignment 1234 UINT_32 pitchAlign; ///< Pitch alignment 1235 UINT_32 heightAlign; ///< Height alignment 1236 UINT_32 bpp; ///< Bits per pixel of FMASK is: number of bit planes 1237 UINT_32 numSamples; ///< Number of samples, used for dump, export this since input 1238 /// may be changed in 9xx and above 1239 /// r800 and later HWL parameters 1240 ADDR_TILEINFO* pTileInfo; ///< Tile parameters used. Fmask can have different 1241 /// bank_height from color buffer 1242 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1243 /// while the global useTileIndex is set to 1 1244 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1245 UINT_64 sliceSize; ///< Size of slice in bytes 1246 } ADDR_COMPUTE_FMASK_INFO_OUTPUT; 1247 1248 /** 1249 *************************************************************************************************** 1250 * AddrComputeFmaskInfo 1251 * 1252 * @brief 1253 * Compute Fmask pitch/height/depth/alignments and size in bytes 1254 *************************************************************************************************** 1255 */ 1256 ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskInfo( 1257 ADDR_HANDLE hLib, 1258 const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn, 1259 ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut); 1260 1261 1262 1263 /** 1264 *************************************************************************************************** 1265 * ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT 1266 * 1267 * @brief 1268 * Input structure for AddrComputeFmaskAddrFromCoord 1269 *************************************************************************************************** 1270 */ 1271 typedef struct _ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT 1272 { 1273 UINT_32 size; ///< Size of this structure in bytes 1274 1275 UINT_32 x; ///< X coordinate 1276 UINT_32 y; ///< Y coordinate 1277 UINT_32 slice; ///< Slice index 1278 UINT_32 plane; ///< Plane number 1279 UINT_32 sample; ///< Sample index (fragment index for EQAA) 1280 1281 UINT_32 pitch; ///< Surface pitch, in pixels 1282 UINT_32 height; ///< Surface height, in pixels 1283 UINT_32 numSamples; ///< Number of samples 1284 UINT_32 numFrags; ///< Number of fragments, leave it zero or the same as 1285 /// number of samples for normal AA; Set it to the 1286 /// number of fragments for EQAA 1287 1288 AddrTileMode tileMode; ///< Tile mode 1289 union 1290 { 1291 struct 1292 { 1293 UINT_32 bankSwizzle; ///< Bank swizzle 1294 UINT_32 pipeSwizzle; ///< Pipe swizzle 1295 }; 1296 UINT_32 tileSwizzle; ///< Combined swizzle, if useCombinedSwizzle is TRUE 1297 }; 1298 1299 /// r800 and later HWL parameters 1300 struct 1301 { 1302 UINT_32 resolved: 1; ///< TRUE if this is a resolved fmask, used by H/W clients 1303 UINT_32 ignoreSE: 1; ///< TRUE if shader engines are ignored. 1304 UINT_32 reserved: 30; ///< Reserved for future use. 1305 }; 1306 ADDR_TILEINFO* pTileInfo; ///< 2D tiling parameters. Client must provide all data 1307 1308 } ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT; 1309 1310 /** 1311 *************************************************************************************************** 1312 * ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT 1313 * 1314 * @brief 1315 * Output structure for AddrComputeFmaskAddrFromCoord 1316 *************************************************************************************************** 1317 */ 1318 typedef struct _ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT 1319 { 1320 UINT_32 size; ///< Size of this structure in bytes 1321 1322 UINT_64 addr; ///< Fmask address 1323 UINT_32 bitPosition; ///< Bit position within fmaskAddr, 0-7. 1324 } ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT; 1325 1326 /** 1327 *************************************************************************************************** 1328 * AddrComputeFmaskAddrFromCoord 1329 * 1330 * @brief 1331 * Compute Fmask address according to coordinates (x,y,slice,sample,plane) 1332 *************************************************************************************************** 1333 */ 1334 ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskAddrFromCoord( 1335 ADDR_HANDLE hLib, 1336 const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT* pIn, 1337 ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT* pOut); 1338 1339 1340 1341 /** 1342 *************************************************************************************************** 1343 * ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT 1344 * 1345 * @brief 1346 * Input structure for AddrComputeFmaskCoordFromAddr 1347 *************************************************************************************************** 1348 */ 1349 typedef struct _ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT 1350 { 1351 UINT_32 size; ///< Size of this structure in bytes 1352 1353 UINT_64 addr; ///< Address 1354 UINT_32 bitPosition; ///< Bit position within addr, 0-7. 1355 1356 UINT_32 pitch; ///< Pitch, in pixels 1357 UINT_32 height; ///< Height in pixels 1358 UINT_32 numSamples; ///< Number of samples 1359 UINT_32 numFrags; ///< Number of fragments 1360 AddrTileMode tileMode; ///< Tile mode 1361 union 1362 { 1363 struct 1364 { 1365 UINT_32 bankSwizzle; ///< Bank swizzle 1366 UINT_32 pipeSwizzle; ///< Pipe swizzle 1367 }; 1368 UINT_32 tileSwizzle; ///< Combined swizzle, if useCombinedSwizzle is TRUE 1369 }; 1370 1371 /// r800 and later HWL parameters 1372 struct 1373 { 1374 UINT_32 resolved: 1; ///< TRUE if this is a resolved fmask, used by HW components 1375 UINT_32 ignoreSE: 1; ///< TRUE if shader engines are ignored. 1376 UINT_32 reserved: 30; ///< Reserved for future use. 1377 }; 1378 ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 1379 1380 } ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT; 1381 1382 /** 1383 *************************************************************************************************** 1384 * ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT 1385 * 1386 * @brief 1387 * Output structure for AddrComputeFmaskCoordFromAddr 1388 *************************************************************************************************** 1389 */ 1390 typedef struct _ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT 1391 { 1392 UINT_32 size; ///< Size of this structure in bytes 1393 1394 UINT_32 x; ///< X coordinate 1395 UINT_32 y; ///< Y coordinate 1396 UINT_32 slice; ///< Slice index 1397 UINT_32 plane; ///< Plane number 1398 UINT_32 sample; ///< Sample index (fragment index for EQAA) 1399 } ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT; 1400 1401 /** 1402 *************************************************************************************************** 1403 * AddrComputeFmaskCoordFromAddr 1404 * 1405 * @brief 1406 * Compute FMASK coordinate from an given address 1407 *************************************************************************************************** 1408 */ 1409 ADDR_E_RETURNCODE ADDR_API AddrComputeFmaskCoordFromAddr( 1410 ADDR_HANDLE hLib, 1411 const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT* pIn, 1412 ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT* pOut); 1413 1414 1415 1416 /////////////////////////////////////////////////////////////////////////////////////////////////// 1417 // Element/utility functions 1418 /////////////////////////////////////////////////////////////////////////////////////////////////// 1419 1420 /** 1421 *************************************************************************************************** 1422 * AddrGetVersion 1423 * 1424 * @brief 1425 * Get AddrLib version number 1426 *************************************************************************************************** 1427 */ 1428 UINT_32 ADDR_API AddrGetVersion(ADDR_HANDLE hLib); 1429 1430 /** 1431 *************************************************************************************************** 1432 * AddrUseTileIndex 1433 * 1434 * @brief 1435 * Return TRUE if tileIndex is enabled in this address library 1436 *************************************************************************************************** 1437 */ 1438 BOOL_32 ADDR_API AddrUseTileIndex(ADDR_HANDLE hLib); 1439 1440 /** 1441 *************************************************************************************************** 1442 * AddrUseCombinedSwizzle 1443 * 1444 * @brief 1445 * Return TRUE if combined swizzle is enabled in this address library 1446 *************************************************************************************************** 1447 */ 1448 BOOL_32 ADDR_API AddrUseCombinedSwizzle(ADDR_HANDLE hLib); 1449 1450 /** 1451 *************************************************************************************************** 1452 * ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT 1453 * 1454 * @brief 1455 * Input structure of AddrExtractBankPipeSwizzle 1456 *************************************************************************************************** 1457 */ 1458 typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT 1459 { 1460 UINT_32 size; ///< Size of this structure in bytes 1461 1462 UINT_32 base256b; ///< Base256b value 1463 1464 /// r800 and later HWL parameters 1465 ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 1466 1467 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1468 /// while the global useTileIndex is set to 1 1469 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1470 ///< README: When tileIndex is not -1, this must be valid 1471 } ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT; 1472 1473 /** 1474 *************************************************************************************************** 1475 * ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT 1476 * 1477 * @brief 1478 * Output structure of AddrExtractBankPipeSwizzle 1479 *************************************************************************************************** 1480 */ 1481 typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT 1482 { 1483 UINT_32 size; ///< Size of this structure in bytes 1484 1485 UINT_32 bankSwizzle; ///< Bank swizzle 1486 UINT_32 pipeSwizzle; ///< Pipe swizzle 1487 } ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT; 1488 1489 /** 1490 *************************************************************************************************** 1491 * AddrExtractBankPipeSwizzle 1492 * 1493 * @brief 1494 * Extract Bank and Pipe swizzle from base256b 1495 * @return 1496 * ADDR_OK if no error 1497 *************************************************************************************************** 1498 */ 1499 ADDR_E_RETURNCODE ADDR_API AddrExtractBankPipeSwizzle( 1500 ADDR_HANDLE hLib, 1501 const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT* pIn, 1502 ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT* pOut); 1503 1504 1505 /** 1506 *************************************************************************************************** 1507 * ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT 1508 * 1509 * @brief 1510 * Input structure of AddrCombineBankPipeSwizzle 1511 *************************************************************************************************** 1512 */ 1513 typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT 1514 { 1515 UINT_32 size; ///< Size of this structure in bytes 1516 1517 UINT_32 bankSwizzle; ///< Bank swizzle 1518 UINT_32 pipeSwizzle; ///< Pipe swizzle 1519 UINT_64 baseAddr; ///< Base address (leave it zero for driver clients) 1520 1521 /// r800 and later HWL parameters 1522 ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Client must provide all data 1523 1524 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1525 /// while the global useTileIndex is set to 1 1526 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1527 ///< README: When tileIndex is not -1, this must be valid 1528 } ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT; 1529 1530 /** 1531 *************************************************************************************************** 1532 * ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT 1533 * 1534 * @brief 1535 * Output structure of AddrCombineBankPipeSwizzle 1536 *************************************************************************************************** 1537 */ 1538 typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT 1539 { 1540 UINT_32 size; ///< Size of this structure in bytes 1541 1542 UINT_32 tileSwizzle; ///< Combined swizzle 1543 } ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT; 1544 1545 /** 1546 *************************************************************************************************** 1547 * AddrCombineBankPipeSwizzle 1548 * 1549 * @brief 1550 * Combine Bank and Pipe swizzle 1551 * @return 1552 * ADDR_OK if no error 1553 * @note 1554 * baseAddr here is full MCAddress instead of base256b 1555 *************************************************************************************************** 1556 */ 1557 ADDR_E_RETURNCODE ADDR_API AddrCombineBankPipeSwizzle( 1558 ADDR_HANDLE hLib, 1559 const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT* pIn, 1560 ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT* pOut); 1561 1562 1563 1564 /** 1565 *************************************************************************************************** 1566 * ADDR_COMPUTE_SLICESWIZZLE_INPUT 1567 * 1568 * @brief 1569 * Input structure of AddrComputeSliceSwizzle 1570 *************************************************************************************************** 1571 */ 1572 typedef struct _ADDR_COMPUTE_SLICESWIZZLE_INPUT 1573 { 1574 UINT_32 size; ///< Size of this structure in bytes 1575 1576 AddrTileMode tileMode; ///< Tile Mode 1577 UINT_32 baseSwizzle; ///< Base tile swizzle 1578 UINT_32 slice; ///< Slice index 1579 UINT_64 baseAddr; ///< Base address, driver should leave it 0 in most cases 1580 1581 /// r800 and later HWL parameters 1582 ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Actually banks needed here! 1583 1584 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1585 /// while the global useTileIndex is set to 1 1586 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1587 ///< README: When tileIndex is not -1, this must be valid 1588 } ADDR_COMPUTE_SLICESWIZZLE_INPUT; 1589 1590 1591 1592 /** 1593 *************************************************************************************************** 1594 * ADDR_COMPUTE_SLICESWIZZLE_OUTPUT 1595 * 1596 * @brief 1597 * Output structure of AddrComputeSliceSwizzle 1598 *************************************************************************************************** 1599 */ 1600 typedef struct _ADDR_COMPUTE_SLICESWIZZLE_OUTPUT 1601 { 1602 UINT_32 size; ///< Size of this structure in bytes 1603 1604 UINT_32 tileSwizzle; ///< Recalculated tileSwizzle value 1605 } ADDR_COMPUTE_SLICESWIZZLE_OUTPUT; 1606 1607 /** 1608 *************************************************************************************************** 1609 * AddrComputeSliceSwizzle 1610 * 1611 * @brief 1612 * Extract Bank and Pipe swizzle from base256b 1613 * @return 1614 * ADDR_OK if no error 1615 *************************************************************************************************** 1616 */ 1617 ADDR_E_RETURNCODE ADDR_API AddrComputeSliceSwizzle( 1618 ADDR_HANDLE hLib, 1619 const ADDR_COMPUTE_SLICESWIZZLE_INPUT* pIn, 1620 ADDR_COMPUTE_SLICESWIZZLE_OUTPUT* pOut); 1621 1622 1623 /** 1624 *************************************************************************************************** 1625 * AddrSwizzleGenOption 1626 * 1627 * @brief 1628 * Which swizzle generating options: legacy or linear 1629 *************************************************************************************************** 1630 */ 1631 typedef enum _AddrSwizzleGenOption 1632 { 1633 ADDR_SWIZZLE_GEN_DEFAULT = 0, ///< As is in client driver implemention for swizzle 1634 ADDR_SWIZZLE_GEN_LINEAR = 1, ///< Using a linear increment of swizzle 1635 } AddrSwizzleGenOption; 1636 1637 /** 1638 *************************************************************************************************** 1639 * AddrSwizzleOption 1640 * 1641 * @brief 1642 * Controls how swizzle is generated 1643 *************************************************************************************************** 1644 */ 1645 typedef union _ADDR_SWIZZLE_OPTION 1646 { 1647 struct 1648 { 1649 UINT_32 genOption : 1; ///< The way swizzle is generated, see AddrSwizzleGenOption 1650 UINT_32 reduceBankBit : 1; ///< TRUE if we need reduce swizzle bits 1651 UINT_32 reserved :30; ///< Reserved bits 1652 }; 1653 1654 UINT_32 value; 1655 1656 } ADDR_SWIZZLE_OPTION; 1657 1658 /** 1659 *************************************************************************************************** 1660 * ADDR_COMPUTE_BASE_SWIZZLE_INPUT 1661 * 1662 * @brief 1663 * Input structure of AddrComputeBaseSwizzle 1664 *************************************************************************************************** 1665 */ 1666 typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_INPUT 1667 { 1668 UINT_32 size; ///< Size of this structure in bytes 1669 1670 ADDR_SWIZZLE_OPTION option; ///< Swizzle option 1671 UINT_32 surfIndex; ///< Index of this surface type 1672 AddrTileMode tileMode; ///< Tile Mode 1673 1674 /// r800 and later HWL parameters 1675 ADDR_TILEINFO* pTileInfo; ///< 2D tile parameters. Actually banks needed here! 1676 1677 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1678 /// while the global useTileIndex is set to 1 1679 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1680 ///< README: When tileIndex is not -1, this must be valid 1681 } ADDR_COMPUTE_BASE_SWIZZLE_INPUT; 1682 1683 /** 1684 *************************************************************************************************** 1685 * ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT 1686 * 1687 * @brief 1688 * Output structure of AddrComputeBaseSwizzle 1689 *************************************************************************************************** 1690 */ 1691 typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT 1692 { 1693 UINT_32 size; ///< Size of this structure in bytes 1694 1695 UINT_32 tileSwizzle; ///< Combined swizzle 1696 } ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT; 1697 1698 /** 1699 *************************************************************************************************** 1700 * AddrComputeBaseSwizzle 1701 * 1702 * @brief 1703 * Return a Combined Bank and Pipe swizzle base on surface based on surface type/index 1704 * @return 1705 * ADDR_OK if no error 1706 *************************************************************************************************** 1707 */ 1708 ADDR_E_RETURNCODE ADDR_API AddrComputeBaseSwizzle( 1709 ADDR_HANDLE hLib, 1710 const ADDR_COMPUTE_BASE_SWIZZLE_INPUT* pIn, 1711 ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT* pOut); 1712 1713 1714 1715 /** 1716 *************************************************************************************************** 1717 * ELEM_GETEXPORTNORM_INPUT 1718 * 1719 * @brief 1720 * Input structure for ElemGetExportNorm 1721 * 1722 *************************************************************************************************** 1723 */ 1724 typedef struct _ELEM_GETEXPORTNORM_INPUT 1725 { 1726 UINT_32 size; ///< Size of this structure in bytes 1727 1728 AddrColorFormat format; ///< Color buffer format; Client should use ColorFormat 1729 AddrSurfaceNumber num; ///< Surface number type; Client should use NumberType 1730 AddrSurfaceSwap swap; ///< Surface swap byte swap; Client should use SurfaceSwap 1731 UINT_32 numSamples; ///< Number of samples 1732 } ELEM_GETEXPORTNORM_INPUT; 1733 1734 /** 1735 *************************************************************************************************** 1736 * ElemGetExportNorm 1737 * 1738 * @brief 1739 * Helper function to check one format can be EXPORT_NUM, which is a register 1740 * CB_COLOR_INFO.SURFACE_FORMAT. FP16 can be reported as EXPORT_NORM for rv770 in r600 1741 * family 1742 * @note 1743 * The implementation is only for r600. 1744 * 00 - EXPORT_FULL: PS exports are 4 pixels with 4 components with 32-bits-per-component. (two 1745 * clocks per export) 1746 * 01 - EXPORT_NORM: PS exports are 4 pixels with 4 components with 16-bits-per-component. (one 1747 * clock per export) 1748 * 1749 *************************************************************************************************** 1750 */ 1751 BOOL_32 ADDR_API ElemGetExportNorm( 1752 ADDR_HANDLE hLib, 1753 const ELEM_GETEXPORTNORM_INPUT* pIn); 1754 1755 1756 1757 /** 1758 *************************************************************************************************** 1759 * ELEM_FLT32TODEPTHPIXEL_INPUT 1760 * 1761 * @brief 1762 * Input structure for addrFlt32ToDepthPixel 1763 * 1764 *************************************************************************************************** 1765 */ 1766 typedef struct _ELEM_FLT32TODEPTHPIXEL_INPUT 1767 { 1768 UINT_32 size; ///< Size of this structure in bytes 1769 1770 AddrDepthFormat format; ///< Depth buffer format 1771 ADDR_FLT_32 comps[2]; ///< Component values (Z/stencil) 1772 } ELEM_FLT32TODEPTHPIXEL_INPUT; 1773 1774 /** 1775 *************************************************************************************************** 1776 * ELEM_FLT32TODEPTHPIXEL_INPUT 1777 * 1778 * @brief 1779 * Output structure for ElemFlt32ToDepthPixel 1780 * 1781 *************************************************************************************************** 1782 */ 1783 typedef struct _ELEM_FLT32TODEPTHPIXEL_OUTPUT 1784 { 1785 UINT_32 size; ///< Size of this structure in bytes 1786 1787 UINT_8* pPixel; ///< Real depth value. Same data type as depth buffer. 1788 /// Client must provide enough storage for this type. 1789 UINT_32 depthBase; ///< Tile base in bits for depth bits 1790 UINT_32 stencilBase; ///< Tile base in bits for stencil bits 1791 UINT_32 depthBits; ///< Bits for depth 1792 UINT_32 stencilBits; ///< Bits for stencil 1793 } ELEM_FLT32TODEPTHPIXEL_OUTPUT; 1794 1795 /** 1796 *************************************************************************************************** 1797 * ElemFlt32ToDepthPixel 1798 * 1799 * @brief 1800 * Convert a FLT_32 value to a depth/stencil pixel value 1801 * 1802 * @return 1803 * Return code 1804 * 1805 *************************************************************************************************** 1806 */ 1807 ADDR_E_RETURNCODE ADDR_API ElemFlt32ToDepthPixel( 1808 ADDR_HANDLE hLib, 1809 const ELEM_FLT32TODEPTHPIXEL_INPUT* pIn, 1810 ELEM_FLT32TODEPTHPIXEL_OUTPUT* pOut); 1811 1812 1813 1814 /** 1815 *************************************************************************************************** 1816 * ELEM_FLT32TOCOLORPIXEL_INPUT 1817 * 1818 * @brief 1819 * Input structure for addrFlt32ToColorPixel 1820 * 1821 *************************************************************************************************** 1822 */ 1823 typedef struct _ELEM_FLT32TOCOLORPIXEL_INPUT 1824 { 1825 UINT_32 size; ///< Size of this structure in bytes 1826 1827 AddrColorFormat format; ///< Color buffer format 1828 AddrSurfaceNumber surfNum; ///< Surface number 1829 AddrSurfaceSwap surfSwap; ///< Surface swap 1830 ADDR_FLT_32 comps[4]; ///< Component values (r/g/b/a) 1831 } ELEM_FLT32TOCOLORPIXEL_INPUT; 1832 1833 /** 1834 *************************************************************************************************** 1835 * ELEM_FLT32TOCOLORPIXEL_INPUT 1836 * 1837 * @brief 1838 * Output structure for ElemFlt32ToColorPixel 1839 * 1840 *************************************************************************************************** 1841 */ 1842 typedef struct _ELEM_FLT32TOCOLORPIXEL_OUTPUT 1843 { 1844 UINT_32 size; ///< Size of this structure in bytes 1845 1846 UINT_8* pPixel; ///< Real color value. Same data type as color buffer. 1847 /// Client must provide enough storage for this type. 1848 } ELEM_FLT32TOCOLORPIXEL_OUTPUT; 1849 1850 /** 1851 *************************************************************************************************** 1852 * ElemFlt32ToColorPixel 1853 * 1854 * @brief 1855 * Convert a FLT_32 value to a red/green/blue/alpha pixel value 1856 * 1857 * @return 1858 * Return code 1859 * 1860 *************************************************************************************************** 1861 */ 1862 ADDR_E_RETURNCODE ADDR_API ElemFlt32ToColorPixel( 1863 ADDR_HANDLE hLib, 1864 const ELEM_FLT32TOCOLORPIXEL_INPUT* pIn, 1865 ELEM_FLT32TOCOLORPIXEL_OUTPUT* pOut); 1866 1867 1868 /** 1869 *************************************************************************************************** 1870 * ADDR_CONVERT_TILEINFOTOHW_INPUT 1871 * 1872 * @brief 1873 * Input structure for AddrConvertTileInfoToHW 1874 * @note 1875 * When reverse is TRUE, indices are igonred 1876 *************************************************************************************************** 1877 */ 1878 typedef struct _ADDR_CONVERT_TILEINFOTOHW_INPUT 1879 { 1880 UINT_32 size; ///< Size of this structure in bytes 1881 BOOL_32 reverse; ///< Convert control flag. 1882 /// FALSE: convert from real value to HW value; 1883 /// TRUE: convert from HW value to real value. 1884 1885 /// r800 and later HWL parameters 1886 ADDR_TILEINFO* pTileInfo; ///< Tile parameters with real value 1887 1888 INT_32 tileIndex; ///< Tile index, MUST be -1 if you don't want to use it 1889 /// while the global useTileIndex is set to 1 1890 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1891 ///< README: When tileIndex is not -1, this must be valid 1892 } ADDR_CONVERT_TILEINFOTOHW_INPUT; 1893 1894 /** 1895 *************************************************************************************************** 1896 * ADDR_CONVERT_TILEINFOTOHW_OUTPUT 1897 * 1898 * @brief 1899 * Output structure for AddrConvertTileInfoToHW 1900 *************************************************************************************************** 1901 */ 1902 typedef struct _ADDR_CONVERT_TILEINFOTOHW_OUTPUT 1903 { 1904 UINT_32 size; ///< Size of this structure in bytes 1905 1906 /// r800 and later HWL parameters 1907 ADDR_TILEINFO* pTileInfo; ///< Tile parameters with hardware register value 1908 1909 } ADDR_CONVERT_TILEINFOTOHW_OUTPUT; 1910 1911 /** 1912 *************************************************************************************************** 1913 * AddrConvertTileInfoToHW 1914 * 1915 * @brief 1916 * Convert tile info from real value to hardware register value 1917 *************************************************************************************************** 1918 */ 1919 ADDR_E_RETURNCODE ADDR_API AddrConvertTileInfoToHW( 1920 ADDR_HANDLE hLib, 1921 const ADDR_CONVERT_TILEINFOTOHW_INPUT* pIn, 1922 ADDR_CONVERT_TILEINFOTOHW_OUTPUT* pOut); 1923 1924 1925 1926 /** 1927 *************************************************************************************************** 1928 * ADDR_CONVERT_TILEINDEX_INPUT 1929 * 1930 * @brief 1931 * Input structure for AddrConvertTileIndex 1932 *************************************************************************************************** 1933 */ 1934 typedef struct _ADDR_CONVERT_TILEINDEX_INPUT 1935 { 1936 UINT_32 size; ///< Size of this structure in bytes 1937 1938 INT_32 tileIndex; ///< Tile index 1939 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 1940 BOOL_32 tileInfoHw; ///< Set to TRUE if client wants HW enum, otherwise actual 1941 } ADDR_CONVERT_TILEINDEX_INPUT; 1942 1943 /** 1944 *************************************************************************************************** 1945 * ADDR_CONVERT_TILEINDEX_OUTPUT 1946 * 1947 * @brief 1948 * Output structure for AddrConvertTileIndex 1949 *************************************************************************************************** 1950 */ 1951 typedef struct _ADDR_CONVERT_TILEINDEX_OUTPUT 1952 { 1953 UINT_32 size; ///< Size of this structure in bytes 1954 1955 AddrTileMode tileMode; ///< Tile mode 1956 AddrTileType tileType; ///< Tile type 1957 ADDR_TILEINFO* pTileInfo; ///< Tile info 1958 1959 } ADDR_CONVERT_TILEINDEX_OUTPUT; 1960 1961 /** 1962 *************************************************************************************************** 1963 * AddrConvertTileIndex 1964 * 1965 * @brief 1966 * Convert tile index to tile mode/type/info 1967 *************************************************************************************************** 1968 */ 1969 ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex( 1970 ADDR_HANDLE hLib, 1971 const ADDR_CONVERT_TILEINDEX_INPUT* pIn, 1972 ADDR_CONVERT_TILEINDEX_OUTPUT* pOut); 1973 1974 1975 1976 /** 1977 *************************************************************************************************** 1978 * ADDR_CONVERT_TILEINDEX1_INPUT 1979 * 1980 * @brief 1981 * Input structure for AddrConvertTileIndex1 (without macro mode index) 1982 *************************************************************************************************** 1983 */ 1984 typedef struct _ADDR_CONVERT_TILEINDEX1_INPUT 1985 { 1986 UINT_32 size; ///< Size of this structure in bytes 1987 1988 INT_32 tileIndex; ///< Tile index 1989 UINT_32 bpp; ///< Bits per pixel 1990 UINT_32 numSamples; ///< Number of samples 1991 BOOL_32 tileInfoHw; ///< Set to TRUE if client wants HW enum, otherwise actual 1992 } ADDR_CONVERT_TILEINDEX1_INPUT; 1993 1994 /** 1995 *************************************************************************************************** 1996 * AddrConvertTileIndex1 1997 * 1998 * @brief 1999 * Convert tile index to tile mode/type/info 2000 *************************************************************************************************** 2001 */ 2002 ADDR_E_RETURNCODE ADDR_API AddrConvertTileIndex1( 2003 ADDR_HANDLE hLib, 2004 const ADDR_CONVERT_TILEINDEX1_INPUT* pIn, 2005 ADDR_CONVERT_TILEINDEX_OUTPUT* pOut); 2006 2007 2008 2009 /** 2010 *************************************************************************************************** 2011 * ADDR_GET_TILEINDEX_INPUT 2012 * 2013 * @brief 2014 * Input structure for AddrGetTileIndex 2015 *************************************************************************************************** 2016 */ 2017 typedef struct _ADDR_GET_TILEINDEX_INPUT 2018 { 2019 UINT_32 size; ///< Size of this structure in bytes 2020 2021 AddrTileMode tileMode; ///< Tile mode 2022 AddrTileType tileType; ///< Tile-type: disp/non-disp/... 2023 ADDR_TILEINFO* pTileInfo; ///< Pointer to tile-info structure, can be NULL for linear/1D 2024 } ADDR_GET_TILEINDEX_INPUT; 2025 2026 /** 2027 *************************************************************************************************** 2028 * ADDR_GET_TILEINDEX_OUTPUT 2029 * 2030 * @brief 2031 * Output structure for AddrGetTileIndex 2032 *************************************************************************************************** 2033 */ 2034 typedef struct _ADDR_GET_TILEINDEX_OUTPUT 2035 { 2036 UINT_32 size; ///< Size of this structure in bytes 2037 2038 INT_32 index; ///< index in table 2039 } ADDR_GET_TILEINDEX_OUTPUT; 2040 2041 /** 2042 *************************************************************************************************** 2043 * AddrGetTileIndex 2044 * 2045 * @brief 2046 * Get the tiling mode index in table 2047 *************************************************************************************************** 2048 */ 2049 ADDR_E_RETURNCODE ADDR_API AddrGetTileIndex( 2050 ADDR_HANDLE hLib, 2051 const ADDR_GET_TILEINDEX_INPUT* pIn, 2052 ADDR_GET_TILEINDEX_OUTPUT* pOut); 2053 2054 2055 2056 2057 /** 2058 *************************************************************************************************** 2059 * ADDR_PRT_INFO_INPUT 2060 * 2061 * @brief 2062 * Input structure for AddrComputePrtInfo 2063 *************************************************************************************************** 2064 */ 2065 typedef struct _ADDR_PRT_INFO_INPUT 2066 { 2067 AddrFormat format; ///< Surface format 2068 UINT_32 baseMipWidth; ///< Base mipmap width 2069 UINT_32 baseMipHeight; ///< Base mipmap height 2070 UINT_32 baseMipDepth; ///< Base mipmap depth 2071 UINT_32 numFrags; ///< Number of fragments, 2072 } ADDR_PRT_INFO_INPUT; 2073 2074 /** 2075 *************************************************************************************************** 2076 * ADDR_PRT_INFO_OUTPUT 2077 * 2078 * @brief 2079 * Input structure for AddrComputePrtInfo 2080 *************************************************************************************************** 2081 */ 2082 typedef struct _ADDR_PRT_INFO_OUTPUT 2083 { 2084 UINT_32 prtTileWidth; 2085 UINT_32 prtTileHeight; 2086 } ADDR_PRT_INFO_OUTPUT; 2087 2088 /** 2089 *************************************************************************************************** 2090 * AddrComputePrtInfo 2091 * 2092 * @brief 2093 * Compute prt surface related information 2094 *************************************************************************************************** 2095 */ 2096 ADDR_E_RETURNCODE ADDR_API AddrComputePrtInfo( 2097 ADDR_HANDLE hLib, 2098 const ADDR_PRT_INFO_INPUT* pIn, 2099 ADDR_PRT_INFO_OUTPUT* pOut); 2100 2101 /////////////////////////////////////////////////////////////////////////////////////////////////// 2102 // DCC key functions 2103 /////////////////////////////////////////////////////////////////////////////////////////////////// 2104 2105 /** 2106 *************************************************************************************************** 2107 * _ADDR_COMPUTE_DCCINFO_INPUT 2108 * 2109 * @brief 2110 * Input structure of AddrComputeDccInfo 2111 *************************************************************************************************** 2112 */ 2113 typedef struct _ADDR_COMPUTE_DCCINFO_INPUT 2114 { 2115 UINT_32 size; ///< Size of this structure in bytes 2116 UINT_32 bpp; ///< BitPP of color surface 2117 UINT_32 numSamples; ///< Sample number of color surface 2118 UINT_64 colorSurfSize; ///< Size of color surface to which dcc key is bound 2119 AddrTileMode tileMode; ///< Tile mode of color surface 2120 ADDR_TILEINFO tileInfo; ///< Tile info of color surface 2121 UINT_32 tileSwizzle; ///< Tile swizzle 2122 INT_32 tileIndex; ///< Tile index of color surface, 2123 ///< MUST be -1 if you don't want to use it 2124 ///< while the global useTileIndex is set to 1 2125 INT_32 macroModeIndex; ///< Index in macro tile mode table if there is one (CI) 2126 ///< README: When tileIndex is not -1, this must be valid 2127 } ADDR_COMPUTE_DCCINFO_INPUT; 2128 2129 /** 2130 *************************************************************************************************** 2131 * ADDR_COMPUTE_DCCINFO_OUTPUT 2132 * 2133 * @brief 2134 * Output structure of AddrComputeDccInfo 2135 *************************************************************************************************** 2136 */ 2137 typedef struct _ADDR_COMPUTE_DCCINFO_OUTPUT 2138 { 2139 UINT_32 size; ///< Size of this structure in bytes 2140 UINT_64 dccRamBaseAlign; ///< Base alignment of dcc key 2141 UINT_64 dccRamSize; ///< Size of dcc key 2142 UINT_64 dccFastClearSize; ///< Size of dcc key portion that can be fast cleared 2143 BOOL_32 subLvlCompressible; ///< whether sub resource is compressiable 2144 } ADDR_COMPUTE_DCCINFO_OUTPUT; 2145 2146 /** 2147 *************************************************************************************************** 2148 * AddrComputeDccInfo 2149 * 2150 * @brief 2151 * Compute DCC key size, base alignment 2152 * info 2153 *************************************************************************************************** 2154 */ 2155 ADDR_E_RETURNCODE ADDR_API AddrComputeDccInfo( 2156 ADDR_HANDLE hLib, 2157 const ADDR_COMPUTE_DCCINFO_INPUT* pIn, 2158 ADDR_COMPUTE_DCCINFO_OUTPUT* pOut); 2159 2160 #if defined(__cplusplus) 2161 } 2162 #endif 2163 2164 #endif // __ADDR_INTERFACE_H__ 2165 2166 2167