mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +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
9743e37fde
commit
aafbbf54db
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -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() {
|
||||
@@ -169,9 +169,13 @@ void D3DSharingBuilderFactory<D3DTypesHelper::D3D9>::setExtensionEnabled(DriverI
|
||||
extensionEnabled = driverInfo->getMediaSharingSupport();
|
||||
}
|
||||
|
||||
void D3DSharingBuilderFactory<D3DTypesHelper::D3D10>::setExtensionEnabled(DriverInfo *driverInfo) {}
|
||||
void D3DSharingBuilderFactory<D3DTypesHelper::D3D10>::setExtensionEnabled(DriverInfo *driverInfo) {
|
||||
extensionEnabled = driverInfo->getMediaSharingSupport();
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,18 +33,6 @@ 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)) {
|
||||
this->pciBusInfo = pciBusInfo;
|
||||
|
||||
@@ -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() {
|
||||
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
|
||||
@@ -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 {
|
||||
|
||||
@@ -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