Windows: Use timestamp frequency from adapter info

Related-To: NEO-5435
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-02-01 18:37:13 +00:00
committed by Compute-Runtime-Automation
parent 0ca1cdc565
commit 2b0b2231a7
7 changed files with 21 additions and 9 deletions

View File

@@ -99,11 +99,9 @@ double OSTimeWin::getHostTimerResolution() const {
}
double OSTimeWin::getDynamicDeviceTimerResolution(HardwareInfo const &hwInfo) const {
double retVal = 0;
TimeStampDataHeader escapeInfo = {0};
if (runEscape(wddm, escapeInfo)) {
retVal = 1000000000.0 / (double)escapeInfo.m_Data.m_Out.gpuPerfFreq;
double retVal = 0u;
if (wddm) {
retVal = 1000000000.0 / static_cast<double>(wddm->getTimestampFrequency());
}
return retVal;

View File

@@ -150,6 +150,7 @@ bool Wddm::queryAdapterInfo() {
systemSharedMemory = adapterInfo.SystemSharedMemory;
dedicatedVideoMemory = adapterInfo.DedicatedVideoMemory;
maxRenderFrequency = adapterInfo.MaxRenderFreq;
timestampFrequency = adapterInfo.GfxTimeStampFreq;
instrumentationEnabled = adapterInfo.Caps.InstrumentationIsEnabled != 0;
}

View File

@@ -161,6 +161,8 @@ class Wddm {
const RootDeviceEnvironment &getRootDeviceEnvironment() const { return rootDeviceEnvironment; }
const uint32_t getTimestampFrequency() const { return timestampFrequency; }
protected:
std::unique_ptr<HwDeviceId> hwDeviceId;
D3DKMT_HANDLE device = 0;
@@ -180,6 +182,7 @@ class Wddm {
uint64_t systemSharedMemory = 0;
uint64_t dedicatedVideoMemory = 0;
uint32_t maxRenderFrequency = 0;
uint32_t timestampFrequency = 0u;
bool instrumentationEnabled = false;
std::string deviceRegistryPath;
RootDeviceEnvironment &rootDeviceEnvironment;

View File

@@ -291,6 +291,7 @@ NTSTATUS __stdcall D3DKMTQueryAdapterInfo(IN CONST D3DKMT_QUERYADAPTERINFO *quer
adapterInfo->GfxMemorySize = 2181038080;
adapterInfo->SystemSharedMemory = 4249540608;
adapterInfo->SystemVideoMemory = 0;
adapterInfo->GfxTimeStampFreq = 1;
adapterInfo->GfxPartition.Standard.Base = gAdapterInfo.GfxPartition.Standard.Base;
adapterInfo->GfxPartition.Standard.Limit = gAdapterInfo.GfxPartition.Standard.Limit;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2020 Intel Corporation
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -39,6 +39,12 @@ TEST_F(WddmTests, whenInitializingWddmThenSetMinAddressToCorrectValue) {
ASSERT_EQ(expectedMinAddress, wddm->getWddmMinAddress());
}
TEST_F(WddmTests, whenInitializingWddmThenSetTimestampFrequencyToCorrectValue) {
EXPECT_EQ(0u, wddm->timestampFrequency);
init();
EXPECT_EQ(1u, wddm->timestampFrequency);
}
TEST_F(WddmTests, givenWddmWhenPassesCorrectHandleToVerifySharedHandleThenReturnTrue) {
init();
D3DKMT_HANDLE handle = 1u;