mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Add mechanism to avoid calling gdi calls while process exit
Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
673a6244ee
commit
ddd8a08fac
@@ -271,6 +271,55 @@ TEST(ExecutionEnvironment, givenMultipleRootDevicesWhenTheyAreCreatedThenReuseMe
|
||||
EXPECT_EQ(memoryManager, device2->getMemoryManager());
|
||||
}
|
||||
|
||||
uint64_t isDriverAvaliableCounter = 0u;
|
||||
|
||||
class DriverModelMock : public DriverModel {
|
||||
public:
|
||||
DriverModelMock(DriverModelType driverModelType) : DriverModel(driverModelType) {
|
||||
}
|
||||
|
||||
bool isDriverAvaliable() override {
|
||||
isDriverAvaliableCounter++;
|
||||
return true;
|
||||
}
|
||||
void setGmmInputArgs(void *args) override {
|
||||
}
|
||||
|
||||
uint32_t getDeviceHandle() const override {
|
||||
return 0;
|
||||
}
|
||||
|
||||
PhysicalDevicePciBusInfo getPciBusInfo() const override {
|
||||
return {};
|
||||
}
|
||||
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override {
|
||||
return {};
|
||||
}
|
||||
|
||||
bool skipResourceCleanup() const {
|
||||
return skipResourceCleanupVar;
|
||||
}
|
||||
|
||||
bool isGpuHangDetected(OsContext &osContext) override {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
TEST(ExecutionEnvironment, givenRootDeviceWhenPrepareForCleanupThenIsDriverAvaliableIsCalled) {
|
||||
VariableBackup<uint64_t> varBackup = &isDriverAvaliableCounter;
|
||||
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
|
||||
std::unique_ptr<OSInterface> osInterface = std::make_unique<OSInterface>();
|
||||
osInterface->setDriverModel(std::make_unique<DriverModelMock>(DriverModelType::UNKNOWN));
|
||||
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::move(osInterface);
|
||||
|
||||
executionEnvironment->prepareForCleanup();
|
||||
|
||||
EXPECT_EQ(1u, isDriverAvaliableCounter);
|
||||
}
|
||||
|
||||
TEST(ExecutionEnvironment, givenUnproperSetCsrFlagValueWhenInitializingMemoryManagerThenCreateDefaultMemoryManager) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(10);
|
||||
|
||||
@@ -997,6 +997,7 @@ TEST(DrmTest, whenCheckedIfResourcesCleanupCanBeSkippedThenReturnsFalse) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
DrmMock *pDrm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
EXPECT_TRUE(pDrm->isDriverAvaliable());
|
||||
EXPECT_FALSE(pDrm->skipResourceCleanup());
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ struct OsContextWinTestNoCleanup : public WddmTestWithMockGdiDllNoCleanup {
|
||||
|
||||
TEST_F(OsContextWinTestNoCleanup, givenReinitializeContextWhenContextIsInitThenContextIsNotDestroyed) {
|
||||
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0u, EngineDescriptorHelper::getDefaultDescriptor(engineTypeUsage, preemptionMode));
|
||||
EXPECT_FALSE(this->wddm->isDriverAvaliable());
|
||||
EXPECT_TRUE(this->wddm->skipResourceCleanup());
|
||||
EXPECT_NO_THROW(osContext->reInitializeContext());
|
||||
EXPECT_NO_THROW(osContext->ensureContextInitialized());
|
||||
|
||||
Reference in New Issue
Block a user