[3/n] Wddm Cleanup.
- remove different flavors of Wddm - rename files for better meaning - remove unnecessary files - remove unnecessary methods Change-Id: I73a35e186a9a99169260bb157958ff795b36e20d
This commit is contained in:
parent
077134faf4
commit
931ed38a57
|
@ -45,7 +45,7 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices, Exec
|
|||
numDevices = 0;
|
||||
|
||||
while (numDevices < totalDeviceCount) {
|
||||
std::unique_ptr<Wddm> wddm(Wddm ::createWddm(Wddm::pickWddmInterfaceVersion(tempHwInfos[numDevices])));
|
||||
std::unique_ptr<Wddm> wddm(Wddm ::createWddm());
|
||||
if (!wddm->enumAdapters(tempHwInfos[numDevices])) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -909,13 +909,4 @@ void Wddm::resetMonitoredFenceParams(D3DKMT_HANDLE &handle, uint64_t *cpuAddress
|
|||
monitoredFence.cpuAddress = 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
|
||||
|
|
|
@ -63,8 +63,7 @@ class Wddm {
|
|||
|
||||
virtual ~Wddm();
|
||||
|
||||
static Wddm *createWddm(WddmInterfaceVersion interfaceVersion);
|
||||
static WddmInterfaceVersion pickWddmInterfaceVersion(const HardwareInfo &hwInfo);
|
||||
static Wddm *createWddm();
|
||||
bool enumAdapters(HardwareInfo &outHardwareInfo);
|
||||
|
||||
MOCKABLE_VIRTUAL bool evict(D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_t &sizeToTrim);
|
||||
|
@ -223,7 +222,4 @@ class Wddm {
|
|||
std::unique_ptr<KmDafListener> kmDafListener;
|
||||
std::unique_ptr<WddmInterface> wddmInterface;
|
||||
};
|
||||
|
||||
using Wddm20 = Wddm;
|
||||
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm23.h"
|
||||
|
||||
namespace OCLRT {
|
||||
Wddm23::Wddm23() : Wddm20() {
|
||||
}
|
||||
} // namespace OCLRT
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 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"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class Wddm23 : public Wddm20 {
|
||||
protected:
|
||||
friend Wddm20;
|
||||
Wddm23();
|
||||
~Wddm23() = default;
|
||||
|
||||
D3DKMT_HANDLE hwQueueHandle = 0;
|
||||
};
|
||||
} // namespace OCLRT
|
|
@ -22,18 +22,9 @@
|
|||
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm23.h"
|
||||
|
||||
namespace OCLRT {
|
||||
Wddm *Wddm::createWddm(WddmInterfaceVersion interfaceVersion) {
|
||||
switch (interfaceVersion) {
|
||||
case WddmInterfaceVersion::Wddm20:
|
||||
return new Wddm20();
|
||||
case WddmInterfaceVersion::Wddm23:
|
||||
return new Wddm23();
|
||||
default:
|
||||
UNRECOVERABLE_IF(true);
|
||||
return nullptr;
|
||||
}
|
||||
Wddm *Wddm::createWddm() {
|
||||
return new Wddm();
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -52,7 +52,7 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareIn
|
|||
: BaseClass(hwInfoIn, executionEnvironment) {
|
||||
this->wddm = wddm;
|
||||
if (this->wddm == nullptr) {
|
||||
this->wddm = Wddm::createWddm(Wddm::pickWddmInterfaceVersion(hwInfoIn));
|
||||
this->wddm = Wddm::createWddm();
|
||||
}
|
||||
GPUNODE_ORDINAL nodeOrdinal = GPUNODE_3D;
|
||||
UNRECOVERABLE_IF(!WddmEngineMapper<GfxFamily>::engineNodeMap(hwInfoIn.capabilityTable.defaultEngineType, nodeOrdinal));
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "unit_tests/mocks/mock_ostime.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/mocks/mock_ostime_win.h"
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
|
|
@ -79,6 +79,9 @@ if(WIN32)
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_memory${BRANCH_DIR_SUFFIX}/mock_gmm_memory.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_page_table_mngr.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_gmm_page_table_mngr.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm_interface23.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_wddm.cpp
|
||||
${IGDRCL_SRC_tests_mock_wddm}
|
||||
)
|
||||
else()
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/mock_gdi/mock_gdi.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -237,38 +237,3 @@ bool WddmMock::reserveValidAddressRange(size_t size, void *&reservedMem) {
|
|||
GmmMemory *WddmMock::getGmmMemory() const {
|
||||
return gmmMemory.get();
|
||||
}
|
||||
|
||||
bool WddmMock::initializeWithoutConfiguringAddressSpace() {
|
||||
if (gdi != nullptr && gdi->isInitialized() && !initialized) {
|
||||
if (!openAdapter()) {
|
||||
return false;
|
||||
}
|
||||
if (!queryAdapterInfo()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (featureTable->ftrWddmHwQueues) {
|
||||
wddmInterface = std::make_unique<WddmInterface23>(*this);
|
||||
} else {
|
||||
wddmInterface = std::make_unique<WddmInterface20>(*this);
|
||||
}
|
||||
|
||||
if (!createDevice()) {
|
||||
return false;
|
||||
}
|
||||
if (!createPagingQueue()) {
|
||||
return false;
|
||||
}
|
||||
if (!createContext()) {
|
||||
return false;
|
||||
}
|
||||
if (wddmInterface->hwQueuesSupported() && !wddmInterface->createHwQueue(preemptionMode)) {
|
||||
return false;
|
||||
}
|
||||
if (!wddmInterface->createMonitoredFence()) {
|
||||
return false;
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
return initialized;
|
||||
}
|
|
@ -47,19 +47,22 @@ struct KmDafLockCall : public CallResult {
|
|||
};
|
||||
} // namespace WddmMockHelpers
|
||||
|
||||
class WddmMock : public Wddm20 {
|
||||
class WddmMock : public Wddm {
|
||||
public:
|
||||
using Wddm::adapter;
|
||||
using Wddm::context;
|
||||
using Wddm::currentPagingFenceValue;
|
||||
using Wddm::device;
|
||||
using Wddm::featureTable;
|
||||
using Wddm::gdi;
|
||||
using Wddm::getSystemInfo;
|
||||
using Wddm::gmmMemory;
|
||||
using Wddm::pagingFenceAddress;
|
||||
using Wddm::pagingQueue;
|
||||
using Wddm::preemptionMode;
|
||||
using Wddm::wddmInterface;
|
||||
|
||||
WddmMock() : Wddm20(){};
|
||||
WddmMock() : Wddm(){};
|
||||
~WddmMock();
|
||||
|
||||
bool makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) override;
|
||||
|
@ -103,8 +106,6 @@ class WddmMock : public Wddm20 {
|
|||
}
|
||||
}
|
||||
|
||||
bool initializeWithoutConfiguringAddressSpace();
|
||||
|
||||
WddmMockHelpers::MakeResidentCall makeResidentResult;
|
||||
WddmMockHelpers::CallResult makeNonResidentResult;
|
||||
WddmMockHelpers::CallResult mapGpuVirtualAddressResult;
|
||||
|
@ -133,6 +134,4 @@ class WddmMock : public Wddm20 {
|
|||
uintptr_t virtualAllocAddress = OCLRT::windowsMinAddress;
|
||||
bool kmDafEnabled = false;
|
||||
};
|
||||
|
||||
using WddmMock20 = WddmMock;
|
||||
} // namespace OCLRT
|
|
@ -22,33 +22,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "runtime/os_interface/windows/wddm/wddm23.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class WddmMock23 : public Wddm23 {
|
||||
public:
|
||||
using Wddm::featureTable;
|
||||
using Wddm::preemptionMode;
|
||||
using Wddm::wddmInterface;
|
||||
using Wddm23::context;
|
||||
using Wddm23::currentPagingFenceValue;
|
||||
using Wddm23::gdi;
|
||||
using Wddm23::hwQueueHandle;
|
||||
using Wddm23::pagingFenceAddress;
|
||||
using Wddm23::submit;
|
||||
|
||||
WddmMock23() : Wddm23(){};
|
||||
|
||||
bool waitOnGPU() override {
|
||||
waitOnGPUCalled++;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t waitOnGPUCalled = 0;
|
||||
uint32_t createHwQueueCalled = 0;
|
||||
bool createHwQueueResult = false;
|
||||
};
|
||||
|
||||
class WddmMockInterface23 : public WddmInterface23 {
|
||||
public:
|
||||
using WddmInterface23::WddmInterface23;
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "runtime/os_interface/windows/deferrable_deletion_win.h"
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <type_traits>
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "unit_tests/mocks/mock_graphics_allocation.h"
|
||||
#include "unit_tests/mocks/mock_program.h"
|
||||
#include "unit_tests/mocks/mock_submissions_aggregator.h"
|
||||
#include "unit_tests/mocks/mock_wddm23.h"
|
||||
#include "unit_tests/mocks/mock_wddm_interface23.h"
|
||||
#include "unit_tests/os_interface/windows/mock_gdi_interface.h"
|
||||
#include "unit_tests/os_interface/windows/mock_wddm_memory_manager.h"
|
||||
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
||||
|
@ -67,7 +67,7 @@ class WddmCommandStreamFixture {
|
|||
virtual void SetUp() {
|
||||
device.reset(MockDevice::createWithNewExecutionEnvironment<MockDevice>(platformDevices[0]));
|
||||
ASSERT_NE(nullptr, device);
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
ASSERT_NE(wddm, nullptr);
|
||||
|
||||
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::ImmediateDispatch));
|
||||
|
@ -128,7 +128,7 @@ class WddmCommandStreamWithMockGdiFixture {
|
|||
virtual void SetUp() {
|
||||
ExecutionEnvironment *executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->initGmm(*platformDevices);
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
gdi = new MockGdi();
|
||||
wddm->gdi.reset(gdi);
|
||||
ASSERT_NE(wddm, nullptr);
|
||||
|
@ -242,7 +242,7 @@ TEST_F(WddmCommandStreamTest, givenWdmmWhenSubmitIsCalledThenCoherencyRequiredFl
|
|||
}
|
||||
|
||||
TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOffWhenWorkloadIsSubmittedThenHeaderDoesntHavePreemptionFieldSet) {
|
||||
auto wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||
auto wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
auto localHwInfo = *platformDevices[0];
|
||||
localHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
@ -264,7 +264,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
|
|||
}
|
||||
|
||||
TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOnWhenWorkloadIsSubmittedThenHeaderDoesHavePreemptionFieldSet) {
|
||||
auto wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||
auto wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
auto localHwInfo = *platformDevices[0];
|
||||
localHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
@ -285,7 +285,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
|
|||
}
|
||||
|
||||
TEST(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderContainsPreemptionFieldSet) {
|
||||
auto wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||
auto wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
auto localHwInfo = *platformDevices[0];
|
||||
localHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
@ -296,7 +296,7 @@ TEST(WddmPreemptionHeaderTests, givenDeviceSupportingPreemptionWhenCommandStream
|
|||
}
|
||||
|
||||
TEST(WddmPreemptionHeaderTests, givenDevicenotSupportingPreemptionWhenCommandStreamReceiverIsCreatedThenHeaderPreemptionFieldIsNotSet) {
|
||||
auto wddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||
auto wddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
auto localHwInfo = *platformDevices[0];
|
||||
localHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
@ -780,7 +780,7 @@ using WddmSimpleTest = ::testing::Test;
|
|||
HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedOn) {
|
||||
DebugManager.flags.CsrDispatchMode.set(0);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
auto wddm = Wddm::createWddm(WddmInterfaceVersion::Wddm20);
|
||||
auto wddm = Wddm::createWddm();
|
||||
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*platformDevices[0], wddm, executionEnvironment));
|
||||
EXPECT_EQ(DispatchMode::BatchedDispatch, mockCsr->dispatchMode);
|
||||
}
|
||||
|
@ -790,21 +790,9 @@ HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVer
|
|||
FeatureTable myFtrTable = *myHwInfo.pSkuTable;
|
||||
myHwInfo.pSkuTable = &myFtrTable;
|
||||
|
||||
myFtrTable.ftrWddmHwQueues = false;
|
||||
EXPECT_TRUE(WddmInterfaceVersion::Wddm20 == Wddm::pickWddmInterfaceVersion(myHwInfo));
|
||||
{
|
||||
WddmCommandStreamReceiver<FamilyType> wddmCsr20(myHwInfo, nullptr, *device->executionEnvironment);
|
||||
auto wddm20 = wddmCsr20.peekWddm();
|
||||
EXPECT_EQ(typeid(*wddm20), typeid(WddmMock20));
|
||||
}
|
||||
|
||||
myFtrTable.ftrWddmHwQueues = true;
|
||||
EXPECT_TRUE(WddmInterfaceVersion::Wddm23 == Wddm::pickWddmInterfaceVersion(myHwInfo));
|
||||
{
|
||||
WddmCommandStreamReceiver<FamilyType> wddmCsr23(myHwInfo, nullptr, *device->executionEnvironment);
|
||||
auto wddm23 = wddmCsr23.peekWddm();
|
||||
EXPECT_EQ(typeid(*wddm23), typeid(WddmMock23));
|
||||
}
|
||||
WddmCommandStreamReceiver<FamilyType> wddmCsr(myHwInfo, nullptr, *device->executionEnvironment);
|
||||
auto wddm = wddmCsr.peekWddm();
|
||||
EXPECT_EQ(typeid(*wddm), typeid(WddmMock));
|
||||
}
|
||||
|
||||
struct WddmCsrCompressionTests : ::testing::Test {
|
||||
|
@ -821,7 +809,7 @@ struct WddmCsrCompressionTests : ::testing::Test {
|
|||
}
|
||||
|
||||
void createMockWddm() {
|
||||
myMockWddm = static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||
myMockWddm = static_cast<WddmMock *>(Wddm::createWddm());
|
||||
}
|
||||
|
||||
HardwareInfo hwInfo = {};
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/mocks/mock_device.h"
|
||||
#include "unit_tests/mocks/mock_csr.h"
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/libult/create_command_stream.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ void HwInfoConfigTestWindows::SetUp() {
|
|||
|
||||
osInterface.reset(new OSInterface());
|
||||
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm(Wddm::pickWddmInterfaceVersion(outHwInfo)));
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
||||
wddm->enumAdapters(outHwInfo);
|
||||
testHwInfo = outHwInfo;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "runtime/os_interface/windows/windows_wrapper.h"
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "mock_performance_counters_win.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/os_interface/windows/windows_wrapper.h"
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/os_interface/windows/mock_performance_counters_win.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ TEST(Wddm20EnumAdaptersTest, expectTrue) {
|
|||
const HardwareInfo hwInfo = *platformDevices[0];
|
||||
OsLibrary *mockGdiDll = setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo);
|
||||
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm(Wddm::pickWddmInterfaceVersion(outHwInfo)));
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
||||
bool success = wddm->enumAdapters(outHwInfo);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
|
@ -125,7 +125,7 @@ TEST(Wddm20EnumAdaptersTest, givenEmptyHardwareInfoWhenEnumAdapterIsCalledThenCa
|
|||
auto hwInfo = *platformDevices[0];
|
||||
std::unique_ptr<OsLibrary> mockGdiDll(setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo));
|
||||
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm(Wddm::pickWddmInterfaceVersion(outHwInfo)));
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
||||
bool success = wddm->enumAdapters(outHwInfo);
|
||||
EXPECT_TRUE(success);
|
||||
|
||||
|
@ -167,7 +167,7 @@ TEST(Wddm20EnumAdaptersTest, givenUnknownPlatformWhenEnumAdapterIsCalledThenFals
|
|||
fSetAdpaterInfo(&platform, hwInfo.pSysInfo);
|
||||
delete ptr;
|
||||
});
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm(Wddm::pickWddmInterfaceVersion(outHwInfo)));
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
||||
auto ret = wddm->enumAdapters(outHwInfo);
|
||||
EXPECT_FALSE(ret);
|
||||
EXPECT_EQ(nullptr, outHwInfo.pPlatform);
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
*/
|
||||
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm23.h"
|
||||
#include "unit_tests/fixtures/gmm_environment_fixture.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/mocks/mock_wddm23.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/mocks/mock_wddm_interface23.h"
|
||||
#include "unit_tests/os_interface/windows/gdi_dll_fixture.h"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -35,7 +35,7 @@ struct Wddm23Tests : public ::testing::Test, GdiDllFixture, public GmmEnvironmen
|
|||
GmmEnvironmentFixture::SetUp();
|
||||
GdiDllFixture::SetUp();
|
||||
|
||||
wddm.reset(static_cast<WddmMock23 *>(Wddm::createWddm(WddmInterfaceVersion::Wddm23)));
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
wddm->featureTable->ftrWddmHwQueues = true;
|
||||
wddmMockInterface = new WddmMockInterface23(*wddm);
|
||||
wddm->wddmInterface.reset(wddmMockInterface);
|
||||
|
@ -47,7 +47,7 @@ struct Wddm23Tests : public ::testing::Test, GdiDllFixture, public GmmEnvironmen
|
|||
GmmEnvironmentFixture::TearDown();
|
||||
}
|
||||
|
||||
std::unique_ptr<WddmMock23> wddm;
|
||||
std::unique_ptr<WddmMock> wddm;
|
||||
WddmMockInterface23 *wddmMockInterface = nullptr;
|
||||
};
|
||||
|
||||
|
@ -67,7 +67,7 @@ HWTEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) {
|
|||
}
|
||||
|
||||
TEST_F(Wddm23Tests, whenCreateHwQueueIsCalledThenSetAllRequiredFieldsAndMonitoredFence) {
|
||||
EXPECT_EQ(0u, wddm->hwQueueHandle);
|
||||
EXPECT_EQ(0u, wddmMockInterface->hwQueueHandle);
|
||||
wddm->context = 1;
|
||||
|
||||
wddm->wddmInterface->createHwQueue(wddm->preemptionMode);
|
||||
|
@ -145,11 +145,11 @@ HWTEST_F(Wddm23Tests, givenCurrentPendingFenceValueGreaterThanPendingFenceValueW
|
|||
*wddm->pagingFenceAddress = 1;
|
||||
wddm->currentPagingFenceValue = 1;
|
||||
wddm->submit(cmdBufferAddress, cmdSize, &cmdBufferHeader);
|
||||
EXPECT_EQ(0u, wddm->waitOnGPUCalled);
|
||||
EXPECT_EQ(0u, wddm->waitOnGPUResult.called);
|
||||
|
||||
wddm->currentPagingFenceValue = 2;
|
||||
wddm->submit(cmdBufferAddress, cmdSize, &cmdBufferHeader);
|
||||
EXPECT_EQ(1u, wddm->waitOnGPUCalled);
|
||||
EXPECT_EQ(1u, wddm->waitOnGPUResult.called);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, whenInitCalledThenInitializeNewGdiDDIsAndCallToCreateHwQueue) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
#include "unit_tests/fixtures/gmm_environment_fixture.h"
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/os_interface/windows/ult_dxgi_factory.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
|
|
@ -20,18 +20,11 @@
|
|||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm23.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/mocks/mock_wddm_interface23.h"
|
||||
|
||||
namespace OCLRT {
|
||||
Wddm *Wddm::createWddm(WddmInterfaceVersion interfaceVersion) {
|
||||
switch (interfaceVersion) {
|
||||
case WddmInterfaceVersion::Wddm20:
|
||||
return new WddmMock20();
|
||||
case WddmInterfaceVersion::Wddm23:
|
||||
return new WddmMock23();
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
Wddm *Wddm::createWddm() {
|
||||
return new WddmMock();
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
#include "unit_tests/fixtures/gmm_environment_fixture.h"
|
||||
#include "unit_tests/mocks/mock_wddm20.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/os_interface/windows/mock_gdi_interface.h"
|
||||
#include "unit_tests/os_interface/windows/gdi_dll_fixture.h"
|
||||
#include "mock_gmm_memory.h"
|
||||
|
@ -34,7 +34,7 @@ namespace OCLRT {
|
|||
struct WddmFixture : public GmmEnvironmentFixture {
|
||||
void SetUp() override {
|
||||
GmmEnvironmentFixture::SetUp();
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
gdi = new MockGdi();
|
||||
wddm->gdi.reset(gdi);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ struct WddmFixtureWithMockGdiDll : public GmmEnvironmentFixture, public GdiDllFi
|
|||
void SetUp() override {
|
||||
GmmEnvironmentFixture::SetUp();
|
||||
GdiDllFixture::SetUp();
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
@ -65,7 +65,7 @@ struct WddmFixtureWithMockGdiDll : public GmmEnvironmentFixture, public GdiDllFi
|
|||
struct WddmInstrumentationGmmFixture : public GmmEnvironmentFixture {
|
||||
void SetUp() override {
|
||||
GmmEnvironmentFixture::SetUp();
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
gmmMem = new ::testing::NiceMock<GmockGmmMemory>();
|
||||
wddm->gmmMemory.reset(gmmMem);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ using namespace ::testing;
|
|||
void WddmMemoryManagerFixture::SetUp() {
|
||||
GmmEnvironmentFixture::SetUp();
|
||||
GdiDllFixture::SetUp();
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
ASSERT_NE(nullptr, wddm);
|
||||
if (platformDevices[0]->capabilityTable.ftrRenderCompressedBuffers || platformDevices[0]->capabilityTable.ftrRenderCompressedImages) {
|
||||
GMM_DEVICE_CALLBACKS_INT dummyDeviceCallbacks = {};
|
||||
|
@ -58,7 +58,7 @@ TEST(WddmMemoryManager, NonAssignable) {
|
|||
}
|
||||
|
||||
TEST(WddmMemoryManagerAllocator32BitTest, allocator32BitIsCreatedWithCorrectBase) {
|
||||
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
||||
std::unique_ptr<WddmMock> wddm(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
uint64_t base = 0x56000;
|
||||
uint64_t size = 0x9000;
|
||||
wddm->setHeap32(base, size);
|
||||
|
|
|
@ -70,7 +70,7 @@ class MockWddmMemoryManagerFixture : public GmmEnvironmentFixture {
|
|||
public:
|
||||
void SetUp() {
|
||||
GmmEnvironmentFixture::SetUp();
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
gdi = new MockGdi();
|
||||
wddm->gdi.reset(gdi);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ class WddmMemoryManagerSimpleTest : public MockWddmMemoryManagerFixture, public
|
|||
public:
|
||||
void SetUp() override {
|
||||
MockWddmMemoryManagerFixture::SetUp();
|
||||
wddm->initializeWithoutConfiguringAddressSpace();
|
||||
wddm->init<DEFAULT_TEST_FAMILY_NAME>();
|
||||
}
|
||||
void TearDown() override {
|
||||
MockWddmMemoryManagerFixture::TearDown();
|
||||
|
|
|
@ -43,7 +43,7 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
|
|||
|
||||
template <typename GfxFamily>
|
||||
void createAndInitWddm(unsigned int forceReturnPreemptionRegKeyValue) {
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(WddmInterfaceVersion::Wddm20)));
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
auto regReader = new RegistryReaderMock();
|
||||
wddm->registryReader.reset(regReader);
|
||||
regReader->forceRetValue = forceReturnPreemptionRegKeyValue;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#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"
|
||||
#include "test.h"
|
||||
|
||||
|
@ -31,21 +30,6 @@
|
|||
using namespace OCLRT;
|
||||
|
||||
TEST(wddmCreateTests, givenInputVersionWhenCreatingThenCreateRequestedObject) {
|
||||
std::unique_ptr<Wddm> wddm20(Wddm::createWddm(WddmInterfaceVersion::Wddm20));
|
||||
std::unique_ptr<Wddm> wddm23(Wddm::createWddm(WddmInterfaceVersion::Wddm23));
|
||||
|
||||
EXPECT_EQ(typeid(*wddm20.get()), typeid(Wddm20));
|
||||
EXPECT_EQ(typeid(*wddm23.get()), typeid(Wddm23));
|
||||
}
|
||||
|
||||
TEST(wddmCreateTests, givenInvalidInputVersionWhenCreatingThenThrowException) {
|
||||
EXPECT_THROW(Wddm::createWddm(static_cast<WddmInterfaceVersion>(0)), std::exception);
|
||||
EXPECT_THROW(Wddm::createWddm(static_cast<WddmInterfaceVersion>(21)), std::exception);
|
||||
EXPECT_THROW(Wddm::createWddm(static_cast<WddmInterfaceVersion>(22)), std::exception);
|
||||
EXPECT_THROW(Wddm::createWddm(static_cast<WddmInterfaceVersion>(24)), std::exception);
|
||||
}
|
||||
|
||||
TEST(wddmCreateTests, givenNotPopulatedHwInfoWhenAskingForWddmVersionThenReturn20) {
|
||||
HardwareInfo hwInfo = {};
|
||||
EXPECT_TRUE(WddmInterfaceVersion::Wddm20 == Wddm::pickWddmInterfaceVersion(hwInfo));
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm());
|
||||
EXPECT_EQ(typeid(*wddm.get()), typeid(Wddm));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue