mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
fix: correct order of wddm initialization
init gmm after getting device and paging queue handles Related-To: NEO-11080 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0c2a8ef30b
commit
ed15408592
@@ -136,6 +136,13 @@ bool Wddm::init() {
|
||||
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*hardwareInfo);
|
||||
|
||||
if (!createDevice(preemptionMode)) {
|
||||
return false;
|
||||
}
|
||||
if (!createPagingQueue()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rootDeviceEnvironment.initGmm();
|
||||
this->rootDeviceEnvironment.getGmmClientContext()->setHandleAllocator(this->hwDeviceId->getUmKmDataTranslator()->createGmmHandleAllocator());
|
||||
|
||||
@@ -147,13 +154,6 @@ bool Wddm::init() {
|
||||
} else {
|
||||
wddmInterface = std::make_unique<WddmInterface20>(*this);
|
||||
}
|
||||
|
||||
if (!createDevice(preemptionMode)) {
|
||||
return false;
|
||||
}
|
||||
if (!createPagingQueue()) {
|
||||
return false;
|
||||
}
|
||||
if (!gmmMemory) {
|
||||
gmmMemory.reset(GmmMemory::create(rootDeviceEnvironment.getGmmClientContext()));
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ ADAPTER_BDF gAdapterBDF{};
|
||||
D3DKMT_DEVICEEXECUTION_STATE gExecutionState = D3DKMT_DEVICEEXECUTION_ACTIVE;
|
||||
NTSTATUS gGetDeviceStateExecutionReturnValue = STATUS_SUCCESS;
|
||||
NTSTATUS gGetDeviceStatePageFaultReturnValue = STATUS_SUCCESS;
|
||||
bool failCreateDevice = false;
|
||||
bool failCreatePagingQueue = false;
|
||||
|
||||
NTSTATUS __stdcall mockD3DKMTEscape(IN CONST D3DKMT_ESCAPE *pData) {
|
||||
static int perfTicks = 0;
|
||||
@@ -69,6 +71,9 @@ NTSTATUS __stdcall mockD3DKMTOpenAdapterFromLuid(IN OUT CONST D3DKMT_OPENADAPTER
|
||||
}
|
||||
|
||||
NTSTATUS __stdcall mockD3DKMTCreateDevice(IN OUT D3DKMT_CREATEDEVICE *createDevice) {
|
||||
if (failCreateDevice) {
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
if (createDevice == nullptr || createDevice->hAdapter != ADAPTER_HANDLE) {
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -85,6 +90,9 @@ NTSTATUS __stdcall mockD3DKMTDestroyDevice(IN CONST D3DKMT_DESTROYDEVICE *destor
|
||||
}
|
||||
|
||||
NTSTATUS __stdcall mockD3DKMTCreatePagingQueue(IN OUT D3DKMT_CREATEPAGINGQUEUE *createQueue) {
|
||||
if (failCreatePagingQueue) {
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
if (createQueue == nullptr || (createQueue->hDevice != DEVICE_HANDLE)) {
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -115,3 +115,5 @@ void initGfxPartition();
|
||||
void setCapturingCreateAllocationFlags();
|
||||
void getCapturedCreateAllocationFlags(D3DKMT_CREATEALLOCATIONFLAGS &capturedCreateAllocationFlags, uint32_t &numCalled);
|
||||
void setSupportCreateAllocationWithReadWriteExisitingSysMemory(bool supportValue, bool &previousValue);
|
||||
extern bool failCreateDevice;
|
||||
extern bool failCreatePagingQueue;
|
||||
|
||||
@@ -536,6 +536,20 @@ TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenSharedHandl
|
||||
EXPECT_NE(0u, handle);
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, whenCreateDeviceFailsThenGmmIsNotIntialized) {
|
||||
VariableBackup backupFailDevice(&failCreateDevice, true);
|
||||
wddm->rootDeviceEnvironment.gmmHelper.reset();
|
||||
EXPECT_FALSE(wddm->init());
|
||||
EXPECT_EQ(nullptr, wddm->rootDeviceEnvironment.gmmHelper.get());
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, whenCreatePagingQueueFailsThenGmmIsNotIntialized) {
|
||||
VariableBackup backupFailDevice(&failCreatePagingQueue, true);
|
||||
wddm->rootDeviceEnvironment.gmmHelper.reset();
|
||||
EXPECT_FALSE(wddm->init());
|
||||
EXPECT_EQ(nullptr, wddm->rootDeviceEnvironment.gmmHelper.get());
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) {
|
||||
OsAgnosticMemoryManager mm(*executionEnvironment);
|
||||
auto gmmHelper = getGmmHelper();
|
||||
|
||||
Reference in New Issue
Block a user