Windows: discover all devices

Related-To: NEO-4208
Change-Id: I9d577ce3acc7545f7c424afcbd9869f50db200e6
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2020-02-26 11:36:16 +01:00 committed by sys_ocldev
parent c824b2e451
commit 078ef764a4
4 changed files with 19 additions and 2 deletions

View File

@ -24,4 +24,6 @@ void WINAPI ULTGetSystemInfo(SYSTEM_INFO *pSystemInfo) {
const wchar_t *UltIDXGIAdapter1::description = L"Intel";
extern uint32_t numRootDevicesToEnum = 0;
} // namespace NEO

View File

@ -7,6 +7,7 @@
#pragma once
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/memory_manager/memory_constants.h"
#include <cwchar>
@ -93,12 +94,19 @@ class UltIDXGIAdapter1 : public IDXGIAdapter1 {
}
};
extern uint32_t numRootDevicesToEnum;
class UltIDXGIFactory1 : public IDXGIFactory1 {
public:
HRESULT STDMETHODCALLTYPE EnumAdapters1(
UINT Adapter,
IDXGIAdapter1 **ppAdapter) {
if (Adapter > 2) {
UINT numRootDevices = 1u;
if (numRootDevicesToEnum > 0u) {
numRootDevices = numRootDevicesToEnum;
} else if (DebugManager.flags.CreateMultipleRootDevices.get()) {
numRootDevices = static_cast<UINT>(DebugManager.flags.CreateMultipleRootDevices.get());
}
if (Adapter >= numRootDevices) {
*(IDXGIAdapter1 **)ppAdapter = nullptr;
return DXGI_ERROR_NOT_FOUND;
}

View File

@ -39,6 +39,7 @@ namespace NEO {
namespace SysCalls {
extern const wchar_t *igdrclFilePath;
}
extern uint32_t numRootDevicesToEnum;
} // namespace NEO
using namespace NEO;
@ -120,6 +121,13 @@ TEST(WddmDiscoverDevices, WhenAdapterDescriptionContainsDCHIAndgdrclPathDoesntCo
EXPECT_TRUE(hwDeviceIds.empty());
}
TEST(WddmDiscoverDevices, WhenMultipleRootDevicesAreAvailableThenAllAreDiscovered) {
VariableBackup<uint32_t> backup{&numRootDevicesToEnum};
numRootDevicesToEnum = 3u;
auto hwDeviceIds = OSInterface::discoverDevices();
EXPECT_EQ(numRootDevicesToEnum, hwDeviceIds.size());
}
TEST(WddmDiscoverDevices, WhenAdapterDescriptionContainsDCHDAndgdrclPathContainsDchDThenAdapterIsDiscovered) {
VariableBackup<const wchar_t *> descriptionBackup(&UltIDXGIAdapter1::description);
descriptionBackup = L"Intel DCH-D";

View File

@ -287,7 +287,6 @@ std::vector<std::unique_ptr<HwDeviceId>> OSInterface::discoverDevices() {
auto hwDeviceId = createHwDeviceIdFromAdapterLuid(*gdi, OpenAdapterDesc.AdapterLuid);
if (hwDeviceId) {
hwDeviceIds.push_back(std::move(hwDeviceId));
break;
}
}
}