Debian Codegraph @

Source/GmmLib/inc/Internal/Common/Platform/GmmGen12Platform.h

raw
1 /*==============================================================================
2 Copyright(c) 2019 Intel Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files(the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and / or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21 ============================================================================*/
22 #pragma once
23 #include "GmmGen11Platform.h"
24
25 typedef struct __CCS_UNIT
26 {
27 ALIGNMENT Align;
28 struct
29 {
30 //represents downscale factor if msb = 0,
31 // upscale factor if msb = 1,
32 //factor value is absolute (+ve)
33 int32_t Width;
34 int32_t Height;
35 uint32_t Depth; //Depth slices or Samples sharing CCS$line
36 } Downscale;
37 } CCS_UNIT;
38
39 //Gen12 CCS supported on Yf/Ys 2D/MSAA/3D tiling
40 #define CCS_MODES (GMM_TILE_MODES - TILE_YF_2D_8bpe)
41 #define CCS_MODE(x) (x >= TILE_YF_2D_8bpe) ? (x - TILE_YF_2D_8bpe) : CCS_MODES
42
43 typedef enum _FC_TileType
44 {
45 FC_TILE_Y,
46 FC_TILE_YF,
47 FC_TILE_YS,
48 FC_TILE_4,
49 FC_TILE_64,
50 FC_TILE_64_3D,
51 //max equals last supported plus one
52 FC_TILE_MAX
53 } FC_TILE_TYPE;
54
55 #define FCTilingType(x) (((x) == LEGACY_TILE_Y) ? (FC_TILE_Y) : \
56 (((x) == TILE4) ? (FC_TILE_4) : \
57 (((x) >= TILE_YF_2D_8bpe && (x) <= TILE_YF_2D_128bpe) ? (FC_TILE_YF) : \
58 (((x) >= TILE_YS_2D_8bpe && (x) <= TILE_YS_2D_128bpe) ? (FC_TILE_YS) : \
59 (((x) >= TILE__64_2D_8bpe && (x) <= TILE__64_2D_128bpe) ? (FC_TILE_64) : \
60 (((x) >= TILE__64_3D_8bpe && (x) <= TILE__64_3D_128bpe) ? (FC_TILE_64_3D) : \
61 (FC_TILE_MAX)))))))
62 #define FCMaxBppModes 5
63 #define FCMaxModes FC_TILE_MAX *FCMaxBppModes
64 #define FCBppMode(bpp) __GmmLog2(bpp) - 3
65 #define FCMode(TileMode, bpp) (FCTilingType(TileMode) < FC_TILE_MAX) ? (FCTilingType(TileMode) * FCMaxBppModes + FCBppMode(bpp)) : FCMaxModes
66
67 //===========================================================================
68 // typedef:
69 // GMM_TEXTURE_ALIGN_EX
70 //
71 // Description:
72 // The following struct extends the texture mip map unit alignment
73 // required for each map format. The alignment values are platform
74 // dependent.
75 //
76 //---------------------------------------------------------------------------
77 typedef struct GMM_TEXTURE_ALIGN_EX_REC
78 {
79 CCS_UNIT CCSEx[CCS_MODES];
80 }GMM_TEXTURE_ALIGN_EX;
81
82 #ifdef __cplusplus
83
84 namespace GmmLib
85 {
86 class NON_PAGED_SECTION PlatformInfoGen12 : public PlatformInfoGen11
87 {
88 protected:
89 GMM_TEXTURE_ALIGN_EX TexAlignEx;
90 CCS_UNIT FCTileMode[FCMaxModes];
91 public:
92 PlatformInfoGen12(PLATFORM &Platform, Context *pGmmLibContext);
93 ~PlatformInfoGen12(){};
94 virtual GMM_TEXTURE_ALIGN_EX GetExTextureAlign() { return TexAlignEx; }
95 virtual void ApplyExtendedTexAlign(uint32_t CCSMode, ALIGNMENT& UnitAlign);
96 virtual CCS_UNIT* GetFCRectAlign() { return FCTileMode; }
97 virtual void SetCCSFlag(GMM_RESOURCE_FLAG &Flags);
98 virtual uint8_t ValidateMMC(GMM_TEXTURE_INFO &Surf);
99 virtual uint8_t ValidateCCS(GMM_TEXTURE_INFO &Surf);
100 virtual uint8_t ValidateUnifiedAuxSurface(GMM_TEXTURE_INFO &Surf);
101 virtual uint8_t CheckFmtDisplayDecompressible(GMM_TEXTURE_INFO &Surf,
102 bool IsSupportedRGB64_16_16_16_16,
103 bool IsSupportedRGB32_8_8_8_8,
104 bool IsSupportedRGB32_2_10_10_10,
105 bool IsSupportedMediaFormats);
106 virtual uint8_t OverrideCompressionFormat(GMM_RESOURCE_FORMAT Format, uint8_t IsMC);
107 };
108 }
109
110 #endif