Add getter to query Wddm version

Related-To: NEO-3639

Change-Id: If066f954827982dcc388f3f0ea241dbc98e824ea
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2019-12-17 14:29:28 +01:00
committed by sys_ocldev
parent 73697b7ab4
commit 2b0db66c52
5 changed files with 28 additions and 3 deletions

View File

@@ -122,7 +122,7 @@ bool Wddm::init(HardwareInfo &outHardwareInfo) {
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(outHardwareInfo);
if (featureTable->ftrWddmHwQueues) {
if (WddmVersion::WDDM_2_3 == getWddmVersion()) {
wddmInterface = std::make_unique<WddmInterface23>(*this);
} else {
wddmInterface = std::make_unique<WddmInterface20>(*this);
@@ -981,4 +981,12 @@ void Wddm::updatePagingFenceValue(uint64_t newPagingFenceValue) {
interlockedMax(currentPagingFenceValue, newPagingFenceValue);
}
WddmVersion Wddm::getWddmVersion() {
if (featureTable->ftrWddmHwQueues) {
return WddmVersion::WDDM_2_3;
} else {
return WddmVersion::WDDM_2_0;
}
}
} // namespace NEO

View File

@@ -44,6 +44,11 @@ struct WddmSubmitArguments {
D3DKMT_HANDLE hwQueueHandle;
};
enum class WddmVersion : uint32_t {
WDDM_2_0 = 0,
WDDM_2_3
};
class Wddm {
public:
typedef HRESULT(WINAPI *CreateDXGIFactoryFcn)(REFIID riid, void **ppFactory);
@@ -152,6 +157,8 @@ class Wddm {
void setGmmInputArg(void *args);
WddmVersion getWddmVersion();
protected:
std::unique_ptr<Gdi> gdi;
D3DKMT_HANDLE adapter = 0;

View File

@@ -1071,3 +1071,13 @@ TEST_F(Wddm20Tests, givenWddmWhenOpenAdapterAndForceDeviceIdIsDifferentFromTheEx
bool result = wddm.openAdapter();
EXPECT_FALSE(result);
}
TEST_F(WddmTest, WhenFeatureFlagHwQueueIsDisabledThenReturnWddm20Version) {
wddm->featureTable->ftrWddmHwQueues = 0;
EXPECT_EQ(WddmVersion::WDDM_2_0, wddm->getWddmVersion());
}
TEST_F(WddmTest, WhenFeatureFlagHwQueueIsEnabledThenReturnWddm23Version) {
wddm->featureTable->ftrWddmHwQueues = 1;
EXPECT_EQ(WddmVersion::WDDM_2_3, wddm->getWddmVersion());
}

View File

@@ -38,7 +38,7 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture {
void init() {
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
auto hwInfo = *platformDevices[0];
wddmMockInterface = reinterpret_cast<WddmMockInterface23 *>(wddm->wddmInterface.release());
wddmMockInterface = static_cast<WddmMockInterface23 *>(wddm->wddmInterface.release());
wddm->init(hwInfo);
wddm->wddmInterface.reset(wddmMockInterface);
osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);

View File

@@ -67,7 +67,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
void init() {
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
auto hwInfo = *platformDevices[0];
wddmMockInterface = reinterpret_cast<WddmMockInterface20 *>(wddm->wddmInterface.release());
wddmMockInterface = static_cast<WddmMockInterface20 *>(wddm->wddmInterface.release());
wddm->init(hwInfo);
wddm->wddmInterface.reset(wddmMockInterface);
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false);