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 #pragma once
23
24 #include "External/Common/GmmInternal.h" // UMD or KMD Windows header
25 #include "External/Common/GmmTextureExt.h"
26 #include "External/Common/GmmUtil.h"
27 #include "External/Common/GmmInfoExt.h"
28 #include "External/Common/GmmInfo.h"
29 #include "External/Common/GmmProto.h"
30 #ifdef __cplusplus
31 #include "Internal/Common/Texture/GmmTextureCalc.h"
32 //---------------------------------------------------------------------------
33 // ExpandWidth/Height Wrappers
34 //
35 // Gen7+ MSAA (non-Depth/Stencil) render targets use array expansion instead of
36 // Width/Height expansion--So they pass NumSamples=1 to __GmmExpandXxx functions.
37 //
38 //---------------------------------------------------------------------------
39 #define __GMM_EXPAND_Xxx(ptr, Xxx, Dimension, UnitAlignment, pTexInfo) \
40 (ptr)->Expand##Xxx( \
41 (Dimension), (UnitAlignment), \
42 ((pTexInfo)->Flags.Gpu.Depth || (pTexInfo)->Flags.Gpu.SeparateStencil) ? \
43 (pTexInfo)->MSAA.NumSamples : 1)
44
45 #define __GMM_EXPAND_WIDTH(ptr, __Width, UnitAlignment, pTexInfo) \
46 __GMM_EXPAND_Xxx(ptr, Width, __Width, UnitAlignment, pTexInfo)
47
48 #define __GMM_EXPAND_HEIGHT(ptr, __Height, UnitAlignment, pTexInfo) \
49 __GMM_EXPAND_Xxx(ptr, Height, __Height, UnitAlignment, pTexInfo)
50
51 //=============================================================================
52 //Function:
53 // __GmmTexFillHAlignVAlign
54 //
55 //Description:
56 // Stores in pTexInfo the appropriate unit aligment sizes.
57 //
58 //-----------------------------------------------------------------------------
59 // Gmmlib 2.0 TODO[Low] Move to Class and Inline function handling.
__GmmTexFillHAlignVAlign(GMM_TEXTURE_INFO * pTexInfo,GMM_LIB_CONTEXT * pGmmLibContext)60 GMM_INLINE GMM_STATUS __GmmTexFillHAlignVAlign(GMM_TEXTURE_INFO *pTexInfo,GMM_LIB_CONTEXT* pGmmLibContext)
61 {
62 uint32_t UnitAlignWidth = 0;
63 uint32_t UnitAlignHeight = 0;
64 uint32_t UnitAlignDepth = 0;
65 const GMM_PLATFORM_INFO *pPlatform;
66 GMM_TEXTURE_CALC *pTextureCalc;
67
68 GMM_DPF_ENTER;
69 __GMM_ASSERTPTR(pGmmLibContext,GMM_ERROR);
70
71 __GMM_ASSERTPTR(pTexInfo, GMM_ERROR);
72
73 #define SET_ALIGN_FACTOR(Xxx, Bytes) \
74 if(!pGmmLibContext->GetSkuTable().FtrTileY) \
75 { \
76 UnitAlign##Xxx = \
77 (pTexInfo->BitsPerPixel == 128) ? Bytes/16 : \
78 (pTexInfo->BitsPerPixel == 64) ? Bytes/8 : \
79 (pTexInfo->BitsPerPixel == 32) ? Bytes/4 : \
80 (pTexInfo->BitsPerPixel == 16) ? Bytes/2 : Bytes ; \
81 \
82 if(!pTexInfo->Flags.Info.Linear && \
83 (pTexInfo->BitsPerPixel == 24 || pTexInfo->BitsPerPixel == 48 || pTexInfo->BitsPerPixel == 96)) \
84 { \
85 UnitAlign##Xxx = 16; \
86 } \
87 else if (pTexInfo->Flags.Info.Linear && \
88 (pTexInfo->BitsPerPixel == 24 || pTexInfo->BitsPerPixel == 48 || pTexInfo->BitsPerPixel == 96))\
89 { \
90 UnitAlign##Xxx = 128; \
91 } \
92 }
93
94
95 if (!((pTexInfo->Format > GMM_FORMAT_INVALID) &&
96 (pTexInfo->Format < GMM_RESOURCE_FORMATS)))
97 {
98 GMM_DPF_CRITICAL("Invalid Resource Format");
99 return GMM_ERROR;
100 }
101
102 if( !pTexInfo->Alignment.HAlign &&
103 !pTexInfo->Alignment.VAlign)
104 {
105 pPlatform = GMM_OVERRIDE_PLATFORM_INFO(pTexInfo,pGmmLibContext);
106 pTextureCalc = GMM_OVERRIDE_TEXTURE_CALC(pTexInfo,pGmmLibContext);
107
108 /// SKL TiledYf/Ys Surfaces //////////////////////////////////////////
109 if( ((GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN9_CORE) &&
110 (pTexInfo->Flags.Info.TiledYf || GMM_IS_64KB_TILE(pTexInfo->Flags))))
111 {
112 #define SET_ALIGN_INFO(Xxx, A1, A2, A3, A4, A5) \
113 UnitAlign##Xxx = \
114 (pTexInfo->BitsPerPixel == 128) ? A1 : \
115 (pTexInfo->BitsPerPixel == 64) ? A2 : \
116 (pTexInfo->BitsPerPixel == 32) ? A3 : \
117 (pTexInfo->BitsPerPixel == 16) ? A4 : A5; \
118
119 if(pTexInfo->Type == RESOURCE_1D)
120 {
121 if(pTexInfo->Flags.Info.TiledYf)
122 {
123 SET_ALIGN_INFO(Width, 256, 512, 1024, 2048, 4096);
124 }
125 else // if(pTexInfo->Flags.Info.TiledYs)
126 {
127 SET_ALIGN_INFO(Width, 4096, 8192, 16384, 32768, 65536);
128 }
129 }
130 else if((pTexInfo->Type == RESOURCE_2D) || (pTexInfo->Type == RESOURCE_CUBE) ||
131 (pTexInfo->Type == RESOURCE_PRIMARY))
132 {
133 if(pTexInfo->Flags.Info.TiledYf)
134 {
135 SET_ALIGN_INFO(Width, 16, 32, 32, 64, 64);
136 SET_ALIGN_INFO(Height, 16, 16, 32, 32, 64);
137 }
138 else // if(pTexInfo->Flags.Info.TiledYs)
139 {
140 SET_ALIGN_INFO(Width, 64, 128, 128, 256, 256);
141 SET_ALIGN_INFO(Height, 64, 64, 128, 128, 256);
142 }
143
144 // Only color buffer MSAA
145 if(pTexInfo->MSAA.NumSamples > 1 &&
146 !pTexInfo->Flags.Gpu.Depth &&
147 !pTexInfo->Flags.Gpu.SeparateStencil)
148 {
149 if(pGmmLibContext->GetSkuTable().FtrTileY)
150 {
151 switch(pTexInfo->MSAA.NumSamples)
152 {
153 case 16:
154 UnitAlignWidth /= 4;
155 UnitAlignHeight /= 4;
156 break;
157 case 8:
158 UnitAlignWidth /= 4;
159 UnitAlignHeight /= 2;
160 break;
161 case 4:
162 UnitAlignWidth /= 2;
163 UnitAlignHeight /= 2;
164 break;
165 case 2:
166 UnitAlignWidth /= 2;
167 break;
168 default:
169 __GMM_ASSERT(0);
170 }
171 }
172 else
173 {
174 if (pGmmLibContext->GetSkuTable().FtrXe2PlusTiling)
175 {
176 switch (pTexInfo->MSAA.NumSamples)
177 {
178 case 16:
179 if (pTexInfo->BitsPerPixel == 64)
180 {
181 UnitAlignWidth /= 8;
182 UnitAlignHeight /= 2;
183 }
184 else
185 {
186 UnitAlignWidth /= 4;
187 UnitAlignHeight /= 4;
188 }
189 break;
190 case 8:
191 if ((pTexInfo->BitsPerPixel == 8) || (pTexInfo->BitsPerPixel == 32))
192 {
193 UnitAlignWidth /= 2;
194 UnitAlignHeight /= 4;
195 }
196 else
197 {
198 UnitAlignWidth /= 4;
199 UnitAlignHeight /= 2;
200 }
201 break;
202 case 4:
203 UnitAlignWidth /= 2;
204 UnitAlignHeight /= 2;
205 break;
206 case 2:
207 if (pTexInfo->BitsPerPixel == 128)
208 {
209 UnitAlignHeight /= 2;
210 }
211 else
212 {
213 UnitAlignWidth /= 2;
214 }
215 break;
216 default:
217 __GMM_ASSERT(0);
218 }
219 }
220 else
221 {
222 switch (pTexInfo->MSAA.NumSamples)
223 {
224 case 4:
225 case 8:
226 case 16:
227 UnitAlignWidth /= 2;
228 UnitAlignHeight /= 2;
229 break;
230 case 2:
231 UnitAlignWidth /= 2;
232 break;
233 default:
234 __GMM_ASSERT(0);
235 }
236 }
237 }
238 }
239 }
240 else if(pTexInfo->Type == RESOURCE_3D)
241 {
242 if(pTexInfo->Flags.Info.TiledYf)
243 {
244 SET_ALIGN_INFO(Width, 4, 8, 8, 8, 16);
245 SET_ALIGN_INFO(Height, 8, 8, 16, 16, 16);
246 SET_ALIGN_INFO(Depth, 8, 8, 8, 16, 16);
247 }
248 else // if(pTexInfo->Flags.Info.TiledYs)
249 {
250 SET_ALIGN_INFO(Width, 16, 32, 32, 32, 64);
251 SET_ALIGN_INFO(Height, 16, 16, 32, 32, 32);
252 SET_ALIGN_INFO(Depth, 16, 16, 16, 32, 32);
253 }
254 }
255
256 #undef SET_ALIGN_INFO
257 if(GmmIsCompressed(pGmmLibContext, pTexInfo->Format))
258 {
259 uint32_t ElementWidth, ElementHeight, ElementDepth;
260 pTextureCalc->GetCompressionBlockDimensions(pTexInfo->Format, &ElementWidth, &ElementHeight, &ElementDepth);
261
262 UnitAlignWidth *= ElementWidth;
263 UnitAlignHeight *= ElementHeight;
264 UnitAlignDepth *= ElementDepth;
265 }
266 }
267 /// SKL 1D Surfaces ///////////////////////////////////////////////
268 else if((GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN9_CORE) &&
269 (pTexInfo->Type == RESOURCE_1D))
270 {
271 UnitAlignWidth = 64;
272
273 // Tile4/64
274 SET_ALIGN_FACTOR(Width, 128);
275 }
276 /// CCS ///////////////////////////////////////////////////////////
277 else if (pTexInfo->Flags.Gpu.CCS &&
278 (pTexInfo->Flags.Gpu.__NonMsaaTileYCcs || pTexInfo->Flags.Gpu.__NonMsaaTileXCcs))
279 {
280 UnitAlignWidth = pPlatform->TexAlign.CCS.Align.Width;
281 UnitAlignHeight = pPlatform->TexAlign.CCS.Align.Height;
282
283 ALIGNMENT UnitAlign = { UnitAlignWidth , UnitAlignHeight, UnitAlignDepth };
284 pGmmLibContext->GetPlatformInfoObj()->ApplyExtendedTexAlign(pTexInfo->CCSModeAlign, UnitAlign);
285
286 if (UnitAlign.Width != UnitAlignWidth ||
287 UnitAlign.Height != UnitAlignHeight ||
288 UnitAlign.Depth != UnitAlignDepth)
289 {
290 UnitAlignWidth = UnitAlign.Width;
291 UnitAlignHeight = UnitAlign.Height;
292 UnitAlignDepth = UnitAlign.Depth;
293 }
294 }
295 else if (GmmIsYUVPacked(pTexInfo->Format)) /////////////////////////
296 {
297 UnitAlignWidth = pPlatform->TexAlign.YUV422.Width;
298 UnitAlignHeight = pPlatform->TexAlign.YUV422.Height;
299
300 // For packed 8/16-bit formats alignment factor of 4 will give us < 16B so expand to 32B
301
302 if (pTexInfo->Flags.Info.Linear)
303 {
304 SET_ALIGN_FACTOR(Width, 128);
305 }
306 else
307 {
308 SET_ALIGN_FACTOR(Width, 32);
309 }
310 }
311 else if(GmmIsCompressed(pGmmLibContext, pTexInfo->Format)) /////////////////////////////
312 {
313 uint32_t ElementWidth, ElementHeight, ElementDepth;
314
315 pTextureCalc->GetCompressionBlockDimensions(pTexInfo->Format, &ElementWidth, &ElementHeight, &ElementDepth);
316
317 UnitAlignWidth = ElementWidth * pPlatform->TexAlign.Compressed.Width;
318
319 UnitAlignHeight = ElementHeight * pPlatform->TexAlign.Compressed.Height;
320
321 UnitAlignDepth = (pTexInfo->Type == RESOURCE_3D) ? ElementDepth * pPlatform->TexAlign.Compressed.Depth : pPlatform->TexAlign.Compressed.Depth;
322
323 }
324 /// Depth Buffer //////////////////////////////////////////////////
325 else if(pTexInfo->Flags.Gpu.HiZ)
326 {
327 if( (GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN7_CORE) &&
328 (pTexInfo->BitsPerPixel == 16))
329 {
330 UnitAlignWidth = 8; // Gen7 Special Case: HALIGN_8 for 16bpp Depth Buffers
331 }
332 else
333 {
334 UnitAlignWidth = pPlatform->TexAlign.Depth.Width;
335 }
336
337 UnitAlignHeight = pPlatform->TexAlign.Depth.Height;
338 }
339 else if (pTexInfo->Flags.Gpu.Depth)
340 {
341 if (pTexInfo->BitsPerPixel == 16)
342 {
343 if (pTexInfo->MSAA.NumSamples == 0x2 || pTexInfo->MSAA.NumSamples == 0x8)
344 {
345 UnitAlignWidth = pPlatform->TexAlign.Depth_D16_UNORM_2x_8x.Width;
346 UnitAlignHeight = pPlatform->TexAlign.Depth_D16_UNORM_2x_8x.Height;
347 }
348 else
349 {
350 UnitAlignWidth = pPlatform->TexAlign.Depth_D16_UNORM_1x_4x_16x.Width;
351 UnitAlignHeight = pPlatform->TexAlign.Depth_D16_UNORM_1x_4x_16x.Height;
352 }
353
354 SET_ALIGN_FACTOR(Width, 16);
355
356 }
357 else
358 {
359 UnitAlignWidth = pPlatform->TexAlign.Depth.Width;
360 UnitAlignHeight = pPlatform->TexAlign.Depth.Height;
361
362 SET_ALIGN_FACTOR(Width, 32);
363 }
364 }
365 /// Separate Stencil //////////////////////////////////////////////
366 else if(pTexInfo->Flags.Gpu.SeparateStencil)
367 {
368 UnitAlignWidth = pPlatform->TexAlign.SeparateStencil.Width;
369 UnitAlignHeight = pPlatform->TexAlign.SeparateStencil.Height;
370
371 SET_ALIGN_FACTOR(Width, 16);
372
373 }
374 /// Cross Adapter //////////////////////////////////////////////
375 else if(pTexInfo->Flags.Info.XAdapter)
376 {
377 //Add cross adapter height restriction.
378 UnitAlignHeight = pPlatform->TexAlign.XAdapter.Height;
379 UnitAlignWidth = pPlatform->TexAlign.XAdapter.Width;
380
381 SET_ALIGN_FACTOR(Width, 128);
382
383 __GMM_ASSERT(pTexInfo->MaxLod == 0);
384 }
385 else if(((pTexInfo->Flags.Gpu.MCS &&
386 GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN12_CORE) ||
387 (pTexInfo->Flags.Gpu.CCS && GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN9_CORE)) &&
388 (pTexInfo->MSAA.NumSamples > 1))
389 {
390 UnitAlignWidth = 16;
391 UnitAlignHeight = 4;
392
393 SET_ALIGN_FACTOR(Width, 128);
394 }
395 else if(pTexInfo->Flags.Wa.__ForceOtherHVALIGN4)
396 {
397 UnitAlignWidth = 4;
398 UnitAlignHeight = 4;
399 }
400 else /// All Other ////////////////////////////////////////////////
401 {
402 UnitAlignWidth = pPlatform->TexAlign.AllOther.Width;
403
404 if(GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN8_CORE)
405 {
406 UnitAlignHeight = pPlatform->TexAlign.AllOther.Height;
407
408 // Let VAlign = 16, when bpp == 8 or 16 for both TileX and TileY on BDW
409 if ((GmmGetWaTable(pGmmLibContext)->WaUseVAlign16OnTileXYBpp816) &&
410 (pTexInfo->BitsPerPixel == 8 || pTexInfo->BitsPerPixel == 16) &&
411 (pTexInfo->Flags.Info.TiledX || pTexInfo->Flags.Info.TiledY))
412 {
413 UnitAlignHeight = 16;
414 }
415
416 if((GmmGetWaTable(pGmmLibContext)->Wa32bppTileY2DColorNoHAlign4) &&
417 (pTexInfo->BitsPerPixel == 32 && pTexInfo->Flags.Info.TiledY &&
418 pTexInfo->MSAA.NumSamples == 1 && pTexInfo->MaxLod > 1) &&
419 UnitAlignWidth <= 4)
420 {
421 UnitAlignWidth = 8;
422 }
423
424 SET_ALIGN_FACTOR(Width, 128);
425 }
426 else if(pTexInfo->MSAA.NumSamples <= 1)
427 {
428 if ((GmmGetWaTable(pGmmLibContext)->WaValign2For96bppFormats) &&
429 ( pTexInfo->BitsPerPixel == 96 ) )
430 {
431 UnitAlignHeight = 2;
432 }
433 else if ((GmmGetWaTable(pGmmLibContext)->WaValign2ForR8G8B8UINTFormat) &&
434 ( pTexInfo->Format == GMM_FORMAT_R8G8B8_UINT ) )
435 {
436 UnitAlignHeight = 2;
437 }
438 else
439 {
440 UnitAlignHeight = pPlatform->TexAlign.AllOther.Height;
441 }
442 }
443 else
444 {
445 UnitAlignHeight = 4; // Gen6+ Special Case: VALIGN_4 for >= MSAA_4X Render Targets
446 }
447 }
448
449 //ExistingSysMem override
450 if(pTexInfo->Flags.Info.ExistingSysMem &&
451 !pTexInfo->ExistingSysMem.IsGmmAllocated &&
452 !pTexInfo->ExistingSysMem.IsPageAligned)
453 {
454 if(pTexInfo->Flags.Gpu.Texture)
455 {
456 UnitAlignWidth = pPlatform->SamplerFetchGranularityWidth;
457 UnitAlignHeight = pPlatform->SamplerFetchGranularityHeight;
458 }
459 else if(pTexInfo->Flags.Gpu.RenderTarget)
460 {
461 UnitAlignWidth = (GmmIsYUVPlanar(pTexInfo->Format)) ? 2 : 1;
462 UnitAlignHeight = 1;
463 }
464 }
465
466 pTexInfo->Alignment.HAlign = UnitAlignWidth;
467 pTexInfo->Alignment.VAlign = UnitAlignHeight;
468 pTexInfo->Alignment.DAlign = UnitAlignDepth;
469 }
470 else
471 {
472 // Don't reinitialize b/c special-case ResCreates (e.g. MCS) need the
473 // values from their first pass through here to stick (but they'll come
474 // through here more than once, with different parameters).
475 }
476
477 GMM_DPF_EXIT;
478 return GMM_SUCCESS;
479 } // __GmmTexFillHAlignVAlign
480 #endif //__cpluscplus
481 //===========================================================================
482 // typedef:
483 // GMM_MIPTAIL_SLOT_OFFSET_REC
484 //
485 // Description:
486 // This structure used to describe the offset between miptail slot and
487 // miptail starting address
488 //---------------------------------------------------------------------------
489 typedef struct GMM_MIPTAIL_SLOT_OFFSET_REC
490 {
491 uint32_t X;
492 uint32_t Y;
493 uint32_t Z;
494 }GMM_MIPTAIL_SLOT_OFFSET;
495
496 #define GEN9_MIPTAIL_SLOT_OFFSET_1D_SURFACE { \
497 /* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
498 { { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 }, { 32768, 0, 0 } }, \
499 { { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 } }, \
500 { { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 } }, \
501 { { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 } }, \
502 { { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 } }, \
503 { { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 } }, \
504 { { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 } }, \
505 { { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 } }, \
506 { { 28, 0, 0 }, { 56, 0, 0 }, { 112, 0, 0 }, { 224, 0, 0 }, { 448, 0, 0 } }, \
507 { { 24, 0, 0 }, { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 } }, \
508 { { 20, 0, 0 }, { 40, 0, 0 }, { 80, 0, 0 }, { 160, 0, 0 }, { 320, 0, 0 } }, \
509 { { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 } }, \
510 { { 12, 0, 0 }, { 24, 0, 0 }, { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 } }, \
511 { { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 } }, \
512 { { 4, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 } }, \
513 { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
514 }
515
516 #define GEN9_MIPTAIL_SLOT_OFFSET_2D_SURFACE { \
517 /* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */\
518 { { 32, 0, 0 }, { 64, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 128, 0, 0 } }, \
519 { { 0, 32, 0 }, { 0, 32, 0 }, { 0, 64, 0 }, { 0, 64, 0 }, { 0, 128, 0 } }, \
520 { { 16, 0, 0 }, { 32, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 64, 0, 0 } }, \
521 { { 0, 16, 0 }, { 0, 16, 0 }, { 0, 32, 0 }, { 0, 32, 0 }, { 0, 64, 0 } }, \
522 { { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 32, 0, 0 } }, \
523 { { 4, 8, 0 }, { 8, 8, 0 }, { 8, 16, 0 }, { 16, 16, 0 }, { 16, 32, 0 } }, \
524 { { 0, 12, 0 }, { 0, 12, 0 }, { 0, 24, 0 }, { 0, 24, 0 }, { 0, 48, 0 } }, \
525 { { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 32, 0 } }, \
526 { { 4, 4, 0 }, { 8, 4, 0 }, { 8, 8, 0 }, { 16, 8, 0 }, { 16, 16, 0 } }, \
527 { { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 } }, \
528 { { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 } }, \
529 { { 3, 0, 0 }, { 6, 0, 0 }, { 4, 4, 0 }, { 8, 4, 0 }, { 0, 12, 0 } }, \
530 { { 2, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 8, 0, 0 }, { 0, 8, 0 } }, \
531 { { 1, 0, 0 }, { 2, 0, 0 }, { 0, 4, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
532 { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
533 }
534
535 #define GEN9_MIPTAIL_SLOT_OFFSET_3D_SURFACE { \
536 /* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
537 { { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 } }, \
538 { { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 16, 0 } }, \
539 { { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 16 }, { 0, 0, 16 } }, \
540 { { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 } }, \
541 { { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 8, 0 } }, \
542 { { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 8 }, { 0, 0, 8 } }, \
543 { { 3, 0, 0 }, { 6, 0, 0 }, { 4, 4, 0 }, { 0, 4, 4 }, { 0, 4, 4 } }, \
544 { { 2, 0, 0 }, { 4, 0, 0 }, { 0, 4, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
545 { { 1, 0, 3 }, { 2, 0, 3 }, { 4, 0, 3 }, { 0, 0, 7 }, { 0, 0, 7 } }, \
546 { { 1, 0, 2 }, { 2, 0, 2 }, { 4, 0, 2 }, { 0, 0, 6 }, { 0, 0, 6 } }, \
547 { { 1, 0, 1 }, { 2, 0, 1 }, { 4, 0, 1 }, { 0, 0, 5 }, { 0, 0, 5 } }, \
548 { { 1, 0, 0 }, { 2, 0, 0 }, { 4, 0, 0 }, { 0, 0, 4 }, { 0, 0, 4 } }, \
549 { { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 } }, \
550 { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 } }, \
551 { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 } }, \
552 { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
553 }
554
555 #define GEN10_MIPTAIL_SLOT_OFFSET_1D_SURFACE { \
556 /* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
557 { { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 }, { 32768, 0, 0 } }, \
558 { { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 } }, \
559 { { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 } }, \
560 { { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 } }, \
561 { { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 } }, \
562 { { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 }, { 1536, 0, 0 } }, \
563 { { 80, 0, 0 }, { 160, 0, 0 }, { 320, 0, 0 }, { 640, 0, 0 }, { 1280, 0, 0 } }, \
564 { { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 } }, \
565 { { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 } }, \
566 { { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 } }, \
567 { { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 } }, \
568 { { 12, 0, 0 }, { 24, 0, 0 }, { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 } }, \
569 { { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 } }, \
570 { { 4, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 } }, \
571 { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
572 }
573
574 #define GEN10_MIPTAIL_SLOT_OFFSET_2D_SURFACE { \
575 /* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
576 { { 32, 0, 0 }, { 64, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 128, 0, 0 } }, \
577 { { 0, 32, 0 }, { 0, 32, 0 }, { 0, 64, 0 }, { 0, 64, 0 }, { 0, 128, 0 } }, \
578 { { 16, 0, 0 }, { 32, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 64, 0, 0 } }, \
579 { { 0, 16, 0 }, { 0, 16, 0 }, { 0, 32, 0 }, { 0, 32, 0 }, { 0, 64, 0 } }, \
580 { { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 32, 0, 0 } }, \
581 { { 4, 8, 0 }, { 8, 8, 0 }, { 8, 16, 0 }, { 16, 16, 0 }, { 16, 32, 0 } }, \
582 { { 0, 12, 0 }, { 0, 12, 0 }, { 0, 24, 0 }, { 0, 24, 0 }, { 0, 48, 0 } }, \
583 { { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 32, 0 } }, \
584 { { 4, 4, 0 }, { 8, 4, 0 }, { 8, 8, 0 }, { 16, 8, 0 }, { 16, 16, 0 } }, \
585 { { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 } }, \
586 { { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 } }, \
587 { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
588 { { 1, 0, 0 }, { 2, 0, 0 }, { 0, 4, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
589 { { 2, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 8, 0, 0 }, { 0, 8, 0 } }, \
590 { { 3, 0, 0 }, { 6, 0, 0 }, { 4, 4, 0 }, { 8, 4, 0 }, { 0, 12, 0 } }, \
591 }
592
593 #define GEN10_MIPTAIL_SLOT_OFFSET_3D_SURFACE { \
594 /* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
595 { { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 } }, \
596 { { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 16, 0 } }, \
597 { { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 16 }, { 0, 0, 16 } }, \
598 { { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 } }, \
599 { { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 8, 0 } }, \
600 { { 2, 0, 4 }, { 4, 0, 4 }, { 4, 0, 4 }, { 4, 0, 8 }, { 8, 0, 8 } }, \
601 { { 0, 2, 4 }, { 0, 2, 4 }, { 0, 4, 4 }, { 0, 4, 8 }, { 0, 4, 8 } }, \
602 { { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 8 }, { 0, 0, 8 } }, \
603 { { 2, 2, 0 }, { 4, 2, 0 }, { 4, 4, 0 }, { 4, 4, 0 }, { 8, 4, 0 } }, \
604 { { 2, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 8, 0, 0 } }, \
605 { { 0, 2, 0 }, { 0, 2, 0 }, { 0, 4, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
606 { { 1, 0, 2 }, { 2, 0, 2 }, { 2, 0, 2 }, { 2, 0, 4 }, { 4, 0, 4 } }, \
607 { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 4 }, { 0, 0, 4 } }, \
608 { { 1, 0, 0 }, { 2, 0, 0 }, { 2, 0, 0 }, { 2, 0, 0 }, { 4, 0, 0 } }, \
609 { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
610 }
611
612 #define GEN11_MIPTAIL_SLOT_OFFSET_1D_SURFACE { \
613 /* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
614 { { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 }, { 32768, 0, 0 } }, \
615 { { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 }, { 16384, 0, 0 } }, \
616 { { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 }, { 8192, 0, 0 } }, \
617 { { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 }, { 4096, 0, 0 } }, \
618 { { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 }, { 2048, 0, 0 } }, \
619 { { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 }, { 1536, 0, 0 } }, \
620 { { 80, 0, 0 }, { 160, 0, 0 }, { 320, 0, 0 }, { 640, 0, 0 }, { 1280, 0, 0 } }, \
621 { { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 }, { 1024, 0, 0 } }, \
622 { { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 }, { 384, 0, 0 }, { 768, 0, 0 } }, \
623 { { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 }, { 512, 0, 0 } }, \
624 { { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 }, { 256, 0, 0 } }, \
625 { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
626 { { 4, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 } }, \
627 { { 8, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 }, { 64, 0, 0 }, { 128, 0, 0 } }, \
628 { { 12, 0, 0 }, { 24, 0, 0 }, { 48, 0, 0 }, { 96, 0, 0 }, { 192, 0, 0 } }, \
629 }
630
631 #define GEN11_MIPTAIL_SLOT_OFFSET_2D_SURFACE GEN10_MIPTAIL_SLOT_OFFSET_2D_SURFACE
632
633 #define GEN11_MIPTAIL_SLOT_OFFSET_3D_SURFACE { \
634 /* | 128 bpe | 64 bpe | 32 bpe | 16 bpe | 8 bpe | */ \
635 { { 8, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 16, 0, 0 }, { 32, 0, 0 } }, \
636 { { 0, 8, 0 }, { 0, 8, 0 }, { 0, 16, 0 }, { 0, 16, 0 }, { 0, 16, 0 } }, \
637 { { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 8 }, { 0, 0, 16 }, { 0, 0, 16 } }, \
638 { { 4, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 8, 0, 0 }, { 16, 0, 0 } }, \
639 { { 0, 4, 0 }, { 0, 4, 0 }, { 0, 8, 0 }, { 0, 8, 0 }, { 0, 8, 0 } }, \
640 { { 2, 0, 4 }, { 4, 0, 4 }, { 4, 0, 4 }, { 0, 4, 8 }, { 0, 4, 8 } }, \
641 { { 1, 0, 4 }, { 2, 0, 4 }, { 0, 4, 4 }, { 0, 0, 12 }, { 0, 0, 12 } }, \
642 { { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 4 }, { 0, 0, 8 }, { 0, 0, 8 } }, \
643 { { 3, 0, 0 }, { 6, 0, 0 }, { 4, 4, 0 }, { 0, 4, 4 }, { 0, 4, 4 } }, \
644 { { 2, 0, 0 }, { 4, 0, 0 }, { 4, 0, 0 }, { 0, 4, 0 }, { 0, 4, 0 } }, \
645 { { 1, 0, 0 }, { 2, 0, 0 }, { 0, 4, 0 }, { 0, 0, 4 }, { 0, 0, 4 } }, \
646 { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, \
647 { { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 }, { 0, 0, 1 } }, \
648 { { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 }, { 0, 0, 2 } }, \
649 { { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 }, { 0, 0, 3 } }, \
650 }
651