"Fossies" - the Fresh Open Source Software Archive

Member "mesa-20.1.8/src/amd/addrlib/src/r800/ciaddrlib.h" (16 Sep 2020, 7773 Bytes) of package /linux/misc/mesa-20.1.8.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ciaddrlib.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright © 2007-2019 Advanced Micro Devices, Inc.
    3  * All Rights Reserved.
    4  *
    5  * Permission is hereby granted, free of charge, to any person obtaining
    6  * a copy of this software and associated documentation files (the
    7  * "Software"), to deal in the Software without restriction, including
    8  * without limitation the rights to use, copy, modify, merge, publish,
    9  * distribute, sub license, and/or sell copies of the Software, and to
   10  * permit persons to whom the Software is furnished to do so, subject to
   11  * the following conditions:
   12  *
   13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   14  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
   15  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
   16  * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS
   17  * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
   20  * USE OR OTHER DEALINGS IN THE SOFTWARE.
   21  *
   22  * The above copyright notice and this permission notice (including the
   23  * next paragraph) shall be included in all copies or substantial portions
   24  * of the Software.
   25  */
   26 
   27 /**
   28 ****************************************************************************************************
   29 * @file  ciaddrlib.h
   30 * @brief Contains the CiLib class definition.
   31 ****************************************************************************************************
   32 */
   33 
   34 #ifndef __CI_ADDR_LIB_H__
   35 #define __CI_ADDR_LIB_H__
   36 
   37 #include "addrlib1.h"
   38 #include "siaddrlib.h"
   39 
   40 namespace Addr
   41 {
   42 namespace V1
   43 {
   44 
   45 /**
   46 ****************************************************************************************************
   47 * @brief This class is the CI specific address library
   48 *        function set.
   49 ****************************************************************************************************
   50 */
   51 class CiLib : public SiLib
   52 {
   53 public:
   54     /// Creates CiLib object
   55     static Addr::Lib* CreateObj(const Client* pClient)
   56     {
   57         VOID* pMem = Object::ClientAlloc(sizeof(CiLib), pClient);
   58         return (pMem != NULL) ? new (pMem) CiLib(pClient) : NULL;
   59     }
   60 
   61 private:
   62     CiLib(const Client* pClient);
   63     virtual ~CiLib();
   64 
   65 protected:
   66 
   67     // Hwl interface - defined in AddrLib1
   68     virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
   69         const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
   70         ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
   71 
   72     virtual ADDR_E_RETURNCODE HwlComputeFmaskInfo(
   73         const ADDR_COMPUTE_FMASK_INFO_INPUT* pIn,
   74         ADDR_COMPUTE_FMASK_INFO_OUTPUT* pOut);
   75 
   76     virtual ChipFamily HwlConvertChipFamily(
   77         UINT_32 uChipFamily, UINT_32 uChipRevision);
   78 
   79     virtual BOOL_32 HwlInitGlobalParams(
   80         const ADDR_CREATE_INPUT* pCreateIn);
   81 
   82     virtual ADDR_E_RETURNCODE HwlSetupTileCfg(
   83         UINT_32 bpp, INT_32 index, INT_32 macroModeIndex, ADDR_TILEINFO* pInfo,
   84         AddrTileMode* pMode = 0, AddrTileType* pType = 0) const;
   85 
   86     virtual VOID HwlComputeTileDataWidthAndHeightLinear(
   87         UINT_32* pMacroWidth, UINT_32* pMacroHeight,
   88         UINT_32 bpp, ADDR_TILEINFO* pTileInfo) const;
   89 
   90     virtual INT_32 HwlComputeMacroModeIndex(
   91         INT_32 tileIndex, ADDR_SURFACE_FLAGS flags, UINT_32 bpp, UINT_32 numSamples,
   92         ADDR_TILEINFO* pTileInfo, AddrTileMode* pTileMode = NULL, AddrTileType* pTileType = NULL
   93         ) const;
   94 
   95     // Sub-hwl interface - defined in EgBasedLib
   96     virtual VOID HwlSetupTileInfo(
   97         AddrTileMode tileMode, ADDR_SURFACE_FLAGS flags,
   98         UINT_32 bpp, UINT_32 pitch, UINT_32 height, UINT_32 numSamples,
   99         ADDR_TILEINFO* inputTileInfo, ADDR_TILEINFO* outputTileInfo,
  100         AddrTileType inTileType, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
  101 
  102     virtual INT_32 HwlPostCheckTileIndex(
  103         const ADDR_TILEINFO* pInfo, AddrTileMode mode, AddrTileType type,
  104         INT curIndex = TileIndexInvalid) const;
  105 
  106     virtual VOID HwlFmaskPreThunkSurfInfo(
  107         const ADDR_COMPUTE_FMASK_INFO_INPUT* pFmaskIn,
  108         const ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut,
  109         ADDR_COMPUTE_SURFACE_INFO_INPUT* pSurfIn,
  110         ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut) const;
  111 
  112     virtual VOID HwlFmaskPostThunkSurfInfo(
  113         const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pSurfOut,
  114         ADDR_COMPUTE_FMASK_INFO_OUTPUT* pFmaskOut) const;
  115 
  116     virtual AddrTileMode HwlDegradeThickTileMode(
  117         AddrTileMode baseTileMode, UINT_32 numSlices, UINT_32* pBytesPerTile) const;
  118 
  119     virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
  120 
  121     virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
  122 
  123     virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
  124 
  125     /// Overwrite tile setting to PRT
  126     virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
  127 
  128     virtual ADDR_E_RETURNCODE HwlComputeDccInfo(
  129         const ADDR_COMPUTE_DCCINFO_INPUT* pIn,
  130         ADDR_COMPUTE_DCCINFO_OUTPUT* pOut) const;
  131 
  132     virtual ADDR_E_RETURNCODE HwlComputeCmaskAddrFromCoord(
  133         const ADDR_COMPUTE_CMASK_ADDRFROMCOORD_INPUT* pIn,
  134         ADDR_COMPUTE_CMASK_ADDRFROMCOORD_OUTPUT* pOut) const;
  135 
  136     virtual ADDR_E_RETURNCODE HwlComputeHtileAddrFromCoord(
  137         const ADDR_COMPUTE_HTILE_ADDRFROMCOORD_INPUT*  pIn,
  138         ADDR_COMPUTE_HTILE_ADDRFROMCOORD_OUTPUT*       pOut) const;
  139 
  140     virtual UINT_32 HwlComputeMaxBaseAlignments() const;
  141 
  142     virtual UINT_32 HwlComputeMaxMetaBaseAlignments() const;
  143 
  144     virtual VOID HwlPadDimensions(
  145         AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
  146         UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 mipLevel,
  147         UINT_32* pPitch, UINT_32 *PitchAlign, UINT_32 height, UINT_32 heightAlign) const;
  148 
  149     virtual VOID HwlComputeSurfaceAlignmentsMacroTiled(
  150         AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
  151         UINT_32 mipLevel, UINT_32 numSamples, ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
  152 
  153 private:
  154     VOID ReadGbTileMode(
  155         UINT_32 regValue, TileConfig* pCfg) const;
  156 
  157     VOID ReadGbMacroTileCfg(
  158         UINT_32 regValue, ADDR_TILEINFO* pCfg) const;
  159 
  160 private:
  161     BOOL_32 InitTileSettingTable(
  162         const UINT_32 *pSetting, UINT_32 noOfEntries);
  163 
  164     BOOL_32 InitMacroTileCfgTable(
  165         const UINT_32 *pSetting, UINT_32 noOfEntries);
  166 
  167     UINT_64 HwlComputeMetadataNibbleAddress(
  168         UINT_64 uncompressedDataByteAddress,
  169         UINT_64 dataBaseByteAddress,
  170         UINT_64 metadataBaseByteAddress,
  171         UINT_32 metadataBitSize,
  172         UINT_32 elementBitSize,
  173         UINT_32 blockByteSize,
  174         UINT_32 pipeInterleaveBytes,
  175         UINT_32 numOfPipes,
  176         UINT_32 numOfBanks,
  177         UINT_32 numOfSamplesPerSplit) const;
  178 
  179     BOOL_32 DepthStencilTileCfgMatch(
  180         const ADDR_COMPUTE_SURFACE_INFO_INPUT*  pIn,
  181         ADDR_COMPUTE_SURFACE_INFO_OUTPUT*       pOut) const;
  182 
  183     BOOL_32 CheckTcCompatibility(const ADDR_TILEINFO* pTileInfo, UINT_32 bpp, AddrTileMode tileMode,
  184                                  AddrTileType tileType, const ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
  185 
  186     BOOL_32 SupportDccAndTcCompatibility() const
  187     {
  188         return ((m_settings.isVolcanicIslands == TRUE) || (m_configFlags.forceDccAndTcCompat == TRUE));
  189     }
  190 
  191     static const UINT_32    MacroTileTableSize = 16;
  192     static const UINT_32    PrtMacroModeOffset = MacroTileTableSize / 2;
  193     static const INT_32     MinDepth2DThinIndex = 0;
  194     static const INT_32     MaxDepth2DThinIndex = 4;
  195     static const INT_32     Depth1DThinIndex = 5;
  196 
  197     ADDR_TILEINFO           m_macroTileTable[MacroTileTableSize];
  198     UINT_32                 m_noOfMacroEntries;
  199     BOOL_32                 m_allowNonDispThickModes;
  200 };
  201 
  202 } // V1
  203 } // Addr
  204 
  205 #endif