ac/surface/gfx9: let addrlib choose the preferred swizzle kind
[mesa.git] / src / amd / addrlib / core / addrlib1.h
index 6ca58260cc837ed794fcad1e3974d076481b712a..d6642aaaf7489275d06f17900a6e45c82ad9f99b 100644 (file)
  */
 
 /**
-***************************************************************************************************
+****************************************************************************************************
 * @file  addrlib1.h
-* @brief Contains the AddrLib1 base class definition.
-***************************************************************************************************
+* @brief Contains the Addr::V1::Lib class definition.
+****************************************************************************************************
 */
 
 #ifndef __ADDR_LIB1_H__
 
 #include "addrlib.h"
 
+namespace Addr
+{
+namespace V1
+{
 
 /**
-***************************************************************************************************
+****************************************************************************************************
 * @brief Neutral enums that define bank swap size
-***************************************************************************************************
+****************************************************************************************************
 */
-enum AddrSampleSplitSize
+enum SampleSplitSize
 {
     ADDR_SAMPLESPLIT_1KB = 1024,
     ADDR_SAMPLESPLIT_2KB = 2048,
@@ -51,11 +55,11 @@ enum AddrSampleSplitSize
 };
 
 /**
-***************************************************************************************************
+****************************************************************************************************
 * @brief Flags for AddrTileMode
-***************************************************************************************************
+****************************************************************************************************
 */
-struct AddrTileModeFlags
+struct TileModeFlags
 {
     UINT_32 thickness       : 4;
     UINT_32 isLinear        : 1;
@@ -67,17 +71,20 @@ struct AddrTileModeFlags
     UINT_32 isBankSwapped   : 1;
 };
 
+static const UINT_32 Block64K = 0x10000;
+static const UINT_32 PrtTileSize = Block64K;
+
 /**
-***************************************************************************************************
+****************************************************************************************************
 * @brief This class contains asic independent address lib functionalities
-***************************************************************************************************
+****************************************************************************************************
 */
-class AddrLib1 : public AddrLib
+class Lib : public Addr::Lib
 {
 public:
-    virtual ~AddrLib1();
+    virtual ~Lib();
 
-    static AddrLib1* GetAddrLib1(
+    static Lib* GetLib(
         ADDR_HANDLE hLib);
 
     /// Returns tileIndex support
@@ -187,8 +194,8 @@ public:
         const ADDR_PRT_INFO_INPUT*  pIn,
         ADDR_PRT_INFO_OUTPUT*       pOut) const;
 protected:
-    AddrLib1();  // Constructor is protected
-    AddrLib1(const AddrClient* pClient);
+    Lib();  // Constructor is protected
+    Lib(const Client* pClient);
 
     /// Pure Virtual function for Hwl computing surface info
     virtual ADDR_E_RETURNCODE HwlComputeSurfaceInfo(
@@ -342,28 +349,39 @@ protected:
     VOID    ComputeMipLevel(
         ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const;
 
-    /// Pure Virtual function for Hwl checking degrade for base level
-    virtual BOOL_32 HwlDegradeBaseLevel(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn) const = 0;
+    /// Pure Virtual function for Hwl to get macro tiled alignment info
+    virtual BOOL_32 HwlGetAlignmentInfoMacroTiled(
+        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn,
+        UINT_32* pPitchAlign, UINT_32* pHeightAlign, UINT_32* pSizeAlign) const = 0;
+
 
     virtual VOID HwlOverrideTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
     {
         // not supported in hwl layer
     }
 
+    virtual VOID HwlOptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
+    {
+        // not supported in hwl layer
+    }
+
+    virtual VOID HwlSelectTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
+    {
+        // not supported in hwl layer
+    }
+
     AddrTileMode DegradeLargeThickTile(AddrTileMode tileMode, UINT_32 bpp) const;
 
     VOID PadDimensions(
         AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
         UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 padDims, UINT_32 mipLevel,
-        UINT_32* pPitch, UINT_32 pitchAlign, UINT_32* pHeight, UINT_32 heightAlign,
+        UINT_32* pPitch, UINT_32* pPitchAlign, UINT_32* pHeight, UINT_32 heightAlign,
         UINT_32* pSlices, UINT_32 sliceAlign) const;
 
     virtual VOID HwlPadDimensions(
         AddrTileMode tileMode, UINT_32 bpp, ADDR_SURFACE_FLAGS flags,
-        UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 padDims, UINT_32 mipLevel,
-        UINT_32* pPitch, UINT_32 pitchAlign, UINT_32* pHeight, UINT_32 heightAlign,
-        UINT_32* pSlices, UINT_32 sliceAlign) const
+        UINT_32 numSamples, ADDR_TILEINFO* pTileInfo, UINT_32 mipLevel,
+        UINT_32* pPitch, UINT_32* pPitchAlign, UINT_32 height, UINT_32 heightAlign) const
     {
     }
 
@@ -429,7 +447,7 @@ protected:
     //
     // Misc helper
     //
-    static const AddrTileModeFlags ModeFlags[ADDR_TM_COUNT];
+    static const TileModeFlags ModeFlags[ADDR_TM_COUNT];
 
     static UINT_32 Thickness(
         AddrTileMode tileMode);
@@ -478,19 +496,30 @@ protected:
         ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
 
     /// Quad buffer stereo support, has its implementation in ind. layer
-    virtual BOOL_32 ComputeQbStereoInfo(
+    VOID ComputeQbStereoInfo(
         ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const;
 
     /// Pure virutual function to compute stereo bank swizzle for right eye
     virtual UINT_32 HwlComputeQbStereoRightSwizzle(
         ADDR_COMPUTE_SURFACE_INFO_OUTPUT* pOut) const = 0;
 
+    VOID OptimizeTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const;
+
+    /// Overwrite tile setting to PRT
+    virtual VOID HwlSetPrtTileMode(ADDR_COMPUTE_SURFACE_INFO_INPUT* pInOut) const
+    {
+    }
+
+    static BOOL_32 DegradeTo1D(
+        UINT_32 width, UINT_32 height,
+        UINT_32 macroTilePitchAlign, UINT_32 macroTileHeightAlign);
+
 private:
     // Disallow the copy constructor
-    AddrLib1(const AddrLib1& a);
+    Lib(const Lib& a);
 
     // Disallow the assignment operator
-    AddrLib1& operator=(const AddrLib1& a);
+    Lib& operator=(const Lib& a);
 
     UINT_32 ComputeCmaskBaseAlign(
         ADDR_CMASK_FLAGS flags, ADDR_TILEINFO*  pTileInfo) const;
@@ -507,10 +536,10 @@ private:
 
     UINT_32 ComputeXmaskCoordYFromPipe(
         UINT_32 pipe, UINT_32 x) const;
-
-    BOOL_32 OptimizeTileMode(
-        const ADDR_COMPUTE_SURFACE_INFO_INPUT* pIn, AddrTileMode* pTileMode) const;
 };
 
+} // V1
+} // Addr
+
 #endif