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 *GmockWddm::virtualAllocWrapper(void *inPtr, size_t size, uint32_t flags, uint32_t type) {
|
||||||
void *tmp = reinterpret_cast<void *>(virtualAllocAddress);
|
void *tmp = reinterpret_cast<void *>(virtualAllocAddress);
|
||||||
size += MemoryConstants::pageSize;
|
size += MemoryConstants::pageSize;
|
||||||
|
|
|
@ -85,6 +85,7 @@ class WddmMock : public Wddm {
|
||||||
uint64_t *getPagingFenceAddress() override;
|
uint64_t *getPagingFenceAddress() override;
|
||||||
void waitOnPagingFenceFromCpu() override;
|
void waitOnPagingFenceFromCpu() override;
|
||||||
void createPagingFenceLogger() override;
|
void createPagingFenceLogger() override;
|
||||||
|
bool init() override;
|
||||||
|
|
||||||
bool configureDeviceAddressSpace() {
|
bool configureDeviceAddressSpace() {
|
||||||
configureDeviceAddressSpaceResult.called++;
|
configureDeviceAddressSpaceResult.called++;
|
||||||
|
@ -134,6 +135,7 @@ class WddmMock : public Wddm {
|
||||||
bool makeResidentStatus = true;
|
bool makeResidentStatus = true;
|
||||||
bool callBaseMakeResident = true;
|
bool callBaseMakeResident = true;
|
||||||
bool callBaseCreatePagingLogger = true;
|
bool callBaseCreatePagingLogger = true;
|
||||||
|
bool osInterfaceAvailable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GmockWddm : WddmMock {
|
struct GmockWddm : WddmMock {
|
||||||
|
|
|
@ -1402,3 +1402,12 @@ TEST(DiscoverDevices, whenDriverInfoHasIncompatibleDriverStoreThenHwDeviceIdIsNo
|
||||||
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||||
EXPECT_TRUE(hwDeviceIds.empty());
|
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);
|
return SysCalls::closeHandle(hObject);
|
||||||
}
|
}
|
||||||
bool RootDeviceEnvironment::initOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId) {
|
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()) {
|
if (!wddm->init()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm.get());
|
memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||||
osInterface = std::make_unique<OSInterface>();
|
|
||||||
osInterface->get()->setWddm(wddm.release());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Wddm {
|
||||||
virtual ~Wddm();
|
virtual ~Wddm();
|
||||||
|
|
||||||
static Wddm *createWddm(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment);
|
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 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);
|
MOCKABLE_VIRTUAL bool makeResident(const D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim, size_t totalSize);
|
||||||
|
|
Loading…
Reference in New Issue