2 * Copyright © 2014 Advanced Micro Devices, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16 * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
17 * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
28 ****************************************************************************************************
29 * @file addrinterface.h
30 * @brief Contains the addrlib interfaces declaration and parameter defines
31 ****************************************************************************************************
33 #ifndef __ADDR_INTERFACE_H__
34 #define __ADDR_INTERFACE_H__
36 #include "addrtypes.h"
38 #if defined(__cplusplus)
43 #define ADDRLIB_VERSION_MAJOR 6
44 #define ADDRLIB_VERSION_MINOR 2
45 #define ADDRLIB_VERSION ((ADDRLIB_VERSION_MAJOR << 16) | ADDRLIB_VERSION_MINOR)
47 /// Virtually all interface functions need ADDR_HANDLE as first parameter
48 typedef VOID
* ADDR_HANDLE
;
50 /// Client handle used in callbacks
51 typedef VOID
* ADDR_CLIENT_HANDLE
;
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)(
61 * typedef ADDR_E_RETURNCODE (ADDR_API* ADDR_DEBUGPRINT)(
62 * const ADDR_DEBUGPRINT_INPUT* pInput);
64 * /////////////////////////////////////////////////////////////////////////////////////////////////
65 * // Create/Destroy/Config functions
66 * /////////////////////////////////////////////////////////////////////////////////////////////////
70 * /////////////////////////////////////////////////////////////////////////////////////////////////
71 * // Surface functions
72 * /////////////////////////////////////////////////////////////////////////////////////////////////
73 * AddrComputeSurfaceInfo()
74 * AddrComputeSurfaceAddrFromCoord()
75 * AddrComputeSurfaceCoordFromAddr()
77 * /////////////////////////////////////////////////////////////////////////////////////////////////
79 * /////////////////////////////////////////////////////////////////////////////////////////////////
80 * AddrComputeHtileInfo()
81 * AddrComputeHtileAddrFromCoord()
82 * AddrComputeHtileCoordFromAddr()
84 * /////////////////////////////////////////////////////////////////////////////////////////////////
86 * /////////////////////////////////////////////////////////////////////////////////////////////////
87 * AddrComputeCmaskInfo()
88 * AddrComputeCmaskAddrFromCoord()
89 * AddrComputeCmaskCoordFromAddr()
91 * /////////////////////////////////////////////////////////////////////////////////////////////////
93 * /////////////////////////////////////////////////////////////////////////////////////////////////
94 * AddrComputeFmaskInfo()
95 * AddrComputeFmaskAddrFromCoord()
96 * AddrComputeFmaskCoordFromAddr()
98 * /////////////////////////////////////////////////////////////////////////////////////////////////
99 * // Element/Utility functions
100 * /////////////////////////////////////////////////////////////////////////////////////////////////
101 * ElemFlt32ToDepthPixel()
102 * ElemFlt32ToColorPixel()
103 * AddrExtractBankPipeSwizzle()
104 * AddrCombineBankPipeSwizzle()
105 * AddrComputeSliceSwizzle()
106 * AddrConvertTileInfoToHW()
107 * AddrConvertTileIndex()
108 * AddrConvertTileIndex1()
110 * AddrComputeBaseSwizzle()
112 * AddrUseCombinedSwizzle()
116 ////////////////////////////////////////////////////////////////////////////////////////////////////
117 // Callback functions
118 ////////////////////////////////////////////////////////////////////////////////////////////////////
121 ****************************************************************************************************
122 * @brief channel setting structure
123 ****************************************************************************************************
125 typedef union _ADDR_CHANNEL_SETTING
129 UINT_8 valid
: 1; ///< Indicate whehter this channel setting is valid
130 UINT_8 channel
: 2; ///< 0 for x channel, 1 for y channel, 2 for z channel
131 UINT_8 index
: 5; ///< Channel index
133 UINT_8 value
; ///< Value
134 } ADDR_CHANNEL_SETTING
;
137 ****************************************************************************************************
138 * @brief address equation key structure
139 ****************************************************************************************************
141 typedef union _ADDR_EQUATION_KEY
145 UINT_32 log2ElementBytes
: 3; ///< Log2 of Bytes per pixel
146 UINT_32 tileMode
: 5; ///< Tile mode
147 UINT_32 microTileType
: 3; ///< Micro tile type
148 UINT_32 pipeConfig
: 5; ///< pipe config
149 UINT_32 numBanksLog2
: 3; ///< Number of banks log2
150 UINT_32 bankWidth
: 4; ///< Bank width
151 UINT_32 bankHeight
: 4; ///< Bank height
152 UINT_32 macroAspectRatio
: 3; ///< Macro tile aspect ratio
153 UINT_32 prt
: 1; ///< SI only, indicate whether this equation is for prt
154 UINT_32 reserved
: 1; ///< Reserved bit
160 ****************************************************************************************************
161 * @brief address equation structure
162 ****************************************************************************************************
164 #define ADDR_MAX_EQUATION_BIT 20u
166 // Invalid equation index
167 #define ADDR_INVALID_EQUATION_INDEX 0xFFFFFFFF
169 typedef struct _ADDR_EQUATION
171 ADDR_CHANNEL_SETTING addr
[ADDR_MAX_EQUATION_BIT
]; ///< addr setting
172 ///< each bit is result of addr ^ xor ^ xor2
173 ADDR_CHANNEL_SETTING xor1
[ADDR_MAX_EQUATION_BIT
]; ///< xor setting
174 ADDR_CHANNEL_SETTING xor2
[ADDR_MAX_EQUATION_BIT
]; ///< xor2 setting
175 UINT_32 numBits
; ///< The number of bits in equation
176 BOOL_32 stackedDepthSlices
; ///< TRUE if depth slices are treated as being
177 ///< stacked vertically prior to swizzling
182 ****************************************************************************************************
183 * @brief Alloc system memory flags.
184 * @note These flags are reserved for future use and if flags are added will minimize the impact
186 ****************************************************************************************************
188 typedef union _ADDR_ALLOCSYSMEM_FLAGS
192 UINT_32 reserved
: 32; ///< Reserved for future use.
196 } ADDR_ALLOCSYSMEM_FLAGS
;
199 ****************************************************************************************************
200 * @brief Alloc system memory input structure
201 ****************************************************************************************************
203 typedef struct _ADDR_ALLOCSYSMEM_INPUT
205 UINT_32 size
; ///< Size of this structure in bytes
207 ADDR_ALLOCSYSMEM_FLAGS flags
; ///< System memory flags.
208 UINT_32 sizeInBytes
; ///< System memory allocation size in bytes.
209 ADDR_CLIENT_HANDLE hClient
; ///< Client handle
210 } ADDR_ALLOCSYSMEM_INPUT
;
213 ****************************************************************************************************
216 * Allocate system memory callback function. Returns valid pointer on success.
217 ****************************************************************************************************
219 typedef VOID
* (ADDR_API
* ADDR_ALLOCSYSMEM
)(
220 const ADDR_ALLOCSYSMEM_INPUT
* pInput
);
223 ****************************************************************************************************
224 * @brief Free system memory input structure
225 ****************************************************************************************************
227 typedef struct _ADDR_FREESYSMEM_INPUT
229 UINT_32 size
; ///< Size of this structure in bytes
231 VOID
* pVirtAddr
; ///< Virtual address
232 ADDR_CLIENT_HANDLE hClient
; ///< Client handle
233 } ADDR_FREESYSMEM_INPUT
;
236 ****************************************************************************************************
239 * Free system memory callback function.
240 * Returns ADDR_OK on success.
241 ****************************************************************************************************
243 typedef ADDR_E_RETURNCODE (ADDR_API
* ADDR_FREESYSMEM
)(
244 const ADDR_FREESYSMEM_INPUT
* pInput
);
247 ****************************************************************************************************
248 * @brief Print debug message input structure
249 ****************************************************************************************************
251 typedef struct _ADDR_DEBUGPRINT_INPUT
253 UINT_32 size
; ///< Size of this structure in bytes
255 CHAR
* pDebugString
; ///< Debug print string
256 va_list ap
; ///< Variable argument list
257 ADDR_CLIENT_HANDLE hClient
; ///< Client handle
258 } ADDR_DEBUGPRINT_INPUT
;
261 ****************************************************************************************************
264 * Print debug message callback function.
265 * Returns ADDR_OK on success.
266 ****************************************************************************************************
268 typedef ADDR_E_RETURNCODE (ADDR_API
* ADDR_DEBUGPRINT
)(
269 const ADDR_DEBUGPRINT_INPUT
* pInput
);
272 ****************************************************************************************************
276 * Address Library needs client to provide system memory alloc/free routines.
277 ****************************************************************************************************
279 typedef struct _ADDR_CALLBACKS
281 ADDR_ALLOCSYSMEM allocSysMem
; ///< Routine to allocate system memory
282 ADDR_FREESYSMEM freeSysMem
; ///< Routine to free system memory
283 ADDR_DEBUGPRINT debugPrint
; ///< Routine to print debug message
286 ////////////////////////////////////////////////////////////////////////////////////////////////////
287 // Create/Destroy functions
288 ////////////////////////////////////////////////////////////////////////////////////////////////////
291 ****************************************************************************************************
295 * This structure is used to pass some setup in creation of AddrLib
297 ****************************************************************************************************
299 typedef union _ADDR_CREATE_FLAGS
303 UINT_32 noCubeMipSlicesPad
: 1; ///< Turn cubemap faces padding off
304 UINT_32 fillSizeFields
: 1; ///< If clients fill size fields in all input and
306 UINT_32 useTileIndex
: 1; ///< Make tileIndex field in input valid
307 UINT_32 useCombinedSwizzle
: 1; ///< Use combined tile swizzle
308 UINT_32 checkLast2DLevel
: 1; ///< Check the last 2D mip sub level
309 UINT_32 useHtileSliceAlign
: 1; ///< Do htile single slice alignment
310 UINT_32 allowLargeThickTile
: 1; ///< Allow 64*thickness*bytesPerPixel > rowSize
311 UINT_32 reserved
: 25; ///< Reserved bits for future use
318 ****************************************************************************************************
319 * ADDR_REGISTER_VALUE
322 * Data from registers to setup AddrLib global data, used in AddrCreate
323 ****************************************************************************************************
325 typedef struct _ADDR_REGISTER_VALUE
327 UINT_32 gbAddrConfig
; ///< For R8xx, use GB_ADDR_CONFIG register value.
328 /// For R6xx/R7xx, use GB_TILING_CONFIG.
329 /// But they can be treated as the same.
330 /// if this value is 0, use chip to set default value
331 UINT_32 backendDisables
; ///< 1 bit per backend, starting with LSB. 1=disabled,0=enabled.
332 /// Register value of CC_RB_BACKEND_DISABLE.BACKEND_DISABLE
334 /// R800 registers-----------------------------------------------
335 UINT_32 noOfBanks
; ///< Number of h/w ram banks - For r800: MC_ARB_RAMCFG.NOOFBANK
336 /// No enums for this value in h/w header files
340 UINT_32 noOfRanks
; /// MC_ARB_RAMCFG.NOOFRANK
343 /// SI (R1000) registers-----------------------------------------
344 const UINT_32
* pTileConfig
; ///< Global tile setting tables
345 UINT_32 noOfEntries
; ///< Number of entries in pTileConfig
347 ///< CI registers-------------------------------------------------
348 const UINT_32
* pMacroTileConfig
; ///< Global macro tile mode table
349 UINT_32 noOfMacroEntries
; ///< Number of entries in pMacroTileConfig
351 ///< GFX9 HW parameters
352 UINT_32 blockVarSizeLog2
; ///< SW_VAR_* block size
353 } ADDR_REGISTER_VALUE
;
356 ****************************************************************************************************
360 * Parameters use to create an AddrLib Object. Caller must provide all fields.
362 ****************************************************************************************************
364 typedef struct _ADDR_CREATE_INPUT
366 UINT_32 size
; ///< Size of this structure in bytes
368 UINT_32 chipEngine
; ///< Chip Engine
369 UINT_32 chipFamily
; ///< Chip Family
370 UINT_32 chipRevision
; ///< Chip Revision
371 ADDR_CALLBACKS callbacks
; ///< Callbacks for sysmem alloc/free/print
372 ADDR_CREATE_FLAGS createFlags
; ///< Flags to setup AddrLib
373 ADDR_REGISTER_VALUE regValue
; ///< Data from registers to setup AddrLib global data
374 ADDR_CLIENT_HANDLE hClient
; ///< Client handle
375 UINT_32 minPitchAlignPixels
; ///< Minimum pitch alignment in pixels
379 ****************************************************************************************************
380 * ADDR_CREATEINFO_OUTPUT
383 * Return AddrLib handle to client driver
385 ****************************************************************************************************
387 typedef struct _ADDR_CREATE_OUTPUT
389 UINT_32 size
; ///< Size of this structure in bytes
391 ADDR_HANDLE hLib
; ///< Address lib handle
393 UINT_32 numEquations
; ///< Number of equations in the table
394 const ADDR_EQUATION
* pEquationTable
; ///< Pointer to the equation table
395 } ADDR_CREATE_OUTPUT
;
398 ****************************************************************************************************
402 * Create AddrLib object, must be called before any interface calls
405 * ADDR_OK if successful
406 ****************************************************************************************************
408 ADDR_E_RETURNCODE ADDR_API
AddrCreate(
409 const ADDR_CREATE_INPUT
* pAddrCreateIn
,
410 ADDR_CREATE_OUTPUT
* pAddrCreateOut
);
415 ****************************************************************************************************
419 * Destroy AddrLib object, must be called to free internally allocated resources.
422 * ADDR_OK if successful
423 ****************************************************************************************************
425 ADDR_E_RETURNCODE ADDR_API
AddrDestroy(
430 ////////////////////////////////////////////////////////////////////////////////////////////////////
432 ////////////////////////////////////////////////////////////////////////////////////////////////////
435 ****************************************************************************************************
437 * Bank/tiling parameters. On function input, these can be set as desired or
438 * left 0 for AddrLib to calculate/default. On function output, these are the actual
441 * Valid bankWidth/bankHeight value:
442 * 1,2,4,8. They are factors instead of pixels or bytes.
444 * The bank number remains constant across each row of the
445 * macro tile as each pipe is selected, so the number of
446 * tiles in the x direction with the same bank number will
447 * be bank_width * num_pipes.
448 ****************************************************************************************************
450 typedef struct _ADDR_TILEINFO
452 /// Any of these parameters can be set to 0 to use the HW default.
453 UINT_32 banks
; ///< Number of banks, numerical value
454 UINT_32 bankWidth
; ///< Number of tiles in the X direction in the same bank
455 UINT_32 bankHeight
; ///< Number of tiles in the Y direction in the same bank
456 UINT_32 macroAspectRatio
; ///< Macro tile aspect ratio. 1-1:1, 2-4:1, 4-16:1, 8-64:1
457 UINT_32 tileSplitBytes
; ///< Tile split size, in bytes
458 AddrPipeCfg pipeConfig
; ///< Pipe Config = HW enum + 1
461 // Create a define to avoid client change. The removal of R800 is because we plan to implement SI
462 // within 800 HWL - An AddrPipeCfg is added in above data structure
463 typedef ADDR_TILEINFO ADDR_R800_TILEINFO
;
466 ****************************************************************************************************
468 * Information needed by quad buffer stereo support
469 ****************************************************************************************************
471 typedef struct _ADDR_QBSTEREOINFO
473 UINT_32 eyeHeight
; ///< Height (in pixel rows) to right eye
474 UINT_32 rightOffset
; ///< Offset (in bytes) to right eye
475 UINT_32 rightSwizzle
; ///< TileSwizzle for right eyes
479 ****************************************************************************************************
484 ****************************************************************************************************
486 typedef union _ADDR_SURFACE_FLAGS
490 UINT_32 color
: 1; ///< Flag indicates this is a color buffer
491 UINT_32 depth
: 1; ///< Flag indicates this is a depth/stencil buffer
492 UINT_32 stencil
: 1; ///< Flag indicates this is a stencil buffer
493 UINT_32 texture
: 1; ///< Flag indicates this is a texture
494 UINT_32 cube
: 1; ///< Flag indicates this is a cubemap
495 UINT_32 volume
: 1; ///< Flag indicates this is a volume texture
496 UINT_32 fmask
: 1; ///< Flag indicates this is an fmask
497 UINT_32 cubeAsArray
: 1; ///< Flag indicates if treat cubemap as arrays
498 UINT_32 compressZ
: 1; ///< Flag indicates z buffer is compressed
499 UINT_32 overlay
: 1; ///< Flag indicates this is an overlay surface
500 UINT_32 noStencil
: 1; ///< Flag indicates this depth has no separate stencil
501 UINT_32 display
: 1; ///< Flag indicates this should match display controller req.
502 UINT_32 opt4Space
: 1; ///< Flag indicates this surface should be optimized for space
503 /// i.e. save some memory but may lose performance
504 UINT_32 prt
: 1; ///< Flag for partially resident texture
505 UINT_32 qbStereo
: 1; ///< Quad buffer stereo surface
506 UINT_32 pow2Pad
: 1; ///< SI: Pad to pow2, must set for mipmap (include level0)
507 UINT_32 interleaved
: 1; ///< Special flag for interleaved YUV surface padding
508 UINT_32 tcCompatible
: 1; ///< Flag indicates surface needs to be shader readable
509 UINT_32 dispTileType
: 1; ///< NI: force display Tiling for 128 bit shared resoruce
510 UINT_32 dccCompatible
: 1; ///< VI: whether to make MSAA surface support dcc fast clear
511 UINT_32 dccPipeWorkaround
: 1; ///< VI: whether to workaround the HW limit that
512 /// dcc can't be enabled if pipe config of tile mode
513 /// is different from that of ASIC, this flag
514 /// is address lib internal flag, client should ignore it
515 UINT_32 czDispCompatible
: 1; ///< SI+: CZ family has a HW bug needs special alignment.
516 /// This flag indicates we need to follow the
517 /// alignment with CZ families or other ASICs under
518 /// PX configuration + CZ.
519 UINT_32 nonSplit
: 1; ///< CI: depth texture should not be split
520 UINT_32 disableLinearOpt
: 1; ///< Disable tile mode optimization to linear
521 UINT_32 needEquation
: 1; ///< Make the surface tile setting equation compatible.
522 /// This flag indicates we need to override tile
523 /// mode to PRT_* tile mode to disable slice rotation,
524 /// which is needed by swizzle pattern equation.
525 UINT_32 skipIndicesOutput
: 1; ///< Skipping indices in output.
526 UINT_32 rotateDisplay
: 1; ///< Rotate micro tile type
527 UINT_32 minimizeAlignment
: 1; ///< Minimize alignment
528 UINT_32 preferEquation
: 1; ///< Return equation index without adjusting tile mode
529 UINT_32 matchStencilTileCfg
: 1; ///< Select tile index of stencil as well as depth surface
530 /// to make sure they share same tile config parameters
531 UINT_32 reserved
: 2; ///< Reserved bits
535 } ADDR_SURFACE_FLAGS
;
538 ****************************************************************************************************
539 * ADDR_COMPUTE_SURFACE_INFO_INPUT
542 * Input structure for AddrComputeSurfaceInfo
543 ****************************************************************************************************
545 typedef struct _ADDR_COMPUTE_SURFACE_INFO_INPUT
547 UINT_32 size
; ///< Size of this structure in bytes
549 AddrTileMode tileMode
; ///< Tile mode
550 AddrFormat format
; ///< If format is set to valid one, bpp/width/height
551 /// might be overwritten
552 UINT_32 bpp
; ///< Bits per pixel
553 UINT_32 numSamples
; ///< Number of samples
554 UINT_32 width
; ///< Width, in pixels
555 UINT_32 height
; ///< Height, in pixels
556 UINT_32 numSlices
; ///< Number of surface slices or depth
557 UINT_32 slice
; ///< Slice index
558 UINT_32 mipLevel
; ///< Current mipmap level
559 UINT_32 numMipLevels
; ///< Number of mips in mip chain
560 ADDR_SURFACE_FLAGS flags
; ///< Surface type flags
561 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
562 /// number of samples for normal AA; Set it to the
563 /// number of fragments for EQAA
564 /// r800 and later HWL parameters
565 // Needed by 2D tiling, for linear and 1D tiling, just keep them 0's
566 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Set to 0 to default/calculate
567 AddrTileType tileType
; ///< Micro tiling type, not needed when tileIndex != -1
568 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
569 /// while the global useTileIndex is set to 1
570 UINT_32 basePitch
; ///< Base level pitch in pixels, 0 means ignored, is a
571 /// must for mip levels from SI+.
572 /// Don't use pitch in blocks for compressed formats!
573 UINT_32 maxBaseAlign
; ///< Max base alignment request from client
574 UINT_32 pitchAlign
; ///< Pitch alignment request from client
575 UINT_32 heightAlign
; ///< Height alignment request from client
576 } ADDR_COMPUTE_SURFACE_INFO_INPUT
;
579 ****************************************************************************************************
580 * ADDR_COMPUTE_SURFACE_INFO_OUTPUT
583 * Output structure for AddrComputeSurfInfo
585 Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch
586 Pixel: Original pixel
587 ****************************************************************************************************
589 typedef struct _ADDR_COMPUTE_SURFACE_INFO_OUTPUT
591 UINT_32 size
; ///< Size of this structure in bytes
593 UINT_32 pitch
; ///< Pitch in elements (in blocks for compressed formats)
594 UINT_32 height
; ///< Height in elements (in blocks for compressed formats)
595 UINT_32 depth
; ///< Number of slice/depth
596 UINT_64 surfSize
; ///< Surface size in bytes
597 AddrTileMode tileMode
; ///< Actual tile mode. May differ from that in input
598 UINT_32 baseAlign
; ///< Base address alignment
599 UINT_32 pitchAlign
; ///< Pitch alignment, in elements
600 UINT_32 heightAlign
; ///< Height alignment, in elements
601 UINT_32 depthAlign
; ///< Depth alignment, aligned to thickness, for 3d texture
602 UINT_32 bpp
; ///< Bits per elements (e.g. blocks for BCn, 1/3 for 96bit)
603 UINT_32 pixelPitch
; ///< Pitch in original pixels
604 UINT_32 pixelHeight
; ///< Height in original pixels
605 UINT_32 pixelBits
; ///< Original bits per pixel, passed from input
606 UINT_64 sliceSize
; ///< Size of slice specified by input's slice
607 /// The result is controlled by surface flags & createFlags
608 /// By default this value equals to surfSize for volume
609 UINT_32 pitchTileMax
; ///< PITCH_TILE_MAX value for h/w register
610 UINT_32 heightTileMax
; ///< HEIGHT_TILE_MAX value for h/w register
611 UINT_32 sliceTileMax
; ///< SLICE_TILE_MAX value for h/w register
613 UINT_32 numSamples
; ///< Pass the effective numSamples processed in this call
615 /// r800 and later HWL parameters
616 ADDR_TILEINFO
* pTileInfo
; ///< Tile parameters used. Filled in if 0 on input
617 AddrTileType tileType
; ///< Micro tiling type, only valid when tileIndex != -1
618 INT_32 tileIndex
; ///< Tile index, MAY be "downgraded"
620 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
624 /// Special information to work around SI mipmap swizzle bug UBTS #317508
625 UINT_32 last2DLevel
: 1; ///< TRUE if this is the last 2D(3D) tiled
626 ///< Only meaningful when create flag checkLast2DLevel is set
627 UINT_32 tcCompatible
: 1; ///< If the surface can be shader compatible
628 UINT_32 dccUnsupport
: 1; ///< If the surface can support DCC compressed rendering
629 UINT_32 prtTileIndex
: 1; ///< SI only, indicate the returned tile index is for PRT
630 ///< If address lib return true for mip 0, client should set prt flag
631 ///< for child mips in subsequent compute surface info calls
632 UINT_32 reserved
:28; ///< Reserved bits
635 UINT_32 equationIndex
; ///< Equation index in the equation table;
637 UINT_32 blockWidth
; ///< Width in element inside one block(1D->Micro, 2D->Macro)
638 UINT_32 blockHeight
; ///< Height in element inside one block(1D->Micro, 2D->Macro)
639 UINT_32 blockSlices
; ///< Slice number inside one block(1D->Micro, 2D->Macro)
642 ADDR_QBSTEREOINFO
* pStereoInfo
;///< Stereo information, needed when .qbStereo flag is TRUE
644 INT_32 stencilTileIdx
; ///< stencil tile index output when matchStencilTileCfg was set
645 } ADDR_COMPUTE_SURFACE_INFO_OUTPUT
;
648 ****************************************************************************************************
649 * AddrComputeSurfaceInfo
652 * Compute surface width/height/depth/alignments and suitable tiling mode
653 ****************************************************************************************************
655 ADDR_E_RETURNCODE ADDR_API
AddrComputeSurfaceInfo(
657 const ADDR_COMPUTE_SURFACE_INFO_INPUT
* pIn
,
658 ADDR_COMPUTE_SURFACE_INFO_OUTPUT
* pOut
);
663 ****************************************************************************************************
664 * ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
667 * Input structure for AddrComputeSurfaceAddrFromCoord
668 ****************************************************************************************************
670 typedef struct _ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
672 UINT_32 size
; ///< Size of this structure in bytes
674 UINT_32 x
; ///< X coordinate
675 UINT_32 y
; ///< Y coordinate
676 UINT_32 slice
; ///< Slice index
677 UINT_32 sample
; ///< Sample index, use fragment index for EQAA
679 UINT_32 bpp
; ///< Bits per pixel
680 UINT_32 pitch
; ///< Surface pitch, in pixels
681 UINT_32 height
; ///< Surface height, in pixels
682 UINT_32 numSlices
; ///< Surface depth
683 UINT_32 numSamples
; ///< Number of samples
685 AddrTileMode tileMode
; ///< Tile mode
686 BOOL_32 isDepth
; ///< TRUE if the surface uses depth sample ordering within
687 /// micro tile. Textures can also choose depth sample order
688 UINT_32 tileBase
; ///< Base offset (in bits) inside micro tile which handles
689 /// the case that components are stored separately
690 UINT_32 compBits
; ///< The component bits actually needed(for planar surface)
692 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
693 /// number of samples for normal AA; Set it to the
694 /// number of fragments for EQAA
695 /// r800 and later HWL parameters
696 // Used for 1D tiling above
697 AddrTileType tileType
; ///< See defintion of AddrTileType
700 UINT_32 ignoreSE
: 1; ///< TRUE if shader engines are ignored. This is texture
701 /// only flag. Only non-RT texture can set this to TRUE
702 UINT_32 reserved
:31; ///< Reserved for future use.
704 // 2D tiling needs following structure
705 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
706 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
707 /// while the global useTileIndex is set to 1
712 UINT_32 bankSwizzle
; ///< Bank swizzle
713 UINT_32 pipeSwizzle
; ///< Pipe swizzle
715 UINT_32 tileSwizzle
; ///< Combined swizzle, if useCombinedSwizzle is TRUE
717 } ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
;
720 ****************************************************************************************************
721 * ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
724 * Output structure for AddrComputeSurfaceAddrFromCoord
725 ****************************************************************************************************
727 typedef struct _ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
729 UINT_32 size
; ///< Size of this structure in bytes
731 UINT_64 addr
; ///< Byte address
732 UINT_32 bitPosition
; ///< Bit position within surfaceAddr, 0-7.
733 /// For surface bpp < 8, e.g. FMT_1.
734 UINT_32 prtBlockIndex
; ///< Index of a PRT tile (64K block)
735 } ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
;
738 ****************************************************************************************************
739 * AddrComputeSurfaceAddrFromCoord
742 * Compute surface address from a given coordinate.
743 ****************************************************************************************************
745 ADDR_E_RETURNCODE ADDR_API
AddrComputeSurfaceAddrFromCoord(
747 const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
* pIn
,
748 ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
* pOut
);
753 ****************************************************************************************************
754 * ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
757 * Input structure for AddrComputeSurfaceCoordFromAddr
758 ****************************************************************************************************
760 typedef struct _ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
762 UINT_32 size
; ///< Size of this structure in bytes
764 UINT_64 addr
; ///< Address in bytes
765 UINT_32 bitPosition
; ///< Bit position in addr. 0-7. for surface bpp < 8,
767 UINT_32 bpp
; ///< Bits per pixel
768 UINT_32 pitch
; ///< Pitch, in pixels
769 UINT_32 height
; ///< Height in pixels
770 UINT_32 numSlices
; ///< Surface depth
771 UINT_32 numSamples
; ///< Number of samples
773 AddrTileMode tileMode
; ///< Tile mode
774 BOOL_32 isDepth
; ///< Surface uses depth sample ordering within micro tile.
775 /// Note: Textures can choose depth sample order as well.
776 UINT_32 tileBase
; ///< Base offset (in bits) inside micro tile which handles
777 /// the case that components are stored separately
778 UINT_32 compBits
; ///< The component bits actually needed(for planar surface)
780 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
781 /// number of samples for normal AA; Set it to the
782 /// number of fragments for EQAA
783 /// r800 and later HWL parameters
784 // Used for 1D tiling above
785 AddrTileType tileType
; ///< See defintion of AddrTileType
788 UINT_32 ignoreSE
: 1; ///< TRUE if shader engines are ignored. This is texture
789 /// only flag. Only non-RT texture can set this to TRUE
790 UINT_32 reserved
:31; ///< Reserved for future use.
792 // 2D tiling needs following structure
793 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
794 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
795 /// while the global useTileIndex is set to 1
800 UINT_32 bankSwizzle
; ///< Bank swizzle
801 UINT_32 pipeSwizzle
; ///< Pipe swizzle
803 UINT_32 tileSwizzle
; ///< Combined swizzle, if useCombinedSwizzle is TRUE
805 } ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
;
808 ****************************************************************************************************
809 * ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
812 * Output structure for AddrComputeSurfaceCoordFromAddr
813 ****************************************************************************************************
815 typedef struct _ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
817 UINT_32 size
; ///< Size of this structure in bytes
819 UINT_32 x
; ///< X coordinate
820 UINT_32 y
; ///< Y coordinate
821 UINT_32 slice
; ///< Index of slices
822 UINT_32 sample
; ///< Index of samples, means fragment index for EQAA
823 } ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
;
826 ****************************************************************************************************
827 * AddrComputeSurfaceCoordFromAddr
830 * Compute coordinate from a given surface address
831 ****************************************************************************************************
833 ADDR_E_RETURNCODE ADDR_API
AddrComputeSurfaceCoordFromAddr(
835 const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
* pIn
,
836 ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
* pOut
);
838 ////////////////////////////////////////////////////////////////////////////////////////////////////
840 ////////////////////////////////////////////////////////////////////////////////////////////////////
843 ****************************************************************************************************
848 ****************************************************************************************************
850 typedef union _ADDR_HTILE_FLAGS
854 UINT_32 tcCompatible
: 1; ///< Flag indicates surface needs to be shader readable
855 UINT_32 skipTcCompatSizeAlign
: 1; ///< Flag indicates that addrLib will not align htile
856 /// size to 256xBankxPipe when computing tc-compatible
858 UINT_32 reserved
: 30; ///< Reserved bits
865 ****************************************************************************************************
866 * ADDR_COMPUTE_HTILE_INFO_INPUT
869 * Input structure of AddrComputeHtileInfo
870 ****************************************************************************************************
872 typedef struct _ADDR_COMPUTE_HTILE_INFO_INPUT
874 UINT_32 size
; ///< Size of this structure in bytes
876 ADDR_HTILE_FLAGS flags
; ///< HTILE flags
877 UINT_32 pitch
; ///< Surface pitch, in pixels
878 UINT_32 height
; ///< Surface height, in pixels
879 UINT_32 numSlices
; ///< Number of slices
880 BOOL_32 isLinear
; ///< Linear or tiled HTILE layout
881 AddrHtileBlockSize blockWidth
; ///< 4 or 8. EG above only support 8
882 AddrHtileBlockSize blockHeight
; ///< 4 or 8. EG above only support 8
883 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
885 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
886 /// while the global useTileIndex is set to 1
887 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
888 ///< README: When tileIndex is not -1, this must be valid
889 } ADDR_COMPUTE_HTILE_INFO_INPUT
;
892 ****************************************************************************************************
893 * ADDR_COMPUTE_HTILE_INFO_OUTPUT
896 * Output structure of AddrComputeHtileInfo
897 ****************************************************************************************************
899 typedef struct _ADDR_COMPUTE_HTILE_INFO_OUTPUT
901 UINT_32 size
; ///< Size of this structure in bytes
903 UINT_32 pitch
; ///< Pitch in pixels of depth buffer represented in this
904 /// HTile buffer. This might be larger than original depth
905 /// buffer pitch when called with an unaligned pitch.
906 UINT_32 height
; ///< Height in pixels, as above
907 UINT_64 htileBytes
; ///< Size of HTILE buffer, in bytes
908 UINT_32 baseAlign
; ///< Base alignment
909 UINT_32 bpp
; ///< Bits per pixel for HTILE is how many bits for an 8x8 block!
910 UINT_32 macroWidth
; ///< Macro width in pixels, actually squared cache shape
911 UINT_32 macroHeight
; ///< Macro height in pixels
912 UINT_64 sliceSize
; ///< Slice size, in bytes.
913 BOOL_32 sliceInterleaved
; ///< Flag to indicate if different slice's htile is interleaved
914 /// Compute engine clear can't be used if htile is interleaved
915 BOOL_32 nextMipLevelCompressible
; ///< Flag to indicate whether HTILE can be enabled in
916 /// next mip level, it also indicates if memory set based
917 /// fast clear can be used for current mip level.
918 } ADDR_COMPUTE_HTILE_INFO_OUTPUT
;
921 ****************************************************************************************************
922 * AddrComputeHtileInfo
925 * Compute Htile pitch, height, base alignment and size in bytes
926 ****************************************************************************************************
928 ADDR_E_RETURNCODE ADDR_API
AddrComputeHtileInfo(
930 const ADDR_COMPUTE_HTILE_INFO_INPUT
* pIn
,
931 ADDR_COMPUTE_HTILE_INFO_OUTPUT
* pOut
);
936 ****************************************************************************************************
937 * ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
940 * Input structure for AddrComputeHtileAddrFromCoord
941 ****************************************************************************************************
943 typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
945 UINT_32 size
; ///< Size of this structure in bytes
947 UINT_32 pitch
; ///< Pitch, in pixels
948 UINT_32 height
; ///< Height in pixels
949 UINT_32 x
; ///< X coordinate
950 UINT_32 y
; ///< Y coordinate
951 UINT_32 slice
; ///< Index of slice
952 UINT_32 numSlices
; ///< Number of slices
953 BOOL_32 isLinear
; ///< Linear or tiled HTILE layout
954 ADDR_HTILE_FLAGS flags
; ///< htile flags
955 AddrHtileBlockSize blockWidth
; ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8
956 AddrHtileBlockSize blockHeight
; ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8
957 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
959 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
960 /// while the global useTileIndex is set to 1
961 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
962 ///< README: When tileIndex is not -1, this must be valid
963 UINT_32 bpp
; ///< depth/stencil buffer bit per pixel size
964 UINT_32 zStencilAddr
; ///< tcCompatible Z/Stencil surface address
965 } ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
;
968 ****************************************************************************************************
969 * ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
972 * Output structure for AddrComputeHtileAddrFromCoord
973 ****************************************************************************************************
975 typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
977 UINT_32 size
; ///< Size of this structure in bytes
979 UINT_64 addr
; ///< Address in bytes
980 UINT_32 bitPosition
; ///< Bit position, 0 or 4. CMASK and HTILE shares some lib method.
981 /// So we keep bitPosition for HTILE as well
982 } ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
;
985 ****************************************************************************************************
986 * AddrComputeHtileAddrFromCoord
989 * Compute Htile address according to coordinates (of depth buffer)
990 ****************************************************************************************************
992 ADDR_E_RETURNCODE ADDR_API
AddrComputeHtileAddrFromCoord(
994 const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
* pIn
,
995 ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
* pOut
);
1000 ****************************************************************************************************
1001 * ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
1004 * Input structure for AddrComputeHtileCoordFromAddr
1005 ****************************************************************************************************
1007 typedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
1009 UINT_32 size
; ///< Size of this structure in bytes
1011 UINT_64 addr
; ///< Address
1012 UINT_32 bitPosition
; ///< Bit position 0 or 4. CMASK and HTILE share some methods
1013 /// so we keep bitPosition for HTILE as well
1014 UINT_32 pitch
; ///< Pitch, in pixels
1015 UINT_32 height
; ///< Height, in pixels
1016 UINT_32 numSlices
; ///< Number of slices
1017 BOOL_32 isLinear
; ///< Linear or tiled HTILE layout
1018 AddrHtileBlockSize blockWidth
; ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8
1019 AddrHtileBlockSize blockHeight
; ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8
1020 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
1022 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1023 /// while the global useTileIndex is set to 1
1024 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1025 ///< README: When tileIndex is not -1, this must be valid
1026 } ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
;
1029 ****************************************************************************************************
1030 * ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
1033 * Output structure for AddrComputeHtileCoordFromAddr
1034 ****************************************************************************************************
1036 typedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
1038 UINT_32 size
; ///< Size of this structure in bytes
1040 UINT_32 x
; ///< X coordinate
1041 UINT_32 y
; ///< Y coordinate
1042 UINT_32 slice
; ///< Slice index
1043 } ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
;
1046 ****************************************************************************************************
1047 * AddrComputeHtileCoordFromAddr
1050 * Compute coordinates within depth buffer (1st pixel of a micro tile) according to
1052 ****************************************************************************************************
1054 ADDR_E_RETURNCODE ADDR_API
AddrComputeHtileCoordFromAddr(
1056 const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
* pIn
,
1057 ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
* pOut
);
1061 ////////////////////////////////////////////////////////////////////////////////////////////////////
1063 ////////////////////////////////////////////////////////////////////////////////////////////////////
1066 ****************************************************************************************************
1071 ****************************************************************************************************
1073 typedef union _ADDR_CMASK_FLAGS
1077 UINT_32 tcCompatible
: 1; ///< Flag indicates surface needs to be shader readable
1078 UINT_32 reserved
:31; ///< Reserved bits
1085 ****************************************************************************************************
1086 * ADDR_COMPUTE_CMASK_INFO_INPUT
1089 * Input structure of AddrComputeCmaskInfo
1090 ****************************************************************************************************
1092 typedef struct _ADDR_COMPUTE_CMASKINFO_INPUT
1094 UINT_32 size
; ///< Size of this structure in bytes
1096 ADDR_CMASK_FLAGS flags
; ///< CMASK flags
1097 UINT_32 pitch
; ///< Pitch, in pixels, of color buffer
1098 UINT_32 height
; ///< Height, in pixels, of color buffer
1099 UINT_32 numSlices
; ///< Number of slices, of color buffer
1100 BOOL_32 isLinear
; ///< Linear or tiled layout, Only SI can be linear
1101 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
1103 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1104 /// while the global useTileIndex is set to 1
1105 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1106 ///< README: When tileIndex is not -1, this must be valid
1107 } ADDR_COMPUTE_CMASK_INFO_INPUT
;
1110 ****************************************************************************************************
1111 * ADDR_COMPUTE_CMASK_INFO_OUTPUT
1114 * Output structure of AddrComputeCmaskInfo
1115 ****************************************************************************************************
1117 typedef struct _ADDR_COMPUTE_CMASK_INFO_OUTPUT
1119 UINT_32 size
; ///< Size of this structure in bytes
1121 UINT_32 pitch
; ///< Pitch in pixels of color buffer which
1122 /// this Cmask matches. The size might be larger than
1123 /// original color buffer pitch when called with
1124 /// an unaligned pitch.
1125 UINT_32 height
; ///< Height in pixels, as above
1126 UINT_64 cmaskBytes
; ///< Size in bytes of CMask buffer
1127 UINT_32 baseAlign
; ///< Base alignment
1128 UINT_32 blockMax
; ///< Cmask block size. Need this to set CB_COLORn_MASK register
1129 UINT_32 macroWidth
; ///< Macro width in pixels, actually squared cache shape
1130 UINT_32 macroHeight
; ///< Macro height in pixels
1131 UINT_64 sliceSize
; ///< Slice size, in bytes.
1132 } ADDR_COMPUTE_CMASK_INFO_OUTPUT
;
1135 ****************************************************************************************************
1136 * AddrComputeCmaskInfo
1139 * Compute Cmask pitch, height, base alignment and size in bytes from color buffer
1141 ****************************************************************************************************
1143 ADDR_E_RETURNCODE ADDR_API
AddrComputeCmaskInfo(
1145 const ADDR_COMPUTE_CMASK_INFO_INPUT
* pIn
,
1146 ADDR_COMPUTE_CMASK_INFO_OUTPUT
* pOut
);
1151 ****************************************************************************************************
1152 * ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
1155 * Input structure for AddrComputeCmaskAddrFromCoord
1157 ****************************************************************************************************
1159 typedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
1161 UINT_32 size
; ///< Size of this structure in bytes
1162 UINT_32 x
; ///< X coordinate
1163 UINT_32 y
; ///< Y coordinate
1164 UINT_64 fmaskAddr
; ///< Fmask addr for tc compatible Cmask
1165 UINT_32 slice
; ///< Slice index
1166 UINT_32 pitch
; ///< Pitch in pixels, of color buffer
1167 UINT_32 height
; ///< Height in pixels, of color buffer
1168 UINT_32 numSlices
; ///< Number of slices
1170 BOOL_32 isLinear
; ///< Linear or tiled layout, Only SI can be linear
1171 ADDR_CMASK_FLAGS flags
; ///< CMASK flags
1172 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
1174 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1175 ///< while the global useTileIndex is set to 1
1176 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1177 ///< README: When tileIndex is not -1, this must be valid
1178 } ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
;
1181 ****************************************************************************************************
1182 * ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
1185 * Output structure for AddrComputeCmaskAddrFromCoord
1186 ****************************************************************************************************
1188 typedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
1190 UINT_32 size
; ///< Size of this structure in bytes
1192 UINT_64 addr
; ///< CMASK address in bytes
1193 UINT_32 bitPosition
; ///< Bit position within addr, 0-7. CMASK is 4 bpp,
1194 /// so the address may be located in bit 0 (0) or 4 (4)
1195 } ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
;
1198 ****************************************************************************************************
1199 * AddrComputeCmaskAddrFromCoord
1202 * Compute Cmask address according to coordinates (of MSAA color buffer)
1203 ****************************************************************************************************
1205 ADDR_E_RETURNCODE ADDR_API
AddrComputeCmaskAddrFromCoord(
1207 const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
* pIn
,
1208 ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
* pOut
);
1213 ****************************************************************************************************
1214 * ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
1217 * Input structure for AddrComputeCmaskCoordFromAddr
1218 ****************************************************************************************************
1220 typedef struct _ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
1222 UINT_32 size
; ///< Size of this structure in bytes
1224 UINT_64 addr
; ///< CMASK address in bytes
1225 UINT_32 bitPosition
; ///< Bit position within addr, 0-7. CMASK is 4 bpp,
1226 /// so the address may be located in bit 0 (0) or 4 (4)
1227 UINT_32 pitch
; ///< Pitch, in pixels
1228 UINT_32 height
; ///< Height in pixels
1229 UINT_32 numSlices
; ///< Number of slices
1230 BOOL_32 isLinear
; ///< Linear or tiled layout, Only SI can be linear
1231 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
1233 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1234 /// while the global useTileIndex is set to 1
1235 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1236 ///< README: When tileIndex is not -1, this must be valid
1237 } ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
;
1240 ****************************************************************************************************
1241 * ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
1244 * Output structure for AddrComputeCmaskCoordFromAddr
1245 ****************************************************************************************************
1247 typedef struct _ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
1249 UINT_32 size
; ///< Size of this structure in bytes
1251 UINT_32 x
; ///< X coordinate
1252 UINT_32 y
; ///< Y coordinate
1253 UINT_32 slice
; ///< Slice index
1254 } ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
;
1257 ****************************************************************************************************
1258 * AddrComputeCmaskCoordFromAddr
1261 * Compute coordinates within color buffer (1st pixel of a micro tile) according to
1263 ****************************************************************************************************
1265 ADDR_E_RETURNCODE ADDR_API
AddrComputeCmaskCoordFromAddr(
1267 const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
* pIn
,
1268 ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
* pOut
);
1272 ////////////////////////////////////////////////////////////////////////////////////////////////////
1274 ////////////////////////////////////////////////////////////////////////////////////////////////////
1277 ****************************************************************************************************
1278 * ADDR_COMPUTE_FMASK_INFO_INPUT
1281 * Input structure for AddrComputeFmaskInfo
1282 ****************************************************************************************************
1284 typedef struct _ADDR_COMPUTE_FMASK_INFO_INPUT
1286 UINT_32 size
; ///< Size of this structure in bytes
1288 AddrTileMode tileMode
; ///< Tile mode
1289 UINT_32 pitch
; ///< Surface pitch, in pixels
1290 UINT_32 height
; ///< Surface height, in pixels
1291 UINT_32 numSlices
; ///< Number of slice/depth
1292 UINT_32 numSamples
; ///< Number of samples
1293 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
1294 /// number of samples for normal AA; Set it to the
1295 /// number of fragments for EQAA
1296 /// r800 and later HWL parameters
1299 UINT_32 resolved
: 1; ///< TRUE if the surface is for resolved fmask, only used
1300 /// by H/W clients. S/W should always set it to FALSE.
1301 UINT_32 reserved
: 31; ///< Reserved for future use.
1303 ADDR_TILEINFO
* pTileInfo
; ///< 2D tiling parameters. Clients must give valid data
1304 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1305 /// while the global useTileIndex is set to 1
1306 } ADDR_COMPUTE_FMASK_INFO_INPUT
;
1309 ****************************************************************************************************
1310 * ADDR_COMPUTE_FMASK_INFO_OUTPUT
1313 * Output structure for AddrComputeFmaskInfo
1314 ****************************************************************************************************
1316 typedef struct _ADDR_COMPUTE_FMASK_INFO_OUTPUT
1318 UINT_32 size
; ///< Size of this structure in bytes
1320 UINT_32 pitch
; ///< Pitch of fmask in pixels
1321 UINT_32 height
; ///< Height of fmask in pixels
1322 UINT_32 numSlices
; ///< Slices of fmask
1323 UINT_64 fmaskBytes
; ///< Size of fmask in bytes
1324 UINT_32 baseAlign
; ///< Base address alignment
1325 UINT_32 pitchAlign
; ///< Pitch alignment
1326 UINT_32 heightAlign
; ///< Height alignment
1327 UINT_32 bpp
; ///< Bits per pixel of FMASK is: number of bit planes
1328 UINT_32 numSamples
; ///< Number of samples, used for dump, export this since input
1329 /// may be changed in 9xx and above
1330 /// r800 and later HWL parameters
1331 ADDR_TILEINFO
* pTileInfo
; ///< Tile parameters used. Fmask can have different
1332 /// bank_height from color buffer
1333 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1334 /// while the global useTileIndex is set to 1
1335 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1336 UINT_64 sliceSize
; ///< Size of slice in bytes
1337 } ADDR_COMPUTE_FMASK_INFO_OUTPUT
;
1340 ****************************************************************************************************
1341 * AddrComputeFmaskInfo
1344 * Compute Fmask pitch/height/depth/alignments and size in bytes
1345 ****************************************************************************************************
1347 ADDR_E_RETURNCODE ADDR_API
AddrComputeFmaskInfo(
1349 const ADDR_COMPUTE_FMASK_INFO_INPUT
* pIn
,
1350 ADDR_COMPUTE_FMASK_INFO_OUTPUT
* pOut
);
1355 ****************************************************************************************************
1356 * ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
1359 * Input structure for AddrComputeFmaskAddrFromCoord
1360 ****************************************************************************************************
1362 typedef struct _ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
1364 UINT_32 size
; ///< Size of this structure in bytes
1366 UINT_32 x
; ///< X coordinate
1367 UINT_32 y
; ///< Y coordinate
1368 UINT_32 slice
; ///< Slice index
1369 UINT_32 plane
; ///< Plane number
1370 UINT_32 sample
; ///< Sample index (fragment index for EQAA)
1372 UINT_32 pitch
; ///< Surface pitch, in pixels
1373 UINT_32 height
; ///< Surface height, in pixels
1374 UINT_32 numSamples
; ///< Number of samples
1375 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
1376 /// number of samples for normal AA; Set it to the
1377 /// number of fragments for EQAA
1379 AddrTileMode tileMode
; ///< Tile mode
1384 UINT_32 bankSwizzle
; ///< Bank swizzle
1385 UINT_32 pipeSwizzle
; ///< Pipe swizzle
1387 UINT_32 tileSwizzle
; ///< Combined swizzle, if useCombinedSwizzle is TRUE
1390 /// r800 and later HWL parameters
1393 UINT_32 resolved
: 1; ///< TRUE if this is a resolved fmask, used by H/W clients
1394 UINT_32 ignoreSE
: 1; ///< TRUE if shader engines are ignored.
1395 UINT_32 reserved
: 30; ///< Reserved for future use.
1397 ADDR_TILEINFO
* pTileInfo
; ///< 2D tiling parameters. Client must provide all data
1399 } ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
;
1402 ****************************************************************************************************
1403 * ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
1406 * Output structure for AddrComputeFmaskAddrFromCoord
1407 ****************************************************************************************************
1409 typedef struct _ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
1411 UINT_32 size
; ///< Size of this structure in bytes
1413 UINT_64 addr
; ///< Fmask address
1414 UINT_32 bitPosition
; ///< Bit position within fmaskAddr, 0-7.
1415 } ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
;
1418 ****************************************************************************************************
1419 * AddrComputeFmaskAddrFromCoord
1422 * Compute Fmask address according to coordinates (x,y,slice,sample,plane)
1423 ****************************************************************************************************
1425 ADDR_E_RETURNCODE ADDR_API
AddrComputeFmaskAddrFromCoord(
1427 const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
* pIn
,
1428 ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
* pOut
);
1433 ****************************************************************************************************
1434 * ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
1437 * Input structure for AddrComputeFmaskCoordFromAddr
1438 ****************************************************************************************************
1440 typedef struct _ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
1442 UINT_32 size
; ///< Size of this structure in bytes
1444 UINT_64 addr
; ///< Address
1445 UINT_32 bitPosition
; ///< Bit position within addr, 0-7.
1447 UINT_32 pitch
; ///< Pitch, in pixels
1448 UINT_32 height
; ///< Height in pixels
1449 UINT_32 numSamples
; ///< Number of samples
1450 UINT_32 numFrags
; ///< Number of fragments
1451 AddrTileMode tileMode
; ///< Tile mode
1456 UINT_32 bankSwizzle
; ///< Bank swizzle
1457 UINT_32 pipeSwizzle
; ///< Pipe swizzle
1459 UINT_32 tileSwizzle
; ///< Combined swizzle, if useCombinedSwizzle is TRUE
1462 /// r800 and later HWL parameters
1465 UINT_32 resolved
: 1; ///< TRUE if this is a resolved fmask, used by HW components
1466 UINT_32 ignoreSE
: 1; ///< TRUE if shader engines are ignored.
1467 UINT_32 reserved
: 30; ///< Reserved for future use.
1469 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
1471 } ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
;
1474 ****************************************************************************************************
1475 * ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
1478 * Output structure for AddrComputeFmaskCoordFromAddr
1479 ****************************************************************************************************
1481 typedef struct _ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
1483 UINT_32 size
; ///< Size of this structure in bytes
1485 UINT_32 x
; ///< X coordinate
1486 UINT_32 y
; ///< Y coordinate
1487 UINT_32 slice
; ///< Slice index
1488 UINT_32 plane
; ///< Plane number
1489 UINT_32 sample
; ///< Sample index (fragment index for EQAA)
1490 } ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
;
1493 ****************************************************************************************************
1494 * AddrComputeFmaskCoordFromAddr
1497 * Compute FMASK coordinate from an given address
1498 ****************************************************************************************************
1500 ADDR_E_RETURNCODE ADDR_API
AddrComputeFmaskCoordFromAddr(
1502 const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
* pIn
,
1503 ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
* pOut
);
1507 ////////////////////////////////////////////////////////////////////////////////////////////////////
1508 // Element/utility functions
1509 ////////////////////////////////////////////////////////////////////////////////////////////////////
1512 ****************************************************************************************************
1516 * Get AddrLib version number
1517 ****************************************************************************************************
1519 UINT_32 ADDR_API
AddrGetVersion(ADDR_HANDLE hLib
);
1522 ****************************************************************************************************
1526 * Return TRUE if tileIndex is enabled in this address library
1527 ****************************************************************************************************
1529 BOOL_32 ADDR_API
AddrUseTileIndex(ADDR_HANDLE hLib
);
1532 ****************************************************************************************************
1533 * AddrUseCombinedSwizzle
1536 * Return TRUE if combined swizzle is enabled in this address library
1537 ****************************************************************************************************
1539 BOOL_32 ADDR_API
AddrUseCombinedSwizzle(ADDR_HANDLE hLib
);
1542 ****************************************************************************************************
1543 * ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
1546 * Input structure of AddrExtractBankPipeSwizzle
1547 ****************************************************************************************************
1549 typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
1551 UINT_32 size
; ///< Size of this structure in bytes
1553 UINT_32 base256b
; ///< Base256b value
1555 /// r800 and later HWL parameters
1556 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
1558 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1559 /// while the global useTileIndex is set to 1
1560 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1561 ///< README: When tileIndex is not -1, this must be valid
1562 } ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
;
1565 ****************************************************************************************************
1566 * ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
1569 * Output structure of AddrExtractBankPipeSwizzle
1570 ****************************************************************************************************
1572 typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
1574 UINT_32 size
; ///< Size of this structure in bytes
1576 UINT_32 bankSwizzle
; ///< Bank swizzle
1577 UINT_32 pipeSwizzle
; ///< Pipe swizzle
1578 } ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
;
1581 ****************************************************************************************************
1582 * AddrExtractBankPipeSwizzle
1585 * Extract Bank and Pipe swizzle from base256b
1587 * ADDR_OK if no error
1588 ****************************************************************************************************
1590 ADDR_E_RETURNCODE ADDR_API
AddrExtractBankPipeSwizzle(
1592 const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
* pIn
,
1593 ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
* pOut
);
1597 ****************************************************************************************************
1598 * ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
1601 * Input structure of AddrCombineBankPipeSwizzle
1602 ****************************************************************************************************
1604 typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
1606 UINT_32 size
; ///< Size of this structure in bytes
1608 UINT_32 bankSwizzle
; ///< Bank swizzle
1609 UINT_32 pipeSwizzle
; ///< Pipe swizzle
1610 UINT_64 baseAddr
; ///< Base address (leave it zero for driver clients)
1612 /// r800 and later HWL parameters
1613 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
1615 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1616 /// while the global useTileIndex is set to 1
1617 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1618 ///< README: When tileIndex is not -1, this must be valid
1619 } ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
;
1622 ****************************************************************************************************
1623 * ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
1626 * Output structure of AddrCombineBankPipeSwizzle
1627 ****************************************************************************************************
1629 typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
1631 UINT_32 size
; ///< Size of this structure in bytes
1633 UINT_32 tileSwizzle
; ///< Combined swizzle
1634 } ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
;
1637 ****************************************************************************************************
1638 * AddrCombineBankPipeSwizzle
1641 * Combine Bank and Pipe swizzle
1643 * ADDR_OK if no error
1645 * baseAddr here is full MCAddress instead of base256b
1646 ****************************************************************************************************
1648 ADDR_E_RETURNCODE ADDR_API
AddrCombineBankPipeSwizzle(
1650 const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
* pIn
,
1651 ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
* pOut
);
1656 ****************************************************************************************************
1657 * ADDR_COMPUTE_SLICESWIZZLE_INPUT
1660 * Input structure of AddrComputeSliceSwizzle
1661 ****************************************************************************************************
1663 typedef struct _ADDR_COMPUTE_SLICESWIZZLE_INPUT
1665 UINT_32 size
; ///< Size of this structure in bytes
1667 AddrTileMode tileMode
; ///< Tile Mode
1668 UINT_32 baseSwizzle
; ///< Base tile swizzle
1669 UINT_32 slice
; ///< Slice index
1670 UINT_64 baseAddr
; ///< Base address, driver should leave it 0 in most cases
1672 /// r800 and later HWL parameters
1673 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Actually banks needed here!
1675 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1676 /// while the global useTileIndex is set to 1
1677 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1678 ///< README: When tileIndex is not -1, this must be valid
1679 } ADDR_COMPUTE_SLICESWIZZLE_INPUT
;
1684 ****************************************************************************************************
1685 * ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
1688 * Output structure of AddrComputeSliceSwizzle
1689 ****************************************************************************************************
1691 typedef struct _ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
1693 UINT_32 size
; ///< Size of this structure in bytes
1695 UINT_32 tileSwizzle
; ///< Recalculated tileSwizzle value
1696 } ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
;
1699 ****************************************************************************************************
1700 * AddrComputeSliceSwizzle
1703 * Extract Bank and Pipe swizzle from base256b
1705 * ADDR_OK if no error
1706 ****************************************************************************************************
1708 ADDR_E_RETURNCODE ADDR_API
AddrComputeSliceSwizzle(
1710 const ADDR_COMPUTE_SLICESWIZZLE_INPUT
* pIn
,
1711 ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
* pOut
);
1715 ****************************************************************************************************
1716 * AddrSwizzleGenOption
1719 * Which swizzle generating options: legacy or linear
1720 ****************************************************************************************************
1722 typedef enum _AddrSwizzleGenOption
1724 ADDR_SWIZZLE_GEN_DEFAULT
= 0, ///< As is in client driver implemention for swizzle
1725 ADDR_SWIZZLE_GEN_LINEAR
= 1, ///< Using a linear increment of swizzle
1726 } AddrSwizzleGenOption
;
1729 ****************************************************************************************************
1733 * Controls how swizzle is generated
1734 ****************************************************************************************************
1736 typedef union _ADDR_SWIZZLE_OPTION
1740 UINT_32 genOption
: 1; ///< The way swizzle is generated, see AddrSwizzleGenOption
1741 UINT_32 reduceBankBit
: 1; ///< TRUE if we need reduce swizzle bits
1742 UINT_32 reserved
:30; ///< Reserved bits
1747 } ADDR_SWIZZLE_OPTION
;
1750 ****************************************************************************************************
1751 * ADDR_COMPUTE_BASE_SWIZZLE_INPUT
1754 * Input structure of AddrComputeBaseSwizzle
1755 ****************************************************************************************************
1757 typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_INPUT
1759 UINT_32 size
; ///< Size of this structure in bytes
1761 ADDR_SWIZZLE_OPTION option
; ///< Swizzle option
1762 UINT_32 surfIndex
; ///< Index of this surface type
1763 AddrTileMode tileMode
; ///< Tile Mode
1765 /// r800 and later HWL parameters
1766 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Actually banks needed here!
1768 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1769 /// while the global useTileIndex is set to 1
1770 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1771 ///< README: When tileIndex is not -1, this must be valid
1772 } ADDR_COMPUTE_BASE_SWIZZLE_INPUT
;
1775 ****************************************************************************************************
1776 * ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
1779 * Output structure of AddrComputeBaseSwizzle
1780 ****************************************************************************************************
1782 typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
1784 UINT_32 size
; ///< Size of this structure in bytes
1786 UINT_32 tileSwizzle
; ///< Combined swizzle
1787 } ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
;
1790 ****************************************************************************************************
1791 * AddrComputeBaseSwizzle
1794 * Return a Combined Bank and Pipe swizzle base on surface based on surface type/index
1796 * ADDR_OK if no error
1797 ****************************************************************************************************
1799 ADDR_E_RETURNCODE ADDR_API
AddrComputeBaseSwizzle(
1801 const ADDR_COMPUTE_BASE_SWIZZLE_INPUT
* pIn
,
1802 ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
* pOut
);
1807 ****************************************************************************************************
1808 * ELEM_GETEXPORTNORM_INPUT
1811 * Input structure for ElemGetExportNorm
1813 ****************************************************************************************************
1815 typedef struct _ELEM_GETEXPORTNORM_INPUT
1817 UINT_32 size
; ///< Size of this structure in bytes
1819 AddrColorFormat format
; ///< Color buffer format; Client should use ColorFormat
1820 AddrSurfaceNumber num
; ///< Surface number type; Client should use NumberType
1821 AddrSurfaceSwap swap
; ///< Surface swap byte swap; Client should use SurfaceSwap
1822 UINT_32 numSamples
; ///< Number of samples
1823 } ELEM_GETEXPORTNORM_INPUT
;
1826 ****************************************************************************************************
1830 * Helper function to check one format can be EXPORT_NUM, which is a register
1831 * CB_COLOR_INFO.SURFACE_FORMAT. FP16 can be reported as EXPORT_NORM for rv770 in r600
1834 * The implementation is only for r600.
1835 * 00 - EXPORT_FULL: PS exports are 4 pixels with 4 components with 32-bits-per-component. (two
1836 * clocks per export)
1837 * 01 - EXPORT_NORM: PS exports are 4 pixels with 4 components with 16-bits-per-component. (one
1840 ****************************************************************************************************
1842 BOOL_32 ADDR_API
ElemGetExportNorm(
1844 const ELEM_GETEXPORTNORM_INPUT
* pIn
);
1849 ****************************************************************************************************
1850 * ELEM_FLT32TODEPTHPIXEL_INPUT
1853 * Input structure for addrFlt32ToDepthPixel
1855 ****************************************************************************************************
1857 typedef struct _ELEM_FLT32TODEPTHPIXEL_INPUT
1859 UINT_32 size
; ///< Size of this structure in bytes
1861 AddrDepthFormat format
; ///< Depth buffer format
1862 ADDR_FLT_32 comps
[2]; ///< Component values (Z/stencil)
1863 } ELEM_FLT32TODEPTHPIXEL_INPUT
;
1866 ****************************************************************************************************
1867 * ELEM_FLT32TODEPTHPIXEL_INPUT
1870 * Output structure for ElemFlt32ToDepthPixel
1872 ****************************************************************************************************
1874 typedef struct _ELEM_FLT32TODEPTHPIXEL_OUTPUT
1876 UINT_32 size
; ///< Size of this structure in bytes
1878 UINT_8
* pPixel
; ///< Real depth value. Same data type as depth buffer.
1879 /// Client must provide enough storage for this type.
1880 UINT_32 depthBase
; ///< Tile base in bits for depth bits
1881 UINT_32 stencilBase
; ///< Tile base in bits for stencil bits
1882 UINT_32 depthBits
; ///< Bits for depth
1883 UINT_32 stencilBits
; ///< Bits for stencil
1884 } ELEM_FLT32TODEPTHPIXEL_OUTPUT
;
1887 ****************************************************************************************************
1888 * ElemFlt32ToDepthPixel
1891 * Convert a FLT_32 value to a depth/stencil pixel value
1896 ****************************************************************************************************
1898 ADDR_E_RETURNCODE ADDR_API
ElemFlt32ToDepthPixel(
1900 const ELEM_FLT32TODEPTHPIXEL_INPUT
* pIn
,
1901 ELEM_FLT32TODEPTHPIXEL_OUTPUT
* pOut
);
1906 ****************************************************************************************************
1907 * ELEM_FLT32TOCOLORPIXEL_INPUT
1910 * Input structure for addrFlt32ToColorPixel
1912 ****************************************************************************************************
1914 typedef struct _ELEM_FLT32TOCOLORPIXEL_INPUT
1916 UINT_32 size
; ///< Size of this structure in bytes
1918 AddrColorFormat format
; ///< Color buffer format
1919 AddrSurfaceNumber surfNum
; ///< Surface number
1920 AddrSurfaceSwap surfSwap
; ///< Surface swap
1921 ADDR_FLT_32 comps
[4]; ///< Component values (r/g/b/a)
1922 } ELEM_FLT32TOCOLORPIXEL_INPUT
;
1925 ****************************************************************************************************
1926 * ELEM_FLT32TOCOLORPIXEL_INPUT
1929 * Output structure for ElemFlt32ToColorPixel
1931 ****************************************************************************************************
1933 typedef struct _ELEM_FLT32TOCOLORPIXEL_OUTPUT
1935 UINT_32 size
; ///< Size of this structure in bytes
1937 UINT_8
* pPixel
; ///< Real color value. Same data type as color buffer.
1938 /// Client must provide enough storage for this type.
1939 } ELEM_FLT32TOCOLORPIXEL_OUTPUT
;
1942 ****************************************************************************************************
1943 * ElemFlt32ToColorPixel
1946 * Convert a FLT_32 value to a red/green/blue/alpha pixel value
1951 ****************************************************************************************************
1953 ADDR_E_RETURNCODE ADDR_API
ElemFlt32ToColorPixel(
1955 const ELEM_FLT32TOCOLORPIXEL_INPUT
* pIn
,
1956 ELEM_FLT32TOCOLORPIXEL_OUTPUT
* pOut
);
1960 ****************************************************************************************************
1961 * ADDR_CONVERT_TILEINFOTOHW_INPUT
1964 * Input structure for AddrConvertTileInfoToHW
1966 * When reverse is TRUE, indices are igonred
1967 ****************************************************************************************************
1969 typedef struct _ADDR_CONVERT_TILEINFOTOHW_INPUT
1971 UINT_32 size
; ///< Size of this structure in bytes
1972 BOOL_32 reverse
; ///< Convert control flag.
1973 /// FALSE: convert from real value to HW value;
1974 /// TRUE: convert from HW value to real value.
1976 /// r800 and later HWL parameters
1977 ADDR_TILEINFO
* pTileInfo
; ///< Tile parameters with real value
1979 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1980 /// while the global useTileIndex is set to 1
1981 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1982 ///< README: When tileIndex is not -1, this must be valid
1983 UINT_32 bpp
; ///< Bits per pixel
1984 } ADDR_CONVERT_TILEINFOTOHW_INPUT
;
1987 ****************************************************************************************************
1988 * ADDR_CONVERT_TILEINFOTOHW_OUTPUT
1991 * Output structure for AddrConvertTileInfoToHW
1992 ****************************************************************************************************
1994 typedef struct _ADDR_CONVERT_TILEINFOTOHW_OUTPUT
1996 UINT_32 size
; ///< Size of this structure in bytes
1998 /// r800 and later HWL parameters
1999 ADDR_TILEINFO
* pTileInfo
; ///< Tile parameters with hardware register value
2001 } ADDR_CONVERT_TILEINFOTOHW_OUTPUT
;
2004 ****************************************************************************************************
2005 * AddrConvertTileInfoToHW
2008 * Convert tile info from real value to hardware register value
2009 ****************************************************************************************************
2011 ADDR_E_RETURNCODE ADDR_API
AddrConvertTileInfoToHW(
2013 const ADDR_CONVERT_TILEINFOTOHW_INPUT
* pIn
,
2014 ADDR_CONVERT_TILEINFOTOHW_OUTPUT
* pOut
);
2019 ****************************************************************************************************
2020 * ADDR_CONVERT_TILEINDEX_INPUT
2023 * Input structure for AddrConvertTileIndex
2024 ****************************************************************************************************
2026 typedef struct _ADDR_CONVERT_TILEINDEX_INPUT
2028 UINT_32 size
; ///< Size of this structure in bytes
2030 INT_32 tileIndex
; ///< Tile index
2031 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
2032 UINT_32 bpp
; ///< Bits per pixel
2033 BOOL_32 tileInfoHw
; ///< Set to TRUE if client wants HW enum, otherwise actual
2034 } ADDR_CONVERT_TILEINDEX_INPUT
;
2037 ****************************************************************************************************
2038 * ADDR_CONVERT_TILEINDEX_OUTPUT
2041 * Output structure for AddrConvertTileIndex
2042 ****************************************************************************************************
2044 typedef struct _ADDR_CONVERT_TILEINDEX_OUTPUT
2046 UINT_32 size
; ///< Size of this structure in bytes
2048 AddrTileMode tileMode
; ///< Tile mode
2049 AddrTileType tileType
; ///< Tile type
2050 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
2052 } ADDR_CONVERT_TILEINDEX_OUTPUT
;
2055 ****************************************************************************************************
2056 * AddrConvertTileIndex
2059 * Convert tile index to tile mode/type/info
2060 ****************************************************************************************************
2062 ADDR_E_RETURNCODE ADDR_API
AddrConvertTileIndex(
2064 const ADDR_CONVERT_TILEINDEX_INPUT
* pIn
,
2065 ADDR_CONVERT_TILEINDEX_OUTPUT
* pOut
);
2068 ****************************************************************************************************
2069 * ADDR_GET_MACROMODEINDEX_INPUT
2072 * Input structure for AddrGetMacroModeIndex
2073 ****************************************************************************************************
2075 typedef struct _ADDR_GET_MACROMODEINDEX_INPUT
2077 UINT_32 size
; ///< Size of this structure in bytes
2078 ADDR_SURFACE_FLAGS flags
; ///< Surface flag
2079 INT_32 tileIndex
; ///< Tile index
2080 UINT_32 bpp
; ///< Bits per pixel
2081 UINT_32 numFrags
; ///< Number of color fragments
2082 } ADDR_GET_MACROMODEINDEX_INPUT
;
2085 ****************************************************************************************************
2086 * ADDR_GET_MACROMODEINDEX_OUTPUT
2089 * Output structure for AddrGetMacroModeIndex
2090 ****************************************************************************************************
2092 typedef struct _ADDR_GET_MACROMODEINDEX_OUTPUT
2094 UINT_32 size
; ///< Size of this structure in bytes
2095 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
2096 } ADDR_GET_MACROMODEINDEX_OUTPUT
;
2099 ****************************************************************************************************
2100 * AddrGetMacroModeIndex
2103 * Get macro mode index based on input parameters
2104 ****************************************************************************************************
2106 ADDR_E_RETURNCODE ADDR_API
AddrGetMacroModeIndex(
2108 const ADDR_GET_MACROMODEINDEX_INPUT
* pIn
,
2109 ADDR_GET_MACROMODEINDEX_OUTPUT
* pOut
);
2112 ****************************************************************************************************
2113 * ADDR_CONVERT_TILEINDEX1_INPUT
2116 * Input structure for AddrConvertTileIndex1 (without macro mode index)
2117 ****************************************************************************************************
2119 typedef struct _ADDR_CONVERT_TILEINDEX1_INPUT
2121 UINT_32 size
; ///< Size of this structure in bytes
2123 INT_32 tileIndex
; ///< Tile index
2124 UINT_32 bpp
; ///< Bits per pixel
2125 UINT_32 numSamples
; ///< Number of samples
2126 BOOL_32 tileInfoHw
; ///< Set to TRUE if client wants HW enum, otherwise actual
2127 } ADDR_CONVERT_TILEINDEX1_INPUT
;
2130 ****************************************************************************************************
2131 * AddrConvertTileIndex1
2134 * Convert tile index to tile mode/type/info
2135 ****************************************************************************************************
2137 ADDR_E_RETURNCODE ADDR_API
AddrConvertTileIndex1(
2139 const ADDR_CONVERT_TILEINDEX1_INPUT
* pIn
,
2140 ADDR_CONVERT_TILEINDEX_OUTPUT
* pOut
);
2145 ****************************************************************************************************
2146 * ADDR_GET_TILEINDEX_INPUT
2149 * Input structure for AddrGetTileIndex
2150 ****************************************************************************************************
2152 typedef struct _ADDR_GET_TILEINDEX_INPUT
2154 UINT_32 size
; ///< Size of this structure in bytes
2156 AddrTileMode tileMode
; ///< Tile mode
2157 AddrTileType tileType
; ///< Tile-type: disp/non-disp/...
2158 ADDR_TILEINFO
* pTileInfo
; ///< Pointer to tile-info structure, can be NULL for linear/1D
2159 } ADDR_GET_TILEINDEX_INPUT
;
2162 ****************************************************************************************************
2163 * ADDR_GET_TILEINDEX_OUTPUT
2166 * Output structure for AddrGetTileIndex
2167 ****************************************************************************************************
2169 typedef struct _ADDR_GET_TILEINDEX_OUTPUT
2171 UINT_32 size
; ///< Size of this structure in bytes
2173 INT_32 index
; ///< index in table
2174 } ADDR_GET_TILEINDEX_OUTPUT
;
2177 ****************************************************************************************************
2181 * Get the tiling mode index in table
2182 ****************************************************************************************************
2184 ADDR_E_RETURNCODE ADDR_API
AddrGetTileIndex(
2186 const ADDR_GET_TILEINDEX_INPUT
* pIn
,
2187 ADDR_GET_TILEINDEX_OUTPUT
* pOut
);
2192 ****************************************************************************************************
2193 * ADDR_PRT_INFO_INPUT
2196 * Input structure for AddrComputePrtInfo
2197 ****************************************************************************************************
2199 typedef struct _ADDR_PRT_INFO_INPUT
2201 AddrFormat format
; ///< Surface format
2202 UINT_32 baseMipWidth
; ///< Base mipmap width
2203 UINT_32 baseMipHeight
; ///< Base mipmap height
2204 UINT_32 baseMipDepth
; ///< Base mipmap depth
2205 UINT_32 numFrags
; ///< Number of fragments,
2206 } ADDR_PRT_INFO_INPUT
;
2209 ****************************************************************************************************
2210 * ADDR_PRT_INFO_OUTPUT
2213 * Input structure for AddrComputePrtInfo
2214 ****************************************************************************************************
2216 typedef struct _ADDR_PRT_INFO_OUTPUT
2218 UINT_32 prtTileWidth
;
2219 UINT_32 prtTileHeight
;
2220 } ADDR_PRT_INFO_OUTPUT
;
2223 ****************************************************************************************************
2224 * AddrComputePrtInfo
2227 * Compute prt surface related information
2228 ****************************************************************************************************
2230 ADDR_E_RETURNCODE ADDR_API
AddrComputePrtInfo(
2232 const ADDR_PRT_INFO_INPUT
* pIn
,
2233 ADDR_PRT_INFO_OUTPUT
* pOut
);
2237 ////////////////////////////////////////////////////////////////////////////////////////////////////
2238 // DCC key functions
2239 ////////////////////////////////////////////////////////////////////////////////////////////////////
2242 ****************************************************************************************************
2243 * _ADDR_COMPUTE_DCCINFO_INPUT
2246 * Input structure of AddrComputeDccInfo
2247 ****************************************************************************************************
2249 typedef struct _ADDR_COMPUTE_DCCINFO_INPUT
2251 UINT_32 size
; ///< Size of this structure in bytes
2252 UINT_32 bpp
; ///< BitPP of color surface
2253 UINT_32 numSamples
; ///< Sample number of color surface
2254 UINT_64 colorSurfSize
; ///< Size of color surface to which dcc key is bound
2255 AddrTileMode tileMode
; ///< Tile mode of color surface
2256 ADDR_TILEINFO tileInfo
; ///< Tile info of color surface
2257 UINT_32 tileSwizzle
; ///< Tile swizzle
2258 INT_32 tileIndex
; ///< Tile index of color surface,
2259 ///< MUST be -1 if you don't want to use it
2260 ///< while the global useTileIndex is set to 1
2261 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
2262 ///< README: When tileIndex is not -1, this must be valid
2263 } ADDR_COMPUTE_DCCINFO_INPUT
;
2266 ****************************************************************************************************
2267 * ADDR_COMPUTE_DCCINFO_OUTPUT
2270 * Output structure of AddrComputeDccInfo
2271 ****************************************************************************************************
2273 typedef struct _ADDR_COMPUTE_DCCINFO_OUTPUT
2275 UINT_32 size
; ///< Size of this structure in bytes
2276 UINT_64 dccRamBaseAlign
; ///< Base alignment of dcc key
2277 UINT_64 dccRamSize
; ///< Size of dcc key
2278 UINT_64 dccFastClearSize
; ///< Size of dcc key portion that can be fast cleared
2279 BOOL_32 subLvlCompressible
; ///< Whether sub resource is compressiable
2280 BOOL_32 dccRamSizeAligned
; ///< Whether the dcc key size is aligned
2281 } ADDR_COMPUTE_DCCINFO_OUTPUT
;
2284 ****************************************************************************************************
2285 * AddrComputeDccInfo
2288 * Compute DCC key size, base alignment
2290 ****************************************************************************************************
2292 ADDR_E_RETURNCODE ADDR_API
AddrComputeDccInfo(
2294 const ADDR_COMPUTE_DCCINFO_INPUT
* pIn
,
2295 ADDR_COMPUTE_DCCINFO_OUTPUT
* pOut
);
2300 ****************************************************************************************************
2301 * ADDR_GET_MAX_ALIGNMENTS_OUTPUT
2304 * Output structure of AddrGetMaxAlignments
2305 ****************************************************************************************************
2307 typedef struct _ADDR_GET_MAX_ALIGNMENTS_OUTPUT
2309 UINT_32 size
; ///< Size of this structure in bytes
2310 UINT_64 baseAlign
; ///< Maximum base alignment in bytes
2311 } ADDR_GET_MAX_ALIGNMENTS_OUTPUT
;
2314 ****************************************************************************************************
2315 * AddrGetMaxAlignments
2318 * Gets maximnum alignments
2319 ****************************************************************************************************
2321 ADDR_E_RETURNCODE ADDR_API
AddrGetMaxAlignments(
2323 ADDR_GET_MAX_ALIGNMENTS_OUTPUT
* pOut
);
2328 ****************************************************************************************************
2329 * Address library interface version 2
2330 * available from Gfx9 hardware
2331 ****************************************************************************************************
2332 * Addr2ComputeSurfaceInfo()
2333 * Addr2ComputeSurfaceAddrFromCoord()
2334 * Addr2ComputeSurfaceCoordFromAddr()
2336 * Addr2ComputeHtileInfo()
2337 * Addr2ComputeHtileAddrFromCoord()
2338 * Addr2ComputeHtileCoordFromAddr()
2340 * Addr2ComputeCmaskInfo()
2341 * Addr2ComputeCmaskAddrFromCoord()
2342 * Addr2ComputeCmaskCoordFromAddr()
2344 * Addr2ComputeFmaskInfo()
2345 * Addr2ComputeFmaskAddrFromCoord()
2346 * Addr2ComputeFmaskCoordFromAddr()
2348 * Addr2ComputeDccInfo()
2353 ////////////////////////////////////////////////////////////////////////////////////////////////////
2354 // Surface functions for Gfx9
2355 ////////////////////////////////////////////////////////////////////////////////////////////////////
2358 ****************************************************************************************************
2359 * ADDR2_SURFACE_FLAGS
2363 ****************************************************************************************************
2365 typedef union _ADDR2_SURFACE_FLAGS
2369 UINT_32 color
: 1; ///< This resource is a color buffer, can be used with RTV
2370 UINT_32 depth
: 1; ///< Thie resource is a depth buffer, can be used with DSV
2371 UINT_32 stencil
: 1; ///< Thie resource is a stencil buffer, can be used with DSV
2372 UINT_32 fmask
: 1; ///< This is an fmask surface
2373 UINT_32 overlay
: 1; ///< This is an overlay surface
2374 UINT_32 display
: 1; ///< This resource is displable, can be used with DRV
2375 UINT_32 prt
: 1; ///< This is a partially resident texture
2376 UINT_32 qbStereo
: 1; ///< This is a quad buffer stereo surface
2377 UINT_32 interleaved
: 1; ///< Special flag for interleaved YUV surface padding
2378 UINT_32 texture
: 1; ///< This resource can be used with SRV
2379 UINT_32 unordered
: 1; ///< This resource can be used with UAV
2380 UINT_32 rotated
: 1; ///< This resource is rotated and displable
2381 UINT_32 needEquation
: 1; ///< This resource needs equation to be generated if possible
2382 UINT_32 opt4space
: 1; ///< This resource should be optimized for space
2383 UINT_32 minimizeAlign
: 1; ///< This resource should use minimum alignment
2384 UINT_32 reserved
: 17; ///< Reserved bits
2388 } ADDR2_SURFACE_FLAGS
;
2391 ****************************************************************************************************
2392 * ADDR2_COMPUTE_SURFACE_INFO_INPUT
2395 * Input structure for Addr2ComputeSurfaceInfo
2396 ****************************************************************************************************
2398 typedef struct _ADDR2_COMPUTE_SURFACE_INFO_INPUT
2400 UINT_32 size
; ///< Size of this structure in bytes
2402 ADDR2_SURFACE_FLAGS flags
; ///< Surface flags
2403 AddrSwizzleMode swizzleMode
; ///< Swizzle Mode for Gfx9
2404 AddrResourceType resourceType
; ///< Surface type
2405 AddrFormat format
; ///< Surface format
2406 UINT_32 bpp
; ///< bits per pixel
2407 UINT_32 width
; ///< Width (of mip0), in pixels
2408 UINT_32 height
; ///< Height (of mip0), in pixels
2409 UINT_32 numSlices
; ///< Number surface slice/depth (of mip0),
2410 UINT_32 numMipLevels
; ///< Total mipmap levels.
2411 UINT_32 numSamples
; ///< Number of samples
2412 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
2413 /// number of samples for normal AA; Set it to the
2414 /// number of fragments for EQAA
2415 UINT_32 pitchInElement
; ///< Pitch in elements (blocks for compressed formats)
2416 UINT_32 sliceAlign
; ///< Required slice size in bytes
2417 } ADDR2_COMPUTE_SURFACE_INFO_INPUT
;
2420 ****************************************************************************************************
2424 * Structure that contains information for mip level
2426 ****************************************************************************************************
2428 typedef struct _ADDR2_MIP_INFO
2430 UINT_32 pitch
; ///< Pitch in elements
2431 UINT_32 height
; ///< Padded height in elements
2432 UINT_32 depth
; ///< Padded depth
2433 UINT_32 pixelPitch
; ///< Pitch in pixels
2434 UINT_32 pixelHeight
; ///< Padded height in pixels
2435 UINT_32 equationIndex
; ///< Equation index in the equation table
2436 UINT_64 offset
; ///< Offset in bytes from mip base, should only be used
2437 ///< to setup vam surface descriptor, can't be used
2438 ///< to setup swizzle pattern
2439 UINT_64 macroBlockOffset
; ///< macro block offset in bytes from mip base
2440 UINT_32 mipTailOffset
; ///< mip tail offset in bytes
2441 UINT_32 mipTailCoordX
; ///< mip tail coord x
2442 UINT_32 mipTailCoordY
; ///< mip tail coord y
2443 UINT_32 mipTailCoordZ
; ///< mip tail coord z
2447 ****************************************************************************************************
2448 * ADDR2_COMPUTE_SURFACE_INFO_OUTPUT
2451 * Output structure for Addr2ComputeSurfInfo
2453 Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch
2454 Pixel: Original pixel
2455 ****************************************************************************************************
2457 typedef struct _ADDR2_COMPUTE_SURFACE_INFO_OUTPUT
2459 UINT_32 size
; ///< Size of this structure in bytes
2461 UINT_32 pitch
; ///< Pitch in elements (blocks for compressed formats)
2462 UINT_32 height
; ///< Padded height (of mip0) in elements
2463 UINT_32 numSlices
; ///< Padded depth for 3d resource
2464 ///< or padded number of slices for 2d array resource
2465 UINT_32 mipChainPitch
; ///< Pitch (of total mip chain) in elements
2466 UINT_32 mipChainHeight
; ///< Padded height (of total mip chain) in elements
2467 UINT_32 mipChainSlice
; ///< Padded depth (of total mip chain)
2468 UINT_64 sliceSize
; ///< Slice (total mip chain) size in bytes
2469 UINT_64 surfSize
; ///< Surface (total mip chain) size in bytes
2470 UINT_32 baseAlign
; ///< Base address alignment
2471 UINT_32 bpp
; ///< Bits per elements
2472 /// (e.g. blocks for BCn, 1/3 for 96bit)
2473 UINT_32 pixelMipChainPitch
; ///< Mip chain pitch in original pixels
2474 UINT_32 pixelMipChainHeight
; ///< Mip chain height in original pixels
2475 UINT_32 pixelPitch
; ///< Pitch in original pixels
2476 UINT_32 pixelHeight
; ///< Height in original pixels
2477 UINT_32 pixelBits
; ///< Original bits per pixel, passed from input
2479 UINT_32 blockWidth
; ///< Width in element inside one block
2480 UINT_32 blockHeight
; ///< Height in element inside one block
2481 UINT_32 blockSlices
; ///< Slice number inside one block
2482 ///< Prt tile is one block, its width/height/slice
2483 ///< equals to blcok width/height/slice
2485 BOOL_32 epitchIsHeight
; ///< Whether to use height to program epitch register
2487 ADDR_QBSTEREOINFO
* pStereoInfo
; ///< Stereo info, needed if qbStereo flag is TRUE
2489 ADDR2_MIP_INFO
* pMipInfo
; ///< Pointer to mip information array
2490 /// if it is not NULL, the array is assumed to
2491 /// contain numMipLevels entries
2493 UINT_32 equationIndex
; ///< Equation index in the equation table of mip0
2494 BOOL_32 mipChainInTail
; ///< If whole mipchain falls into mip tail block
2495 UINT_32 firstMipIdInTail
; ///< The id of first mip in tail, if there is no mip
2496 /// in tail, it will be set to number of mip levels
2497 } ADDR2_COMPUTE_SURFACE_INFO_OUTPUT
;
2500 ****************************************************************************************************
2501 * Addr2ComputeSurfaceInfo
2504 * Compute surface width/height/slices/alignments and suitable tiling mode
2505 ****************************************************************************************************
2507 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeSurfaceInfo(
2509 const ADDR2_COMPUTE_SURFACE_INFO_INPUT
* pIn
,
2510 ADDR2_COMPUTE_SURFACE_INFO_OUTPUT
* pOut
);
2515 ****************************************************************************************************
2516 * ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
2519 * Input structure for Addr2ComputeSurfaceAddrFromCoord
2520 ****************************************************************************************************
2522 typedef struct _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
2524 UINT_32 size
; ///< Size of this structure in bytes
2526 UINT_32 x
; ///< X coordinate
2527 UINT_32 y
; ///< Y coordinate
2528 UINT_32 slice
; ///< Slice index
2529 UINT_32 sample
; ///< Sample index, use fragment index for EQAA
2530 UINT_32 mipId
; ///< the mip ID in mip chain
2532 AddrSwizzleMode swizzleMode
; ///< Swizzle mode for Gfx9
2533 ADDR2_SURFACE_FLAGS flags
; ///< Surface flags
2534 AddrResourceType resourceType
; ///< Surface type
2535 UINT_32 bpp
; ///< Bits per pixel
2536 UINT_32 unalignedWidth
; ///< Surface original width (of mip0)
2537 UINT_32 unalignedHeight
; ///< Surface original height (of mip0)
2538 UINT_32 numSlices
; ///< Surface original slices (of mip0)
2539 UINT_32 numMipLevels
; ///< Total mipmap levels
2540 UINT_32 numSamples
; ///< Number of samples
2541 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
2542 /// number of samples for normal AA; Set it to the
2543 /// number of fragments for EQAA
2545 UINT_32 pipeBankXor
; ///< Combined swizzle used to do bank/pipe rotation
2546 UINT_32 pitchInElement
; ///< Pitch in elements (blocks for compressed formats)
2547 } ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
;
2550 ****************************************************************************************************
2551 * ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
2554 * Output structure for Addr2ComputeSurfaceAddrFromCoord
2555 ****************************************************************************************************
2557 typedef struct _ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
2559 UINT_32 size
; ///< Size of this structure in bytes
2561 UINT_64 addr
; ///< Byte address
2562 UINT_32 bitPosition
; ///< Bit position within surfaceAddr, 0-7.
2563 /// For surface bpp < 8, e.g. FMT_1.
2564 UINT_32 prtBlockIndex
; ///< Index of a PRT tile (64K block)
2565 } ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
;
2568 ****************************************************************************************************
2569 * Addr2ComputeSurfaceAddrFromCoord
2572 * Compute surface address from a given coordinate.
2573 ****************************************************************************************************
2575 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeSurfaceAddrFromCoord(
2577 const ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
* pIn
,
2578 ADDR2_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
* pOut
);
2583 ****************************************************************************************************
2584 * ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT
2587 * Input structure for Addr2ComputeSurfaceCoordFromAddr
2588 ****************************************************************************************************
2590 typedef struct _ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT
2592 UINT_32 size
; ///< Size of this structure in bytes
2594 UINT_64 addr
; ///< Address in bytes
2595 UINT_32 bitPosition
; ///< Bit position in addr. 0-7. for surface bpp < 8,
2598 AddrSwizzleMode swizzleMode
; ///< Swizzle mode for Gfx9
2599 ADDR2_SURFACE_FLAGS flags
; ///< Surface flags
2600 AddrResourceType resourceType
; ///< Surface type
2601 UINT_32 bpp
; ///< Bits per pixel
2602 UINT_32 unalignedWidth
; ///< Surface original width (of mip0)
2603 UINT_32 unalignedHeight
; ///< Surface original height (of mip0)
2604 UINT_32 numSlices
; ///< Surface original slices (of mip0)
2605 UINT_32 numMipLevels
; ///< Total mipmap levels.
2606 UINT_32 numSamples
; ///< Number of samples
2607 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
2608 /// number of samples for normal AA; Set it to the
2609 /// number of fragments for EQAA
2611 UINT_32 pipeBankXor
; ///< Combined swizzle used to do bank/pipe rotation
2612 UINT_32 pitchInElement
; ///< Pitch in elements (blocks for compressed formats)
2613 } ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT
;
2616 ****************************************************************************************************
2617 * ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
2620 * Output structure for Addr2ComputeSurfaceCoordFromAddr
2621 ****************************************************************************************************
2623 typedef struct _ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
2625 UINT_32 size
; ///< Size of this structure in bytes
2627 UINT_32 x
; ///< X coordinate
2628 UINT_32 y
; ///< Y coordinate
2629 UINT_32 slice
; ///< Index of slices
2630 UINT_32 sample
; ///< Index of samples, means fragment index for EQAA
2631 UINT_32 mipId
; ///< mipmap level id
2632 } ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
;
2635 ****************************************************************************************************
2636 * Addr2ComputeSurfaceCoordFromAddr
2639 * Compute coordinate from a given surface address
2640 ****************************************************************************************************
2642 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeSurfaceCoordFromAddr(
2644 const ADDR2_COMPUTE_SURFACE_COORDFROMADDR_INPUT
* pIn
,
2645 ADDR2_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
* pOut
);
2649 ////////////////////////////////////////////////////////////////////////////////////////////////////
2650 // HTile functions for Gfx9
2651 ////////////////////////////////////////////////////////////////////////////////////////////////////
2654 ****************************************************************************************************
2659 ****************************************************************************************************
2661 typedef union _ADDR2_META_FLAGS
2665 UINT_32 pipeAligned
: 1; ///< if Metadata being pipe aligned
2666 UINT_32 rbAligned
: 1; ///< if Metadata being RB aligned
2667 UINT_32 linear
: 1; ///< if Metadata linear, GFX9 does not suppord this!
2668 UINT_32 reserved
: 29; ///< Reserved bits
2675 ****************************************************************************************************
2676 * ADDR2_META_MIP_INFO
2679 * Structure to store per mip metadata information
2680 ****************************************************************************************************
2682 typedef struct _ADDR2_META_MIP_INFO
2703 } ADDR2_META_MIP_INFO
;
2706 ****************************************************************************************************
2707 * ADDR2_COMPUTE_HTILE_INFO_INPUT
2710 * Input structure of Addr2ComputeHtileInfo
2711 ****************************************************************************************************
2713 typedef struct _ADDR2_COMPUTE_HTILE_INFO_INPUT
2715 UINT_32 size
; ///< Size of this structure in bytes
2717 ADDR2_META_FLAGS hTileFlags
; ///< HTILE flags
2718 ADDR2_SURFACE_FLAGS depthFlags
; ///< Depth surface flags
2719 AddrSwizzleMode swizzleMode
; ///< Depth surface swizzle mode
2720 UINT_32 unalignedWidth
; ///< Depth surface original width (of mip0)
2721 UINT_32 unalignedHeight
; ///< Depth surface original height (of mip0)
2722 UINT_32 numSlices
; ///< Number of slices of depth surface (of mip0)
2723 UINT_32 numMipLevels
; ///< Total mipmap levels of color surface
2724 UINT_32 firstMipIdInTail
;
2725 } ADDR2_COMPUTE_HTILE_INFO_INPUT
;
2728 ****************************************************************************************************
2729 * ADDR2_COMPUTE_HTILE_INFO_OUTPUT
2732 * Output structure of Addr2ComputeHtileInfo
2733 ****************************************************************************************************
2735 typedef struct _ADDR2_COMPUTE_HTILE_INFO_OUTPUT
2737 UINT_32 size
; ///< Size of this structure in bytes
2739 UINT_32 pitch
; ///< Pitch in pixels of depth buffer represented in this
2740 /// HTile buffer. This might be larger than original depth
2741 /// buffer pitch when called with an unaligned pitch.
2742 UINT_32 height
; ///< Height in pixels, as above
2743 UINT_32 baseAlign
; ///< Base alignment
2744 UINT_32 sliceSize
; ///< Slice size, in bytes.
2745 UINT_32 htileBytes
; ///< Size of HTILE buffer, in bytes
2746 UINT_32 metaBlkWidth
; ///< Meta block width
2747 UINT_32 metaBlkHeight
; ///< Meta block height
2748 UINT_32 metaBlkNumPerSlice
; ///< Number of metablock within one slice
2750 ADDR2_META_MIP_INFO
* pMipInfo
; ///< HTILE mip information
2751 } ADDR2_COMPUTE_HTILE_INFO_OUTPUT
;
2754 ****************************************************************************************************
2755 * Addr2ComputeHtileInfo
2758 * Compute Htile pitch, height, base alignment and size in bytes
2759 ****************************************************************************************************
2761 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeHtileInfo(
2763 const ADDR2_COMPUTE_HTILE_INFO_INPUT
* pIn
,
2764 ADDR2_COMPUTE_HTILE_INFO_OUTPUT
* pOut
);
2769 ****************************************************************************************************
2770 * ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
2773 * Input structure for Addr2ComputeHtileAddrFromCoord
2774 ****************************************************************************************************
2776 typedef struct _ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
2778 UINT_32 size
; ///< Size of this structure in bytes
2780 UINT_32 x
; ///< X coordinate
2781 UINT_32 y
; ///< Y coordinate
2782 UINT_32 slice
; ///< Index of slices
2783 UINT_32 mipId
; ///< mipmap level id
2785 ADDR2_META_FLAGS hTileFlags
; ///< HTILE flags
2786 ADDR2_SURFACE_FLAGS depthflags
; ///< Depth surface flags
2787 AddrSwizzleMode swizzleMode
; ///< Depth surface swizzle mode
2788 UINT_32 bpp
; ///< Depth surface bits per pixel
2789 UINT_32 unalignedWidth
; ///< Depth surface original width (of mip0)
2790 UINT_32 unalignedHeight
; ///< Depth surface original height (of mip0)
2791 UINT_32 numSlices
; ///< Depth surface original depth (of mip0)
2792 UINT_32 numMipLevels
; ///< Depth surface total mipmap levels
2793 UINT_32 numSamples
; ///< Depth surface number of samples
2794 UINT_32 pipeXor
; ///< Pipe xor setting
2795 } ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
;
2798 ****************************************************************************************************
2799 * ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
2802 * Output structure for Addr2ComputeHtileAddrFromCoord
2803 ****************************************************************************************************
2805 typedef struct _ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
2807 UINT_32 size
; ///< Size of this structure in bytes
2809 UINT_64 addr
; ///< Address in bytes
2810 } ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
;
2813 ****************************************************************************************************
2814 * Addr2ComputeHtileAddrFromCoord
2817 * Compute Htile address according to coordinates (of depth buffer)
2818 ****************************************************************************************************
2820 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeHtileAddrFromCoord(
2822 const ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
* pIn
,
2823 ADDR2_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
* pOut
);
2828 ****************************************************************************************************
2829 * ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT
2832 * Input structure for Addr2ComputeHtileCoordFromAddr
2833 ****************************************************************************************************
2835 typedef struct _ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT
2837 UINT_32 size
; ///< Size of this structure in bytes
2839 UINT_64 addr
; ///< Address
2841 ADDR2_META_FLAGS hTileFlags
; ///< HTILE flags
2842 ADDR2_SURFACE_FLAGS depthFlags
; ///< Depth surface flags
2843 AddrSwizzleMode swizzleMode
; ///< Depth surface swizzle mode
2844 UINT_32 bpp
; ///< Depth surface bits per pixel
2845 UINT_32 unalignedWidth
; ///< Depth surface original width (of mip0)
2846 UINT_32 unalignedHeight
; ///< Depth surface original height (of mip0)
2847 UINT_32 numSlices
; ///< Depth surface original depth (of mip0)
2848 UINT_32 numMipLevels
; ///< Depth surface total mipmap levels
2849 UINT_32 numSamples
; ///< Depth surface number of samples
2850 UINT_32 pipeXor
; ///< Pipe xor setting
2851 } ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT
;
2854 ****************************************************************************************************
2855 * ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
2858 * Output structure for Addr2ComputeHtileCoordFromAddr
2859 ****************************************************************************************************
2861 typedef struct _ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
2863 UINT_32 size
; ///< Size of this structure in bytes
2865 UINT_32 x
; ///< X coordinate
2866 UINT_32 y
; ///< Y coordinate
2867 UINT_32 slice
; ///< Index of slices
2868 UINT_32 mipId
; ///< mipmap level id
2869 } ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
;
2872 ****************************************************************************************************
2873 * Addr2ComputeHtileCoordFromAddr
2876 * Compute coordinates within depth buffer (1st pixel of a micro tile) according to
2878 ****************************************************************************************************
2880 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeHtileCoordFromAddr(
2882 const ADDR2_COMPUTE_HTILE_COORDFROMADDR_INPUT
* pIn
,
2883 ADDR2_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
* pOut
);
2887 ////////////////////////////////////////////////////////////////////////////////////////////////////
2888 // C-mask functions for Gfx9
2889 ////////////////////////////////////////////////////////////////////////////////////////////////////
2892 ****************************************************************************************************
2893 * ADDR2_COMPUTE_CMASK_INFO_INPUT
2896 * Input structure of Addr2ComputeCmaskInfo
2897 ****************************************************************************************************
2899 typedef struct _ADDR2_COMPUTE_CMASKINFO_INPUT
2901 UINT_32 size
; ///< Size of this structure in bytes
2903 ADDR2_META_FLAGS cMaskFlags
; ///< CMASK flags
2904 ADDR2_SURFACE_FLAGS colorFlags
; ///< Color surface flags
2905 AddrResourceType resourceType
; ///< Color surface type
2906 AddrSwizzleMode swizzleMode
; ///< FMask surface swizzle mode
2907 UINT_32 unalignedWidth
; ///< Color surface original width
2908 UINT_32 unalignedHeight
; ///< Color surface original height
2909 UINT_32 numSlices
; ///< Number of slices of color buffer
2910 } ADDR2_COMPUTE_CMASK_INFO_INPUT
;
2913 ****************************************************************************************************
2914 * ADDR2_COMPUTE_CMASK_INFO_OUTPUT
2917 * Output structure of Addr2ComputeCmaskInfo
2918 ****************************************************************************************************
2920 typedef struct _ADDR2_COMPUTE_CMASK_INFO_OUTPUT
2922 UINT_32 size
; ///< Size of this structure in bytes
2924 UINT_32 pitch
; ///< Pitch in pixels of color buffer which
2925 /// this Cmask matches. The size might be larger than
2926 /// original color buffer pitch when called with
2927 /// an unaligned pitch.
2928 UINT_32 height
; ///< Height in pixels, as above
2929 UINT_32 baseAlign
; ///< Base alignment
2930 UINT_32 sliceSize
; ///< Slice size, in bytes.
2931 UINT_32 cmaskBytes
; ///< Size in bytes of CMask buffer
2932 UINT_32 metaBlkWidth
; ///< Meta block width
2933 UINT_32 metaBlkHeight
; ///< Meta block height
2935 UINT_32 metaBlkNumPerSlice
; ///< Number of metablock within one slice
2936 } ADDR2_COMPUTE_CMASK_INFO_OUTPUT
;
2939 ****************************************************************************************************
2940 * Addr2ComputeCmaskInfo
2943 * Compute Cmask pitch, height, base alignment and size in bytes from color buffer
2945 ****************************************************************************************************
2947 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeCmaskInfo(
2949 const ADDR2_COMPUTE_CMASK_INFO_INPUT
* pIn
,
2950 ADDR2_COMPUTE_CMASK_INFO_OUTPUT
* pOut
);
2955 ****************************************************************************************************
2956 * ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
2959 * Input structure for Addr2ComputeCmaskAddrFromCoord
2961 ****************************************************************************************************
2963 typedef struct _ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
2965 UINT_32 size
; ///< Size of this structure in bytes
2967 UINT_32 x
; ///< X coordinate
2968 UINT_32 y
; ///< Y coordinate
2969 UINT_32 slice
; ///< Index of slices
2971 ADDR2_META_FLAGS cMaskFlags
; ///< CMASK flags
2972 ADDR2_SURFACE_FLAGS colorFlags
; ///< Color surface flags
2973 AddrResourceType resourceType
; ///< Color surface type
2974 AddrSwizzleMode swizzleMode
; ///< FMask surface swizzle mode
2976 UINT_32 unalignedWidth
; ///< Color surface original width (of mip0)
2977 UINT_32 unalignedHeight
; ///< Color surface original height (of mip0)
2978 UINT_32 numSlices
; ///< Color surface original slices (of mip0)
2980 UINT_32 numSamples
; ///< Color surfae sample number
2981 UINT_32 numFrags
; ///< Color surface fragment number
2983 UINT_32 pipeXor
; ///< pipe Xor setting
2984 } ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
;
2987 ****************************************************************************************************
2988 * ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
2991 * Output structure for Addr2ComputeCmaskAddrFromCoord
2992 ****************************************************************************************************
2994 typedef struct _ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
2996 UINT_32 size
; ///< Size of this structure in bytes
2998 UINT_64 addr
; ///< CMASK address in bytes
2999 UINT_32 bitPosition
; ///< Bit position within addr, 0 or 4
3000 } ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
;
3003 ****************************************************************************************************
3004 * Addr2ComputeCmaskAddrFromCoord
3007 * Compute Cmask address according to coordinates (of MSAA color buffer)
3008 ****************************************************************************************************
3010 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeCmaskAddrFromCoord(
3012 const ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
* pIn
,
3013 ADDR2_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
* pOut
);
3018 ****************************************************************************************************
3019 * ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT
3022 * Input structure for Addr2ComputeCmaskCoordFromAddr
3023 ****************************************************************************************************
3025 typedef struct _ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT
3027 UINT_32 size
; ///< Size of this structure in bytes
3029 UINT_64 addr
; ///< CMASK address in bytes
3030 UINT_32 bitPosition
; ///< Bit position within addr, 0 or 4
3032 ADDR2_META_FLAGS cMaskFlags
; ///< CMASK flags
3033 ADDR2_SURFACE_FLAGS colorFlags
; ///< Color surface flags
3034 AddrResourceType resourceType
; ///< Color surface type
3035 AddrSwizzleMode swizzleMode
; ///< FMask surface swizzle mode
3037 UINT_32 unalignedWidth
; ///< Color surface original width (of mip0)
3038 UINT_32 unalignedHeight
; ///< Color surface original height (of mip0)
3039 UINT_32 numSlices
; ///< Color surface original slices (of mip0)
3040 UINT_32 numMipLevels
; ///< Color surface total mipmap levels.
3041 } ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT
;
3044 ****************************************************************************************************
3045 * ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
3048 * Output structure for Addr2ComputeCmaskCoordFromAddr
3049 ****************************************************************************************************
3051 typedef struct _ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
3053 UINT_32 size
; ///< Size of this structure in bytes
3055 UINT_32 x
; ///< X coordinate
3056 UINT_32 y
; ///< Y coordinate
3057 UINT_32 slice
; ///< Index of slices
3058 UINT_32 mipId
; ///< mipmap level id
3059 } ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
;
3062 ****************************************************************************************************
3063 * Addr2ComputeCmaskCoordFromAddr
3066 * Compute coordinates within color buffer (1st pixel of a micro tile) according to
3068 ****************************************************************************************************
3070 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeCmaskCoordFromAddr(
3072 const ADDR2_COMPUTE_CMASK_COORDFROMADDR_INPUT
* pIn
,
3073 ADDR2_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
* pOut
);
3077 ////////////////////////////////////////////////////////////////////////////////////////////////////
3078 // F-mask functions for Gfx9
3079 ////////////////////////////////////////////////////////////////////////////////////////////////////
3082 ****************************************************************************************************
3087 ****************************************************************************************************
3089 typedef union _ADDR2_FMASK_FLAGS
3093 UINT_32 resolved
: 1; ///< TRUE if this is a resolved fmask, used by H/W clients
3094 /// by H/W clients. S/W should always set it to FALSE.
3095 UINT_32 reserved
: 31; ///< Reserved for future use.
3099 } ADDR2_FMASK_FLAGS
;
3102 ****************************************************************************************************
3103 * ADDR2_COMPUTE_FMASK_INFO_INPUT
3106 * Input structure for Addr2ComputeFmaskInfo
3107 ****************************************************************************************************
3109 typedef struct _ADDR2_COMPUTE_FMASK_INFO_INPUT
3111 UINT_32 size
; ///< Size of this structure in bytes
3113 AddrSwizzleMode swizzleMode
; ///< FMask surface swizzle mode
3114 UINT_32 unalignedWidth
; ///< Color surface original width
3115 UINT_32 unalignedHeight
; ///< Color surface original height
3116 UINT_32 numSlices
; ///< Number of slices/depth
3117 UINT_32 numSamples
; ///< Number of samples
3118 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
3119 /// number of samples for normal AA; Set it to the
3120 /// number of fragments for EQAA
3121 ADDR2_FMASK_FLAGS fMaskFlags
; ///< FMASK flags
3122 } ADDR2_COMPUTE_FMASK_INFO_INPUT
;
3125 ****************************************************************************************************
3126 * ADDR2_COMPUTE_FMASK_INFO_OUTPUT
3129 * Output structure for Addr2ComputeFmaskInfo
3130 ****************************************************************************************************
3132 typedef struct _ADDR2_COMPUTE_FMASK_INFO_OUTPUT
3134 UINT_32 size
; ///< Size of this structure in bytes
3136 UINT_32 pitch
; ///< Pitch of fmask in pixels
3137 UINT_32 height
; ///< Height of fmask in pixels
3138 UINT_32 baseAlign
; ///< Base alignment
3139 UINT_32 numSlices
; ///< Slices of fmask
3140 UINT_32 fmaskBytes
; ///< Size of fmask in bytes
3141 UINT_32 bpp
; ///< Bits per pixel of FMASK is: number of bit planes
3142 UINT_32 numSamples
; ///< Number of samples
3143 UINT_32 sliceSize
; ///< Size of slice in bytes
3144 } ADDR2_COMPUTE_FMASK_INFO_OUTPUT
;
3147 ****************************************************************************************************
3148 * Addr2ComputeFmaskInfo
3151 * Compute Fmask pitch/height/slices/alignments and size in bytes
3152 ****************************************************************************************************
3154 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeFmaskInfo(
3156 const ADDR2_COMPUTE_FMASK_INFO_INPUT
* pIn
,
3157 ADDR2_COMPUTE_FMASK_INFO_OUTPUT
* pOut
);
3162 ****************************************************************************************************
3163 * ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
3166 * Input structure for Addr2ComputeFmaskAddrFromCoord
3167 ****************************************************************************************************
3169 typedef struct _ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
3171 UINT_32 size
; ///< Size of this structure in bytes
3173 AddrSwizzleMode swizzleMode
; ///< FMask surface swizzle mode
3174 UINT_32 x
; ///< X coordinate
3175 UINT_32 y
; ///< Y coordinate
3176 UINT_32 slice
; ///< Slice index
3177 UINT_32 sample
; ///< Sample index (fragment index for EQAA)
3178 UINT_32 plane
; ///< Plane number
3180 UINT_32 unalignedWidth
; ///< Color surface original width
3181 UINT_32 unalignedHeight
; ///< Color surface original height
3182 UINT_32 numSamples
; ///< Number of samples
3183 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
3184 /// number of samples for normal AA; Set it to the
3185 /// number of fragments for EQAA
3186 UINT_32 tileSwizzle
; ///< Combined swizzle used to do bank/pipe rotation
3188 ADDR2_FMASK_FLAGS fMaskFlags
; ///< FMASK flags
3189 } ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
;
3192 ****************************************************************************************************
3193 * ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
3196 * Output structure for Addr2ComputeFmaskAddrFromCoord
3197 ****************************************************************************************************
3199 typedef struct _ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
3201 UINT_32 size
; ///< Size of this structure in bytes
3203 UINT_64 addr
; ///< Fmask address
3204 UINT_32 bitPosition
; ///< Bit position within fmaskAddr, 0-7.
3205 } ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
;
3208 ****************************************************************************************************
3209 * Addr2ComputeFmaskAddrFromCoord
3212 * Compute Fmask address according to coordinates (x,y,slice,sample,plane)
3213 ****************************************************************************************************
3215 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeFmaskAddrFromCoord(
3217 const ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
* pIn
,
3218 ADDR2_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
* pOut
);
3223 ****************************************************************************************************
3224 * ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT
3227 * Input structure for Addr2ComputeFmaskCoordFromAddr
3228 ****************************************************************************************************
3230 typedef struct _ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT
3232 UINT_32 size
; ///< Size of this structure in bytes
3234 UINT_64 addr
; ///< Address
3235 UINT_32 bitPosition
; ///< Bit position within addr, 0-7.
3236 AddrSwizzleMode swizzleMode
; ///< FMask surface swizzle mode
3238 UINT_32 unalignedWidth
; ///< Color surface original width
3239 UINT_32 unalignedHeight
; ///< Color surface original height
3240 UINT_32 numSamples
; ///< Number of samples
3241 UINT_32 numFrags
; ///< Number of fragments
3243 UINT_32 tileSwizzle
; ///< Combined swizzle used to do bank/pipe rotation
3245 ADDR2_FMASK_FLAGS fMaskFlags
; ///< FMASK flags
3246 } ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT
;
3249 ****************************************************************************************************
3250 * ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
3253 * Output structure for Addr2ComputeFmaskCoordFromAddr
3254 ****************************************************************************************************
3256 typedef struct _ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
3258 UINT_32 size
; ///< Size of this structure in bytes
3260 UINT_32 x
; ///< X coordinate
3261 UINT_32 y
; ///< Y coordinate
3262 UINT_32 slice
; ///< Slice index
3263 UINT_32 sample
; ///< Sample index (fragment index for EQAA)
3264 UINT_32 plane
; ///< Plane number
3265 } ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
;
3268 ****************************************************************************************************
3269 * Addr2ComputeFmaskCoordFromAddr
3272 * Compute FMASK coordinate from an given address
3273 ****************************************************************************************************
3275 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeFmaskCoordFromAddr(
3277 const ADDR2_COMPUTE_FMASK_COORDFROMADDR_INPUT
* pIn
,
3278 ADDR2_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
* pOut
);
3282 ////////////////////////////////////////////////////////////////////////////////////////////////////
3283 // DCC key functions for Gfx9
3284 ////////////////////////////////////////////////////////////////////////////////////////////////////
3287 ****************************************************************************************************
3288 * _ADDR2_COMPUTE_DCCINFO_INPUT
3291 * Input structure of Addr2ComputeDccInfo
3292 ****************************************************************************************************
3294 typedef struct _ADDR2_COMPUTE_DCCINFO_INPUT
3296 UINT_32 size
; ///< Size of this structure in bytes
3298 ADDR2_META_FLAGS dccKeyFlags
; ///< DCC key flags
3299 ADDR2_SURFACE_FLAGS colorFlags
; ///< Color surface flags
3300 AddrResourceType resourceType
; ///< Color surface type
3301 AddrSwizzleMode swizzleMode
; ///< Color surface swizzle mode
3302 UINT_32 bpp
; ///< bits per pixel
3303 UINT_32 unalignedWidth
; ///< Color surface original width (of mip0)
3304 UINT_32 unalignedHeight
; ///< Color surface original height (of mip0)
3305 UINT_32 numSlices
; ///< Number of slices, of color surface (of mip0)
3306 UINT_32 numFrags
; ///< Fragment number of color surface
3307 UINT_32 numMipLevels
; ///< Total mipmap levels of color surface
3308 UINT_32 dataSurfaceSize
; ///< The padded size of all slices and mip levels
3309 ///< useful in meta linear case
3310 UINT_32 firstMipIdInTail
;
3311 } ADDR2_COMPUTE_DCCINFO_INPUT
;
3314 ****************************************************************************************************
3315 * ADDR2_COMPUTE_DCCINFO_OUTPUT
3318 * Output structure of Addr2ComputeDccInfo
3319 ****************************************************************************************************
3321 typedef struct _ADDR2_COMPUTE_DCCINFO_OUTPUT
3323 UINT_32 size
; ///< Size of this structure in bytes
3325 UINT_32 dccRamBaseAlign
; ///< Base alignment of dcc key
3326 UINT_32 dccRamSize
; ///< Size of dcc key
3328 UINT_32 pitch
; ///< DCC surface mip chain pitch
3329 UINT_32 height
; ///< DCC surface mip chain height
3330 UINT_32 depth
; ///< DCC surface mip chain depth
3332 UINT_32 compressBlkWidth
; ///< DCC compress block width
3333 UINT_32 compressBlkHeight
; ///< DCC compress block height
3334 UINT_32 compressBlkDepth
; ///< DCC compress block depth
3336 UINT_32 metaBlkWidth
; ///< DCC meta block width
3337 UINT_32 metaBlkHeight
; ///< DCC meta block height
3338 UINT_32 metaBlkDepth
; ///< DCC meta block depth
3340 UINT_32 metaBlkNumPerSlice
; ///< Number of metablock within one slice
3344 UINT_32 fastClearSizePerSlice
; ///< Size of DCC within a slice should be fast cleared
3345 UINT_32 dccRamSliceSize
;
3348 ADDR2_META_MIP_INFO
* pMipInfo
; ///< DCC mip information
3349 } ADDR2_COMPUTE_DCCINFO_OUTPUT
;
3352 ****************************************************************************************************
3353 * Addr2ComputeDccInfo
3356 * Compute DCC key size, base alignment
3358 ****************************************************************************************************
3360 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeDccInfo(
3362 const ADDR2_COMPUTE_DCCINFO_INPUT
* pIn
,
3363 ADDR2_COMPUTE_DCCINFO_OUTPUT
* pOut
);
3367 ****************************************************************************************************
3368 * ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT
3371 * Input structure for Addr2ComputeDccAddrFromCoord
3373 ****************************************************************************************************
3375 typedef struct _ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT
3377 UINT_32 size
; ///< Size of this structure in bytes
3379 UINT_32 x
; ///< X coordinate
3380 UINT_32 y
; ///< Y coordinate
3381 UINT_32 slice
; ///< Index of slices
3382 UINT_32 sample
; ///< Index of samples, means fragment index for EQAA
3383 UINT_32 mipId
; ///< mipmap level id
3385 ADDR2_META_FLAGS dccKeyFlags
; ///< DCC flags
3386 ADDR2_SURFACE_FLAGS colorFlags
; ///< Color surface flags
3387 AddrResourceType resourceType
; ///< Color surface type
3388 AddrSwizzleMode swizzleMode
; ///< Color surface swizzle mode
3389 UINT_32 bpp
; ///< Color surface bits per pixel
3390 UINT_32 unalignedWidth
; ///< Color surface original width (of mip0)
3391 UINT_32 unalignedHeight
; ///< Color surface original height (of mip0)
3392 UINT_32 numSlices
; ///< Color surface original slices (of mip0)
3393 UINT_32 numMipLevels
; ///< Color surface mipmap levels
3394 UINT_32 numFrags
; ///< Color surface fragment number
3396 UINT_32 pipeXor
; ///< pipe Xor setting
3397 } ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT
;
3400 ****************************************************************************************************
3401 * ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT
3404 * Output structure for Addr2ComputeDccAddrFromCoord
3405 ****************************************************************************************************
3407 typedef struct _ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT
3409 UINT_32 size
; ///< Size of this structure in bytes
3411 UINT_64 addr
; ///< DCC address in bytes
3412 } ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT
;
3415 ****************************************************************************************************
3416 * Addr2ComputeDccAddrFromCoord
3419 * Compute DCC address according to coordinates (of MSAA color buffer)
3420 ****************************************************************************************************
3422 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeDccAddrFromCoord(
3424 const ADDR2_COMPUTE_DCC_ADDRFROMCOORD_INPUT
* pIn
,
3425 ADDR2_COMPUTE_DCC_ADDRFROMCOORD_OUTPUT
* pOut
);
3427 ////////////////////////////////////////////////////////////////////////////////////////////////////
3428 // Misc functions for Gfx9
3429 ////////////////////////////////////////////////////////////////////////////////////////////////////
3432 ****************************************************************************************************
3433 * ADDR2_COMPUTE_PIPEBANKXOR_INPUT
3436 * Input structure of Addr2ComputePipebankXor
3437 ****************************************************************************************************
3439 typedef struct _ADDR2_COMPUTE_PIPEBANKXOR_INPUT
3441 UINT_32 size
; ///< Size of this structure in bytes
3442 UINT_32 surfIndex
; ///< Input surface index
3443 ADDR2_SURFACE_FLAGS flags
; ///< Surface flag
3444 AddrSwizzleMode swizzleMode
; ///< Surface swizzle mode
3445 AddrResourceType resourceType
; ///< Surface resource type
3446 AddrFormat format
; ///< Surface format
3447 UINT_32 numSamples
; ///< Number of samples
3448 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
3449 /// number of samples for normal AA; Set it to the
3450 /// number of fragments for EQAA
3451 } ADDR2_COMPUTE_PIPEBANKXOR_INPUT
;
3454 ****************************************************************************************************
3455 * ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT
3458 * Output structure of Addr2ComputePipebankXor
3459 ****************************************************************************************************
3461 typedef struct _ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT
3463 UINT_32 size
; ///< Size of this structure in bytes
3464 UINT_32 pipeBankXor
; ///< Pipe bank xor
3465 } ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT
;
3468 ****************************************************************************************************
3469 * Addr2ComputePipeBankXor
3472 * Calculate a valid bank pipe xor value for client to use.
3473 ****************************************************************************************************
3475 ADDR_E_RETURNCODE ADDR_API
Addr2ComputePipeBankXor(
3477 const ADDR2_COMPUTE_PIPEBANKXOR_INPUT
* pIn
,
3478 ADDR2_COMPUTE_PIPEBANKXOR_OUTPUT
* pOut
);
3481 ****************************************************************************************************
3482 * ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT
3485 * Input structure of Addr2ComputeSlicePipeBankXor
3486 ****************************************************************************************************
3488 typedef struct _ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT
3490 UINT_32 size
; ///< Size of this structure in bytes
3491 AddrSwizzleMode swizzleMode
; ///< Surface swizzle mode
3492 AddrResourceType resourceType
; ///< Surface resource type
3493 UINT_32 basePipeBankXor
; ///< Base pipe bank xor
3494 UINT_32 slice
; ///< Slice id
3495 UINT_32 numSamples
; ///< Number of samples
3496 } ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT
;
3499 ****************************************************************************************************
3500 * ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT
3503 * Output structure of Addr2ComputeSlicePipeBankXor
3504 ****************************************************************************************************
3506 typedef struct _ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT
3508 UINT_32 size
; ///< Size of this structure in bytes
3509 UINT_32 pipeBankXor
; ///< Pipe bank xor
3510 } ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT
;
3513 ****************************************************************************************************
3514 * Addr2ComputeSlicePipeBankXor
3517 * Calculate slice pipe bank xor value based on base pipe bank xor and slice id.
3518 ****************************************************************************************************
3520 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeSlicePipeBankXor(
3522 const ADDR2_COMPUTE_SLICE_PIPEBANKXOR_INPUT
* pIn
,
3523 ADDR2_COMPUTE_SLICE_PIPEBANKXOR_OUTPUT
* pOut
);
3526 ****************************************************************************************************
3527 * ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT
3530 * Input structure of Addr2ComputeSubResourceOffsetForSwizzlePattern
3531 ****************************************************************************************************
3533 typedef struct _ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT
3535 UINT_32 size
; ///< Size of this structure in bytes
3536 AddrSwizzleMode swizzleMode
; ///< Surface swizzle mode
3537 AddrResourceType resourceType
; ///< Surface resource type
3538 UINT_32 pipeBankXor
; ///< Per resource xor
3539 UINT_32 slice
; ///< Slice id
3540 UINT_64 sliceSize
; ///< Slice size of a mip chain
3541 UINT_64 macroBlockOffset
; ///< Macro block offset, returned in ADDR2_MIP_INFO
3542 UINT_32 mipTailOffset
; ///< Mip tail offset, returned in ADDR2_MIP_INFO
3543 } ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT
;
3546 ****************************************************************************************************
3547 * ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT
3550 * Output structure of Addr2ComputeSubResourceOffsetForSwizzlePattern
3551 ****************************************************************************************************
3553 typedef struct _ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT
3555 UINT_32 size
; ///< Size of this structure in bytes
3556 UINT_64 offset
; ///< offset
3557 } ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT
;
3560 ****************************************************************************************************
3561 * Addr2ComputeSubResourceOffsetForSwizzlePattern
3564 * Calculate sub resource offset to support swizzle pattern.
3565 ****************************************************************************************************
3567 ADDR_E_RETURNCODE ADDR_API
Addr2ComputeSubResourceOffsetForSwizzlePattern(
3569 const ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_INPUT
* pIn
,
3570 ADDR2_COMPUTE_SUBRESOURCE_OFFSET_FORSWIZZLEPATTERN_OUTPUT
* pOut
);
3573 ****************************************************************************************************
3577 * Bit field that defines block type
3578 ****************************************************************************************************
3580 typedef union _ADDR2_BLOCK_SET
3584 UINT_32 micro
: 1; // 256B block for 2D resource
3585 UINT_32 macro4KB
: 1; // 4KB for 2D/3D resource
3586 UINT_32 macro64KB
: 1; // 64KB for 2D/3D resource
3587 UINT_32 var
: 1; // VAR block
3588 UINT_32 linear
: 1; // Linear block
3589 UINT_32 reserved
: 27;
3596 ****************************************************************************************************
3600 * Bit field that defines swizzle type
3601 ****************************************************************************************************
3603 typedef union _ADDR2_SWTYPE_SET
3607 UINT_32 sw_Z
: 1; // SW_*_Z_*
3608 UINT_32 sw_S
: 1; // SW_*_S_*
3609 UINT_32 sw_D
: 1; // SW_*_D_*
3610 UINT_32 sw_R
: 1; // SW_*_R_*
3611 UINT_32 reserved
: 28;
3618 ****************************************************************************************************
3619 * ADDR2_GET_PREFERRED_SURF_SETTING_INPUT
3622 * Input structure of Addr2GetPreferredSurfaceSetting
3623 ****************************************************************************************************
3625 typedef struct _ADDR2_GET_PREFERRED_SURF_SETTING_INPUT
3627 UINT_32 size
; ///< Size of this structure in bytes
3629 ADDR2_SURFACE_FLAGS flags
; ///< Surface flags
3630 AddrResourceType resourceType
; ///< Surface type
3631 AddrFormat format
; ///< Surface format
3632 AddrResrouceLocation resourceLoction
; ///< Surface heap choice
3633 ADDR2_BLOCK_SET forbiddenBlock
; ///< Client can use it to disable some block setting
3634 ///< such as linear for DXTn, tiled for YUV
3635 ADDR2_SWTYPE_SET preferredSwSet
; ///< Client can use it to specify sw type(s) wanted
3636 BOOL_32 noXor
; ///< Do not use xor mode for this resource
3637 UINT_32 bpp
; ///< bits per pixel
3638 UINT_32 width
; ///< Width (of mip0), in pixels
3639 UINT_32 height
; ///< Height (of mip0), in pixels
3640 UINT_32 numSlices
; ///< Number surface slice/depth (of mip0),
3641 UINT_32 numMipLevels
; ///< Total mipmap levels.
3642 UINT_32 numSamples
; ///< Number of samples
3643 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
3644 /// number of samples for normal AA; Set it to the
3645 /// number of fragments for EQAA
3646 UINT_32 maxAlign
; ///< maximum base/size alignment requested by client
3647 UINT_32 minSizeAlign
; ///< memory allocated for surface in client driver will
3648 /// be padded to multiple of this value (in bytes)
3649 } ADDR2_GET_PREFERRED_SURF_SETTING_INPUT
;
3652 ****************************************************************************************************
3653 * ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT
3656 * Output structure of Addr2GetPreferredSurfaceSetting
3657 ****************************************************************************************************
3659 typedef struct _ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT
3661 UINT_32 size
; ///< Size of this structure in bytes
3663 AddrSwizzleMode swizzleMode
; ///< Suggested swizzle mode to be used
3664 AddrResourceType resourceType
; ///< Suggested resource type to program HW
3665 ADDR2_BLOCK_SET validBlockSet
; ///< Valid block type bit conbination
3666 BOOL_32 canXor
; ///< If client can use xor on a valid macro block
3668 ADDR2_SWTYPE_SET validSwTypeSet
; ///< Valid swizzle type bit combination
3669 ADDR2_SWTYPE_SET clientPreferredSwSet
; ///< Client-preferred swizzle type bit combination
3670 } ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT
;
3673 ****************************************************************************************************
3674 * Addr2GetPreferredSurfaceSetting
3677 * Suggest a preferred setting for client driver to program HW register
3678 ****************************************************************************************************
3680 ADDR_E_RETURNCODE ADDR_API
Addr2GetPreferredSurfaceSetting(
3682 const ADDR2_GET_PREFERRED_SURF_SETTING_INPUT
* pIn
,
3683 ADDR2_GET_PREFERRED_SURF_SETTING_OUTPUT
* pOut
);
3686 ****************************************************************************************************
3687 * Addr2IsValidDisplaySwizzleMode
3690 * Return whether the swizzle mode is supported by DCE / DCN.
3691 ****************************************************************************************************
3693 ADDR_E_RETURNCODE ADDR_API
Addr2IsValidDisplaySwizzleMode(
3695 AddrSwizzleMode swizzleMode
,
3699 #if defined(__cplusplus)
3703 #endif // __ADDR_INTERFACE_H__