[2/n] Initialize Wddm interface in Wddm init.

Change-Id: If7184e64df54b4e6840970fec67cb5bc11909b7c
This commit is contained in:
Mrozek, Michal
2018-08-14 09:45:57 +02:00
committed by sys_ocldev
parent a5950500a3
commit 6c5875f805
9 changed files with 27 additions and 12 deletions

View File

@@ -80,11 +80,9 @@ Wddm::Wddm() : initialized(false),
minAddress = 0;
kmDafListener = std::unique_ptr<KmDafListener>(new KmDafListener);
gdi = std::unique_ptr<Gdi>(new Gdi());
wddmInterface = std::make_unique<WddmInterface20>(*this);
}
Wddm::~Wddm() {
wddmInterface->destroyHwQueue();
resetPageTableManager(nullptr);
destroyContext(context);
destroyPagingQueue();

View File

@@ -46,6 +46,15 @@ bool Wddm::init() {
if (!queryAdapterInfo()) {
return false;
}
if (!wddmInterface) {
if (featureTable->ftrWddmHwQueues) {
wddmInterface = std::make_unique<WddmInterface23>(*this);
} else {
wddmInterface = std::make_unique<WddmInterface20>(*this);
}
}
if (!createDevice()) {
return false;
}

View File

@@ -25,6 +25,5 @@
namespace OCLRT {
Wddm23::Wddm23() : Wddm20() {
wddmInterface = std::make_unique<WddmInterface23>(*this);
}
} // namespace OCLRT

View File

@@ -28,9 +28,6 @@ bool OCLRT::WddmInterface20::createHwQueue(PreemptionMode preemptionMode) {
return false;
}
void OCLRT::WddmInterface20::destroyHwQueue() {
}
bool OCLRT::WddmInterface20::createMonitoredFence() {
NTSTATUS Status;
D3DKMT_CREATESYNCHRONIZATIONOBJECT2 CreateSynchronizationObject = {0};

View File

@@ -29,9 +29,9 @@ class Wddm;
class WddmInterface {
public:
WddmInterface(Wddm &wddm) : wddm(wddm){};
virtual ~WddmInterface() = default;
WddmInterface() = delete;
virtual bool createHwQueue(PreemptionMode preemptionMode) = 0;
virtual void destroyHwQueue() = 0;
virtual bool createMonitoredFence() = 0;
virtual const bool hwQueuesSupported() = 0;
virtual bool submit(uint64_t commandBuffer, size_t size, void *commandHeader) = 0;
@@ -42,7 +42,6 @@ class WddmInterface20 : public WddmInterface {
public:
using WddmInterface::WddmInterface;
bool createHwQueue(PreemptionMode preemptionMode) override;
void destroyHwQueue() override;
bool createMonitoredFence() override;
const bool hwQueuesSupported() override;
bool submit(uint64_t commandBuffer, size_t size, void *commandHeader) override;
@@ -50,9 +49,10 @@ class WddmInterface20 : public WddmInterface {
class WddmInterface23 : public WddmInterface {
public:
~WddmInterface23() override { destroyHwQueue(); }
using WddmInterface::WddmInterface;
bool createHwQueue(PreemptionMode preemptionMode) override;
void destroyHwQueue() override;
void destroyHwQueue();
bool createMonitoredFence() override;
const bool hwQueuesSupported() override;
bool submit(uint64_t commandBuffer, size_t size, void *commandHeader) override;