mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Improving OS abstraction
Signed-off-by: Jaroslaw Chodor <jaroslaw.chodor@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7bec5d5d3b
commit
0e9aa45e46
@@ -57,7 +57,7 @@ ClDevice::ClDevice(Device &device, Platform *platform) : device(device), platfor
|
||||
}
|
||||
if (getSharedDeviceInfo().debuggerActive && getSourceLevelDebugger()) {
|
||||
auto osInterface = device.getRootDeviceEnvironment().osInterface.get();
|
||||
getSourceLevelDebugger()->notifyNewDevice(osInterface ? osInterface->getDeviceHandle() : 0);
|
||||
getSourceLevelDebugger()->notifyNewDevice(osInterface ? osInterface->getDriverModel()->getDeviceHandle() : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/os_interface/linux/drm_memory_manager.h"
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_interface.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
@@ -14,11 +14,4 @@ namespace NEO {
|
||||
|
||||
bool OSInterface::osEnableLocalMemory = true;
|
||||
|
||||
void OSInterface::setGmmInputArgs(void *args) {
|
||||
auto gmmInArgs = reinterpret_cast<GMM_INIT_IN_ARGS *>(args);
|
||||
auto adapterBDF = this->get()->getDrm()->getAdapterBDF();
|
||||
gmmInArgs->FileDescriptor = adapterBDF.Data;
|
||||
gmmInArgs->ClientType = GMM_CLIENT::GMM_OCL_VISTA;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
@@ -14,8 +14,4 @@ namespace NEO {
|
||||
|
||||
bool OSInterface::osEnableLocalMemory = true;
|
||||
|
||||
void OSInterface::setGmmInputArgs(void *args) {
|
||||
this->get()->getWddm()->setGmmInputArg(args);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "opencl/source/os_interface/linux/drm_command_stream.h"
|
||||
|
||||
@@ -40,7 +40,7 @@ DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(ExecutionEnvironme
|
||||
|
||||
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get();
|
||||
|
||||
this->drm = rootDeviceEnvironment->osInterface->get()->getDrm();
|
||||
this->drm = rootDeviceEnvironment->osInterface->getDriverModel()->as<Drm>();
|
||||
residency.reserve(512);
|
||||
execObjectsStorage.reserve(512);
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/device/sub_device.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
#include "shared/source/os_interface/linux/os_time_linux.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
namespace NEO {
|
||||
////////////////////////////////////////////////////
|
||||
@@ -19,8 +19,7 @@ namespace NEO {
|
||||
////////////////////////////////////////////////////
|
||||
std::unique_ptr<PerformanceCounters> PerformanceCounters::create(Device *device) {
|
||||
auto counter = std::make_unique<PerformanceCountersLinux>();
|
||||
auto osInterface = device->getOSTime()->getOSInterface()->get();
|
||||
auto drm = osInterface->getDrm();
|
||||
auto drm = device->getOSTime()->getOSInterface()->getDriverModel()->as<Drm>();
|
||||
auto gen = device->getHardwareInfo().platform.eRenderCoreFamily;
|
||||
auto &hwHelper = HwHelper::get(gen);
|
||||
UNRECOVERABLE_IF(counter == nullptr);
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
|
||||
#include "shared/source/helpers/get_info.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
#include "shared/source/utilities/api_intercept.h"
|
||||
|
||||
#include "opencl/source/api/api.h"
|
||||
@@ -27,7 +28,7 @@ ClDevice *pickDeviceWithAdapterLuid(Platform *platform, LUID adapterLuid) {
|
||||
ClDevice *deviceToReturn = nullptr;
|
||||
for (auto i = 0u; i < platform->getNumDevices(); i++) {
|
||||
auto device = platform->getClDevice(i);
|
||||
if (device->getRootDeviceEnvironment().osInterface->get()->getWddm()->verifyAdapterLuid(adapterLuid)) {
|
||||
if (device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<Wddm>()->verifyAdapterLuid(adapterLuid)) {
|
||||
deviceToReturn = device;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/os_time_win.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
namespace NEO {
|
||||
/////////////////////////////////////////////////////
|
||||
@@ -18,14 +19,14 @@ namespace NEO {
|
||||
/////////////////////////////////////////////////////
|
||||
std::unique_ptr<PerformanceCounters> PerformanceCounters::create(Device *device) {
|
||||
auto counter = std::make_unique<PerformanceCountersWin>();
|
||||
auto osInterface = device->getOSTime()->getOSInterface()->get();
|
||||
auto wddm = device->getOSTime()->getOSInterface()->getDriverModel()->as<Wddm>();
|
||||
auto gen = device->getHardwareInfo().platform.eRenderCoreFamily;
|
||||
auto &hwHelper = HwHelper::get(gen);
|
||||
UNRECOVERABLE_IF(counter == nullptr);
|
||||
|
||||
counter->clientData.Windows.Adapter = reinterpret_cast<void *>(static_cast<UINT_PTR>(osInterface->getAdapterHandle()));
|
||||
counter->clientData.Windows.Device = reinterpret_cast<void *>(static_cast<UINT_PTR>(osInterface->getDeviceHandle()));
|
||||
counter->clientData.Windows.Escape = osInterface->getEscapeHandle();
|
||||
counter->clientData.Windows.Adapter = reinterpret_cast<void *>(static_cast<UINT_PTR>(wddm->getAdapter()));
|
||||
counter->clientData.Windows.Device = reinterpret_cast<void *>(static_cast<UINT_PTR>(wddm->getDeviceHandle()));
|
||||
counter->clientData.Windows.Escape = wddm->getEscapeHandle();
|
||||
counter->clientData.Windows.KmdInstrumentationEnabled = device->getHardwareInfo().capabilityTable.instrumentationEnabled;
|
||||
counter->contextData.ClientData = &counter->clientData;
|
||||
counter->clientType.Gen = static_cast<MetricsLibraryApi::ClientGen>(hwHelper.getMetricsLibraryGenId());
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "shared/source/os_interface/windows/gdi_interface.h"
|
||||
#include "shared/source/os_interface/windows/os_context_win.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -43,7 +42,7 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(ExecutionEnviron
|
||||
: BaseClass(executionEnvironment, rootDeviceIndex, deviceBitfield) {
|
||||
|
||||
notifyAubCaptureImpl = DeviceCallbacks<GfxFamily>::notifyAubCapture;
|
||||
this->wddm = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface->get()->getWddm();
|
||||
this->wddm = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface->getDriverModel()->as<Wddm>();
|
||||
|
||||
PreemptionMode preemptionMode = PreemptionHelper::getDefaultPreemptionMode(this->peekHwInfo());
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/get_info.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
#include "shared/source/utilities/api_intercept.h"
|
||||
|
||||
@@ -359,7 +359,7 @@ cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties *properties
|
||||
ClDevice *deviceToReturn = nullptr;
|
||||
for (auto i = 0u; i < platform->getNumDevices(); i++) {
|
||||
auto device = platform->getClDevice(i);
|
||||
if (device->getRootDeviceEnvironment().osInterface->get()->getWddm()->verifyAdapterLuid(glSharing->getAdapterLuid(reinterpret_cast<GLContext>(static_cast<uintptr_t>(GLHGLRCHandle))))) {
|
||||
if (device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<Wddm>()->verifyAdapterLuid(glSharing->getAdapterLuid(reinterpret_cast<GLContext>(static_cast<uintptr_t>(GLHGLRCHandle))))) {
|
||||
deviceToReturn = device;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/gdi_interface.h"
|
||||
#include "shared/source/os_interface/windows/os_context_win.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/sys_calls.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
#include "opencl/extensions/public/cl_gl_private_intel.h"
|
||||
@@ -38,7 +39,7 @@ void destroyEvent(OSInterface &osInterface, HANDLE event) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto ret = osInterface.get()->closeHandle(event);
|
||||
auto ret = SysCalls::closeHandle(event);
|
||||
DEBUG_BREAK_IF(TRUE != ret);
|
||||
}
|
||||
|
||||
@@ -47,7 +48,7 @@ void cleanupArbSyncObject(OSInterface &osInterface, CL_GL_SYNC_INFO *glSyncInfo)
|
||||
return;
|
||||
}
|
||||
|
||||
auto gdi = osInterface.get()->getWddm()->getGdi();
|
||||
auto gdi = osInterface.getDriverModel()->as<Wddm>()->getGdi();
|
||||
UNRECOVERABLE_IF(nullptr == gdi);
|
||||
|
||||
destroySync(*gdi, glSyncInfo->serverSynchronizationObject);
|
||||
@@ -65,7 +66,7 @@ bool setupArbSyncObject(GLSharingFunctions &sharing, OSInterface &osInterface, C
|
||||
|
||||
glSyncInfo.hContextToBlock = static_cast<D3DKMT_HANDLE>(sharingFunctions.getGLContextHandle());
|
||||
auto glDevice = static_cast<D3DKMT_HANDLE>(sharingFunctions.getGLDeviceHandle());
|
||||
auto wddm = osInterface.get()->getWddm();
|
||||
auto wddm = osInterface.getDriverModel()->as<Wddm>();
|
||||
|
||||
D3DKMT_CREATESYNCHRONIZATIONOBJECT serverSyncInitInfo = {};
|
||||
serverSyncInitInfo.hDevice = glDevice;
|
||||
@@ -76,7 +77,7 @@ bool setupArbSyncObject(GLSharingFunctions &sharing, OSInterface &osInterface, C
|
||||
glSyncInfo.serverSynchronizationObject = serverSyncInitInfo.hSyncObject;
|
||||
|
||||
glSyncInfo.eventName = createArbSyncEventName();
|
||||
glSyncInfo.event = osInterface.get()->createEvent(NULL, TRUE, FALSE, glSyncInfo.eventName);
|
||||
glSyncInfo.event = SysCalls::createEvent(nullptr, TRUE, FALSE, glSyncInfo.eventName);
|
||||
|
||||
D3DKMT_CREATESYNCHRONIZATIONOBJECT2 clientSyncInitInfo = {};
|
||||
clientSyncInitInfo.hDevice = glDevice;
|
||||
@@ -87,7 +88,7 @@ bool setupArbSyncObject(GLSharingFunctions &sharing, OSInterface &osInterface, C
|
||||
|
||||
D3DKMT_CREATESYNCHRONIZATIONOBJECT2 submissionSyncEventInfo = {};
|
||||
glSyncInfo.submissionEventName = createArbSyncEventName();
|
||||
glSyncInfo.submissionEvent = osInterface.get()->createEvent(NULL, TRUE, FALSE, glSyncInfo.submissionEventName);
|
||||
glSyncInfo.submissionEvent = SysCalls::createEvent(nullptr, TRUE, FALSE, glSyncInfo.submissionEventName);
|
||||
|
||||
submissionSyncEventInfo.hDevice = glDevice;
|
||||
submissionSyncEventInfo.Info.Type = D3DDDI_CPU_NOTIFICATION;
|
||||
@@ -140,7 +141,7 @@ void signalArbSyncObject(OsContext &osContext, CL_GL_SYNC_INFO &glSyncInfo) {
|
||||
}
|
||||
|
||||
void serverWaitForArbSyncObject(OSInterface &osInterface, CL_GL_SYNC_INFO &glSyncInfo) {
|
||||
auto wddm = osInterface.get()->getWddm();
|
||||
auto wddm = osInterface.getDriverModel()->as<Wddm>();
|
||||
|
||||
D3DKMT_WAITFORSYNCHRONIZATIONOBJECT waitForSyncInfo = {};
|
||||
waitForSyncInfo.hContext = glSyncInfo.hContextToBlock;
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
#include "shared/source/os_interface/linux/pci_path.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/source/platform/platform.h"
|
||||
@@ -38,7 +38,7 @@ ClDevice *VADevice::getRootDeviceFromVaDisplay(Platform *pPlatform, VADisplay va
|
||||
auto device = pPlatform->getClDevice(i);
|
||||
NEO::Device *neoDevice = &device->getDevice();
|
||||
|
||||
auto *drm = neoDevice->getRootDeviceEnvironment().osInterface->get()->getDrm();
|
||||
auto *drm = neoDevice->getRootDeviceEnvironment().osInterface->getDriverModel()->as<Drm>();
|
||||
auto pciPath = drm->getPciPath();
|
||||
if (devicePath == pciPath) {
|
||||
return device;
|
||||
|
||||
Reference in New Issue
Block a user