mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
Include files are now grouped and sorted in following order: 1. Header file of the class the current file implements 2. Project files 3. Third party files 4. Standard library Change-Id: If31af05652184169f7fee1d7ad08f1b2ed602cf0 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
40 lines
1.3 KiB
C++
40 lines
1.3 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(OSInterface *osInterface, uint32_t contextId, uint32_t numDevicesSupported, EngineInstanceT engineType, PreemptionMode preemptionMode)
|
|
: contextId(contextId), numDevicesSupported(numDevicesSupported), engineType(engineType) {
|
|
if (osInterface) {
|
|
osContextImpl = std::make_unique<OsContextLinux>(*osInterface->get()->getDrm(), engineType);
|
|
}
|
|
}
|
|
|
|
OsContext::~OsContext() = default;
|
|
|
|
OsContextLinux::OsContextImpl(Drm &drm, EngineInstanceT engineType) : 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::~OsContextImpl() {
|
|
drm.destroyDrmContext(drmContextId);
|
|
}
|
|
} // namespace OCLRT
|