Add member for handling additional adapterInfo fields

Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich 2022-08-04 11:29:25 +00:00 committed by Compute-Runtime-Automation
parent d8cd596baf
commit b39be32e20
21 changed files with 184 additions and 83 deletions

View File

@ -9,7 +9,7 @@
#include "opencl/source/sharings/d3d/enable_d3d.h"
#include "shared/source/os_interface/driver_info.h"
#include "shared/source/os_interface/windows/driver_info_windows.h"
#include "opencl/source/api/api.h"
#include "opencl/source/context/context.h"
@ -104,11 +104,11 @@ std::string D3DSharingBuilderFactory<D3DTypesHelper::D3D9>::getExtensions(Driver
}
std::string D3DSharingBuilderFactory<D3DTypesHelper::D3D10>::getExtensions(DriverInfo *driverInfo) {
return "cl_khr_d3d10_sharing ";
return extensionEnabled ? "cl_khr_d3d10_sharing " : "";
}
std::string D3DSharingBuilderFactory<D3DTypesHelper::D3D11>::getExtensions(DriverInfo *driverInfo) {
return "cl_khr_d3d11_sharing cl_intel_d3d11_nv12_media_sharing ";
return extensionEnabled ? "cl_khr_d3d11_sharing cl_intel_d3d11_nv12_media_sharing " : "";
}
void D3DSharingBuilderFactory<D3DTypesHelper::D3D9>::fillGlobalDispatchTable() {
@ -166,12 +166,17 @@ void *D3DSharingBuilderFactory<D3DTypesHelper::D3D11>::getExtensionFunctionAddre
}
void D3DSharingBuilderFactory<D3DTypesHelper::D3D9>::setExtensionEnabled(DriverInfo *driverInfo) {
auto driverInfoWin = driverInfo->as<DriverInfoWindows>();
extensionEnabled = driverInfo->getMediaSharingSupport() && driverInfoWin->containsSetting(is64bit ? "UserModeDriverName" : "UserModeDriverNameWOW");
}
void D3DSharingBuilderFactory<D3DTypesHelper::D3D10>::setExtensionEnabled(DriverInfo *driverInfo) {
extensionEnabled = driverInfo->getMediaSharingSupport();
}
void D3DSharingBuilderFactory<D3DTypesHelper::D3D10>::setExtensionEnabled(DriverInfo *driverInfo) {}
void D3DSharingBuilderFactory<D3DTypesHelper::D3D11>::setExtensionEnabled(DriverInfo *driverInfo) {}
void D3DSharingBuilderFactory<D3DTypesHelper::D3D11>::setExtensionEnabled(DriverInfo *driverInfo) {
extensionEnabled = driverInfo->getMediaSharingSupport();
}
static SharingFactory::RegisterSharing<D3DSharingBuilderFactory<D3DTypesHelper::D3D9>, D3DSharingFunctions<D3DTypesHelper::D3D9>> D3D9Sharing;
static SharingFactory::RegisterSharing<D3DSharingBuilderFactory<D3DTypesHelper::D3D10>, D3DSharingFunctions<D3DTypesHelper::D3D10>> D3D10Sharing;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -57,7 +57,7 @@ std::unique_ptr<SharingContextBuilder> VaSharingBuilderFactory::createContextBui
};
std::string VaSharingBuilderFactory::getExtensions(DriverInfo *driverInfo) {
auto imageSupport = driverInfo ? driverInfo->getImageSupport() : false;
auto imageSupport = driverInfo ? driverInfo->getMediaSharingSupport() : false;
if (imageSupport && VASharingFunctions::isVaLibraryAvailable()) {
return "cl_intel_va_api_media_sharing ";
}

View File

@ -6,7 +6,7 @@
*/
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
#include "shared/source/os_interface/driver_info.h"
#include "shared/source/os_interface/windows/driver_info_windows.h"
#include "shared/source/utilities/arrayref.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/unit_test/helpers/gtest_helpers.h"
@ -850,12 +850,25 @@ TEST(D3D10, givenD3D10BuilderWhenGettingExtensionsThenCorrectExtensionsListIsRet
EXPECT_TRUE(hasSubstr(builderFactory->getExtensions(nullptr), std::string("cl_khr_d3d10_sharing")));
}
TEST(D3D10, givenD3D10BuilderAndExtensionEnableFalseWhenGettingExtensionsThenCorrectExtensionsListIsReturned) {
auto builderFactory = std::make_unique<D3DSharingBuilderFactory<D3DTypesHelper::D3D10>>();
builderFactory->extensionEnabled = false;
EXPECT_FALSE(hasSubstr(builderFactory->getExtensions(nullptr), std::string("cl_khr_d3d10_sharing")));
}
TEST(D3D11, givenD3D11BuilderWhenGettingExtensionsThenCorrectExtensionsListIsReturned) {
auto builderFactory = std::make_unique<D3DSharingBuilderFactory<D3DTypesHelper::D3D11>>();
EXPECT_TRUE(hasSubstr(builderFactory->getExtensions(nullptr), std::string("cl_khr_d3d11_sharing")));
EXPECT_TRUE(hasSubstr(builderFactory->getExtensions(nullptr), std::string("cl_intel_d3d11_nv12_media_sharing")));
}
TEST(D3D11, givenD3D11BuilderAndExtensionEnableFalseWhenGettingExtensionsThenCorrectExtensionsListIsReturned) {
auto builderFactory = std::make_unique<D3DSharingBuilderFactory<D3DTypesHelper::D3D11>>();
builderFactory->extensionEnabled = false;
EXPECT_FALSE(hasSubstr(builderFactory->getExtensions(nullptr), std::string("cl_khr_d3d11_sharing")));
EXPECT_FALSE(hasSubstr(builderFactory->getExtensions(nullptr), std::string("cl_intel_d3d11_nv12_media_sharing")));
}
TEST(D3DSharingFactory, givenEnabledFormatQueryAndFactoryWithD3DSharingsWhenGettingExtensionFunctionAddressThenFormatQueryFunctionsAreReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.EnableFormatQuery.set(true);
@ -872,8 +885,9 @@ TEST(D3DSharingFactory, givenEnabledFormatQueryAndFactoryWithD3DSharingsWhenGett
}
TEST(D3D9SharingFactory, givenDriverInfoWhenVerifyExtensionSupportThenExtensionEnableIsSetCorrect) {
class MockDriverInfo : public DriverInfo {
class MockDriverInfo : public DriverInfoWindows {
public:
MockDriverInfo() : DriverInfoWindows("", PhysicalDevicePciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue)) {}
bool getMediaSharingSupport() override { return support; };
bool support = true;
};
@ -911,4 +925,43 @@ TEST(D3D9SharingFactory, givenDriverInfoWhenVerifyExtensionSupportThenExtensionE
mockSharingFactory->verifyExtensionSupport(driverInfo.get());
EXPECT_FALSE(mockSharingFactory->d3d9SharingBuilderFactory->extensionEnabled);
}
TEST(D3D9SharingFactory, givenDriverInfoWhenSetExtensionEnabledThenCorrectValueIsSet) {
class MockDriverInfo : public DriverInfoWindows {
public:
MockDriverInfo() : DriverInfoWindows("", PhysicalDevicePciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue)) {}
bool getMediaSharingSupport() override { return support; };
bool containsSetting(const char *setting) override {
if (failingContainsSetting) {
return false;
}
if (memcmp(setting, "UserModeDriverName", sizeof("UserModeDriverName")) == 0) {
return true;
} else if (memcmp(setting, "UserModeDriverNameWOW", sizeof("UserModeDriverNameWOW")) == 0) {
return true;
} else {
return false;
}
}
bool support = true;
bool failingContainsSetting = false;
};
class SharingD3D9BuilderMock : public D3DSharingBuilderFactory<D3DTypesHelper::D3D9> {
public:
};
auto driverInfo = std::make_unique<MockDriverInfo>();
auto mockSharingFactory = std::make_unique<SharingD3D9BuilderMock>();
driverInfo->support = true;
mockSharingFactory->extensionEnabled = false;
mockSharingFactory->setExtensionEnabled(driverInfo.get());
EXPECT_TRUE(mockSharingFactory->extensionEnabled);
driverInfo->failingContainsSetting = true;
mockSharingFactory->extensionEnabled = false;
mockSharingFactory->setExtensionEnabled(driverInfo.get());
EXPECT_FALSE(mockSharingFactory->extensionEnabled);
}
} // namespace NEO

View File

@ -7,6 +7,7 @@
#include "shared/source/device/device.h"
#include "shared/source/helpers/get_info.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/unit_test/helpers/gtest_helpers.h"
@ -26,10 +27,14 @@ using namespace ::testing;
namespace NEO {
TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCorrectExtensionsAreSet) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
DebugManagerStateRestore stateRestore;
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
auto hwInfo = defaultHwInfo.get();
auto pDevice = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfo);
DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment());
auto pClDevice = new ClDevice{*pDevice, platform()};
std::string extensionString(pClDevice->getDeviceInfo().deviceExtensions);
EXPECT_FALSE(hasSubstr(extensionString, std::string("cl_intel_dx9_media_sharing ")));

