Files
compute-runtime/runtime/os_interface/windows/os_context_win.cpp
Artur Harasimiuk 40146291ad Update copyright headers
Updating files modified in 2018 only. Older files remain with old style
copyright header

Change-Id: Ic99f2e190ad74b4b7f2bd79dd7b9fa5fbe36ec92
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
2018-09-20 18:02:35 +02:00

49 lines
1.5 KiB
C++

/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/os_interface/windows/os_context_win.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/windows/wddm/wddm_interface.h"
#include "runtime/os_interface/windows/os_interface.h"
namespace OCLRT {
OsContextWin::OsContextImpl(Wddm &wddm) : wddm(wddm) {
UNRECOVERABLE_IF(!wddm.isInitialized());
auto wddmInterface = wddm.getWddmInterface();
if (!wddm.createContext(context)) {
return;
}
if (wddmInterface->hwQueuesSupported()) {
if (!wddmInterface->createHwQueue(wddm.getPreemptionMode(), *this)) {
return;
}
}
initialized = wddmInterface->createMonitoredFence(*this);
};
OsContextWin::~OsContextImpl() {
wddm.getWddmInterface()->destroyHwQueue(hwQueueHandle);
wddm.destroyContext(context);
}
void OsContextWin::resetMonitoredFenceParams(D3DKMT_HANDLE &handle, uint64_t *cpuAddress, D3DGPU_VIRTUAL_ADDRESS &gpuAddress) {
monitoredFence.lastSubmittedFence = 0;
monitoredFence.currentFenceValue = 1;
monitoredFence.fenceHandle = handle;
monitoredFence.cpuAddress = cpuAddress;
monitoredFence.gpuAddress = gpuAddress;
}
OsContext::OsContext(OSInterface *osInterface, uint32_t contextId) : contextId(contextId) {
if (osInterface) {
osContextImpl = std::make_unique<OsContextWin>(*osInterface->get()->getWddm());
}
}
OsContext::~OsContext() = default;
} // namespace OCLRT