Files
compute-runtime/runtime/os_interface/linux/os_context_linux.cpp
Piotr Fusik 25e6494443 Use std::bitset for deviceBitfield.
Change-Id: I9078ffbb38967b753980cb1c5ebcab00f5292598
Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
2019-03-14 08:36:01 +01:00

42 lines
1.5 KiB
C++

/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/os_interface/linux/os_context_linux.h"
#include "runtime/os_interface/linux/drm_engine_mapper.h"
#include "runtime/os_interface/linux/drm_neo.h"
#include "runtime/os_interface/linux/os_interface.h"
#include "runtime/os_interface/os_context.h"
namespace OCLRT {
OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield,
EngineInstanceT engineType, PreemptionMode preemptionMode) {
if (osInterface) {
return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode);
}
return new OsContext(contextId, deviceBitfield, engineType, preemptionMode);
}
OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield,
EngineInstanceT engineType, PreemptionMode preemptionMode)
: OsContext(contextId, deviceBitfield, engineType, preemptionMode), drm(drm) {
engineFlag = DrmEngineMapper::engineNodeMap(engineType.type);
this->drmContextId = drm.createDrmContext();
if (drm.isPreemptionSupported() &&
engineType.type == lowPriorityGpgpuEngine.type &&
engineType.id == lowPriorityGpgpuEngine.id) {
drm.setLowPriorityContextParam(this->drmContextId);
}
}
OsContextLinux::~OsContextLinux() {
drm.destroyDrmContext(drmContextId);
}
} // namespace OCLRT