Move HardwareInfo ownership to ExecutionEnvironment [1/n]

Change-Id: I5e5b4cc45947a8841282c7d431fb69d9c397a2d4
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2019-05-06 12:33:44 +02:00
committed by sys_ocldev
parent b2aee82f41
commit bb80d327c7
233 changed files with 1786 additions and 2298 deletions

View File

@@ -23,9 +23,9 @@ OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSyst
struct DeviceFactoryTest : public ::testing::Test {
public:
void SetUp() override {
const HardwareInfo hwInfo = *platformDevices[0];
const HardwareInfo *hwInfo = platformDevices[0];
executionEnvironment = platformImpl->peekExecutionEnvironment();
mockGdiDll = setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace);
mockGdiDll = setAdapterInfo(&hwInfo->pPlatform, &hwInfo->pSysInfo, hwInfo->capabilityTable.gpuAddressSpace);
}
void TearDown() override {
@@ -39,43 +39,32 @@ struct DeviceFactoryTest : public ::testing::Test {
TEST_F(DeviceFactoryTest, GetDevices_Expect_True_If_Returned) {
DeviceFactoryCleaner cleaner;
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
EXPECT_TRUE((numDevices > 0) ? success : !success);
}
TEST_F(DeviceFactoryTest, GetDevices_Check_HwInfo_Null) {
DeviceFactoryCleaner cleaner;
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
EXPECT_TRUE((numDevices > 0) ? success : !success);
if (numDevices > 0) {
ASSERT_NE(hwInfo, nullptr);
EXPECT_NE(hwInfo->pPlatform, nullptr);
EXPECT_NE(hwInfo->pSkuTable, nullptr);
EXPECT_NE(hwInfo->pSysInfo, nullptr);
EXPECT_NE(hwInfo->pWaTable, nullptr);
}
}
TEST_F(DeviceFactoryTest, GetDevices_Check_HwInfo_Platform) {
DeviceFactoryCleaner cleaner;
HardwareInfo *hwInfo = nullptr;
const HardwareInfo *refHwinfo = *platformDevices;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
const HardwareInfo *hwInfo = executionEnvironment->getHardwareInfo();
EXPECT_TRUE((numDevices > 0) ? success : !success);
if (numDevices > 0) {
ASSERT_NE(hwInfo, nullptr);
EXPECT_NE(hwInfo->pPlatform, nullptr);
EXPECT_EQ(refHwinfo->pPlatform->eDisplayCoreFamily, hwInfo->pPlatform->eDisplayCoreFamily);
EXPECT_EQ(refHwinfo->pPlatform.eDisplayCoreFamily, hwInfo->pPlatform.eDisplayCoreFamily);
}
}
@@ -83,18 +72,17 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
DeviceFactoryCleaner cleaner;
DebugManagerStateRestore stateRestore;
HardwareInfo *hwInfoReference = nullptr;
HardwareInfo *hwInfoOverriden = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfoReference, numDevices, *executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
auto hwInfo = executionEnvironment->getHardwareInfo();
ASSERT_TRUE(success);
auto refEnableKmdNotify = hwInfoReference->capabilityTable.kmdNotifyProperties.enableKmdNotify;
auto refDelayKmdNotifyMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
auto refEnableQuickKmdSleep = hwInfoReference->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep;
auto refDelayQuickKmdSleepMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
auto refEnableQuickKmdSleepForSporadicWaits = hwInfoReference->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits;
auto refDelayQuickKmdSleepForSporadicWaitsMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds;
auto refEnableKmdNotify = hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify;
auto refDelayKmdNotifyMicroseconds = hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
auto refEnableQuickKmdSleep = hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep;
auto refDelayQuickKmdSleepMicroseconds = hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
auto refEnableQuickKmdSleepForSporadicWaits = hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits;
auto refDelayQuickKmdSleepForSporadicWaitsMicroseconds = hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds;
DeviceFactory::releaseDevices();
DebugManager.flags.OverrideEnableKmdNotify.set(!refEnableKmdNotify);
@@ -106,19 +94,20 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.set(!refEnableQuickKmdSleepForSporadicWaits);
DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.set(static_cast<int32_t>(refDelayQuickKmdSleepForSporadicWaitsMicroseconds) + 12);
success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices, *executionEnvironment);
success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
ASSERT_TRUE(success);
hwInfo = executionEnvironment->getHardwareInfo();
EXPECT_EQ(!refEnableKmdNotify, hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(refDelayKmdNotifyMicroseconds + 10, hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
EXPECT_EQ(!refEnableKmdNotify, hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(refDelayKmdNotifyMicroseconds + 10, hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
EXPECT_EQ(!refEnableQuickKmdSleep, hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
EXPECT_EQ(refDelayQuickKmdSleepMicroseconds + 11, hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
EXPECT_EQ(!refEnableQuickKmdSleep, hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
EXPECT_EQ(refDelayQuickKmdSleepMicroseconds + 11, hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
EXPECT_EQ(!refEnableQuickKmdSleepForSporadicWaits,
hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
EXPECT_EQ(refDelayQuickKmdSleepForSporadicWaitsMicroseconds + 12,
hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
}
TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) {
@@ -126,24 +115,25 @@ TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) {
DebugManagerStateRestore dbgRestorer;
int32_t debugEngineType = 2;
DebugManager.flags.NodeOrdinal.set(debugEngineType);
HardwareInfo *hwInfoOverriden = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices, *executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
ASSERT_TRUE(success);
ASSERT_NE(nullptr, hwInfoOverriden);
int32_t actualEngineType = static_cast<int32_t>(hwInfoOverriden->capabilityTable.defaultEngineType);
auto hwInfo = executionEnvironment->getHardwareInfo();
int32_t actualEngineType = static_cast<int32_t>(hwInfo->capabilityTable.defaultEngineType);
EXPECT_EQ(debugEngineType, actualEngineType);
}
TEST_F(DeviceFactoryTest, givenPointerToHwInfoWhenGetDevicedCalledThenRequiedSurfaceSizeIsSettedProperly) {
DeviceFactoryCleaner cleaner;
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
ASSERT_TRUE(success);
auto hwInfo = executionEnvironment->getHardwareInfo();
EXPECT_EQ(hwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte, hwInfo->capabilityTable.requiredPreemptionSurfaceSize);
EXPECT_EQ(hwInfo->pSysInfo.CsrSizeInMb * MemoryConstants::megaByte, hwInfo->capabilityTable.requiredPreemptionSurfaceSize);
}
TEST_F(DeviceFactoryTest, givenCreateMultipleDevicesDebugFlagWhenGetDevicesIsCalledThenNumberOfReturnedDevicesIsEqualToDebugVariable) {
@@ -151,15 +141,9 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleDevicesDebugFlagWhenGetDevicesIsCal
DebugManagerStateRestore stateRestore;
auto requiredDeviceCount = 2u;
DebugManager.flags.CreateMultipleDevices.set(requiredDeviceCount);
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment);
ASSERT_NE(nullptr, hwInfo);
EXPECT_NE(nullptr, hwInfo->pPlatform);
EXPECT_NE(nullptr, hwInfo->pSkuTable);
EXPECT_NE(nullptr, hwInfo->pSysInfo);
EXPECT_NE(nullptr, hwInfo->pWaTable);
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
ASSERT_TRUE(success);
EXPECT_EQ(requiredDeviceCount, numDevices);
@@ -170,15 +154,9 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleDevicesDebugFlagWhenGetDevicesForPr
DebugManagerStateRestore stateRestore;
auto requiredDeviceCount = 2u;
DebugManager.flags.CreateMultipleDevices.set(requiredDeviceCount);
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevicesForProductFamilyOverride(&hwInfo, numDevices, *executionEnvironment);
ASSERT_NE(nullptr, hwInfo);
EXPECT_NE(nullptr, hwInfo->pPlatform);
EXPECT_NE(nullptr, hwInfo->pSkuTable);
EXPECT_NE(nullptr, hwInfo->pSysInfo);
EXPECT_NE(nullptr, hwInfo->pWaTable);
size_t numDevices = 0;
bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, *executionEnvironment);
ASSERT_TRUE(success);
EXPECT_EQ(requiredDeviceCount, numDevices);
@@ -186,9 +164,9 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleDevicesDebugFlagWhenGetDevicesForPr
TEST_F(DeviceFactoryTest, givenGetDevicesCallWhenItIsDoneThenOsInterfaceIsAllocated) {
DeviceFactoryCleaner cleaner;
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, *executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
EXPECT_TRUE(success);
EXPECT_NE(nullptr, executionEnvironment->osInterface);
}

View File

@@ -16,58 +16,16 @@ using namespace std;
void HwInfoConfigTest::SetUp() {
PlatformFixture::SetUp();
const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo();
pInHwInfo = const_cast<HardwareInfo *>(&hwInfo);
pInHwInfo = pPlatform->getDevice(0)->getHardwareInfo();
originalCapTable = pInHwInfo->capabilityTable;
pOldPlatform = pInHwInfo->pPlatform;
memcpy(&testPlatform, pOldPlatform, sizeof(testPlatform));
pInHwInfo->pPlatform = &testPlatform;
pOldSkuTable = pInHwInfo->pSkuTable;
memcpy(&testSkuTable, pOldSkuTable, sizeof(testSkuTable));
pInHwInfo->pSkuTable = &testSkuTable;
pOldWaTable = pInHwInfo->pWaTable;
memcpy(&testWaTable, pOldWaTable, sizeof(testWaTable));
pInHwInfo->pWaTable = &testWaTable;
pOldSysInfo = pInHwInfo->pSysInfo;
memcpy(&testSysInfo, pOldSysInfo, sizeof(testSysInfo));
pInHwInfo->pSysInfo = &testSysInfo;
testPlatform = &pInHwInfo.pPlatform;
testSkuTable = &pInHwInfo.pSkuTable;
testWaTable = &pInHwInfo.pWaTable;
testSysInfo = &pInHwInfo.pSysInfo;
outHwInfo = {};
}
void HwInfoConfigTest::TearDown() {
ReleaseOutHwInfoStructs();
pInHwInfo->pPlatform = pOldPlatform;
pInHwInfo->pSkuTable = pOldSkuTable;
pInHwInfo->pWaTable = pOldWaTable;
pInHwInfo->pSysInfo = pOldSysInfo;
pInHwInfo->capabilityTable = originalCapTable;
PlatformFixture::TearDown();
}
void HwInfoConfigTest::ReleaseOutHwInfoStructs() {
if (outHwInfo.pPlatform != nullptr) {
delete outHwInfo.pPlatform;
outHwInfo.pPlatform = nullptr;
}
if (outHwInfo.pSkuTable != nullptr) {
delete outHwInfo.pSkuTable;
outHwInfo.pSkuTable = nullptr;
}
if (outHwInfo.pWaTable != nullptr) {
delete outHwInfo.pWaTable;
outHwInfo.pWaTable = nullptr;
}
if (outHwInfo.pSysInfo != nullptr) {
delete outHwInfo.pSysInfo;
outHwInfo.pSysInfo = nullptr;
}
}

View File

@@ -20,22 +20,12 @@ struct HwInfoConfigTest : public ::testing::Test,
public PlatformFixture {
void SetUp() override;
void TearDown() override;
void ReleaseOutHwInfoStructs();
HardwareInfo *pInHwInfo;
HardwareInfo pInHwInfo;
HardwareInfo outHwInfo;
RuntimeCapabilityTable originalCapTable;
const PLATFORM *pOldPlatform;
PLATFORM testPlatform;
const FeatureTable *pOldSkuTable;
FeatureTable testSkuTable;
const WorkaroundTable *pOldWaTable;
WorkaroundTable testWaTable;
const GT_SYSTEM_INFO *pOldSysInfo;
GT_SYSTEM_INFO testSysInfo;
PLATFORM *testPlatform = nullptr;
FeatureTable *testSkuTable = nullptr;
WorkaroundTable *testWaTable = nullptr;
GT_SYSTEM_INFO *testSysInfo = nullptr;
};

View File

@@ -285,7 +285,7 @@ class DrmMockCustom : public Drm {
DrmMockCustom() : Drm(mockFd) {
reset();
ioctl_expected.contextCreate = static_cast<int>(NEO::HwHelper::get(NEO::platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances().size());
ioctl_expected.contextCreate = static_cast<int>(NEO::HwHelper::get(NEO::platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances().size());
ioctl_expected.contextDestroy = ioctl_expected.contextCreate.load();
}
int getErrno() override {

View File

@@ -11,48 +11,44 @@
#include "runtime/os_interface/os_interface.h"
TEST_F(DeviceFactoryLinuxTest, GetDevicesCheckEUCntSSCnt) {
HardwareInfo *hwInfo = nullptr;
const HardwareInfo *refHwinfo = *platformDevices;
size_t numDevices = 0;
pDrm->StoredEUVal = 11;
pDrm->StoredSSVal = 8;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
auto hwInfo = executionEnvironment.getHardwareInfo();
EXPECT_TRUE(success);
EXPECT_EQ((int)numDevices, 1);
EXPECT_NE(hwInfo, nullptr);
EXPECT_NE(hwInfo->pPlatform, nullptr);
EXPECT_NE(hwInfo->pSysInfo, nullptr);
EXPECT_EQ(refHwinfo->pPlatform->eDisplayCoreFamily, hwInfo->pPlatform->eDisplayCoreFamily);
EXPECT_EQ((int)hwInfo->pSysInfo->EUCount, 11);
EXPECT_EQ((int)hwInfo->pSysInfo->SubSliceCount, 8);
EXPECT_EQ(refHwinfo->pPlatform.eDisplayCoreFamily, hwInfo->pPlatform.eDisplayCoreFamily);
EXPECT_EQ((int)hwInfo->pSysInfo.EUCount, 11);
EXPECT_EQ((int)hwInfo->pSysInfo.SubSliceCount, 8);
//temporararily return GT2.
EXPECT_EQ(1u, hwInfo->pSkuTable->ftrGT2);
EXPECT_EQ(1u, hwInfo->pSkuTable.ftrGT2);
DeviceFactory::releaseDevices();
}
TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailed) {
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
pushDrmMock(nullptr);
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
EXPECT_FALSE(success);
popDrmMock();
}
TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailedConfigureHwInfo) {
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
pDrm->StoredRetValForDeviceID = -1;
bool success = DeviceFactory::getDevices(&hwInfo, numDevices, executionEnvironment);
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
EXPECT_FALSE(success);
pDrm->StoredRetValForDeviceID = 0;
@@ -60,7 +56,6 @@ TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailedConfigureHwInfo) {
TEST_F(DeviceFactoryLinuxTest, ReleaseDevices) {
MockDeviceFactory mockDeviceFactory;
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
pDrm->StoredDeviceID = 0x5A84;
@@ -71,7 +66,7 @@ TEST_F(DeviceFactoryLinuxTest, ReleaseDevices) {
pDrm->StoredMinEUinPool = 9;
pDrm->StoredRetVal = -1;
bool success = mockDeviceFactory.getDevices(&hwInfo, numDevices, executionEnvironment);
bool success = mockDeviceFactory.getDevices(numDevices, executionEnvironment);
EXPECT_TRUE(success);
mockDeviceFactory.releaseDevices();
@@ -81,9 +76,8 @@ TEST_F(DeviceFactoryLinuxTest, ReleaseDevices) {
TEST_F(DeviceFactoryLinuxTest, givenGetDeviceCallWhenItIsDoneThenOsInterfaceIsAllocatedAndItContainDrm) {
MockDeviceFactory mockDeviceFactory;
HardwareInfo *hwInfo = nullptr;
size_t numDevices = 0;
bool success = mockDeviceFactory.getDevices(&hwInfo, numDevices, executionEnvironment);
bool success = mockDeviceFactory.getDevices(numDevices, executionEnvironment);
EXPECT_TRUE(success);
EXPECT_NE(nullptr, executionEnvironment.osInterface);
EXPECT_EQ(pDrm, executionEnvironment.osInterface->get()->getDrm());

View File

@@ -43,7 +43,7 @@ class DrmCommandStreamFixture {
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setDrm(mock.get());
osContext = std::make_unique<OsContextLinux>(*mock, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
osContext = std::make_unique<OsContextLinux>(*mock, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
csr = new DrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(executionEnvironment, gemCloseWorkerMode::gemCloseWorkerActive);
@@ -259,7 +259,7 @@ TEST_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdToAllExecBuff
.RetiresOnSaturation();
osContext = std::make_unique<OsContextLinux>(*mock, 1, 1,
HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
csr->setupContext(*osContext);
@@ -589,7 +589,7 @@ class DrmCommandStreamEnhancedFixture
*executionEnvironment);
ASSERT_NE(nullptr, mm);
executionEnvironment->memoryManager.reset(mm);
device.reset(MockDevice::create<MockDevice>(platformDevices[0], executionEnvironment, 0u));
device.reset(MockDevice::create<MockDevice>(executionEnvironment, 0u));
device->resetCommandStreamReceiver(tCsr);
ASSERT_NE(nullptr, device);
}

View File

@@ -1632,7 +1632,7 @@ TEST_F(DrmMemoryManagerTest, givenOsHandleWithNonTiledObjectWhenCreateFromShared
}
TEST_F(DrmMemoryManagerTest, givenOsHandleWithTileYObjectWhenCreateFromSharedHandleIsCalledThenTileYGmmIsCreatedAndSetInAllocation) {
auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform->eRenderCoreFamily);
auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->pPlatform.eRenderCoreFamily);
if (hwHelper.supportsYTiling()) {
mock->ioctl_expected.primeFdToHandle = 1;

View File

@@ -21,22 +21,22 @@ constexpr uint32_t hwConfigTestMidBatchBit = 1 << 10;
template <>
int HwInfoConfigHw<IGFX_UNKNOWN>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
FeatureTable *pSkuTable = const_cast<FeatureTable *>(hwInfo->pSkuTable);
FeatureTable *pSkuTable = &hwInfo->pSkuTable;
if (hwInfo->pPlatform->usDeviceID == 30) {
GT_SYSTEM_INFO *pSysInfo = const_cast<GT_SYSTEM_INFO *>(hwInfo->pSysInfo);
if (hwInfo->pPlatform.usDeviceID == 30) {
GT_SYSTEM_INFO *pSysInfo = &hwInfo->pSysInfo;
pSysInfo->EdramSizeInKb = 128 * 1000;
}
if (hwInfo->pPlatform->usDeviceID & hwConfigTestMidThreadBit) {
if (hwInfo->pPlatform.usDeviceID & hwConfigTestMidThreadBit) {
pSkuTable->ftrGpGpuMidThreadLevelPreempt = 1;
}
if (hwInfo->pPlatform->usDeviceID & hwConfigTestThreadGroupBit) {
if (hwInfo->pPlatform.usDeviceID & hwConfigTestThreadGroupBit) {
pSkuTable->ftrGpGpuThreadGroupLevelPreempt = 1;
}
if (hwInfo->pPlatform->usDeviceID & hwConfigTestMidBatchBit) {
if (hwInfo->pPlatform.usDeviceID & hwConfigTestMidBatchBit) {
pSkuTable->ftrGpGpuMidBatchPreempt = 1;
}
return (hwInfo->pPlatform->usDeviceID == 10) ? -1 : 0;
return (hwInfo->pPlatform.usDeviceID == 10) ? -1 : 0;
}
template <>
@@ -60,14 +60,13 @@ void HwInfoConfigTestLinux::SetUp() {
drm = new DrmMock();
osInterface->get()->setDrm(static_cast<Drm *>(drm));
drm->StoredDeviceID = pOldPlatform->usDeviceID;
drm->StoredDeviceID = pInHwInfo.pPlatform.usDeviceID;
drm->StoredDeviceRevID = 0;
drm->StoredEUVal = pOldSysInfo->EUCount;
drm->StoredSSVal = pOldSysInfo->SubSliceCount;
drm->StoredEUVal = pInHwInfo.pSysInfo.EUCount;
drm->StoredSSVal = pInHwInfo.pSysInfo.SubSliceCount;
rt_cpuidex_func = CpuInfo::cpuidexFunc;
CpuInfo::cpuidexFunc = mockCpuidex;
testHwInfo = *pInHwInfo;
}
void HwInfoConfigTestLinux::TearDown() {
@@ -97,7 +96,7 @@ struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux {
drm->StoredDeviceID = 1;
drm->setGtType(GTTYPE_GT0);
testPlatform.eRenderCoreFamily = platformDevices[0]->pPlatform->eRenderCoreFamily;
testPlatform->eRenderCoreFamily = platformDevices[0]->pPlatform.eRenderCoreFamily;
}
void TearDown() override {
@@ -108,7 +107,7 @@ struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux {
};
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfig) {
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
}
@@ -116,71 +115,67 @@ GTTYPE GtTypes[] = {
GTTYPE_GT1, GTTYPE_GT2, GTTYPE_GT1_5, GTTYPE_GT2_5, GTTYPE_GT3, GTTYPE_GT4, GTTYPE_GTA, GTTYPE_GTC, GTTYPE_GTX};
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigGtTypes) {
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(GTTYPE_GT0, outHwInfo.pPlatform->eGTType);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT1_5);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT2_5);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT3);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGT4);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTA);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTC);
EXPECT_EQ(0u, outHwInfo.pSkuTable->ftrGTX);
ReleaseOutHwInfoStructs();
EXPECT_EQ(GTTYPE_GT0, outHwInfo.pPlatform.eGTType);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT1_5);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT2_5);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT3);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGT4);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTA);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTC);
EXPECT_EQ(0u, outHwInfo.pSkuTable.ftrGTX);
size_t arrSize = sizeof(GtTypes) / sizeof(GTTYPE);
uint32_t FtrSum = 0;
for (uint32_t i = 0; i < arrSize; i++) {
drm->setGtType(GtTypes[i]);
ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(GtTypes[i], outHwInfo.pPlatform->eGTType);
bool FtrPresent = (outHwInfo.pSkuTable->ftrGT1 ||
outHwInfo.pSkuTable->ftrGT1_5 ||
outHwInfo.pSkuTable->ftrGT2 ||
outHwInfo.pSkuTable->ftrGT2_5 ||
outHwInfo.pSkuTable->ftrGT3 ||
outHwInfo.pSkuTable->ftrGT4 ||
outHwInfo.pSkuTable->ftrGTA ||
outHwInfo.pSkuTable->ftrGTC ||
outHwInfo.pSkuTable->ftrGTX);
EXPECT_EQ(GtTypes[i], outHwInfo.pPlatform.eGTType);
bool FtrPresent = (outHwInfo.pSkuTable.ftrGT1 ||
outHwInfo.pSkuTable.ftrGT1_5 ||
outHwInfo.pSkuTable.ftrGT2 ||
outHwInfo.pSkuTable.ftrGT2_5 ||
outHwInfo.pSkuTable.ftrGT3 ||
outHwInfo.pSkuTable.ftrGT4 ||
outHwInfo.pSkuTable.ftrGTA ||
outHwInfo.pSkuTable.ftrGTC ||
outHwInfo.pSkuTable.ftrGTX);
EXPECT_TRUE(FtrPresent);
FtrSum += (outHwInfo.pSkuTable->ftrGT1 +
outHwInfo.pSkuTable->ftrGT1_5 +
outHwInfo.pSkuTable->ftrGT2 +
outHwInfo.pSkuTable->ftrGT2_5 +
outHwInfo.pSkuTable->ftrGT3 +
outHwInfo.pSkuTable->ftrGT4 +
outHwInfo.pSkuTable->ftrGTA +
outHwInfo.pSkuTable->ftrGTC +
outHwInfo.pSkuTable->ftrGTX);
ReleaseOutHwInfoStructs();
FtrSum += (outHwInfo.pSkuTable.ftrGT1 +
outHwInfo.pSkuTable.ftrGT1_5 +
outHwInfo.pSkuTable.ftrGT2 +
outHwInfo.pSkuTable.ftrGT2_5 +
outHwInfo.pSkuTable.ftrGT3 +
outHwInfo.pSkuTable.ftrGT4 +
outHwInfo.pSkuTable.ftrGTA +
outHwInfo.pSkuTable.ftrGTC +
outHwInfo.pSkuTable.ftrGTX);
}
EXPECT_EQ(arrSize, FtrSum);
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigEdramDetection) {
drm->StoredDeviceID = 30;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(1u, outHwInfo.pSkuTable->ftrEDram);
EXPECT_EQ(1u, outHwInfo.pSkuTable.ftrEDram);
}
TEST_F(HwInfoConfigTestLinuxDummy, givenEnabledPlatformCoherencyWhenConfiguringHwInfoThenIgnoreAndSetAsDisabled) {
drm->StoredDeviceID = 21;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrSupportsCoherency);
}
TEST_F(HwInfoConfigTestLinuxDummy, givenDisabledPlatformCoherencyWhenConfiguringHwInfoThenSetValidCapability) {
drm->StoredDeviceID = 20;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrSupportsCoherency);
}
@@ -188,49 +183,49 @@ TEST_F(HwInfoConfigTestLinuxDummy, givenDisabledPlatformCoherencyWhenConfiguring
TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeUnknownGtType) {
drm->setGtType(GTTYPE_UNDEFINED);
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeUnknownDevId) {
drm->StoredDeviceID = 0;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeFailGetDevId) {
drm->StoredRetValForDeviceID = -2;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-2, ret);
}
TEST_F(HwInfoConfigTestLinuxDummy, dummydummyNegativeFailGetDevRevId) {
drm->StoredRetValForDeviceRevID = -3;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-3, ret);
}
TEST_F(HwInfoConfigTestLinuxDummy, dummydummyNegativeFailGetEuCount) {
drm->StoredRetValForEUVal = -4;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-4, ret);
}
TEST_F(HwInfoConfigTestLinuxDummy, dummydummyNegativeFailGetSsCount) {
drm->StoredRetValForSSVal = -5;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-5, ret);
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeFailingConfigureCustom) {
drm->StoredDeviceID = 10;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
}
@@ -239,123 +234,123 @@ TEST_F(HwInfoConfigTestLinuxDummy, dummyNegativeUnknownDeviceId) {
drm->setGtType(GTTYPE_GT1);
auto hwConfig = DummyHwConfig{};
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(-1, ret);
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledMidThreadOn) {
pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
drm->StoredPreemptionSupport =
I915_SCHEDULER_CAP_ENABLED |
I915_SCHEDULER_CAP_PRIORITY |
I915_SCHEDULER_CAP_PREEMPTION;
drm->StoredDeviceID = hwConfigTestMidThreadBit;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::MidThread, outHwInfo.capabilityTable.defaultPreemptionMode);
EXPECT_TRUE(drm->isPreemptionSupported());
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledThreadGroupOn) {
pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
drm->StoredPreemptionSupport =
I915_SCHEDULER_CAP_ENABLED |
I915_SCHEDULER_CAP_PRIORITY |
I915_SCHEDULER_CAP_PREEMPTION;
drm->StoredDeviceID = hwConfigTestThreadGroupBit;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::ThreadGroup, outHwInfo.capabilityTable.defaultPreemptionMode);
EXPECT_TRUE(drm->isPreemptionSupported());
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledMidBatchOn) {
pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
drm->StoredPreemptionSupport =
I915_SCHEDULER_CAP_ENABLED |
I915_SCHEDULER_CAP_PRIORITY |
I915_SCHEDULER_CAP_PREEMPTION;
drm->StoredDeviceID = hwConfigTestMidBatchBit;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::MidBatch, outHwInfo.capabilityTable.defaultPreemptionMode);
EXPECT_TRUE(drm->isPreemptionSupported());
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledNoPreemption) {
pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
drm->StoredPreemptionSupport =
I915_SCHEDULER_CAP_ENABLED |
I915_SCHEDULER_CAP_PRIORITY |
I915_SCHEDULER_CAP_PREEMPTION;
drm->StoredDeviceID = 1;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode);
EXPECT_TRUE(drm->isPreemptionSupported());
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmDisabledAllPreemption) {
pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
drm->StoredPreemptionSupport = 0;
drm->StoredDeviceID = hwConfigTestMidThreadBit | hwConfigTestThreadGroupBit | hwConfigTestMidBatchBit;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode);
EXPECT_FALSE(drm->isPreemptionSupported());
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledAllPreemptionDriverThreadGroup) {
pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::ThreadGroup;
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::ThreadGroup;
drm->StoredPreemptionSupport =
I915_SCHEDULER_CAP_ENABLED |
I915_SCHEDULER_CAP_PRIORITY |
I915_SCHEDULER_CAP_PREEMPTION;
drm->StoredDeviceID = hwConfigTestMidThreadBit | hwConfigTestThreadGroupBit | hwConfigTestMidBatchBit;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::ThreadGroup, outHwInfo.capabilityTable.defaultPreemptionMode);
EXPECT_TRUE(drm->isPreemptionSupported());
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledAllPreemptionDriverMidBatch) {
pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::MidBatch;
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidBatch;
drm->StoredPreemptionSupport =
I915_SCHEDULER_CAP_ENABLED |
I915_SCHEDULER_CAP_PRIORITY |
I915_SCHEDULER_CAP_PREEMPTION;
drm->StoredDeviceID = hwConfigTestMidThreadBit | hwConfigTestThreadGroupBit | hwConfigTestMidBatchBit;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::MidBatch, outHwInfo.capabilityTable.defaultPreemptionMode);
EXPECT_TRUE(drm->isPreemptionSupported());
}
TEST_F(HwInfoConfigTestLinuxDummy, dummyConfigPreemptionDrmEnabledAllPreemptionDriverDisabled) {
pInHwInfo->capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
drm->StoredPreemptionSupport =
I915_SCHEDULER_CAP_ENABLED |
I915_SCHEDULER_CAP_PRIORITY |
I915_SCHEDULER_CAP_PREEMPTION;
drm->StoredDeviceID = hwConfigTestMidThreadBit | hwConfigTestThreadGroupBit | hwConfigTestMidBatchBit;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode);
EXPECT_TRUE(drm->isPreemptionSupported());
}
TEST_F(HwInfoConfigTestLinuxDummy, givenPlatformEnabledFtrCompressionWhenInitializingThenForceDisable) {
pInHwInfo->capabilityTable.ftrRenderCompressedBuffers = true;
pInHwInfo->capabilityTable.ftrRenderCompressedImages = true;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
pInHwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
pInHwInfo.capabilityTable.ftrRenderCompressedImages = true;
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
}
TEST_F(HwInfoConfigTestLinuxDummy, givenPointerToHwInfoWhenConfigureHwInfoCalledThenRequiedSurfaceSizeIsSettedProperly) {
EXPECT_EQ(MemoryConstants::pageSize, pInHwInfo->capabilityTable.requiredPreemptionSurfaceSize);
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(MemoryConstants::pageSize, pInHwInfo.capabilityTable.requiredPreemptionSurfaceSize);
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret);
EXPECT_EQ(outHwInfo.pSysInfo->CsrSizeInMb * MemoryConstants::megaByte, outHwInfo.capabilityTable.requiredPreemptionSurfaceSize);
EXPECT_EQ(outHwInfo.pSysInfo.CsrSizeInMb * MemoryConstants::megaByte, outHwInfo.capabilityTable.requiredPreemptionSurfaceSize);
}

