Reposition members of wddm classes

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz 2022-07-27 01:00:20 +00:00 committed by Compute-Runtime-Automation
parent c52a200087
commit f17b46bc22
8 changed files with 64 additions and 49 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -26,9 +26,11 @@ class RegistryReader : public SettingsReader {
const char *appSpecificLocation(const std::string &name) override;
protected:
HKEY hkeyType;
std::string registryReadRootKey;
void setUpProcessName();
std::string registryReadRootKey;
std::string processName;
HKEY hkeyType;
};
} // namespace NEO

View File

@ -80,7 +80,7 @@ class Gdi {
protected:
MOCKABLE_VIRTUAL bool getAllProcAddresses();
bool initialized = false;
std::unique_ptr<NEO::OsLibrary> gdiDll;
bool initialized = false;
};
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -36,9 +36,9 @@ class HwDeviceIdWddm : public HwDeviceId {
}
protected:
const D3DKMT_HANDLE adapter;
const LUID adapterLuid;
OsEnvironment *osEnvironment;
std::unique_ptr<UmKmDataTranslator> umKmDataTranslator;
OsEnvironment *osEnvironment;
const D3DKMT_HANDLE adapter;
};
} // namespace NEO

View File

@ -21,8 +21,10 @@ HwDeviceIdWddm::~HwDeviceIdWddm() {
HwDeviceIdWddm::HwDeviceIdWddm(D3DKMT_HANDLE adapterIn, LUID adapterLuidIn,
OsEnvironment *osEnvironmentIn, std::unique_ptr<UmKmDataTranslator> umKmDataTranslator)
: HwDeviceId(DriverModelType::WDDM),
adapter(adapterIn), adapterLuid(adapterLuidIn), osEnvironment(osEnvironmentIn),
umKmDataTranslator(std::move(umKmDataTranslator)) {}
adapterLuid(adapterLuidIn), umKmDataTranslator(std::move(umKmDataTranslator)),
osEnvironment(osEnvironmentIn), adapter(adapterIn) {
}
Gdi *HwDeviceIdWddm::getGdi() const {
return static_cast<OsEnvironmentWin *>(osEnvironment)->gdi.get();
};

View File

@ -24,8 +24,9 @@ OsContext *OsContextWin::create(OSInterface *osInterface, uint32_t contextId, co
OsContextWin::OsContextWin(Wddm &wddm, uint32_t contextId, const EngineDescriptor &engineDescriptor)
: OsContext(contextId, engineDescriptor),
wddm(wddm),
residencyController(wddm, contextId) {}
residencyController(wddm, contextId),
wddm(wddm) {
}
void OsContextWin::initializeContext() {

View File

@ -40,10 +40,10 @@ class OsContextWin : public OsContext {
protected:
void initializeContext() override;
D3DKMT_HANDLE wddmContextHandle = 0;
WddmResidencyController residencyController;
HardwareQueue hardwareQueue;
Wddm &wddm;
WddmResidencyController residencyController;
D3DKMT_HANDLE wddmContextHandle = 0;
bool debuggableContext = false;
};
} // namespace NEO

View File

@ -208,35 +208,6 @@ class Wddm : public DriverModel {
PhyicalDevicePciSpeedInfo getPciSpeedInfo() const override;
protected:
std::unique_ptr<HwDeviceIdWddm> hwDeviceId;
D3DKMT_HANDLE device = 0;
D3DKMT_HANDLE pagingQueue = 0;
D3DKMT_HANDLE pagingQueueSyncObject = 0;
uint64_t *pagingFenceAddress = nullptr;
std::atomic<std::uint64_t> currentPagingFenceValue{0};
// Adapter information
std::unique_ptr<PLATFORM> gfxPlatform;
std::unique_ptr<GT_SYSTEM_INFO> gtSystemInfo;
std::unique_ptr<FeatureTable> featureTable;
std::unique_ptr<WorkaroundTable> workaroundTable;
GMM_GFX_PARTITIONING gfxPartition{};
ADAPTER_BDF adapterBDF{};
uint64_t systemSharedMemory = 0;
uint64_t dedicatedVideoMemory = 0;
uint32_t maxRenderFrequency = 0;
uint32_t timestampFrequency = 0u;
bool instrumentationEnabled = false;
std::string deviceRegistryPath;
RootDeviceEnvironment &rootDeviceEnvironment;
unsigned int enablePreemptionRegValue = 1;
unsigned long hwContextId = 0;
uintptr_t maximumApplicationAddress = 0;
std::unique_ptr<GmmMemory> gmmMemory;
uintptr_t minAddress = 0;
Wddm(std::unique_ptr<HwDeviceIdWddm> &&hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment);
MOCKABLE_VIRTUAL bool waitOnGPU(D3DKMT_HANDLE context);
bool createDevice(PreemptionMode preemptionMode);
@ -254,14 +225,50 @@ class Wddm : public DriverModel {
}
void setPlatformSupportEvictWhenNecessaryFlag(const HwInfoConfig &hwInfoConfig);
static GetSystemInfoFcn getSystemInfo;
GMM_GFX_PARTITIONING gfxPartition{};
ADAPTER_BDF adapterBDF{};
std::string deviceRegistryPath;
std::atomic<std::uint64_t> currentPagingFenceValue{0};
uint64_t systemSharedMemory = 0;
uint64_t dedicatedVideoMemory = 0;
// Adapter information
std::unique_ptr<PLATFORM> gfxPlatform;
std::unique_ptr<GT_SYSTEM_INFO> gtSystemInfo;
std::unique_ptr<FeatureTable> featureTable;
std::unique_ptr<WorkaroundTable> workaroundTable;
std::unique_ptr<HwDeviceIdWddm> hwDeviceId;
std::unique_ptr<GmmMemory> gmmMemory;
std::unique_ptr<KmDafListener> kmDafListener;
std::unique_ptr<WddmInterface> wddmInterface;
std::unique_ptr<WddmResidentAllocationsContainer> temporaryResources;
std::unique_ptr<WddmResidencyLogger> residencyLogger;
std::unique_ptr<OSMemory> osMemory;
static GetSystemInfoFcn getSystemInfo;
RootDeviceEnvironment &rootDeviceEnvironment;
uint64_t *pagingFenceAddress = nullptr;
uintptr_t maximumApplicationAddress = 0;
uintptr_t minAddress = 0;
unsigned long hwContextId = 0;
D3DKMT_HANDLE device = 0;
D3DKMT_HANDLE pagingQueue = 0;
D3DKMT_HANDLE pagingQueueSyncObject = 0;
uint32_t maxRenderFrequency = 0;
uint32_t timestampFrequency = 0u;
unsigned int enablePreemptionRegValue = 1;
bool platformSupportsEvictWhenNecessary = false;
bool instrumentationEnabled = false;
};
} // namespace NEO

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -66,18 +66,21 @@ class WddmResidencyController {
bool isInitialized() const;
protected:
Wddm &wddm;
uint32_t osContextId;
MonitoredFence monitoredFence = {};
ResidencyContainer trimCandidateList;
SpinLock lock;
SpinLock trimCallbackLock;
bool memoryBudgetExhausted = false;
uint64_t lastTrimFenceValue = 0u;
ResidencyContainer trimCandidateList;
Wddm &wddm;
VOID *trimCallbackHandle = nullptr;
uint32_t osContextId;
uint32_t trimCandidatesCount = 0;
VOID *trimCallbackHandle = nullptr;
bool memoryBudgetExhausted = false;
};
} // namespace NEO