2019-03-01 21:58:11 +08:00
|
|
|
/*
|
2023-02-01 11:12:09 +08:00
|
|
|
* Copyright (C) 2019-2023 Intel Corporation
|
2019-03-01 21:58:11 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
2020-03-04 15:51:02 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2021-07-01 22:28:56 +08:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
|
|
|
#include "shared/source/os_interface/device_factory.h"
|
2023-03-10 20:28:11 +08:00
|
|
|
#include "shared/source/os_interface/product_helper.h"
|
2021-07-01 22:28:56 +08:00
|
|
|
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
|
|
|
#include "shared/test/common/helpers/default_hw_info.h"
|
2022-06-30 03:17:47 +08:00
|
|
|
#include "shared/test/common/test_macros/hw_test.h"
|
2021-07-01 22:28:56 +08:00
|
|
|
#include "shared/test/common/test_macros/test_checks_shared.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2021-07-01 22:28:56 +08:00
|
|
|
namespace NEO {
|
|
|
|
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment);
|
2019-03-01 21:58:11 +08:00
|
|
|
|
2020-03-23 16:13:25 +08:00
|
|
|
using PrepareDeviceEnvironmentsTests = ::testing::Test;
|
2019-03-01 21:58:11 +08:00
|
|
|
|
2020-03-23 16:13:25 +08:00
|
|
|
HWTEST_F(PrepareDeviceEnvironmentsTests, WhenPrepareDeviceEnvironmentsIsCalledThenSuccessIsReturned) {
|
2019-07-25 23:59:12 +08:00
|
|
|
ExecutionEnvironment executionEnvironment;
|
2019-03-01 21:58:11 +08:00
|
|
|
|
2020-03-23 16:13:25 +08:00
|
|
|
auto returnValue = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
2019-03-01 21:58:11 +08:00
|
|
|
EXPECT_EQ(true, returnValue);
|
|
|
|
}
|
2019-07-16 19:45:35 +08:00
|
|
|
|
2020-03-23 16:13:25 +08:00
|
|
|
HWTEST_F(PrepareDeviceEnvironmentsTests, whenPrepareDeviceEnvironmentsIsCalledThenGmmIsBeingInitializedAfterFillingHwInfo) {
|
|
|
|
ExecutionEnvironment executionEnvironment;
|
|
|
|
executionEnvironment.prepareRootDeviceEnvironments(1u);
|
|
|
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
2019-12-17 15:11:16 +08:00
|
|
|
hwInfo->platform.eProductFamily = PRODUCT_FAMILY::IGFX_UNKNOWN;
|
|
|
|
hwInfo->platform.ePCHProductFamily = PCH_PRODUCT_FAMILY::PCH_UNKNOWN;
|
2020-03-23 16:13:25 +08:00
|
|
|
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
|
2019-07-16 19:45:35 +08:00
|
|
|
|
2020-03-23 16:13:25 +08:00
|
|
|
auto returnValue = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
2019-07-16 19:45:35 +08:00
|
|
|
EXPECT_TRUE(returnValue);
|
2020-03-23 16:13:25 +08:00
|
|
|
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
|
2019-07-16 19:45:35 +08:00
|
|
|
}
|
2021-07-01 22:28:56 +08:00
|
|
|
|
2023-10-03 23:57:01 +08:00
|
|
|
HWTEST_F(PrepareDeviceEnvironmentsTests, givenRcsAndCcsNotSupportedWhenInitializingThenReturnFalse) {
|
2021-07-01 22:28:56 +08:00
|
|
|
REQUIRE_64BIT_OR_SKIP();
|
|
|
|
|
2022-11-29 20:31:17 +08:00
|
|
|
NEO::ExecutionEnvironment executionEnvironment;
|
2023-02-01 11:12:09 +08:00
|
|
|
executionEnvironment.prepareRootDeviceEnvironments(1u);
|
|
|
|
executionEnvironment.rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
2023-10-03 23:57:01 +08:00
|
|
|
executionEnvironment.rootDeviceEnvironments[0]->setRcsExposure();
|
|
|
|
auto *hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
2023-02-01 11:12:09 +08:00
|
|
|
auto &productHelper = executionEnvironment.rootDeviceEnvironments[0]->getProductHelper();
|
2023-10-03 23:57:01 +08:00
|
|
|
productHelper.configureHardwareCustom(hwInfo, nullptr);
|
2021-07-01 22:28:56 +08:00
|
|
|
|
|
|
|
bool expectedValue = false;
|
2023-10-03 23:57:01 +08:00
|
|
|
if (hwInfo->featureTable.flags.ftrRcsNode || hwInfo->featureTable.flags.ftrCCSNode) {
|
2021-07-01 22:28:56 +08:00
|
|
|
expectedValue = true;
|
|
|
|
}
|
|
|
|
|
2022-11-29 20:31:17 +08:00
|
|
|
EXPECT_EQ(expectedValue, NEO::prepareDeviceEnvironments(executionEnvironment));
|
2021-07-01 22:28:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
HWTEST_F(PrepareDeviceEnvironmentsTests, Given32bitApplicationWhenDebugKeyIsSetThenSupportIsReported) {
|
2022-11-29 20:31:17 +08:00
|
|
|
NEO::ExecutionEnvironment executionEnvironment;
|
2021-07-01 22:28:56 +08:00
|
|
|
DebugManagerStateRestore restorer;
|
|
|
|
DebugManager.flags.Force32BitDriverSupport.set(true);
|
2022-11-29 20:31:17 +08:00
|
|
|
EXPECT_TRUE(NEO::prepareDeviceEnvironments(executionEnvironment));
|
2021-07-01 22:28:56 +08:00
|
|
|
}
|
|
|
|
} // namespace NEO
|