View File

@@ -25,6 +25,4 @@ struct HwInfoConfigTestLinux : public HwInfoConfigTest {
DrmMock *drm;
void (*rt_cpuidex_func)(int *, int, int);
HardwareInfo testHwInfo;
};

View File

@@ -33,7 +33,7 @@ class MockPerformanceCountersGen : public PerformanceCounters {
};
HWTEST_F(PerformanceCountersGenTest, givenPerfCountersWhenInitializedWithoutGenSpecificThenDefaultFunctionIsUsed) {
auto gfxCore = platformDevices[0]->pPlatform->eRenderCoreFamily;
auto gfxCore = platformDevices[0]->pPlatform.eRenderCoreFamily;
VariableBackup<decltype(&instrGetPerfCountersQueryData)> bkp(&getPerfCountersQueryDataFactory[gfxCore], nullptr);
@@ -49,7 +49,7 @@ HWTEST_F(PerformanceCountersGenTest, givenPerfCountersWhenInitializedWithoutGenS
}
HWTEST_F(PerformanceCountersGenTest, givenPerfCountersWhenInitializedWithGenSpecificThenGenFunctionIsUsed) {
VariableBackup<decltype(&instrGetPerfCountersQueryData)> bkp(&getPerfCountersQueryDataFactory[platformDevices[0]->pPlatform->eRenderCoreFamily]);
VariableBackup<decltype(&instrGetPerfCountersQueryData)> bkp(&getPerfCountersQueryDataFactory[platformDevices[0]->pPlatform.eRenderCoreFamily]);
auto mockFn = [](
InstrEscCbData cbData,

View File

@@ -65,7 +65,7 @@ class WddmCommandStreamFixture {
memoryManager = new MockWddmMemoryManager(*executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
device.reset(MockDevice::create<MockDevice>(platformDevices[0], executionEnvironment, 0u));
device.reset(MockDevice::create<MockDevice>(executionEnvironment, 0u));
device->resetCommandStreamReceiver(csr);
ASSERT_NE(nullptr, device);
}
@@ -125,7 +125,7 @@ class WddmCommandStreamWithMockGdiFixture {
memoryManager = new WddmMemoryManager(*executionEnvironment);
ASSERT_NE(nullptr, memoryManager);
executionEnvironment->memoryManager.reset(memoryManager);
device = std::unique_ptr<MockDevice>(Device::create<MockDevice>(platformDevices[0], executionEnvironment, 0u));
device = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
device->resetCommandStreamReceiver(this->csr);
ASSERT_NE(nullptr, device);
this->csr->overrideRecorededCommandBuffer(*device);
@@ -248,7 +248,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
executionEnvironment->commandStreamReceivers[0].push_back(std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment));
executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment));
executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false);
executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext);
@@ -274,7 +274,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
executionEnvironment->commandStreamReceivers[0].push_back(std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(*executionEnvironment));
executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment));
executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false);
executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext);
@@ -789,7 +789,7 @@ using WddmSimpleTest = ::testing::Test;
HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedOn) {
DebugManager.flags.CsrDispatchMode.set(0);
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(platformDevices[0], executionEnvironment, 0u));
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
auto wddm = Wddm::createWddm();
executionEnvironment->osInterface = std::make_unique<OSInterface>();
executionEnvironment->osInterface->get()->setWddm(wddm);
@@ -798,9 +798,6 @@ HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedO
}
HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVersionBasingOnFtrFlag) {
HardwareInfo myHwInfo = *platformDevices[0];
FeatureTable myFtrTable = *myHwInfo.pSkuTable;
myHwInfo.pSkuTable = &myFtrTable;
auto wddm = Wddm::createWddm();
pDevice->executionEnvironment->osInterface = std::make_unique<OSInterface>();
pDevice->executionEnvironment->osInterface->get()->setWddm(wddm);
@@ -832,7 +829,7 @@ struct WddmCsrCompressionParameterizedTest : WddmCsrCompressionTests, ::testing:
HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenInitializedThenCreatePagetableMngr) {
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(hwInfo, executionEnvironment, 0u));
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
setCompressionEnabled(compressionEnabled, !compressionEnabled);
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
EXPECT_EQ(nullptr, myMockWddm->getPageTableManager());
@@ -880,7 +877,7 @@ HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenInitial
HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenInitializedThenDontCreatePagetableMngr) {
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(hwInfo, executionEnvironment, 0u));
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
setCompressionEnabled(false, false);
myMockWddm = static_cast<WddmMock *>(executionEnvironment->osInterface->get()->getWddm());
MockWddmCsr<FamilyType> mockWddmCsr(*executionEnvironment);
@@ -897,7 +894,7 @@ HWTEST_P(WddmCsrCompressionParameterizedTest, givenEnabledCompressionWhenFlushin
executionEnvironment->memoryManager.reset(new WddmMemoryManager(*executionEnvironment));
auto mockMngr = reinterpret_cast<MockGmmPageTableMngr *>(myMockWddm->getPageTableManager());
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(hwInfo, executionEnvironment, 0u));
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
device->resetCommandStreamReceiver(mockWddmCsr);
auto memoryManager = executionEnvironment->memoryManager.get();
@@ -942,7 +939,7 @@ HWTEST_F(WddmCsrCompressionTests, givenDisabledCompressionWhenFlushingThenDontIn
mockWddmCsr->overrideDispatchPolicy(DispatchMode::BatchedDispatch);
executionEnvironment->memoryManager.reset(new WddmMemoryManager(*executionEnvironment));
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(hwInfo, executionEnvironment, 0u));
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, 0u));
device->resetCommandStreamReceiver(mockWddmCsr);
auto memoryManager = executionEnvironment->memoryManager.get();

