1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725
|
/*==============================================================================
Copyright(c) 2017 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files(the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and / or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
============================================================================*/
#include "Internal/Common/GmmLibInc.h"
#include <stdlib.h>
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::Create.
/// @see GmmLib::GmmResourceInfoCommon::Create()
///
/// @param[in] pCreateParams: Flags which specify what sort of resource to create
/// @return Pointer to GmmResourceInfo class.
/////////////////////////////////////////////////////////////////////////////////////
GMM_RESOURCE_INFO *GMM_STDCALL GmmResCreate(GMM_RESCREATE_PARAMS *pCreateParams)
{
GMM_RESOURCE_INFO *pRes = NULL;
#if(!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
pRes = GmmResCreateThroughClientCtxt(pCreateParams);
return pRes;
#else
// GMM_RESOURCE_INFO...
if(pCreateParams->pPreallocatedResInfo)
{
pRes = new(pCreateParams->pPreallocatedResInfo) GmmLib::GmmResourceInfo(); // Use preallocated memory as a class
pCreateParams->Flags.Info.__PreallocatedResInfo =
pRes->GetResFlags().Info.__PreallocatedResInfo = 1; // Set both in case we can die before copying over the flags.
}
else
{
if((pRes = new GMM_RESOURCE_INFO) == NULL)
{
GMM_ASSERTDPF(0, "Allocation failed!");
goto ERROR_CASE;
}
}
if(pRes->Create(*pGmmGlobalContext, *pCreateParams) != GMM_SUCCESS)
{
goto ERROR_CASE;
}
return (pRes);
ERROR_CASE:
if(pRes)
{
GmmResFree(pRes);
}
GMM_DPF_EXIT;
return (NULL);
#endif
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::opeartor=. Allocates a new class and
/// returns a pointer to it. The new class must be free'd explicitly by the client.
///
/// @see GmmLib::GmmResourceInfoCommon::operator=()
///
/// @param[in] pRes: Pointer to the GmmResourceInfo class that needs to be copied
/// @return Pointer to newly copied GmmResourceInfo class
/////////////////////////////////////////////////////////////////////////////////////
GMM_RESOURCE_INFO *GMM_STDCALL GmmResCopy(GMM_RESOURCE_INFO *pRes)
{
GMM_RESOURCE_INFO *pResCopy = NULL;
GMM_DPF_ENTER;
__GMM_ASSERTPTR(pRes, NULL);
#if(!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
pResCopy = GmmResCopyThroughClientCtxt(pRes);
return pResCopy;
#else
pResCopy = new GMM_RESOURCE_INFO;
if(!pResCopy)
{
GMM_ASSERTDPF(0, "Allocation failed.");
return NULL;
}
*pResCopy = *pRes;
// We are allocating new class, flag must be false to avoid leak at DestroyResource
pResCopy->GetResFlags().Info.__PreallocatedResInfo = 0;
GMM_DPF_EXIT;
return (pResCopy);
#endif
}
/////////////////////////////////////////////////////////////////////////////////////
/// Helps clients copy one GmmResourceInfo object to another
///
/// @param[in] pDst: Pointer to memory when pSrc will be copied.
/// @param[in] pSrc: Pointer to GmmResourceInfo class that needs to be copied
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResMemcpy(void *pDst, void *pSrc)
{
#if(!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
GmmResMemcpyThroughClientCtxt(pDst, pSrc);
#else
GMM_RESOURCE_INFO *pResSrc = reinterpret_cast<GMM_RESOURCE_INFO *>(pSrc);
// Init memory correctly, in case the pointer is a raw memory pointer
GMM_RESOURCE_INFO *pResDst = new(pDst) GMM_RESOURCE_INFO();
*pResDst = *pResSrc;
#endif
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for ~GmmResourceInfoCommon. Frees the resource if it wasn't part of
/// ::GMM_RESCREATE_PARAMS::pPreallocatedResInfo.
/// @see GmmLib::GmmResourceInfoCommon::~GmmResourceInfoCommon()
///
/// @param[in] pRes: Pointer to the GmmResourceInfo class that needs to be freed
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResFree(GMM_RESOURCE_INFO *pRes)
{
GMM_DPF_ENTER;
__GMM_ASSERTPTR(pRes, VOIDRETURN);
#if(!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
GmmResFreeThroughClientCtxt(pRes);
#else
if(pRes->GetResFlags().Info.__PreallocatedResInfo)
{
*pRes = GmmLib::GmmResourceInfo();
}
else
{
delete pRes;
pRes = NULL;
}
#endif
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetSystemMemPointer.
/// @see GmmLib::GmmResourceInfoCommon::GetSystemMemPointer()
///
/// @param[in] pRes: Pointer to the GmmResourceInfo class
/// @param[in] IsD3DDdiAllocation: Specifies where allocation was made by a D3D client
/// @return Pointer to system memory. NULL if not available.
/////////////////////////////////////////////////////////////////////////////////////
void *GMM_STDCALL GmmResGetSystemMemPointer(GMM_RESOURCE_INFO *pRes,
uint8_t IsD3DDdiAllocation)
{
GMM_DPF_ENTER;
__GMM_ASSERTPTR(pRes, NULL);
return pRes->GetSystemMemPointer(IsD3DDdiAllocation);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetSystemMemSize.
/// @see GmmLib::GmmResourceInfoCommon::GetSystemMemSize()
///
/// @param[in] pRes: Pointer to the GmmResourceInfo class
/// @return Size of memory.
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSystemMemSize(GMM_RESOURCE_INFO *pRes)
{
__GMM_ASSERTPTR(pRes, ((GMM_GFX_SIZE_T)0));
return pRes->GetSystemMemSize();
}
/////////////////////////////////////////////////////////////////////////////////////
/// This function returns size of GMM_RESOURCE_INFO
///
/// @return size of class
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetSizeOfStruct(void)
{
return (sizeof(GMM_RESOURCE_INFO));
}
/////////////////////////////////////////////////////////////////////////////////////
/// This function returns resource flags
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[out] pFlags: Memory where resource flags will be copied
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResGetFlags(GMM_RESOURCE_INFO *pGmmResource,
GMM_RESOURCE_FLAG *pFlags /*output*/)
{
GMM_DPF_ENTER;
__GMM_ASSERTPTR(pGmmResource, VOIDRETURN);
__GMM_ASSERTPTR(pFlags, VOIDRETURN);
*pFlags = GmmResGetResourceFlags(pGmmResource);
GMM_DPF_EXIT;
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetResourceType.
/// @see GmmLib::GmmResourceInfoCommon::GetResourceType()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Resource Type
/////////////////////////////////////////////////////////////////////////////////////
GMM_RESOURCE_TYPE GMM_STDCALL GmmResGetResourceType(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, RESOURCE_INVALID);
return pGmmResource->GetResourceType();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetResourceFormat.
/// @see GmmLib::GmmResourceInfoCommon::GetResourceFormat()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Resource Format
/////////////////////////////////////////////////////////////////////////////////////
GMM_RESOURCE_FORMAT GMM_STDCALL GmmResGetResourceFormat(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, GMM_FORMAT_INVALID);
return pGmmResource->GetResourceFormat();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetPaddedWidth.
/// @see GmmLib::GmmResourceInfoCommon::GetPaddedWidth()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in] MipLevel: Requested mip level
/// @return Padded Width
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetPaddedWidth(GMM_RESOURCE_INFO *pGmmResource,
uint32_t MipLevel)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetPaddedWidth(MipLevel);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetPaddedHeight.
/// @see GmmLib::GmmResourceInfoCommon::GetPaddedHeight()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in] MipLevel: Requested mip level
/// @return Padded Height
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetPaddedHeight(GMM_RESOURCE_INFO *pGmmResource,
uint32_t MipLevel)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetPaddedHeight(MipLevel);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetPaddedPitch.
/// @see GmmLib::GmmResourceInfoCommon::GetPaddedPitch()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in] MipLevel: Requested mip level
/// @return Padded Pitch
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetPaddedPitch(GMM_RESOURCE_INFO *pGmmResource,
uint32_t MipLevel)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetPaddedPitch(MipLevel);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetBaseWidth. Truncates width to
/// 32-bit.
/// @see GmmLib::GmmResourceInfoCommon::GetBaseWidth()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Width
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetBaseWidth(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return GFX_ULONG_CAST(pGmmResource->GetBaseWidth());
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetBaseWidth.
/// @see GmmLib::GmmResourceInfoCommon::GetBaseWidth()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Width
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetBaseWidth64(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetBaseWidth();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetBaseAlignment.
/// @see GmmLib::GmmResourceInfoCommon::GetBaseAlignment()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Base Alignment
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetBaseAlignment(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetBaseAlignment();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetBaseHeight.
/// @see GmmLib::GmmResourceInfoCommon::GetBaseHeight()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Height
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetBaseHeight(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetBaseHeight();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GmmResGetDepth.
/// @see GmmLib::GmmResourceInfoCommon::GmmResGetDepth()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Depth
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetDepth(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetBaseDepth();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetMaxLod.
/// @see GmmLib::GmmResourceInfoCommon::GetMaxLod()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Max Lod
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetMaxLod(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetMaxLod();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetMipTailStartLod.SurfaceState
/// @see GmmLib::GmmResourceInfoCommon::GetMipTailStartLodSurfaceState()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Mip Tail Starts
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetSurfaceStateMipTailStartLod(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetMipTailStartLodSurfaceState();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetTileAddressMappingMode.SurfaceState
/// @see GmmLib::GmmResourceInfoCommon::GetTileAddressMappingModeSurfaceState()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Tile Address Mapping Mode
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetSurfaceStateTileAddressMappingMode(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetTileAddressMappingModeSurfaceState();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetStdTilingModeExt.SurfaceState
/// @see GmmLib::GmmResourceInfoCommon::GetStdTilingModeExtSurfaceState()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Std Tiling Mode Ext
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetSurfaceStateStdTilingModeExt(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, GMM_INVALIDPARAM);
return pGmmResource->GetStdTilingModeExtSurfaceState();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetArraySize.
/// @see GmmLib::GmmResourceInfoCommon::GetArraySize()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Array Size
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetArraySize(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetArraySize();
}
#if(LHDM)
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetRefreshRate.
/// @see GmmLib::GmmResourceInfoCommon::GetRefreshRate()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Refresh rate
/////////////////////////////////////////////////////////////////////////////////////
D3DDDI_RATIONAL GMM_STDCALL GmmResGetRefreshRate(GMM_RESOURCE_INFO *pGmmResource)
{
D3DDDI_RATIONAL RetVal = {0};
__GMM_ASSERTPTR(pGmmResource, RetVal);
return pGmmResource->GetRefreshRate();
}
#endif // LHDM
#if(LHDM)
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoWin::GetD3d9Flags.
/// @see GmmLib::GmmResourceInfoWin::GetD3d9Flags()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[out] pD3d9Flags: Mscaps data is copied to this param
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResGetD3d9Flags(GMM_RESOURCE_INFO * pGmmResource,
D3DDDI_RESOURCEFLAGS *pD3d9Flags)
{
__GMM_ASSERTPTR(pGmmResource, VOIDRETURN);
__GMM_ASSERTPTR(pD3d9Flags, VOIDRETURN);
*pD3d9Flags = pGmmResource->GetD3d9Flags();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoWin::GetD3d9Format.
/// @see GmmLib::GmmResourceInfoWin::GetD3d9Format()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return D3d9 format for the resource
/////////////////////////////////////////////////////////////////////////////////////
D3DDDIFORMAT GMM_STDCALL GmmResGetD3d9Format(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, (D3DDDIFORMAT)0);
return pGmmResource->GetD3d9Format();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoWin::GetVidSourceId.
/// @see GmmLib::GmmResourceInfoWin::GetVidSourceId()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Source Id
/////////////////////////////////////////////////////////////////////////////////////
D3DDDI_VIDEO_PRESENT_SOURCE_ID GMM_STDCALL GmmResGetVidSourceId(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetVidSourceId();
}
#endif // LHDM
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoWin::Is64KBPageSuitable.
/// @see GmmLib::GmmResourceInfoWin::Is64KBPageSuitable()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return 1/0
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResIs64KBPageSuitable(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->Is64KBPageSuitable();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetRotateInfo.
/// @see GmmLib::GmmResourceInfoCommon::GetRotateInfo()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return rotation info
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetRotateInfo(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetRotateInfo();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetAuxQPitch.
/// @see GmmLib::GmmResourceInfoCommon::GetAuxQPitch()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Aux QPitch
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetAuxQPitch(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetAuxQPitch();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetQPitch.
/// @see GmmLib::GmmResourceInfoCommon::GetQPitch()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return QPitch
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetQPitch(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetQPitch();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetQPitchPlanar.
/// @see GmmLib::GmmResourceInfoCommon::GetQPitchPlanar()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Planar QPitch
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetQPitchPlanar(GMM_RESOURCE_INFO *pGmmResource, GMM_YUV_PLANE Plane)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetQPitchPlanar(Plane);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetQPitchInBytes.
/// @see GmmLib::GmmResourceInfoCommon::GetQPitchInBytes()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return QPitch
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetQPitchInBytes(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetQPitchInBytes();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetRenderPitch.
/// @see GmmLib::GmmResourceInfoCommon::GetRenderPitch()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Pitch
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetRenderPitch(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return GFX_ULONG_CAST(pGmmResource->GetRenderPitch());
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetRenderPitchTiles.
/// @see GmmLib::GmmResourceInfoCommon::GetRenderPitchTiles()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Pitch in tiles
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetRenderPitchTiles(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetRenderPitchTiles();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetRenderAuxPitchTiles.
/// @see GmmLib::GmmResourceInfoCommon::GetRenderAuxPitchTiles()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Aux Pitch in tiles
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetRenderAuxPitchTiles(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetRenderAuxPitchTiles();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetUnifiedAuxPitch.
/// @see GmmLib::GmmResourceInfoCommon::GetUnifiedAuxPitch()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Aux Pitch
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetAuxPitch(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return GFX_ULONG_CAST(pGmmResource->GetUnifiedAuxPitch());
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetBitsPerPixel.
/// @see GmmLib::GmmResourceInfoCommon::GetBitsPerPixel()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return bpp
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetBitsPerPixel(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetBitsPerPixel();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetUnifiedAuxBitsPerPixel.
/// @see GmmLib::GmmResourceInfoCommon::GetUnifiedAuxBitsPerPixel()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return bpp
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetAuxBitsPerPixel(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetUnifiedAuxBitsPerPixel();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetCompressionBlockXxx.
/// @see GmmLib::GmmResourceInfoCommon::GetCompressionBlockWidth()
/// @see GmmLib::GmmResourceInfoCommon::GetCompressionBlockHeight()
/// @see GmmLib::GmmResourceInfoCommon::GetCompressionBlockDepth()
///
/// @param[in] pRes: Pointer to the GmmResourceInfo class
/// @return Compression Block Width/Height/Depth
/////////////////////////////////////////////////////////////////////////////////////
#define GmmResGetCompressionBlockXxx(Xxx) \
uint32_t GMM_STDCALL GmmResGetCompressionBlock##Xxx(GMM_RESOURCE_INFO *pGmmResource) \
{ \
__GMM_ASSERTPTR(pGmmResource, 1); \
return pGmmResource->GetCompressionBlock##Xxx(); \
} ///////////////////////////////////////////////////////
GmmResGetCompressionBlockXxx(Width)
GmmResGetCompressionBlockXxx(Height)
GmmResGetCompressionBlockXxx(Depth)
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetUnifiedAuxBitsPerPixel.
/// @see GmmLib::GmmResourceInfoCommon::GetUnifiedAuxBitsPerPixel()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in][out] pReqInfo: Has info about which offset client is requesting. Offset is also
/// passed back to the client in this parameter.
/// @return ::GMM_STATUS
/////////////////////////////////////////////////////////////////////////////////////
GMM_STATUS GMM_STDCALL GmmResGetOffset(GMM_RESOURCE_INFO * pGmmResource,
GMM_REQ_OFFSET_INFO *pReqInfo)
{
__GMM_ASSERTPTR(pGmmResource, GMM_ERROR);
__GMM_ASSERTPTR(pReqInfo, GMM_ERROR);
return pGmmResource->GetOffset(*pReqInfo);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetTextureLayout.
/// @see GmmLib::GmmResourceInfoCommon::GetTextureLayout()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return GMM_2D_LAYOUT_RIGHT or GMM_2D_LAYOUT_BELOW
/////////////////////////////////////////////////////////////////////////////////////
GMM_TEXTURE_LAYOUT GMM_STDCALL GmmResGetTextureLayout(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetTextureLayout();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetTileType.
/// @see GmmLib::GmmResourceInfoCommon::GetTileType()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return ::GMM_TILE_TYPE
/////////////////////////////////////////////////////////////////////////////////////
GMM_TILE_TYPE GMM_STDCALL GmmResGetTileType(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetTileType();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetMipHeight.
/// @see GmmLib::GmmResourceInfoCommon::GetMipHeight()
///
/// @param[in] pResourceInfo: Pointer to the GmmResourceInfo class
/// @param[in] MipLevel: Mip level for which the info is needed
/// @return Mip Height
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetMipHeight(GMM_RESOURCE_INFO *pResourceInfo, uint32_t MipLevel)
{
return pResourceInfo->GetMipHeight(MipLevel);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetMipWidth.
/// @see GmmLib::GmmResourceInfoCommon::GetMipWidth()
///
/// @param[in] pResourceInfo: Pointer to the GmmResourceInfo class
/// @param[in] MipLevel: Mip level for which the info is needed
/// @return Mip Width
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetMipWidth(GMM_RESOURCE_INFO *pResourceInfo, uint32_t MipLevel)
{
return pResourceInfo->GetMipWidth(MipLevel);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetMipDepth.
/// @see GmmLib::GmmResourceInfoCommon::GetMipDepth()
///
/// @param[in] pResourceInfo: Pointer to the GmmResourceInfo class
/// @param[in] MipLevel: Mip level for which the info is needed
/// @return Mip Depth
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetMipDepth(GMM_RESOURCE_INFO *pResourceInfo, uint32_t MipLevel)
{
return pResourceInfo->GetMipDepth(MipLevel);
}
//=============================================================================
//
// Function:GmmResGetCornerTexelMode
//
// Desc:
// Simple getter function to return the Corner Texel Mode of a surface.
//
// Parameters:
// pGmmResource: ==> A previously allocated resource.
//
// Returns:
// CornerTexelMode flag ==> uint8_t
//-----------------------------------------------------------------------------
uint8_t GMM_STDCALL GmmResGetCornerTexelMode(GMM_RESOURCE_INFO *pGmmResource)
{
GMM_DPF_ENTER;
__GMM_ASSERT(pGmmResource);
return ((pGmmResource->GetResFlags().Info.CornerTexelMode) ? 1 : 0);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetCpuCacheType.
/// @see GmmLib::GmmResourceInfoCommon::GetCpuCacheType()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return ::GMM_CPU_CACHE_TYPE
/////////////////////////////////////////////////////////////////////////////////////
GMM_CPU_CACHE_TYPE GMM_STDCALL GmmResGetCpuCacheType(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetCpuCacheType();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetMmcMode.
/// @see GmmLib::GmmResourceInfoCommon::GetMmcMode()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in] ArrayIndex: ArrayIndex for which this info is needed
/// @return Media Memory Compression Mode (Disabled, Horizontal, Vertical)
/////////////////////////////////////////////////////////////////////////////////////
GMM_RESOURCE_MMC_INFO GMM_STDCALL GmmResGetMmcMode(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArrayIndex)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetMmcMode(ArrayIndex);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::SetMmcMode.
/// @see GmmLib::GmmResourceInfoCommon::SetMmcMode()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in] Mode Media Memory Compression Mode (Disabled, Horizontal, Vertical)
/// @param[in] ArrayIndex ArrayIndex for which this info needs to be set
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResSetMmcMode(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_MMC_INFO Mode, uint32_t ArrayIndex)
{
__GMM_ASSERTPTR(pGmmResource, VOIDRETURN);
pGmmResource->SetMmcMode(Mode, ArrayIndex);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::IsMediaMemoryCompressed.
/// @see GmmLib::GmmResourceInfoCommon::IsMediaMemoryCompressed()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in] ArrayIndex ArrayIndex for which this info is needed
/// @return 1 (enabled), 0 (disabled)
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResIsMediaMemoryCompressed(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArrayIndex)
{
return pGmmResource->IsMediaMemoryCompressed(ArrayIndex);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetMmcHint.
/// @see GmmLib::GmmResourceInfoCommon::GetMmcHint()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in] ArrayIndex ArrayIndex for which this info is needed
/// @return true/false
/////////////////////////////////////////////////////////////////////////////////////
GMM_RESOURCE_MMC_HINT GMM_STDCALL GmmResGetMmcHint(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArrayIndex)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetMmcHint(ArrayIndex);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::SetMmcHint.
/// @see GmmLib::GmmResourceInfoCommon::SetMmcHint()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @param[in] Hint Mmc hint to store
/// @param[in] ArrayIndex ArrayIndex for which this info is needed
/// @return true/false
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResSetMmcHint(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_MMC_HINT Hint, uint32_t ArrayIndex)
{
__GMM_ASSERTPTR(pGmmResource, VOIDRETURN);
pGmmResource->SetMmcHint(Hint, ArrayIndex);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetNumSamples.
/// @see GmmLib::GmmResourceInfoCommon::GetNumSamples()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Sample count
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetNumSamples(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetNumSamples();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetSamplePattern.
/// @see GmmLib::GmmResourceInfoCommon::GetSamplePattern()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return Sample count
/////////////////////////////////////////////////////////////////////////////////////
GMM_MSAA_SAMPLE_PATTERN GMM_STDCALL GmmResGetSamplePattern(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetSamplePattern();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetHAlign.
/// @see GmmLib::GmmResourceInfoCommon::GetHAlign()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return HAlign
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetHAlign(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetHAlign();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetVAlign.
/// @see GmmLib::GmmResourceInfoCommon::GetVAlign()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return VAlign
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetVAlign(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetVAlign();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetAuxHAlign.
/// @see GmmLib::GmmResourceInfoCommon::GetAuxHAlign()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return HAlign
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetAuxHAlign(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetAuxHAlign();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::GetAuxVAlign.
/// @see GmmLib::GmmResourceInfoCommon::GetAuxVAlign()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return VAlign
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetAuxVAlign(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetAuxVAlign();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::IsArraySpacingSingleLod.
/// @see GmmLib::GmmResourceInfoCommon::IsArraySpacingSingleLod()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return 1/0
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResIsArraySpacingSingleLod(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->IsArraySpacingSingleLod();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::IsASTC.
/// @see GmmLib::GmmResourceInfoCommon::IsASTC()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return 1/0
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResIsASTC(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->IsASTC();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::IsMsaaFormatDepthStencil.
/// @see GmmLib::GmmResourceInfoCommon::IsMsaaFormatDepthStencil()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return 1/0
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResIsMsaaFormatDepthStencil(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->IsMsaaFormatDepthStencil();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmLib::GmmResourceInfoCommon::IsSvm.
/// @see GmmLib::GmmResourceInfoCommon::IsSvm()
///
/// @param[in] pGmmResource: Pointer to the GmmResourceInfo class
/// @return 1/0
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResIsSvm(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->IsSvm();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::ValidateParams
/// @see GmmLib::GmmResourceInfoCommon::ValidateParams()
///
/// @param[in] pResourceInfo: Pointer to GmmResourceInfo class
/// @return 1 is validation passed. 0 otherwise.
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResValidateParams(GMM_RESOURCE_INFO *pResourceInfo)
{
return pResourceInfo->ValidateParams();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::SetPrivateData
/// @see GmmLib::GmmResourceInfoCommon::SetPrivateData()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] pPrivateData: Pointer to opaque private data from clients
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResSetPrivateData(GMM_RESOURCE_INFO *pGmmResource, void *pPrivateData)
{
__GMM_ASSERTPTR(pGmmResource, VOIDRETURN);
pGmmResource->SetPrivateData(pPrivateData);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetPrivateData
/// @see GmmLib::GmmResourceInfoCommon::GetPrivateData()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return pointer to opaque private data
/////////////////////////////////////////////////////////////////////////////////////
void *GMM_STDCALL GmmResGetPrivateData(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetPrivateData();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetGfxAddress
/// @see GmmLib::GmmResourceInfoCommon::GetGfxAddress()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return Gfx address
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_ADDRESS GMM_STDCALL GmmResGetGfxAddress(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetGfxAddress();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetTallBufferHeight
/// @see GmmLib::GmmResourceInfoCommon::GetTallBufferHeight()
///
/// @param[in] pResourceInfo: Pointer to GmmResourceInfo class
/// @return Surface height
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetTallBufferHeight(GMM_RESOURCE_INFO *pResourceInfo)
{
__GMM_ASSERTPTR(pResourceInfo, 0);
return pResourceInfo->GetTallBufferHeight();
};
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetSizeMainSurface
/// @see GmmLib::GmmResourceInfoCommon::GetSizeMainSurface()
///
/// @param[in] pResourceInfo: Pointer to GmmResourceInfo class
/// @return Size of main surface
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSizeMainSurface(const GMM_RESOURCE_INFO *pResourceInfo)
{
return pResourceInfo->GetSizeMainSurface();
}
//TODO(Low) : Remove when client moves to new interface
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetSizeSurface
/// @see GmmLib::GmmResourceInfoCommon::GetSizeSurface()
///
/// @param[in] pResourceInfo: Pointer to GmmResourceInfo class
/// @return Surface Size
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetRenderSize(GMM_RESOURCE_INFO *pResourceInfo)
{
__GMM_ASSERTPTR(pResourceInfo, 0);
return GFX_ULONG_CAST(pResourceInfo->GetSizeSurface());
}
uint32_t GMM_STDCALL GmmResGetAuxSurfaceSize(GMM_RESOURCE_INFO *pGmmResource, GMM_UNIFIED_AUX_TYPE GmmAuxType)
{
return GFX_ULONG_CAST(GmmResGetSizeAuxSurface(pGmmResource, GmmAuxType));
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetSizeSurface
/// @see GmmLib::GmmResourceInfoCommon::GetSizeSurface()
///
/// @param[in] pResourceInfo: Pointer to GmmResourceInfo class
/// @return Surface Size
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSizeSurface(GMM_RESOURCE_INFO *pResourceInfo)
{
__GMM_ASSERTPTR(pResourceInfo, 0);
return pResourceInfo->GetSizeSurface();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetSizeAllocation
/// @see GmmLib::GmmResourceInfoCommon::GetSizeAllocation()
///
/// @param[in] pResourceInfo: Pointer to GmmResourceInfo class
/// @return Allocation Size
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSizeAllocation(GMM_RESOURCE_INFO *pResourceInfo)
{
__GMM_ASSERTPTR(pResourceInfo, 0);
return pResourceInfo->GetSizeAllocation();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetResourceFormatSurfaceState
/// @see GmmLib::GmmResourceInfoCommon::GetResourceFormatSurfaceState()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return Resource format
/////////////////////////////////////////////////////////////////////////////////////
GMM_SURFACESTATE_FORMAT GMM_STDCALL GmmResGetSurfaceStateFormat(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, GMM_SURFACESTATE_FORMAT_INVALID);
return pGmmResource->GetResourceFormatSurfaceState();
}
//=============================================================================
//
// Function: GmmGetSurfaceStateFormat
//
// Desc: See below.
//
// Returns:
// SURFACE_STATE.Format for the given resource or
// GMM_SURFACESTATE_FORMAT_INVALID if resource wasn't created with a
// direct SURFACE_STATE.Format.
//
//-----------------------------------------------------------------------------
GMM_SURFACESTATE_FORMAT GMM_STDCALL GmmGetSurfaceStateFormat(GMM_RESOURCE_FORMAT Format)
{
return ((Format > GMM_FORMAT_INVALID) &&
(Format < GMM_RESOURCE_FORMATS)) ?
pGmmGlobalContext->GetPlatformInfo().FormatTable[Format].SurfaceStateFormat :
GMM_SURFACESTATE_FORMAT_INVALID;
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetHAlignSurfaceState
/// @see GmmLib::GmmResourceInfoCommon::GetHAlignSurfaceState()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return HAlign
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetSurfaceStateHAlign(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetHAlignSurfaceState();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetVAlignSurfaceState
/// @see GmmLib::GmmResourceInfoCommon::GetVAlignSurfaceState()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return VAlign
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetSurfaceStateVAlign(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetVAlignSurfaceState();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetTiledResourceModeSurfaceState
/// @see GmmLib::GmmResourceInfoCommon::GetTiledResourceModeSurfaceState()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return Tiled Resource Mode
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetSurfaceStateTiledResourceMode(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetTiledResourceModeSurfaceState();
}
/////////////////////////////////////////////////////////////////////////////////////
/// Returns the surface offset for unified allocations. Truncates the offset to size
/// of uint32_t.
/// @see GmmResGetAuxSurfaceOffset64()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] GmmAuxType: the type of aux the offset is needed for
/// @return Surface Offset in bytes
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetAuxSurfaceOffset(GMM_RESOURCE_INFO *pGmmResource, GMM_UNIFIED_AUX_TYPE GmmAuxType)
{
return GFX_ULONG_CAST(GmmResGetAuxSurfaceOffset64(pGmmResource, GmmAuxType));
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetUnifiedAuxSurfaceOffset
/// @see GmmLib::GmmResourceInfoCommon::GetUnifiedAuxSurfaceOffset()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] GmmAuxType: the type of aux the offset is needed for
/// @return Surface Offset in bytes
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetAuxSurfaceOffset64(GMM_RESOURCE_INFO *pGmmResource, GMM_UNIFIED_AUX_TYPE GmmAuxType)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetUnifiedAuxSurfaceOffset(GmmAuxType);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetSizeAuxSurface
/// @see GmmLib::GmmResourceInfoCommon::GetSizeAuxSurface()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] GmmAuxType: the type of aux the size is needed for
/// @return Surface size in bytes
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetSizeAuxSurface(GMM_RESOURCE_INFO *pGmmResource, GMM_UNIFIED_AUX_TYPE GmmAuxType)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetSizeAuxSurface(GmmAuxType);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetSetHardwareProtection
/// @see GmmLib::GmmResourceInfoCommon::GetSetHardwareProtection()
/// @see GmmLib::GmmResourceInfoWin::GetSetHardwareProtection()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] GetIsEncrypted: Read encryption status
/// @param[in] SetIsEncrypted: Write encryption status
/// @return Whether surface is encrypted or not
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResGetSetHardwareProtection(GMM_RESOURCE_INFO *pGmmResource, uint8_t GetIsEncrypted, uint8_t SetIsEncrypted)
{
return pGmmResource ?
pGmmResource->GetSetHardwareProtection(GetIsEncrypted, SetIsEncrypted) :
0;
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::CpuBlt
/// @see GmmLib::GmmResourceInfoCommon::CpuBlt()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] pBlt: Describes the blit operation. See ::GMM_RES_COPY_BLT for more info.
/// @return 1 if succeeded, 0 otherwise
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResCpuBlt(GMM_RESOURCE_INFO *pGmmResource, GMM_RES_COPY_BLT *pBlt)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->CpuBlt(pBlt);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetStdLayoutSize
/// @see GmmLib::GmmResourceInfoCommon::GetStdLayoutSize()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return Size in bytes of Standard Layout version of surface.
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetStdLayoutSize(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetStdLayoutSize();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetMappingSpanDesc
/// @see GmmLib::GmmResourceInfoCommon::GetMappingSpanDesc()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] pMapping: Clients call the function with initially zero'd out GMM_GET_MAPPING.
/// @return 1 if more span descriptors to report, 0 if all mapping is done
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResGetMappingSpanDesc(GMM_RESOURCE_INFO *pGmmResource, GMM_GET_MAPPING *pMapping)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetMappingSpanDesc(pMapping);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::IsColorSeparation
/// @see GmmLib::GmmResourceInfoCommon::IsColorSeparation()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return 1 if the resource is color separated target, 0 otherwise
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmResIsColorSeparation(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->IsColorSeparation();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::TranslateColorSeparationX
/// @see GmmLib::GmmResourceInfoCommon::TranslateColorSeparationX()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] x: X coordinate
/// @return Translated color separation target x coordinate
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResTranslateColorSeparationX(GMM_RESOURCE_INFO *pGmmResource, uint32_t x)
{
__GMM_ASSERTPTR(pGmmResource, false);
return pGmmResource->TranslateColorSeparationX(x);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetColorSeparationArraySize
/// @see GmmLib::GmmResourceInfoCommon::GetColorSeparationArraySize()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return Array size of a color separated target resource
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetColorSeparationArraySize(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetColorSeparationArraySize();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetColorSeparationPhysicalWidth
/// @see GmmLib::GmmResourceInfoCommon::GetColorSeparationPhysicalWidth()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return Physical width of a color separated target resource
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetColorSeparationPhysicalWidth(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->GetColorSeparationPhysicalWidth();
}
//=============================================================================
//
// Function: GmmResGetMaxGpuVirtualAddressBits
//
// Desc: This function returns max no of GpuVA bits supported per surface on current platform
//
// Parameters:
// GMM_RESOURCE_INFO *pGmmResource (Don't care)
// Function will return the current Gen MaxGpuVirtualAddressBitsPerResource
//
// Returns:
// uint32_t - Max no of GpuVA bits
//-----------------------------------------------------------------------------
uint32_t GMM_STDCALL GmmResGetMaxGpuVirtualAddressBits(GMM_RESOURCE_INFO *pGmmResource)
{
if(pGmmResource == NULL)
{
__GMM_ASSERTPTR(pGmmGlobalContext, 0);
const GMM_PLATFORM_INFO &PlatformInfo = pGmmGlobalContext->GetPlatformInfo();
return PlatformInfo.MaxGpuVirtualAddressBitsPerResource;
}
return pGmmResource->GetMaxGpuVirtualAddressBits();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::IsSurfaceFaultable
/// @see GmmLib::GmmResourceInfoCommon::IsSurfaceFaultable()
/// @see GmmLib::GmmResourceInfoWin::IsSurfaceFaultable()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return 1 is surface can be faulted on
/////////////////////////////////////////////////////////////////////////////////////
uint8_t GMM_STDCALL GmmIsSurfaceFaultable(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERTPTR(pGmmResource, 0);
return pGmmResource->IsSurfaceFaultable();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetResFlags
/// @see GmmLib::GmmResourceInfoCommon::GetResFlags()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return Copy of ::GMM_RESOURCE_FLAGS
/////////////////////////////////////////////////////////////////////////////////////
GMM_RESOURCE_FLAG GMM_STDCALL GmmResGetResourceFlags(const GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return const_cast<GMM_RESOURCE_INFO *>(pGmmResource)->GetResFlags();
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetMaximumRenamingListLength
/// @see GmmLib::GmmResourceInfoCommon::GetMaximumRenamingListLength()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @return maximum remaining list length
/////////////////////////////////////////////////////////////////////////////////////
uint32_t GMM_STDCALL GmmResGetMaximumRenamingListLength(GMM_RESOURCE_INFO *pGmmResource)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetMaximumRenamingListLength();
}
//=============================================================================
//
// Function: GmmGetLogicalTileShape
//
// Desc: This function returns the logical tile shape
//
// Parameters:
// See Function arguments
//
// Returns:
// GMM_STATUS
//-----------------------------------------------------------------------------
GMM_STATUS GMM_STDCALL GmmGetLogicalTileShape(uint32_t TileMode,
uint32_t *pWidthInBytes,
uint32_t *pHeight,
uint32_t *pDepth)
{
__GMM_ASSERT(TileMode < GMM_TILE_MODES);
if(pWidthInBytes)
{
*pWidthInBytes = pGmmGlobalContext->GetPlatformInfo().TileInfo[TileMode].LogicalTileWidth;
}
if(pHeight)
{
*pHeight = pGmmGlobalContext->GetPlatformInfo().TileInfo[TileMode].LogicalTileHeight;
}
if(pDepth)
{
*pDepth = pGmmGlobalContext->GetPlatformInfo().TileInfo[TileMode].LogicalTileDepth;
}
return GMM_SUCCESS;
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideSize
/// @see GmmLib::GmmResourceInfoCommon::OverrideSize()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Size: new size of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationSize(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_SIZE_T Size)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideSize(Size);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverridePitch
/// @see GmmLib::GmmResourceInfoCommon::OverridePitch()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Pitch: new pitch of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationPitch(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_SIZE_T Pitch)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverridePitch(Pitch);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideUnifiedAuxPitch
/// @see GmmLib::GmmResourceInfoCommon::OverrideUnifiedAuxPitch()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Pitch: new pitch of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAuxAllocationPitch(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_SIZE_T Pitch)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideUnifiedAuxPitch(Pitch);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideUnifiedAuxPitch
/// @see GmmLib::GmmResourceInfoCommon::OverrideUnifiedAuxPitch()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Pitch: new pitch of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationFlags(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_FLAG *pFlags)
{
__GMM_ASSERT(pGmmResource);
__GMM_ASSERT(pFlags);
pGmmResource->OverrideAllocationFlags(*pFlags);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideHAlign
/// @see GmmLib::GmmResourceInfoCommon::OverrideHAlign()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Pitch: new pitch of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationHAlign(GMM_RESOURCE_INFO *pGmmResource, uint32_t HAlign)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideHAlign(HAlign);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideBaseAlignment
/// @see GmmLib::GmmResourceInfoCommon::OverrideBaseAlignment()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Alignment: new BaseAlignment of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationBaseAlignment(GMM_RESOURCE_INFO *pGmmResource, uint32_t Alignment)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideBaseAlignment(Alignment);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideBaseWidth
/// @see GmmLib::GmmResourceInfoCommon::OverrideBaseWidth()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] BaseWidth: new BaseWidth of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationBaseWidth(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_SIZE_T BaseWidth)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideBaseWidth(BaseWidth);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideBaseHeight
/// @see GmmLib::GmmResourceInfoCommon::OverrideBaseHeight()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] BaseHeight: new BaseWidth of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationBaseHeight(GMM_RESOURCE_INFO *pGmmResource, uint32_t BaseHeight)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideBaseHeight(BaseHeight);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideDepth
/// @see GmmLib::GmmResourceInfoCommon::OverrideDepth()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Depth: new Depth of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationDepth(GMM_RESOURCE_INFO *pGmmResource, uint32_t Depth)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideDepth(Depth);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideTileMode
/// @see GmmLib::GmmResourceInfoCommon::OverrideTileMode()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] TileMode: new tile mode of the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideResourceTiling(GMM_RESOURCE_INFO *pGmmResource, uint32_t TileMode)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideTileMode(static_cast<GMM_TILE_MODE>(TileMode));
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideUnifiedAuxTileMode
/// @see GmmLib::GmmResourceInfoCommon::OverrideUnifiedAuxTileMode()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] TileMode: new tile mode of the unified auxresource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAuxResourceTiling(GMM_RESOURCE_INFO *pGmmResource, uint32_t TileMode)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideUnifiedAuxTileMode(static_cast<GMM_TILE_MODE>(TileMode));
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideSurfaceFormat
/// @see GmmLib::GmmResourceInfoCommon::OverrideSurfaceFormat()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Format: new format for the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationFormat(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_FORMAT Format)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideSurfaceFormat(Format);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideSurfaceType
/// @see GmmLib::GmmResourceInfoCommon::OverrideSurfaceType()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] ResourceType: new type for the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideSurfaceType(GMM_RESOURCE_INFO *pGmmResource, GMM_RESOURCE_TYPE ResourceType)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideSurfaceType(ResourceType);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GmmResOverrideSvmGfxAddress
/// @see GmmLib::GmmResourceInfoCommon::GmmResOverrideSvmGfxAddress()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] SvmGfxAddress: new svm gfx address for the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideSvmGfxAddress(GMM_RESOURCE_INFO *pGmmResource, GMM_GFX_ADDRESS SvmGfxAddress)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideSvmGfxAddress(SvmGfxAddress);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideArraySize
/// @see GmmLib::GmmResourceInfoCommon::OverrideArraySize()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] ArraySize: new array size for the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationArraySize(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArraySize)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideArraySize(ArraySize);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::OverrideArraySize
/// @see GmmLib::GmmResourceInfoCommon::OverrideArraySize()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] MaxLod: new max LOD for the resource
/////////////////////////////////////////////////////////////////////////////////////
void GMM_STDCALL GmmResOverrideAllocationMaxLod(GMM_RESOURCE_INFO *pGmmResource, uint32_t MaxLod)
{
__GMM_ASSERT(pGmmResource);
pGmmResource->OverrideMaxLod(MaxLod);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetPlanarXOffset
/// @see GmmLib::GmmResourceInfoCommon::GetPlanarXOffset()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Plane: Plane for which the offset is needed
/// @return X offset
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetPlanarGetXOffset(GMM_RESOURCE_INFO *pGmmResource, GMM_YUV_PLANE Plane)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetPlanarXOffset(Plane);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetPlanarYOffset
/// @see GmmLib::GmmResourceInfoCommon::GetPlanarYOffset()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Plane: Plane for which the offset is needed
/// @return Y offset
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetPlanarGetYOffset(GMM_RESOURCE_INFO *pGmmResource, GMM_YUV_PLANE Plane)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetPlanarYOffset(Plane);
}
/////////////////////////////////////////////////////////////////////////////////////
/// C wrapper for GmmResourceInfoCommon::GetPlanarAuxOffset
/// @see GmmLib::GmmResourceInfoCommon::GetPlanarAuxOffset()
///
/// @param[in] pGmmResource: Pointer to GmmResourceInfo class
/// @param[in] Plane: Plane for which the offset is needed
/// @return Y offset
/////////////////////////////////////////////////////////////////////////////////////
GMM_GFX_SIZE_T GMM_STDCALL GmmResGetPlanarAuxOffset(GMM_RESOURCE_INFO *pGmmResource, uint32_t ArrayIndex, GMM_UNIFIED_AUX_TYPE AuxType)
{
__GMM_ASSERT(pGmmResource);
return pGmmResource->GetPlanarAuxOffset(ArrayIndex, AuxType);
}
//=============================================================================
//
// Function: __CanSupportStdTiling
//
// Desc: Verifies texture parameters can support StdTiling
//
// Parameters:
// GMM_TEXTURE_INFO& Surf
//
// Returns:
//
//-----------------------------------------------------------------------------
uint8_t __CanSupportStdTiling(GMM_TEXTURE_INFO Surf)
{
const __GMM_PLATFORM_RESOURCE *pPlatformResource = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
// SKL+ Tiled Resource Mode Restrictions
if((Surf.Flags.Info.TiledYf || Surf.Flags.Info.TiledYs) &&
!((GFX_GET_CURRENT_RENDERCORE(pPlatformResource->Platform) >= IGFX_GEN9_CORE) &&
// TiledY must be set unless 1D surface.
((Surf.Flags.Info.TiledY && (Surf.Type != RESOURCE_1D)) ||
(Surf.Flags.Info.Linear && (Surf.Type == RESOURCE_1D ||
Surf.Type == RESOURCE_BUFFER))) &&
// 8, 16, 32, 64, or 128 bpp
((!GmmIsCompressed(Surf.Format) &&
((Surf.BitsPerPixel == 8) ||
(Surf.BitsPerPixel == 16) ||
(Surf.BitsPerPixel == 32) ||
(Surf.BitsPerPixel == 64) ||
(Surf.BitsPerPixel == 128))) ||
// Compressed Modes: BC*, ETC*, EAC*, ASTC*
(GmmIsCompressed(Surf.Format) && (Surf.Format != GMM_FORMAT_FXT1)))))
/* Not currently supported...
// YCRCB* Formats
GmmIsYUVPacked(Surf.Format) */
{
return 0;
}
return 1;
}
|