xref: /aosp_15_r20/external/gmmlib/Source/GmmLib/Platform/GmmGen10Platform.cpp (revision 35ffd701415c9e32e53136d61a677a8d0a8fc4a5)
1 /*==============================================================================
2 Copyright(c) 2017 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 
23 #include "Internal/Common/GmmLibInc.h"
24 #include "Internal/Common/Platform/GmmGen10Platform.h"
25 
26 /////////////////////////////////////////////////////////////////////////////////////
27 /// Allocates This function will initialize the necessary info based on platform.
28 ///              - Buffer type restrictions (Eg: Z, Color, Display)
29 ///              - X/Y tile dimensions
30 ///
31 /// @param[in]  Platform: Contains information about platform to initialize an object
32 /////////////////////////////////////////////////////////////////////////////////////
PlatformInfoGen10(PLATFORM & Platform,Context * pGmmLibContext)33 GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform, Context *pGmmLibContext)
34     : PlatformInfo(Platform, pGmmLibContext)
35 {
36     __GMM_ASSERTPTR(pGmmLibContext, VOIDRETURN);
37     // --------------------------
38     // Non Native Dispay Interface buffer restriction. Register Ref: DSPACNTR, DSPASTRIDE, DSPASURF
39     // Clamping res based on 2 Nndi buffers and GMM_NNDI_SEGMENT_SIZE reserved gfx memory
40     // --------------------------
41     Data.Nndi.Alignment            = PAGE_SIZE;
42     Data.Nndi.PitchAlignment       = GMM_BYTES(1);
43     Data.Nndi.RenderPitchAlignment = GMM_BYTES(1);
44     Data.Nndi.LockPitchAlignment   = GMM_BYTES(1);
45     Data.Nndi.MinPitch             = GMM_BYTES(640);
46     Data.Nndi.MaxPitch             = GMM_BYTES(8192);
47     Data.Nndi.MinAllocationSize    = PAGE_SIZE;
48     Data.Nndi.MinHeight            = GMM_SCANLINES(200);
49     Data.Nndi.MinWidth             = GMM_PIXELS(320);
50     Data.Nndi.MinDepth             = 0;
51     Data.Nndi.MaxHeight            = GMM_BYTES(1536);
52     Data.Nndi.MaxWidth             = GMM_BYTES(2048);
53     Data.Nndi.MaxDepth             = 1;
54     Data.Nndi.MaxArraySize         = 1;
55 
56     // --------------------------
57     // Depth Buffer Restriction. Inst Ref: 3DSTATE_DEPTH_BUFFER
58     // --------------------------
59     Data.Depth.Alignment            = PAGE_SIZE;
60     Data.Depth.PitchAlignment       = GMM_BYTES(64);
61     Data.Depth.RenderPitchAlignment = GMM_BYTES(64);
62     Data.Depth.LockPitchAlignment   = GMM_BYTES(64);
63     Data.Depth.MinPitch             = GMM_BYTES(64);
64     Data.Depth.MaxPitch             = GMM_KBYTE(128); // 3DSTATE_DEPTH_BUFFER has conflicting info--but 128KB should be fine.
65     Data.Depth.MinAllocationSize    = PAGE_SIZE;
66     Data.Depth.MinHeight            = GMM_SCANLINES(1);
67     Data.Depth.MinWidth             = GMM_PIXELS(1);
68     Data.Depth.MinDepth             = 0;
69     Data.Depth.MaxHeight            = GMM_KBYTE(16);
70     Data.Depth.MaxWidth             = GMM_KBYTE(16);
71     Data.Depth.MaxDepth             = GMM_KBYTE(2);
72     Data.Depth.MaxArraySize         = GMM_KBYTE(2);
73 
74     // --------------------------
75     // Stencil Buffer Restriction. Inst Ref: 3DSTATE_STENCIL_BUFFER
76     // --------------------------
77     Data.Stencil.Alignment            = PAGE_SIZE;
78     Data.Stencil.PitchAlignment       = GMM_BYTES(128);
79     Data.Stencil.RenderPitchAlignment = GMM_BYTES(128);
80     Data.Stencil.LockPitchAlignment   = GMM_BYTES(128);
81     Data.Stencil.MinPitch             = GMM_BYTES(128);
82     Data.Stencil.MaxPitch             = GMM_KBYTE(128); // 3DSTATE_STENCIL_BUFFER: 2*Pitch <= 128KB (GMM client allocs 2x-width, so GMM limits to that.)
83     Data.Stencil.MinAllocationSize    = PAGE_SIZE;
84     Data.Stencil.MinHeight            = GMM_SCANLINES(1);
85     Data.Stencil.MinWidth             = GMM_PIXELS(1);
86     Data.Stencil.MinDepth             = 0;
87     Data.Stencil.MaxHeight            = GMM_KBYTE(16);
88     Data.Stencil.MaxWidth             = GMM_KBYTE(16);
89     Data.Stencil.MaxDepth             = GMM_KBYTE(2);
90     Data.Stencil.MaxArraySize         = GMM_KBYTE(2);
91 
92     // --------------------------
93     // Hierarchical Depth Buffer Restriction. Inst Ref: 3DSTATE_HIER_DEPTH_BUFFER
94     // --------------------------
95     Data.HiZ.Alignment            = PAGE_SIZE;
96     Data.HiZ.PitchAlignment       = GMM_BYTES(128);
97     Data.HiZ.RenderPitchAlignment = GMM_BYTES(128);
98     Data.HiZ.LockPitchAlignment   = GMM_BYTES(128);
99     Data.HiZ.MinPitch             = GMM_BYTES(128);
100     Data.HiZ.MaxPitch             = GMM_KBYTE(128);
101     Data.HiZ.MinAllocationSize    = PAGE_SIZE;
102     Data.HiZ.MinHeight            = GMM_SCANLINES(1);
103     Data.HiZ.MinWidth             = GMM_PIXELS(1);
104     Data.HiZ.MinDepth             = 0;
105     Data.HiZ.MaxHeight            = GMM_KBYTE(16);
106     Data.HiZ.MaxWidth             = GMM_KBYTE(16);
107     Data.HiZ.MaxDepth             = GMM_KBYTE(2);
108     Data.HiZ.MaxArraySize         = GMM_KBYTE(2);
109 
110     // --------------------------
111     // Vertex Restriction. Inst Ref: 3DSTATE_VERTEX_BUFFER, 3DSTATE_INSTANCE_STEP_RATE
112     // Note: restrictions are expanded here for UMD flexibility.
113     // --------------------------
114     Data.Vertex.Alignment            = PAGE_SIZE;
115     Data.Vertex.PitchAlignment       = GMM_BYTES(1);
116     Data.Vertex.LockPitchAlignment   = GMM_BYTES(1);
117     Data.Vertex.RenderPitchAlignment = GMM_BYTES(1);
118     Data.Vertex.MinPitch             = GMM_BYTES(1);
119     Data.Vertex.MaxPitch             = GMM_GBYTE(2);
120     Data.Vertex.MinAllocationSize    = PAGE_SIZE;
121     Data.Vertex.MinHeight            = GMM_SCANLINES(1);
122     Data.Vertex.MinWidth             = GMM_PIXELS(1);
123     Data.Vertex.MinDepth             = 0;
124     Data.Vertex.MaxHeight            = GMM_MBYTE(128); //TODO(Minor): How does Media fail when we change this to 1?!
125     Data.Vertex.MaxWidth             = GMM_GBYTE(2);
126     Data.Vertex.MaxDepth             = GMM_KBYTE(2);
127     Data.Vertex.MaxArraySize         = GMM_KBYTE(2);
128 
129     // --------------------------
130     // Index Buffer Restriction. Inst Ref: 3DSTATE_INDEX_BUFFER
131     // --------------------------
132     Data.Index = Data.Vertex;
133 
134     // --------------------------
135     // Linear Buffer Restriction. General purpose. Flexible.
136     // --------------------------
137     Data.Linear.Alignment            = PAGE_SIZE;
138     Data.Linear.PitchAlignment       = GMM_BYTES(1);
139     Data.Linear.LockPitchAlignment   = GMM_BYTES(1);
140     Data.Linear.RenderPitchAlignment = GMM_BYTES(1);
141     Data.Linear.MinPitch             = GMM_BYTES(1);
142     Data.Linear.MaxPitch             = GMM_GBYTE(256);
143     Data.Linear.MinAllocationSize    = PAGE_SIZE;
144     Data.Linear.MinHeight            = GMM_SCANLINES(1);
145     Data.Linear.MinWidth             = GMM_PIXELS(1);
146     Data.Linear.MinDepth             = 0;
147     Data.Linear.MaxHeight            = 1;
148     Data.Linear.MaxWidth             = GMM_GBYTE(256);
149     Data.Linear.MaxDepth             = 1;
150     Data.Linear.MaxArraySize         = 1;
151 
152     // --------------------------
153     // No Surface Restriction. General purpose. Flexible.
154     // --------------------------
155     Data.NoRestriction.Alignment            = PAGE_SIZE;
156     Data.NoRestriction.PitchAlignment       = GMM_BYTES(1);
157     Data.NoRestriction.LockPitchAlignment   = GMM_BYTES(1);
158     Data.NoRestriction.RenderPitchAlignment = GMM_BYTES(1);
159     Data.NoRestriction.MinPitch             = GMM_BYTES(1);
160     Data.NoRestriction.MaxPitch             = GMM_TBYTE(128);
161     Data.NoRestriction.MinAllocationSize    = PAGE_SIZE;
162     Data.NoRestriction.MinHeight            = GMM_SCANLINES(1);
163     Data.NoRestriction.MinWidth             = GMM_PIXELS(1);
164     Data.NoRestriction.MinDepth             = 0;
165     Data.NoRestriction.MaxHeight            = GMM_GBYTE(256);
166     Data.NoRestriction.MaxWidth             = GMM_TBYTE(128);
167     Data.NoRestriction.MaxDepth             = GMM_KBYTE(2);
168     Data.NoRestriction.MaxArraySize         = GMM_KBYTE(2);
169 
170     // --------------------------
171     // Constant Buffer Restriction.
172     // --------------------------
173     Data.Constant = Data.NoRestriction;
174 
175     // --------------------------
176     // Dx9 Constant Buffer pool Restriction. Inst Ref: 3DSTATE_DX9_CONSTANT_BUFFER_POOL_ALLOC
177     // --------------------------
178     Data.StateDx9ConstantBuffer           = Data.NoRestriction;
179     Data.StateDx9ConstantBuffer.Alignment = GMM_KBYTE(8);
180 
181     // --------------------------
182     // MC Buffer Restriction
183     // --------------------------
184     Data.MotionComp                      = Data.NoRestriction;
185     Data.MotionComp.Alignment            = PAGE_SIZE;
186     Data.MotionComp.PitchAlignment       = GMM_BYTES(32);
187     Data.MotionComp.LockPitchAlignment   = GMM_BYTES(32);
188     Data.MotionComp.RenderPitchAlignment = GMM_BYTES(32);
189     Data.MotionComp.MinPitch             = GMM_BYTES(32);
190 
191     // --------------------------
192     // Stream Buffer Restriction
193     // --------------------------
194     Data.Stream = Data.NoRestriction;
195 
196     // --------------------------
197     // Interlace Scan Buffer Restriction
198     // --------------------------
199     Data.InterlacedScan = Data.NoRestriction;
200 
201     // --------------------------
202     // Text API Buffer Restriction
203     // --------------------------
204     Data.TextApi = Data.NoRestriction;
205 
206     // --------------------------
207     // RT & Texture2DSurface restrictions. Inst Ref: SURFACE_STATE
208     // Greatest common restriction source comes from 8bpp RT
209     // --------------------------
210     Data.Texture2DSurface.Alignment            = PAGE_SIZE;
211     Data.Texture2DSurface.PitchAlignment       = GMM_BYTES(32);
212     Data.Texture2DSurface.LockPitchAlignment   = GMM_BYTES(32);
213     Data.Texture2DSurface.RenderPitchAlignment = GMM_BYTES(32);
214     Data.Texture2DSurface.MinPitch             = GMM_BYTES(32);
215     Data.Texture2DSurface.MaxPitch             = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256);
216     Data.Texture2DSurface.MinAllocationSize    = PAGE_SIZE;
217     Data.Texture2DSurface.MinHeight            = GMM_SCANLINES(1);
218     Data.Texture2DSurface.MinWidth             = GMM_PIXELS(1);
219     Data.Texture2DSurface.MinDepth             = 0;
220     Data.Texture2DSurface.MaxHeight            = GMM_KBYTE(16);
221     Data.Texture2DSurface.MaxWidth             = GMM_KBYTE(16);
222     Data.Texture2DSurface.MaxDepth             = GMM_FIELD_NA;
223     Data.Texture2DSurface.MaxArraySize         = GMM_KBYTE(2);
224 
225     {
226         // Linear surfaces accessed with Media Block Read/Write commands
227         // require 64-byte-aligned pitch. Such commands only operate on 2D
228         // resources, so we'll handle the requirement here. Though requirement
229         // applies to linear surfaces only, our up'ing the pitch alignment to
230         // 64 bytes here won't affect tiled surfaces, since their pitch
231         // alignment is never smaller than that.
232         Data.Texture2DLinearSurface                      = Data.Texture2DSurface;
233         Data.Texture2DLinearSurface.PitchAlignment       = GFX_MAX(GMM_BYTES(64), Data.Texture2DSurface.PitchAlignment);
234         Data.Texture2DLinearSurface.LockPitchAlignment   = GFX_MAX(GMM_BYTES(64), Data.Texture2DSurface.LockPitchAlignment);
235         Data.Texture2DLinearSurface.RenderPitchAlignment = GFX_MAX(GMM_BYTES(64), Data.Texture2DSurface.RenderPitchAlignment);
236     }
237 
238     // --------------------------
239     // AsyncFlip Restriction. Register Ref: PRI_STRIDE, PRI_SURF, SRCSZ <-- TODO(Minor): SRCSZ correct reg for W/H req's?
240     // --------------------------
241     Data.ASyncFlipSurface.Alignment            = GMM_KBYTE(256);
242     Data.ASyncFlipSurface.PitchAlignment       = GMM_BYTES(64);
243     Data.ASyncFlipSurface.RenderPitchAlignment = GMM_BYTES(64);
244     Data.ASyncFlipSurface.LockPitchAlignment   = GMM_BYTES(64);
245     Data.ASyncFlipSurface.MinPitch             = GMM_BYTES(64);
246     Data.ASyncFlipSurface.MaxPitch             = Data.Texture2DSurface.MaxPitch;
247     Data.ASyncFlipSurface.MinAllocationSize    = PAGE_SIZE;
248     Data.ASyncFlipSurface.MinHeight            = GMM_SCANLINES(1);
249     Data.ASyncFlipSurface.MinWidth             = GMM_PIXELS(1);
250     Data.ASyncFlipSurface.MinDepth             = 0;
251     Data.ASyncFlipSurface.MaxHeight            = Data.Texture2DSurface.MaxHeight; // Beyond DE requirements-Necessary for mosaic framebuffers
252     Data.ASyncFlipSurface.MaxWidth             = Data.Texture2DSurface.MaxWidth;  // Okay since GMM isn't actual display requirement gatekeeper.
253     Data.ASyncFlipSurface.MaxDepth             = 1;
254     Data.ASyncFlipSurface.MaxArraySize         = GMM_KBYTE(2);
255 
256     // --------------------------
257     // Hardware MBM Restriction.
258     // --------------------------
259     Data.HardwareMBM = Data.ASyncFlipSurface;
260 
261     // --------------------------
262     // Video Buffer Restriction
263     // --------------------------
264     Data.Video = Data.Texture2DLinearSurface;
265 
266     // --------------------------
267     // Overlay Buffer Restriction. Overlay buffer restriction will be same as Async flip surface since CNL has universal planes.
268     // --------------------------
269     Data.Overlay = Data.ASyncFlipSurface;
270 
271     // --------------------------
272     // RT & CubeSurface restrictions. Inst Ref: SURFACE_STATE
273     // Greatest common restriction source comes from 8bpp RT
274     // --------------------------
275     Data.CubeSurface.Alignment            = PAGE_SIZE;
276     Data.CubeSurface.PitchAlignment       = GMM_BYTES(32);
277     Data.CubeSurface.LockPitchAlignment   = GMM_BYTES(32);
278     Data.CubeSurface.RenderPitchAlignment = GMM_BYTES(32);
279     Data.CubeSurface.MinPitch             = GMM_BYTES(32);
280     Data.CubeSurface.MaxPitch             = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256);
281     Data.CubeSurface.MinAllocationSize    = PAGE_SIZE;
282     Data.CubeSurface.MinHeight            = GMM_SCANLINES(1);
283     Data.CubeSurface.MinWidth             = GMM_PIXELS(1);
284     Data.CubeSurface.MinDepth             = 0;
285     Data.CubeSurface.MaxHeight            = GMM_KBYTE(16);
286     Data.CubeSurface.MaxWidth             = GMM_KBYTE(16);
287     Data.CubeSurface.MaxDepth             = 1;
288     Data.CubeSurface.MaxArraySize         = GMM_KBYTE(2) / 6; // MaxElements / Cubefaces
289 
290     // --------------------------
291     // RT & 3D Surface restrictions. Inst Ref: SURFACE_STATE
292     // Greatest common restriction source comes from 8bpp RT
293     // --------------------------
294     Data.Texture3DSurface.Alignment            = PAGE_SIZE;
295     Data.Texture3DSurface.PitchAlignment       = GMM_BYTES(32);
296     Data.Texture3DSurface.LockPitchAlignment   = GMM_BYTES(32);
297     Data.Texture3DSurface.RenderPitchAlignment = GMM_BYTES(32);
298     Data.Texture3DSurface.MinPitch             = GMM_BYTES(32);
299     Data.Texture3DSurface.MaxPitch             = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256);
300     Data.Texture3DSurface.MinAllocationSize    = PAGE_SIZE;
301     Data.Texture3DSurface.MinHeight            = GMM_SCANLINES(1);
302     Data.Texture3DSurface.MinWidth             = GMM_PIXELS(1);
303     Data.Texture3DSurface.MinDepth             = 0;
304     Data.Texture3DSurface.MaxHeight            = GMM_KBYTE(16);
305     Data.Texture3DSurface.MaxWidth             = GMM_KBYTE(16);
306     Data.Texture3DSurface.MaxDepth             = GMM_KBYTE(2);
307     Data.Texture3DSurface.MaxArraySize         = GMM_FIELD_NA;
308 
309     // --------------------------
310     // RT & Buffer Type restrictions. Inst Ref: SURFACE_STATE
311     // Greatest common restriction source comes from 8bpp RT
312     // --------------------------
313     Data.BufferType.Alignment            = PAGE_SIZE;
314     Data.BufferType.PitchAlignment       = GMM_BYTES(32);
315     Data.BufferType.LockPitchAlignment   = GMM_BYTES(32);
316     Data.BufferType.RenderPitchAlignment = GMM_BYTES(32);
317     Data.BufferType.MinPitch             = GMM_BYTES(32);
318     Data.BufferType.MaxPitch             = GMM_GBYTE(256);
319     Data.BufferType.MinAllocationSize    = PAGE_SIZE;
320     Data.BufferType.MinHeight            = GMM_SCANLINES(0);
321     Data.BufferType.MinWidth             = GMM_PIXELS(1);
322     Data.BufferType.MinDepth             = 0;
323     Data.BufferType.MaxHeight            = GMM_SCANLINES(1);
324     Data.BufferType.MaxWidth             = GMM_GBYTE(256);
325     Data.BufferType.MaxDepth             = GMM_FIELD_NA;
326     Data.BufferType.MaxArraySize         = GMM_GBYTE(2);
327 
328     // --------------------------
329     // Cursor surface restricion. Register Ref: CURACNTR, CURABASE
330     // --------------------------
331     Data.Cursor.Alignment            = pGmmLibContext->GetWaTable().WaCursor16K ? GMM_KBYTE(16) : PAGE_SIZE;
332     Data.Cursor.PitchAlignment       = 1;
333     Data.Cursor.LockPitchAlignment   = 1;
334     Data.Cursor.RenderPitchAlignment = 1;
335     Data.Cursor.MinPitch             = 1;
336     Data.Cursor.MaxPitch             = 0xffffffff;
337     Data.Cursor.MinAllocationSize    = 1;
338     Data.Cursor.MinHeight            = GMM_SCANLINES(1);
339     Data.Cursor.MinWidth             = 1;
340     Data.Cursor.MinDepth             = 0;
341     Data.Cursor.MaxHeight            = 0xffffffff;
342     Data.Cursor.MaxWidth             = 0xffffffff;
343     Data.Cursor.MaxDepth             = 0xffffffff;
344     Data.Cursor.MaxArraySize         = 1;
345 
346     // clang-format off
347     /******************************************************************************************************/
348     /***************************************   Width,   Height,    Depth,  MtsWidth,  MtsHeight, MtsDepth */
349     /******************************************************************************************************/
350     // Legacy TILE_X/Y
351     SET_TILE_MODE_INFO(LEGACY_TILE_X,            512,        8,        1,         0,         0,         0)
352     SET_TILE_MODE_INFO(LEGACY_TILE_Y,            128,       32,        1,         0,         0,         0)
353     // YS 1D
354     SET_TILE_MODE_INFO(TILE_YS_1D_128bpe,       4096,        1,        1,      1024,         1,         1)
355     SET_TILE_MODE_INFO(TILE_YS_1D_64bpe,        8192,        1,        1,      2048,         1,         1)
356     SET_TILE_MODE_INFO(TILE_YS_1D_32bpe,       16384,        1,        1,      4096,         1,         1)
357     SET_TILE_MODE_INFO(TILE_YS_1D_16bpe,       32768,        1,        1,      8192,         1,         1)
358     SET_TILE_MODE_INFO(TILE_YS_1D_8bpe,        65536,        1,        1,     16384,         1,         1)
359     // YS 2D
360     SET_TILE_MODE_INFO(TILE_YS_2D_128bpe,       1024,       64,        1,        32,        64,         1)
361     SET_TILE_MODE_INFO(TILE_YS_2D_64bpe,        1024,       64,        1,        64,        64,         1)
362     SET_TILE_MODE_INFO(TILE_YS_2D_32bpe,         512,      128,        1,        64,       128,         1)
363     SET_TILE_MODE_INFO(TILE_YS_2D_16bpe,         512,      128,        1,       128,       128,         1)
364     SET_TILE_MODE_INFO(TILE_YS_2D_8bpe,          256,      256,        1,       128,       256,         1)
365     // YS 2D 2X
366     SET_TILE_MODE_INFO(TILE_YS_2D_2X_128bpe,     512,       64,        1,        32,        32,         1)
367     SET_TILE_MODE_INFO(TILE_YS_2D_2X_64bpe,      512,       64,        1,        64,        32,         1)
368     SET_TILE_MODE_INFO(TILE_YS_2D_2X_32bpe,      256,      128,        1,        64,        64,         1)
369     SET_TILE_MODE_INFO(TILE_YS_2D_2X_16bpe,      256,      128,        1,       128,        64,         1)
370     SET_TILE_MODE_INFO(TILE_YS_2D_2X_8bpe,       128,      256,        1,       128,       128,         1)
371     // YS 2D 4X
372     SET_TILE_MODE_INFO(TILE_YS_2D_4X_128bpe,     512,       32,        1,        16,        32,         1)
373     SET_TILE_MODE_INFO(TILE_YS_2D_4X_64bpe,      512,       32,        1,        32,        32,         1)
374     SET_TILE_MODE_INFO(TILE_YS_2D_4X_32bpe,      256,       64,        1,        32,        64,         1)
375     SET_TILE_MODE_INFO(TILE_YS_2D_4X_16bpe,      256,       64,        1,        64,        64,         1)
376     SET_TILE_MODE_INFO(TILE_YS_2D_4X_8bpe,       128,      128,        1,        64,       128,         1)
377     // YS 2D 8X
378     SET_TILE_MODE_INFO(TILE_YS_2D_8X_128bpe,     256,       32,        1,        16,        16,         1)
379     SET_TILE_MODE_INFO(TILE_YS_2D_8X_64bpe,      256,       32,        1,        32,        16,         1)
380     SET_TILE_MODE_INFO(TILE_YS_2D_8X_32bpe,      128,       64,        1,        32,        32,         1)
381     SET_TILE_MODE_INFO(TILE_YS_2D_8X_16bpe,      128,       64,        1,        64,        32,         1)
382     SET_TILE_MODE_INFO(TILE_YS_2D_8X_8bpe,        64,      128,        1,        64,        64,         1)
383     // YS 2D 16X
384     SET_TILE_MODE_INFO(TILE_YS_2D_16X_128bpe,    256,       16,        1,         8,        16,         1)
385     SET_TILE_MODE_INFO(TILE_YS_2D_16X_64bpe,     256,       16,        1,        16,        16,         1)
386     SET_TILE_MODE_INFO(TILE_YS_2D_16X_32bpe,     128,       32,        1,        16,        32,         1)
387     SET_TILE_MODE_INFO(TILE_YS_2D_16X_16bpe,     128,       32,        1,        32,        32,         1)
388     SET_TILE_MODE_INFO(TILE_YS_2D_16X_8bpe,       64,       64,        1,        32,        64,         1)
389     // YS 3D
390     SET_TILE_MODE_INFO(TILE_YS_3D_128bpe,        256,       16,       16,         8,        16,        16)
391     SET_TILE_MODE_INFO(TILE_YS_3D_64bpe,         256,       16,       16,        16,        16,        16)
392     SET_TILE_MODE_INFO(TILE_YS_3D_32bpe,         128,       32,       16,        16,        32,        16)
393     SET_TILE_MODE_INFO(TILE_YS_3D_16bpe,          64,       32,       32,        16,        32,        32)
394     SET_TILE_MODE_INFO(TILE_YS_3D_8bpe,           64,       32,       32,        32,        32,        32)
395     // YF 1D
396     SET_TILE_MODE_INFO(TILE_YF_1D_128bpe,        256,        1,        1,        64,         1,         1)
397     SET_TILE_MODE_INFO(TILE_YF_1D_64bpe,         512,        1,        1,       128,         1,         1)
398     SET_TILE_MODE_INFO(TILE_YF_1D_32bpe,        1024,        1,        1,       256,         1,         1)
399     SET_TILE_MODE_INFO(TILE_YF_1D_16bpe,        2048,        1,        1,       512,         1,         1)
400     SET_TILE_MODE_INFO(TILE_YF_1D_8bpe,         4096,        1,        1,      1024,         1,         1)
401     // YF 2D
402     SET_TILE_MODE_INFO(TILE_YF_2D_128bpe,        256,       16,        1,         8,        16,         1)
403     SET_TILE_MODE_INFO(TILE_YF_2D_64bpe,         256,       16,        1,        16,        16,         1)
404     SET_TILE_MODE_INFO(TILE_YF_2D_32bpe,         128,       32,        1,        16,        32,         1)
405     SET_TILE_MODE_INFO(TILE_YF_2D_16bpe,         128,       32,        1,        32,        32,         1)
406     SET_TILE_MODE_INFO(TILE_YF_2D_8bpe,           64,       64,        1,        32,        64,         1)
407     // YF 2D 2X
408     SET_TILE_MODE_INFO(TILE_YF_2D_2X_128bpe,     128,       16,        1,         4,         8,         1)
409     SET_TILE_MODE_INFO(TILE_YF_2D_2X_64bpe,      128,       16,        1,         8,         8,         1)
410     SET_TILE_MODE_INFO(TILE_YF_2D_2X_32bpe,       64,       32,        1,         8,        16,         1)
411     SET_TILE_MODE_INFO(TILE_YF_2D_2X_16bpe,       64,       32,        1,        16,        16,         1)
412     SET_TILE_MODE_INFO(TILE_YF_2D_2X_8bpe,        32,       64,        1,        16,        32,         1)
413     // YF 2D 4X
414     SET_TILE_MODE_INFO(TILE_YF_2D_4X_128bpe,     128,        8,        1,         4,         4,         1)
415     SET_TILE_MODE_INFO(TILE_YF_2D_4X_64bpe,      128,        8,        1,         8,         4,         1)
416     SET_TILE_MODE_INFO(TILE_YF_2D_4X_32bpe,       64,       16,        1,         8,         8,         1)
417     SET_TILE_MODE_INFO(TILE_YF_2D_4X_16bpe,       64,       16,        1,        16,         8,         1)
418     SET_TILE_MODE_INFO(TILE_YF_2D_4X_8bpe,        32,       32,        1,        16,        16,         1)
419     // YF 2D 8X
420     SET_TILE_MODE_INFO(TILE_YF_2D_8X_128bpe,      64,        8,        1,         4,         4,         1)
421     SET_TILE_MODE_INFO(TILE_YF_2D_8X_64bpe,       64,        8,        1,         8,         4,         1)
422     SET_TILE_MODE_INFO(TILE_YF_2D_8X_32bpe,       32,       16,        1,         8,         8,         1)
423     SET_TILE_MODE_INFO(TILE_YF_2D_8X_16bpe,       32,       16,        1,        16,         8,         1)
424     SET_TILE_MODE_INFO(TILE_YF_2D_8X_8bpe,        16,       32,        1,        16,        16,         1)
425     // YF 2D 16X
426     SET_TILE_MODE_INFO(TILE_YF_2D_16X_128bpe,     64,        4,        1,         1,         4,         1)
427     SET_TILE_MODE_INFO(TILE_YF_2D_16X_64bpe,      64,        4,        1,         2,         4,         1)
428     SET_TILE_MODE_INFO(TILE_YF_2D_16X_32bpe,      32,        8,        1,         4,         4,         1)
429     SET_TILE_MODE_INFO(TILE_YF_2D_16X_16bpe,      32,        8,        1,         8,         4,         1)
430     SET_TILE_MODE_INFO(TILE_YF_2D_16X_8bpe,       16,       16,        1,         8,         4,         1)
431     // YF 3D
432     SET_TILE_MODE_INFO(TILE_YF_3D_128bpe,         64,        8,        8,         4,         4,         8)
433     SET_TILE_MODE_INFO(TILE_YF_3D_64bpe,          64,        8,        8,         8,         4,         8)
434     SET_TILE_MODE_INFO(TILE_YF_3D_32bpe,          32,       16,        8,         8,         8,         8)
435     SET_TILE_MODE_INFO(TILE_YF_3D_16bpe,          16,       16,       16,         8,         8,        16)
436     SET_TILE_MODE_INFO(TILE_YF_3D_8bpe,           16,       16,       16,        16,         8,        16)
437     // clang-format on
438 
439     //--------------------------
440     // Fence paramaters. Register Ref: FENCE
441     //--------------------------
442     Data.NumberFenceRegisters = pGmmLibContext->GetWaTable().Wa16TileFencesOnly ? 16 : 32;
443     Data.FenceLowBoundShift   = 12;
444     Data.FenceLowBoundMask    = GFX_MASK(12, 31);
445     Data.MinFenceSize         = GMM_MBYTE(1);
446 
447     Data.PagingBufferPrivateDataSize = GMM_KBYTE(4);
448     Data.MaxLod                      = 14; // [0,14] --> 15 Total
449 
450     Data.FBCRequiredStolenMemorySize = GMM_MBYTE(8);
451 
452     // --------------------------
453     // Surface Alignment Units
454     // --------------------------
455     Data.TexAlign.CCS.Align.Width                  = 128;
456     Data.TexAlign.CCS.Align.Height                 = 64;
457     Data.TexAlign.CCS.MaxPitchinTiles              = 512;
458     Data.TexAlign.Compressed.Width                 = 4; // No reason for > HALIGN_4.
459     Data.TexAlign.Compressed.Height                = 4; // No reason for > VALIGN_4.
460     Data.TexAlign.Compressed.Depth                 = 4; // No reason for > DALIGN_4.
461     Data.TexAlign.Depth.Width                      = 4; // See usage for 16bpp HALIGN_8 special-casing.
462     Data.TexAlign.Depth.Height                     = 4;
463     Data.TexAlign.Depth_D16_UNORM_1x_4x_16x.Width  = 8;
464     Data.TexAlign.Depth_D16_UNORM_1x_4x_16x.Height = Data.TexAlign.Depth.Height;
465     Data.TexAlign.Depth_D16_UNORM_2x_8x.Width      = 8;
466     Data.TexAlign.Depth_D16_UNORM_2x_8x.Height     = Data.TexAlign.Depth.Height;
467     Data.TexAlign.SeparateStencil.Width            = 8;
468     Data.TexAlign.SeparateStencil.Height           = 8;
469     Data.TexAlign.YUV422.Width                     = 4;
470     Data.TexAlign.YUV422.Height                    = 4;
471     Data.TexAlign.AllOther.Width                   = 16; // HALIGN_16 required for non-MSAA RT's for CCS Fast-Clear and...TBA
472     Data.TexAlign.AllOther.Height                  = 4;  // VALIGN_4 should be sufficent.
473     Data.TexAlign.XAdapter.Height                  = D3DKMT_CROSS_ADAPTER_RESOURCE_HEIGHT_ALIGNMENT;
474     Data.TexAlign.XAdapter.Width                   = 1; //minimum should be one.
475 
476     // ----------------------------------
477     // SURFACE_STATE YOffset Granularity
478     // ----------------------------------
479     Data.SurfaceStateYOffsetGranularity = 4;
480     Data.SamplerFetchGranularityHeight  = 4;
481     Data.SamplerFetchGranularityWidth   = 4;
482 
483     // ----------------------------------
484     // Restrictions for Cross adapter resource
485     // ----------------------------------
486     Data.XAdapter.Alignment            = GMM_KBYTE(64); //64KB for DX12/StdSwizzle�-Not worth special-casing.
487     Data.XAdapter.PitchAlignment       = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT);
488     Data.XAdapter.RenderPitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT);
489     Data.XAdapter.LockPitchAlignment   = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT);
490     Data.XAdapter.MinPitch             = GMM_BYTES(32);
491     Data.XAdapter.MaxPitch             = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256);
492     Data.XAdapter.MinAllocationSize    = PAGE_SIZE;
493     Data.XAdapter.MinHeight            = GMM_SCANLINES(1);
494     Data.XAdapter.MinWidth             = GMM_PIXELS(1);
495     Data.XAdapter.MinDepth             = 0;
496     Data.XAdapter.MaxHeight            = GMM_KBYTE(16);
497     Data.XAdapter.MaxWidth             = GMM_KBYTE(16);
498     Data.XAdapter.MaxDepth             = GMM_FIELD_NA;
499     Data.XAdapter.MaxArraySize         = GMM_KBYTE(2);
500 
501     //---------------------------------------------
502     //MaxSize for any surface type
503     //---------------------------------------------
504     Data.SurfaceMaxSize                      = GMM_GBYTE(256);
505     Data.MaxGpuVirtualAddressBitsPerResource = 38;
506     Data.HiZPixelsPerByte                    = 2;
507 
508     Data.ReconMaxHeight = Data.Texture2DSurface.MaxHeight; // Reconstructed surfaces require more height and width for higher resolutions.
509     Data.ReconMaxWidth  = Data.Texture2DSurface.MaxWidth;
510 
511     Data.NoOfBitsSupported                = 39;
512     Data.HighestAcceptablePhysicalAddress = GFX_MASK_LARGE(0, 38);
513 }
514