View File

@@ -33,12 +33,12 @@ class DriverInfoDeviceTest : public ::testing::Test {
public:
void SetUp() {
hwInfo = platformDevices[0];
commandStreamReceiverCreateFunc = commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily];
commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily] = createMockCommandStreamReceiver;
commandStreamReceiverCreateFunc = commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily];
commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily] = createMockCommandStreamReceiver;
}
void TearDown() {
commandStreamReceiverFactory[hwInfo->pPlatform->eRenderCoreFamily] = commandStreamReceiverCreateFunc;
commandStreamReceiverFactory[hwInfo->pPlatform.eRenderCoreFamily] = commandStreamReceiverCreateFunc;
}
CommandStreamReceiverCreateFunc commandStreamReceiverCreateFunc;

View File

@@ -17,8 +17,8 @@ OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSyst
struct GdiDllFixture {
virtual void SetUp() {
const HardwareInfo hwInfo = *platformDevices[0];
mockGdiDll.reset(setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace));
const HardwareInfo *hwInfo = platformDevices[0];
mockGdiDll.reset(setAdapterInfo(&hwInfo->pPlatform, &hwInfo->pSysInfo, hwInfo->capabilityTable.gpuAddressSpace));
setSizesFcn = reinterpret_cast<decltype(&MockSetSizes)>(mockGdiDll->getProcAddress("MockSetSizes"));
getSizesFcn = reinterpret_cast<decltype(&GetMockSizes)>(mockGdiDll->getProcAddress("GetMockSizes"));

View File

@@ -326,7 +326,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza
FailSignalSyncObjectMock::reset();
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
wddm->init(preemptionMode);
OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
CL_GL_SYNC_INFO syncInfo = {};
syncInfo.serverSynchronizationObject = 0x5cU;
@@ -385,7 +385,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza
FailSignalSyncObjectMock::reset();
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
wddm->init(preemptionMode);
OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
CL_GL_SYNC_INFO syncInfo = {};
syncInfo.submissionSynchronizationObject = 0x7cU;

View File

@@ -29,7 +29,6 @@ void HwInfoConfigTestWindows::SetUp() {
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
wddm->enumAdapters(outHwInfo);
testHwInfo = outHwInfo;
}
void HwInfoConfigTestWindows::TearDown() {
@@ -37,14 +36,14 @@ void HwInfoConfigTestWindows::TearDown() {
}
TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenReturnSuccess) {
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get());
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get());
EXPECT_EQ(0, ret);
}
TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenSetFtrSvmCorrectly) {
auto ftrSvm = outHwInfo.pSkuTable->ftrSVM;
auto ftrSvm = outHwInfo.pSkuTable.ftrSVM;
int ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get());
int ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get());
ASSERT_EQ(0, ret);
EXPECT_EQ(outHwInfo.capabilityTable.ftrSvm, ftrSvm);
@@ -54,12 +53,12 @@ TEST_F(HwInfoConfigTestWindows, givenInstrumentationForHardwareIsEnabledOrDisabl
int ret;
outHwInfo.capabilityTable.instrumentationEnabled = false;
ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get());
ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get());
ASSERT_EQ(0, ret);
EXPECT_FALSE(outHwInfo.capabilityTable.instrumentationEnabled);
outHwInfo.capabilityTable.instrumentationEnabled = true;
ret = hwConfig.configureHwInfo(pInHwInfo, &outHwInfo, osInterface.get());
ret = hwConfig.configureHwInfo(&pInHwInfo, &outHwInfo, osInterface.get());
ASSERT_EQ(0, ret);
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled == haveInstrumentation);
}