View File

@ -7,7 +7,9 @@
#include "shared/source/device/device.h"
#include "shared/source/helpers/get_info.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/unit_test/helpers/gtest_helpers.h"
@ -21,10 +23,14 @@ using namespace ::testing;
namespace NEO {
TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCorrectExtensionsAreSet) {
VariableBackup<UltHwConfig> backup(&ultHwConfig);
DebugManagerStateRestore stateRestore;
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
auto hwInfo = defaultHwInfo.get();
auto pDevice = MockDevice::createWithNewExecutionEnvironment<Device>(hwInfo);
DeviceFactory::prepareDeviceEnvironments(*pDevice->getExecutionEnvironment());
auto pClDevice = new ClDevice{*pDevice, platform()};
std::string extensionString(pClDevice->getDeviceInfo().deviceExtensions);
EXPECT_FALSE(hasSubstr(extensionString, std::string("cl_intel_va_api_media_sharing ")));

View File

@ -177,29 +177,11 @@ TEST_F(DriverInfoWindowsTest, GivenDriverInfoWhenThenReturnNonNullptr) {
EXPECT_TRUE(registryReaderMock->properVersionKey);
};
TEST(DriverInfo, givenDriverInfoWhenGetStringReturnNotMeaningEmptyStringThenEnableSharingSupport) {
TEST(DriverInfo, givenDriverInfoWhenGetMediaSharingSupportThenTrueIsReturned) {
MockDriverInfoWindows driverInfo("", PhysicalDevicePciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue));
MockRegistryReader *registryReaderMock = new MockRegistryReader();
driverInfo.registryReader.reset(registryReaderMock);
auto enable = driverInfo.getMediaSharingSupport();
EXPECT_TRUE(enable);
EXPECT_EQ(is64bit, registryReaderMock->using64bit);
EXPECT_TRUE(registryReaderMock->properMediaSharingExtensions);
};
TEST(DriverInfo, givenDriverInfoWhenGetStringReturnMeaningEmptyStringThenDisableSharingSupport) {
MockDriverInfoWindows driverInfo("", PhysicalDevicePciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue));
MockRegistryReader *registryReaderMock = new MockRegistryReader();
registryReaderMock->returnString = "<>";
driverInfo.registryReader.reset(registryReaderMock);
auto enable = driverInfo.getMediaSharingSupport();
EXPECT_FALSE(enable);
EXPECT_EQ(is64bit, registryReaderMock->using64bit);
EXPECT_TRUE(registryReaderMock->properMediaSharingExtensions);
};
TEST(DriverInfo, givenFullPathToRegistryWhenCreatingDriverInfoWindowsThenTheRegistryPathIsTrimmed) {
@ -262,16 +244,4 @@ TEST_F(DriverInfoWindowsTest, whenCurrentLibraryIsLoadedFromDifferentDriverStore
EXPECT_FALSE(driverInfo->isCompatibleDriverStore());
}
TEST_F(DriverInfoWindowsTest, givenDriverInfoWindowsWhenGetImageSupportIsCalledThenReturnTrue) {
MockExecutionEnvironment executionEnvironment;
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
std::unique_ptr<OSInterface> osInterface(new OSInterface());
osInterface->setDriverModel(std::unique_ptr<DriverModel>(Wddm::createWddm(nullptr, rootDeviceEnvironment)));
EXPECT_NE(nullptr, osInterface->getDriverModel()->as<Wddm>());
std::unique_ptr<DriverInfo> driverInfo(DriverInfo::create(nullptr, osInterface.get()));
EXPECT_TRUE(driverInfo->getImageSupport());
}
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -25,8 +25,8 @@ extern "C" int vaDisplayIsValid(VADisplay vaDisplay) {
class MockDriverInfo : public DriverInfo {
public:
MockDriverInfo(bool imageSupport) : imageSupport(imageSupport) {}
bool getImageSupport() override { return imageSupport; };
MockDriverInfo(bool imageSupport) : DriverInfo(DriverInfoType::UNKNOWN), imageSupport(imageSupport) {}
bool getMediaSharingSupport() override { return imageSupport; };
bool imageSupport = true;
};
@ -130,7 +130,7 @@ TEST_F(VaSharingEnablerTests, givenVaBuilderWhenValidPropertyThenTrueIsReturned)
auto res = builder->processProperties(property, value);
EXPECT_TRUE(res);
//repeat to check if we don't allocate twice
// repeat to check if we don't allocate twice
auto prevAllocations = MemoryManagement::numAllocations.load();
res = builder->processProperties(property, value);
EXPECT_TRUE(res);

View File

@ -7,6 +7,8 @@
#pragma once
#include "shared/source/helpers/debug_helpers.h"
#include <cstdint>
#include <limits>
#include <string>
@ -38,22 +40,37 @@ struct PhyicalDevicePciSpeedInfo {
int64_t maxBandwidth = unknown;
};
enum class DriverInfoType { UNKNOWN,
WINDOWS,
LINUX };
class DriverInfo {
public:
DriverInfo()
: pciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue) {}
DriverInfo(DriverInfoType driverInfoType)
: driverInfoType(driverInfoType), pciBusInfo(PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue, PhysicalDevicePciBusInfo::invalidValue) {}
static DriverInfo *create(const HardwareInfo *hwInfo, const OSInterface *osInterface);
virtual ~DriverInfo() = default;
template <typename DerivedType>
DerivedType *as() {
UNRECOVERABLE_IF(DerivedType::driverInfoType != this->driverInfoType);
return static_cast<DerivedType *>(this);
}
template <typename DerivedType>
DerivedType *as() const {
UNRECOVERABLE_IF(DerivedType::driverInfoType != this->driverInfoType);
return static_cast<const DerivedType *>(this);
}
virtual std::string getDeviceName(std::string defaultName) { return defaultName; }
virtual std::string getVersion(std::string defaultVersion) { return defaultVersion; }
virtual bool getMediaSharingSupport() { return true; }
virtual bool getImageSupport() { return true; }
virtual PhysicalDevicePciBusInfo getPciBusInfo() { return pciBusInfo; }
protected:
DriverInfoType driverInfoType;
PhysicalDevicePciBusInfo pciBusInfo;
};

View File

@ -27,10 +27,10 @@ DriverInfo *DriverInfo::create(const HardwareInfo *hwInfo, const OSInterface *os
};
DriverInfoLinux::DriverInfoLinux(bool imageSupport, const PhysicalDevicePciBusInfo &pciBusInfo)
: imageSupport(imageSupport) {
: DriverInfo(DriverInfoType::LINUX), imageSupport(imageSupport) {
this->pciBusInfo = pciBusInfo;
}
bool DriverInfoLinux::getImageSupport() { return imageSupport; }
bool DriverInfoLinux::getMediaSharingSupport() { return imageSupport; }
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -13,8 +13,10 @@ namespace NEO {
class DriverInfoLinux : public DriverInfo {
public:
static constexpr DriverInfoType driverInfoType = DriverInfoType::LINUX;
DriverInfoLinux(bool imageSupport, const PhysicalDevicePciBusInfo &pciBusInfo);
bool getImageSupport() override;
bool getMediaSharingSupport() override;
protected:
bool imageSupport = true;

View File

@ -15,6 +15,7 @@ set(NEO_CORE_OS_INTERFACE_WINDOWS
${CMAKE_CURRENT_SOURCE_DIR}/debug_registry_reader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/debug_registry_reader.h
${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream.inl
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}driver_info_windows_impl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/driver_info_windows.cpp
${CMAKE_CURRENT_SOURCE_DIR}/driver_info_windows.h
${CMAKE_CURRENT_SOURCE_DIR}/environment_variables.h
@ -83,6 +84,7 @@ set(NEO_CORE_OS_INTERFACE_WDDM
${CMAKE_CURRENT_SOURCE_DIR}/wddm/adapter_factory.h
${CMAKE_CURRENT_SOURCE_DIR}/wddm/adapter_factory_dxcore.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm/adapter_factory_dxcore.h
${CMAKE_CURRENT_SOURCE_DIR}/wddm${BRANCH_DIR_SUFFIX}wddm_additional_adapter_info_options.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm/configure_device_address_space_${DRIVER_MODEL}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm/set_gmm_input_args_${DRIVER_MODEL}.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wddm/max_mem_alloc_size_${DRIVER_MODEL}.cpp

View File

@ -33,20 +33,8 @@ std::string getCurrentLibraryPath() {
}
namespace NEO {
DriverInfo *DriverInfo::create(const HardwareInfo *hwInfo, const OSInterface *osInterface) {
if (osInterface == nullptr) {
return nullptr;
}
auto wddm = osInterface->getDriverModel()->as<Wddm>();
UNRECOVERABLE_IF(wddm == nullptr);
return new DriverInfoWindows(wddm->getDeviceRegistryPath(), wddm->getPciBusInfo());
};
DriverInfoWindows::DriverInfoWindows(const std::string &fullPath, const PhysicalDevicePciBusInfo &pciBusInfo)
: path(DriverInfoWindows::trimRegistryKey(fullPath)), registryReader(createRegistryReaderFunc(path)) {
: DriverInfo(DriverInfoType::WINDOWS), path(DriverInfoWindows::trimRegistryKey(fullPath)), registryReader(createRegistryReaderFunc(path)) {
this->pciBusInfo = pciBusInfo;
}
@ -93,11 +81,11 @@ bool isCompatibleDriverStore(std::string &&deviceRegistryPath) {
return driverInfo.isCompatibleDriverStore();
}
bool DriverInfoWindows::containsSetting(const char *setting) {
return registryReader->getSetting(setting, std::string("")) != "<>";
}
decltype(DriverInfoWindows::createRegistryReaderFunc) DriverInfoWindows::createRegistryReaderFunc = [](const std::string &registryPath) -> std::unique_ptr<SettingsReader> {
return std::make_unique<RegistryReader>(false, registryPath);
};
bool DriverInfoWindows::getMediaSharingSupport() {
return registryReader->getSetting(is64bit ? "UserModeDriverName" : "UserModeDriverNameWOW", std::string("")) != "<>";
}
} // namespace NEO

View File

@ -21,12 +21,14 @@ bool isCompatibleDriverStore(std::string &&deviceRegistryPath);
class DriverInfoWindows : public DriverInfo {
public:
static constexpr DriverInfoType driverInfoType = DriverInfoType::WINDOWS;
DriverInfoWindows(const std::string &path, const PhysicalDevicePciBusInfo &pciBusInfo);
~DriverInfoWindows() override;
std::string getDeviceName(std::string defaultName) override;
std::string getVersion(std::string defaultVersion) override;
bool isCompatibleDriverStore() const;
bool getMediaSharingSupport() override;
MOCKABLE_VIRTUAL bool containsSetting(const char *setting);
static std::function<std::unique_ptr<SettingsReader>(const std::string &registryPath)> createRegistryReaderFunc;
protected:

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/windows/driver_info_windows.h"
#include "shared/source/os_interface/windows/wddm/wddm.h"
namespace NEO {
DriverInfo *DriverInfo::create(const HardwareInfo *hwInfo, const OSInterface *osInterface) {
if (osInterface == nullptr) {
return nullptr;
}
auto wddm = osInterface->getDriverModel()->as<Wddm>();
UNRECOVERABLE_IF(wddm == nullptr);
return new DriverInfoWindows(wddm->getDeviceRegistryPath(), wddm->getPciBusInfo());
};
} // namespace NEO

View File

@ -188,6 +188,8 @@ bool Wddm::queryAdapterInfo() {
maxRenderFrequency = adapterInfo.MaxRenderFreq;
timestampFrequency = adapterInfo.GfxTimeStampFreq;
instrumentationEnabled = adapterInfo.Caps.InstrumentationIsEnabled != 0;
populateAdditionalAdapterInfoOptions(adapterInfo);
}
return status == STATUS_SUCCESS;

View File

@ -207,6 +207,10 @@ class Wddm : public DriverModel {
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override;
uint32_t getAdditionalAdapterInfoOptions() const {
return additionalAdapterInfoOptions;
}
protected:
Wddm(std::unique_ptr<HwDeviceIdWddm> &&hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment);
MOCKABLE_VIRTUAL bool waitOnGPU(D3DKMT_HANDLE context);
@ -224,6 +228,7 @@ class Wddm : public DriverModel {
return evictNeeded;
}
void setPlatformSupportEvictWhenNecessaryFlag(const HwInfoConfig &hwInfoConfig);
void populateAdditionalAdapterInfoOptions(const ADAPTER_INFO_KMD &adapterInfo);
GMM_GFX_PARTITIONING gfxPartition{};
ADAPTER_BDF adapterBDF{};
@ -265,6 +270,7 @@ class Wddm : public DriverModel {
uint32_t maxRenderFrequency = 0;
uint32_t timestampFrequency = 0u;
uint32_t additionalAdapterInfoOptions = 0u;
unsigned int enablePreemptionRegValue = 1;

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/windows/wddm/wddm.h"
namespace NEO {
void Wddm::populateAdditionalAdapterInfoOptions(const ADAPTER_INFO_KMD &adapterInfo) {
}
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -13,7 +13,7 @@ namespace NEO {
class DriverInfoMock : public DriverInfo {
public:
DriverInfoMock(){};
DriverInfoMock() : DriverInfo(DriverInfoType::WINDOWS){};
std::string getDeviceName(std::string defaultName) override { return deviceName; };
std::string getVersion(std::string defaultVersion) override { return version; };
@ -28,6 +28,10 @@ class DriverInfoMock : public DriverInfo {
pciBusInfo.pciFunction = info.pciFunction;
}
bool getMediaSharingSupport() override {
return false;
}
private:
std::string deviceName;
std::string version;

View File

@ -28,6 +28,7 @@ constexpr auto virtualAllocAddress = is64bit ? 0x7FFFF0000000 : 0xFF000000;
class WddmMock : public Wddm {
public:
using Wddm::adapterBDF;
using Wddm::additionalAdapterInfoOptions;
using Wddm::adjustEvictNeededParameter;
using Wddm::createPagingFenceLogger;
using Wddm::currentPagingFenceValue;
@ -44,6 +45,7 @@ class WddmMock : public Wddm {
using Wddm::pagingFenceAddress;
using Wddm::pagingQueue;
using Wddm::platformSupportsEvictWhenNecessary;
using Wddm::populateAdditionalAdapterInfoOptions;
using Wddm::residencyLogger;
using Wddm::rootDeviceEnvironment;
using Wddm::setPlatformSupportEvictWhenNecessaryFlag;
@ -102,7 +104,7 @@ class WddmMock : public Wddm {
bool configureDeviceAddressSpace() {
configureDeviceAddressSpaceResult.called++;
//create context cant be called before configureDeviceAddressSpace
// create context cant be called before configureDeviceAddressSpace
if (createContextResult.called > 0) {
return configureDeviceAddressSpaceResult.success = false;
} else {

View File

@ -43,13 +43,6 @@ TEST(DriverInfo, GivenDriverInfoWhenLinuxThenReturnDefault) {
EXPECT_STREQ(defaultVersion.c_str(), resultVersion.c_str());
}
TEST(DriverInfo, givenGetMediaSharingSupportWhenLinuxThenReturnTrue) {
auto hwInfo = *defaultHwInfo;
std::unique_ptr<DriverInfo> driverInfo(DriverInfo::create(&hwInfo, nullptr));
EXPECT_TRUE(driverInfo->getMediaSharingSupport());
}
TEST(DriverInfo, givenGetImageSupportWhenHwInfoSupportsImagesThenReturnTrueOtherwiseFalse) {
auto hwInfo = *defaultHwInfo;
@ -57,7 +50,7 @@ TEST(DriverInfo, givenGetImageSupportWhenHwInfoSupportsImagesThenReturnTrueOther
hwInfo.capabilityTable.supportsImages = supportsImages;
std::unique_ptr<DriverInfo> driverInfo(DriverInfo::create(&hwInfo, nullptr));
EXPECT_EQ(supportsImages, driverInfo->getImageSupport());
EXPECT_EQ(supportsImages, driverInfo->getMediaSharingSupport());
}
}
} // namespace NEO

View File

@ -149,6 +149,11 @@ TEST_F(WddmTests, GivenPlatformSupportsEvictWhenNecessaryWhenAdjustingEvictNeede
EXPECT_TRUE(value);
}
TEST_F(WddmTests, GivenWddmWhenAdditionalAdapterInfoOptionIsSetThenCorrectValueIsReturned) {
wddm->additionalAdapterInfoOptions = 13u;
EXPECT_EQ(13u, wddm->getAdditionalAdapterInfoOptions());
}
TEST_F(WddmTests, GivenPlatformNotSupportEvictWhenNecessaryWhenAdjustingEvictNeededTrueThenExpectTrue) {
wddm->platformSupportsEvictWhenNecessary = false;
bool value = wddm->adjustEvictNeededParameter(true);