2018-08-23 23:53:58 +08:00
|
|
|
/*
|
2020-01-13 21:47:05 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-08-23 23:53:58 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-08-23 23:53:58 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/preemption_mode.h"
|
|
|
|
#include "shared/source/helpers/common_types.h"
|
|
|
|
#include "shared/source/utilities/reference_tracked_object.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2018-11-26 21:04:52 +08:00
|
|
|
#include "engine_node.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2018-08-23 23:53:58 +08:00
|
|
|
#include <memory>
|
2018-08-27 21:48:29 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-08-23 23:53:58 +08:00
|
|
|
class OSInterface;
|
2018-12-10 17:30:39 +08:00
|
|
|
|
2018-08-27 21:48:29 +08:00
|
|
|
class OsContext : public ReferenceTrackedObject<OsContext> {
|
2018-08-23 23:53:58 +08:00
|
|
|
public:
|
2019-02-27 18:17:17 +08:00
|
|
|
OsContext() = delete;
|
2018-08-23 23:53:58 +08:00
|
|
|
|
2019-03-18 20:57:59 +08:00
|
|
|
static OsContext *create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield,
|
2020-03-04 06:33:31 +08:00
|
|
|
aub_stream::EngineType engineType, PreemptionMode preemptionMode,
|
|
|
|
bool lowPriority, bool internalEngine, bool rootDevice);
|
2018-12-10 17:30:39 +08:00
|
|
|
uint32_t getContextId() const { return contextId; }
|
2019-03-06 01:50:10 +08:00
|
|
|
uint32_t getNumSupportedDevices() const { return numSupportedDevices; }
|
2019-03-13 22:00:07 +08:00
|
|
|
DeviceBitfield getDeviceBitfield() const { return deviceBitfield; }
|
2019-02-27 18:17:17 +08:00
|
|
|
PreemptionMode getPreemptionMode() const { return preemptionMode; }
|
2019-03-27 17:06:29 +08:00
|
|
|
aub_stream::EngineType &getEngineType() { return engineType; }
|
2019-03-18 20:57:59 +08:00
|
|
|
bool isLowPriority() const { return lowPriority; }
|
2020-03-04 06:33:31 +08:00
|
|
|
bool isInternalEngine() const { return internalEngine; }
|
|
|
|
bool isRootDevice() const { return rootDevice; }
|
2019-12-19 21:02:05 +08:00
|
|
|
virtual bool isInitialized() const { return true; }
|
2020-03-07 02:02:24 +08:00
|
|
|
bool isDefaultContext() const { return defaultContext; }
|
|
|
|
void setDefaultContext(bool value) { defaultContext = value; }
|
2018-09-06 21:54:29 +08:00
|
|
|
|
2018-08-23 23:53:58 +08:00
|
|
|
protected:
|
2020-03-04 06:33:31 +08:00
|
|
|
OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType, PreemptionMode preemptionMode,
|
|
|
|
bool lowPriority, bool internalEngine, bool rootDevice)
|
2019-03-13 22:00:07 +08:00
|
|
|
: contextId(contextId),
|
|
|
|
deviceBitfield(deviceBitfield),
|
|
|
|
preemptionMode(preemptionMode),
|
|
|
|
numSupportedDevices(static_cast<uint32_t>(deviceBitfield.count())),
|
2019-03-18 20:57:59 +08:00
|
|
|
engineType(engineType),
|
2020-03-04 06:33:31 +08:00
|
|
|
lowPriority(lowPriority),
|
|
|
|
internalEngine(internalEngine),
|
|
|
|
rootDevice(rootDevice) {}
|
2019-02-27 18:17:17 +08:00
|
|
|
|
2019-02-12 18:31:19 +08:00
|
|
|
const uint32_t contextId;
|
2019-03-13 22:00:07 +08:00
|
|
|
const DeviceBitfield deviceBitfield;
|
2019-02-27 18:17:17 +08:00
|
|
|
const PreemptionMode preemptionMode;
|
2019-03-13 22:00:07 +08:00
|
|
|
const uint32_t numSupportedDevices;
|
2019-03-27 17:06:29 +08:00
|
|
|
aub_stream::EngineType engineType = aub_stream::ENGINE_RCS;
|
2020-03-04 06:33:31 +08:00
|
|
|
const bool lowPriority = false;
|
|
|
|
const bool internalEngine = false;
|
|
|
|
const bool rootDevice = false;
|
2020-03-07 02:02:24 +08:00
|
|
|
bool defaultContext = false;
|
2018-08-23 23:53:58 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|