| 1 |
/* |
| 2 |
* Copyright (C) 2019-2023 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "shared/source/execution_environment/root_device_environment.h" |
| 9 |
#include "shared/source/gen12lp/hw_info_gen12lp.h" |
| 10 |
#include "shared/source/os_interface/os_interface.h" |
| 11 |
#include "shared/test/common/helpers/debug_manager_state_restore.h" |
| 12 |
#include "shared/test/common/libult/gen12lp/special_ult_helper_gen12lp.h" |
| 13 |
#include "shared/test/common/test_macros/header/per_product_test_definitions.h" |
| 14 |
#include "shared/test/unit_test/os_interface/windows/product_helper_win_tests.h" |
| 15 |
|
| 16 |
using namespace NEO; |
| 17 |
|
| 18 |
using Gen12lpProductHelperWindows = ProductHelperTestWindows; |
| 19 |
|
| 20 |
GEN12LPTEST_F(Gen12lpProductHelperWindows, givenE2ECSetByKmdWhenConfiguringHwThenAdjustInternalImageFlag) { |
| 21 |
FeatureTable &localFeatureTable = outHwInfo.featureTable; |
| 22 |
|
| 23 |
localFeatureTable.flags.ftrE2ECompression = true; |
| 24 |
productHelper->configureHardwareCustom(&outHwInfo, nullptr); |
| 25 |
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers); |
| 26 |
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages); |
| 27 |
|
| 28 |
localFeatureTable.flags.ftrE2ECompression = false; |
| 29 |
productHelper->configureHardwareCustom(&outHwInfo, nullptr); |
| 30 |
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers); |
| 31 |
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages); |
| 32 |
} |
| 33 |
|
| 34 |
GEN12LPTEST_F(Gen12lpProductHelperWindows, givenGen12LpProductWhenAdjustPlatformForProductFamilyCalledThenOverrideWithCorrectFamily) { |
| 35 |
|
| 36 |
PLATFORM *testPlatform = &outHwInfo.platform; |
| 37 |
testPlatform->eDisplayCoreFamily = IGFX_GEN11_CORE; |
| 38 |
testPlatform->eRenderCoreFamily = IGFX_GEN11_CORE; |
| 39 |
productHelper->adjustPlatformForProductFamily(&outHwInfo); |
| 40 |
|
| 41 |
EXPECT_EQ(IGFX_GEN12LP_CORE, testPlatform->eRenderCoreFamily); |
| 42 |
EXPECT_EQ(IGFX_GEN12LP_CORE, testPlatform->eDisplayCoreFamily); |
| 43 |
} |
| 44 |
|
| 45 |
GEN12LPTEST_F(Gen12lpProductHelperWindows, givenCompressionFtrEnabledWhenAskingForPageTableManagerThenReturnCorrectValue) { |
| 46 |
|
| 47 |
outHwInfo.capabilityTable.ftrRenderCompressedBuffers = false; |
| 48 |
outHwInfo.capabilityTable.ftrRenderCompressedImages = false; |
| 49 |
EXPECT_FALSE(productHelper->isPageTableManagerSupported(outHwInfo)); |
| 50 |
|
| 51 |
outHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; |
| 52 |
outHwInfo.capabilityTable.ftrRenderCompressedImages = false; |
| 53 |
EXPECT_TRUE(productHelper->isPageTableManagerSupported(outHwInfo)); |
| 54 |
|
| 55 |
outHwInfo.capabilityTable.ftrRenderCompressedBuffers = false; |
| 56 |
outHwInfo.capabilityTable.ftrRenderCompressedImages = true; |
| 57 |
EXPECT_TRUE(productHelper->isPageTableManagerSupported(outHwInfo)); |
| 58 |
|
| 59 |
outHwInfo.capabilityTable.ftrRenderCompressedBuffers = true; |
| 60 |
outHwInfo.capabilityTable.ftrRenderCompressedImages = true; |
| 61 |
EXPECT_TRUE(productHelper->isPageTableManagerSupported(outHwInfo)); |
| 62 |
} |
| 63 |
|
| 64 |
GEN12LPTEST_F(Gen12lpProductHelperWindows, givenGen12LpSkuWhenGettingCapabilityCoherencyFlagThenExpectValidValue) { |
| 65 |
bool coherency = false; |
| 66 |
productHelper->setCapabilityCoherencyFlag(outHwInfo, coherency); |
| 67 |
const bool checkDone = SpecialUltHelperGen12lp::additionalCoherencyCheck(outHwInfo.platform.eProductFamily, coherency); |
| 68 |
if (checkDone) { |
| 69 |
EXPECT_FALSE(coherency); |
| 70 |
return; |
| 71 |
} |
| 72 |
|
| 73 |
if (SpecialUltHelperGen12lp::isAdditionalCapabilityCoherencyFlagSettingRequired(outHwInfo.platform.eProductFamily)) { |
| 74 |
outHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A1, outHwInfo); |
| 75 |
productHelper->setCapabilityCoherencyFlag(outHwInfo, coherency); |
| 76 |
EXPECT_TRUE(coherency); |
| 77 |
outHwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, outHwInfo); |
| 78 |
productHelper->setCapabilityCoherencyFlag(outHwInfo, coherency); |
| 79 |
EXPECT_FALSE(coherency); |
| 80 |
} else { |
| 81 |
EXPECT_TRUE(coherency); |
| 82 |
} |
| 83 |
} |