Load proper KMD adapter

Related-To: NEO-3007

Change-Id: I6555caf4351f30677983cef86df48c88d0927ebc
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-10-02 14:49:33 +02:00
committed by sys_ocldev
parent a0a821105d
commit c3fc8d8695

View File

@@ -30,6 +30,24 @@
#include "gmm_memory.h"
std::wstring getIgdrclPath() {
std::wstring returnValue;
WCHAR path[255];
HMODULE handle = NULL;
auto status = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
(LPCWSTR)(&clGetPlatformIDs), &handle);
if (status != 0) {
status = GetModuleFileName(handle, path, sizeof(path));
if (status != 0) {
returnValue.append(path);
}
}
return returnValue;
}
namespace NEO {
extern Wddm::CreateDXGIFactoryFcn getCreateDxgiFactory();
extern Wddm::GetSystemInfoFcn getGetSystemInfo();
@@ -231,6 +249,8 @@ bool Wddm::openAdapter() {
IDXGIAdapter1 *pAdapter = nullptr;
DWORD iDevNum = 0;
auto igdrclPath = getIgdrclPath();
HRESULT hr = Wddm::createDxgiFactory(__uuidof(IDXGIFactory), (void **)(&pFactory));
if ((hr != S_OK) || (pFactory == nullptr)) {
return false;
@@ -243,7 +263,17 @@ bool Wddm::openAdapter() {
// be virtualizing one of our adapters) in the description
if ((wcsstr(OpenAdapterDesc.Description, L"Intel") != 0) ||
(wcsstr(OpenAdapterDesc.Description, L"Citrix") != 0)) {
break;
if (wcsstr(OpenAdapterDesc.Description, L"DCH-D") != 0) {
if (wcsstr(igdrclPath.c_str(), L"_dch_d.inf") != 0) {
break;
}
} else if (wcsstr(OpenAdapterDesc.Description, L"DCH-I") != 0) {
if (wcsstr(igdrclPath.c_str(), L"_dch_i.inf") != 0) {
break;
}
} else {
break;
}
}
}
// Release all the non-Intel adapters