mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Require OpenCLDriverName in DeviceRegistryPath
Change-Id: I93a8ca95082f6ddb48adffe33145568f32d77418 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Mateusz Jablonski
parent
e729995f2c
commit
39f42b20ba
@@ -118,9 +118,10 @@ class MockRegistryReader : public SettingsReader {
|
||||
} else if (key == "UserModeDriverNameWOW") {
|
||||
properMediaSharingExtensions = true;
|
||||
return returnString;
|
||||
}
|
||||
if (key == "DriverStorePathForComputeRuntime") {
|
||||
} else if (key == "DriverStorePathForComputeRuntime") {
|
||||
return driverStorePath;
|
||||
} else if (key == "OpenCLDriverName") {
|
||||
return openCLDriverName;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@@ -133,6 +134,7 @@ class MockRegistryReader : public SettingsReader {
|
||||
bool properNameKey = false;
|
||||
bool properVersionKey = false;
|
||||
std::string driverStorePath = "driverStore\\0x8086";
|
||||
std::string openCLDriverName = "igdrcl.dll";
|
||||
bool properMediaSharingExtensions = false;
|
||||
bool using64bit = false;
|
||||
std::string returnString = "";
|
||||
@@ -231,6 +233,15 @@ TEST(DriverInfo, givenInitializedOsInterfaceWhenCreateDriverInfoWindowsThenSetRe
|
||||
EXPECT_STREQ(driverInfo->getRegistryReaderRegKey(), driverInfo->reader->getRegKey());
|
||||
};
|
||||
|
||||
TEST_F(DriverInfoWindowsTest, whenThereIsNoOpenCLDriverNamePointedByDriverInfoThenItIsNotCompatible) {
|
||||
VariableBackup<const wchar_t *> currentLibraryPathBackup(&SysCalls::currentLibraryPath);
|
||||
currentLibraryPathBackup = L"driverStore\\0x8086\\myLib.dll";
|
||||
|
||||
static_cast<MockRegistryReader *>(driverInfo->registryReader.get())->openCLDriverName = "";
|
||||
|
||||
EXPECT_FALSE(driverInfo->isCompatibleDriverStore());
|
||||
}
|
||||
|
||||
TEST_F(DriverInfoWindowsTest, whenCurrentLibraryIsLoadedFromDriverStorePointedByDriverInfoThenItIsCompatible) {
|
||||
VariableBackup<const wchar_t *> currentLibraryPathBackup(&SysCalls::currentLibraryPath);
|
||||
currentLibraryPathBackup = L"driverStore\\0x8086\\myLib.dll";
|
||||
|
||||
@@ -45,6 +45,15 @@ DWORD getModuleFileName(HMODULE hModule, LPWSTR lpFilename, DWORD nSize) {
|
||||
lstrcpyW(lpFilename, currentLibraryPath);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *openCLDriverName = "igdrcl.dll";
|
||||
|
||||
char *getenv(const char *variableName) {
|
||||
if (strcmp(variableName, "OpenCLDriverName") == 0) {
|
||||
return openCLDriverName;
|
||||
}
|
||||
return ::getenv(variableName);
|
||||
}
|
||||
} // namespace SysCalls
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -12,4 +12,8 @@ namespace NEO {
|
||||
SettingsReader *SettingsReader::createOsReader(bool userScope, const std::string ®Key) {
|
||||
return new EnvironmentVariableReader;
|
||||
}
|
||||
|
||||
char *SettingsReader::getenv(const char *settingName) {
|
||||
return ::getenv(settingName);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -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 ®Key) : registryReadRootKey(regKey) {
|
||||
hkeyType = userScope ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
|
||||
setUpProcessName();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user