1 /*
2  * Copyright (C) 2018-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #pragma once
9 
10 #include <array>
11 #include <bitset>
12 #include <cstdint>
13 
14 namespace NEO {
15 constexpr size_t bcsInfoMaskSize = 9u;
16 using BcsInfoMask = std::bitset<bcsInfoMaskSize>;
17 
18 struct FeatureTableBase {
19   public:
FeatureTableBaseFeatureTableBase20     FeatureTableBase() {
21         flags.ftrRcsNode = 1;
22     }
23 
24     struct Flags {
25         // DW0
26         uint32_t ftrDesktop : 1;
27         uint32_t ftrChannelSwizzlingXOREnabled : 1;
28         uint32_t ftrGtBigDie : 1;
29         uint32_t ftrGtMediumDie : 1;
30         uint32_t ftrGtSmallDie : 1;
31         uint32_t ftrGT1 : 1;
32         uint32_t ftrGT1_5 : 1;
33         uint32_t ftrGT2 : 1;
34         uint32_t ftrGT2_5 : 1;
35         uint32_t ftrGT3 : 1;
36         uint32_t ftrGT4 : 1;
37         uint32_t ftrIVBM0M1Platform : 1;
38         uint32_t ftrSGTPVSKUStrapPresent : 1;
39         uint32_t ftrGTA : 1;
40         uint32_t ftrGTC : 1;
41         uint32_t ftrGTX : 1;
42         uint32_t ftr5Slice : 1;
43         uint32_t ftrGpGpuMidBatchPreempt : 1;
44         uint32_t ftrGpGpuThreadGroupLevelPreempt : 1;
45         uint32_t ftrGpGpuMidThreadLevelPreempt : 1;
46         uint32_t ftrIoMmuPageFaulting : 1;
47         uint32_t ftrWddm2Svm : 1;
48         uint32_t ftrPooledEuEnabled : 1;
49         uint32_t ftrResourceStreamer : 1;
50         uint32_t ftrPPGTT : 1;
51         uint32_t ftrSVM : 1;
52         uint32_t ftrEDram : 1;
53         uint32_t ftrL3IACoherency : 1;
54         uint32_t ftrIA32eGfxPTEs : 1;
55         uint32_t ftr3dMidBatchPreempt : 1;
56         uint32_t ftr3dObjectLevelPreempt : 1;
57         uint32_t ftrPerCtxtPreemptionGranularityControl : 1;
58         // DW1
59         uint32_t ftrTileY : 1;
60         uint32_t ftrDisplayYTiling : 1;
61         uint32_t ftrTranslationTable : 1;
62         uint32_t ftrUserModeTranslationTable : 1;
63         uint32_t ftrEnableGuC : 1;
64         uint32_t ftrFbc : 1;
65         uint32_t ftrFbc2AddressTranslation : 1;
66         uint32_t ftrFbcBlitterTracking : 1;
67         uint32_t ftrFbcCpuTracking : 1;
68         uint32_t ftrVcs2 : 1;
69         uint32_t ftrVEBOX : 1;
70         uint32_t ftrSingleVeboxSlice : 1;
71         uint32_t ftrULT : 1;
72         uint32_t ftrLCIA : 1;
73         uint32_t ftrGttCacheInvalidation : 1;
74         uint32_t ftrTileMappedResource : 1;
75         uint32_t ftrAstcHdr2D : 1;
76         uint32_t ftrAstcLdr2D : 1;
77         uint32_t ftrStandardMipTailFormat : 1;
78         uint32_t ftrFrameBufferLLC : 1;
79         uint32_t ftrCrystalwell : 1;
80         uint32_t ftrLLCBypass : 1;
81         uint32_t ftrDisplayEngineS3d : 1;
82         uint32_t ftrVERing : 1;
83         uint32_t ftrWddm2GpuMmu : 1;
84         uint32_t ftrWddm2_1_64kbPages : 1;
85         uint32_t ftrWddmHwQueues : 1;
86         uint32_t ftrMemTypeMocsDeferPAT : 1;
87         uint32_t ftrKmdDaf : 1;
88         uint32_t ftrSimulationMode : 1;
89         uint32_t ftrE2ECompression : 1;
90         uint32_t ftrLinearCCS : 1;
91         //DW2
92         uint32_t ftrCCSRing : 1;
93         uint32_t ftrCCSNode : 1;
94         uint32_t ftrRcsNode : 1;
95         uint32_t ftrLocalMemory : 1;
96         uint32_t ftrLocalMemoryAllows4KB : 1;
97         uint32_t ftrFlatPhysCCS : 1;
98         uint32_t ftrMultiTileArch : 1;
99         uint32_t ftrCCSMultiInstance : 1;
100         uint32_t ftrPpgtt64KBWalkOptimization : 1;
101         uint32_t ftrUnified3DMediaCompressionFormats : 1;
102         uint32_t ftr57bGPUAddressing : 1;
103         uint32_t reserved : 21;
104     };
105 
106     union {
107         Flags flags;
108         std::array<uint32_t, 3> packed = {};
109     };
110 };
111 
112 static_assert(sizeof(FeatureTableBase::flags) == sizeof(FeatureTableBase::packed));
113 
114 struct WorkaroundTableBase {
115 
116     struct Flags {
117         // DW0
118         uint32_t waDoNotUseMIReportPerfCount : 1;
119         uint32_t waEnablePreemptionGranularityControlByUMD : 1;
120         uint32_t waSendMIFLUSHBeforeVFE : 1;
121         uint32_t waReportPerfCountUseGlobalContextID : 1;
122         uint32_t waDisableLSQCROPERFforOCL : 1;
123         uint32_t waMsaa8xTileYDepthPitchAlignment : 1;
124         uint32_t waLosslessCompressionSurfaceStride : 1;
125         uint32_t waFbcLinearSurfaceStride : 1;
126         uint32_t wa4kAlignUVOffsetNV12LinearSurface : 1;
127         uint32_t waEncryptedEdramOnlyPartials : 1;
128         uint32_t waDisableEdramForDisplayRT : 1;
129         uint32_t waForcePcBbFullCfgRestore : 1;
130         uint32_t waCompressedResourceRequiresConstVA21 : 1;
131         uint32_t waDisablePerCtxtPreemptionGranularityControl : 1;
132         uint32_t waLLCCachingUnsupported : 1;
133         uint32_t waUseVAlign16OnTileXYBpp816 : 1;
134         uint32_t waModifyVFEStateAfterGPGPUPreemption : 1;
135         uint32_t waCSRUncachable : 1;
136         uint32_t waSamplerCacheFlushBetweenRedescribedSurfaceReads : 1;
137         uint32_t waRestrictPitch128KB : 1;
138         uint32_t waLimit128BMediaCompr : 1;
139         uint32_t waUntypedBufferCompression : 1;
140         uint32_t waAuxTable16KGranular : 1;
141         uint32_t waDisableFusedThreadScheduling : 1;
142         uint32_t waDefaultTile4 : 1;
143         uint32_t waAuxTable64KGranular : 1;
144         uint32_t reserved : 6;
145     };
146 
147     union {
148         Flags flags;
149         std::array<uint32_t, 1> packed = {};
150     };
151 };
152 
153 static_assert(sizeof(WorkaroundTableBase::flags) == sizeof(WorkaroundTableBase::packed));
154 } // namespace NEO
155