1 /* 2 * Copyright (c) 2021, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 #ifndef __VP_RENDER_FC_TYPES_H__ 23 #define __VP_RENDER_FC_TYPES_H__ 24 25 namespace vp 26 { 27 //!< Linear sampler bias 28 #define VP_SAMPLER_BIAS 0.015625f 29 #define VP_HW_LINEAR_SHIFT 0.5f 30 31 // Defined DP used FC kernel for computation. 32 struct VP_FC_DP_BASED_CURBE_DATA 33 { 34 // DWORD 0 - GRF R1.0 35 union 36 { 37 // CSC 38 struct 39 { 40 uint32_t CscConstantC0 : 16; 41 uint32_t CscConstantC1 : 16; 42 }; 43 44 uint32_t Value; 45 } DW0; 46 47 // DWORD 1 - GRF R1.1 48 union 49 { 50 // CSC 51 struct 52 { 53 uint32_t CscConstantC2 : 16; 54 uint32_t CscConstantC3 : 16; 55 }; 56 57 uint32_t Value; 58 } DW1; 59 60 // DWORD 2 - GRF R1.2 61 union 62 { 63 // CSC 64 struct 65 { 66 uint32_t CscConstantC4 : 16; 67 uint32_t CscConstantC5 : 16; 68 }; 69 70 uint32_t Value; 71 } DW2; 72 73 // DWORD 3 - GRF R1.3 74 union 75 { 76 // CSC 77 struct 78 { 79 uint32_t CscConstantC6 : 16; 80 uint32_t CscConstantC7 : 16; 81 }; 82 83 uint32_t Value; 84 } DW3; 85 86 // DWORD 4 - GRF R1.4 87 union 88 { 89 // CSC 90 struct 91 { 92 uint32_t CscConstantC8 : 16; 93 uint32_t CscConstantC9 : 16; 94 }; 95 96 uint32_t Value; 97 } DW4; 98 99 // DWORD 5 - GRF R1.5 100 union 101 { 102 // CSC 103 struct 104 { 105 uint32_t CscConstantC10 : 16; 106 uint32_t CscConstantC11 : 16; 107 }; 108 109 uint32_t Value; 110 } DW5; 111 112 // DWORD 6 - GRF R1.6 113 union 114 { 115 // Dataport-based rotation 116 struct 117 { 118 uint32_t InputPictureWidth : 16; 119 uint32_t InputPictureHeight : 16; 120 }; 121 122 uint32_t Value; 123 } DW6; 124 125 // DWORD 7 - GRF R1.7 distWidth and distHeight 126 union 127 { 128 struct 129 { 130 uint32_t DestinationRectangleWidth : 16; 131 uint32_t DestinationRectangleHeight : 16; 132 }; 133 134 uint32_t Value; 135 } DW7; 136 137 // DWORD 8 - GRF R1.8 138 union 139 { 140 struct 141 { 142 uint32_t RotationChromaSitingFlag; 143 }; 144 145 uint32_t Value; 146 } DW8; 147 148 // DWORD 9 - GRF R1.9 input DeltaX 149 union 150 { 151 struct 152 { 153 float HorizontalScalingStepRatioLayer0; 154 }; 155 156 uint32_t Value; 157 } DW9; 158 159 // DWORD 10 - GRF R2.0 input DeltaY 160 union 161 { 162 struct 163 { 164 float VerticalScalingStepRatioLayer0; 165 }; 166 167 uint32_t Value; 168 } DW10; 169 170 // DWORD 11 - GRF R2.1 input orignin x 171 union 172 { 173 struct 174 { 175 float HorizontalFrameOriginLayer0; 176 }; 177 178 uint32_t Value; 179 } DW11; 180 181 // DWORD 12 - GRF R2.2 input orignin Y 182 union 183 { 184 struct 185 { 186 float VerticalFrameOriginLayer0; 187 }; 188 189 uint32_t Value; 190 } DW12; 191 192 // DWORD13 - GRF R2.3 topleft[2] 193 union 194 { 195 struct 196 { 197 uint32_t DestXTopLeftLayer0 : 16; 198 uint32_t DestYTopLeftLayer0 : 16; 199 }; 200 201 uint32_t Value; 202 } DW13; 203 204 // DWORD14 - GRF R2.4 bottomRight 205 union 206 { 207 struct 208 { 209 uint32_t DestXBottomRightLayer0 : 16; 210 uint32_t DestYBottomRightLayer0 : 16; 211 }; 212 213 uint32_t Value; 214 } DW14; 215 216 // DWORD15 - GRF R2.4 waflag and dstpitch 217 union 218 { 219 struct 220 { 221 uint32_t waFlag : 16; 222 uint32_t StatisticsSurfacePitch : 16; 223 }; 224 225 uint32_t Value; 226 } DW15; 227 228 }; 229 230 // Defined in Inline parameter computation 231 struct VP_FC_CURBE_DATA 232 { 233 // DWORD 0 - GRF R1.0 234 union 235 { 236 // CSC 237 struct 238 { 239 uint32_t CscConstantC0 : 16; 240 uint32_t CscConstantC1 : 16; 241 }; 242 243 // Chroma Denoise 244 struct 245 { 246 uint32_t LocalDifferenceThresholdU : 8; 247 uint32_t LocalDifferenceThresholdV : 8; 248 uint32_t SobelEdgeThresholdU : 8; 249 uint32_t SobelEdgeThresholdV : 8; 250 }; 251 252 // Dataport-based rotation 253 struct 254 { 255 uint32_t InputPictureWidth : 16; 256 uint32_t InputPictureHeight : 16; 257 }; 258 259 uint32_t Value; 260 } DW00; 261 262 // DWORD 1 - GRF R1.1 263 union 264 { 265 // CSC 266 struct 267 { 268 uint32_t CscConstantC2 : 16; 269 uint32_t CscConstantC3 : 16; 270 }; 271 272 // Chroma Denoise 273 struct 274 { 275 uint32_t HistoryInitialValueU : 8; 276 uint32_t HistoryInitialValueV : 8; 277 uint32_t HistoryMaxU : 8; 278 uint32_t HistoryMaxV : 8; 279 }; 280 281 // Dataport-based rotation 282 struct 283 { 284 uint32_t RotationMirrorMode : 8; 285 uint32_t DestinationRGBFormat : 8; 286 uint32_t : 16; 287 }; 288 289 uint32_t Value; 290 } DW01; 291 292 // DWORD 2 - GRF R1.2 293 union 294 { 295 // CSC 296 struct 297 { 298 uint32_t CscConstantC4 : 16; 299 uint32_t CscConstantC5 : 16; 300 }; 301 302 // Chroma Denoise 303 struct 304 { 305 uint32_t HistoryDeltaU : 8; 306 uint32_t HistoryDeltaV : 8; 307 uint32_t DNSADThresholdU : 8; 308 uint32_t DNSADThresholdV : 8; 309 }; 310 311 // Dataport-based rotation 312 struct 313 { 314 uint32_t CscConstantC0 : 16; 315 uint32_t CscConstantC1 : 16; 316 }; 317 318 uint32_t Value; 319 } DW02; 320 321 // DWORD 3 - GRF R1.3 322 union 323 { 324 // CSC 325 struct 326 { 327 uint32_t CscConstantC6 : 16; 328 uint32_t CscConstantC7 : 16; 329 }; 330 331 // Chroma Denoise 332 struct 333 { 334 uint32_t DNTDThresholdU : 8; 335 uint32_t DNTDThresholdV : 8; 336 uint32_t DNLTDThresholdU : 8; 337 uint32_t DNLTDThresholdV : 8; 338 }; 339 340 // Dataport-based rotation 341 struct 342 { 343 uint32_t CscConstantC2 : 16; 344 uint32_t CscConstantC3 : 16; 345 }; 346 347 uint32_t Value; 348 } DW03; 349 350 // DWORD 4 - GRF R1.4 351 union 352 { 353 // CSC 354 struct 355 { 356 uint32_t CscConstantC8 : 16; 357 uint32_t CscConstantC9 : 16; 358 }; 359 360 // Dataport-based rotation 361 struct 362 { 363 uint32_t CscConstantC4 : 16; 364 uint32_t CscConstantC5 : 16; 365 }; 366 367 uint32_t Value; 368 } DW04; 369 370 // DWORD 5 - GRF R1.5 371 union 372 { 373 // CSC 374 struct 375 { 376 uint32_t CscConstantC10 : 16; 377 uint32_t CscConstantC11 : 16; 378 }; 379 380 // Dataport-based rotation 381 struct 382 { 383 uint32_t CscConstantC6 : 16; 384 uint32_t CscConstantC7 : 16; 385 }; 386 387 uint32_t Value; 388 } DW05; 389 390 // DWORD 6 - GRF R1.6 391 union 392 { 393 // Const Blending 394 struct 395 { 396 uint32_t ConstantBlendingAlphaLayer1 : 8; 397 uint32_t ConstantBlendingAlphaLayer2 : 8; 398 uint32_t ConstantBlendingAlphaLayer3 : 8; 399 uint32_t ConstantBlendingAlphaLayer4 : 8; 400 }; 401 402 // DNDI 403 struct 404 { 405 uint32_t HalfStatisticsSurfacePitch : 16; // Statistics surface pitch divided by 2 406 uint32_t StatisticsSurfaceHeight : 16; // Statistics surface height divided by 4 407 }; 408 409 // Dataport-based rotation 410 struct 411 { 412 uint32_t CscConstantC8 : 16; 413 uint32_t CscConstantC9 : 16; 414 }; 415 416 uint32_t Value; 417 } DW06; 418 419 // DWORD 7 - GRF R1.7 420 union 421 { 422 // Const Blending 423 struct 424 { 425 uint32_t ConstantBlendingAlphaLayer5 : 8; 426 uint32_t ConstantBlendingAlphaLayer6 : 8; 427 uint32_t ConstantBlendingAlphaLayer7 : 8; 428 uint32_t PointerToInlineParameters : 8; 429 }; 430 431 struct 432 { 433 uint32_t ConstantBlendingAlphaLayer51 : 8; 434 uint32_t ConstantBlendingAlphaLayer61 : 8; 435 uint32_t ConstantBlendingAlphaLayer71 : 8; 436 uint32_t OutputDepth : 8; 437 }; 438 439 // DNDI 440 struct 441 { 442 uint32_t TopFieldFirst : 8; 443 uint32_t : 24; 444 }; 445 446 // Dataport-based rotation 447 struct 448 { 449 uint32_t CscConstantC10 : 16; 450 uint32_t CscConstantC11 : 16; 451 }; 452 453 uint32_t Value; 454 } DW07; 455 456 // DWORD 8 - GRF R2.0 457 union 458 { 459 struct 460 { 461 uint32_t DestinationRectangleWidth : 16; 462 uint32_t DestinationRectangleHeight : 16; 463 }; 464 465 // Dataport-based rotation 466 struct 467 { 468 uint32_t InputIndex : 32; 469 }; 470 471 uint32_t Value; 472 } DW08; 473 474 // DWORD 9 - GRF R2.1 475 union 476 { 477 // Common structure for all gens 478 struct 479 { 480 uint32_t RotationMirrorMode : 3; 481 uint32_t RotationMirrorAllLayer : 1; 482 uint32_t DualOutputMode : 1; 483 uint32_t : 11; 484 uint32_t ChannelSwap : 1; 485 uint32_t : 1; 486 uint32_t : 1; 487 uint32_t : 13; 488 }; 489 490 // Bit field(s) for gen8+ only 491 struct 492 { 493 uint32_t : 3; 494 uint32_t : 1; 495 uint32_t : 12; 496 uint32_t : 1; 497 uint32_t : 10; 498 uint32_t IEFByPassEnable : 1; 499 uint32_t : 4; 500 }; 501 502 // Bit field(s) for Gen9+ only 503 struct 504 { 505 uint32_t : 5; 506 uint32_t : 3; 507 uint32_t : 8; 508 uint32_t : 1; 509 uint32_t : 1; 510 uint32_t AlphaChannelCalculation : 1; 511 uint32_t : 8; 512 uint32_t : 1; 513 uint32_t : 4; 514 }; 515 516 // Dataport-based rotation 517 struct 518 { 519 uint32_t OutputIndex : 32; 520 }; 521 522 uint32_t Value; 523 } DW09; 524 525 // DWORD 10 - GRF R2.2 526 union 527 { 528 struct // Gen9+ Rotation 529 { 530 uint32_t RotationAngleofLayer0 : 3; 531 uint32_t RotationAngleofLayer1 : 3; 532 uint32_t RotationAngleofLayer2 : 3; 533 uint32_t RotationAngleofLayer3 : 3; 534 uint32_t RotationAngleofLayer4 : 3; 535 uint32_t RotationAngleofLayer5 : 3; 536 uint32_t RotationAngleofLayer6 : 3; 537 uint32_t RotationAngleofLayer7 : 3; 538 uint32_t ChromaSitingLocation : 3; 539 uint32_t MonoXORCompositeMask : 3; 540 uint32_t : 2; 541 }; 542 543 uint32_t Value; 544 } DW10; 545 546 // DWORD 11 - GRF R2.3 547 union 548 { 549 struct 550 { 551 float ChromasitingUOffset; // Param for 3D Sampler use case 552 }; 553 uint32_t Value; 554 } DW11; 555 556 // DWORD 12 - GRF R2.4 557 union 558 { 559 // CE 560 struct 561 { 562 uint32_t ColorProcessingEnable : 1; 563 uint32_t : 1; 564 uint32_t MessageFormat : 2; 565 uint32_t : 1; 566 uint32_t ColorProcessingStatePointer : 27; 567 }; 568 569 struct 570 { 571 float TopBottomDelta; // Used for interlace scaling on Gen9+ 572 }; 573 574 struct 575 { 576 float ChromasitingVOffset; // Param only for 3D Sampler use case 577 }; 578 579 uint32_t Value; 580 } DW12; 581 582 // DWORD 13 - GRF R2.5 583 union 584 { 585 // Colorfill ARGB 586 struct 587 { 588 uint32_t ColorFill_R : 8; // R 589 uint32_t ColorFill_G : 8; // G 590 uint32_t ColorFill_B : 8; // B 591 uint32_t ColorFill_A : 8; // A 592 }; 593 594 // Colorfill AYUV 595 struct 596 { 597 uint32_t ColorFill_V : 8; // V 598 uint32_t ColorFill_Y : 8; // Y 599 uint32_t ColorFill_U : 8; // U 600 uint32_t : 8; // A 601 }; 602 603 uint32_t Value; 604 } DW13; 605 606 // DWORD 14 - GRF R2.6 607 union 608 { 609 // Lumakey, NLAS 610 struct 611 { 612 uint32_t LumakeyLowThreshold : 8; 613 uint32_t LumakeyHighThreshold : 8; 614 uint32_t NLASEnable : 8; 615 uint32_t Sampler3DStateSetSelection : 8; 616 }; 617 618 uint32_t Value; 619 } DW14; 620 621 // DWORD 15 - GRF R2.7 622 union 623 { 624 // Save 625 struct 626 { 627 uint8_t DestinationPackedYOffset; 628 uint8_t DestinationPackedUOffset; 629 uint8_t DestinationPackedVOffset; 630 uint8_t DestinationRGBFormat; 631 }; 632 633 uint32_t Value; 634 } DW15; 635 636 // DWORD 16 - GRF R3.0 637 union 638 { 639 // Sampler Load 640 struct 641 { 642 float HorizontalScalingStepRatioLayer0; 643 }; 644 645 uint32_t Value; 646 } DW16; 647 648 // DWORD 17 - GRF R3.1 649 union 650 { 651 // Sampler Load 652 struct 653 { 654 float HorizontalScalingStepRatioLayer1; 655 }; 656 657 uint32_t Value; 658 } DW17; 659 660 // DWORD 18 - GRF R3.2 661 union 662 { 663 // Sampler Load 664 struct 665 { 666 float HorizontalScalingStepRatioLayer2; 667 }; 668 669 uint32_t Value; 670 } DW18; 671 672 // DWORD 19 - GRF R3.3 673 union 674 { 675 // Sampler Load 676 struct 677 { 678 float HorizontalScalingStepRatioLayer3; 679 }; 680 681 uint32_t Value; 682 } DW19; 683 684 // DWORD 20 - GRF R3.4 685 union 686 { 687 // Sampler Load 688 struct 689 { 690 float HorizontalScalingStepRatioLayer4; 691 }; 692 693 uint32_t Value; 694 } DW20; 695 696 // DWORD 21 - GRF R3.5 697 union 698 { 699 // Sampler Load 700 struct 701 { 702 float HorizontalScalingStepRatioLayer5; 703 }; 704 705 uint32_t Value; 706 } DW21; 707 708 // DWORD 22 - GRF R3.6 709 union 710 { 711 // Sampler Load 712 struct 713 { 714 float HorizontalScalingStepRatioLayer6; 715 }; 716 717 uint32_t Value; 718 } DW22; 719 720 // DWORD 23 - GRF R3.7 721 union 722 { 723 // Sampler Load 724 struct 725 { 726 float HorizontalScalingStepRatioLayer7; 727 }; 728 729 uint32_t Value; 730 } DW23; 731 732 // DWORD 24 - GRF R4.0 733 union 734 { 735 // Sampler Load 736 struct 737 { 738 float VerticalScalingStepRatioLayer0; 739 }; 740 741 // Dataport Load 742 struct 743 { 744 uint8_t SourcePackedYOffset; 745 uint8_t SourcePackedUOffset; 746 uint8_t SourcePackedVOffset; 747 uint8_t Reserved; 748 }; 749 750 uint32_t Value; 751 } DW24; 752 753 // DWORD 25 - GRF R4.1 754 union 755 { 756 // Sampler Load 757 struct 758 { 759 float VerticalScalingStepRatioLayer1; 760 }; 761 762 uint32_t Value; 763 } DW25; 764 765 // DWORD 26 - GRF R4.2 766 union 767 { 768 // Sampler Load 769 struct 770 { 771 float VerticalScalingStepRatioLayer2; 772 }; 773 774 // Dataport Load 775 struct 776 { 777 uint32_t HorizontalFrameOriginOffset : 16; 778 uint32_t VerticalFrameOriginOffset : 16; 779 }; 780 781 uint32_t Value; 782 } DW26; 783 784 // DWORD 27 - GRF R4.3 785 union 786 { 787 // Sampler Load 788 struct 789 { 790 float VerticalScalingStepRatioLayer3; 791 }; 792 793 uint32_t Value; 794 } DW27; 795 796 // DWORD 28 - GRF R4.4 797 union 798 { 799 // Sampler Load 800 struct 801 { 802 float VerticalScalingStepRatioLayer4; 803 }; 804 805 uint32_t Value; 806 } DW28; 807 808 // DWORD 29 - GRF R4.5 809 union 810 { 811 // Sampler Load 812 struct 813 { 814 float VerticalScalingStepRatioLayer5; 815 }; 816 817 uint32_t Value; 818 } DW29; 819 820 // DWORD 30 - GRF R4.6 821 union 822 { 823 // Sampler Load 824 struct 825 { 826 float VerticalScalingStepRatioLayer6; 827 }; 828 829 uint32_t Value; 830 } DW30; 831 832 // DWORD 31 - GRF R4.7 833 union 834 { 835 // Sampler Load 836 struct 837 { 838 float VerticalScalingStepRatioLayer7; 839 }; 840 841 uint32_t Value; 842 } DW31; 843 844 // DWORD 32 - GRF R5.0 845 union 846 { 847 // Sampler Load 848 struct 849 { 850 float VerticalFrameOriginLayer0; 851 }; 852 853 uint32_t Value; 854 } DW32; 855 856 // DWORD 33 - GRF R5.1 857 union 858 { 859 // Sampler Load 860 struct 861 { 862 float VerticalFrameOriginLayer1; 863 }; 864 865 uint32_t Value; 866 } DW33; 867 868 // DWORD 34 - GRF R5.2 869 union 870 { 871 // Sampler Load 872 struct 873 { 874 float VerticalFrameOriginLayer2; 875 }; 876 877 uint32_t Value; 878 } DW34; 879 880 // DWORD 35 - GRF R5.3 881 union 882 { 883 // Sampler Load 884 struct 885 { 886 float VerticalFrameOriginLayer3; 887 }; 888 889 uint32_t Value; 890 } DW35; 891 892 // DWORD 36 - GRF R5.4 893 union 894 { 895 // Sampler Load 896 struct 897 { 898 float VerticalFrameOriginLayer4; 899 }; 900 901 uint32_t Value; 902 } DW36; 903 904 // DWORD 37 - GRF R5.5 905 union 906 { 907 // Sampler Load 908 struct 909 { 910 float VerticalFrameOriginLayer5; 911 }; 912 913 uint32_t Value; 914 } DW37; 915 916 // DWORD 38 - GRF R5.6 917 union 918 { 919 // Sampler Load 920 struct 921 { 922 float VerticalFrameOriginLayer6; 923 }; 924 925 uint32_t Value; 926 } DW38; 927 928 // DWORD 39 - GRF R5.7 929 union 930 { 931 // Sampler Load 932 struct 933 { 934 float VerticalFrameOriginLayer7; 935 }; 936 937 uint32_t Value; 938 } DW39; 939 940 // DWORD 40 - GRF R6.0 941 union 942 { 943 // Sampler Load 944 struct 945 { 946 float HorizontalFrameOriginLayer0; 947 }; 948 949 uint32_t Value; 950 } DW40; 951 952 // DWORD 41 - GRF R6.1 953 union 954 { 955 // Sampler Load 956 struct 957 { 958 float HorizontalFrameOriginLayer1; 959 }; 960 961 uint32_t Value; 962 } DW41; 963 964 // DWORD 42 - GRF R6.2 965 union 966 { 967 // Sampler Load 968 struct 969 { 970 float HorizontalFrameOriginLayer2; 971 }; 972 973 uint32_t Value; 974 } DW42; 975 976 // DWORD 43 - GRF R6.3 977 union 978 { 979 // Sampler Load 980 struct 981 { 982 float HorizontalFrameOriginLayer3; 983 }; 984 985 uint32_t Value; 986 } DW43; 987 988 // DWORD 44 - GRF R6.4 989 union 990 { 991 // Sampler Load 992 struct 993 { 994 float HorizontalFrameOriginLayer4; 995 }; 996 997 uint32_t Value; 998 } DW44; 999 1000 // DWORD 45 - GRF R6.5 1001 union 1002 { 1003 // Sampler Load 1004 struct 1005 { 1006 float HorizontalFrameOriginLayer5; 1007 }; 1008 1009 uint32_t Value; 1010 } DW45; 1011 1012 // DWORD 46 - GRF R6.6 1013 union 1014 { 1015 // Sampler Load 1016 struct 1017 { 1018 float HorizontalFrameOriginLayer6; 1019 }; 1020 1021 uint32_t Value; 1022 } DW46; 1023 1024 // DWORD 47 - GRF R6.7 1025 union 1026 { 1027 // Sampler Load 1028 struct 1029 { 1030 float HorizontalFrameOriginLayer7; 1031 }; 1032 1033 uint32_t Value; 1034 } DW47; 1035 1036 // DWORD48 - GRF R7.0 1037 union 1038 { 1039 struct 1040 { 1041 uint32_t DestXTopLeftLayer0 : BITFIELD_RANGE(0,15); 1042 uint32_t DestYTopLeftLayer0 : BITFIELD_RANGE(16,31); 1043 }; 1044 1045 uint32_t Value; 1046 } DW48; 1047 1048 // DWORD49 - GRF R7.1 1049 union 1050 { 1051 struct 1052 { 1053 uint32_t DestXTopLeftLayer1 : BITFIELD_RANGE(0,15); 1054 uint32_t DestYTopLeftLayer1 : BITFIELD_RANGE(16,31); 1055 }; 1056 1057 uint32_t Value; 1058 } DW49; 1059 1060 // DWORD50 - GRF R7.2 1061 union 1062 { 1063 struct 1064 { 1065 uint32_t DestXTopLeftLayer2 : BITFIELD_RANGE(0,15); 1066 uint32_t DestYTopLeftLayer2 : BITFIELD_RANGE(16,31); 1067 }; 1068 1069 uint32_t Value; 1070 } DW50; 1071 1072 // DWORD51 - GRF R7.3 1073 union 1074 { 1075 struct 1076 { 1077 uint32_t DestXTopLeftLayer3 : BITFIELD_RANGE(0,15); 1078 uint32_t DestYTopLeftLayer3 : BITFIELD_RANGE(16,31); 1079 }; 1080 1081 uint32_t Value; 1082 } DW51; 1083 1084 // DWORD52 - GRF R7.4 1085 union 1086 { 1087 struct 1088 { 1089 uint32_t DestXTopLeftLayer4 : BITFIELD_RANGE(0,15); 1090 uint32_t DestYTopLeftLayer4 : BITFIELD_RANGE(16,31); 1091 }; 1092 1093 uint32_t Value; 1094 } DW52; 1095 1096 // DWORD53 - GRF R7.5 1097 union 1098 { 1099 struct 1100 { 1101 uint32_t DestXTopLeftLayer5 : BITFIELD_RANGE(0,15); 1102 uint32_t DestYTopLeftLayer5 : BITFIELD_RANGE(16,31); 1103 }; 1104 1105 uint32_t Value; 1106 } DW53; 1107 1108 // DWORD54 - GRF R7.6 1109 union 1110 { 1111 struct 1112 { 1113 uint32_t DestXTopLeftLayer6 : BITFIELD_RANGE(0,15); 1114 uint32_t DestYTopLeftLayer6 : BITFIELD_RANGE(16,31); 1115 }; 1116 1117 uint32_t Value; 1118 } DW54; 1119 1120 // DWORD55 - GRF R7.7 1121 union 1122 { 1123 struct 1124 { 1125 uint32_t DestXTopLeftLayer7 : BITFIELD_RANGE(0,15); 1126 uint32_t DestYTopLeftLayer7 : BITFIELD_RANGE(16,31); 1127 }; 1128 1129 uint32_t Value; 1130 } DW55; 1131 1132 // DWORD56 - GRF R8.0 1133 union 1134 { 1135 struct 1136 { 1137 uint32_t DestXBottomRightLayer0 : BITFIELD_RANGE(0,15); 1138 uint32_t DestYBottomRightLayer0 : BITFIELD_RANGE(16,31); 1139 }; 1140 1141 uint32_t Value; 1142 } DW56; 1143 1144 // DWORD57 - GRF R8.1 1145 union 1146 { 1147 struct 1148 { 1149 uint32_t DestXBottomRightLayer1 : BITFIELD_RANGE(0,15); 1150 uint32_t DestYBottomRightLayer1 : BITFIELD_RANGE(16,31); 1151 }; 1152 1153 uint32_t Value; 1154 } DW57; 1155 1156 // DWORD58 - GRF R8.2 1157 union 1158 { 1159 struct 1160 { 1161 uint32_t DestXBottomRightLayer2 : BITFIELD_RANGE(0,15); 1162 uint32_t DestYBottomRightLayer2 : BITFIELD_RANGE(16,31); 1163 }; 1164 1165 uint32_t Value; 1166 } DW58; 1167 1168 // DWORD59 - GRF R8.3 1169 union 1170 { 1171 struct 1172 { 1173 uint32_t DestXBottomRightLayer3 : BITFIELD_RANGE(0,15); 1174 uint32_t DestYBottomRightLayer3 : BITFIELD_RANGE(16,31); 1175 }; 1176 1177 uint32_t Value; 1178 } DW59; 1179 1180 // DWORD60 - GRF R8.4 1181 union 1182 { 1183 struct 1184 { 1185 uint32_t DestXBottomRightLayer4 : BITFIELD_RANGE(0,15); 1186 uint32_t DestYBottomRightLayer4 : BITFIELD_RANGE(16,31); 1187 }; 1188 1189 uint32_t Value; 1190 } DW60; 1191 1192 // DWORD61 - GRF R8.5 1193 union 1194 { 1195 struct 1196 { 1197 uint32_t DestXBottomRightLayer5 : BITFIELD_RANGE(0,15); 1198 uint32_t DestYBottomRightLayer5 : BITFIELD_RANGE(16,31); 1199 }; 1200 1201 uint32_t Value; 1202 } DW61; 1203 1204 // DWORD62 - GRF R8.6 1205 union 1206 { 1207 struct 1208 { 1209 uint32_t DestXBottomRightLayer6 : BITFIELD_RANGE(0,15); 1210 uint32_t DestYBottomRightLayer6 : BITFIELD_RANGE(16,31); 1211 }; 1212 1213 uint32_t Value; 1214 } DW62; 1215 1216 // DWORD63 - GRF R8.7 1217 union 1218 { 1219 struct 1220 { 1221 uint32_t DestXBottomRightLayer7 : BITFIELD_RANGE(0,15); 1222 uint32_t DestYBottomRightLayer7 : BITFIELD_RANGE(16,31); 1223 }; 1224 1225 uint32_t Value; 1226 } DW63; 1227 1228 // DWORD64 - GRF R9.0 1229 union 1230 { 1231 struct 1232 { 1233 float MainVideoXScalingStepLeft; 1234 }; 1235 1236 uint32_t Value; 1237 } DW64; 1238 1239 // DWORD65 - GRF R9.1 1240 union 1241 { 1242 struct 1243 { 1244 float VideoStepDeltaForNonLinearRegion; 1245 }; 1246 1247 uint32_t Value; 1248 } DW65; 1249 1250 // DWORD66 - GRF R9.2 1251 union 1252 { 1253 struct 1254 { 1255 uint32_t StartofLinearScalingInPixelPositionC0 : BITFIELD_RANGE(0,15); 1256 uint32_t StartofRHSNonLinearScalingInPixelPositionC1 : BITFIELD_RANGE(16,31); 1257 }; 1258 1259 uint32_t Value; 1260 } DW66; 1261 1262 // DWORD 67 - GRF R9.3 1263 union 1264 { 1265 // Sampler Load 1266 struct 1267 { 1268 float MainVideoXScalingStepCenter; 1269 }; 1270 1271 uint32_t Value; 1272 } DW67; 1273 1274 // DWORD 68 - GRF R9.4 1275 union 1276 { 1277 // Sampler Load 1278 struct 1279 { 1280 float MainVideoXScalingStepRight; 1281 }; 1282 1283 uint32_t Value; 1284 } DW68; 1285 1286 // DWORD63 - GRF R8.7 1287 union 1288 { 1289 struct 1290 { 1291 uint32_t DestHorizontalBlockOrigin : BITFIELD_RANGE(0,15); 1292 uint32_t DestVerticalBlockOrigin : BITFIELD_RANGE(16,31); 1293 }; 1294 1295 uint32_t Value; 1296 } DW69; 1297 1298 // DWORD 70-71 - GRF 9.6-9.7 - Padding is needed as we program ConstantURBEntryReadLength = iCurbeLength >> 5 1299 uint32_t dwPad[2]; 1300 }; 1301 1302 #define VP_MAX_PROCAMP 2 1303 1304 #define VP_COMP_SAMPLER_NEAREST 1 1305 #define VP_COMP_SAMPLER_BILINEAR 2 1306 #define VP_COMP_SAMPLER_LUMAKEY 4 1307 1308 #define VP_COMP_MAX_LAYERS 8 1309 #define VP_COMP_MAX_PALETTES 2 1310 #define VP_COMP_MAX_PROCAMP 1 1311 #define VP_COMP_MAX_LUMA_KEY 1 1312 #define VP_COMP_MAX_AVS 1 1313 #define VP_COMP_MAX_SAMPLER (VP_COMP_SAMPLER_NEAREST | VP_COMP_SAMPLER_BILINEAR | VP_COMP_SAMPLER_LUMAKEY) 1314 1315 C_ASSERT(VP_MAX_PROCAMP >= VP_COMP_MAX_PROCAMP); 1316 1317 struct VP_LAYER_CALCULATED_PARAMS 1318 { 1319 uint16_t alpha = 255; 1320 float fScaleX = 0; 1321 float fScaleY = 0; 1322 float fOffsetY = 0; 1323 float fOffsetX = 0; 1324 float fShiftX = 0; 1325 float fShiftY = 0; 1326 1327 RECT clipedDstRect = {}; // Clipped dest rectangle 1328 bool isChromaUpSamplingNeeded = false; 1329 bool isChromaDownSamplingNeeded = false; 1330 MHW_SAMPLER_FILTER_MODE samplerFilterMode = MHW_SAMPLER_FILTER_MODE::MHW_SAMPLER_FILTER_NEAREST; 1331 1332 bool chromaSitingEnabled = false; //!< Chromasiting flag 1333 }; 1334 1335 // Need be gotten with surface entry. 1336 struct VP_LAYER_CALCULATED_PARAMS2 1337 { 1338 float fStepX = 0; 1339 float fStepY = 0; 1340 float fOriginX = 0; 1341 float fOriginY = 0; 1342 }; 1343 1344 struct VP_FC_LAYER 1345 { 1346 VP_SURFACE *surf; //!< rcDst in surf is the one with rotation, which is different from the rcDst in SwfilterScaling 1347 int32_t layerID; 1348 int32_t layerIDOrigin; //!< Origin layerID before layerSkipped, which can be used to reference surfaces in SurfaceGroup. 1349 VPHAL_SCALING_MODE scalingMode; 1350 bool iefEnabled; 1351 bool iscalingEnabled; 1352 VPHAL_ROTATION rotation; 1353 bool useSampleUnorm = false; //!< true: sample unorm is used, false: DScaler or AVS is used. 1354 bool useSamplerLumakey; //!< Disabled on Gen12 1355 bool fieldWeaving; 1356 int32_t paletteID = 0; //!<Palette Allocation 1357 bool queryVariance; 1358 bool xorComp = false; //!< is mono-chroma composite mode. 1359 VP_SURFACE *surfField = nullptr; //!< For SurfaceTypeFcInputLayer0Field1Dual during iscaling and fieldWeaving. 1360 1361 // Filled by hwFilter 1362 VP_LAYER_CALCULATED_PARAMS calculatedParams = {}; //!< Only valid in source. 1363 // Filled by packet 1364 VP_LAYER_CALCULATED_PARAMS2 calculatedParams2 = {}; //!< calcualted parameters which need be normalized by surface entry. 1365 1366 // Need be initialized during SetupSurfaceState. 1367 PRENDERHAL_SURFACE_STATE_ENTRY surfaceEntries[MHW_MAX_SURFACE_PLANES] = {}; 1368 uint32_t numOfSurfaceEntries = 0; 1369 1370 PVPHAL_DI_PARAMS diParams; 1371 PVPHAL_LUMAKEY_PARAMS lumaKeyParams; 1372 PVPHAL_BLENDING_PARAMS blendingParams; 1373 PVPHAL_PROCAMP_PARAMS procampParams; 1374 }; 1375 1376 #define VP_COMP_MAX_LAYERS 8 1377 #define VP_MAX_TARGETS 8 //!< multi output support 1378 1379 //! 1380 //! \brief Structure to VPHAL Composite Parameters 1381 //! 1382 struct VP_COMPOSITE_PARAMS 1383 { 1384 // Pointer to target and source surfaces 1385 uint32_t sourceCount; //!< Number of sources 1386 VP_FC_LAYER source[VP_COMP_MAX_LAYERS]; 1387 uint32_t targetCount; //!< Number of targets 1388 VP_FC_LAYER target[VPHAL_MAX_TARGETS]; //!< Render targets 1389 // Needed by CP during MHW VP integration, due to pTokenState->pResourceInfo 1390 //RENDERHAL_SURFACE renderHalSurfaceSrc[VP_COMP_MAX_LAYERS]; 1391 //RENDERHAL_SURFACE renderHalSurfaceSrcField[VP_COMP_MAX_LAYERS]; 1392 //RENDERHAL_SURFACE renderHalSurfaceTarget[VP_MAX_TARGETS]; 1393 1394 PVPHAL_COLORFILL_PARAMS pColorFillParams; //!< ColorFill - BG only 1395 PVPHAL_ALPHA_PARAMS pCompAlpha; //!< Alpha for composited surface 1396 bool bAlphaCalculateEnable; //!< Alpha Calculation flag 1397 1398 // Resource counters 1399 struct 1400 { 1401 int32_t layers; 1402 int32_t palettes; 1403 int32_t avs; 1404 int32_t procamp; 1405 int32_t lumaKeys; 1406 int32_t sampler; 1407 } resCounter; 1408 //VPHAL_ROTATION rotation; //!< Layer 0 rotation info 1409 }; 1410 1411 class VpCompositeParamsPool 1412 { 1413 public: VpCompositeParamsPool()1414 VpCompositeParamsPool() 1415 { 1416 } ~VpCompositeParamsPool()1417 virtual ~VpCompositeParamsPool() 1418 { 1419 } 1420 Assign()1421 VP_COMPOSITE_PARAMS *Assign() 1422 { 1423 VP_COMPOSITE_PARAMS *p = nullptr; 1424 if (0 == m_idle.size()) 1425 { 1426 m_pool.push_back(VP_COMPOSITE_PARAMS()); 1427 p = &m_pool[m_pool.size() - 1]; 1428 } 1429 else 1430 { 1431 p = m_idle.begin()->second; 1432 m_idle.erase(p); 1433 } 1434 m_inuse.insert(std::make_pair(p, p)); 1435 return p; 1436 } 1437 Release(VP_COMPOSITE_PARAMS * & p)1438 void Release(VP_COMPOSITE_PARAMS *&p) 1439 { 1440 if (nullptr == p || m_inuse.end() == m_inuse.find(p)) 1441 { 1442 return; 1443 } 1444 m_inuse.erase(p); 1445 m_idle.insert(std::make_pair(p, p)); 1446 } 1447 1448 private: 1449 std::vector<VP_COMPOSITE_PARAMS> m_pool; 1450 std::map<VP_COMPOSITE_PARAMS *, VP_COMPOSITE_PARAMS *> m_inuse; 1451 std::map<VP_COMPOSITE_PARAMS *, VP_COMPOSITE_PARAMS *> m_idle; 1452 1453 MEDIA_CLASS_DEFINE_END(vp__VpCompositeParamsPool) 1454 }; 1455 1456 } 1457 #endif // !__VP_RENDER_FC_TYPES_H__ 1458