mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Always use unrecoverable drm context
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
5a2f00d295
commit
343371faad
@ -29,7 +29,7 @@ void IoctlHelper::fillExecObject(ExecObject &execObject, uint32_t handle, uint64
|
||||
|
||||
auto &drmExecObject = *reinterpret_cast<drm_i915_gem_exec_object2 *>(execObject.data);
|
||||
drmExecObject.handle = handle;
|
||||
drmExecObject.relocation_count = 0; //No relocations, we are SoftPinning
|
||||
drmExecObject.relocation_count = 0; // No relocations, we are SoftPinning
|
||||
drmExecObject.relocs_ptr = 0ul;
|
||||
drmExecObject.alignment = 0;
|
||||
drmExecObject.offset = gpuAddress;
|
||||
@ -91,9 +91,7 @@ uint32_t IoctlHelper::createDrmContext(Drm &drm, OsContextLinux &osContext, uint
|
||||
drm.setNonPersistentContext(drmContextId);
|
||||
}
|
||||
|
||||
if (drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled()) {
|
||||
drm.setUnrecoverableContext(drmContextId);
|
||||
}
|
||||
drm.setUnrecoverableContext(drmContextId);
|
||||
|
||||
if (debuggableContext) {
|
||||
drm.setContextDebugFlag(drmContextId);
|
||||
|
@ -106,6 +106,8 @@ int DrmMock::ioctl(DrmIoctl request, void *arg) {
|
||||
receivedContextParamRequestCount++;
|
||||
receivedContextParamRequest = *reinterpret_cast<GemContextParam *>(&receivedContextCreateSetParam.param);
|
||||
if (receivedContextCreateSetParam.param.param == I915_CONTEXT_PARAM_VM) {
|
||||
this->requestSetVmId = receivedContextParamRequest.value;
|
||||
|
||||
return this->storedRetVal;
|
||||
}
|
||||
}
|
||||
@ -152,10 +154,12 @@ int DrmMock::ioctl(DrmIoctl request, void *arg) {
|
||||
return this->storedRetValForPersistant;
|
||||
}
|
||||
if (receivedContextParamRequest.param == I915_CONTEXT_PARAM_VM) {
|
||||
this->requestSetVmId = receivedContextParamRequest.value;
|
||||
return this->storedRetVal;
|
||||
}
|
||||
if (receivedContextParamRequest.param == I915_CONTEXT_PARAM_RECOVERABLE) {
|
||||
receivedRecoverableContextValue = receivedContextParamRequest.value;
|
||||
unrecoverableContextSet = true;
|
||||
return this->storedRetVal;
|
||||
}
|
||||
}
|
||||
@ -226,7 +230,7 @@ int DrmMock::ioctl(DrmIoctl request, void *arg) {
|
||||
if (request == DrmIoctl::PrimeFdToHandle) {
|
||||
ioctlCount.primeFdToHandle++;
|
||||
auto primeToHandleParams = static_cast<PrimeHandle *>(arg);
|
||||
//return BO
|
||||
// return BO
|
||||
primeToHandleParams->handle = outputHandle;
|
||||
inputFd = primeToHandleParams->fileDescriptor;
|
||||
return fdToHandleRetVal;
|
||||
|
@ -192,6 +192,7 @@ class DrmMock : public Drm {
|
||||
bool callBaseIsVmBindAvailable = false;
|
||||
bool callBaseIsSetPairAvailable = false;
|
||||
bool callBaseGetSetPairAvailable = false;
|
||||
bool unrecoverableContextSet = false;
|
||||
|
||||
bool capturedCooperativeContextRequest = false;
|
||||
bool incrementVmId = false;
|
||||
@ -207,6 +208,7 @@ class DrmMock : public Drm {
|
||||
uint32_t receivedContextParamRequestCount = 0;
|
||||
GemContextParam receivedContextParamRequest = {};
|
||||
uint64_t receivedRecoverableContextValue = std::numeric_limits<uint64_t>::max();
|
||||
uint64_t requestSetVmId = std::numeric_limits<uint64_t>::max();
|
||||
|
||||
bool queryPageFaultSupportCalled = false;
|
||||
|
||||
|
@ -364,7 +364,7 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount);
|
||||
EXPECT_EQ(4u, drmMock.receivedContextParamRequestCount);
|
||||
}
|
||||
|
||||
TEST(DrmTest, whenCreatingDrmContextWithVirtualMemoryAddressSpaceThenProperVmIdIsSet) {
|
||||
@ -379,7 +379,9 @@ TEST(DrmTest, whenCreatingDrmContextWithVirtualMemoryAddressSpaceThenProperVmIdI
|
||||
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized();
|
||||
|
||||
EXPECT_EQ(drmMock.receivedContextParamRequest.value, drmMock.getVirtualMemoryAddressSpace(0u));
|
||||
EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount);
|
||||
|
||||
EXPECT_EQ(drmMock.requestSetVmId, static_cast<uint64_t>(drmMock.getVirtualMemoryAddressSpace(0u)));
|
||||
}
|
||||
|
||||
TEST(DrmTest, whenCreatingDrmContextWithNoVirtualMemoryAddressSpaceThenProperContextIdIsSet) {
|
||||
@ -395,7 +397,7 @@ TEST(DrmTest, whenCreatingDrmContextWithNoVirtualMemoryAddressSpaceThenProperCon
|
||||
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized();
|
||||
|
||||
EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount);
|
||||
EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount); // unrecoverable context
|
||||
}
|
||||
|
||||
TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextIsCreatedThenReceivedContextParamRequestCountReturnsCorrectValue) {
|
||||
@ -404,7 +406,7 @@ TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextI
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto expectedCount = 0u;
|
||||
auto expectedCount = 1u; // unrecoverable context
|
||||
|
||||
{
|
||||
drmMock.storedRetValForPersistant = -1;
|
||||
@ -420,7 +422,7 @@ TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextI
|
||||
++expectedCount;
|
||||
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized();
|
||||
expectedCount += 2;
|
||||
expectedCount += 3;
|
||||
EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount);
|
||||
}
|
||||
}
|
||||
@ -438,17 +440,17 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext
|
||||
OsContextLinux osContext2(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::LowPriority}));
|
||||
osContext2.ensureContextInitialized();
|
||||
|
||||
EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount);
|
||||
EXPECT_EQ(4u, drmMock.receivedContextParamRequestCount);
|
||||
|
||||
drmMock.preemptionSupported = true;
|
||||
|
||||
OsContextLinux osContext3(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext3.ensureContextInitialized();
|
||||
EXPECT_EQ(3u, drmMock.receivedContextParamRequestCount);
|
||||
EXPECT_EQ(6u, drmMock.receivedContextParamRequestCount);
|
||||
|
||||
OsContextLinux osContext4(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::LowPriority}));
|
||||
osContext4.ensureContextInitialized();
|
||||
EXPECT_EQ(5u, drmMock.receivedContextParamRequestCount);
|
||||
EXPECT_EQ(9u, drmMock.receivedContextParamRequestCount);
|
||||
EXPECT_EQ(drmMock.storedDrmContextId, drmMock.receivedContextParamRequest.contextId);
|
||||
EXPECT_EQ(static_cast<uint64_t>(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param);
|
||||
EXPECT_EQ(static_cast<uint64_t>(-1023), drmMock.receivedContextParamRequest.value);
|
||||
@ -739,7 +741,7 @@ TEST(DrmTest, givenNoPerContextVmsDrmWhenCreatingOsContextsThenVmIdIsNotQueriedA
|
||||
|
||||
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized();
|
||||
EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount);
|
||||
EXPECT_EQ(2u, drmMock.receivedContextParamRequestCount);
|
||||
|
||||
auto &drmVmIds = osContext.getDrmVmIds();
|
||||
EXPECT_EQ(0u, drmVmIds.size());
|
||||
@ -871,6 +873,7 @@ TEST(DrmTest, givenProgramDebuggingWhenCreatingContextThenUnrecoverableContextIs
|
||||
OsContextLinux osContext(drm, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized();
|
||||
|
||||
EXPECT_TRUE(drm.unrecoverableContextSet);
|
||||
EXPECT_EQ(0u, drm.receivedRecoverableContextValue);
|
||||
EXPECT_EQ(2u, drm.receivedContextParamRequestCount);
|
||||
}
|
||||
|
Reference in New Issue
Block a user