mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Add member for handling additional adapterInfo fields
Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
d8cd596baf
commit
b39be32e20
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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 ®istryPath) -> std::unique_ptr<SettingsReader> {
|
||||
return std::make_unique<RegistryReader>(false, registryPath);
|
||||
};
|
||||
|
||||
bool DriverInfoWindows::getMediaSharingSupport() {
|
||||
return registryReader->getSetting(is64bit ? "UserModeDriverName" : "UserModeDriverNameWOW", std::string("")) != "<>";
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -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 ®istryPath)> createRegistryReaderFunc;
|
||||
|
||||
protected:
|
||||
|
@ -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
|
@ -188,6 +188,8 @@ bool Wddm::queryAdapterInfo() {
|
||||
maxRenderFrequency = adapterInfo.MaxRenderFreq;
|
||||
timestampFrequency = adapterInfo.GfxTimeStampFreq;
|
||||
instrumentationEnabled = adapterInfo.Caps.InstrumentationIsEnabled != 0;
|
||||
|
||||
populateAdditionalAdapterInfoOptions(adapterInfo);
|
||||
}
|
||||
|
||||
return status == STATUS_SUCCESS;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user