mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
feature: Add ioctl helpers for primary contexts
Related-To: NEO-12952 Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
7c3468794e
commit
0a7ed9f9f4
@@ -1319,7 +1319,7 @@ int IoctlHelperXe::createDrmContext(Drm &drm, OsContextLinux &osContext, uint32_
|
||||
std::array<drm_xe_ext_set_property, maxContextSetProperties> extProperties{};
|
||||
uint32_t extPropertyIndex{0U};
|
||||
setOptionalContextProperties(drm, &extProperties, extPropertyIndex);
|
||||
setContextProperties(osContext, &extProperties, extPropertyIndex);
|
||||
setContextProperties(osContext, deviceIndex, &extProperties, extPropertyIndex);
|
||||
|
||||
drm_xe_exec_queue_create create{};
|
||||
create.width = 1;
|
||||
@@ -1653,7 +1653,7 @@ void IoctlHelperXe::setOptionalContextProperties(Drm &drm, void *extProperties,
|
||||
}
|
||||
}
|
||||
|
||||
void IoctlHelperXe::setContextProperties(const OsContextLinux &osContext, void *extProperties, uint32_t &extIndexInOut) {
|
||||
void IoctlHelperXe::setContextProperties(const OsContextLinux &osContext, uint32_t deviceIndex, void *extProperties, uint32_t &extIndexInOut) {
|
||||
|
||||
auto &ext = *reinterpret_cast<std::array<drm_xe_ext_set_property, maxContextSetProperties> *>(extProperties);
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ class IoctlHelperXe : public IoctlHelper {
|
||||
|
||||
uint16_t getDefaultEngineClass(const aub_stream::EngineType &defaultEngineType);
|
||||
void setOptionalContextProperties(Drm &drm, void *extProperties, uint32_t &extIndexInOut);
|
||||
virtual void setContextProperties(const OsContextLinux &osContext, void *extProperties, uint32_t &extIndexInOut);
|
||||
virtual void setContextProperties(const OsContextLinux &osContext, uint32_t deviceIndex, void *extProperties, uint32_t &extIndexInOut);
|
||||
virtual void applyContextFlags(void *execQueueCreate, bool allocateInterrupt){};
|
||||
|
||||
struct GtIpVersion {
|
||||
|
||||
@@ -9,8 +9,16 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
void IoctlHelperXePrelim::setContextProperties(const OsContextLinux &osContext, void *extProperties, uint32_t &extIndexInOut) {
|
||||
IoctlHelperXe::setContextProperties(osContext, extProperties, extIndexInOut);
|
||||
bool IoctlHelperXePrelim::isPrimaryContext(const OsContextLinux &osContext, uint32_t deviceIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t IoctlHelperXePrelim::getPrimaryContextId(const OsContextLinux &osContext, uint32_t deviceIndex, size_t contextIndex) {
|
||||
return static_cast<uint32_t>(-1);
|
||||
}
|
||||
|
||||
void IoctlHelperXePrelim::setContextProperties(const OsContextLinux &osContext, uint32_t deviceIndex, void *extProperties, uint32_t &extIndexInOut) {
|
||||
IoctlHelperXe::setContextProperties(osContext, deviceIndex, extProperties, extIndexInOut);
|
||||
}
|
||||
|
||||
bool IoctlHelperXePrelim::getFdFromVmExport(uint32_t vmId, uint32_t flags, int32_t *fd) {
|
||||
|
||||
@@ -20,7 +20,9 @@ class IoctlHelperXePrelim : public IoctlHelperXe {
|
||||
std::string getIoctlString(DrmIoctl ioctlRequest) const override;
|
||||
|
||||
protected:
|
||||
void setContextProperties(const OsContextLinux &osContext, void *extProperties, uint32_t &extIndexInOut) override;
|
||||
virtual bool isPrimaryContext(const OsContextLinux &osContext, uint32_t deviceIndex);
|
||||
virtual uint32_t getPrimaryContextId(const OsContextLinux &osContext, uint32_t deviceIndex, size_t contextIndex);
|
||||
void setContextProperties(const OsContextLinux &osContext, uint32_t deviceIndex, void *extProperties, uint32_t &extIndexInOut) override;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -10,6 +10,7 @@ inline constexpr int testValueMapOff = 0x7788;
|
||||
inline constexpr int testValuePrime = 0x4321;
|
||||
inline constexpr uint32_t testValueGemCreate = 0x8273;
|
||||
struct DrmMockXe : public DrmMockCustom {
|
||||
using Drm::engineInfo;
|
||||
|
||||
static std::unique_ptr<DrmMockXe> create(RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
|
||||
|
||||
@@ -2098,7 +2098,7 @@ TEST_F(IoctlHelperXeTest, givenLowPriorityContextWhenSettingPropertiesThenCorrec
|
||||
OsContextLinux osContext(*drm, 0, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::lowPriority}));
|
||||
std::array<drm_xe_ext_set_property, MockIoctlHelperXe::maxContextSetProperties> extProperties{};
|
||||
uint32_t extIndex = 1;
|
||||
xeIoctlHelper->setContextProperties(osContext, &extProperties, extIndex);
|
||||
xeIoctlHelper->setContextProperties(osContext, 0, &extProperties, extIndex);
|
||||
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(&extProperties[1]), extProperties[0].base.next_extension);
|
||||
EXPECT_EQ(0u, extProperties[1].base.next_extension);
|
||||
|
||||
Reference in New Issue
Block a user