1/* 2 * Copyright (C) 2016 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 (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 25/* Instructions, enums and structures for CTG. 26 * 27 * This file has been generated, do not hand edit. 28 */ 29 30#ifndef GFX45_PACK_H 31#define GFX45_PACK_H 32 33#include <stdio.h> 34#include <stdint.h> 35#include <stdbool.h> 36#include <assert.h> 37#include <math.h> 38 39#ifndef __gen_validate_value 40#define __gen_validate_value(x) 41#endif 42 43#ifndef __intel_field_functions 44#define __intel_field_functions 45 46#ifdef NDEBUG 47#define NDEBUG_UNUSED __attribute__((unused)) 48#else 49#define NDEBUG_UNUSED 50#endif 51 52union __intel_value { 53 float f; 54 uint32_t dw; 55}; 56 57static inline __attribute__((always_inline)) uint64_t 58__gen_mbo(uint32_t start, uint32_t end) 59{ 60 return (~0ull >> (64 - (end - start + 1))) << start; 61} 62 63static inline __attribute__((always_inline)) uint64_t 64__gen_uint(uint64_t v, uint32_t start, NDEBUG_UNUSED uint32_t end) 65{ 66 __gen_validate_value(v); 67 68#ifndef NDEBUG 69 const int width = end - start + 1; 70 if (width < 64) { 71 const uint64_t max = (1ull << width) - 1; 72 assert(v <= max); 73 } 74#endif 75 76 return v << start; 77} 78 79static inline __attribute__((always_inline)) uint64_t 80__gen_sint(int64_t v, uint32_t start, uint32_t end) 81{ 82 const int width = end - start + 1; 83 84 __gen_validate_value(v); 85 86#ifndef NDEBUG 87 if (width < 64) { 88 const int64_t max = (1ll << (width - 1)) - 1; 89 const int64_t min = -(1ll << (width - 1)); 90 assert(min <= v && v <= max); 91 } 92#endif 93 94 const uint64_t mask = ~0ull >> (64 - width); 95 96 return (v & mask) << start; 97} 98 99static inline __attribute__((always_inline)) uint64_t 100__gen_offset(uint64_t v, NDEBUG_UNUSED uint32_t start, NDEBUG_UNUSED uint32_t end) 101{ 102 __gen_validate_value(v); 103#ifndef NDEBUG 104 uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start; 105 106 assert((v & ~mask) == 0); 107#endif 108 109 return v; 110} 111 112static inline __attribute__((always_inline)) uint64_t 113__gen_address(__gen_user_data *data, void *location, 114 __gen_address_type address, uint32_t delta, 115 __attribute__((unused)) uint32_t start, uint32_t end) 116{ 117 uint64_t addr_u64 = __gen_combine_address(data, location, address, delta); 118 if (end == 31) { 119 return addr_u64; 120 } else if (end < 63) { 121 const unsigned shift = 63 - end; 122 return (addr_u64 << shift) >> shift; 123 } else { 124 return addr_u64; 125 } 126} 127 128static inline __attribute__((always_inline)) uint32_t 129__gen_float(float v) 130{ 131 __gen_validate_value(v); 132 return ((union __intel_value) { .f = (v) }).dw; 133} 134 135static inline __attribute__((always_inline)) uint64_t 136__gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits) 137{ 138 __gen_validate_value(v); 139 140 const float factor = (1 << fract_bits); 141 142#ifndef NDEBUG 143 const float max = ((1 << (end - start)) - 1) / factor; 144 const float min = -(1 << (end - start)) / factor; 145 assert(min <= v && v <= max); 146#endif 147 148 const int64_t int_val = llroundf(v * factor); 149 const uint64_t mask = ~0ull >> (64 - (end - start + 1)); 150 151 return (int_val & mask) << start; 152} 153 154static inline __attribute__((always_inline)) uint64_t 155__gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits) 156{ 157 __gen_validate_value(v); 158 159 const float factor = (1 << fract_bits); 160 161#ifndef NDEBUG 162 const float max = ((1 << (end - start + 1)) - 1) / factor; 163 const float min = 0.0f; 164 assert(min <= v && v <= max); 165#endif 166 167 const uint64_t uint_val = llroundf(v * factor); 168 169 return uint_val << start; 170} 171 172#ifndef __gen_address_type 173#error #define __gen_address_type before including this file 174#endif 175 176#ifndef __gen_user_data 177#error #define __gen_combine_address before including this file 178#endif 179 180#undef NDEBUG_UNUSED 181 182#endif 183 184 185enum GFX45_3D_Color_Buffer_Blend_Factor { 186 BLENDFACTOR_ONE = 1, 187 BLENDFACTOR_SRC_COLOR = 2, 188 BLENDFACTOR_SRC_ALPHA = 3, 189 BLENDFACTOR_DST_ALPHA = 4, 190 BLENDFACTOR_DST_COLOR = 5, 191 BLENDFACTOR_SRC_ALPHA_SATURATE = 6, 192 BLENDFACTOR_CONST_COLOR = 7, 193 BLENDFACTOR_CONST_ALPHA = 8, 194 BLENDFACTOR_SRC1_COLOR = 9, 195 BLENDFACTOR_SRC1_ALPHA = 10, 196 BLENDFACTOR_ZERO = 17, 197 BLENDFACTOR_INV_SRC_COLOR = 18, 198 BLENDFACTOR_INV_SRC_ALPHA = 19, 199 BLENDFACTOR_INV_DST_ALPHA = 20, 200 BLENDFACTOR_INV_DST_COLOR = 21, 201 BLENDFACTOR_INV_CONST_COLOR = 23, 202 BLENDFACTOR_INV_CONST_ALPHA = 24, 203 BLENDFACTOR_INV_SRC1_COLOR = 25, 204 BLENDFACTOR_INV_SRC1_ALPHA = 26, 205}; 206 207enum GFX45_3D_Color_Buffer_Blend_Function { 208 BLENDFUNCTION_ADD = 0, 209 BLENDFUNCTION_SUBTRACT = 1, 210 BLENDFUNCTION_REVERSE_SUBTRACT = 2, 211 BLENDFUNCTION_MIN = 3, 212 BLENDFUNCTION_MAX = 4, 213}; 214 215enum GFX45_3D_Compare_Function { 216 COMPAREFUNCTION_ALWAYS = 0, 217 COMPAREFUNCTION_NEVER = 1, 218 COMPAREFUNCTION_LESS = 2, 219 COMPAREFUNCTION_EQUAL = 3, 220 COMPAREFUNCTION_LEQUAL = 4, 221 COMPAREFUNCTION_GREATER = 5, 222 COMPAREFUNCTION_NOTEQUAL = 6, 223 COMPAREFUNCTION_GEQUAL = 7, 224}; 225 226enum GFX45_3D_Logic_Op_Function { 227 LOGICOP_CLEAR = 0, 228 LOGICOP_NOR = 1, 229 LOGICOP_AND_INVERTED = 2, 230 LOGICOP_COPY_INVERTED = 3, 231 LOGICOP_AND_REVERSE = 4, 232 LOGICOP_INVERT = 5, 233 LOGICOP_XOR = 6, 234 LOGICOP_NAND = 7, 235 LOGICOP_AND = 8, 236 LOGICOP_EQUIV = 9, 237 LOGICOP_NOOP = 10, 238 LOGICOP_OR_INVERTED = 11, 239 LOGICOP_COPY = 12, 240 LOGICOP_OR_REVERSE = 13, 241 LOGICOP_OR = 14, 242 LOGICOP_SET = 15, 243}; 244 245enum GFX45_3D_Prim_Topo_Type { 246 _3DPRIM_POINTLIST = 1, 247 _3DPRIM_LINELIST = 2, 248 _3DPRIM_LINESTRIP = 3, 249 _3DPRIM_TRILIST = 4, 250 _3DPRIM_TRISTRIP = 5, 251 _3DPRIM_TRIFAN = 6, 252 _3DPRIM_QUADLIST = 7, 253 _3DPRIM_QUADSTRIP = 8, 254 _3DPRIM_LINELIST_ADJ = 9, 255 _3DPRIM_LINESTRIP_ADJ = 10, 256 _3DPRIM_TRILIST_ADJ = 11, 257 _3DPRIM_TRISTRIP_ADJ = 12, 258 _3DPRIM_TRISTRIP_REVERSE = 13, 259 _3DPRIM_POLYGON = 14, 260 _3DPRIM_RECTLIST = 15, 261 _3DPRIM_LINELOOP = 16, 262 _3DPRIM_POINTLIST_BF = 17, 263 _3DPRIM_LINESTRIP_CONT = 18, 264 _3DPRIM_LINESTRIP_BF = 19, 265 _3DPRIM_LINESTRIP_CONT_BF = 20, 266 _3DPRIM_TRIFAN_NOSTIPPLE = 22, 267}; 268 269enum GFX45_3D_Stencil_Operation { 270 STENCILOP_KEEP = 0, 271 STENCILOP_ZERO = 1, 272 STENCILOP_REPLACE = 2, 273 STENCILOP_INCRSAT = 3, 274 STENCILOP_DECRSAT = 4, 275 STENCILOP_INCR = 5, 276 STENCILOP_DECR = 6, 277 STENCILOP_INVERT = 7, 278}; 279 280enum GFX45_3D_Vertex_Component_Control { 281 VFCOMP_NOSTORE = 0, 282 VFCOMP_STORE_SRC = 1, 283 VFCOMP_STORE_0 = 2, 284 VFCOMP_STORE_1_FP = 3, 285 VFCOMP_STORE_1_INT = 4, 286 VFCOMP_STORE_VID = 5, 287 VFCOMP_STORE_IID = 6, 288 VFCOMP_STORE_PID = 7, 289}; 290 291enum GFX45_Texture_Coordinate_Mode { 292 TCM_WRAP = 0, 293 TCM_MIRROR = 1, 294 TCM_CLAMP = 2, 295 TCM_CUBE = 3, 296 TCM_CLAMP_BORDER = 4, 297 TCM_MIRROR_ONCE = 5, 298}; 299 300#define GFX45_CC_VIEWPORT_length 2 301struct GFX45_CC_VIEWPORT { 302 float MinimumDepth; 303 float MaximumDepth; 304}; 305 306static inline __attribute__((always_inline)) void 307GFX45_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data, 308 __attribute__((unused)) void * restrict dst, 309 __attribute__((unused)) const struct GFX45_CC_VIEWPORT * restrict values) 310{ 311 uint32_t * restrict dw = (uint32_t * restrict) dst; 312 313 dw[0] = 314 __gen_float(values->MinimumDepth); 315 316 dw[1] = 317 __gen_float(values->MaximumDepth); 318} 319 320#define GFX45_CLIP_STATE_length 11 321struct GFX45_CLIP_STATE { 322 uint32_t GRFRegisterCount; 323 __gen_address_type KernelStartPointer; 324 bool SoftwareExceptionEnable; 325 bool MaskStackExceptionEnable; 326 bool IllegalOpcodeExceptionEnable; 327 uint32_t FloatingPointMode; 328#define FLOATING_POINT_MODE_IEEE754 0 329#define FLOATING_POINT_MODE_Alternate 1 330 uint32_t ThreadPriority; 331#define NormalPriority 0 332#define HighPriority 1 333 uint32_t BindingTableEntryCount; 334 bool SingleProgramFlow; 335 uint32_t PerThreadScratchSpace; 336 __gen_address_type ScratchSpaceBasePointer; 337 uint32_t DispatchGRFStartRegisterForURBData; 338 uint32_t VertexURBEntryReadOffset; 339 uint32_t VertexURBEntryReadLength; 340 uint32_t ConstantURBEntryReadOffset; 341 uint32_t ConstantURBEntryReadLength; 342 bool ClipperStatisticsEnable; 343 bool GSOutputObjectStatisticsEnable; 344 uint32_t NumberofURBEntries; 345 uint32_t URBEntryAllocationSize; 346 uint32_t MaximumNumberofThreads; 347 uint32_t ClipMode; 348#define CLIPMODE_NORMAL 0 349#define CLIPMODE_ALL 1 350#define CLIPMODE_CLIP_NON_REJECTED 2 351#define CLIPMODE_REJECT_ALL 3 352#define CLIPMODE_ACCEPT_ALL 4 353 uint32_t UserClipDistanceClipTestEnableBitmask; 354 bool UserClipFlagsMustClipEnable; 355 bool NegativeWClipTestEnable; 356 bool GuardbandClipTestEnable; 357 bool ViewportZClipTestEnable; 358 bool ViewportXYClipTestEnable; 359 uint32_t VertexPositionSpace; 360#define VPOS_NDCSPACE 0 361#define VPOS_SCREENSPACE 1 362 uint32_t APIMode; 363#define APIMODE_OGL 0 364#define APIMODE_D3D 1 365 __gen_address_type ClipperViewportStatePointer; 366 float ScreenSpaceViewportXMin; 367 float ScreenSpaceViewportXMax; 368 float ScreenSpaceViewportYMin; 369 float ScreenSpaceViewportYMax; 370}; 371 372static inline __attribute__((always_inline)) void 373GFX45_CLIP_STATE_pack(__attribute__((unused)) __gen_user_data *data, 374 __attribute__((unused)) void * restrict dst, 375 __attribute__((unused)) const struct GFX45_CLIP_STATE * restrict values) 376{ 377 uint32_t * restrict dw = (uint32_t * restrict) dst; 378 379 const uint32_t v0 = 380 __gen_uint(values->GRFRegisterCount, 1, 3); 381 dw[0] = __gen_address(data, &dw[0], values->KernelStartPointer, v0, 6, 31); 382 383 dw[1] = 384 __gen_uint(values->SoftwareExceptionEnable, 7, 7) | 385 __gen_uint(values->MaskStackExceptionEnable, 11, 11) | 386 __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) | 387 __gen_uint(values->FloatingPointMode, 16, 16) | 388 __gen_uint(values->ThreadPriority, 17, 17) | 389 __gen_uint(values->BindingTableEntryCount, 18, 25) | 390 __gen_uint(values->SingleProgramFlow, 31, 31); 391 392 const uint32_t v2 = 393 __gen_uint(values->PerThreadScratchSpace, 0, 3); 394 dw[2] = __gen_address(data, &dw[2], values->ScratchSpaceBasePointer, v2, 10, 31); 395 396 dw[3] = 397 __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) | 398 __gen_uint(values->VertexURBEntryReadOffset, 4, 9) | 399 __gen_uint(values->VertexURBEntryReadLength, 11, 16) | 400 __gen_uint(values->ConstantURBEntryReadOffset, 18, 23) | 401 __gen_uint(values->ConstantURBEntryReadLength, 25, 30); 402 403 dw[4] = 404 __gen_uint(values->ClipperStatisticsEnable, 10, 10) | 405 __gen_uint(values->GSOutputObjectStatisticsEnable, 10, 10) | 406 __gen_uint(values->NumberofURBEntries, 11, 18) | 407 __gen_uint(values->URBEntryAllocationSize, 19, 23) | 408 __gen_uint(values->MaximumNumberofThreads, 25, 30); 409 410 dw[5] = 411 __gen_uint(values->ClipMode, 13, 15) | 412 __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) | 413 __gen_uint(values->UserClipFlagsMustClipEnable, 24, 24) | 414 __gen_uint(values->NegativeWClipTestEnable, 25, 25) | 415 __gen_uint(values->GuardbandClipTestEnable, 26, 26) | 416 __gen_uint(values->ViewportZClipTestEnable, 27, 27) | 417 __gen_uint(values->ViewportXYClipTestEnable, 28, 28) | 418 __gen_uint(values->VertexPositionSpace, 29, 29) | 419 __gen_uint(values->APIMode, 30, 30); 420 421 dw[6] = __gen_address(data, &dw[6], values->ClipperViewportStatePointer, 0, 5, 31); 422 423 dw[7] = 424 __gen_float(values->ScreenSpaceViewportXMin); 425 426 dw[8] = 427 __gen_float(values->ScreenSpaceViewportXMax); 428 429 dw[9] = 430 __gen_float(values->ScreenSpaceViewportYMin); 431 432 dw[10] = 433 __gen_float(values->ScreenSpaceViewportYMax); 434} 435 436#define GFX45_CLIP_VIEWPORT_length 4 437struct GFX45_CLIP_VIEWPORT { 438 float XMinClipGuardband; 439 float XMaxClipGuardband; 440 float YMinClipGuardband; 441 float YMaxClipGuardband; 442}; 443 444static inline __attribute__((always_inline)) void 445GFX45_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data, 446 __attribute__((unused)) void * restrict dst, 447 __attribute__((unused)) const struct GFX45_CLIP_VIEWPORT * restrict values) 448{ 449 uint32_t * restrict dw = (uint32_t * restrict) dst; 450 451 dw[0] = 452 __gen_float(values->XMinClipGuardband); 453 454 dw[1] = 455 __gen_float(values->XMaxClipGuardband); 456 457 dw[2] = 458 __gen_float(values->YMinClipGuardband); 459 460 dw[3] = 461 __gen_float(values->YMaxClipGuardband); 462} 463 464#define GFX45_COLOR_CALC_STATE_length 8 465struct GFX45_COLOR_CALC_STATE { 466 enum GFX45_3D_Stencil_Operation BackfaceStencilPassDepthPassOp; 467 enum GFX45_3D_Stencil_Operation BackfaceStencilPassDepthFailOp; 468 enum GFX45_3D_Stencil_Operation BackfaceStencilFailOp; 469 enum GFX45_3D_Compare_Function BackfaceStencilTestFunction; 470 bool DoubleSidedStencilEnable; 471 bool StencilBufferWriteEnable; 472 enum GFX45_3D_Stencil_Operation StencilPassDepthPassOp; 473 enum GFX45_3D_Stencil_Operation StencilPassDepthFailOp; 474 enum GFX45_3D_Stencil_Operation StencilFailOp; 475 enum GFX45_3D_Compare_Function StencilTestFunction; 476 bool StencilTestEnable; 477 uint32_t BackfaceStencilReferenceValue; 478 uint32_t StencilWriteMask; 479 uint32_t StencilTestMask; 480 uint32_t StencilReferenceValue; 481 bool LogicOpEnable; 482 bool DepthBufferWriteEnable; 483 enum GFX45_3D_Compare_Function DepthTestFunction; 484 bool DepthTestEnable; 485 uint32_t BackfaceStencilWriteMask; 486 uint32_t BackfaceStencilTestMask; 487 enum GFX45_3D_Compare_Function AlphaTestFunction; 488 bool AlphaTestEnable; 489 bool ColorBufferBlendEnable; 490 bool IndependentAlphaBlendEnable; 491 uint32_t AlphaTestFormat; 492#define ALPHATEST_UNORM8 0 493#define ALPHATEST_FLOAT32 1 494 __gen_address_type CCViewportStatePointer; 495 enum GFX45_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor; 496 enum GFX45_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor; 497 enum GFX45_3D_Color_Buffer_Blend_Function AlphaBlendFunction; 498 bool StatisticsEnable; 499 enum GFX45_3D_Logic_Op_Function LogicOpFunction; 500 bool RoundDisableFunctionDisable; 501 bool ColorDitherEnable; 502 bool PostBlendColorClampEnable; 503 bool PreBlendColorClampEnable; 504 uint32_t ColorClampRange; 505#define COLORCLAMP_UNORM 0 506#define COLORCLAMP_SNORM 1 507#define COLORCLAMP_RTFORMAT 2 508 uint32_t YDitherOffset; 509 uint32_t XDitherOffset; 510 enum GFX45_3D_Color_Buffer_Blend_Factor DestinationBlendFactor; 511 enum GFX45_3D_Color_Buffer_Blend_Factor SourceBlendFactor; 512 enum GFX45_3D_Color_Buffer_Blend_Function ColorBlendFunction; 513 uint32_t AlphaReferenceValueAsUNORM8; 514 float AlphaReferenceValueAsFLOAT32; 515}; 516 517static inline __attribute__((always_inline)) void 518GFX45_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data, 519 __attribute__((unused)) void * restrict dst, 520 __attribute__((unused)) const struct GFX45_COLOR_CALC_STATE * restrict values) 521{ 522 uint32_t * restrict dw = (uint32_t * restrict) dst; 523 524 dw[0] = 525 __gen_uint(values->BackfaceStencilPassDepthPassOp, 3, 5) | 526 __gen_uint(values->BackfaceStencilPassDepthFailOp, 6, 8) | 527 __gen_uint(values->BackfaceStencilFailOp, 9, 11) | 528 __gen_uint(values->BackfaceStencilTestFunction, 12, 14) | 529 __gen_uint(values->DoubleSidedStencilEnable, 15, 15) | 530 __gen_uint(values->StencilBufferWriteEnable, 18, 18) | 531 __gen_uint(values->StencilPassDepthPassOp, 19, 21) | 532 __gen_uint(values->StencilPassDepthFailOp, 22, 24) | 533 __gen_uint(values->StencilFailOp, 25, 27) | 534 __gen_uint(values->StencilTestFunction, 28, 30) | 535 __gen_uint(values->StencilTestEnable, 31, 31); 536 537 dw[1] = 538 __gen_uint(values->BackfaceStencilReferenceValue, 0, 7) | 539 __gen_uint(values->StencilWriteMask, 8, 15) | 540 __gen_uint(values->StencilTestMask, 16, 23) | 541 __gen_uint(values->StencilReferenceValue, 24, 31); 542 543 dw[2] = 544 __gen_uint(values->LogicOpEnable, 0, 0) | 545 __gen_uint(values->DepthBufferWriteEnable, 11, 11) | 546 __gen_uint(values->DepthTestFunction, 12, 14) | 547 __gen_uint(values->DepthTestEnable, 15, 15) | 548 __gen_uint(values->BackfaceStencilWriteMask, 16, 23) | 549 __gen_uint(values->BackfaceStencilTestMask, 24, 31); 550 551 dw[3] = 552 __gen_uint(values->AlphaTestFunction, 8, 10) | 553 __gen_uint(values->AlphaTestEnable, 11, 11) | 554 __gen_uint(values->ColorBufferBlendEnable, 12, 12) | 555 __gen_uint(values->IndependentAlphaBlendEnable, 13, 13) | 556 __gen_uint(values->AlphaTestFormat, 15, 15); 557 558 dw[4] = __gen_address(data, &dw[4], values->CCViewportStatePointer, 0, 5, 31); 559 560 dw[5] = 561 __gen_uint(values->DestinationAlphaBlendFactor, 2, 6) | 562 __gen_uint(values->SourceAlphaBlendFactor, 7, 11) | 563 __gen_uint(values->AlphaBlendFunction, 12, 14) | 564 __gen_uint(values->StatisticsEnable, 15, 15) | 565 __gen_uint(values->LogicOpFunction, 16, 19) | 566 __gen_uint(values->RoundDisableFunctionDisable, 30, 30) | 567 __gen_uint(values->ColorDitherEnable, 31, 31); 568 569 dw[6] = 570 __gen_uint(values->PostBlendColorClampEnable, 0, 0) | 571 __gen_uint(values->PreBlendColorClampEnable, 1, 1) | 572 __gen_uint(values->ColorClampRange, 2, 3) | 573 __gen_uint(values->YDitherOffset, 15, 16) | 574 __gen_uint(values->XDitherOffset, 17, 18) | 575 __gen_uint(values->DestinationBlendFactor, 19, 23) | 576 __gen_uint(values->SourceBlendFactor, 24, 28) | 577 __gen_uint(values->ColorBlendFunction, 29, 31); 578 579 dw[7] = 580 __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) | 581 __gen_float(values->AlphaReferenceValueAsFLOAT32); 582} 583 584#define GFX45_GS_STATE_length 7 585struct GFX45_GS_STATE { 586 uint32_t GRFRegisterCount; 587 __gen_address_type KernelStartPointer; 588 bool SoftwareExceptionEnable; 589 bool MaskStackExceptionEnable; 590 bool IllegalOpcodeExceptionEnable; 591 uint32_t FloatingPointMode; 592#define FLOATING_POINT_MODE_IEEE754 0 593#define FLOATING_POINT_MODE_Alternate 1 594 uint32_t BindingTableEntryCount; 595 bool SingleProgramFlow; 596 uint32_t PerThreadScratchSpace; 597 __gen_address_type ScratchSpaceBasePointer; 598 uint32_t DispatchGRFStartRegisterForURBData; 599 uint32_t VertexURBEntryReadOffset; 600 uint32_t VertexURBEntryReadLength; 601 uint32_t ConstantURBEntryReadOffset; 602 uint32_t ConstantURBEntryReadLength; 603 bool RenderingEnable; 604 bool GSStatisticsEnable; 605 uint32_t NumberofURBEntries; 606 uint32_t URBEntryAllocationSize; 607 uint32_t MaximumNumberofThreads; 608 uint32_t SamplerCount; 609 __gen_address_type SamplerStatePointer; 610 uint32_t MaximumVPIndex; 611 bool DiscardAdjacency; 612 bool ReorderEnable; 613}; 614 615static inline __attribute__((always_inline)) void 616GFX45_GS_STATE_pack(__attribute__((unused)) __gen_user_data *data, 617 __attribute__((unused)) void * restrict dst, 618 __attribute__((unused)) const struct GFX45_GS_STATE * restrict values) 619{ 620 uint32_t * restrict dw = (uint32_t * restrict) dst; 621 622 const uint32_t v0 = 623 __gen_uint(values->GRFRegisterCount, 1, 3); 624 dw[0] = __gen_address(data, &dw[0], values->KernelStartPointer, v0, 6, 31); 625 626 dw[1] = 627 __gen_uint(values->SoftwareExceptionEnable, 7, 7) | 628 __gen_uint(values->MaskStackExceptionEnable, 11, 11) | 629 __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) | 630 __gen_uint(values->FloatingPointMode, 16, 16) | 631 __gen_uint(values->BindingTableEntryCount, 18, 25) | 632 __gen_uint(values->SingleProgramFlow, 31, 31); 633 634 const uint32_t v2 = 635 __gen_uint(values->PerThreadScratchSpace, 0, 3); 636 dw[2] = __gen_address(data, &dw[2], values->ScratchSpaceBasePointer, v2, 10, 31); 637 638 dw[3] = 639 __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) | 640 __gen_uint(values->VertexURBEntryReadOffset, 4, 9) | 641 __gen_uint(values->VertexURBEntryReadLength, 11, 16) | 642 __gen_uint(values->ConstantURBEntryReadOffset, 18, 23) | 643 __gen_uint(values->ConstantURBEntryReadLength, 25, 30); 644 645 dw[4] = 646 __gen_uint(values->RenderingEnable, 8, 8) | 647 __gen_uint(values->GSStatisticsEnable, 10, 10) | 648 __gen_uint(values->NumberofURBEntries, 11, 18) | 649 __gen_uint(values->URBEntryAllocationSize, 19, 23) | 650 __gen_uint(values->MaximumNumberofThreads, 25, 30); 651 652 const uint32_t v5 = 653 __gen_uint(values->SamplerCount, 0, 2); 654 dw[5] = __gen_address(data, &dw[5], values->SamplerStatePointer, v5, 5, 31); 655 656 dw[6] = 657 __gen_uint(values->MaximumVPIndex, 0, 3) | 658 __gen_uint(values->DiscardAdjacency, 29, 29) | 659 __gen_uint(values->ReorderEnable, 30, 30); 660} 661 662#define GFX45_RENDER_SURFACE_STATE_length 6 663struct GFX45_RENDER_SURFACE_STATE { 664 bool CubeFaceEnablePositiveZ; 665 bool CubeFaceEnableNegativeZ; 666 bool CubeFaceEnablePositiveY; 667 bool CubeFaceEnableNegativeY; 668 bool CubeFaceEnablePositiveX; 669 bool CubeFaceEnableNegativeX; 670 uint32_t MediaBoundaryPixelMode; 671#define NORMAL_MODE 0 672#define PROGRESSIVE_FRAME 2 673#define INTERLACED_FRAME 3 674 uint32_t RenderCacheReadWriteMode; 675#define WRITE_ONLY 0 676#define READ_WRITE 1 677 uint32_t MIPMapLayoutMode; 678#define MIPLAYOUT_BELOW 0 679#define MIPLAYOUT_RIGHT 1 680 uint32_t VerticalLineStrideOffset; 681 uint32_t VerticalLineStride; 682 bool ColorBlendEnable; 683 uint32_t ColorBufferComponentWriteDisables; 684#define WRITEDISABLE_ALPHA 8 685#define WRITEDISABLE_RED 4 686#define WRITEDISABLE_GREEN 2 687#define WRITEDISABLE_BLUE 1 688 uint32_t SurfaceFormat; 689 uint32_t DataReturnFormat; 690#define DATA_RETURN_FLOAT32 0 691#define DATA_RETURN_S114 1 692 uint32_t SurfaceType; 693#define SURFTYPE_1D 0 694#define SURFTYPE_2D 1 695#define SURFTYPE_3D 2 696#define SURFTYPE_CUBE 3 697#define SURFTYPE_BUFFER 4 698#define SURFTYPE_NULL 7 699 __gen_address_type SurfaceBaseAddress; 700 uint32_t MIPCountLOD; 701 uint32_t Width; 702 uint32_t Height; 703 uint32_t TileWalk; 704#define TILEWALK_XMAJOR 0 705#define TILEWALK_YMAJOR 1 706 uint32_t TiledSurface; 707 uint32_t SurfacePitch; 708 uint32_t Depth; 709 uint32_t RenderTargetViewExtent; 710 uint32_t MinimumArrayElement; 711 uint32_t SurfaceMinLOD; 712 uint32_t YOffset; 713 uint32_t XOffset; 714}; 715 716static inline __attribute__((always_inline)) void 717GFX45_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data, 718 __attribute__((unused)) void * restrict dst, 719 __attribute__((unused)) const struct GFX45_RENDER_SURFACE_STATE * restrict values) 720{ 721 uint32_t * restrict dw = (uint32_t * restrict) dst; 722 723 dw[0] = 724 __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) | 725 __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) | 726 __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) | 727 __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) | 728 __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) | 729 __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) | 730 __gen_uint(values->MediaBoundaryPixelMode, 6, 7) | 731 __gen_uint(values->RenderCacheReadWriteMode, 8, 8) | 732 __gen_uint(values->MIPMapLayoutMode, 10, 10) | 733 __gen_uint(values->VerticalLineStrideOffset, 11, 11) | 734 __gen_uint(values->VerticalLineStride, 12, 12) | 735 __gen_uint(values->ColorBlendEnable, 13, 13) | 736 __gen_uint(values->ColorBufferComponentWriteDisables, 14, 17) | 737 __gen_uint(values->SurfaceFormat, 18, 26) | 738 __gen_uint(values->DataReturnFormat, 27, 27) | 739 __gen_uint(values->SurfaceType, 29, 31); 740 741 dw[1] = __gen_address(data, &dw[1], values->SurfaceBaseAddress, 0, 0, 31); 742 743 dw[2] = 744 __gen_uint(values->MIPCountLOD, 2, 5) | 745 __gen_uint(values->Width, 6, 18) | 746 __gen_uint(values->Height, 19, 31); 747 748 dw[3] = 749 __gen_uint(values->TileWalk, 0, 0) | 750 __gen_uint(values->TiledSurface, 1, 1) | 751 __gen_uint(values->SurfacePitch, 3, 19) | 752 __gen_uint(values->Depth, 21, 31); 753 754 dw[4] = 755 __gen_uint(values->RenderTargetViewExtent, 8, 16) | 756 __gen_uint(values->MinimumArrayElement, 17, 27) | 757 __gen_uint(values->SurfaceMinLOD, 28, 31); 758 759 dw[5] = 760 __gen_uint(values->YOffset, 20, 23) | 761 __gen_uint(values->XOffset, 25, 31); 762} 763 764#define GFX45_SAMPLER_BORDER_COLOR_STATE_length 12 765struct GFX45_SAMPLER_BORDER_COLOR_STATE { 766 float BorderColorRed; 767 float BorderColorGreen; 768 float BorderColorBlue; 769 float BorderColorAlpha; 770}; 771 772static inline __attribute__((always_inline)) void 773GFX45_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data, 774 __attribute__((unused)) void * restrict dst, 775 __attribute__((unused)) const struct GFX45_SAMPLER_BORDER_COLOR_STATE * restrict values) 776{ 777 uint32_t * restrict dw = (uint32_t * restrict) dst; 778 779 dw[0] = 780 __gen_float(values->BorderColorRed); 781 782 dw[1] = 783 __gen_float(values->BorderColorGreen); 784 785 dw[2] = 786 __gen_float(values->BorderColorBlue); 787 788 dw[3] = 789 __gen_float(values->BorderColorAlpha); 790 791 dw[4] = 0; 792 793 dw[5] = 0; 794 795 dw[6] = 0; 796 797 dw[7] = 0; 798 799 dw[8] = 0; 800 801 dw[9] = 0; 802 803 dw[10] = 0; 804 805 dw[11] = 0; 806} 807 808#define GFX45_SAMPLER_STATE_length 4 809struct GFX45_SAMPLER_STATE { 810 uint32_t ShadowFunction; 811#define PREFILTEROP_ALWAYS 0 812#define PREFILTEROP_NEVER 1 813#define PREFILTEROP_LESS 2 814#define PREFILTEROP_EQUAL 3 815#define PREFILTEROP_LEQUAL 4 816#define PREFILTEROP_GREATER 5 817#define PREFILTEROP_NOTEQUAL 6 818#define PREFILTEROP_GEQUAL 7 819 float TextureLODBias; 820 uint32_t MinModeFilter; 821 uint32_t MagModeFilter; 822#define MAPFILTER_NEAREST 0 823#define MAPFILTER_LINEAR 1 824#define MAPFILTER_ANISOTROPIC 2 825#define MAPFILTER_MONO 6 826 uint32_t MipModeFilter; 827#define MIPFILTER_NONE 0 828#define MIPFILTER_NEAREST 1 829#define MIPFILTER_LINEAR 3 830 float BaseMipLevel; 831 bool LODPreClampEnable; 832 bool SamplerDisable; 833 enum GFX45_Texture_Coordinate_Mode TCZAddressControlMode; 834 enum GFX45_Texture_Coordinate_Mode TCYAddressControlMode; 835 enum GFX45_Texture_Coordinate_Mode TCXAddressControlMode; 836 uint32_t CubeSurfaceControlMode; 837#define CUBECTRLMODE_PROGRAMMED 0 838#define CUBECTRLMODE_OVERRIDE 1 839 float MaxLOD; 840 float MinLOD; 841 __gen_address_type BorderColorPointer; 842 bool RAddressMinFilterRoundingEnable; 843 bool RAddressMagFilterRoundingEnable; 844 bool VAddressMinFilterRoundingEnable; 845 bool VAddressMagFilterRoundingEnable; 846 bool UAddressMinFilterRoundingEnable; 847 bool UAddressMagFilterRoundingEnable; 848 uint32_t MaximumAnisotropy; 849#define RATIO21 0 850#define RATIO41 1 851#define RATIO61 2 852#define RATIO81 3 853#define RATIO101 4 854#define RATIO121 5 855#define RATIO141 6 856#define RATIO161 7 857 uint32_t ChromaKeyMode; 858#define KEYFILTER_KILL_ON_ANY_MATCH 0 859#define KEYFILTER_REPLACE_BLACK 1 860 uint32_t ChromaKeyIndex; 861 bool ChromaKeyEnable; 862 uint32_t MonochromeFilterWidth; 863 uint32_t MonochromeFilterHeight; 864}; 865 866static inline __attribute__((always_inline)) void 867GFX45_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data, 868 __attribute__((unused)) void * restrict dst, 869 __attribute__((unused)) const struct GFX45_SAMPLER_STATE * restrict values) 870{ 871 uint32_t * restrict dw = (uint32_t * restrict) dst; 872 873 dw[0] = 874 __gen_uint(values->ShadowFunction, 0, 2) | 875 __gen_sfixed(values->TextureLODBias, 3, 13, 6) | 876 __gen_uint(values->MinModeFilter, 14, 16) | 877 __gen_uint(values->MagModeFilter, 17, 19) | 878 __gen_uint(values->MipModeFilter, 20, 21) | 879 __gen_ufixed(values->BaseMipLevel, 22, 26, 1) | 880 __gen_uint(values->LODPreClampEnable, 28, 28) | 881 __gen_uint(values->SamplerDisable, 31, 31); 882 883 dw[1] = 884 __gen_uint(values->TCZAddressControlMode, 0, 2) | 885 __gen_uint(values->TCYAddressControlMode, 3, 5) | 886 __gen_uint(values->TCXAddressControlMode, 6, 8) | 887 __gen_uint(values->CubeSurfaceControlMode, 9, 9) | 888 __gen_ufixed(values->MaxLOD, 12, 21, 6) | 889 __gen_ufixed(values->MinLOD, 22, 31, 6); 890 891 dw[2] = __gen_address(data, &dw[2], values->BorderColorPointer, 0, 5, 31); 892 893 dw[3] = 894 __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) | 895 __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) | 896 __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) | 897 __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) | 898 __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) | 899 __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) | 900 __gen_uint(values->MaximumAnisotropy, 19, 21) | 901 __gen_uint(values->ChromaKeyMode, 22, 22) | 902 __gen_uint(values->ChromaKeyIndex, 23, 24) | 903 __gen_uint(values->ChromaKeyEnable, 25, 25) | 904 __gen_uint(values->MonochromeFilterWidth, 26, 28) | 905 __gen_uint(values->MonochromeFilterHeight, 29, 31); 906} 907 908#define GFX45_SCISSOR_RECT_length 2 909struct GFX45_SCISSOR_RECT { 910 uint32_t ScissorRectangleXMin; 911 uint32_t ScissorRectangleYMin; 912 uint32_t ScissorRectangleXMax; 913 uint32_t ScissorRectangleYMax; 914}; 915 916static inline __attribute__((always_inline)) void 917GFX45_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data, 918 __attribute__((unused)) void * restrict dst, 919 __attribute__((unused)) const struct GFX45_SCISSOR_RECT * restrict values) 920{ 921 uint32_t * restrict dw = (uint32_t * restrict) dst; 922 923 dw[0] = 924 __gen_uint(values->ScissorRectangleXMin, 0, 15) | 925 __gen_uint(values->ScissorRectangleYMin, 16, 31); 926 927 dw[1] = 928 __gen_uint(values->ScissorRectangleXMax, 0, 15) | 929 __gen_uint(values->ScissorRectangleYMax, 16, 31); 930} 931 932#define GFX45_SF_STATE_length 8 933struct GFX45_SF_STATE { 934 uint32_t GRFRegisterCount; 935 __gen_address_type KernelStartPointer; 936 bool SoftwareExceptionEnable; 937 bool MaskStackExceptionEnable; 938 bool IllegalOpcodeExceptionEnable; 939 uint32_t FloatingPointMode; 940#define FLOATING_POINT_MODE_IEEE754 0 941#define FLOATING_POINT_MODE_Alternate 1 942 uint32_t ThreadPriority; 943#define NormalPriority 0 944#define HighPriority 1 945 uint32_t BindingTableEntryCount; 946 bool SingleProgramFlow; 947 uint32_t PerThreadScratchSpace; 948 __gen_address_type ScratchSpaceBasePointer; 949 uint32_t DispatchGRFStartRegisterForURBData; 950 uint32_t VertexURBEntryReadOffset; 951 uint32_t VertexURBEntryReadLength; 952 uint32_t ConstantURBEntryReadOffset; 953 uint32_t ConstantURBEntryReadLength; 954 bool StatisticsEnable; 955 uint32_t NumberofURBEntries; 956 uint32_t URBEntryAllocationSize; 957 uint32_t MaximumNumberofThreads; 958 uint32_t FrontWinding; 959#define FRONTWINDING_CW 0 960#define FRONTWINDING_CCW 1 961 bool ViewportTransformEnable; 962 __gen_address_type SetupViewportStateOffset; 963 float DestinationOriginVerticalBias; 964 float DestinationOriginHorizontalBias; 965 bool ScissorRectangleEnable; 966 bool _2x2PixelTriangleFilterDisable; 967 bool ZeroPixelTriangleFilterDisable; 968 uint32_t PointRasterizationRule; 969#define RASTRULE_UPPER_LEFT 0 970#define RASTRULE_UPPER_RIGHT 1 971 uint32_t LineEndCapAntialiasingRegionWidth; 972#define _05pixels 0 973#define _10pixels 1 974#define _20pixels 2 975#define _40pixels 3 976 float LineWidth; 977 bool FastScissorClipDisable; 978 uint32_t CullMode; 979#define CULLMODE_BOTH 0 980#define CULLMODE_NONE 1 981#define CULLMODE_FRONT 2 982#define CULLMODE_BACK 3 983 bool AntialiasingEnable; 984 float PointWidth; 985 uint32_t PointWidthSource; 986#define Vertex 0 987#define State 1 988 uint32_t VertexSubPixelPrecisionSelect; 989#define _8SubPixelPrecisionBits 0 990#define _4SubPixelPrecisionBits 1 991 bool SpritePointEnable; 992 uint32_t AALineDistanceMode; 993#define AALINEDISTANCE_MANHATTAN 0 994#define AALINEDISTANCE_TRUE 1 995 uint32_t TriangleFanProvokingVertexSelect; 996#define Vertex0 0 997#define Vertex1 1 998#define Vertex2 2 999 uint32_t LineStripListProvokingVertexSelect; 1000#define Vertex0 0 1001#define Vertex1 1 1002 uint32_t TriangleStripListProvokingVertexSelect; 1003#define Vertex0 0 1004#define Vertex1 1 1005#define Vertex2 2 1006 bool LastPixelEnable; 1007}; 1008 1009static inline __attribute__((always_inline)) void 1010GFX45_SF_STATE_pack(__attribute__((unused)) __gen_user_data *data, 1011 __attribute__((unused)) void * restrict dst, 1012 __attribute__((unused)) const struct GFX45_SF_STATE * restrict values) 1013{ 1014 uint32_t * restrict dw = (uint32_t * restrict) dst; 1015 1016 const uint32_t v0 = 1017 __gen_uint(values->GRFRegisterCount, 1, 3); 1018 dw[0] = __gen_address(data, &dw[0], values->KernelStartPointer, v0, 6, 31); 1019 1020 dw[1] = 1021 __gen_uint(values->SoftwareExceptionEnable, 7, 7) | 1022 __gen_uint(values->MaskStackExceptionEnable, 11, 11) | 1023 __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) | 1024 __gen_uint(values->FloatingPointMode, 16, 16) | 1025 __gen_uint(values->ThreadPriority, 17, 17) | 1026 __gen_uint(values->BindingTableEntryCount, 18, 25) | 1027 __gen_uint(values->SingleProgramFlow, 31, 31); 1028 1029 const uint32_t v2 = 1030 __gen_uint(values->PerThreadScratchSpace, 0, 3); 1031 dw[2] = __gen_address(data, &dw[2], values->ScratchSpaceBasePointer, v2, 10, 31); 1032 1033 dw[3] = 1034 __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) | 1035 __gen_uint(values->VertexURBEntryReadOffset, 4, 9) | 1036 __gen_uint(values->VertexURBEntryReadLength, 11, 16) | 1037 __gen_uint(values->ConstantURBEntryReadOffset, 18, 23) | 1038 __gen_uint(values->ConstantURBEntryReadLength, 25, 30); 1039 1040 dw[4] = 1041 __gen_uint(values->StatisticsEnable, 10, 10) | 1042 __gen_uint(values->NumberofURBEntries, 11, 18) | 1043 __gen_uint(values->URBEntryAllocationSize, 19, 23) | 1044 __gen_uint(values->MaximumNumberofThreads, 25, 30); 1045 1046 const uint32_t v5 = 1047 __gen_uint(values->FrontWinding, 0, 0) | 1048 __gen_uint(values->ViewportTransformEnable, 1, 1); 1049 dw[5] = __gen_address(data, &dw[5], values->SetupViewportStateOffset, v5, 5, 31); 1050 1051 dw[6] = 1052 __gen_ufixed(values->DestinationOriginVerticalBias, 9, 12, 4) | 1053 __gen_ufixed(values->DestinationOriginHorizontalBias, 13, 16, 4) | 1054 __gen_uint(values->ScissorRectangleEnable, 17, 17) | 1055 __gen_uint(values->_2x2PixelTriangleFilterDisable, 18, 18) | 1056 __gen_uint(values->ZeroPixelTriangleFilterDisable, 19, 19) | 1057 __gen_uint(values->PointRasterizationRule, 20, 21) | 1058 __gen_uint(values->LineEndCapAntialiasingRegionWidth, 22, 23) | 1059 __gen_ufixed(values->LineWidth, 24, 27, 1) | 1060 __gen_uint(values->FastScissorClipDisable, 28, 28) | 1061 __gen_uint(values->CullMode, 29, 30) | 1062 __gen_uint(values->AntialiasingEnable, 31, 31); 1063 1064 dw[7] = 1065 __gen_ufixed(values->PointWidth, 0, 10, 3) | 1066 __gen_uint(values->PointWidthSource, 11, 11) | 1067 __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) | 1068 __gen_uint(values->SpritePointEnable, 13, 13) | 1069 __gen_uint(values->AALineDistanceMode, 14, 14) | 1070 __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) | 1071 __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) | 1072 __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) | 1073 __gen_uint(values->LastPixelEnable, 31, 31); 1074} 1075 1076#define GFX45_SF_VIEWPORT_length 8 1077struct GFX45_SF_VIEWPORT { 1078 float ViewportMatrixElementm00; 1079 float ViewportMatrixElementm11; 1080 float ViewportMatrixElementm22; 1081 float ViewportMatrixElementm30; 1082 float ViewportMatrixElementm31; 1083 float ViewportMatrixElementm32; 1084 struct GFX45_SCISSOR_RECT ScissorRectangle; 1085}; 1086 1087static inline __attribute__((always_inline)) void 1088GFX45_SF_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data, 1089 __attribute__((unused)) void * restrict dst, 1090 __attribute__((unused)) const struct GFX45_SF_VIEWPORT * restrict values) 1091{ 1092 uint32_t * restrict dw = (uint32_t * restrict) dst; 1093 1094 dw[0] = 1095 __gen_float(values->ViewportMatrixElementm00); 1096 1097 dw[1] = 1098 __gen_float(values->ViewportMatrixElementm11); 1099 1100 dw[2] = 1101 __gen_float(values->ViewportMatrixElementm22); 1102 1103 dw[3] = 1104 __gen_float(values->ViewportMatrixElementm30); 1105 1106 dw[4] = 1107 __gen_float(values->ViewportMatrixElementm31); 1108 1109 dw[5] = 1110 __gen_float(values->ViewportMatrixElementm32); 1111 1112 GFX45_SCISSOR_RECT_pack(data, &dw[6], &values->ScissorRectangle); 1113} 1114 1115#define GFX45_VERTEX_BUFFER_STATE_length 4 1116struct GFX45_VERTEX_BUFFER_STATE { 1117 uint32_t BufferPitch; 1118 uint32_t BufferAccessType; 1119#define VERTEXDATA 0 1120#define INSTANCEDATA 1 1121 uint32_t VertexBufferIndex; 1122 __gen_address_type BufferStartingAddress; 1123 uint32_t MaxIndex; 1124 uint32_t InstanceDataStepRate; 1125}; 1126 1127static inline __attribute__((always_inline)) void 1128GFX45_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data, 1129 __attribute__((unused)) void * restrict dst, 1130 __attribute__((unused)) const struct GFX45_VERTEX_BUFFER_STATE * restrict values) 1131{ 1132 uint32_t * restrict dw = (uint32_t * restrict) dst; 1133 1134 dw[0] = 1135 __gen_uint(values->BufferPitch, 0, 10) | 1136 __gen_uint(values->BufferAccessType, 26, 26) | 1137 __gen_uint(values->VertexBufferIndex, 27, 31); 1138 1139 dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 31); 1140 1141 dw[2] = 1142 __gen_uint(values->MaxIndex, 0, 31); 1143 1144 dw[3] = 1145 __gen_uint(values->InstanceDataStepRate, 0, 31); 1146} 1147 1148#define GFX45_VERTEX_ELEMENT_STATE_length 2 1149struct GFX45_VERTEX_ELEMENT_STATE { 1150 uint32_t SourceElementOffset; 1151 uint32_t SourceElementFormat; 1152 bool Valid; 1153 uint32_t VertexBufferIndex; 1154 uint32_t DestinationElementOffset; 1155 enum GFX45_3D_Vertex_Component_Control Component3Control; 1156 enum GFX45_3D_Vertex_Component_Control Component2Control; 1157 enum GFX45_3D_Vertex_Component_Control Component1Control; 1158 enum GFX45_3D_Vertex_Component_Control Component0Control; 1159}; 1160 1161static inline __attribute__((always_inline)) void 1162GFX45_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data, 1163 __attribute__((unused)) void * restrict dst, 1164 __attribute__((unused)) const struct GFX45_VERTEX_ELEMENT_STATE * restrict values) 1165{ 1166 uint32_t * restrict dw = (uint32_t * restrict) dst; 1167 1168 dw[0] = 1169 __gen_uint(values->SourceElementOffset, 0, 10) | 1170 __gen_uint(values->SourceElementFormat, 16, 24) | 1171 __gen_uint(values->Valid, 26, 26) | 1172 __gen_uint(values->VertexBufferIndex, 27, 31); 1173 1174 dw[1] = 1175 __gen_uint(values->DestinationElementOffset, 0, 7) | 1176 __gen_uint(values->Component3Control, 16, 18) | 1177 __gen_uint(values->Component2Control, 20, 22) | 1178 __gen_uint(values->Component1Control, 24, 26) | 1179 __gen_uint(values->Component0Control, 28, 30); 1180} 1181 1182#define GFX45_VS_STATE_length 7 1183struct GFX45_VS_STATE { 1184 uint32_t GRFRegisterCount; 1185 __gen_address_type KernelStartPointer; 1186 bool SoftwareExceptionEnable; 1187 bool MaskStackExceptionEnable; 1188 bool IllegalOpcodeExceptionEnable; 1189 uint32_t FloatingPointMode; 1190#define FLOATING_POINT_MODE_IEEE754 0 1191#define FLOATING_POINT_MODE_Alternate 1 1192 uint32_t ThreadPriority; 1193#define NormalPriority 0 1194#define HighPriority 1 1195 uint32_t BindingTableEntryCount; 1196 bool SingleProgramFlow; 1197 uint32_t PerThreadScratchSpace; 1198 __gen_address_type ScratchSpaceBasePointer; 1199 uint32_t DispatchGRFStartRegisterForURBData; 1200 uint32_t VertexURBEntryReadOffset; 1201 uint32_t VertexURBEntryReadLength; 1202 uint32_t ConstantURBEntryReadOffset; 1203 uint32_t ConstantURBEntryReadLength; 1204 bool StatisticsEnable; 1205 uint32_t NumberofURBEntries; 1206 uint32_t URBEntryAllocationSize; 1207 uint32_t MaximumNumberofThreads; 1208 uint32_t SamplerCount; 1209 __gen_address_type SamplerStatePointer; 1210 bool Enable; 1211 bool VertexCacheDisable; 1212}; 1213 1214static inline __attribute__((always_inline)) void 1215GFX45_VS_STATE_pack(__attribute__((unused)) __gen_user_data *data, 1216 __attribute__((unused)) void * restrict dst, 1217 __attribute__((unused)) const struct GFX45_VS_STATE * restrict values) 1218{ 1219 uint32_t * restrict dw = (uint32_t * restrict) dst; 1220 1221 const uint32_t v0 = 1222 __gen_uint(values->GRFRegisterCount, 1, 3); 1223 dw[0] = __gen_address(data, &dw[0], values->KernelStartPointer, v0, 6, 31); 1224 1225 dw[1] = 1226 __gen_uint(values->SoftwareExceptionEnable, 7, 7) | 1227 __gen_uint(values->MaskStackExceptionEnable, 11, 11) | 1228 __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) | 1229 __gen_uint(values->FloatingPointMode, 16, 16) | 1230 __gen_uint(values->ThreadPriority, 17, 17) | 1231 __gen_uint(values->BindingTableEntryCount, 18, 25) | 1232 __gen_uint(values->SingleProgramFlow, 31, 31); 1233 1234 const uint32_t v2 = 1235 __gen_uint(values->PerThreadScratchSpace, 0, 3); 1236 dw[2] = __gen_address(data, &dw[2], values->ScratchSpaceBasePointer, v2, 10, 31); 1237 1238 dw[3] = 1239 __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) | 1240 __gen_uint(values->VertexURBEntryReadOffset, 4, 9) | 1241 __gen_uint(values->VertexURBEntryReadLength, 11, 16) | 1242 __gen_uint(values->ConstantURBEntryReadOffset, 18, 23) | 1243 __gen_uint(values->ConstantURBEntryReadLength, 25, 30); 1244 1245 dw[4] = 1246 __gen_uint(values->StatisticsEnable, 10, 10) | 1247 __gen_uint(values->NumberofURBEntries, 11, 18) | 1248 __gen_uint(values->URBEntryAllocationSize, 19, 23) | 1249 __gen_uint(values->MaximumNumberofThreads, 25, 30); 1250 1251 const uint32_t v5 = 1252 __gen_uint(values->SamplerCount, 0, 2); 1253 dw[5] = __gen_address(data, &dw[5], values->SamplerStatePointer, v5, 5, 31); 1254 1255 dw[6] = 1256 __gen_uint(values->Enable, 0, 0) | 1257 __gen_uint(values->VertexCacheDisable, 1, 1); 1258} 1259 1260#define GFX45_WM_STATE_length 8 1261struct GFX45_WM_STATE { 1262 uint32_t GRFRegisterCount0; 1263 __gen_address_type KernelStartPointer0; 1264 bool SoftwareExceptionEnable; 1265 bool MaskStackExceptionEnable; 1266 bool IllegalOpcodeExceptionEnable; 1267 uint32_t DepthCoefficientURBReadOffset; 1268 uint32_t FloatingPointMode; 1269#define FLOATING_POINT_MODE_IEEE754 0 1270#define FLOATING_POINT_MODE_Alternate 1 1271 uint32_t ThreadPriority; 1272#define Normal 0 1273#define High 1 1274 uint32_t BindingTableEntryCount; 1275 bool SingleProgramFlow; 1276 uint32_t PerThreadScratchSpace; 1277 __gen_address_type ScratchSpaceBasePointer; 1278 uint32_t DispatchGRFStartRegisterForConstantSetupData0; 1279 uint32_t SetupURBEntryReadOffset; 1280 uint32_t SetupURBEntryReadLength; 1281 uint32_t ConstantURBEntryReadOffset; 1282 uint32_t ConstantURBEntryReadLength; 1283 bool StatisticsEnable; 1284 uint32_t SamplerCount; 1285 __gen_address_type SamplerStatePointer; 1286 bool _8PixelDispatchEnable; 1287 bool _16PixelDispatchEnable; 1288 bool _32PixelDispatchEnable; 1289 bool Contiguous32PixelDispatchEnable; 1290 bool Contiguous64PixelDispatchEnable; 1291 bool LegacyGlobalDepthBiasEnable; 1292 bool LineStippleEnable; 1293 bool GlobalDepthOffsetEnable; 1294 bool PolygonStippleEnable; 1295 uint32_t LineAntialiasingRegionWidth; 1296#define _05pixels 0 1297#define _10pixels 1 1298#define _20pixels 2 1299#define _40pixels 3 1300 uint32_t LineEndCapAntialiasingRegionWidth; 1301#define _05pixels 0 1302#define _10pixels 1 1303#define _20pixels 2 1304#define _40pixels 3 1305 bool EarlyDepthTestEnable; 1306 bool ThreadDispatchEnable; 1307 bool PixelShaderUsesSourceDepth; 1308 bool PixelShaderComputedDepth; 1309 bool PixelShaderKillsPixel; 1310 bool LegacyDiamondLineRasterization; 1311 uint32_t MaximumNumberofThreads; 1312 float GlobalDepthOffsetConstant; 1313 float GlobalDepthOffsetScale; 1314}; 1315 1316static inline __attribute__((always_inline)) void 1317GFX45_WM_STATE_pack(__attribute__((unused)) __gen_user_data *data, 1318 __attribute__((unused)) void * restrict dst, 1319 __attribute__((unused)) const struct GFX45_WM_STATE * restrict values) 1320{ 1321 uint32_t * restrict dw = (uint32_t * restrict) dst; 1322 1323 const uint32_t v0 = 1324 __gen_uint(values->GRFRegisterCount0, 1, 3); 1325 dw[0] = __gen_address(data, &dw[0], values->KernelStartPointer0, v0, 6, 31); 1326 1327 dw[1] = 1328 __gen_uint(values->SoftwareExceptionEnable, 1, 1) | 1329 __gen_uint(values->MaskStackExceptionEnable, 2, 2) | 1330 __gen_uint(values->IllegalOpcodeExceptionEnable, 4, 4) | 1331 __gen_uint(values->DepthCoefficientURBReadOffset, 8, 13) | 1332 __gen_uint(values->FloatingPointMode, 16, 16) | 1333 __gen_uint(values->ThreadPriority, 17, 17) | 1334 __gen_uint(values->BindingTableEntryCount, 18, 25) | 1335 __gen_uint(values->SingleProgramFlow, 31, 31); 1336 1337 const uint32_t v2 = 1338 __gen_uint(values->PerThreadScratchSpace, 0, 3); 1339 dw[2] = __gen_address(data, &dw[2], values->ScratchSpaceBasePointer, v2, 10, 31); 1340 1341 dw[3] = 1342 __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 0, 3) | 1343 __gen_uint(values->SetupURBEntryReadOffset, 4, 9) | 1344 __gen_uint(values->SetupURBEntryReadLength, 11, 16) | 1345 __gen_uint(values->ConstantURBEntryReadOffset, 18, 23) | 1346 __gen_uint(values->ConstantURBEntryReadLength, 25, 30); 1347 1348 const uint32_t v4 = 1349 __gen_uint(values->StatisticsEnable, 0, 0) | 1350 __gen_uint(values->SamplerCount, 2, 4); 1351 dw[4] = __gen_address(data, &dw[4], values->SamplerStatePointer, v4, 5, 31); 1352 1353 dw[5] = 1354 __gen_uint(values->_8PixelDispatchEnable, 0, 0) | 1355 __gen_uint(values->_16PixelDispatchEnable, 1, 1) | 1356 __gen_uint(values->_32PixelDispatchEnable, 2, 2) | 1357 __gen_uint(values->Contiguous32PixelDispatchEnable, 3, 3) | 1358 __gen_uint(values->Contiguous64PixelDispatchEnable, 4, 4) | 1359 __gen_uint(values->LegacyGlobalDepthBiasEnable, 10, 10) | 1360 __gen_uint(values->LineStippleEnable, 11, 11) | 1361 __gen_uint(values->GlobalDepthOffsetEnable, 12, 12) | 1362 __gen_uint(values->PolygonStippleEnable, 13, 13) | 1363 __gen_uint(values->LineAntialiasingRegionWidth, 14, 15) | 1364 __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) | 1365 __gen_uint(values->EarlyDepthTestEnable, 18, 18) | 1366 __gen_uint(values->ThreadDispatchEnable, 19, 19) | 1367 __gen_uint(values->PixelShaderUsesSourceDepth, 20, 20) | 1368 __gen_uint(values->PixelShaderComputedDepth, 21, 21) | 1369 __gen_uint(values->PixelShaderKillsPixel, 22, 22) | 1370 __gen_uint(values->LegacyDiamondLineRasterization, 23, 23) | 1371 __gen_uint(values->MaximumNumberofThreads, 25, 31); 1372 1373 dw[6] = 1374 __gen_float(values->GlobalDepthOffsetConstant); 1375 1376 dw[7] = 1377 __gen_float(values->GlobalDepthOffsetScale); 1378} 1379 1380#define GFX45_3DPRIMITIVE_length 6 1381#define GFX45_3DPRIMITIVE_length_bias 2 1382#define GFX45_3DPRIMITIVE_header \ 1383 .DWordLength = 4, \ 1384 ._3DCommandSubOpcode = 0, \ 1385 ._3DCommandOpcode = 3, \ 1386 .CommandSubType = 3, \ 1387 .CommandType = 3 1388 1389struct GFX45_3DPRIMITIVE { 1390 uint32_t DWordLength; 1391 uint32_t IndirectVertexCount; 1392 enum GFX45_3D_Prim_Topo_Type PrimitiveTopologyType; 1393 uint32_t VertexAccessType; 1394#define SEQUENTIAL 0 1395#define RANDOM 1 1396 uint32_t _3DCommandSubOpcode; 1397 uint32_t _3DCommandOpcode; 1398 uint32_t CommandSubType; 1399 uint32_t CommandType; 1400 uint32_t VertexCountPerInstance; 1401 uint32_t StartVertexLocation; 1402 uint32_t InstanceCount; 1403 uint32_t StartInstanceLocation; 1404 int32_t BaseVertexLocation; 1405}; 1406 1407static inline __attribute__((always_inline)) void 1408GFX45_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data, 1409 __attribute__((unused)) void * restrict dst, 1410 __attribute__((unused)) const struct GFX45_3DPRIMITIVE * restrict values) 1411{ 1412 uint32_t * restrict dw = (uint32_t * restrict) dst; 1413 1414 dw[0] = 1415 __gen_uint(values->DWordLength, 0, 7) | 1416 __gen_uint(values->IndirectVertexCount, 9, 9) | 1417 __gen_uint(values->PrimitiveTopologyType, 10, 14) | 1418 __gen_uint(values->VertexAccessType, 15, 15) | 1419 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1420 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1421 __gen_uint(values->CommandSubType, 27, 28) | 1422 __gen_uint(values->CommandType, 29, 31); 1423 1424 dw[1] = 1425 __gen_uint(values->VertexCountPerInstance, 0, 31); 1426 1427 dw[2] = 1428 __gen_uint(values->StartVertexLocation, 0, 31); 1429 1430 dw[3] = 1431 __gen_uint(values->InstanceCount, 0, 31); 1432 1433 dw[4] = 1434 __gen_uint(values->StartInstanceLocation, 0, 31); 1435 1436 dw[5] = 1437 __gen_sint(values->BaseVertexLocation, 0, 31); 1438} 1439 1440#define GFX45_3DSTATE_AA_LINE_PARAMETERS_length 3 1441#define GFX45_3DSTATE_AA_LINE_PARAMETERS_length_bias 2 1442#define GFX45_3DSTATE_AA_LINE_PARAMETERS_header \ 1443 .DWordLength = 1, \ 1444 ._3DCommandSubOpcode = 10, \ 1445 ._3DCommandOpcode = 1, \ 1446 .CommandSubType = 3, \ 1447 .CommandType = 3 1448 1449struct GFX45_3DSTATE_AA_LINE_PARAMETERS { 1450 uint32_t DWordLength; 1451 uint32_t _3DCommandSubOpcode; 1452 uint32_t _3DCommandOpcode; 1453 uint32_t CommandSubType; 1454 uint32_t CommandType; 1455 float AACoverageSlope; 1456 float AACoverageBias; 1457 float AACoverageEndCapSlope; 1458 float AACoverageEndCapBias; 1459}; 1460 1461static inline __attribute__((always_inline)) void 1462GFX45_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data, 1463 __attribute__((unused)) void * restrict dst, 1464 __attribute__((unused)) const struct GFX45_3DSTATE_AA_LINE_PARAMETERS * restrict values) 1465{ 1466 uint32_t * restrict dw = (uint32_t * restrict) dst; 1467 1468 dw[0] = 1469 __gen_uint(values->DWordLength, 0, 7) | 1470 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1471 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1472 __gen_uint(values->CommandSubType, 27, 28) | 1473 __gen_uint(values->CommandType, 29, 31); 1474 1475 dw[1] = 1476 __gen_ufixed(values->AACoverageSlope, 0, 7, 8) | 1477 __gen_ufixed(values->AACoverageBias, 16, 23, 8); 1478 1479 dw[2] = 1480 __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) | 1481 __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8); 1482} 1483 1484#define GFX45_3DSTATE_BINDING_TABLE_POINTERS_length 6 1485#define GFX45_3DSTATE_BINDING_TABLE_POINTERS_length_bias 2 1486#define GFX45_3DSTATE_BINDING_TABLE_POINTERS_header\ 1487 .DWordLength = 4, \ 1488 ._3DCommandSubOpcode = 1, \ 1489 ._3DCommandOpcode = 0, \ 1490 .CommandSubType = 3, \ 1491 .CommandType = 3 1492 1493struct GFX45_3DSTATE_BINDING_TABLE_POINTERS { 1494 uint32_t DWordLength; 1495 uint32_t _3DCommandSubOpcode; 1496 uint32_t _3DCommandOpcode; 1497 uint32_t CommandSubType; 1498 uint32_t CommandType; 1499 uint64_t PointertoVSBindingTable; 1500 uint64_t PointertoGSBindingTable; 1501 uint64_t PointertoCLIPBindingTable; 1502 uint64_t PointertoSFBindingTable; 1503 uint64_t PointertoPSBindingTable; 1504}; 1505 1506static inline __attribute__((always_inline)) void 1507GFX45_3DSTATE_BINDING_TABLE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data, 1508 __attribute__((unused)) void * restrict dst, 1509 __attribute__((unused)) const struct GFX45_3DSTATE_BINDING_TABLE_POINTERS * restrict values) 1510{ 1511 uint32_t * restrict dw = (uint32_t * restrict) dst; 1512 1513 dw[0] = 1514 __gen_uint(values->DWordLength, 0, 7) | 1515 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1516 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1517 __gen_uint(values->CommandSubType, 27, 28) | 1518 __gen_uint(values->CommandType, 29, 31); 1519 1520 dw[1] = 1521 __gen_offset(values->PointertoVSBindingTable, 5, 31); 1522 1523 dw[2] = 1524 __gen_offset(values->PointertoGSBindingTable, 5, 31); 1525 1526 dw[3] = 1527 __gen_offset(values->PointertoCLIPBindingTable, 5, 31); 1528 1529 dw[4] = 1530 __gen_offset(values->PointertoSFBindingTable, 5, 31); 1531 1532 dw[5] = 1533 __gen_offset(values->PointertoPSBindingTable, 5, 31); 1534} 1535 1536#define GFX45_3DSTATE_CONSTANT_COLOR_length 5 1537#define GFX45_3DSTATE_CONSTANT_COLOR_length_bias 2 1538#define GFX45_3DSTATE_CONSTANT_COLOR_header \ 1539 .DWordLength = 3, \ 1540 ._3DCommandSubOpcode = 1, \ 1541 ._3DCommandOpcode = 1, \ 1542 .CommandSubType = 3, \ 1543 .CommandType = 3 1544 1545struct GFX45_3DSTATE_CONSTANT_COLOR { 1546 uint32_t DWordLength; 1547 uint32_t _3DCommandSubOpcode; 1548 uint32_t _3DCommandOpcode; 1549 uint32_t CommandSubType; 1550 uint32_t CommandType; 1551 float BlendConstantColorRed; 1552 float BlendConstantColorGreen; 1553 float BlendConstantColorBlue; 1554 float BlendConstantColorAlpha; 1555}; 1556 1557static inline __attribute__((always_inline)) void 1558GFX45_3DSTATE_CONSTANT_COLOR_pack(__attribute__((unused)) __gen_user_data *data, 1559 __attribute__((unused)) void * restrict dst, 1560 __attribute__((unused)) const struct GFX45_3DSTATE_CONSTANT_COLOR * restrict values) 1561{ 1562 uint32_t * restrict dw = (uint32_t * restrict) dst; 1563 1564 dw[0] = 1565 __gen_uint(values->DWordLength, 0, 7) | 1566 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1567 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1568 __gen_uint(values->CommandSubType, 27, 28) | 1569 __gen_uint(values->CommandType, 29, 31); 1570 1571 dw[1] = 1572 __gen_float(values->BlendConstantColorRed); 1573 1574 dw[2] = 1575 __gen_float(values->BlendConstantColorGreen); 1576 1577 dw[3] = 1578 __gen_float(values->BlendConstantColorBlue); 1579 1580 dw[4] = 1581 __gen_float(values->BlendConstantColorAlpha); 1582} 1583 1584#define GFX45_3DSTATE_DEPTH_BUFFER_length 6 1585#define GFX45_3DSTATE_DEPTH_BUFFER_length_bias 2 1586#define GFX45_3DSTATE_DEPTH_BUFFER_header \ 1587 .DWordLength = 4, \ 1588 ._3DCommandSubOpcode = 5, \ 1589 ._3DCommandOpcode = 1, \ 1590 .CommandSubType = 3, \ 1591 .CommandType = 3 1592 1593struct GFX45_3DSTATE_DEPTH_BUFFER { 1594 uint32_t DWordLength; 1595 uint32_t _3DCommandSubOpcode; 1596 uint32_t _3DCommandOpcode; 1597 uint32_t CommandSubType; 1598 uint32_t CommandType; 1599 uint32_t SurfacePitch; 1600 uint32_t SurfaceFormat; 1601#define D32_FLOAT_S8X24_UINT 0 1602#define D32_FLOAT 1 1603#define D24_UNORM_S8_UINT 2 1604#define D24_UNORM_X8_UINT 3 1605#define D16_UNORM 5 1606 uint32_t SoftwareTiledRenderingMode; 1607#define NORMAL 0 1608#define STR1 1 1609#define STR2 3 1610 bool DepthBufferCoordinateOffsetDisable; 1611 uint32_t TileWalk; 1612#define TILEWALK_YMAJOR 1 1613 bool TiledSurface; 1614 uint32_t SurfaceType; 1615#define SURFTYPE_1D 0 1616#define SURFTYPE_2D 1 1617#define SURFTYPE_3D 2 1618#define SURFTYPE_CUBE 3 1619#define SURFTYPE_NULL 7 1620 __gen_address_type SurfaceBaseAddress; 1621 uint32_t MIPMapLayoutMode; 1622#define MIPLAYOUT_BELOW 0 1623#define MIPLAYOUT_RIGHT 1 1624 uint32_t LOD; 1625 uint32_t Width; 1626 uint32_t Height; 1627#define SURFTYPE_1Dmustbezero 0 1628 uint32_t RenderTargetViewExtent; 1629 uint32_t MinimumArrayElement; 1630 uint32_t Depth; 1631#define SURFTYPE_CUBEmustbezero 0 1632 int32_t DepthCoordinateOffsetX; 1633 int32_t DepthCoordinateOffsetY; 1634}; 1635 1636static inline __attribute__((always_inline)) void 1637GFX45_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data, 1638 __attribute__((unused)) void * restrict dst, 1639 __attribute__((unused)) const struct GFX45_3DSTATE_DEPTH_BUFFER * restrict values) 1640{ 1641 uint32_t * restrict dw = (uint32_t * restrict) dst; 1642 1643 dw[0] = 1644 __gen_uint(values->DWordLength, 0, 7) | 1645 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1646 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1647 __gen_uint(values->CommandSubType, 27, 28) | 1648 __gen_uint(values->CommandType, 29, 31); 1649 1650 dw[1] = 1651 __gen_uint(values->SurfacePitch, 0, 16) | 1652 __gen_uint(values->SurfaceFormat, 18, 20) | 1653 __gen_uint(values->SoftwareTiledRenderingMode, 23, 24) | 1654 __gen_uint(values->DepthBufferCoordinateOffsetDisable, 25, 25) | 1655 __gen_uint(values->TileWalk, 26, 26) | 1656 __gen_uint(values->TiledSurface, 27, 27) | 1657 __gen_uint(values->SurfaceType, 29, 31); 1658 1659 dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31); 1660 1661 dw[3] = 1662 __gen_uint(values->MIPMapLayoutMode, 1, 1) | 1663 __gen_uint(values->LOD, 2, 5) | 1664 __gen_uint(values->Width, 6, 18) | 1665 __gen_uint(values->Height, 19, 31); 1666 1667 dw[4] = 1668 __gen_uint(values->RenderTargetViewExtent, 1, 9) | 1669 __gen_uint(values->MinimumArrayElement, 10, 20) | 1670 __gen_uint(values->Depth, 21, 31); 1671 1672 dw[5] = 1673 __gen_sint(values->DepthCoordinateOffsetX, 0, 15) | 1674 __gen_sint(values->DepthCoordinateOffsetY, 16, 31); 1675} 1676 1677#define GFX45_3DSTATE_DRAWING_RECTANGLE_length 4 1678#define GFX45_3DSTATE_DRAWING_RECTANGLE_length_bias 2 1679#define GFX45_3DSTATE_DRAWING_RECTANGLE_header \ 1680 .DWordLength = 2, \ 1681 ._3DCommandSubOpcode = 0, \ 1682 ._3DCommandOpcode = 1, \ 1683 .CommandSubType = 3, \ 1684 .CommandType = 3 1685 1686struct GFX45_3DSTATE_DRAWING_RECTANGLE { 1687 uint32_t DWordLength; 1688 uint32_t _3DCommandSubOpcode; 1689 uint32_t _3DCommandOpcode; 1690 uint32_t CommandSubType; 1691 uint32_t CommandType; 1692 uint32_t ClippedDrawingRectangleXMin; 1693 uint32_t ClippedDrawingRectangleYMin; 1694 uint32_t ClippedDrawingRectangleXMax; 1695 uint32_t ClippedDrawingRectangleYMax; 1696 int32_t DrawingRectangleOriginX; 1697 int32_t DrawingRectangleOriginY; 1698}; 1699 1700static inline __attribute__((always_inline)) void 1701GFX45_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data, 1702 __attribute__((unused)) void * restrict dst, 1703 __attribute__((unused)) const struct GFX45_3DSTATE_DRAWING_RECTANGLE * restrict values) 1704{ 1705 uint32_t * restrict dw = (uint32_t * restrict) dst; 1706 1707 dw[0] = 1708 __gen_uint(values->DWordLength, 0, 7) | 1709 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1710 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1711 __gen_uint(values->CommandSubType, 27, 28) | 1712 __gen_uint(values->CommandType, 29, 31); 1713 1714 dw[1] = 1715 __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) | 1716 __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31); 1717 1718 dw[2] = 1719 __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) | 1720 __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31); 1721 1722 dw[3] = 1723 __gen_sint(values->DrawingRectangleOriginX, 0, 15) | 1724 __gen_sint(values->DrawingRectangleOriginY, 16, 31); 1725} 1726 1727#define GFX45_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP_length 2 1728#define GFX45_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP_length_bias 2 1729#define GFX45_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP_header\ 1730 .DWordLength = 0, \ 1731 ._3DCommandSubOpcode = 9, \ 1732 ._3DCommandOpcode = 1, \ 1733 .CommandSubType = 3, \ 1734 .CommandType = 3 1735 1736struct GFX45_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP { 1737 uint32_t DWordLength; 1738 uint32_t _3DCommandSubOpcode; 1739 uint32_t _3DCommandOpcode; 1740 uint32_t CommandSubType; 1741 uint32_t CommandType; 1742 float GlobalDepthOffsetClamp; 1743}; 1744 1745static inline __attribute__((always_inline)) void 1746GFX45_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP_pack(__attribute__((unused)) __gen_user_data *data, 1747 __attribute__((unused)) void * restrict dst, 1748 __attribute__((unused)) const struct GFX45_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP * restrict values) 1749{ 1750 uint32_t * restrict dw = (uint32_t * restrict) dst; 1751 1752 dw[0] = 1753 __gen_uint(values->DWordLength, 0, 7) | 1754 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1755 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1756 __gen_uint(values->CommandSubType, 27, 28) | 1757 __gen_uint(values->CommandType, 29, 31); 1758 1759 dw[1] = 1760 __gen_float(values->GlobalDepthOffsetClamp); 1761} 1762 1763#define GFX45_3DSTATE_INDEX_BUFFER_length 3 1764#define GFX45_3DSTATE_INDEX_BUFFER_length_bias 2 1765#define GFX45_3DSTATE_INDEX_BUFFER_header \ 1766 .DWordLength = 1, \ 1767 ._3DCommandSubOpcode = 10, \ 1768 ._3DCommandOpcode = 0, \ 1769 .CommandSubType = 3, \ 1770 .CommandType = 3 1771 1772struct GFX45_3DSTATE_INDEX_BUFFER { 1773 uint32_t DWordLength; 1774 uint32_t IndexFormat; 1775#define INDEX_BYTE 0 1776#define INDEX_WORD 1 1777#define INDEX_DWORD 2 1778 bool CutIndexEnable; 1779 uint32_t _3DCommandSubOpcode; 1780 uint32_t _3DCommandOpcode; 1781 uint32_t CommandSubType; 1782 uint32_t CommandType; 1783 __gen_address_type BufferStartingAddress; 1784 __gen_address_type BufferEndingAddress; 1785}; 1786 1787static inline __attribute__((always_inline)) void 1788GFX45_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data, 1789 __attribute__((unused)) void * restrict dst, 1790 __attribute__((unused)) const struct GFX45_3DSTATE_INDEX_BUFFER * restrict values) 1791{ 1792 uint32_t * restrict dw = (uint32_t * restrict) dst; 1793 1794 dw[0] = 1795 __gen_uint(values->DWordLength, 0, 7) | 1796 __gen_uint(values->IndexFormat, 8, 9) | 1797 __gen_uint(values->CutIndexEnable, 10, 10) | 1798 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1799 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1800 __gen_uint(values->CommandSubType, 27, 28) | 1801 __gen_uint(values->CommandType, 29, 31); 1802 1803 dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 31); 1804 1805 dw[2] = __gen_address(data, &dw[2], values->BufferEndingAddress, 0, 0, 31); 1806} 1807 1808#define GFX45_3DSTATE_LINE_STIPPLE_length 3 1809#define GFX45_3DSTATE_LINE_STIPPLE_length_bias 2 1810#define GFX45_3DSTATE_LINE_STIPPLE_header \ 1811 .DWordLength = 1, \ 1812 ._3DCommandSubOpcode = 8, \ 1813 ._3DCommandOpcode = 1, \ 1814 .CommandSubType = 3, \ 1815 .CommandType = 3 1816 1817struct GFX45_3DSTATE_LINE_STIPPLE { 1818 uint32_t DWordLength; 1819 uint32_t _3DCommandSubOpcode; 1820 uint32_t _3DCommandOpcode; 1821 uint32_t CommandSubType; 1822 uint32_t CommandType; 1823 uint32_t LineStipplePattern; 1824 uint32_t CurrentStippleIndex; 1825 uint32_t CurrentRepeatCounter; 1826 bool ModifyEnableCurrentRepeatCounterCurrentStippleIndex; 1827 uint32_t LineStippleRepeatCount; 1828 float LineStippleInverseRepeatCount; 1829}; 1830 1831static inline __attribute__((always_inline)) void 1832GFX45_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data, 1833 __attribute__((unused)) void * restrict dst, 1834 __attribute__((unused)) const struct GFX45_3DSTATE_LINE_STIPPLE * restrict values) 1835{ 1836 uint32_t * restrict dw = (uint32_t * restrict) dst; 1837 1838 dw[0] = 1839 __gen_uint(values->DWordLength, 0, 7) | 1840 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1841 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1842 __gen_uint(values->CommandSubType, 27, 28) | 1843 __gen_uint(values->CommandType, 29, 31); 1844 1845 dw[1] = 1846 __gen_uint(values->LineStipplePattern, 0, 15) | 1847 __gen_uint(values->CurrentStippleIndex, 16, 19) | 1848 __gen_uint(values->CurrentRepeatCounter, 21, 29) | 1849 __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31); 1850 1851 dw[2] = 1852 __gen_uint(values->LineStippleRepeatCount, 0, 8) | 1853 __gen_ufixed(values->LineStippleInverseRepeatCount, 16, 31, 13); 1854} 1855 1856#define GFX45_3DSTATE_PIPELINED_POINTERS_length 7 1857#define GFX45_3DSTATE_PIPELINED_POINTERS_length_bias 2 1858#define GFX45_3DSTATE_PIPELINED_POINTERS_header \ 1859 .DWordLength = 5, \ 1860 ._3DCommandSubOpcode = 0, \ 1861 ._3DCommandOpcode = 0, \ 1862 .CommandSubType = 3, \ 1863 .CommandType = 3 1864 1865struct GFX45_3DSTATE_PIPELINED_POINTERS { 1866 uint32_t DWordLength; 1867 uint32_t _3DCommandSubOpcode; 1868 uint32_t _3DCommandOpcode; 1869 uint32_t CommandSubType; 1870 uint32_t CommandType; 1871 __gen_address_type PointertoVSState; 1872 bool GSEnable; 1873 __gen_address_type PointertoGSState; 1874 bool ClipEnable; 1875 __gen_address_type PointertoCLIPState; 1876 __gen_address_type PointertoSFState; 1877 __gen_address_type PointertoWMState; 1878 __gen_address_type PointertoColorCalcState; 1879}; 1880 1881static inline __attribute__((always_inline)) void 1882GFX45_3DSTATE_PIPELINED_POINTERS_pack(__attribute__((unused)) __gen_user_data *data, 1883 __attribute__((unused)) void * restrict dst, 1884 __attribute__((unused)) const struct GFX45_3DSTATE_PIPELINED_POINTERS * restrict values) 1885{ 1886 uint32_t * restrict dw = (uint32_t * restrict) dst; 1887 1888 dw[0] = 1889 __gen_uint(values->DWordLength, 0, 7) | 1890 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1891 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1892 __gen_uint(values->CommandSubType, 27, 28) | 1893 __gen_uint(values->CommandType, 29, 31); 1894 1895 dw[1] = __gen_address(data, &dw[1], values->PointertoVSState, 0, 5, 31); 1896 1897 const uint32_t v2 = 1898 __gen_uint(values->GSEnable, 0, 0); 1899 dw[2] = __gen_address(data, &dw[2], values->PointertoGSState, v2, 5, 31); 1900 1901 const uint32_t v3 = 1902 __gen_uint(values->ClipEnable, 0, 0); 1903 dw[3] = __gen_address(data, &dw[3], values->PointertoCLIPState, v3, 5, 31); 1904 1905 dw[4] = __gen_address(data, &dw[4], values->PointertoSFState, 0, 5, 31); 1906 1907 dw[5] = __gen_address(data, &dw[5], values->PointertoWMState, 0, 5, 31); 1908 1909 dw[6] = __gen_address(data, &dw[6], values->PointertoColorCalcState, 0, 5, 31); 1910} 1911 1912#define GFX45_3DSTATE_POLY_STIPPLE_OFFSET_length 2 1913#define GFX45_3DSTATE_POLY_STIPPLE_OFFSET_length_bias 2 1914#define GFX45_3DSTATE_POLY_STIPPLE_OFFSET_header\ 1915 .DWordLength = 0, \ 1916 ._3DCommandSubOpcode = 6, \ 1917 ._3DCommandOpcode = 1, \ 1918 .CommandSubType = 3, \ 1919 .CommandType = 3 1920 1921struct GFX45_3DSTATE_POLY_STIPPLE_OFFSET { 1922 uint32_t DWordLength; 1923 uint32_t _3DCommandSubOpcode; 1924 uint32_t _3DCommandOpcode; 1925 uint32_t CommandSubType; 1926 uint32_t CommandType; 1927 uint32_t PolygonStippleYOffset; 1928 uint32_t PolygonStippleXOffset; 1929}; 1930 1931static inline __attribute__((always_inline)) void 1932GFX45_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data, 1933 __attribute__((unused)) void * restrict dst, 1934 __attribute__((unused)) const struct GFX45_3DSTATE_POLY_STIPPLE_OFFSET * restrict values) 1935{ 1936 uint32_t * restrict dw = (uint32_t * restrict) dst; 1937 1938 dw[0] = 1939 __gen_uint(values->DWordLength, 0, 7) | 1940 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1941 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1942 __gen_uint(values->CommandSubType, 27, 28) | 1943 __gen_uint(values->CommandType, 29, 31); 1944 1945 dw[1] = 1946 __gen_uint(values->PolygonStippleYOffset, 0, 4) | 1947 __gen_uint(values->PolygonStippleXOffset, 8, 12); 1948} 1949 1950#define GFX45_3DSTATE_POLY_STIPPLE_PATTERN_length 33 1951#define GFX45_3DSTATE_POLY_STIPPLE_PATTERN_length_bias 2 1952#define GFX45_3DSTATE_POLY_STIPPLE_PATTERN_header\ 1953 .DWordLength = 31, \ 1954 ._3DCommandSubOpcode = 7, \ 1955 ._3DCommandOpcode = 1, \ 1956 .CommandSubType = 3, \ 1957 .CommandType = 3 1958 1959struct GFX45_3DSTATE_POLY_STIPPLE_PATTERN { 1960 uint32_t DWordLength; 1961 uint32_t _3DCommandSubOpcode; 1962 uint32_t _3DCommandOpcode; 1963 uint32_t CommandSubType; 1964 uint32_t CommandType; 1965 uint32_t PatternRow[32]; 1966}; 1967 1968static inline __attribute__((always_inline)) void 1969GFX45_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data, 1970 __attribute__((unused)) void * restrict dst, 1971 __attribute__((unused)) const struct GFX45_3DSTATE_POLY_STIPPLE_PATTERN * restrict values) 1972{ 1973 uint32_t * restrict dw = (uint32_t * restrict) dst; 1974 1975 dw[0] = 1976 __gen_uint(values->DWordLength, 0, 7) | 1977 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 1978 __gen_uint(values->_3DCommandOpcode, 24, 26) | 1979 __gen_uint(values->CommandSubType, 27, 28) | 1980 __gen_uint(values->CommandType, 29, 31); 1981 1982 dw[1] = 1983 __gen_uint(values->PatternRow[0], 0, 31); 1984 1985 dw[2] = 1986 __gen_uint(values->PatternRow[1], 0, 31); 1987 1988 dw[3] = 1989 __gen_uint(values->PatternRow[2], 0, 31); 1990 1991 dw[4] = 1992 __gen_uint(values->PatternRow[3], 0, 31); 1993 1994 dw[5] = 1995 __gen_uint(values->PatternRow[4], 0, 31); 1996 1997 dw[6] = 1998 __gen_uint(values->PatternRow[5], 0, 31); 1999 2000 dw[7] = 2001 __gen_uint(values->PatternRow[6], 0, 31); 2002 2003 dw[8] = 2004 __gen_uint(values->PatternRow[7], 0, 31); 2005 2006 dw[9] = 2007 __gen_uint(values->PatternRow[8], 0, 31); 2008 2009 dw[10] = 2010 __gen_uint(values->PatternRow[9], 0, 31); 2011 2012 dw[11] = 2013 __gen_uint(values->PatternRow[10], 0, 31); 2014 2015 dw[12] = 2016 __gen_uint(values->PatternRow[11], 0, 31); 2017 2018 dw[13] = 2019 __gen_uint(values->PatternRow[12], 0, 31); 2020 2021 dw[14] = 2022 __gen_uint(values->PatternRow[13], 0, 31); 2023 2024 dw[15] = 2025 __gen_uint(values->PatternRow[14], 0, 31); 2026 2027 dw[16] = 2028 __gen_uint(values->PatternRow[15], 0, 31); 2029 2030 dw[17] = 2031 __gen_uint(values->PatternRow[16], 0, 31); 2032 2033 dw[18] = 2034 __gen_uint(values->PatternRow[17], 0, 31); 2035 2036 dw[19] = 2037 __gen_uint(values->PatternRow[18], 0, 31); 2038 2039 dw[20] = 2040 __gen_uint(values->PatternRow[19], 0, 31); 2041 2042 dw[21] = 2043 __gen_uint(values->PatternRow[20], 0, 31); 2044 2045 dw[22] = 2046 __gen_uint(values->PatternRow[21], 0, 31); 2047 2048 dw[23] = 2049 __gen_uint(values->PatternRow[22], 0, 31); 2050 2051 dw[24] = 2052 __gen_uint(values->PatternRow[23], 0, 31); 2053 2054 dw[25] = 2055 __gen_uint(values->PatternRow[24], 0, 31); 2056 2057 dw[26] = 2058 __gen_uint(values->PatternRow[25], 0, 31); 2059 2060 dw[27] = 2061 __gen_uint(values->PatternRow[26], 0, 31); 2062 2063 dw[28] = 2064 __gen_uint(values->PatternRow[27], 0, 31); 2065 2066 dw[29] = 2067 __gen_uint(values->PatternRow[28], 0, 31); 2068 2069 dw[30] = 2070 __gen_uint(values->PatternRow[29], 0, 31); 2071 2072 dw[31] = 2073 __gen_uint(values->PatternRow[30], 0, 31); 2074 2075 dw[32] = 2076 __gen_uint(values->PatternRow[31], 0, 31); 2077} 2078 2079#define GFX45_3DSTATE_VERTEX_BUFFERS_length_bias 2 2080#define GFX45_3DSTATE_VERTEX_BUFFERS_header \ 2081 .DWordLength = 3, \ 2082 ._3DCommandSubOpcode = 8, \ 2083 ._3DCommandOpcode = 0, \ 2084 .CommandSubType = 3, \ 2085 .CommandType = 3 2086 2087struct GFX45_3DSTATE_VERTEX_BUFFERS { 2088 uint32_t DWordLength; 2089 uint32_t _3DCommandSubOpcode; 2090 uint32_t _3DCommandOpcode; 2091 uint32_t CommandSubType; 2092 uint32_t CommandType; 2093 /* variable length fields follow */ 2094}; 2095 2096static inline __attribute__((always_inline)) void 2097GFX45_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data, 2098 __attribute__((unused)) void * restrict dst, 2099 __attribute__((unused)) const struct GFX45_3DSTATE_VERTEX_BUFFERS * restrict values) 2100{ 2101 uint32_t * restrict dw = (uint32_t * restrict) dst; 2102 2103 dw[0] = 2104 __gen_uint(values->DWordLength, 0, 7) | 2105 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2106 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2107 __gen_uint(values->CommandSubType, 27, 28) | 2108 __gen_uint(values->CommandType, 29, 31); 2109} 2110 2111#define GFX45_3DSTATE_VERTEX_ELEMENTS_length_bias 2 2112#define GFX45_3DSTATE_VERTEX_ELEMENTS_header \ 2113 .DWordLength = 1, \ 2114 ._3DCommandSubOpcode = 9, \ 2115 ._3DCommandOpcode = 0, \ 2116 .CommandSubType = 3, \ 2117 .CommandType = 3 2118 2119struct GFX45_3DSTATE_VERTEX_ELEMENTS { 2120 uint32_t DWordLength; 2121 uint32_t _3DCommandSubOpcode; 2122 uint32_t _3DCommandOpcode; 2123 uint32_t CommandSubType; 2124 uint32_t CommandType; 2125 /* variable length fields follow */ 2126}; 2127 2128static inline __attribute__((always_inline)) void 2129GFX45_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data, 2130 __attribute__((unused)) void * restrict dst, 2131 __attribute__((unused)) const struct GFX45_3DSTATE_VERTEX_ELEMENTS * restrict values) 2132{ 2133 uint32_t * restrict dw = (uint32_t * restrict) dst; 2134 2135 dw[0] = 2136 __gen_uint(values->DWordLength, 0, 7) | 2137 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2138 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2139 __gen_uint(values->CommandSubType, 27, 28) | 2140 __gen_uint(values->CommandType, 29, 31); 2141} 2142 2143#define GFX45_3DSTATE_VF_STATISTICS_length 1 2144#define GFX45_3DSTATE_VF_STATISTICS_length_bias 1 2145#define GFX45_3DSTATE_VF_STATISTICS_header \ 2146 ._3DCommandSubOpcode = 11, \ 2147 ._3DCommandOpcode = 0, \ 2148 .CommandSubType = 1, \ 2149 .CommandType = 3 2150 2151struct GFX45_3DSTATE_VF_STATISTICS { 2152 bool StatisticsEnable; 2153 uint32_t _3DCommandSubOpcode; 2154 uint32_t _3DCommandOpcode; 2155 uint32_t CommandSubType; 2156 uint32_t CommandType; 2157}; 2158 2159static inline __attribute__((always_inline)) void 2160GFX45_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data, 2161 __attribute__((unused)) void * restrict dst, 2162 __attribute__((unused)) const struct GFX45_3DSTATE_VF_STATISTICS * restrict values) 2163{ 2164 uint32_t * restrict dw = (uint32_t * restrict) dst; 2165 2166 dw[0] = 2167 __gen_uint(values->StatisticsEnable, 0, 0) | 2168 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2169 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2170 __gen_uint(values->CommandSubType, 27, 28) | 2171 __gen_uint(values->CommandType, 29, 31); 2172} 2173 2174#define GFX45_CONSTANT_BUFFER_length 2 2175#define GFX45_CONSTANT_BUFFER_length_bias 2 2176#define GFX45_CONSTANT_BUFFER_header \ 2177 .DWordLength = 0, \ 2178 .Valid = 0, \ 2179 ._3DCommandSubOpcode = 2, \ 2180 ._3DCommandOpcode = 0, \ 2181 .CommandSubType = 0, \ 2182 .CommandType = 3 2183 2184struct GFX45_CONSTANT_BUFFER { 2185 uint32_t DWordLength; 2186 bool Valid; 2187 uint32_t _3DCommandSubOpcode; 2188 uint32_t _3DCommandOpcode; 2189 uint32_t CommandSubType; 2190 uint32_t CommandType; 2191 uint32_t BufferLength; 2192 __gen_address_type BufferStartingAddress; 2193}; 2194 2195static inline __attribute__((always_inline)) void 2196GFX45_CONSTANT_BUFFER_pack(__attribute__((unused)) __gen_user_data *data, 2197 __attribute__((unused)) void * restrict dst, 2198 __attribute__((unused)) const struct GFX45_CONSTANT_BUFFER * restrict values) 2199{ 2200 uint32_t * restrict dw = (uint32_t * restrict) dst; 2201 2202 dw[0] = 2203 __gen_uint(values->DWordLength, 0, 7) | 2204 __gen_uint(values->Valid, 8, 8) | 2205 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2206 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2207 __gen_uint(values->CommandSubType, 27, 28) | 2208 __gen_uint(values->CommandType, 29, 31); 2209 2210 const uint32_t v1 = 2211 __gen_uint(values->BufferLength, 0, 5); 2212 dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, v1, 6, 31); 2213} 2214 2215#define GFX45_CS_URB_STATE_length 2 2216#define GFX45_CS_URB_STATE_length_bias 2 2217#define GFX45_CS_URB_STATE_header \ 2218 .DWordLength = 0, \ 2219 ._3DCommandSubOpcode = 1, \ 2220 ._3DCommandOpcode = 0, \ 2221 .CommandSubType = 0, \ 2222 .CommandType = 3 2223 2224struct GFX45_CS_URB_STATE { 2225 uint32_t DWordLength; 2226 uint32_t _3DCommandSubOpcode; 2227 uint32_t _3DCommandOpcode; 2228 uint32_t CommandSubType; 2229 uint32_t CommandType; 2230 uint32_t NumberofURBEntries; 2231 uint32_t URBEntryAllocationSize; 2232}; 2233 2234static inline __attribute__((always_inline)) void 2235GFX45_CS_URB_STATE_pack(__attribute__((unused)) __gen_user_data *data, 2236 __attribute__((unused)) void * restrict dst, 2237 __attribute__((unused)) const struct GFX45_CS_URB_STATE * restrict values) 2238{ 2239 uint32_t * restrict dw = (uint32_t * restrict) dst; 2240 2241 dw[0] = 2242 __gen_uint(values->DWordLength, 0, 7) | 2243 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2244 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2245 __gen_uint(values->CommandSubType, 27, 28) | 2246 __gen_uint(values->CommandType, 29, 31); 2247 2248 dw[1] = 2249 __gen_uint(values->NumberofURBEntries, 0, 2) | 2250 __gen_uint(values->URBEntryAllocationSize, 4, 8); 2251} 2252 2253#define GFX45_MI_FLUSH_length 1 2254#define GFX45_MI_FLUSH_length_bias 1 2255#define GFX45_MI_FLUSH_header \ 2256 .MICommandOpcode = 4, \ 2257 .CommandType = 0 2258 2259struct GFX45_MI_FLUSH { 2260 uint32_t StateInstructionCacheInvalidate; 2261#define DontInvalidate 0 2262#define Invalidate 1 2263 uint32_t RenderCacheFlushInhibit; 2264#define Flush 0 2265#define DontFlush 1 2266 uint32_t GlobalSnapshotCountReset; 2267#define DontReset 0 2268#define Reset 1 2269 uint32_t MICommandOpcode; 2270 uint32_t CommandType; 2271}; 2272 2273static inline __attribute__((always_inline)) void 2274GFX45_MI_FLUSH_pack(__attribute__((unused)) __gen_user_data *data, 2275 __attribute__((unused)) void * restrict dst, 2276 __attribute__((unused)) const struct GFX45_MI_FLUSH * restrict values) 2277{ 2278 uint32_t * restrict dw = (uint32_t * restrict) dst; 2279 2280 dw[0] = 2281 __gen_uint(values->StateInstructionCacheInvalidate, 1, 1) | 2282 __gen_uint(values->RenderCacheFlushInhibit, 2, 2) | 2283 __gen_uint(values->GlobalSnapshotCountReset, 3, 3) | 2284 __gen_uint(values->MICommandOpcode, 23, 28) | 2285 __gen_uint(values->CommandType, 29, 31); 2286} 2287 2288#define GFX45_MI_LOAD_REGISTER_IMM_length 3 2289#define GFX45_MI_LOAD_REGISTER_IMM_length_bias 2 2290#define GFX45_MI_LOAD_REGISTER_IMM_header \ 2291 .DWordLength = 1, \ 2292 .MICommandOpcode = 34, \ 2293 .CommandType = 0 2294 2295struct GFX45_MI_LOAD_REGISTER_IMM { 2296 uint32_t DWordLength; 2297 uint32_t ByteWriteDisables; 2298 uint32_t MICommandOpcode; 2299 uint32_t CommandType; 2300 uint64_t RegisterOffset; 2301 uint32_t DataDWord; 2302 /* variable length fields follow */ 2303}; 2304 2305static inline __attribute__((always_inline)) void 2306GFX45_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data, 2307 __attribute__((unused)) void * restrict dst, 2308 __attribute__((unused)) const struct GFX45_MI_LOAD_REGISTER_IMM * restrict values) 2309{ 2310 uint32_t * restrict dw = (uint32_t * restrict) dst; 2311 2312 dw[0] = 2313 __gen_uint(values->DWordLength, 0, 5) | 2314 __gen_uint(values->ByteWriteDisables, 8, 11) | 2315 __gen_uint(values->MICommandOpcode, 23, 28) | 2316 __gen_uint(values->CommandType, 29, 31); 2317 2318 dw[1] = 2319 __gen_offset(values->RegisterOffset, 2, 31); 2320 2321 dw[2] = 2322 __gen_uint(values->DataDWord, 0, 31); 2323} 2324 2325#define GFX45_MI_STORE_DATA_IMM_length 5 2326#define GFX45_MI_STORE_DATA_IMM_length_bias 2 2327#define GFX45_MI_STORE_DATA_IMM_header \ 2328 .DWordLength = 2, \ 2329 .MICommandOpcode = 32, \ 2330 .CommandType = 0 2331 2332struct GFX45_MI_STORE_DATA_IMM { 2333 uint32_t DWordLength; 2334 uint32_t BitFieldName; 2335 bool MemoryAddressType; 2336 uint32_t MICommandOpcode; 2337 uint32_t CommandType; 2338 __gen_address_type PhysicalStartAddressExtension; 2339 __gen_address_type Address; 2340 uint64_t ImmediateData; 2341}; 2342 2343static inline __attribute__((always_inline)) void 2344GFX45_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data, 2345 __attribute__((unused)) void * restrict dst, 2346 __attribute__((unused)) const struct GFX45_MI_STORE_DATA_IMM * restrict values) 2347{ 2348 uint32_t * restrict dw = (uint32_t * restrict) dst; 2349 2350 dw[0] = 2351 __gen_uint(values->DWordLength, 0, 5) | 2352 __gen_uint(values->BitFieldName, 21, 21) | 2353 __gen_uint(values->MemoryAddressType, 22, 22) | 2354 __gen_uint(values->MICommandOpcode, 23, 28) | 2355 __gen_uint(values->CommandType, 29, 31); 2356 2357 dw[1] = __gen_address(data, &dw[1], values->PhysicalStartAddressExtension, 0, 0, 3); 2358 2359 dw[2] = __gen_address(data, &dw[2], values->Address, 0, 2, 31); 2360 2361 const uint64_t v3 = 2362 __gen_uint(values->ImmediateData, 0, 63); 2363 dw[3] = v3; 2364 dw[4] = v3 >> 32; 2365} 2366 2367#define GFX45_MI_STORE_REGISTER_MEM_length 3 2368#define GFX45_MI_STORE_REGISTER_MEM_length_bias 2 2369#define GFX45_MI_STORE_REGISTER_MEM_header \ 2370 .DWordLength = 1, \ 2371 .MICommandOpcode = 36, \ 2372 .CommandType = 0 2373 2374struct GFX45_MI_STORE_REGISTER_MEM { 2375 uint32_t DWordLength; 2376 bool UseGlobalGTT; 2377 uint32_t MICommandOpcode; 2378 uint32_t CommandType; 2379 uint64_t RegisterAddress; 2380 __gen_address_type PhysicalStartAddressExtension; 2381 __gen_address_type MemoryAddress; 2382}; 2383 2384static inline __attribute__((always_inline)) void 2385GFX45_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data, 2386 __attribute__((unused)) void * restrict dst, 2387 __attribute__((unused)) const struct GFX45_MI_STORE_REGISTER_MEM * restrict values) 2388{ 2389 uint32_t * restrict dw = (uint32_t * restrict) dst; 2390 2391 dw[0] = 2392 __gen_uint(values->DWordLength, 0, 7) | 2393 __gen_uint(values->UseGlobalGTT, 22, 22) | 2394 __gen_uint(values->MICommandOpcode, 23, 28) | 2395 __gen_uint(values->CommandType, 29, 31); 2396 2397 const uint32_t v1 = 2398 __gen_offset(values->RegisterAddress, 2, 22); 2399 dw[1] = __gen_address(data, &dw[1], values->PhysicalStartAddressExtension, v1, 28, 31); 2400 2401 dw[2] = __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 31); 2402} 2403 2404#define GFX45_PIPELINE_SELECT_length 1 2405#define GFX45_PIPELINE_SELECT_length_bias 1 2406#define GFX45_PIPELINE_SELECT_header \ 2407 ._3DCommandSubOpcode = 4, \ 2408 ._3DCommandOpcode = 1, \ 2409 .CommandSubType = 1, \ 2410 .CommandType = 3 2411 2412struct GFX45_PIPELINE_SELECT { 2413 uint32_t PipelineSelection; 2414#define _3D 0 2415#define Media 1 2416 uint32_t _3DCommandSubOpcode; 2417 uint32_t _3DCommandOpcode; 2418 uint32_t CommandSubType; 2419 uint32_t CommandType; 2420}; 2421 2422static inline __attribute__((always_inline)) void 2423GFX45_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data, 2424 __attribute__((unused)) void * restrict dst, 2425 __attribute__((unused)) const struct GFX45_PIPELINE_SELECT * restrict values) 2426{ 2427 uint32_t * restrict dw = (uint32_t * restrict) dst; 2428 2429 dw[0] = 2430 __gen_uint(values->PipelineSelection, 0, 1) | 2431 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2432 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2433 __gen_uint(values->CommandSubType, 27, 28) | 2434 __gen_uint(values->CommandType, 29, 31); 2435} 2436 2437#define GFX45_PIPE_CONTROL_length 4 2438#define GFX45_PIPE_CONTROL_length_bias 2 2439#define GFX45_PIPE_CONTROL_header \ 2440 .DWordLength = 2, \ 2441 ._3DCommandSubOpcode = 0, \ 2442 ._3DCommandOpcode = 2, \ 2443 .CommandSubType = 3, \ 2444 .CommandType = 3 2445 2446struct GFX45_PIPE_CONTROL { 2447 uint32_t DWordLength; 2448 bool NotifyEnable; 2449 bool IndirectStatePointersDisable; 2450 bool TextureCacheFlushEnable; 2451 bool InstructionCacheInvalidateEnable; 2452 bool WriteCacheFlush; 2453 bool DepthStallEnable; 2454 uint32_t PostSyncOperation; 2455#define NoWrite 0 2456#define WriteImmediateData 1 2457#define WritePSDepthCount 2 2458#define WriteTimestamp 3 2459 uint32_t _3DCommandSubOpcode; 2460 uint32_t _3DCommandOpcode; 2461 uint32_t CommandSubType; 2462 uint32_t CommandType; 2463 uint32_t DestinationAddressType; 2464#define DAT_PGTT 0 2465#define DAT_GGTT 1 2466 __gen_address_type Address; 2467 uint64_t ImmediateData; 2468}; 2469 2470static inline __attribute__((always_inline)) void 2471GFX45_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data, 2472 __attribute__((unused)) void * restrict dst, 2473 __attribute__((unused)) const struct GFX45_PIPE_CONTROL * restrict values) 2474{ 2475 uint32_t * restrict dw = (uint32_t * restrict) dst; 2476 2477 dw[0] = 2478 __gen_uint(values->DWordLength, 0, 7) | 2479 __gen_uint(values->NotifyEnable, 8, 8) | 2480 __gen_uint(values->IndirectStatePointersDisable, 9, 9) | 2481 __gen_uint(values->TextureCacheFlushEnable, 10, 10) | 2482 __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) | 2483 __gen_uint(values->WriteCacheFlush, 12, 12) | 2484 __gen_uint(values->DepthStallEnable, 13, 13) | 2485 __gen_uint(values->PostSyncOperation, 14, 15) | 2486 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2487 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2488 __gen_uint(values->CommandSubType, 27, 28) | 2489 __gen_uint(values->CommandType, 29, 31); 2490 2491 const uint32_t v1 = 2492 __gen_uint(values->DestinationAddressType, 2, 2); 2493 dw[1] = __gen_address(data, &dw[1], values->Address, v1, 3, 31); 2494 2495 const uint64_t v2 = 2496 __gen_uint(values->ImmediateData, 0, 63); 2497 dw[2] = v2; 2498 dw[3] = v2 >> 32; 2499} 2500 2501#define GFX45_STATE_BASE_ADDRESS_length 6 2502#define GFX45_STATE_BASE_ADDRESS_length_bias 2 2503#define GFX45_STATE_BASE_ADDRESS_header \ 2504 .DWordLength = 4, \ 2505 ._3DCommandSubOpcode = 1, \ 2506 ._3DCommandOpcode = 1, \ 2507 .CommandSubType = 0, \ 2508 .CommandType = 3 2509 2510struct GFX45_STATE_BASE_ADDRESS { 2511 uint32_t DWordLength; 2512 uint32_t _3DCommandSubOpcode; 2513 uint32_t _3DCommandOpcode; 2514 uint32_t CommandSubType; 2515 uint32_t CommandType; 2516 bool GeneralStateBaseAddressModifyEnable; 2517 __gen_address_type GeneralStateBaseAddress; 2518 bool SurfaceStateBaseAddressModifyEnable; 2519 __gen_address_type SurfaceStateBaseAddress; 2520 bool IndirectObjectBaseAddressModifyEnable; 2521 __gen_address_type IndirectObjectBaseAddress; 2522 bool GeneralStateAccessUpperBoundModifyEnable; 2523 __gen_address_type GeneralStateAccessUpperBound; 2524 bool IndirectObjectAccessUpperBoundModifyEnable; 2525 __gen_address_type IndirectObjectAccessUpperBound; 2526}; 2527 2528static inline __attribute__((always_inline)) void 2529GFX45_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data, 2530 __attribute__((unused)) void * restrict dst, 2531 __attribute__((unused)) const struct GFX45_STATE_BASE_ADDRESS * restrict values) 2532{ 2533 uint32_t * restrict dw = (uint32_t * restrict) dst; 2534 2535 dw[0] = 2536 __gen_uint(values->DWordLength, 0, 7) | 2537 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2538 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2539 __gen_uint(values->CommandSubType, 27, 28) | 2540 __gen_uint(values->CommandType, 29, 31); 2541 2542 const uint32_t v1 = 2543 __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0); 2544 dw[1] = __gen_address(data, &dw[1], values->GeneralStateBaseAddress, v1, 12, 31); 2545 2546 const uint32_t v2 = 2547 __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0); 2548 dw[2] = __gen_address(data, &dw[2], values->SurfaceStateBaseAddress, v2, 12, 31); 2549 2550 const uint32_t v3 = 2551 __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0); 2552 dw[3] = __gen_address(data, &dw[3], values->IndirectObjectBaseAddress, v3, 12, 31); 2553 2554 const uint32_t v4 = 2555 __gen_uint(values->GeneralStateAccessUpperBoundModifyEnable, 0, 0); 2556 dw[4] = __gen_address(data, &dw[4], values->GeneralStateAccessUpperBound, v4, 12, 31); 2557 2558 const uint32_t v5 = 2559 __gen_uint(values->IndirectObjectAccessUpperBoundModifyEnable, 0, 0); 2560 dw[5] = __gen_address(data, &dw[5], values->IndirectObjectAccessUpperBound, v5, 12, 31); 2561} 2562 2563#define GFX45_STATE_SIP_length 2 2564#define GFX45_STATE_SIP_length_bias 2 2565#define GFX45_STATE_SIP_header \ 2566 .DWordLength = 0, \ 2567 ._3DCommandSubOpcode = 2, \ 2568 ._3DCommandOpcode = 1, \ 2569 .CommandSubType = 0, \ 2570 .CommandType = 3 2571 2572struct GFX45_STATE_SIP { 2573 uint32_t DWordLength; 2574 uint32_t _3DCommandSubOpcode; 2575 uint32_t _3DCommandOpcode; 2576 uint32_t CommandSubType; 2577 uint32_t CommandType; 2578 uint64_t SystemInstructionPointer; 2579}; 2580 2581static inline __attribute__((always_inline)) void 2582GFX45_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data, 2583 __attribute__((unused)) void * restrict dst, 2584 __attribute__((unused)) const struct GFX45_STATE_SIP * restrict values) 2585{ 2586 uint32_t * restrict dw = (uint32_t * restrict) dst; 2587 2588 dw[0] = 2589 __gen_uint(values->DWordLength, 0, 7) | 2590 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2591 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2592 __gen_uint(values->CommandSubType, 27, 28) | 2593 __gen_uint(values->CommandType, 29, 31); 2594 2595 dw[1] = 2596 __gen_offset(values->SystemInstructionPointer, 4, 31); 2597} 2598 2599#define GFX45_URB_FENCE_length 3 2600#define GFX45_URB_FENCE_length_bias 2 2601#define GFX45_URB_FENCE_header \ 2602 .DWordLength = 1, \ 2603 ._3DCommandSubOpcode = 0, \ 2604 ._3DCommandOpcode = 0, \ 2605 .CommandSubType = 0, \ 2606 .CommandType = 3 2607 2608struct GFX45_URB_FENCE { 2609 uint32_t DWordLength; 2610 bool VSUnitURBReallocationRequest; 2611 bool GSUnitURBReallocationRequest; 2612 bool CLIPUnitURBReallocationRequest; 2613 bool SFUnitURBReallocationRequest; 2614 bool VFEUnitURBReallocationRequest; 2615 bool CSUnitURBReallocationRequest; 2616 uint32_t _3DCommandSubOpcode; 2617 uint32_t _3DCommandOpcode; 2618 uint32_t CommandSubType; 2619 uint32_t CommandType; 2620 uint32_t VSFence; 2621 uint32_t GSFence; 2622 uint32_t CLIPFence; 2623 uint32_t SFFence; 2624 uint32_t VFEFence; 2625 uint32_t CSFence; 2626}; 2627 2628static inline __attribute__((always_inline)) void 2629GFX45_URB_FENCE_pack(__attribute__((unused)) __gen_user_data *data, 2630 __attribute__((unused)) void * restrict dst, 2631 __attribute__((unused)) const struct GFX45_URB_FENCE * restrict values) 2632{ 2633 uint32_t * restrict dw = (uint32_t * restrict) dst; 2634 2635 dw[0] = 2636 __gen_uint(values->DWordLength, 0, 7) | 2637 __gen_uint(values->VSUnitURBReallocationRequest, 8, 8) | 2638 __gen_uint(values->GSUnitURBReallocationRequest, 9, 9) | 2639 __gen_uint(values->CLIPUnitURBReallocationRequest, 10, 10) | 2640 __gen_uint(values->SFUnitURBReallocationRequest, 11, 11) | 2641 __gen_uint(values->VFEUnitURBReallocationRequest, 12, 12) | 2642 __gen_uint(values->CSUnitURBReallocationRequest, 13, 13) | 2643 __gen_uint(values->_3DCommandSubOpcode, 16, 23) | 2644 __gen_uint(values->_3DCommandOpcode, 24, 26) | 2645 __gen_uint(values->CommandSubType, 27, 28) | 2646 __gen_uint(values->CommandType, 29, 31); 2647 2648 dw[1] = 2649 __gen_uint(values->VSFence, 0, 9) | 2650 __gen_uint(values->GSFence, 10, 19) | 2651 __gen_uint(values->CLIPFence, 20, 29); 2652 2653 dw[2] = 2654 __gen_uint(values->SFFence, 0, 9) | 2655 __gen_uint(values->VFEFence, 10, 19) | 2656 __gen_uint(values->CSFence, 20, 30); 2657} 2658 2659#define GFX45_XY_COLOR_BLT_length 6 2660#define GFX45_XY_COLOR_BLT_length_bias 2 2661#define GFX45_XY_COLOR_BLT_header \ 2662 .DWordLength = 4, \ 2663 ._2DCommandOpcode = 80, \ 2664 .CommandType = 2 2665 2666struct GFX45_XY_COLOR_BLT { 2667 uint32_t DWordLength; 2668 bool TilingEnable; 2669 uint32_t _32bppByteMask; 2670 uint32_t _2DCommandOpcode; 2671 uint32_t CommandType; 2672 int32_t DestinationPitch; 2673 uint32_t RasterOperation; 2674 uint32_t ColorDepth; 2675#define COLOR_DEPTH__8bit 0 2676#define COLOR_DEPTH__565 1 2677#define COLOR_DEPTH__1555 2 2678#define COLOR_DEPTH__32bit 3 2679 bool ClippingEnabled; 2680 int32_t DestinationX1Coordinate; 2681 int32_t DestinationY1Coordinate; 2682 int32_t DestinationX2Coordinate; 2683 int32_t DestinationY2Coordinate; 2684 __gen_address_type DestinationBaseAddress; 2685 int32_t SolidPatternColor; 2686}; 2687 2688static inline __attribute__((always_inline)) void 2689GFX45_XY_COLOR_BLT_pack(__attribute__((unused)) __gen_user_data *data, 2690 __attribute__((unused)) void * restrict dst, 2691 __attribute__((unused)) const struct GFX45_XY_COLOR_BLT * restrict values) 2692{ 2693 uint32_t * restrict dw = (uint32_t * restrict) dst; 2694 2695 dw[0] = 2696 __gen_uint(values->DWordLength, 0, 7) | 2697 __gen_uint(values->TilingEnable, 11, 11) | 2698 __gen_uint(values->_32bppByteMask, 20, 21) | 2699 __gen_uint(values->_2DCommandOpcode, 22, 28) | 2700 __gen_uint(values->CommandType, 29, 31); 2701 2702 dw[1] = 2703 __gen_sint(values->DestinationPitch, 0, 15) | 2704 __gen_uint(values->RasterOperation, 16, 23) | 2705 __gen_uint(values->ColorDepth, 24, 25) | 2706 __gen_uint(values->ClippingEnabled, 30, 30); 2707 2708 dw[2] = 2709 __gen_sint(values->DestinationX1Coordinate, 0, 15) | 2710 __gen_sint(values->DestinationY1Coordinate, 16, 31); 2711 2712 dw[3] = 2713 __gen_sint(values->DestinationX2Coordinate, 0, 15) | 2714 __gen_sint(values->DestinationY2Coordinate, 16, 31); 2715 2716 dw[4] = __gen_address(data, &dw[4], values->DestinationBaseAddress, 0, 0, 31); 2717 2718 dw[5] = 2719 __gen_sint(values->SolidPatternColor, 0, 31); 2720} 2721 2722#define GFX45_XY_SETUP_BLT_length 8 2723#define GFX45_XY_SETUP_BLT_length_bias 2 2724#define GFX45_XY_SETUP_BLT_header \ 2725 .DWordLength = 6, \ 2726 ._2DCommandOpcode = 1, \ 2727 .CommandType = 2 2728 2729struct GFX45_XY_SETUP_BLT { 2730 uint32_t DWordLength; 2731 bool TilingEnable; 2732 uint32_t _32bppByteMask; 2733 uint32_t _2DCommandOpcode; 2734 uint32_t CommandType; 2735 int32_t DestinationPitch; 2736 uint32_t RasterOperation; 2737 uint32_t ColorDepth; 2738#define COLOR_DEPTH__8bit 0 2739#define COLOR_DEPTH__565 1 2740#define COLOR_DEPTH__1555 2 2741#define COLOR_DEPTH__32bit 3 2742 bool MonoSourceTransparencyMode; 2743 bool ClippingEnabled; 2744 int32_t ClipRectX1Coordinate; 2745 int32_t ClipRectY1Coordinate; 2746 int32_t ClipRectX2Coordinate; 2747 int32_t ClipRectY2Coordinate; 2748 __gen_address_type DestinationBaseAddress; 2749 uint32_t BackgroundColor; 2750 uint32_t ForegroundColor; 2751 uint32_t PatternBaseAddress; 2752}; 2753 2754static inline __attribute__((always_inline)) void 2755GFX45_XY_SETUP_BLT_pack(__attribute__((unused)) __gen_user_data *data, 2756 __attribute__((unused)) void * restrict dst, 2757 __attribute__((unused)) const struct GFX45_XY_SETUP_BLT * restrict values) 2758{ 2759 uint32_t * restrict dw = (uint32_t * restrict) dst; 2760 2761 dw[0] = 2762 __gen_uint(values->DWordLength, 0, 7) | 2763 __gen_uint(values->TilingEnable, 11, 11) | 2764 __gen_uint(values->_32bppByteMask, 20, 21) | 2765 __gen_uint(values->_2DCommandOpcode, 22, 28) | 2766 __gen_uint(values->CommandType, 29, 31); 2767 2768 dw[1] = 2769 __gen_sint(values->DestinationPitch, 0, 15) | 2770 __gen_uint(values->RasterOperation, 16, 23) | 2771 __gen_uint(values->ColorDepth, 24, 25) | 2772 __gen_uint(values->MonoSourceTransparencyMode, 29, 29) | 2773 __gen_uint(values->ClippingEnabled, 30, 30); 2774 2775 dw[2] = 2776 __gen_sint(values->ClipRectX1Coordinate, 0, 15) | 2777 __gen_sint(values->ClipRectY1Coordinate, 16, 31); 2778 2779 dw[3] = 2780 __gen_sint(values->ClipRectX2Coordinate, 0, 15) | 2781 __gen_sint(values->ClipRectY2Coordinate, 16, 31); 2782 2783 dw[4] = __gen_address(data, &dw[4], values->DestinationBaseAddress, 0, 0, 31); 2784 2785 dw[5] = 2786 __gen_uint(values->BackgroundColor, 0, 31); 2787 2788 dw[6] = 2789 __gen_uint(values->ForegroundColor, 0, 31); 2790 2791 dw[7] = 2792 __gen_uint(values->PatternBaseAddress, 0, 31); 2793} 2794 2795#define GFX45_XY_SRC_COPY_BLT_length 8 2796#define GFX45_XY_SRC_COPY_BLT_length_bias 2 2797#define GFX45_XY_SRC_COPY_BLT_header \ 2798 .DWordLength = 6, \ 2799 ._2DCommandOpcode = 83, \ 2800 .CommandType = 2 2801 2802struct GFX45_XY_SRC_COPY_BLT { 2803 uint32_t DWordLength; 2804 bool DestinationTilingEnable; 2805 bool SourceTilingEnable; 2806 uint32_t _32bppByteMask; 2807 uint32_t _2DCommandOpcode; 2808 uint32_t CommandType; 2809 int32_t DestinationPitch; 2810 uint32_t RasterOperation; 2811 uint32_t ColorDepth; 2812#define COLOR_DEPTH__8bit 0 2813#define COLOR_DEPTH__565 1 2814#define COLOR_DEPTH__1555 2 2815#define COLOR_DEPTH__32bit 3 2816 bool ClippingEnabled; 2817 int32_t DestinationX1Coordinate; 2818 int32_t DestinationY1Coordinate; 2819 int32_t DestinationX2Coordinate; 2820 int32_t DestinationY2Coordinate; 2821 __gen_address_type DestinationBaseAddress; 2822 int32_t SourceX1Coordinate; 2823 int32_t SourceY1Coordinate; 2824 int32_t SourcePitch; 2825 __gen_address_type SourceBaseAddress; 2826}; 2827 2828static inline __attribute__((always_inline)) void 2829GFX45_XY_SRC_COPY_BLT_pack(__attribute__((unused)) __gen_user_data *data, 2830 __attribute__((unused)) void * restrict dst, 2831 __attribute__((unused)) const struct GFX45_XY_SRC_COPY_BLT * restrict values) 2832{ 2833 uint32_t * restrict dw = (uint32_t * restrict) dst; 2834 2835 dw[0] = 2836 __gen_uint(values->DWordLength, 0, 7) | 2837 __gen_uint(values->DestinationTilingEnable, 11, 11) | 2838 __gen_uint(values->SourceTilingEnable, 15, 15) | 2839 __gen_uint(values->_32bppByteMask, 20, 21) | 2840 __gen_uint(values->_2DCommandOpcode, 22, 28) | 2841 __gen_uint(values->CommandType, 29, 31); 2842 2843 dw[1] = 2844 __gen_sint(values->DestinationPitch, 0, 15) | 2845 __gen_uint(values->RasterOperation, 16, 23) | 2846 __gen_uint(values->ColorDepth, 24, 25) | 2847 __gen_uint(values->ClippingEnabled, 30, 30); 2848 2849 dw[2] = 2850 __gen_sint(values->DestinationX1Coordinate, 0, 15) | 2851 __gen_sint(values->DestinationY1Coordinate, 16, 31); 2852 2853 dw[3] = 2854 __gen_sint(values->DestinationX2Coordinate, 0, 15) | 2855 __gen_sint(values->DestinationY2Coordinate, 16, 31); 2856 2857 dw[4] = __gen_address(data, &dw[4], values->DestinationBaseAddress, 0, 0, 31); 2858 2859 dw[5] = 2860 __gen_sint(values->SourceX1Coordinate, 0, 15) | 2861 __gen_sint(values->SourceY1Coordinate, 16, 31); 2862 2863 dw[6] = 2864 __gen_sint(values->SourcePitch, 0, 15); 2865 2866 dw[7] = __gen_address(data, &dw[7], values->SourceBaseAddress, 0, 0, 31); 2867} 2868 2869#define GFX45_XY_TEXT_IMMEDIATE_BLT_length 3 2870#define GFX45_XY_TEXT_IMMEDIATE_BLT_length_bias 2 2871#define GFX45_XY_TEXT_IMMEDIATE_BLT_header \ 2872 .DWordLength = 1, \ 2873 ._2DCommandOpcode = 49, \ 2874 .CommandType = 2 2875 2876struct GFX45_XY_TEXT_IMMEDIATE_BLT { 2877 uint32_t DWordLength; 2878 bool TilingEnable; 2879 uint32_t Packing; 2880#define BitPacked 0 2881#define BytePacked 1 2882 uint32_t _32bppByteMask; 2883 uint32_t _2DCommandOpcode; 2884 uint32_t CommandType; 2885 int32_t DestinationPitch; 2886 int32_t DestinationX1Coordinate; 2887 int32_t DestinationY1Coordinate; 2888 int32_t DestinationX2Coordinate; 2889 int32_t DestinationY2Coordinate; 2890}; 2891 2892static inline __attribute__((always_inline)) void 2893GFX45_XY_TEXT_IMMEDIATE_BLT_pack(__attribute__((unused)) __gen_user_data *data, 2894 __attribute__((unused)) void * restrict dst, 2895 __attribute__((unused)) const struct GFX45_XY_TEXT_IMMEDIATE_BLT * restrict values) 2896{ 2897 uint32_t * restrict dw = (uint32_t * restrict) dst; 2898 2899 dw[0] = 2900 __gen_uint(values->DWordLength, 0, 7) | 2901 __gen_uint(values->TilingEnable, 11, 11) | 2902 __gen_uint(values->Packing, 16, 16) | 2903 __gen_uint(values->_32bppByteMask, 20, 21) | 2904 __gen_uint(values->_2DCommandOpcode, 22, 28) | 2905 __gen_uint(values->CommandType, 29, 31); 2906 2907 dw[1] = 2908 __gen_sint(values->DestinationPitch, 0, 15) | 2909 __gen_sint(values->DestinationX1Coordinate, 0, 15) | 2910 __gen_sint(values->DestinationY1Coordinate, 16, 31); 2911 2912 dw[2] = 2913 __gen_sint(values->DestinationX2Coordinate, 0, 15) | 2914 __gen_sint(values->DestinationY2Coordinate, 16, 31); 2915} 2916 2917#endif /* GFX45_PACK_H */ 2918