Create OsInterface before calling Wddm::init
Related-To: NEO-3691 Change-Id: I33690e4297b6ddd3195c272de00f0c946c56380b Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
a77965adf7
commit
1a35298fdb
|
@ -300,6 +300,11 @@ void WddmMock::createPagingFenceLogger() {
|
|||
}
|
||||
}
|
||||
|
||||
bool WddmMock::init() {
|
||||
osInterfaceAvailable = rootDeviceEnvironment.osInterface != nullptr;
|
||||
return Wddm::init();
|
||||
}
|
||||
|
||||
void *GmockWddm::virtualAllocWrapper(void *inPtr, size_t size, uint32_t flags, uint32_t type) {
|
||||
void *tmp = reinterpret_cast<void *>(virtualAllocAddress);
|
||||
size += MemoryConstants::pageSize;
|
||||
|
|
|
@ -85,6 +85,7 @@ class WddmMock : public Wddm {
|
|||
uint64_t *getPagingFenceAddress() override;
|
||||
void waitOnPagingFenceFromCpu() override;
|
||||
void createPagingFenceLogger() override;
|
||||
bool init() override;
|
||||
|
||||
bool configureDeviceAddressSpace() {
|
||||
configureDeviceAddressSpaceResult.called++;
|
||||
|
@ -134,6 +135,7 @@ class WddmMock : public Wddm {
|
|||
bool makeResidentStatus = true;
|
||||
bool callBaseMakeResident = true;
|
||||
bool callBaseCreatePagingLogger = true;
|
||||
bool osInterfaceAvailable = false;
|
||||
};
|
||||
|
||||
struct GmockWddm : WddmMock {
|
||||
|
|
|
@ -1402,3 +1402,12 @@ TEST(DiscoverDevices, whenDriverInfoHasIncompatibleDriverStoreThenHwDeviceIdIsNo
|
|||
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
EXPECT_TRUE(hwDeviceIds.empty());
|
||||
}
|
||||
|
||||
TEST(InitOsInterfaceTest, givenRootDeviceEnvironmentWhenIntializingWddmDuringInitOsInterfaceMethodThenOsInterfaceIsAvailable) {
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
EXPECT_EQ(1u, hwDeviceIds.size());
|
||||
executionEnvironment.rootDeviceEnvironments[0]->initOsInterface(std::move(hwDeviceIds[0]));
|
||||
auto wddm = static_cast<WddmMock *>(executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->getWddm());
|
||||
EXPECT_TRUE(wddm->osInterfaceAvailable);
|
||||
}
|
||||
|
|
|
@ -70,13 +70,13 @@ BOOL OSInterface::OSInterfaceImpl::closeHandle(HANDLE hObject) {
|
|||
return SysCalls::closeHandle(hObject);
|
||||
}
|
||||
bool RootDeviceEnvironment::initOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId) {
|
||||
std::unique_ptr<Wddm> wddm(Wddm::createWddm(std::move(hwDeviceId), *this));
|
||||
auto wddm(Wddm::createWddm(std::move(hwDeviceId), *this));
|
||||
osInterface = std::make_unique<OSInterface>();
|
||||
osInterface->get()->setWddm(wddm);
|
||||
if (!wddm->init()) {
|
||||
return false;
|
||||
}
|
||||
memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm.get());
|
||||
osInterface = std::make_unique<OSInterface>();
|
||||
osInterface->get()->setWddm(wddm.release());
|
||||
memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
return true;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
|
|
@ -52,7 +52,7 @@ class Wddm {
|
|||
virtual ~Wddm();
|
||||
|
||||
static Wddm *createWddm(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
bool init();
|
||||
MOCKABLE_VIRTUAL bool init();
|
||||
|
||||
MOCKABLE_VIRTUAL bool evict(const D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_t &sizeToTrim);
|
||||
MOCKABLE_VIRTUAL bool makeResident(const D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim, size_t totalSize);
|
||||
|
|
Loading…
Reference in New Issue