2018-08-21 23:36:08 +08:00
|
|
|
/*
|
2018-09-18 15:11:08 +08:00
|
|
|
* Copyright (C) 2018 Intel Corporation
|
2018-08-21 23:36:08 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-08-21 23:36:08 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2018-08-23 23:53:58 +08:00
|
|
|
#include "runtime/os_interface/os_context.h"
|
2018-08-21 23:36:08 +08:00
|
|
|
#include "runtime/os_interface/windows/windows_wrapper.h"
|
|
|
|
#include "runtime/os_interface/windows/windows_defs.h"
|
|
|
|
#include <d3dkmthk.h>
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
2018-08-23 23:53:58 +08:00
|
|
|
class Wddm;
|
|
|
|
using OsContextWin = OsContext::OsContextImpl;
|
|
|
|
class OsContext::OsContextImpl {
|
2018-08-21 23:36:08 +08:00
|
|
|
public:
|
2018-08-23 23:53:58 +08:00
|
|
|
OsContextImpl() = delete;
|
|
|
|
OsContextImpl(Wddm &wddm);
|
|
|
|
~OsContextImpl();
|
2018-08-21 23:36:08 +08:00
|
|
|
D3DKMT_HANDLE getContext() const {
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
D3DKMT_HANDLE getHwQueue() const {
|
|
|
|
return hwQueueHandle;
|
|
|
|
}
|
|
|
|
void setHwQueue(D3DKMT_HANDLE hwQueue) {
|
|
|
|
hwQueueHandle = hwQueue;
|
|
|
|
}
|
|
|
|
bool isInitialized() const {
|
|
|
|
return initialized;
|
|
|
|
}
|
|
|
|
MonitoredFence &getMonitoredFence() { return monitoredFence; }
|
|
|
|
void resetMonitoredFenceParams(D3DKMT_HANDLE &handle, uint64_t *cpuAddress, D3DGPU_VIRTUAL_ADDRESS &gpuAddress);
|
2018-08-27 21:48:29 +08:00
|
|
|
Wddm *getWddm() const { return &wddm; }
|
2018-08-21 23:36:08 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool initialized = false;
|
|
|
|
D3DKMT_HANDLE context = 0;
|
|
|
|
D3DKMT_HANDLE hwQueueHandle = 0;
|
|
|
|
Wddm &wddm;
|
|
|
|
MonitoredFence monitoredFence = {};
|
|
|
|
};
|
|
|
|
} // namespace OCLRT
|