mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 07:00:17 +08:00
Add separate methods to Wddm interface to create monitor fence
Related-To: NEO-3639 Change-Id: Id1216def65c873028eb6a577fa30ad68ebec8f19 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
cc46cdf46c
commit
58fa5bd347
@@ -40,7 +40,7 @@ OsContextWin::OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield device
|
||||
|
||||
OsContextWin::~OsContextWin() {
|
||||
wddm.getWddmInterface()->destroyHwQueue(hardwareQueue.handle);
|
||||
wddm.getWddmInterface()->destroyMonitorFence(residencyController.getMonitoredFence().fenceHandle);
|
||||
wddm.getWddmInterface()->destroyMonitorFence(residencyController.getMonitoredFence());
|
||||
wddm.destroyContext(wddmContextHandle);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,30 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
bool WddmInterface::createMonitoredFence(MonitoredFence &monitorFence) {
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
D3DKMT_CREATESYNCHRONIZATIONOBJECT2 CreateSynchronizationObject = {0};
|
||||
CreateSynchronizationObject.hDevice = wddm.getDevice();
|
||||
CreateSynchronizationObject.Info.Type = D3DDDI_MONITORED_FENCE;
|
||||
CreateSynchronizationObject.Info.MonitoredFence.InitialFenceValue = 0;
|
||||
|
||||
status = wddm.getGdi()->createSynchronizationObject2(&CreateSynchronizationObject);
|
||||
DEBUG_BREAK_IF(STATUS_SUCCESS != status);
|
||||
|
||||
monitorFence.fenceHandle = CreateSynchronizationObject.hSyncObject;
|
||||
monitorFence.cpuAddress = reinterpret_cast<uint64_t *>(CreateSynchronizationObject.Info.MonitoredFence.FenceValueCPUVirtualAddress);
|
||||
monitorFence.gpuAddress = CreateSynchronizationObject.Info.MonitoredFence.FenceValueGPUVirtualAddress;
|
||||
|
||||
return status == STATUS_SUCCESS;
|
||||
}
|
||||
void WddmInterface::destroyMonitorFence(D3DKMT_HANDLE fenceHandle) {
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
D3DKMT_DESTROYSYNCHRONIZATIONOBJECT destroySyncObject = {0};
|
||||
destroySyncObject.hSyncObject = fenceHandle;
|
||||
status = wddm.getGdi()->destroySynchronizationObject(&destroySyncObject);
|
||||
DEBUG_BREAK_IF(STATUS_SUCCESS != status);
|
||||
}
|
||||
|
||||
bool WddmInterface20::createHwQueue(OsContextWin &osContext) {
|
||||
return false;
|
||||
}
|
||||
@@ -21,28 +45,16 @@ void WddmInterface20::destroyHwQueue(D3DKMT_HANDLE hwQueue) {}
|
||||
|
||||
bool WddmInterface20::createMonitoredFence(OsContextWin &osContext) {
|
||||
auto &residencyController = osContext.getResidencyController();
|
||||
NTSTATUS Status;
|
||||
D3DKMT_CREATESYNCHRONIZATIONOBJECT2 CreateSynchronizationObject = {0};
|
||||
CreateSynchronizationObject.hDevice = wddm.getDevice();
|
||||
CreateSynchronizationObject.Info.Type = D3DDDI_MONITORED_FENCE;
|
||||
CreateSynchronizationObject.Info.MonitoredFence.InitialFenceValue = 0;
|
||||
MonitoredFence &monitorFence = residencyController.getMonitoredFence();
|
||||
bool ret = WddmInterface::createMonitoredFence(monitorFence);
|
||||
|
||||
Status = wddm.getGdi()->createSynchronizationObject2(&CreateSynchronizationObject);
|
||||
DEBUG_BREAK_IF(STATUS_SUCCESS != Status);
|
||||
monitorFence.currentFenceValue = 1;
|
||||
|
||||
residencyController.resetMonitoredFenceParams(CreateSynchronizationObject.hSyncObject,
|
||||
reinterpret_cast<uint64_t *>(CreateSynchronizationObject.Info.MonitoredFence.FenceValueCPUVirtualAddress),
|
||||
CreateSynchronizationObject.Info.MonitoredFence.FenceValueGPUVirtualAddress);
|
||||
|
||||
return Status == STATUS_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void WddmInterface20::destroyMonitorFence(D3DKMT_HANDLE fenceHandle) {
|
||||
NTSTATUS status = STATUS_SUCCESS;
|
||||
D3DKMT_DESTROYSYNCHRONIZATIONOBJECT destroySyncObject = {0};
|
||||
destroySyncObject.hSyncObject = fenceHandle;
|
||||
status = wddm.getGdi()->destroySynchronizationObject(&destroySyncObject);
|
||||
DEBUG_BREAK_IF(STATUS_SUCCESS != status);
|
||||
void WddmInterface20::destroyMonitorFence(MonitoredFence &monitorFence) {
|
||||
WddmInterface::destroyMonitorFence(monitorFence.fenceHandle);
|
||||
}
|
||||
|
||||
const bool WddmInterface20::hwQueuesSupported() {
|
||||
@@ -102,7 +114,7 @@ bool WddmInterface23::createMonitoredFence(OsContextWin &osContext) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void WddmInterface23::destroyMonitorFence(D3DKMT_HANDLE fenceHandle) {
|
||||
void WddmInterface23::destroyMonitorFence(MonitoredFence &monitorFence) {
|
||||
}
|
||||
|
||||
void WddmInterface23::destroyHwQueue(D3DKMT_HANDLE hwQueue) {
|
||||
|
||||
@@ -19,6 +19,7 @@ class Gdi;
|
||||
class Wddm;
|
||||
class OsContextWin;
|
||||
class WddmResidencyController;
|
||||
struct MonitoredFence;
|
||||
struct WddmSubmitArguments;
|
||||
|
||||
class WddmInterface {
|
||||
@@ -29,7 +30,9 @@ class WddmInterface {
|
||||
virtual bool createHwQueue(OsContextWin &osContext) = 0;
|
||||
virtual void destroyHwQueue(D3DKMT_HANDLE hwQueue) = 0;
|
||||
virtual bool createMonitoredFence(OsContextWin &osContext) = 0;
|
||||
virtual void destroyMonitorFence(D3DKMT_HANDLE fenceHandle) = 0;
|
||||
MOCKABLE_VIRTUAL bool createMonitoredFence(MonitoredFence &monitorFence);
|
||||
void destroyMonitorFence(D3DKMT_HANDLE fenceHandle);
|
||||
virtual void destroyMonitorFence(MonitoredFence &monitorFence) = 0;
|
||||
virtual const bool hwQueuesSupported() = 0;
|
||||
virtual bool submit(uint64_t commandBuffer, size_t size, void *commandHeader, WddmSubmitArguments &submitArguments) = 0;
|
||||
Wddm &wddm;
|
||||
@@ -41,7 +44,7 @@ class WddmInterface20 : public WddmInterface {
|
||||
bool createHwQueue(OsContextWin &osContext) override;
|
||||
void destroyHwQueue(D3DKMT_HANDLE hwQueue) override;
|
||||
bool createMonitoredFence(OsContextWin &osContext) override;
|
||||
void destroyMonitorFence(D3DKMT_HANDLE fenceHandle) override;
|
||||
void destroyMonitorFence(MonitoredFence &monitorFence) override;
|
||||
const bool hwQueuesSupported() override;
|
||||
bool submit(uint64_t commandBuffer, size_t size, void *commandHeader, WddmSubmitArguments &submitArguments) override;
|
||||
};
|
||||
@@ -52,7 +55,7 @@ class WddmInterface23 : public WddmInterface {
|
||||
bool createHwQueue(OsContextWin &osContext) override;
|
||||
void destroyHwQueue(D3DKMT_HANDLE hwQueue) override;
|
||||
bool createMonitoredFence(OsContextWin &osContext) override;
|
||||
void destroyMonitorFence(D3DKMT_HANDLE fenceHandle) override;
|
||||
void destroyMonitorFence(MonitoredFence &monitorFence) override;
|
||||
const bool hwQueuesSupported() override;
|
||||
bool submit(uint64_t commandBuffer, size_t size, void *commandHeader, WddmSubmitArguments &submitArguments) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user