From 3a369ad500449eae78ccdba17e174650c64bd795 Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Tue, 12 Jun 2018 09:42:47 +0200 Subject: [PATCH] Improve Wddm creation Pick interface version basing on Ftr flag Change-Id: I09880610922a6d451fc6f414a4fa5857449bc0f4 --- runtime/helpers/hw_info.cpp | 25 ++----- runtime/helpers/hw_info.h | 15 ++-- runtime/os_interface/DebugVariables.inl | 1 - runtime/os_interface/linux/device_factory.cpp | 1 - runtime/os_interface/linux/hw_info_config.cpp | 12 ++-- runtime/os_interface/windows/wddm/wddm.cpp | 68 +++++++++++-------- runtime/os_interface/windows/wddm/wddm.h | 12 ++-- .../os_interface/windows/wddm/wddm_create.cpp | 6 +- .../windows/wddm_device_command_stream.inl | 2 +- runtime/sku_info/sku_info_base.h | 23 ++++--- .../os_interface/hw_info_config_tests.cpp | 4 +- .../windows/device_command_stream_tests.cpp | 25 +++++++ .../os_interface/windows/wddm20_tests.cpp | 4 -- .../os_interface/windows/wddm_create.cpp | 2 +- unit_tests/test_files/igdrcl.config | 1 - unit_tests/windows/wddm_create_tests.cpp | 19 +++--- 16 files changed, 113 insertions(+), 107 deletions(-) diff --git a/runtime/helpers/hw_info.cpp b/runtime/helpers/hw_info.cpp index d6519a9bd0..947b985206 100644 --- a/runtime/helpers/hw_info.cpp +++ b/runtime/helpers/hw_info.cpp @@ -24,6 +24,10 @@ #include "hw_cmds.h" namespace OCLRT { +HardwareInfo::HardwareInfo(const PLATFORM *platform, const FeatureTable *skuTable, const WorkaroundTable *waTable, + const GT_SYSTEM_INFO *sysInfo, RuntimeCapabilityTable capabilityTable) + : pPlatform(platform), pSkuTable(skuTable), pWaTable(waTable), pSysInfo(sysInfo), capabilityTable(capabilityTable) { +} const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT] = {}; void (*hardwareInfoSetupGt[IGFX_MAX_PRODUCT])(GT_SYSTEM_INFO *) = { @@ -33,27 +37,6 @@ void (*hardwareInfoSetupGt[IGFX_MAX_PRODUCT])(GT_SYSTEM_INFO *) = { const FeatureTable emptySkuTable = {}; const WorkaroundTable emptyWaTable = {}; -const PLATFORM unknownPlatform = { - IGFX_UNKNOWN, - PCH_UNKNOWN, - IGFX_UNKNOWN_CORE, - IGFX_UNKNOWN_CORE, - PLATFORM_NONE, // default init - 0, // usDeviceID - 0, // usRevId. 0 sets the stepping to A0 - 0, // usDeviceID_PCH - 0, // usRevId_PCH - GTTYPE_UNDEFINED}; - -const GT_SYSTEM_INFO unknownSysInfo = {}; - -const HardwareInfo unknownHardware = { - &unknownPlatform, - &emptySkuTable, - &emptyWaTable, - &unknownSysInfo, - {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, PreemptionMode::Disabled, {false, false}, nullptr}}; - const char *getPlatformType(const HardwareInfo &hwInfo) { if (hwInfo.capabilityTable.isCore) { return "core"; diff --git a/runtime/helpers/hw_info.h b/runtime/helpers/hw_info.h index 215910792f..1ab35c5122 100644 --- a/runtime/helpers/hw_info.h +++ b/runtime/helpers/hw_info.h @@ -84,17 +84,20 @@ struct HardwareCapabilities { }; struct HardwareInfo { - const PLATFORM *pPlatform; - const FeatureTable *pSkuTable; - const WorkaroundTable *pWaTable; - const GT_SYSTEM_INFO *pSysInfo; + HardwareInfo() = default; + HardwareInfo(const PLATFORM *platform, const FeatureTable *skuTable, const WorkaroundTable *waTable, + const GT_SYSTEM_INFO *sysInfo, RuntimeCapabilityTable capabilityTable); - RuntimeCapabilityTable capabilityTable; + const PLATFORM *pPlatform = nullptr; + const FeatureTable *pSkuTable = nullptr; + const WorkaroundTable *pWaTable = nullptr; + const GT_SYSTEM_INFO *pSysInfo = nullptr; + + RuntimeCapabilityTable capabilityTable = {}; }; extern const WorkaroundTable emptyWaTable; extern const FeatureTable emptySkuTable; -extern const HardwareInfo unknownHardware; template struct HwMapper {}; diff --git a/runtime/os_interface/DebugVariables.inl b/runtime/os_interface/DebugVariables.inl index 193286a22e..4b863d927a 100644 --- a/runtime/os_interface/DebugVariables.inl +++ b/runtime/os_interface/DebugVariables.inl @@ -92,7 +92,6 @@ DECLARE_DEBUG_VARIABLE(int32_t, ForceOCLVersion, 0, "Force specific OpenCL API v DECLARE_DEBUG_VARIABLE(int32_t, ForcePreemptionMode, -1, "Keep this variable in sync with PreemptionMode enum. -1 - devices default mode, 1 - disable, 2 - midBatch, 3 - threadGroup, 4 - midThread") DECLARE_DEBUG_VARIABLE(int32_t, NodeOrdinal, -1, "-1: default do not override, 0: ENGINE_RCS") DECLARE_DEBUG_VARIABLE(int32_t, OverrideThreadArbitrationPolicy, -1, "-1 (dont override) or any valid config (0: Age Based, 1: Round Robin)") -DECLARE_DEBUG_VARIABLE(bool, HwQueueSupported, false, "Windows only. Pass flag to KMD during Wddm Context creation") DECLARE_DEBUG_VARIABLE(bool, UseMaxSimdSizeToDeduceMaxWorkgroupSize, false, "With this flag on, max workgroup size is deduced using SIMD32 instead of SIMD8, this causes the max wkg size to be 4 times bigger") DECLARE_DEBUG_VARIABLE(int32_t, OverrideAubDeviceId, -1, "-1 dont override, any other: use this value for AUB generation device id") DECLARE_DEBUG_VARIABLE(std::string, ForceCompilerUsePlatform, std::string("unk"), "Specify product for use in compiler interface") \ No newline at end of file diff --git a/runtime/os_interface/linux/device_factory.cpp b/runtime/os_interface/linux/device_factory.cpp index 504720b08e..483854864a 100644 --- a/runtime/os_interface/linux/device_factory.cpp +++ b/runtime/os_interface/linux/device_factory.cpp @@ -48,7 +48,6 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) { const HardwareInfo *pCurrDevice = platformDevices[devNum]; HardwareInfo tmpHwInfo; - memset(&tmpHwInfo, 0, sizeof(tmpHwInfo)); osInterface.get()->get()->setDrm(drm); diff --git a/runtime/os_interface/linux/hw_info_config.cpp b/runtime/os_interface/linux/hw_info_config.cpp index 7961f506b4..31a359ffb7 100644 --- a/runtime/os_interface/linux/hw_info_config.cpp +++ b/runtime/os_interface/linux/hw_info_config.cpp @@ -102,13 +102,13 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou int val = 0; ret = drm->getDeviceID(val); if (ret != 0 || val == 0) { - memset(outHwInfo, 0, sizeof(HardwareInfo)); + *outHwInfo = {}; return (ret == 0) ? -1 : ret; } pPlatform->usDeviceID = static_cast(val); ret = drm->getDeviceRevID(val); if (ret != 0) { - memset(outHwInfo, 0, sizeof(HardwareInfo)); + *outHwInfo = {}; return ret; } pPlatform->usRevId = static_cast(val); @@ -116,7 +116,7 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou int euCount; ret = drm->getEuTotal(euCount); if (ret != 0) { - memset(outHwInfo, 0, sizeof(HardwareInfo)); + *outHwInfo = {}; return ret; } pSysInfo->EUCount = static_cast(euCount); @@ -126,7 +126,7 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou int subSliceCount; ret = drm->getSubsliceTotal(subSliceCount); if (ret != 0) { - memset(outHwInfo, 0, sizeof(HardwareInfo)); + *outHwInfo = {}; return ret; } pSysInfo->SubSliceCount = static_cast(subSliceCount); @@ -138,7 +138,7 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou GTTYPE gtType = drm->getGtType(); if (gtType == GTTYPE_UNDEFINED) { - memset(outHwInfo, 0, sizeof(HardwareInfo)); + *outHwInfo = {}; return -1; } pPlatform->eGTType = gtType; @@ -154,7 +154,7 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou ret = configureHardwareCustom(outHwInfo, osIface); if (ret != 0) { - memset(outHwInfo, 0, sizeof(HardwareInfo)); + *outHwInfo = {}; return ret; } configureCacheInfo(outHwInfo); diff --git a/runtime/os_interface/windows/wddm/wddm.cpp b/runtime/os_interface/windows/wddm/wddm.cpp index 1548e131ea..9b836e5ac4 100644 --- a/runtime/os_interface/windows/wddm/wddm.cpp +++ b/runtime/os_interface/windows/wddm/wddm.cpp @@ -93,41 +93,41 @@ Wddm::~Wddm() { } bool Wddm::enumAdapters(unsigned int devNum, HardwareInfo &outHardwareInfo) { - bool success = false; - if (devNum > 0) + if (devNum > 0) { return false; - - std::unique_ptr wddm(createWddm(WddmInterfaceVersion::Wddm20)); - DEBUG_BREAK_IF(wddm == nullptr); - - if (wddm->gdi->isInitialized()) { - do { - success = wddm->openAdapter(); - if (!success) - break; - success = wddm->queryAdapterInfo(); - if (!success) - break; - } while (!success); } - if (success) { - auto productFamily = wddm->gfxPlatform->eProductFamily; - if (hardwareInfoTable[productFamily] == nullptr) - return false; - outHardwareInfo.pPlatform = new PLATFORM(*wddm->gfxPlatform); - outHardwareInfo.pSkuTable = new FeatureTable(*wddm->featureTable); - outHardwareInfo.pWaTable = new WorkaroundTable(*wddm->waTable); - outHardwareInfo.pSysInfo = new GT_SYSTEM_INFO(*wddm->gtSystemInfo); + std::unique_ptr wddm(createWddm(Wddm::pickWddmInterfaceVersion(outHardwareInfo))); + UNRECOVERABLE_IF(!wddm.get()); - outHardwareInfo.capabilityTable = hardwareInfoTable[productFamily]->capabilityTable; - outHardwareInfo.capabilityTable.maxRenderFrequency = wddm->maxRenderFrequency; - outHardwareInfo.capabilityTable.instrumentationEnabled &= wddm->instrumentationEnabled; - - HwInfoConfig *hwConfig = HwInfoConfig::get(productFamily); - hwConfig->adjustPlatformForProductFamily(&outHardwareInfo); + if (!wddm->gdi->isInitialized()) { + return false; } - return success; + if (!wddm->openAdapter()) { + return false; + } + if (!wddm->queryAdapterInfo()) { + return false; + } + + auto productFamily = wddm->gfxPlatform->eProductFamily; + if (!hardwareInfoTable[productFamily]) { + return false; + } + + outHardwareInfo.pPlatform = new PLATFORM(*wddm->gfxPlatform); + outHardwareInfo.pSkuTable = new FeatureTable(*wddm->featureTable); + outHardwareInfo.pWaTable = new WorkaroundTable(*wddm->waTable); + outHardwareInfo.pSysInfo = new GT_SYSTEM_INFO(*wddm->gtSystemInfo); + + outHardwareInfo.capabilityTable = hardwareInfoTable[productFamily]->capabilityTable; + outHardwareInfo.capabilityTable.maxRenderFrequency = wddm->maxRenderFrequency; + outHardwareInfo.capabilityTable.instrumentationEnabled &= wddm->instrumentationEnabled; + + HwInfoConfig *hwConfig = HwInfoConfig::get(productFamily); + hwConfig->adjustPlatformForProductFamily(&outHardwareInfo); + + return true; } bool Wddm::queryAdapterInfo() { @@ -960,4 +960,12 @@ void Wddm::resetMonitoredFenceParams(D3DKMT_HANDLE &handle, uint64_t *cpuAddress monitoredFence.gpuAddress = gpuAddress; } +WddmInterfaceVersion Wddm::pickWddmInterfaceVersion(const HardwareInfo &hwInfo) { + if (hwInfo.pSkuTable && hwInfo.pSkuTable->ftrWddmHwQueues) { + return WddmInterfaceVersion::Wddm23; + } + // Use default version when hwInfo is not yet populated (eg. during enumAdapter call) + return WddmInterfaceVersion::Wddm20; +} + } // namespace OCLRT diff --git a/runtime/os_interface/windows/wddm/wddm.h b/runtime/os_interface/windows/wddm/wddm.h index 1f79a095b7..d0b2e63fd4 100644 --- a/runtime/os_interface/windows/wddm/wddm.h +++ b/runtime/os_interface/windows/wddm/wddm.h @@ -49,10 +49,10 @@ struct FeatureTable; struct WorkaroundTable; struct KmDafListener; -namespace WddmInterfaceVersion { -constexpr uint32_t Wddm20 = 20; -constexpr uint32_t Wddm23 = 23; -} // namespace WddmInterfaceVersion +enum class WddmInterfaceVersion { + Wddm20 = 20, + Wddm23 = 23, +}; class Wddm { public: @@ -63,8 +63,8 @@ class Wddm { virtual ~Wddm(); - static Wddm *createWddm(uint32_t interfaceVersion); - + static Wddm *createWddm(WddmInterfaceVersion interfaceVersion); + static WddmInterfaceVersion pickWddmInterfaceVersion(const HardwareInfo &hwInfo); static bool enumAdapters(unsigned int devNum, HardwareInfo &outHardwareInfo); MOCKABLE_VIRTUAL bool evict(D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_t &sizeToTrim); diff --git a/runtime/os_interface/windows/wddm/wddm_create.cpp b/runtime/os_interface/windows/wddm/wddm_create.cpp index eb93d62a50..92e6503200 100644 --- a/runtime/os_interface/windows/wddm/wddm_create.cpp +++ b/runtime/os_interface/windows/wddm/wddm_create.cpp @@ -25,11 +25,7 @@ #include "runtime/os_interface/windows/wddm/wddm23.h" namespace OCLRT { -Wddm *Wddm::createWddm(uint32_t interfaceVersion) { - if (DebugManager.flags.HwQueueSupported.get()) { - interfaceVersion = WddmInterfaceVersion::Wddm23; - } - +Wddm *Wddm::createWddm(WddmInterfaceVersion interfaceVersion) { switch (interfaceVersion) { case WddmInterfaceVersion::Wddm20: return new Wddm20(); diff --git a/runtime/os_interface/windows/wddm_device_command_stream.inl b/runtime/os_interface/windows/wddm_device_command_stream.inl index 2ea3aa5170..1ca52f9241 100644 --- a/runtime/os_interface/windows/wddm_device_command_stream.inl +++ b/runtime/os_interface/windows/wddm_device_command_stream.inl @@ -52,7 +52,7 @@ WddmCommandStreamReceiver::WddmCommandStreamReceiver(const HardwareIn : BaseClass(hwInfoIn) { this->wddm = wddm; if (this->wddm == nullptr) { - this->wddm = Wddm::createWddm(WddmInterfaceVersion::Wddm20); + this->wddm = Wddm::createWddm(Wddm::pickWddmInterfaceVersion(hwInfoIn)); } GPUNODE_ORDINAL nodeOrdinal = GPUNODE_3D; UNRECOVERABLE_IF(!WddmEngineMapper::engineNodeMap(hwInfoIn.capabilityTable.defaultEngineType, nodeOrdinal)); diff --git a/runtime/sku_info/sku_info_base.h b/runtime/sku_info/sku_info_base.h index af0b1b3634..fcc07f4d78 100644 --- a/runtime/sku_info/sku_info_base.h +++ b/runtime/sku_info/sku_info_base.h @@ -86,14 +86,15 @@ struct FeatureTableBase { bool ftrAstcHdr2D = false; bool ftrAstcLdr2D = false; - bool ftrStandardMipTailFormat = false; // Gmmlib - bool ftrFrameBufferLLC = false; // Gmmlib - bool ftrCrystalwell = false; // Gmmlib - bool ftrLLCBypass = false; // Gmmlib - bool ftrDisplayEngineS3d = false; // Gmmlib - bool ftrVERing = false; // Gmmlib - bool ftrWddm2GpuMmu = false; // Gmmlib - bool ftrWddm2_1_64kbPages = false; // Gmmlib + bool ftrStandardMipTailFormat = false; + bool ftrFrameBufferLLC = false; + bool ftrCrystalwell = false; + bool ftrLLCBypass = false; + bool ftrDisplayEngineS3d = false; + bool ftrVERing = false; + bool ftrWddm2GpuMmu = false; + bool ftrWddm2_1_64kbPages = false; + bool ftrWddmHwQueues = false; bool ftrKmdDaf = false; }; @@ -107,10 +108,10 @@ struct WorkaroundTableBase { bool waDisableLSQCROPERFforOCL = false; bool waMsaa8xTileYDepthPitchAlignment = false; bool waLosslessCompressionSurfaceStride = false; - bool waFbcLinearSurfaceStride = false; // Gmmlib + bool waFbcLinearSurfaceStride = false; bool wa4kAlignUVOffsetNV12LinearSurface = false; - bool waEncryptedEdramOnlyPartials = false; // Gmmlib - bool waDisableEdramForDisplayRT = false; // Gmmlib + bool waEncryptedEdramOnlyPartials = false; + bool waDisableEdramForDisplayRT = false; bool waForcePcBbFullCfgRestore = false; bool waCompressedResourceRequiresConstVA21 = false; bool waDisablePerCtxtPreemptionGranularityControl = false; diff --git a/unit_tests/os_interface/hw_info_config_tests.cpp b/unit_tests/os_interface/hw_info_config_tests.cpp index efa6c8923d..5d665e6906 100644 --- a/unit_tests/os_interface/hw_info_config_tests.cpp +++ b/unit_tests/os_interface/hw_info_config_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 2018, Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -52,7 +52,7 @@ void HwInfoConfigTest::SetUp() { memcpy(&testSysInfo, pOldSysInfo, sizeof(testSysInfo)); pInHwInfo->pSysInfo = &testSysInfo; - memset(&outHwInfo, 0, sizeof(outHwInfo)); + outHwInfo = {}; } void HwInfoConfigTest::TearDown() { diff --git a/unit_tests/os_interface/windows/device_command_stream_tests.cpp b/unit_tests/os_interface/windows/device_command_stream_tests.cpp index 4e8797b134..07912d95d2 100644 --- a/unit_tests/os_interface/windows/device_command_stream_tests.cpp +++ b/unit_tests/os_interface/windows/device_command_stream_tests.cpp @@ -43,6 +43,7 @@ #include "unit_tests/mocks/mock_program.h" #include "unit_tests/mocks/mock_submissions_aggregator.h" #include "unit_tests/mocks/mock_gmm_page_table_mngr.h" +#include "unit_tests/mocks/mock_wddm23.h" #include "unit_tests/os_interface/windows/mock_wddm_memory_manager.h" #include "unit_tests/os_interface/windows/wddm_fixture.h" #include "unit_tests/os_interface/windows/mock_gdi_interface.h" @@ -759,6 +760,30 @@ HWTEST_F(WddmDefaultTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurned EXPECT_EQ(DispatchMode::BatchedDispatch, mockCsr->dispatchMode); } +HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVersionBasingOnFtrFlag) { + HardwareInfo myHwInfo = *platformDevices[0]; + FeatureTable myFtrTable = *myHwInfo.pSkuTable; + myHwInfo.pSkuTable = &myFtrTable; + + myFtrTable.ftrWddmHwQueues = false; + EXPECT_TRUE(WddmInterfaceVersion::Wddm20 == Wddm::pickWddmInterfaceVersion(myHwInfo)); + { + WddmCommandStreamReceiver wddmCsr20(myHwInfo, nullptr); + auto wddm20 = wddmCsr20.peekWddm(); + EXPECT_EQ(typeid(*wddm20), typeid(WddmMock20)); + delete wddm20; + } + + myFtrTable.ftrWddmHwQueues = true; + EXPECT_TRUE(WddmInterfaceVersion::Wddm23 == Wddm::pickWddmInterfaceVersion(myHwInfo)); + { + WddmCommandStreamReceiver wddmCsr23(myHwInfo, nullptr); + auto wddm23 = wddmCsr23.peekWddm(); + EXPECT_EQ(typeid(*wddm23), typeid(WddmMock23)); + delete wddm23; + } +} + struct WddmCsrCompressionTests : WddmCommandStreamMockGdiTest { void setCompressionEnabled(bool enabled) { RuntimeCapabilityTable capabilityTable = {platformDevices[0]->capabilityTable}; diff --git a/unit_tests/os_interface/windows/wddm20_tests.cpp b/unit_tests/os_interface/windows/wddm20_tests.cpp index f531b7377b..8b7506600a 100644 --- a/unit_tests/os_interface/windows/wddm20_tests.cpp +++ b/unit_tests/os_interface/windows/wddm20_tests.cpp @@ -693,10 +693,6 @@ HWTEST_F(Wddm20Tests, givenDebugManagerWhenGetForUseNoRingFlushesKmdModeIsCalled EXPECT_TRUE(DebugManager.flags.UseNoRingFlushesKmdMode.get()); } -HWTEST_F(Wddm20Tests, givenDebugManagerWhenGetForHwQueueSupportedIsCalledThenFalseIsReturned) { - EXPECT_FALSE(DebugManager.flags.HwQueueSupported.get()); -} - HWTEST_F(Wddm20Tests, makeResidentMultipleHandles) { wddm->init(); ASSERT_TRUE(wddm->isInitialized()); diff --git a/unit_tests/os_interface/windows/wddm_create.cpp b/unit_tests/os_interface/windows/wddm_create.cpp index 548fcf5e7a..b25f6944cc 100644 --- a/unit_tests/os_interface/windows/wddm_create.cpp +++ b/unit_tests/os_interface/windows/wddm_create.cpp @@ -24,7 +24,7 @@ #include "unit_tests/mocks/mock_wddm23.h" namespace OCLRT { -Wddm *Wddm::createWddm(uint32_t interfaceVersion) { +Wddm *Wddm::createWddm(WddmInterfaceVersion interfaceVersion) { switch (interfaceVersion) { case WddmInterfaceVersion::Wddm20: return new WddmMock20(); diff --git a/unit_tests/test_files/igdrcl.config b/unit_tests/test_files/igdrcl.config index 7c244a94b8..e307b93106 100644 --- a/unit_tests/test_files/igdrcl.config +++ b/unit_tests/test_files/igdrcl.config @@ -62,7 +62,6 @@ PrintDriverDiagnostics = -1 FlattenBatchBufferForAUBDump = false PrintDispatchParameters = false AddPatchInfoCommentsForAUBDump = false -HwQueueSupported = false DisableZeroCopyForUseHostPtr = false SchedulerGWS = 0 DisableZeroCopyForBuffers = false diff --git a/unit_tests/windows/wddm_create_tests.cpp b/unit_tests/windows/wddm_create_tests.cpp index 3e92295330..37f4da7de1 100644 --- a/unit_tests/windows/wddm_create_tests.cpp +++ b/unit_tests/windows/wddm_create_tests.cpp @@ -20,6 +20,7 @@ * OTHER DEALINGS IN THE SOFTWARE. */ +#include "runtime/helpers/hw_info.h" #include "runtime/os_interface/windows/wddm/wddm.h" #include "runtime/os_interface/windows/wddm/wddm23.h" #include "unit_tests/helpers/debug_manager_state_restore.h" @@ -38,17 +39,13 @@ TEST(wddmCreateTests, givenInputVersionWhenCreatingThenCreateRequestedObject) { } TEST(wddmCreateTests, givenInvalidInputVersionWhenCreatingThenThrowException) { - EXPECT_THROW(Wddm::createWddm(0), std::exception); - EXPECT_THROW(Wddm::createWddm(21), std::exception); - EXPECT_THROW(Wddm::createWddm(22), std::exception); - EXPECT_THROW(Wddm::createWddm(24), std::exception); + EXPECT_THROW(Wddm::createWddm(static_cast(0)), std::exception); + EXPECT_THROW(Wddm::createWddm(static_cast(21)), std::exception); + EXPECT_THROW(Wddm::createWddm(static_cast(22)), std::exception); + EXPECT_THROW(Wddm::createWddm(static_cast(24)), std::exception); } -TEST(wddmCreateTests, givenHwQueuesSupportedDebugVariableWhenCreatingThenForceWddm23) { - DebugManagerStateRestore restore; - DebugManager.flags.HwQueueSupported.set(true); - - std::unique_ptr wddm(Wddm::createWddm(WddmInterfaceVersion::Wddm20)); - - EXPECT_EQ(typeid(*wddm.get()), typeid(Wddm23)); +TEST(wddmCreateTests, givenNotPopulatedHwInfoWhenAskingForWddmVersionThenReturn20) { + HardwareInfo hwInfo = {}; + EXPECT_TRUE(WddmInterfaceVersion::Wddm20 == Wddm::pickWddmInterfaceVersion(hwInfo)); }