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 5
44 #define ADDRLIB_VERSION_MINOR 25
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
350 } ADDR_REGISTER_VALUE
;
353 ****************************************************************************************************
357 * Parameters use to create an AddrLib Object. Caller must provide all fields.
359 ****************************************************************************************************
361 typedef struct _ADDR_CREATE_INPUT
363 UINT_32 size
; ///< Size of this structure in bytes
365 UINT_32 chipEngine
; ///< Chip Engine
366 UINT_32 chipFamily
; ///< Chip Family
367 UINT_32 chipRevision
; ///< Chip Revision
368 ADDR_CALLBACKS callbacks
; ///< Callbacks for sysmem alloc/free/print
369 ADDR_CREATE_FLAGS createFlags
; ///< Flags to setup AddrLib
370 ADDR_REGISTER_VALUE regValue
; ///< Data from registers to setup AddrLib global data
371 ADDR_CLIENT_HANDLE hClient
; ///< Client handle
372 UINT_32 minPitchAlignPixels
; ///< Minimum pitch alignment in pixels
376 ****************************************************************************************************
377 * ADDR_CREATEINFO_OUTPUT
380 * Return AddrLib handle to client driver
382 ****************************************************************************************************
384 typedef struct _ADDR_CREATE_OUTPUT
386 UINT_32 size
; ///< Size of this structure in bytes
388 ADDR_HANDLE hLib
; ///< Address lib handle
390 UINT_32 numEquations
; ///< Number of equations in the table
391 const ADDR_EQUATION
* pEquationTable
; ///< Pointer to the equation table
392 } ADDR_CREATE_OUTPUT
;
395 ****************************************************************************************************
399 * Create AddrLib object, must be called before any interface calls
402 * ADDR_OK if successful
403 ****************************************************************************************************
405 ADDR_E_RETURNCODE ADDR_API
AddrCreate(
406 const ADDR_CREATE_INPUT
* pAddrCreateIn
,
407 ADDR_CREATE_OUTPUT
* pAddrCreateOut
);
412 ****************************************************************************************************
416 * Destroy AddrLib object, must be called to free internally allocated resources.
419 * ADDR_OK if successful
420 ****************************************************************************************************
422 ADDR_E_RETURNCODE ADDR_API
AddrDestroy(
427 ////////////////////////////////////////////////////////////////////////////////////////////////////
429 ////////////////////////////////////////////////////////////////////////////////////////////////////
432 ****************************************************************************************************
434 * Bank/tiling parameters. On function input, these can be set as desired or
435 * left 0 for AddrLib to calculate/default. On function output, these are the actual
438 * Valid bankWidth/bankHeight value:
439 * 1,2,4,8. They are factors instead of pixels or bytes.
441 * The bank number remains constant across each row of the
442 * macro tile as each pipe is selected, so the number of
443 * tiles in the x direction with the same bank number will
444 * be bank_width * num_pipes.
445 ****************************************************************************************************
447 typedef struct _ADDR_TILEINFO
449 /// Any of these parameters can be set to 0 to use the HW default.
450 UINT_32 banks
; ///< Number of banks, numerical value
451 UINT_32 bankWidth
; ///< Number of tiles in the X direction in the same bank
452 UINT_32 bankHeight
; ///< Number of tiles in the Y direction in the same bank
453 UINT_32 macroAspectRatio
; ///< Macro tile aspect ratio. 1-1:1, 2-4:1, 4-16:1, 8-64:1
454 UINT_32 tileSplitBytes
; ///< Tile split size, in bytes
455 AddrPipeCfg pipeConfig
; ///< Pipe Config = HW enum + 1
458 // Create a define to avoid client change. The removal of R800 is because we plan to implement SI
459 // within 800 HWL - An AddrPipeCfg is added in above data structure
460 typedef ADDR_TILEINFO ADDR_R800_TILEINFO
;
463 ****************************************************************************************************
465 * Information needed by quad buffer stereo support
466 ****************************************************************************************************
468 typedef struct _ADDR_QBSTEREOINFO
470 UINT_32 eyeHeight
; ///< Height (in pixel rows) to right eye
471 UINT_32 rightOffset
; ///< Offset (in bytes) to right eye
472 UINT_32 rightSwizzle
; ///< TileSwizzle for right eyes
476 ****************************************************************************************************
481 ****************************************************************************************************
483 typedef union _ADDR_SURFACE_FLAGS
487 UINT_32 color
: 1; ///< Flag indicates this is a color buffer
488 UINT_32 depth
: 1; ///< Flag indicates this is a depth/stencil buffer
489 UINT_32 stencil
: 1; ///< Flag indicates this is a stencil buffer
490 UINT_32 texture
: 1; ///< Flag indicates this is a texture
491 UINT_32 cube
: 1; ///< Flag indicates this is a cubemap
492 UINT_32 volume
: 1; ///< Flag indicates this is a volume texture
493 UINT_32 fmask
: 1; ///< Flag indicates this is an fmask
494 UINT_32 cubeAsArray
: 1; ///< Flag indicates if treat cubemap as arrays
495 UINT_32 compressZ
: 1; ///< Flag indicates z buffer is compressed
496 UINT_32 overlay
: 1; ///< Flag indicates this is an overlay surface
497 UINT_32 noStencil
: 1; ///< Flag indicates this depth has no separate stencil
498 UINT_32 display
: 1; ///< Flag indicates this should match display controller req.
499 UINT_32 opt4Space
: 1; ///< Flag indicates this surface should be optimized for space
500 /// i.e. save some memory but may lose performance
501 UINT_32 prt
: 1; ///< Flag for partially resident texture
502 UINT_32 qbStereo
: 1; ///< Quad buffer stereo surface
503 UINT_32 pow2Pad
: 1; ///< SI: Pad to pow2, must set for mipmap (include level0)
504 UINT_32 interleaved
: 1; ///< Special flag for interleaved YUV surface padding
505 UINT_32 tcCompatible
: 1; ///< Flag indicates surface needs to be shader readable
506 UINT_32 dispTileType
: 1; ///< NI: force display Tiling for 128 bit shared resoruce
507 UINT_32 dccCompatible
: 1; ///< VI: whether to support dcc fast clear
508 UINT_32 czDispCompatible
: 1; ///< SI+: CZ family has a HW bug needs special alignment.
509 /// This flag indicates we need to follow the
510 /// alignment with CZ families or other ASICs under
511 /// PX configuration + CZ.
512 UINT_32 nonSplit
: 1; ///< CI: depth texture should not be split
513 UINT_32 disableLinearOpt
: 1; ///< Disable tile mode optimization to linear
514 UINT_32 needEquation
: 1; ///< Make the surface tile setting equation compatible.
515 /// This flag indicates we need to override tile
516 /// mode to PRT_* tile mode to disable slice rotation,
517 /// which is needed by swizzle pattern equation.
518 UINT_32 skipIndicesOutput
: 1; ///< Skipping indices in output.
519 UINT_32 rotateDisplay
: 1; ///< Rotate micro tile type
520 UINT_32 minimizeAlignment
: 1; ///< Minimize alignment
521 UINT_32 preferEquation
: 1; ///< Return equation index without adjusting tile mode
522 UINT_32 matchStencilTileCfg
: 1; ///< Select tile index of stencil as well as depth surface
523 /// to make sure they share same tile config parameters
524 UINT_32 reserved
: 3; ///< Reserved bits
528 } ADDR_SURFACE_FLAGS
;
531 ****************************************************************************************************
532 * ADDR_COMPUTE_SURFACE_INFO_INPUT
535 * Input structure for AddrComputeSurfaceInfo
536 ****************************************************************************************************
538 typedef struct _ADDR_COMPUTE_SURFACE_INFO_INPUT
540 UINT_32 size
; ///< Size of this structure in bytes
542 AddrTileMode tileMode
; ///< Tile mode
543 AddrFormat format
; ///< If format is set to valid one, bpp/width/height
544 /// might be overwritten
545 UINT_32 bpp
; ///< Bits per pixel
546 UINT_32 numSamples
; ///< Number of samples
547 UINT_32 width
; ///< Width, in pixels
548 UINT_32 height
; ///< Height, in pixels
549 UINT_32 numSlices
; ///< Number of surface slices or depth
550 UINT_32 slice
; ///< Slice index
551 UINT_32 mipLevel
; ///< Current mipmap level
552 UINT_32 numMipLevels
; ///< Number of mips in mip chain
553 ADDR_SURFACE_FLAGS flags
; ///< Surface type flags
554 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
555 /// number of samples for normal AA; Set it to the
556 /// number of fragments for EQAA
557 /// r800 and later HWL parameters
558 // Needed by 2D tiling, for linear and 1D tiling, just keep them 0's
559 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Set to 0 to default/calculate
560 AddrTileType tileType
; ///< Micro tiling type, not needed when tileIndex != -1
561 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
562 /// while the global useTileIndex is set to 1
563 UINT_32 basePitch
; ///< Base level pitch in pixels, 0 means ignored, is a
564 /// must for mip levels from SI+.
565 /// Don't use pitch in blocks for compressed formats!
566 UINT_32 maxBaseAlign
; ///< Max base alignment request from client
567 UINT_32 pitchAlign
; ///< Pitch alignment request from client
568 UINT_32 heightAlign
; ///< Height alignment request from client
569 } ADDR_COMPUTE_SURFACE_INFO_INPUT
;
572 ****************************************************************************************************
573 * ADDR_COMPUTE_SURFACE_INFO_OUTPUT
576 * Output structure for AddrComputeSurfInfo
578 Element: AddrLib unit for computing. e.g. BCn: 4x4 blocks; R32B32B32: 32bit with 3x pitch
579 Pixel: Original pixel
580 ****************************************************************************************************
582 typedef struct _ADDR_COMPUTE_SURFACE_INFO_OUTPUT
584 UINT_32 size
; ///< Size of this structure in bytes
586 UINT_32 pitch
; ///< Pitch in elements (in blocks for compressed formats)
587 UINT_32 height
; ///< Height in elements (in blocks for compressed formats)
588 UINT_32 depth
; ///< Number of slice/depth
589 UINT_64 surfSize
; ///< Surface size in bytes
590 AddrTileMode tileMode
; ///< Actual tile mode. May differ from that in input
591 UINT_32 baseAlign
; ///< Base address alignment
592 UINT_32 pitchAlign
; ///< Pitch alignment, in elements
593 UINT_32 heightAlign
; ///< Height alignment, in elements
594 UINT_32 depthAlign
; ///< Depth alignment, aligned to thickness, for 3d texture
595 UINT_32 bpp
; ///< Bits per elements (e.g. blocks for BCn, 1/3 for 96bit)
596 UINT_32 pixelPitch
; ///< Pitch in original pixels
597 UINT_32 pixelHeight
; ///< Height in original pixels
598 UINT_32 pixelBits
; ///< Original bits per pixel, passed from input
599 UINT_64 sliceSize
; ///< Size of slice specified by input's slice
600 /// The result is controlled by surface flags & createFlags
601 /// By default this value equals to surfSize for volume
602 UINT_32 pitchTileMax
; ///< PITCH_TILE_MAX value for h/w register
603 UINT_32 heightTileMax
; ///< HEIGHT_TILE_MAX value for h/w register
604 UINT_32 sliceTileMax
; ///< SLICE_TILE_MAX value for h/w register
606 UINT_32 numSamples
; ///< Pass the effective numSamples processed in this call
608 /// r800 and later HWL parameters
609 ADDR_TILEINFO
* pTileInfo
; ///< Tile parameters used. Filled in if 0 on input
610 AddrTileType tileType
; ///< Micro tiling type, only valid when tileIndex != -1
611 INT_32 tileIndex
; ///< Tile index, MAY be "downgraded"
613 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
617 /// Special information to work around SI mipmap swizzle bug UBTS #317508
618 UINT_32 last2DLevel
: 1; ///< TRUE if this is the last 2D(3D) tiled
619 ///< Only meaningful when create flag checkLast2DLevel is set
620 UINT_32 tcCompatible
: 1; ///< If the surface can be shader compatible
621 UINT_32 dccUnsupport
: 1; ///< If the surface can support DCC compressed rendering
622 UINT_32 prtTileIndex
: 1; ///< SI only, indicate the returned tile index is for PRT
623 ///< If address lib return true for mip 0, client should set prt flag
624 ///< for child mips in subsequent compute surface info calls
625 UINT_32 reserved
:28; ///< Reserved bits
628 UINT_32 equationIndex
; ///< Equation index in the equation table;
630 UINT_32 blockWidth
; ///< Width in element inside one block(1D->Micro, 2D->Macro)
631 UINT_32 blockHeight
; ///< Height in element inside one block(1D->Micro, 2D->Macro)
632 UINT_32 blockSlices
; ///< Slice number inside one block(1D->Micro, 2D->Macro)
635 ADDR_QBSTEREOINFO
* pStereoInfo
;///< Stereo information, needed when .qbStereo flag is TRUE
637 INT_32 stencilTileIdx
; ///< stencil tile index output when matchStencilTileCfg was set
638 } ADDR_COMPUTE_SURFACE_INFO_OUTPUT
;
641 ****************************************************************************************************
642 * AddrComputeSurfaceInfo
645 * Compute surface width/height/depth/alignments and suitable tiling mode
646 ****************************************************************************************************
648 ADDR_E_RETURNCODE ADDR_API
AddrComputeSurfaceInfo(
650 const ADDR_COMPUTE_SURFACE_INFO_INPUT
* pIn
,
651 ADDR_COMPUTE_SURFACE_INFO_OUTPUT
* pOut
);
656 ****************************************************************************************************
657 * ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
660 * Input structure for AddrComputeSurfaceAddrFromCoord
661 ****************************************************************************************************
663 typedef struct _ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
665 UINT_32 size
; ///< Size of this structure in bytes
667 UINT_32 x
; ///< X coordinate
668 UINT_32 y
; ///< Y coordinate
669 UINT_32 slice
; ///< Slice index
670 UINT_32 sample
; ///< Sample index, use fragment index for EQAA
672 UINT_32 bpp
; ///< Bits per pixel
673 UINT_32 pitch
; ///< Surface pitch, in pixels
674 UINT_32 height
; ///< Surface height, in pixels
675 UINT_32 numSlices
; ///< Surface depth
676 UINT_32 numSamples
; ///< Number of samples
678 AddrTileMode tileMode
; ///< Tile mode
679 BOOL_32 isDepth
; ///< TRUE if the surface uses depth sample ordering within
680 /// micro tile. Textures can also choose depth sample order
681 UINT_32 tileBase
; ///< Base offset (in bits) inside micro tile which handles
682 /// the case that components are stored separately
683 UINT_32 compBits
; ///< The component bits actually needed(for planar surface)
685 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
686 /// number of samples for normal AA; Set it to the
687 /// number of fragments for EQAA
688 /// r800 and later HWL parameters
689 // Used for 1D tiling above
690 AddrTileType tileType
; ///< See defintion of AddrTileType
693 UINT_32 ignoreSE
: 1; ///< TRUE if shader engines are ignored. This is texture
694 /// only flag. Only non-RT texture can set this to TRUE
695 UINT_32 reserved
:31; ///< Reserved for future use.
697 // 2D tiling needs following structure
698 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
699 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
700 /// while the global useTileIndex is set to 1
705 UINT_32 bankSwizzle
; ///< Bank swizzle
706 UINT_32 pipeSwizzle
; ///< Pipe swizzle
708 UINT_32 tileSwizzle
; ///< Combined swizzle, if useCombinedSwizzle is TRUE
711 #if ADDR_AM_BUILD // These two fields are not valid in SW blt since no HTILE access
712 UINT_32 addr5Swizzle
; ///< ADDR5_SWIZZLE_MASK of DB_DEPTH_INFO
713 BOOL_32 is32ByteTile
; ///< Caller must have access to HTILE buffer and know if
714 /// this tile is compressed to 32B
716 } ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
;
719 ****************************************************************************************************
720 * ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
723 * Output structure for AddrComputeSurfaceAddrFromCoord
724 ****************************************************************************************************
726 typedef struct _ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
728 UINT_32 size
; ///< Size of this structure in bytes
730 UINT_64 addr
; ///< Byte address
731 UINT_32 bitPosition
; ///< Bit position within surfaceAddr, 0-7.
732 /// For surface bpp < 8, e.g. FMT_1.
733 UINT_32 prtBlockIndex
; ///< Index of a PRT tile (64K block)
734 } ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
;
737 ****************************************************************************************************
738 * AddrComputeSurfaceAddrFromCoord
741 * Compute surface address from a given coordinate.
742 ****************************************************************************************************
744 ADDR_E_RETURNCODE ADDR_API
AddrComputeSurfaceAddrFromCoord(
746 const ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_INPUT
* pIn
,
747 ADDR_COMPUTE_SURFACE_ADDRFROMCOORD_OUTPUT
* pOut
);
752 ****************************************************************************************************
753 * ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
756 * Input structure for AddrComputeSurfaceCoordFromAddr
757 ****************************************************************************************************
759 typedef struct _ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
761 UINT_32 size
; ///< Size of this structure in bytes
763 UINT_64 addr
; ///< Address in bytes
764 UINT_32 bitPosition
; ///< Bit position in addr. 0-7. for surface bpp < 8,
766 UINT_32 bpp
; ///< Bits per pixel
767 UINT_32 pitch
; ///< Pitch, in pixels
768 UINT_32 height
; ///< Height in pixels
769 UINT_32 numSlices
; ///< Surface depth
770 UINT_32 numSamples
; ///< Number of samples
772 AddrTileMode tileMode
; ///< Tile mode
773 BOOL_32 isDepth
; ///< Surface uses depth sample ordering within micro tile.
774 /// Note: Textures can choose depth sample order as well.
775 UINT_32 tileBase
; ///< Base offset (in bits) inside micro tile which handles
776 /// the case that components are stored separately
777 UINT_32 compBits
; ///< The component bits actually needed(for planar surface)
779 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
780 /// number of samples for normal AA; Set it to the
781 /// number of fragments for EQAA
782 /// r800 and later HWL parameters
783 // Used for 1D tiling above
784 AddrTileType tileType
; ///< See defintion of AddrTileType
787 UINT_32 ignoreSE
: 1; ///< TRUE if shader engines are ignored. This is texture
788 /// only flag. Only non-RT texture can set this to TRUE
789 UINT_32 reserved
:31; ///< Reserved for future use.
791 // 2D tiling needs following structure
792 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
793 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
794 /// while the global useTileIndex is set to 1
799 UINT_32 bankSwizzle
; ///< Bank swizzle
800 UINT_32 pipeSwizzle
; ///< Pipe swizzle
802 UINT_32 tileSwizzle
; ///< Combined swizzle, if useCombinedSwizzle is TRUE
804 } ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
;
807 ****************************************************************************************************
808 * ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
811 * Output structure for AddrComputeSurfaceCoordFromAddr
812 ****************************************************************************************************
814 typedef struct _ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
816 UINT_32 size
; ///< Size of this structure in bytes
818 UINT_32 x
; ///< X coordinate
819 UINT_32 y
; ///< Y coordinate
820 UINT_32 slice
; ///< Index of slices
821 UINT_32 sample
; ///< Index of samples, means fragment index for EQAA
822 } ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
;
825 ****************************************************************************************************
826 * AddrComputeSurfaceCoordFromAddr
829 * Compute coordinate from a given surface address
830 ****************************************************************************************************
832 ADDR_E_RETURNCODE ADDR_API
AddrComputeSurfaceCoordFromAddr(
834 const ADDR_COMPUTE_SURFACE_COORDFROMADDR_INPUT
* pIn
,
835 ADDR_COMPUTE_SURFACE_COORDFROMADDR_OUTPUT
* pOut
);
837 ////////////////////////////////////////////////////////////////////////////////////////////////////
839 ////////////////////////////////////////////////////////////////////////////////////////////////////
842 ****************************************************************************************************
847 ****************************************************************************************************
849 typedef union _ADDR_HTILE_FLAGS
853 UINT_32 tcCompatible
: 1; ///< Flag indicates surface needs to be shader readable
854 UINT_32 reserved
:31; ///< Reserved bits
861 ****************************************************************************************************
862 * ADDR_COMPUTE_HTILE_INFO_INPUT
865 * Input structure of AddrComputeHtileInfo
866 ****************************************************************************************************
868 typedef struct _ADDR_COMPUTE_HTILE_INFO_INPUT
870 UINT_32 size
; ///< Size of this structure in bytes
872 ADDR_HTILE_FLAGS flags
; ///< HTILE flags
873 UINT_32 pitch
; ///< Surface pitch, in pixels
874 UINT_32 height
; ///< Surface height, in pixels
875 UINT_32 numSlices
; ///< Number of slices
876 BOOL_32 isLinear
; ///< Linear or tiled HTILE layout
877 AddrHtileBlockSize blockWidth
; ///< 4 or 8. EG above only support 8
878 AddrHtileBlockSize blockHeight
; ///< 4 or 8. EG above only support 8
879 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
881 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
882 /// while the global useTileIndex is set to 1
883 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
884 ///< README: When tileIndex is not -1, this must be valid
885 } ADDR_COMPUTE_HTILE_INFO_INPUT
;
888 ****************************************************************************************************
889 * ADDR_COMPUTE_HTILE_INFO_OUTPUT
892 * Output structure of AddrComputeHtileInfo
893 ****************************************************************************************************
895 typedef struct _ADDR_COMPUTE_HTILE_INFO_OUTPUT
897 UINT_32 size
; ///< Size of this structure in bytes
899 UINT_32 pitch
; ///< Pitch in pixels of depth buffer represented in this
900 /// HTile buffer. This might be larger than original depth
901 /// buffer pitch when called with an unaligned pitch.
902 UINT_32 height
; ///< Height in pixels, as above
903 UINT_64 htileBytes
; ///< Size of HTILE buffer, in bytes
904 UINT_32 baseAlign
; ///< Base alignment
905 UINT_32 bpp
; ///< Bits per pixel for HTILE is how many bits for an 8x8 block!
906 UINT_32 macroWidth
; ///< Macro width in pixels, actually squared cache shape
907 UINT_32 macroHeight
; ///< Macro height in pixels
908 UINT_64 sliceSize
; ///< Slice size, in bytes.
909 BOOL_32 sliceInterleaved
; ///< Flag to indicate if different slice's htile is interleaved
910 /// Compute engine clear can't be used if htile is interleaved
911 } ADDR_COMPUTE_HTILE_INFO_OUTPUT
;
914 ****************************************************************************************************
915 * AddrComputeHtileInfo
918 * Compute Htile pitch, height, base alignment and size in bytes
919 ****************************************************************************************************
921 ADDR_E_RETURNCODE ADDR_API
AddrComputeHtileInfo(
923 const ADDR_COMPUTE_HTILE_INFO_INPUT
* pIn
,
924 ADDR_COMPUTE_HTILE_INFO_OUTPUT
* pOut
);
929 ****************************************************************************************************
930 * ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
933 * Input structure for AddrComputeHtileAddrFromCoord
934 ****************************************************************************************************
936 typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
938 UINT_32 size
; ///< Size of this structure in bytes
940 UINT_32 pitch
; ///< Pitch, in pixels
941 UINT_32 height
; ///< Height in pixels
942 UINT_32 x
; ///< X coordinate
943 UINT_32 y
; ///< Y coordinate
944 UINT_32 slice
; ///< Index of slice
945 UINT_32 numSlices
; ///< Number of slices
946 BOOL_32 isLinear
; ///< Linear or tiled HTILE layout
947 ADDR_HTILE_FLAGS flags
; ///< htile flags
948 AddrHtileBlockSize blockWidth
; ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8
949 AddrHtileBlockSize blockHeight
; ///< 4 or 8. 1 means 8, 0 means 4. EG above only support 8
950 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
952 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
953 /// while the global useTileIndex is set to 1
954 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
955 ///< README: When tileIndex is not -1, this must be valid
956 UINT_32 bpp
; ///< depth/stencil buffer bit per pixel size
957 UINT_32 zStencilAddr
; ///< tcCompatible Z/Stencil surface address
958 } ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
;
961 ****************************************************************************************************
962 * ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
965 * Output structure for AddrComputeHtileAddrFromCoord
966 ****************************************************************************************************
968 typedef struct _ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
970 UINT_32 size
; ///< Size of this structure in bytes
972 UINT_64 addr
; ///< Address in bytes
973 UINT_32 bitPosition
; ///< Bit position, 0 or 4. CMASK and HTILE shares some lib method.
974 /// So we keep bitPosition for HTILE as well
975 } ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
;
978 ****************************************************************************************************
979 * AddrComputeHtileAddrFromCoord
982 * Compute Htile address according to coordinates (of depth buffer)
983 ****************************************************************************************************
985 ADDR_E_RETURNCODE ADDR_API
AddrComputeHtileAddrFromCoord(
987 const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT
* pIn
,
988 ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT
* pOut
);
993 ****************************************************************************************************
994 * ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
997 * Input structure for AddrComputeHtileCoordFromAddr
998 ****************************************************************************************************
1000 typedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
1002 UINT_32 size
; ///< Size of this structure in bytes
1004 UINT_64 addr
; ///< Address
1005 UINT_32 bitPosition
; ///< Bit position 0 or 4. CMASK and HTILE share some methods
1006 /// so we keep bitPosition for HTILE as well
1007 UINT_32 pitch
; ///< Pitch, in pixels
1008 UINT_32 height
; ///< Height, in pixels
1009 UINT_32 numSlices
; ///< Number of slices
1010 BOOL_32 isLinear
; ///< Linear or tiled HTILE layout
1011 AddrHtileBlockSize blockWidth
; ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8
1012 AddrHtileBlockSize blockHeight
; ///< 4 or 8. 1 means 8, 0 means 4. R8xx/R9xx only support 8
1013 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
1015 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1016 /// while the global useTileIndex is set to 1
1017 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1018 ///< README: When tileIndex is not -1, this must be valid
1019 } ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
;
1022 ****************************************************************************************************
1023 * ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
1026 * Output structure for AddrComputeHtileCoordFromAddr
1027 ****************************************************************************************************
1029 typedef struct _ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
1031 UINT_32 size
; ///< Size of this structure in bytes
1033 UINT_32 x
; ///< X coordinate
1034 UINT_32 y
; ///< Y coordinate
1035 UINT_32 slice
; ///< Slice index
1036 } ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
;
1039 ****************************************************************************************************
1040 * AddrComputeHtileCoordFromAddr
1043 * Compute coordinates within depth buffer (1st pixel of a micro tile) according to
1045 ****************************************************************************************************
1047 ADDR_E_RETURNCODE ADDR_API
AddrComputeHtileCoordFromAddr(
1049 const ADDR_COMPUTE_HTILE_COORDFROMADDR_INPUT
* pIn
,
1050 ADDR_COMPUTE_HTILE_COORDFROMADDR_OUTPUT
* pOut
);
1054 ////////////////////////////////////////////////////////////////////////////////////////////////////
1056 ////////////////////////////////////////////////////////////////////////////////////////////////////
1059 ****************************************************************************************************
1064 ****************************************************************************************************
1066 typedef union _ADDR_CMASK_FLAGS
1070 UINT_32 tcCompatible
: 1; ///< Flag indicates surface needs to be shader readable
1071 UINT_32 reserved
:31; ///< Reserved bits
1078 ****************************************************************************************************
1079 * ADDR_COMPUTE_CMASK_INFO_INPUT
1082 * Input structure of AddrComputeCmaskInfo
1083 ****************************************************************************************************
1085 typedef struct _ADDR_COMPUTE_CMASKINFO_INPUT
1087 UINT_32 size
; ///< Size of this structure in bytes
1089 ADDR_CMASK_FLAGS flags
; ///< CMASK flags
1090 UINT_32 pitch
; ///< Pitch, in pixels, of color buffer
1091 UINT_32 height
; ///< Height, in pixels, of color buffer
1092 UINT_32 numSlices
; ///< Number of slices, of color buffer
1093 BOOL_32 isLinear
; ///< Linear or tiled layout, Only SI can be linear
1094 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
1096 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1097 /// while the global useTileIndex is set to 1
1098 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1099 ///< README: When tileIndex is not -1, this must be valid
1100 } ADDR_COMPUTE_CMASK_INFO_INPUT
;
1103 ****************************************************************************************************
1104 * ADDR_COMPUTE_CMASK_INFO_OUTPUT
1107 * Output structure of AddrComputeCmaskInfo
1108 ****************************************************************************************************
1110 typedef struct _ADDR_COMPUTE_CMASK_INFO_OUTPUT
1112 UINT_32 size
; ///< Size of this structure in bytes
1114 UINT_32 pitch
; ///< Pitch in pixels of color buffer which
1115 /// this Cmask matches. The size might be larger than
1116 /// original color buffer pitch when called with
1117 /// an unaligned pitch.
1118 UINT_32 height
; ///< Height in pixels, as above
1119 UINT_64 cmaskBytes
; ///< Size in bytes of CMask buffer
1120 UINT_32 baseAlign
; ///< Base alignment
1121 UINT_32 blockMax
; ///< Cmask block size. Need this to set CB_COLORn_MASK register
1122 UINT_32 macroWidth
; ///< Macro width in pixels, actually squared cache shape
1123 UINT_32 macroHeight
; ///< Macro height in pixels
1124 UINT_64 sliceSize
; ///< Slice size, in bytes.
1125 } ADDR_COMPUTE_CMASK_INFO_OUTPUT
;
1128 ****************************************************************************************************
1129 * AddrComputeCmaskInfo
1132 * Compute Cmask pitch, height, base alignment and size in bytes from color buffer
1134 ****************************************************************************************************
1136 ADDR_E_RETURNCODE ADDR_API
AddrComputeCmaskInfo(
1138 const ADDR_COMPUTE_CMASK_INFO_INPUT
* pIn
,
1139 ADDR_COMPUTE_CMASK_INFO_OUTPUT
* pOut
);
1144 ****************************************************************************************************
1145 * ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
1148 * Input structure for AddrComputeCmaskAddrFromCoord
1150 ****************************************************************************************************
1152 typedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
1154 UINT_32 size
; ///< Size of this structure in bytes
1155 UINT_32 x
; ///< X coordinate
1156 UINT_32 y
; ///< Y coordinate
1157 UINT_64 fmaskAddr
; ///< Fmask addr for tc compatible Cmask
1158 UINT_32 slice
; ///< Slice index
1159 UINT_32 pitch
; ///< Pitch in pixels, of color buffer
1160 UINT_32 height
; ///< Height in pixels, of color buffer
1161 UINT_32 numSlices
; ///< Number of slices
1163 BOOL_32 isLinear
; ///< Linear or tiled layout, Only SI can be linear
1164 ADDR_CMASK_FLAGS flags
; ///< CMASK flags
1165 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
1167 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1168 ///< while the global useTileIndex is set to 1
1169 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1170 ///< README: When tileIndex is not -1, this must be valid
1171 } ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
;
1174 ****************************************************************************************************
1175 * ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
1178 * Output structure for AddrComputeCmaskAddrFromCoord
1179 ****************************************************************************************************
1181 typedef struct _ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
1183 UINT_32 size
; ///< Size of this structure in bytes
1185 UINT_64 addr
; ///< CMASK address in bytes
1186 UINT_32 bitPosition
; ///< Bit position within addr, 0-7. CMASK is 4 bpp,
1187 /// so the address may be located in bit 0 (0) or 4 (4)
1188 } ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
;
1191 ****************************************************************************************************
1192 * AddrComputeCmaskAddrFromCoord
1195 * Compute Cmask address according to coordinates (of MSAA color buffer)
1196 ****************************************************************************************************
1198 ADDR_E_RETURNCODE ADDR_API
AddrComputeCmaskAddrFromCoord(
1200 const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT
* pIn
,
1201 ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT
* pOut
);
1206 ****************************************************************************************************
1207 * ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
1210 * Input structure for AddrComputeCmaskCoordFromAddr
1211 ****************************************************************************************************
1213 typedef struct _ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
1215 UINT_32 size
; ///< Size of this structure in bytes
1217 UINT_64 addr
; ///< CMASK address in bytes
1218 UINT_32 bitPosition
; ///< Bit position within addr, 0-7. CMASK is 4 bpp,
1219 /// so the address may be located in bit 0 (0) or 4 (4)
1220 UINT_32 pitch
; ///< Pitch, in pixels
1221 UINT_32 height
; ///< Height in pixels
1222 UINT_32 numSlices
; ///< Number of slices
1223 BOOL_32 isLinear
; ///< Linear or tiled layout, Only SI can be linear
1224 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
1226 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1227 /// while the global useTileIndex is set to 1
1228 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1229 ///< README: When tileIndex is not -1, this must be valid
1230 } ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
;
1233 ****************************************************************************************************
1234 * ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
1237 * Output structure for AddrComputeCmaskCoordFromAddr
1238 ****************************************************************************************************
1240 typedef struct _ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
1242 UINT_32 size
; ///< Size of this structure in bytes
1244 UINT_32 x
; ///< X coordinate
1245 UINT_32 y
; ///< Y coordinate
1246 UINT_32 slice
; ///< Slice index
1247 } ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
;
1250 ****************************************************************************************************
1251 * AddrComputeCmaskCoordFromAddr
1254 * Compute coordinates within color buffer (1st pixel of a micro tile) according to
1256 ****************************************************************************************************
1258 ADDR_E_RETURNCODE ADDR_API
AddrComputeCmaskCoordFromAddr(
1260 const ADDR_COMPUTE_CMASK_COORDFROMADDR_INPUT
* pIn
,
1261 ADDR_COMPUTE_CMASK_COORDFROMADDR_OUTPUT
* pOut
);
1265 ////////////////////////////////////////////////////////////////////////////////////////////////////
1267 ////////////////////////////////////////////////////////////////////////////////////////////////////
1270 ****************************************************************************************************
1271 * ADDR_COMPUTE_FMASK_INFO_INPUT
1274 * Input structure for AddrComputeFmaskInfo
1275 ****************************************************************************************************
1277 typedef struct _ADDR_COMPUTE_FMASK_INFO_INPUT
1279 UINT_32 size
; ///< Size of this structure in bytes
1281 AddrTileMode tileMode
; ///< Tile mode
1282 UINT_32 pitch
; ///< Surface pitch, in pixels
1283 UINT_32 height
; ///< Surface height, in pixels
1284 UINT_32 numSlices
; ///< Number of slice/depth
1285 UINT_32 numSamples
; ///< Number of samples
1286 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
1287 /// number of samples for normal AA; Set it to the
1288 /// number of fragments for EQAA
1289 /// r800 and later HWL parameters
1292 UINT_32 resolved
: 1; ///< TRUE if the surface is for resolved fmask, only used
1293 /// by H/W clients. S/W should always set it to FALSE.
1294 UINT_32 reserved
: 31; ///< Reserved for future use.
1296 ADDR_TILEINFO
* pTileInfo
; ///< 2D tiling parameters. Clients must give valid data
1297 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1298 /// while the global useTileIndex is set to 1
1299 } ADDR_COMPUTE_FMASK_INFO_INPUT
;
1302 ****************************************************************************************************
1303 * ADDR_COMPUTE_FMASK_INFO_OUTPUT
1306 * Output structure for AddrComputeFmaskInfo
1307 ****************************************************************************************************
1309 typedef struct _ADDR_COMPUTE_FMASK_INFO_OUTPUT
1311 UINT_32 size
; ///< Size of this structure in bytes
1313 UINT_32 pitch
; ///< Pitch of fmask in pixels
1314 UINT_32 height
; ///< Height of fmask in pixels
1315 UINT_32 numSlices
; ///< Slices of fmask
1316 UINT_64 fmaskBytes
; ///< Size of fmask in bytes
1317 UINT_32 baseAlign
; ///< Base address alignment
1318 UINT_32 pitchAlign
; ///< Pitch alignment
1319 UINT_32 heightAlign
; ///< Height alignment
1320 UINT_32 bpp
; ///< Bits per pixel of FMASK is: number of bit planes
1321 UINT_32 numSamples
; ///< Number of samples, used for dump, export this since input
1322 /// may be changed in 9xx and above
1323 /// r800 and later HWL parameters
1324 ADDR_TILEINFO
* pTileInfo
; ///< Tile parameters used. Fmask can have different
1325 /// bank_height from color buffer
1326 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1327 /// while the global useTileIndex is set to 1
1328 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1329 UINT_64 sliceSize
; ///< Size of slice in bytes
1330 } ADDR_COMPUTE_FMASK_INFO_OUTPUT
;
1333 ****************************************************************************************************
1334 * AddrComputeFmaskInfo
1337 * Compute Fmask pitch/height/depth/alignments and size in bytes
1338 ****************************************************************************************************
1340 ADDR_E_RETURNCODE ADDR_API
AddrComputeFmaskInfo(
1342 const ADDR_COMPUTE_FMASK_INFO_INPUT
* pIn
,
1343 ADDR_COMPUTE_FMASK_INFO_OUTPUT
* pOut
);
1348 ****************************************************************************************************
1349 * ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
1352 * Input structure for AddrComputeFmaskAddrFromCoord
1353 ****************************************************************************************************
1355 typedef struct _ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
1357 UINT_32 size
; ///< Size of this structure in bytes
1359 UINT_32 x
; ///< X coordinate
1360 UINT_32 y
; ///< Y coordinate
1361 UINT_32 slice
; ///< Slice index
1362 UINT_32 plane
; ///< Plane number
1363 UINT_32 sample
; ///< Sample index (fragment index for EQAA)
1365 UINT_32 pitch
; ///< Surface pitch, in pixels
1366 UINT_32 height
; ///< Surface height, in pixels
1367 UINT_32 numSamples
; ///< Number of samples
1368 UINT_32 numFrags
; ///< Number of fragments, leave it zero or the same as
1369 /// number of samples for normal AA; Set it to the
1370 /// number of fragments for EQAA
1372 AddrTileMode tileMode
; ///< Tile mode
1377 UINT_32 bankSwizzle
; ///< Bank swizzle
1378 UINT_32 pipeSwizzle
; ///< Pipe swizzle
1380 UINT_32 tileSwizzle
; ///< Combined swizzle, if useCombinedSwizzle is TRUE
1383 /// r800 and later HWL parameters
1386 UINT_32 resolved
: 1; ///< TRUE if this is a resolved fmask, used by H/W clients
1387 UINT_32 ignoreSE
: 1; ///< TRUE if shader engines are ignored.
1388 UINT_32 reserved
: 30; ///< Reserved for future use.
1390 ADDR_TILEINFO
* pTileInfo
; ///< 2D tiling parameters. Client must provide all data
1392 } ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
;
1395 ****************************************************************************************************
1396 * ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
1399 * Output structure for AddrComputeFmaskAddrFromCoord
1400 ****************************************************************************************************
1402 typedef struct _ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
1404 UINT_32 size
; ///< Size of this structure in bytes
1406 UINT_64 addr
; ///< Fmask address
1407 UINT_32 bitPosition
; ///< Bit position within fmaskAddr, 0-7.
1408 } ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
;
1411 ****************************************************************************************************
1412 * AddrComputeFmaskAddrFromCoord
1415 * Compute Fmask address according to coordinates (x,y,slice,sample,plane)
1416 ****************************************************************************************************
1418 ADDR_E_RETURNCODE ADDR_API
AddrComputeFmaskAddrFromCoord(
1420 const ADDR_COMPUTE_FMASK_ADDRFROMCOORD_INPUT
* pIn
,
1421 ADDR_COMPUTE_FMASK_ADDRFROMCOORD_OUTPUT
* pOut
);
1426 ****************************************************************************************************
1427 * ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
1430 * Input structure for AddrComputeFmaskCoordFromAddr
1431 ****************************************************************************************************
1433 typedef struct _ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
1435 UINT_32 size
; ///< Size of this structure in bytes
1437 UINT_64 addr
; ///< Address
1438 UINT_32 bitPosition
; ///< Bit position within addr, 0-7.
1440 UINT_32 pitch
; ///< Pitch, in pixels
1441 UINT_32 height
; ///< Height in pixels
1442 UINT_32 numSamples
; ///< Number of samples
1443 UINT_32 numFrags
; ///< Number of fragments
1444 AddrTileMode tileMode
; ///< Tile mode
1449 UINT_32 bankSwizzle
; ///< Bank swizzle
1450 UINT_32 pipeSwizzle
; ///< Pipe swizzle
1452 UINT_32 tileSwizzle
; ///< Combined swizzle, if useCombinedSwizzle is TRUE
1455 /// r800 and later HWL parameters
1458 UINT_32 resolved
: 1; ///< TRUE if this is a resolved fmask, used by HW components
1459 UINT_32 ignoreSE
: 1; ///< TRUE if shader engines are ignored.
1460 UINT_32 reserved
: 30; ///< Reserved for future use.
1462 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
1464 } ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
;
1467 ****************************************************************************************************
1468 * ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
1471 * Output structure for AddrComputeFmaskCoordFromAddr
1472 ****************************************************************************************************
1474 typedef struct _ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
1476 UINT_32 size
; ///< Size of this structure in bytes
1478 UINT_32 x
; ///< X coordinate
1479 UINT_32 y
; ///< Y coordinate
1480 UINT_32 slice
; ///< Slice index
1481 UINT_32 plane
; ///< Plane number
1482 UINT_32 sample
; ///< Sample index (fragment index for EQAA)
1483 } ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
;
1486 ****************************************************************************************************
1487 * AddrComputeFmaskCoordFromAddr
1490 * Compute FMASK coordinate from an given address
1491 ****************************************************************************************************
1493 ADDR_E_RETURNCODE ADDR_API
AddrComputeFmaskCoordFromAddr(
1495 const ADDR_COMPUTE_FMASK_COORDFROMADDR_INPUT
* pIn
,
1496 ADDR_COMPUTE_FMASK_COORDFROMADDR_OUTPUT
* pOut
);
1500 ////////////////////////////////////////////////////////////////////////////////////////////////////
1501 // Element/utility functions
1502 ////////////////////////////////////////////////////////////////////////////////////////////////////
1505 ****************************************************************************************************
1509 * Get AddrLib version number
1510 ****************************************************************************************************
1512 UINT_32 ADDR_API
AddrGetVersion(ADDR_HANDLE hLib
);
1515 ****************************************************************************************************
1519 * Return TRUE if tileIndex is enabled in this address library
1520 ****************************************************************************************************
1522 BOOL_32 ADDR_API
AddrUseTileIndex(ADDR_HANDLE hLib
);
1525 ****************************************************************************************************
1526 * AddrUseCombinedSwizzle
1529 * Return TRUE if combined swizzle is enabled in this address library
1530 ****************************************************************************************************
1532 BOOL_32 ADDR_API
AddrUseCombinedSwizzle(ADDR_HANDLE hLib
);
1535 ****************************************************************************************************
1536 * ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
1539 * Input structure of AddrExtractBankPipeSwizzle
1540 ****************************************************************************************************
1542 typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
1544 UINT_32 size
; ///< Size of this structure in bytes
1546 UINT_32 base256b
; ///< Base256b value
1548 /// r800 and later HWL parameters
1549 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
1551 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1552 /// while the global useTileIndex is set to 1
1553 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1554 ///< README: When tileIndex is not -1, this must be valid
1555 } ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
;
1558 ****************************************************************************************************
1559 * ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
1562 * Output structure of AddrExtractBankPipeSwizzle
1563 ****************************************************************************************************
1565 typedef struct _ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
1567 UINT_32 size
; ///< Size of this structure in bytes
1569 UINT_32 bankSwizzle
; ///< Bank swizzle
1570 UINT_32 pipeSwizzle
; ///< Pipe swizzle
1571 } ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
;
1574 ****************************************************************************************************
1575 * AddrExtractBankPipeSwizzle
1578 * Extract Bank and Pipe swizzle from base256b
1580 * ADDR_OK if no error
1581 ****************************************************************************************************
1583 ADDR_E_RETURNCODE ADDR_API
AddrExtractBankPipeSwizzle(
1585 const ADDR_EXTRACT_BANKPIPE_SWIZZLE_INPUT
* pIn
,
1586 ADDR_EXTRACT_BANKPIPE_SWIZZLE_OUTPUT
* pOut
);
1590 ****************************************************************************************************
1591 * ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
1594 * Input structure of AddrCombineBankPipeSwizzle
1595 ****************************************************************************************************
1597 typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
1599 UINT_32 size
; ///< Size of this structure in bytes
1601 UINT_32 bankSwizzle
; ///< Bank swizzle
1602 UINT_32 pipeSwizzle
; ///< Pipe swizzle
1603 UINT_64 baseAddr
; ///< Base address (leave it zero for driver clients)
1605 /// r800 and later HWL parameters
1606 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Client must provide all data
1608 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1609 /// while the global useTileIndex is set to 1
1610 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1611 ///< README: When tileIndex is not -1, this must be valid
1612 } ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
;
1615 ****************************************************************************************************
1616 * ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
1619 * Output structure of AddrCombineBankPipeSwizzle
1620 ****************************************************************************************************
1622 typedef struct _ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
1624 UINT_32 size
; ///< Size of this structure in bytes
1626 UINT_32 tileSwizzle
; ///< Combined swizzle
1627 } ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
;
1630 ****************************************************************************************************
1631 * AddrCombineBankPipeSwizzle
1634 * Combine Bank and Pipe swizzle
1636 * ADDR_OK if no error
1638 * baseAddr here is full MCAddress instead of base256b
1639 ****************************************************************************************************
1641 ADDR_E_RETURNCODE ADDR_API
AddrCombineBankPipeSwizzle(
1643 const ADDR_COMBINE_BANKPIPE_SWIZZLE_INPUT
* pIn
,
1644 ADDR_COMBINE_BANKPIPE_SWIZZLE_OUTPUT
* pOut
);
1649 ****************************************************************************************************
1650 * ADDR_COMPUTE_SLICESWIZZLE_INPUT
1653 * Input structure of AddrComputeSliceSwizzle
1654 ****************************************************************************************************
1656 typedef struct _ADDR_COMPUTE_SLICESWIZZLE_INPUT
1658 UINT_32 size
; ///< Size of this structure in bytes
1660 AddrTileMode tileMode
; ///< Tile Mode
1661 UINT_32 baseSwizzle
; ///< Base tile swizzle
1662 UINT_32 slice
; ///< Slice index
1663 UINT_64 baseAddr
; ///< Base address, driver should leave it 0 in most cases
1665 /// r800 and later HWL parameters
1666 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Actually banks needed here!
1668 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1669 /// while the global useTileIndex is set to 1
1670 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1671 ///< README: When tileIndex is not -1, this must be valid
1672 } ADDR_COMPUTE_SLICESWIZZLE_INPUT
;
1677 ****************************************************************************************************
1678 * ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
1681 * Output structure of AddrComputeSliceSwizzle
1682 ****************************************************************************************************
1684 typedef struct _ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
1686 UINT_32 size
; ///< Size of this structure in bytes
1688 UINT_32 tileSwizzle
; ///< Recalculated tileSwizzle value
1689 } ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
;
1692 ****************************************************************************************************
1693 * AddrComputeSliceSwizzle
1696 * Extract Bank and Pipe swizzle from base256b
1698 * ADDR_OK if no error
1699 ****************************************************************************************************
1701 ADDR_E_RETURNCODE ADDR_API
AddrComputeSliceSwizzle(
1703 const ADDR_COMPUTE_SLICESWIZZLE_INPUT
* pIn
,
1704 ADDR_COMPUTE_SLICESWIZZLE_OUTPUT
* pOut
);
1708 ****************************************************************************************************
1709 * AddrSwizzleGenOption
1712 * Which swizzle generating options: legacy or linear
1713 ****************************************************************************************************
1715 typedef enum _AddrSwizzleGenOption
1717 ADDR_SWIZZLE_GEN_DEFAULT
= 0, ///< As is in client driver implemention for swizzle
1718 ADDR_SWIZZLE_GEN_LINEAR
= 1, ///< Using a linear increment of swizzle
1719 } AddrSwizzleGenOption
;
1722 ****************************************************************************************************
1726 * Controls how swizzle is generated
1727 ****************************************************************************************************
1729 typedef union _ADDR_SWIZZLE_OPTION
1733 UINT_32 genOption
: 1; ///< The way swizzle is generated, see AddrSwizzleGenOption
1734 UINT_32 reduceBankBit
: 1; ///< TRUE if we need reduce swizzle bits
1735 UINT_32 reserved
:30; ///< Reserved bits
1740 } ADDR_SWIZZLE_OPTION
;
1743 ****************************************************************************************************
1744 * ADDR_COMPUTE_BASE_SWIZZLE_INPUT
1747 * Input structure of AddrComputeBaseSwizzle
1748 ****************************************************************************************************
1750 typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_INPUT
1752 UINT_32 size
; ///< Size of this structure in bytes
1754 ADDR_SWIZZLE_OPTION option
; ///< Swizzle option
1755 UINT_32 surfIndex
; ///< Index of this surface type
1756 AddrTileMode tileMode
; ///< Tile Mode
1758 /// r800 and later HWL parameters
1759 ADDR_TILEINFO
* pTileInfo
; ///< 2D tile parameters. Actually banks needed here!
1761 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1762 /// while the global useTileIndex is set to 1
1763 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1764 ///< README: When tileIndex is not -1, this must be valid
1765 } ADDR_COMPUTE_BASE_SWIZZLE_INPUT
;
1768 ****************************************************************************************************
1769 * ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
1772 * Output structure of AddrComputeBaseSwizzle
1773 ****************************************************************************************************
1775 typedef struct _ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
1777 UINT_32 size
; ///< Size of this structure in bytes
1779 UINT_32 tileSwizzle
; ///< Combined swizzle
1780 } ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
;
1783 ****************************************************************************************************
1784 * AddrComputeBaseSwizzle
1787 * Return a Combined Bank and Pipe swizzle base on surface based on surface type/index
1789 * ADDR_OK if no error
1790 ****************************************************************************************************
1792 ADDR_E_RETURNCODE ADDR_API
AddrComputeBaseSwizzle(
1794 const ADDR_COMPUTE_BASE_SWIZZLE_INPUT
* pIn
,
1795 ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT
* pOut
);
1800 ****************************************************************************************************
1801 * ELEM_GETEXPORTNORM_INPUT
1804 * Input structure for ElemGetExportNorm
1806 ****************************************************************************************************
1808 typedef struct _ELEM_GETEXPORTNORM_INPUT
1810 UINT_32 size
; ///< Size of this structure in bytes
1812 AddrColorFormat format
; ///< Color buffer format; Client should use ColorFormat
1813 AddrSurfaceNumber num
; ///< Surface number type; Client should use NumberType
1814 AddrSurfaceSwap swap
; ///< Surface swap byte swap; Client should use SurfaceSwap
1815 UINT_32 numSamples
; ///< Number of samples
1816 } ELEM_GETEXPORTNORM_INPUT
;
1819 ****************************************************************************************************
1823 * Helper function to check one format can be EXPORT_NUM, which is a register
1824 * CB_COLOR_INFO.SURFACE_FORMAT. FP16 can be reported as EXPORT_NORM for rv770 in r600
1827 * The implementation is only for r600.
1828 * 00 - EXPORT_FULL: PS exports are 4 pixels with 4 components with 32-bits-per-component. (two
1829 * clocks per export)
1830 * 01 - EXPORT_NORM: PS exports are 4 pixels with 4 components with 16-bits-per-component. (one
1833 ****************************************************************************************************
1835 BOOL_32 ADDR_API
ElemGetExportNorm(
1837 const ELEM_GETEXPORTNORM_INPUT
* pIn
);
1842 ****************************************************************************************************
1843 * ELEM_FLT32TODEPTHPIXEL_INPUT
1846 * Input structure for addrFlt32ToDepthPixel
1848 ****************************************************************************************************
1850 typedef struct _ELEM_FLT32TODEPTHPIXEL_INPUT
1852 UINT_32 size
; ///< Size of this structure in bytes
1854 AddrDepthFormat format
; ///< Depth buffer format
1855 ADDR_FLT_32 comps
[2]; ///< Component values (Z/stencil)
1856 } ELEM_FLT32TODEPTHPIXEL_INPUT
;
1859 ****************************************************************************************************
1860 * ELEM_FLT32TODEPTHPIXEL_INPUT
1863 * Output structure for ElemFlt32ToDepthPixel
1865 ****************************************************************************************************
1867 typedef struct _ELEM_FLT32TODEPTHPIXEL_OUTPUT
1869 UINT_32 size
; ///< Size of this structure in bytes
1871 UINT_8
* pPixel
; ///< Real depth value. Same data type as depth buffer.
1872 /// Client must provide enough storage for this type.
1873 UINT_32 depthBase
; ///< Tile base in bits for depth bits
1874 UINT_32 stencilBase
; ///< Tile base in bits for stencil bits
1875 UINT_32 depthBits
; ///< Bits for depth
1876 UINT_32 stencilBits
; ///< Bits for stencil
1877 } ELEM_FLT32TODEPTHPIXEL_OUTPUT
;
1880 ****************************************************************************************************
1881 * ElemFlt32ToDepthPixel
1884 * Convert a FLT_32 value to a depth/stencil pixel value
1889 ****************************************************************************************************
1891 ADDR_E_RETURNCODE ADDR_API
ElemFlt32ToDepthPixel(
1893 const ELEM_FLT32TODEPTHPIXEL_INPUT
* pIn
,
1894 ELEM_FLT32TODEPTHPIXEL_OUTPUT
* pOut
);
1899 ****************************************************************************************************
1900 * ELEM_FLT32TOCOLORPIXEL_INPUT
1903 * Input structure for addrFlt32ToColorPixel
1905 ****************************************************************************************************
1907 typedef struct _ELEM_FLT32TOCOLORPIXEL_INPUT
1909 UINT_32 size
; ///< Size of this structure in bytes
1911 AddrColorFormat format
; ///< Color buffer format
1912 AddrSurfaceNumber surfNum
; ///< Surface number
1913 AddrSurfaceSwap surfSwap
; ///< Surface swap
1914 ADDR_FLT_32 comps
[4]; ///< Component values (r/g/b/a)
1915 } ELEM_FLT32TOCOLORPIXEL_INPUT
;
1918 ****************************************************************************************************
1919 * ELEM_FLT32TOCOLORPIXEL_INPUT
1922 * Output structure for ElemFlt32ToColorPixel
1924 ****************************************************************************************************
1926 typedef struct _ELEM_FLT32TOCOLORPIXEL_OUTPUT
1928 UINT_32 size
; ///< Size of this structure in bytes
1930 UINT_8
* pPixel
; ///< Real color value. Same data type as color buffer.
1931 /// Client must provide enough storage for this type.
1932 } ELEM_FLT32TOCOLORPIXEL_OUTPUT
;
1935 ****************************************************************************************************
1936 * ElemFlt32ToColorPixel
1939 * Convert a FLT_32 value to a red/green/blue/alpha pixel value
1944 ****************************************************************************************************
1946 ADDR_E_RETURNCODE ADDR_API
ElemFlt32ToColorPixel(
1948 const ELEM_FLT32TOCOLORPIXEL_INPUT
* pIn
,
1949 ELEM_FLT32TOCOLORPIXEL_OUTPUT
* pOut
);
1953 ****************************************************************************************************
1954 * ADDR_CONVERT_TILEINFOTOHW_INPUT
1957 * Input structure for AddrConvertTileInfoToHW
1959 * When reverse is TRUE, indices are igonred
1960 ****************************************************************************************************
1962 typedef struct _ADDR_CONVERT_TILEINFOTOHW_INPUT
1964 UINT_32 size
; ///< Size of this structure in bytes
1965 BOOL_32 reverse
; ///< Convert control flag.
1966 /// FALSE: convert from real value to HW value;
1967 /// TRUE: convert from HW value to real value.
1969 /// r800 and later HWL parameters
1970 ADDR_TILEINFO
* pTileInfo
; ///< Tile parameters with real value
1972 INT_32 tileIndex
; ///< Tile index, MUST be -1 if you don't want to use it
1973 /// while the global useTileIndex is set to 1
1974 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
1975 ///< README: When tileIndex is not -1, this must be valid
1976 UINT_32 bpp
; ///< Bits per pixel
1977 } ADDR_CONVERT_TILEINFOTOHW_INPUT
;
1980 ****************************************************************************************************
1981 * ADDR_CONVERT_TILEINFOTOHW_OUTPUT
1984 * Output structure for AddrConvertTileInfoToHW
1985 ****************************************************************************************************
1987 typedef struct _ADDR_CONVERT_TILEINFOTOHW_OUTPUT
1989 UINT_32 size
; ///< Size of this structure in bytes
1991 /// r800 and later HWL parameters
1992 ADDR_TILEINFO
* pTileInfo
; ///< Tile parameters with hardware register value
1994 } ADDR_CONVERT_TILEINFOTOHW_OUTPUT
;
1997 ****************************************************************************************************
1998 * AddrConvertTileInfoToHW
2001 * Convert tile info from real value to hardware register value
2002 ****************************************************************************************************
2004 ADDR_E_RETURNCODE ADDR_API
AddrConvertTileInfoToHW(
2006 const ADDR_CONVERT_TILEINFOTOHW_INPUT
* pIn
,
2007 ADDR_CONVERT_TILEINFOTOHW_OUTPUT
* pOut
);
2012 ****************************************************************************************************
2013 * ADDR_CONVERT_TILEINDEX_INPUT
2016 * Input structure for AddrConvertTileIndex
2017 ****************************************************************************************************
2019 typedef struct _ADDR_CONVERT_TILEINDEX_INPUT
2021 UINT_32 size
; ///< Size of this structure in bytes
2023 INT_32 tileIndex
; ///< Tile index
2024 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
2025 UINT_32 bpp
; ///< Bits per pixel
2026 BOOL_32 tileInfoHw
; ///< Set to TRUE if client wants HW enum, otherwise actual
2027 } ADDR_CONVERT_TILEINDEX_INPUT
;
2030 ****************************************************************************************************
2031 * ADDR_CONVERT_TILEINDEX_OUTPUT
2034 * Output structure for AddrConvertTileIndex
2035 ****************************************************************************************************
2037 typedef struct _ADDR_CONVERT_TILEINDEX_OUTPUT
2039 UINT_32 size
; ///< Size of this structure in bytes
2041 AddrTileMode tileMode
; ///< Tile mode
2042 AddrTileType tileType
; ///< Tile type
2043 ADDR_TILEINFO
* pTileInfo
; ///< Tile info
2045 } ADDR_CONVERT_TILEINDEX_OUTPUT
;
2048 ****************************************************************************************************
2049 * AddrConvertTileIndex
2052 * Convert tile index to tile mode/type/info
2053 ****************************************************************************************************
2055 ADDR_E_RETURNCODE ADDR_API
AddrConvertTileIndex(
2057 const ADDR_CONVERT_TILEINDEX_INPUT
* pIn
,
2058 ADDR_CONVERT_TILEINDEX_OUTPUT
* pOut
);
2061 ****************************************************************************************************
2062 * ADDR_GET_MACROMODEINDEX_INPUT
2065 * Input structure for AddrGetMacroModeIndex
2066 ****************************************************************************************************
2068 typedef struct _ADDR_GET_MACROMODEINDEX_INPUT
2070 UINT_32 size
; ///< Size of this structure in bytes
2071 ADDR_SURFACE_FLAGS flags
; ///< Surface flag
2072 INT_32 tileIndex
; ///< Tile index
2073 UINT_32 bpp
; ///< Bits per pixel
2074 UINT_32 numFrags
; ///< Number of color fragments
2075 } ADDR_GET_MACROMODEINDEX_INPUT
;
2078 ****************************************************************************************************
2079 * ADDR_GET_MACROMODEINDEX_OUTPUT
2082 * Output structure for AddrGetMacroModeIndex
2083 ****************************************************************************************************
2085 typedef struct _ADDR_GET_MACROMODEINDEX_OUTPUT
2087 UINT_32 size
; ///< Size of this structure in bytes
2088 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
2089 } ADDR_GET_MACROMODEINDEX_OUTPUT
;
2092 ****************************************************************************************************
2093 * AddrGetMacroModeIndex
2096 * Get macro mode index based on input parameters
2097 ****************************************************************************************************
2099 ADDR_E_RETURNCODE ADDR_API
AddrGetMacroModeIndex(
2101 const ADDR_GET_MACROMODEINDEX_INPUT
* pIn
,
2102 ADDR_GET_MACROMODEINDEX_OUTPUT
* pOut
);
2105 ****************************************************************************************************
2106 * ADDR_CONVERT_TILEINDEX1_INPUT
2109 * Input structure for AddrConvertTileIndex1 (without macro mode index)
2110 ****************************************************************************************************
2112 typedef struct _ADDR_CONVERT_TILEINDEX1_INPUT
2114 UINT_32 size
; ///< Size of this structure in bytes
2116 INT_32 tileIndex
; ///< Tile index
2117 UINT_32 bpp
; ///< Bits per pixel
2118 UINT_32 numSamples
; ///< Number of samples
2119 BOOL_32 tileInfoHw
; ///< Set to TRUE if client wants HW enum, otherwise actual
2120 } ADDR_CONVERT_TILEINDEX1_INPUT
;
2123 ****************************************************************************************************
2124 * AddrConvertTileIndex1
2127 * Convert tile index to tile mode/type/info
2128 ****************************************************************************************************
2130 ADDR_E_RETURNCODE ADDR_API
AddrConvertTileIndex1(
2132 const ADDR_CONVERT_TILEINDEX1_INPUT
* pIn
,
2133 ADDR_CONVERT_TILEINDEX_OUTPUT
* pOut
);
2138 ****************************************************************************************************
2139 * ADDR_GET_TILEINDEX_INPUT
2142 * Input structure for AddrGetTileIndex
2143 ****************************************************************************************************
2145 typedef struct _ADDR_GET_TILEINDEX_INPUT
2147 UINT_32 size
; ///< Size of this structure in bytes
2149 AddrTileMode tileMode
; ///< Tile mode
2150 AddrTileType tileType
; ///< Tile-type: disp/non-disp/...
2151 ADDR_TILEINFO
* pTileInfo
; ///< Pointer to tile-info structure, can be NULL for linear/1D
2152 } ADDR_GET_TILEINDEX_INPUT
;
2155 ****************************************************************************************************
2156 * ADDR_GET_TILEINDEX_OUTPUT
2159 * Output structure for AddrGetTileIndex
2160 ****************************************************************************************************
2162 typedef struct _ADDR_GET_TILEINDEX_OUTPUT
2164 UINT_32 size
; ///< Size of this structure in bytes
2166 INT_32 index
; ///< index in table
2167 } ADDR_GET_TILEINDEX_OUTPUT
;
2170 ****************************************************************************************************
2174 * Get the tiling mode index in table
2175 ****************************************************************************************************
2177 ADDR_E_RETURNCODE ADDR_API
AddrGetTileIndex(
2179 const ADDR_GET_TILEINDEX_INPUT
* pIn
,
2180 ADDR_GET_TILEINDEX_OUTPUT
* pOut
);
2186 ****************************************************************************************************
2187 * ADDR_PRT_INFO_INPUT
2190 * Input structure for AddrComputePrtInfo
2191 ****************************************************************************************************
2193 typedef struct _ADDR_PRT_INFO_INPUT
2195 AddrFormat format
; ///< Surface format
2196 UINT_32 baseMipWidth
; ///< Base mipmap width
2197 UINT_32 baseMipHeight
; ///< Base mipmap height
2198 UINT_32 baseMipDepth
; ///< Base mipmap depth
2199 UINT_32 numFrags
; ///< Number of fragments,
2200 } ADDR_PRT_INFO_INPUT
;
2203 ****************************************************************************************************
2204 * ADDR_PRT_INFO_OUTPUT
2207 * Input structure for AddrComputePrtInfo
2208 ****************************************************************************************************
2210 typedef struct _ADDR_PRT_INFO_OUTPUT
2212 UINT_32 prtTileWidth
;
2213 UINT_32 prtTileHeight
;
2214 } ADDR_PRT_INFO_OUTPUT
;
2217 ****************************************************************************************************
2218 * AddrComputePrtInfo
2221 * Compute prt surface related information
2222 ****************************************************************************************************
2224 ADDR_E_RETURNCODE ADDR_API
AddrComputePrtInfo(
2226 const ADDR_PRT_INFO_INPUT
* pIn
,
2227 ADDR_PRT_INFO_OUTPUT
* pOut
);
2229 ////////////////////////////////////////////////////////////////////////////////////////////////////
2230 // DCC key functions
2231 ////////////////////////////////////////////////////////////////////////////////////////////////////
2234 ****************************************************************************************************
2235 * _ADDR_COMPUTE_DCCINFO_INPUT
2238 * Input structure of AddrComputeDccInfo
2239 ****************************************************************************************************
2241 typedef struct _ADDR_COMPUTE_DCCINFO_INPUT
2243 UINT_32 size
; ///< Size of this structure in bytes
2244 UINT_32 bpp
; ///< BitPP of color surface
2245 UINT_32 numSamples
; ///< Sample number of color surface
2246 UINT_64 colorSurfSize
; ///< Size of color surface to which dcc key is bound
2247 AddrTileMode tileMode
; ///< Tile mode of color surface
2248 ADDR_TILEINFO tileInfo
; ///< Tile info of color surface
2249 UINT_32 tileSwizzle
; ///< Tile swizzle
2250 INT_32 tileIndex
; ///< Tile index of color surface,
2251 ///< MUST be -1 if you don't want to use it
2252 ///< while the global useTileIndex is set to 1
2253 INT_32 macroModeIndex
; ///< Index in macro tile mode table if there is one (CI)
2254 ///< README: When tileIndex is not -1, this must be valid
2255 } ADDR_COMPUTE_DCCINFO_INPUT
;
2258 ****************************************************************************************************
2259 * ADDR_COMPUTE_DCCINFO_OUTPUT
2262 * Output structure of AddrComputeDccInfo
2263 ****************************************************************************************************
2265 typedef struct _ADDR_COMPUTE_DCCINFO_OUTPUT
2267 UINT_32 size
; ///< Size of this structure in bytes
2268 UINT_64 dccRamBaseAlign
; ///< Base alignment of dcc key
2269 UINT_64 dccRamSize
; ///< Size of dcc key
2270 UINT_64 dccFastClearSize
; ///< Size of dcc key portion that can be fast cleared
2271 BOOL_32 subLvlCompressible
; ///< Whether sub resource is compressiable
2272 BOOL_32 dccRamSizeAligned
; ///< Whether the dcc key size is aligned
2273 } ADDR_COMPUTE_DCCINFO_OUTPUT
;
2276 ****************************************************************************************************
2277 * AddrComputeDccInfo
2280 * Compute DCC key size, base alignment
2282 ****************************************************************************************************
2284 ADDR_E_RETURNCODE ADDR_API
AddrComputeDccInfo(
2286 const ADDR_COMPUTE_DCCINFO_INPUT
* pIn
,
2287 ADDR_COMPUTE_DCCINFO_OUTPUT
* pOut
);
2290 ****************************************************************************************************
2291 * ADDR_GET_MAX_ALINGMENTS_OUTPUT
2294 * Output structure of AddrGetMaxAlignments
2295 ****************************************************************************************************
2297 typedef struct _ADDR_GET_MAX_ALINGMENTS_OUTPUT
2299 UINT_32 size
; ///< Size of this structure in bytes
2300 UINT_64 baseAlign
; ///< Maximum base alignment in bytes
2301 } ADDR_GET_MAX_ALINGMENTS_OUTPUT
;
2304 ****************************************************************************************************
2305 * AddrGetMaxAlignments
2308 * Gets maximnum alignments
2309 ****************************************************************************************************
2311 ADDR_E_RETURNCODE ADDR_API
AddrGetMaxAlignments(
2313 ADDR_GET_MAX_ALINGMENTS_OUTPUT
* pOut
);
2315 #if defined(__cplusplus)
2319 #endif // __ADDR_INTERFACE_H__