Fix ioctl call for context persistence change

Change-Id: I2b6048b812abdc00f07d549423901a2b0e85f7ee
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2020-02-06 15:48:24 +01:00
committed by sys_ocldev
parent d5a1eee8fa
commit 916f867685
8 changed files with 57 additions and 37 deletions

View File

@@ -212,16 +212,10 @@ bool Drm::setQueueSliceCount(uint64_t sliceCount) {
return false;
}
void Drm::checkNonPersistentContextsSupport() {
void Drm::checkContextPersistenceChangeSupport() {
drm_i915_gem_context_param contextParam = {};
contextParam.param = I915_CONTEXT_PARAM_PERSISTENCE;
auto retVal = ioctl(DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &contextParam);
if (retVal == 0 && contextParam.value == 1) {
nonPersistentContextsSupported = true;
} else {
nonPersistentContextsSupported = false;
}
contextPersistenceChangeSupported = (ioctl(DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, &contextParam) == 0);
}
void Drm::setNonPersistentContext(uint32_t drmContextId) {
@@ -229,7 +223,12 @@ void Drm::setNonPersistentContext(uint32_t drmContextId) {
contextParam.ctx_id = drmContextId;
contextParam.param = I915_CONTEXT_PARAM_PERSISTENCE;
ioctl(DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &contextParam);
auto retVal = ioctl(DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &contextParam);
if (retVal == ENODEV) {
contextPersistenceChangeSupported = false;
} else {
UNRECOVERABLE_IF(retVal != 0);
}
}
uint32_t Drm::createDrmContext() {

View File

@@ -83,8 +83,8 @@ class Drm {
bool queryMemoryInfo();
int setupHardwareInfo(DeviceDescriptor *, bool);
bool areNonPersistentContextsSupported() const { return nonPersistentContextsSupported; }
void checkNonPersistentContextsSupport();
bool isContextPersistenceChangeSupported() const { return contextPersistenceChangeSupported; }
void checkContextPersistenceChangeSupport();
void setNonPersistentContext(uint32_t drmContextId);
MemoryInfo *getMemoryInfo() const {
@@ -99,8 +99,8 @@ class Drm {
bool sliceCountChangeSupported = false;
drm_i915_gem_context_param_sseu sseu{};
bool preemptionSupported = false;
bool nonPersistentContextsSupported = false;
std::unique_ptr<HwDeviceId> hwDeviceId;
bool contextPersistenceChangeSupported = false;
int deviceId = 0;
int revisionId = 0;
GTTYPE eGtType = GTTYPE_UNDEFINED;

View File

@@ -161,7 +161,7 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
outHwInfo->capabilityTable.ftrRenderCompressedBuffers = false;
outHwInfo->capabilityTable.ftrRenderCompressedImages = false;
drm->checkQueueSliceSupport();
drm->checkNonPersistentContextsSupport();
drm->checkContextPersistenceChangeSupport();
drm->checkPreemptionSupport();
bool preemption = drm->isPreemptionSupported();
PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable,

View File

@@ -27,7 +27,7 @@ OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield devi
for (auto deviceIndex = 0u; deviceIndex < deviceBitfield.size(); deviceIndex++) {
if (deviceBitfield.test(deviceIndex)) {
auto drmContextId = drm.createDrmContext();
if (drm.areNonPersistentContextsSupported()) {
if (drm.isContextPersistenceChangeSupported()) {
drm.setNonPersistentContext(drmContextId);
}
if (drm.isPreemptionSupported() && lowPriority) {