View File

@@ -22,7 +22,6 @@ struct HwInfoConfigTestWindows : public HwInfoConfigTest {
void TearDown() override;
std::unique_ptr<OSInterface> osInterface;
HardwareInfo testHwInfo;
DummyHwConfig hwConfig;
};

View File

@@ -30,7 +30,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextBeforeInitWddmThenOsContextIsNot
auto wddm = new WddmMock;
OSInterface osInterface;
osInterface.get()->setWddm(wddm);
EXPECT_THROW(OsContextWin(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
EXPECT_THROW(OsContextWin(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false),
std::exception);
}
@@ -42,7 +42,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
wddm->init(preemptionMode);
EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called);
auto osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
auto osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
EXPECT_TRUE(osContext->isInitialized());
EXPECT_EQ(osContext->getWddm(), wddm);
EXPECT_EQ(1u, wddm->registerTrimCallbackResult.called);

View File

@@ -89,81 +89,59 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp
TEST(Wddm20EnumAdaptersTest, expectTrue) {
HardwareInfo outHwInfo;
const HardwareInfo hwInfo = *platformDevices[0];
OsLibrary *mockGdiDll = setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace);
const HardwareInfo *hwInfo = platformDevices[0];
std::unique_ptr<OsLibrary> mockGdiDll(setAdapterInfo(&hwInfo->pPlatform,
&hwInfo->pSysInfo,
hwInfo->capabilityTable.gpuAddressSpace));
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
bool success = wddm->enumAdapters(outHwInfo);
EXPECT_TRUE(success);
const HardwareInfo *hwinfo = *platformDevices;
ASSERT_NE(nullptr, outHwInfo.pPlatform);
EXPECT_EQ(outHwInfo.pPlatform->eDisplayCoreFamily, hwinfo->pPlatform->eDisplayCoreFamily);
delete mockGdiDll;
delete outHwInfo.pPlatform;
delete outHwInfo.pSkuTable;
delete outHwInfo.pSysInfo;
delete outHwInfo.pWaTable;
EXPECT_EQ(outHwInfo.pPlatform.eDisplayCoreFamily, hwInfo->pPlatform.eDisplayCoreFamily);
}
TEST(Wddm20EnumAdaptersTest, givenEmptyHardwareInfoWhenEnumAdapterIsCalledThenCapabilityTableIsSet) {
HardwareInfo outHwInfo = {};
auto hwInfo = *platformDevices[0];
std::unique_ptr<OsLibrary> mockGdiDll(setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace));
const HardwareInfo *hwInfo = platformDevices[0];
std::unique_ptr<OsLibrary> mockGdiDll(setAdapterInfo(&hwInfo->pPlatform,
&hwInfo->pSysInfo,
hwInfo->capabilityTable.gpuAddressSpace));
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
bool success = wddm->enumAdapters(outHwInfo);
EXPECT_TRUE(success);
const HardwareInfo *hwinfo = *platformDevices;
EXPECT_EQ(outHwInfo.pPlatform.eDisplayCoreFamily, hwInfo->pPlatform.eDisplayCoreFamily);
ASSERT_NE(nullptr, outHwInfo.pPlatform);
EXPECT_EQ(outHwInfo.pPlatform->eDisplayCoreFamily, hwinfo->pPlatform->eDisplayCoreFamily);
EXPECT_EQ(outHwInfo.capabilityTable.defaultProfilingTimerResolution, hwInfo.capabilityTable.defaultProfilingTimerResolution);
EXPECT_EQ(outHwInfo.capabilityTable.clVersionSupport, hwInfo.capabilityTable.clVersionSupport);
EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify, hwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, hwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleep, hwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds, hwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
delete outHwInfo.pPlatform;
delete outHwInfo.pSkuTable;
delete outHwInfo.pSysInfo;
delete outHwInfo.pWaTable;
EXPECT_EQ(outHwInfo.capabilityTable.defaultProfilingTimerResolution, hwInfo->capabilityTable.defaultProfilingTimerResolution);
EXPECT_EQ(outHwInfo.capabilityTable.clVersionSupport, hwInfo->capabilityTable.clVersionSupport);
EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify, hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds, hwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleep, hwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
EXPECT_EQ(outHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds, hwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
}
TEST(Wddm20EnumAdaptersTest, givenUnknownPlatformWhenEnumAdapterIsCalledThenFalseIsReturnedAndOutputIsEmpty) {
HardwareInfo outHwInfo;
memset(&outHwInfo, 0, sizeof(outHwInfo));
HardwareInfo outHwInfo = {};
HardwareInfo hwInfo = *platformDevices[0];
auto bkp = hwInfo.pPlatform->eProductFamily;
PLATFORM platform = *(hwInfo.pPlatform);
platform.eProductFamily = IGFX_UNKNOWN;
hwInfo.pPlatform.eProductFamily = IGFX_UNKNOWN;
std::unique_ptr<OsLibrary> mockGdiDll(setAdapterInfo(&hwInfo.pPlatform,
&hwInfo.pSysInfo,
hwInfo.capabilityTable.gpuAddressSpace));
std::unique_ptr<OsLibrary, std::function<void(OsLibrary *)>> mockGdiDll(
setAdapterInfo(&platform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace),
[&](OsLibrary *ptr) {
platform.eProductFamily = bkp;
typedef void(__stdcall * pfSetAdapterInfo)(const void *, const void *, uint64_t);
pfSetAdapterInfo fSetAdpaterInfo = reinterpret_cast<pfSetAdapterInfo>(ptr->getProcAddress("MockSetAdapterInfo"));
fSetAdpaterInfo(&platform, hwInfo.pSysInfo, hwInfo.capabilityTable.gpuAddressSpace);
delete ptr;
});
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
auto ret = wddm->enumAdapters(outHwInfo);
EXPECT_FALSE(ret);
EXPECT_EQ(nullptr, outHwInfo.pPlatform);
EXPECT_EQ(nullptr, outHwInfo.pSkuTable);
EXPECT_EQ(nullptr, outHwInfo.pSysInfo);
EXPECT_EQ(nullptr, outHwInfo.pWaTable);
// reset mock gdi
hwInfo = *platformDevices[0];
mockGdiDll.reset(setAdapterInfo(&hwInfo.pPlatform,
&hwInfo.pSysInfo,
hwInfo.capabilityTable.gpuAddressSpace));
}
TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) {
@@ -454,7 +432,7 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceOnInit) {
D3DKMT_HANDLE adapterHandle = ADAPTER_HANDLE;
D3DKMT_HANDLE deviceHandle = DEVICE_HANDLE;
const HardwareInfo hwInfo = *platformDevices[0];
BOOLEAN FtrL3IACoherency = hwInfo.pSkuTable->ftrL3IACoherency ? 1 : 0;
BOOLEAN FtrL3IACoherency = hwInfo.pSkuTable.ftrL3IACoherency ? 1 : 0;
uintptr_t maxAddr = hwInfo.capabilityTable.gpuAddressSpace == MemoryConstants::max48BitAddress
? reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress) + 1
: 0;
@@ -530,7 +508,7 @@ TEST_F(Wddm20WithMockGdiDllTestsWithoutWddmInit, givenUseNoRingFlushesKmdModeDeb
TEST_F(Wddm20WithMockGdiDllTestsWithoutWddmInit, givenEngineTypeWhenCreatingContextThenPassCorrectNodeOrdinal) {
init();
auto createContextParams = this->getCreateContextDataFcn();
UINT expected = WddmEngineMapper::engineNodeMap(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]);
UINT expected = WddmEngineMapper::engineNodeMap(HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0]);
EXPECT_EQ(expected, createContextParams->NodeOrdinal);
}

