Require OpenCLDriverName in DeviceRegistryPath

Change-Id: I93a8ca95082f6ddb48adffe33145568f32d77418
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Jaroslaw Chodor
2020-08-24 01:55:47 +02:00
committed by Mateusz Jablonski
parent e729995f2c
commit 39f42b20ba
9 changed files with 42 additions and 4 deletions

View File

@@ -12,4 +12,8 @@ namespace NEO {
SettingsReader *SettingsReader::createOsReader(bool userScope, const std::string &regKey) {
return new EnvironmentVariableReader;
}
char *SettingsReader::getenv(const char *settingName) {
return ::getenv(settingName);
}
} // namespace NEO

View File

@@ -8,6 +8,7 @@
#include "shared/source/os_interface/windows/debug_registry_reader.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/os_interface/windows/sys_calls.h"
#include "shared/source/os_interface/windows/windows_wrapper.h"
#include "shared/source/utilities/debug_settings_reader.h"
@@ -19,6 +20,10 @@ SettingsReader *SettingsReader::createOsReader(bool userScope, const std::string
return new RegistryReader(userScope, regKey);
}
char *SettingsReader::getenv(const char *settingName) {
return SysCalls::getenv(settingName);
}
RegistryReader::RegistryReader(bool userScope, const std::string &regKey) : registryReadRootKey(regKey) {
hkeyType = userScope ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
setUpProcessName();

View File

@@ -68,6 +68,11 @@ std::string DriverInfoWindows::getVersion(std::string defaultVersion) {
bool DriverInfoWindows::isCompatibleDriverStore() const {
auto currentLibraryPath = getCurrentLibraryPath();
auto openclDriverName = registryReader.get()->getSetting("OpenCLDriverName", std::string{});
if (openclDriverName.empty()) {
return false;
}
auto driverStorePath = registryReader.get()->getSetting("DriverStorePathForComputeRuntime", currentLibraryPath);
return currentLibraryPath.find(driverStorePath.c_str()) == 0u;
}

View File

@@ -28,6 +28,9 @@ BOOL getModuleHandle(DWORD dwFlags, LPCWSTR lpModuleName, HMODULE *phModule) {
DWORD getModuleFileName(HMODULE hModule, LPWSTR lpFilename, DWORD nSize) {
return GetModuleFileName(hModule, lpFilename, nSize);
}
char *getenv(const char *variableName) {
return ::getenv(variableName);
}
} // namespace SysCalls
} // namespace NEO

View File

@@ -17,6 +17,7 @@ BOOL closeHandle(HANDLE hObject);
BOOL getSystemPowerStatus(LPSYSTEM_POWER_STATUS systemPowerStatusPtr);
BOOL getModuleHandle(DWORD dwFlags, LPCWSTR lpModuleName, HMODULE *phModule);
DWORD getModuleFileName(HMODULE hModule, LPWSTR lpFilename, DWORD nSize);
char *getenv(const char *variableName);
} // namespace SysCalls

View File

@@ -144,7 +144,7 @@ bool Wddm::queryAdapterInfo() {
memcpy_s(&gfxPartition, sizeof(gfxPartition), &adapterInfo.GfxPartition, sizeof(GMM_GFX_PARTITIONING));
memcpy_s(&adapterBDF, sizeof(adapterBDF), &adapterInfo.stAdapterBDF, sizeof(ADAPTER_BDF));
deviceRegistryPath = adapterInfo.DeviceRegistryPath;
deviceRegistryPath = std::string(adapterInfo.DeviceRegistryPath, sizeof(adapterInfo.DeviceRegistryPath)).c_str();
systemSharedMemory = adapterInfo.SystemSharedMemory;
dedicatedVideoMemory = adapterInfo.DedicatedVideoMemory;

View File

@@ -30,6 +30,6 @@ class SettingsReader {
virtual std::string getSetting(const char *settingName, const std::string &value) = 0;
virtual const char *appSpecificLocation(const std::string &name) = 0;
static const char *settingsFileName;
MOCKABLE_VIRTUAL char *getenv(const char *settingName) { return ::getenv(settingName); };
MOCKABLE_VIRTUAL char *getenv(const char *settingName);
};
}; // namespace NEO