Update Wddm23 interface

Change-Id: I8c1484875f28dd7f2591db810c64b117f49f70e3
This commit is contained in:
Dunajski, Bartosz
2018-09-12 12:43:15 +02:00
committed by sys_ocldev
parent bcceab5629
commit 53c4d2946e
4 changed files with 28 additions and 34 deletions

View File

@@ -20,17 +20,20 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/memory_manager/memory_constants.h"
#include "runtime/os_interface/windows/gdi_interface.h"
#include "runtime/os_interface/windows/wddm/wddm_interface.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/windows/os_context_win.h"
bool OCLRT::WddmInterface20::createHwQueue(PreemptionMode preemptionMode, OsContextWin &osContext) {
using namespace OCLRT;
bool WddmInterface20::createHwQueue(PreemptionMode preemptionMode, OsContextWin &osContext) {
return false;
}
void OCLRT::WddmInterface20::destroyHwQueue(D3DKMT_HANDLE hwQueue) {}
void WddmInterface20::destroyHwQueue(D3DKMT_HANDLE hwQueue) {}
bool OCLRT::WddmInterface20::createMonitoredFence(OsContextWin &osContext) {
bool WddmInterface::createMonitoredFence(OsContextWin &osContext) {
NTSTATUS Status;
D3DKMT_CREATESYNCHRONIZATIONOBJECT2 CreateSynchronizationObject = {0};
CreateSynchronizationObject.hDevice = wddm.getDevice();
@@ -48,11 +51,11 @@ bool OCLRT::WddmInterface20::createMonitoredFence(OsContextWin &osContext) {
return Status == STATUS_SUCCESS;
}
const bool OCLRT::WddmInterface20::hwQueuesSupported() {
const bool WddmInterface20::hwQueuesSupported() {
return false;
}
bool OCLRT::WddmInterface20::submit(uint64_t commandBuffer, size_t size, void *commandHeader, OsContextWin &osContext) {
bool WddmInterface20::submit(uint64_t commandBuffer, size_t size, void *commandHeader, OsContextWin &osContext) {
D3DKMT_SUBMITCOMMAND SubmitCommand = {0};
NTSTATUS status = STATUS_SUCCESS;
@@ -77,7 +80,7 @@ bool OCLRT::WddmInterface20::submit(uint64_t commandBuffer, size_t size, void *c
return STATUS_SUCCESS == status;
}
bool OCLRT::WddmInterface23::createHwQueue(PreemptionMode preemptionMode, OsContextWin &osContext) {
bool WddmInterface23::createHwQueue(PreemptionMode preemptionMode, OsContextWin &osContext) {
D3DKMT_CREATEHWQUEUE createHwQueue = {};
if (!wddm.getGdi()->setupHwQueueProcAddresses()) {
@@ -93,14 +96,10 @@ bool OCLRT::WddmInterface23::createHwQueue(PreemptionMode preemptionMode, OsCont
UNRECOVERABLE_IF(status != STATUS_SUCCESS);
osContext.setHwQueue(createHwQueue.hHwQueue);
osContext.resetMonitoredFenceParams(createHwQueue.hHwQueueProgressFence,
reinterpret_cast<uint64_t *>(createHwQueue.HwQueueProgressFenceCPUVirtualAddress),
createHwQueue.HwQueueProgressFenceGPUVirtualAddress);
return status == STATUS_SUCCESS;
}
void OCLRT::WddmInterface23::destroyHwQueue(D3DKMT_HANDLE hwQueue) {
void WddmInterface23::destroyHwQueue(D3DKMT_HANDLE hwQueue) {
if (hwQueue) {
D3DKMT_DESTROYHWQUEUE destroyHwQueue = {};
destroyHwQueue.hHwQueue = hwQueue;
@@ -110,15 +109,11 @@ void OCLRT::WddmInterface23::destroyHwQueue(D3DKMT_HANDLE hwQueue) {
}
}
bool OCLRT::WddmInterface23::createMonitoredFence(OsContextWin &osContext) {
const bool WddmInterface23::hwQueuesSupported() {
return true;
}
const bool OCLRT::WddmInterface23::hwQueuesSupported() {
return true;
}
bool OCLRT::WddmInterface23::submit(uint64_t commandBuffer, size_t size, void *commandHeader, OsContextWin &osContext) {
bool WddmInterface23::submit(uint64_t commandBuffer, size_t size, void *commandHeader, OsContextWin &osContext) {
auto monitoredFence = osContext.getMonitoredFence();
D3DKMT_SUBMITCOMMANDTOHWQUEUE submitCommand = {};
@@ -132,7 +127,7 @@ bool OCLRT::WddmInterface23::submit(uint64_t commandBuffer, size_t size, void *c
pHeader->MonitorFenceValue = monitoredFence.currentFenceValue;
submitCommand.pPrivateDriverData = commandHeader;
submitCommand.PrivateDriverDataSize = sizeof(COMMAND_BUFFER_HEADER);
submitCommand.PrivateDriverDataSize = MemoryConstants::pageSize;
auto status = wddm.getGdi()->submitCommandToHwQueue(&submitCommand);
UNRECOVERABLE_IF(status != STATUS_SUCCESS);

View File

@@ -39,7 +39,7 @@ class WddmInterface {
WddmInterface() = delete;
virtual bool createHwQueue(PreemptionMode preemptionMode, OsContextWin &osContext) = 0;
virtual void destroyHwQueue(D3DKMT_HANDLE hwQueue) = 0;
virtual bool createMonitoredFence(OsContextWin &osContext) = 0;
bool createMonitoredFence(OsContextWin &osContext);
virtual const bool hwQueuesSupported() = 0;
virtual bool submit(uint64_t commandBuffer, size_t size, void *commandHeader, OsContextWin &osContext) = 0;
Wddm &wddm;
@@ -50,7 +50,6 @@ class WddmInterface20 : public WddmInterface {
using WddmInterface::WddmInterface;
bool createHwQueue(PreemptionMode preemptionMode, OsContextWin &osContext) override;
void destroyHwQueue(D3DKMT_HANDLE hwQueue) override;
bool createMonitoredFence(OsContextWin &osContext) override;
const bool hwQueuesSupported() override;
bool submit(uint64_t commandBuffer, size_t size, void *commandHeader, OsContextWin &osContext) override;
};
@@ -60,7 +59,6 @@ class WddmInterface23 : public WddmInterface {
using WddmInterface::WddmInterface;
bool createHwQueue(PreemptionMode preemptionMode, OsContextWin &osContext) override;
void destroyHwQueue(D3DKMT_HANDLE hwQueue) override;
bool createMonitoredFence(OsContextWin &osContext) override;
const bool hwQueuesSupported() override;
bool submit(uint64_t commandBuffer, size_t size, void *commandHeader, OsContextWin &osContext) override;
};