mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Many DRM context ids per OsContextLinux.
Related-To: NEO-3008 Change-Id: Id6d1c919109d22ccfc64abdaf11aef875dc33615 Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
@@ -6,11 +6,11 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include "runtime/os_interface/linux/engine_info.h"
|
||||
#include "runtime/os_interface/linux/memory_info.h"
|
||||
#include "runtime/utilities/api_intercept.h"
|
||||
|
||||
#include "engine_node.h"
|
||||
#include "igfxfmid.h"
|
||||
|
||||
#include <cerrno>
|
||||
@@ -65,7 +65,7 @@ class Drm {
|
||||
uint32_t createDrmContext();
|
||||
void destroyDrmContext(uint32_t drmContextId);
|
||||
void setLowPriorityContextParam(uint32_t drmContextId);
|
||||
unsigned int bindDrmContext(uint32_t drmContextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType);
|
||||
unsigned int bindDrmContext(uint32_t drmContextId, uint32_t deviceIndex, aub_stream::EngineType engineType);
|
||||
|
||||
void setGtType(GTTYPE eGtType) { this->eGtType = eGtType; }
|
||||
GTTYPE getGtType() const { return this->eGtType; }
|
||||
|
||||
@@ -21,7 +21,7 @@ void Drm::queryEngineInfo() {
|
||||
void Drm::queryMemoryInfo() {
|
||||
}
|
||||
|
||||
unsigned int Drm::bindDrmContext(uint32_t drmContextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType) {
|
||||
unsigned int Drm::bindDrmContext(uint32_t drmContextId, uint32_t deviceIndex, aub_stream::EngineType engineType) {
|
||||
return DrmEngineMapper::engineNodeMap(engineType);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,15 +24,21 @@ OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, Devic
|
||||
OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield,
|
||||
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority)
|
||||
: OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), drm(drm) {
|
||||
|
||||
this->drmContextId = drm.createDrmContext();
|
||||
if (drm.isPreemptionSupported() && lowPriority) {
|
||||
drm.setLowPriorityContextParam(this->drmContextId);
|
||||
for (auto deviceIndex = 0u; deviceIndex < deviceBitfield.size(); deviceIndex++) {
|
||||
if (deviceBitfield.test(deviceIndex)) {
|
||||
auto drmContextId = drm.createDrmContext();
|
||||
if (drm.isPreemptionSupported() && lowPriority) {
|
||||
drm.setLowPriorityContextParam(drmContextId);
|
||||
}
|
||||
this->engineFlag = drm.bindDrmContext(drmContextId, deviceIndex, engineType);
|
||||
this->drmContextIds.push_back(drmContextId);
|
||||
}
|
||||
}
|
||||
this->engineFlag = drm.bindDrmContext(this->drmContextId, deviceBitfield, engineType);
|
||||
}
|
||||
|
||||
OsContextLinux::~OsContextLinux() {
|
||||
drm.destroyDrmContext(drmContextId);
|
||||
for (auto drmContextId : drmContextIds) {
|
||||
drm.destroyDrmContext(drmContextId);
|
||||
}
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace NEO {
|
||||
class Drm;
|
||||
|
||||
@@ -18,11 +20,11 @@ class OsContextLinux : public OsContext {
|
||||
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority);
|
||||
|
||||
unsigned int getEngineFlag() const { return engineFlag; }
|
||||
uint32_t getDrmContextId() const { return drmContextId; }
|
||||
uint32_t getDrmContextId() const { return drmContextIds[0]; }
|
||||
|
||||
protected:
|
||||
unsigned int engineFlag = 0;
|
||||
uint32_t drmContextId = 0;
|
||||
std::vector<uint32_t> drmContextIds;
|
||||
Drm &drm;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user