View File

@@ -38,7 +38,7 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture {
void init() {
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
EXPECT_TRUE(wddm->init(preemptionMode));
osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
}
void TearDown() override {
@@ -66,7 +66,7 @@ TEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) {
}
TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) {
auto defaultEngine = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0];
auto defaultEngine = HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0];
OsContextWin osContextWithoutPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::Disabled, false);
OsContextWin osContextWithPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::MidBatch, false);

View File

@@ -33,7 +33,7 @@ struct WddmFixture : ::testing::Test {
wddm->gdi.reset(gdi);
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
wddm->init(preemptionMode);
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1u, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
ASSERT_TRUE(wddm->isInitialized());
}
@@ -58,7 +58,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
void init() {
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
EXPECT_TRUE(wddm->init(preemptionMode));
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
ASSERT_TRUE(wddm->isInitialized());
}

View File

@@ -326,7 +326,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSingleEngineRegister
}
TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuForEachEngine) {
memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1],
memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[1],
2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount());
@@ -344,7 +344,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi
}
TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEnginesRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuForTheseEngines) {
memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1],
memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[1],
2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount());

View File

@@ -56,7 +56,7 @@ class MockWddmMemoryManagerFixture {
executionEnvironment->osInterface->get()->setWddm(wddm);
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
osContext->incRefInternal();
@@ -101,7 +101,7 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture
memoryManager = new (std::nothrow) MockWddmMemoryManager(*executionEnvironment);
//assert we have memory manager
ASSERT_NE(nullptr, memoryManager);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false);
osContext->incRefInternal();

View File

@@ -37,7 +37,7 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
regReader->forceRetValue = forceReturnPreemptionRegKeyValue;
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfoTest);
wddm->init(preemptionMode);
osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);
}
DebugManagerStateRestore *dbgRestorer = nullptr;

View File

@@ -92,7 +92,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT
executionEnvironment->osInterface->get()->setWddm(wddm);
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false);
osContext->incRefInternal();
residencyController = &static_cast<OsContextWin *>(osContext)->getResidencyController();
@@ -123,7 +123,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
executionEnvironment->osInterface->get()->setWddm(wddm);
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
osContext->incRefInternal();