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 
25 /////////////////////////////////////////////////////////////////////////////////////
26 /// Allocates This function will initialize the necessary info based on platform.
27 ///              - Buffer type restrictions (Eg: Z, Color, Display)
28 ///              - X/Y tile dimensions
29 ///
30 /// @param[in]  Platform: Contains information about platform to initialize an object
31 /////////////////////////////////////////////////////////////////////////////////////
PlatformInfoGen9(PLATFORM & Platform,Context * pGmmLibContext)32 GmmLib::PlatformInfoGen9::PlatformInfoGen9(PLATFORM &Platform, Context *pGmmLibContext)
33     : PlatformInfo(Platform, pGmmLibContext)
34 {
35     __GMM_ASSERTPTR(pGmmLibContext, VOIDRETURN);
36 
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 SKL 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,      2048,         1,         1)
355     SET_TILE_MODE_INFO(TILE_YS_1D_64bpe,        8192,        1,        1,      4096,         1,         1)
356     SET_TILE_MODE_INFO(TILE_YS_1D_32bpe,       16384,        1,        1,      8192,         1,         1)
357     SET_TILE_MODE_INFO(TILE_YS_1D_16bpe,       32768,        1,        1,     16384,         1,         1)
358     SET_TILE_MODE_INFO(TILE_YS_1D_8bpe,        65536,        1,        1,     32768,         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,       128,         1,         1)
397     SET_TILE_MODE_INFO(TILE_YF_1D_64bpe,         512,        1,        1,       256,         1,         1)
398     SET_TILE_MODE_INFO(TILE_YF_1D_32bpe,        1024,        1,        1,       512,         1,         1)
399     SET_TILE_MODE_INFO(TILE_YF_1D_16bpe,        2048,        1,        1,      1024,         1,         1)
400     SET_TILE_MODE_INFO(TILE_YF_1D_8bpe,         4096,        1,        1,      2048,         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 3D
408     SET_TILE_MODE_INFO(TILE_YF_3D_128bpe,         64,        8,        8,         4,         4,         8)
409     SET_TILE_MODE_INFO(TILE_YF_3D_64bpe,          64,        8,        8,         8,         4,         8)
410     SET_TILE_MODE_INFO(TILE_YF_3D_32bpe,          32,       16,        8,         8,         8,         8)
411     SET_TILE_MODE_INFO(TILE_YF_3D_16bpe,          16,       16,       16,         8,         8,        16)
412     SET_TILE_MODE_INFO(TILE_YF_3D_8bpe,           16,       16,       16,        16,         8,        16)
413     // clang-format on
414 
415     //--------------------------
416     // Fence paramaters. Register Ref: FENCE
417     //--------------------------
418     Data.NumberFenceRegisters = pGmmLibContext->GetWaTable().Wa16TileFencesOnly ? 16 : 32;
419     Data.FenceLowBoundShift   = 12;
420     Data.FenceLowBoundMask    = GFX_MASK(12, 31);
421     Data.MinFenceSize         = GMM_MBYTE(1);
422 
423     Data.PagingBufferPrivateDataSize = GMM_KBYTE(4);
424     Data.MaxLod                      = 14; // [0,14] --> 15 Total
425 
426     Data.FBCRequiredStolenMemorySize = GMM_MBYTE(8);
427 
428     // --------------------------
429     // Surface Alignment Units
430     // --------------------------
431     Data.TexAlign.CCS.Align.Width                  = 128;
432     Data.TexAlign.CCS.Align.Height                 = 64;
433     Data.TexAlign.CCS.MaxPitchinTiles              = 512;
434     Data.TexAlign.Compressed.Width                 = 4; // No reason for > HALIGN_4.
435     Data.TexAlign.Compressed.Height                = 4; // No reason for > VALIGN_4.
436     Data.TexAlign.Compressed.Depth                 = 1;
437     Data.TexAlign.Depth.Width                      = 4; // See usage for 16bpp HALIGN_8 special-casing.
438     Data.TexAlign.Depth.Height                     = 4;
439     Data.TexAlign.Depth_D16_UNORM_1x_4x_16x.Width  = 8;
440     Data.TexAlign.Depth_D16_UNORM_1x_4x_16x.Height = Data.TexAlign.Depth.Height;
441     Data.TexAlign.Depth_D16_UNORM_2x_8x.Width      = 8;
442     Data.TexAlign.Depth_D16_UNORM_2x_8x.Height     = Data.TexAlign.Depth.Height;
443     Data.TexAlign.SeparateStencil.Width            = 8;
444     Data.TexAlign.SeparateStencil.Height           = 8;
445     Data.TexAlign.YUV422.Width                     = 4;
446     Data.TexAlign.YUV422.Height                    = 4;
447     Data.TexAlign.AllOther.Width                   = 16; // HALIGN_16 required for non-MSAA RT's for CCS Fast-Clear and...TBA
448     Data.TexAlign.AllOther.Height                  = 4;  // VALIGN_4 should be sufficent.
449     Data.TexAlign.XAdapter.Height                  = D3DKMT_CROSS_ADAPTER_RESOURCE_HEIGHT_ALIGNMENT;
450     Data.TexAlign.XAdapter.Width                   = 1; //minimum should be one.
451 
452     // ----------------------------------
453     // SURFACE_STATE YOffset Granularity
454     // ----------------------------------
455     Data.SurfaceStateYOffsetGranularity = 4;
456     Data.SamplerFetchGranularityHeight  = 4;
457     Data.SamplerFetchGranularityWidth   = 4;
458 
459     // ----------------------------------
460     // Restrictions for Cross adapter resource
461     // ----------------------------------
462     Data.XAdapter.Alignment            = GMM_KBYTE(64); //64KB for DX12/StdSwizzle--Not worth special-casing.
463     Data.XAdapter.PitchAlignment       = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT);
464     Data.XAdapter.RenderPitchAlignment = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT);
465     Data.XAdapter.LockPitchAlignment   = GMM_BYTES(D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT);
466     Data.XAdapter.MinPitch             = GMM_BYTES(32);
467     Data.XAdapter.MaxPitch             = (pGmmLibContext->GetWaTable().WaRestrictPitch128KB) ? GMM_KBYTE(128) : GMM_KBYTE(256);
468     Data.XAdapter.MinAllocationSize    = PAGE_SIZE;
469     Data.XAdapter.MinHeight            = GMM_SCANLINES(1);
470     Data.XAdapter.MinWidth             = GMM_PIXELS(1);
471     Data.XAdapter.MinDepth             = 0;
472     Data.XAdapter.MaxHeight            = GMM_KBYTE(16);
473     Data.XAdapter.MaxWidth             = GMM_KBYTE(16);
474     Data.XAdapter.MaxDepth             = GMM_FIELD_NA;
475     Data.XAdapter.MaxArraySize         = GMM_KBYTE(2);
476 
477     //---------------------------------------------
478     //MaxSize for any surface type
479     //---------------------------------------------
480     Data.SurfaceMaxSize                      = GMM_GBYTE(256);
481     Data.MaxGpuVirtualAddressBitsPerResource = 38;
482 
483     if(GFX_IS_PRODUCT(Data.Platform, IGFX_KABYLAKE) ||
484        GFX_IS_PRODUCT(Data.Platform, IGFX_COFFEELAKE))
485     {
486         Data.MaxSLMSize = GMM_KBYTE(960);
487     }
488     else
489     {
490         Data.MaxSLMSize = GMM_KBYTE(576);
491     }
492 
493     Data.HiZPixelsPerByte = 2;
494 
495     Data.ReconMaxHeight = Data.Texture2DSurface.MaxHeight; // Reconstructed surfaces require more height and width for higher resolutions.
496     Data.ReconMaxWidth  = Data.Texture2DSurface.MaxWidth;
497 
498     Data.NoOfBitsSupported                = 39;
499     Data.HighestAcceptablePhysicalAddress = GFX_MASK_LARGE(0, 38);
500 }
501