Add constructor parameter to select low priority context.

Change-Id: Ieb3fa008a2f1b54052e393516038c88f00944fa0
Signed-off-by: Piotr Fusik <piotr.fusik@intel.com>
This commit is contained in:
Piotr Fusik
2019-03-18 13:57:59 +01:00
committed by sys_ocldev
parent fa713b4e70
commit 429487fad0
34 changed files with 129 additions and 110 deletions

View File

@@ -43,7 +43,8 @@ class DrmCommandStreamFixture {
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setDrm(mock.get());
osContext = std::make_unique<OsContextLinux>(*mock, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
osContext = std::make_unique<OsContextLinux>(*mock, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
csr = new DrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], executionEnvironment,
gemCloseWorkerMode::gemCloseWorkerActive);
@@ -261,7 +262,8 @@ TEST_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdToAllExecBuff
.RetiresOnSaturation();
osContext = std::make_unique<OsContextLinux>(*mock, 1, 1,
HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false);
csr->setupContext(*osContext);
auto &cs = csr->getCS();

View File

@@ -157,14 +157,14 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
{
drmMock.StoredCtxId = drmContextId1;
OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled);
OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false);
EXPECT_EQ(drmContextId1, osContext1.getDrmContextId());
EXPECT_EQ(0u, drmMock.receivedDestroyContextId);
{
drmMock.StoredCtxId = drmContextId2;
OsContextLinux osContext2(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled);
OsContextLinux osContext2(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false);
EXPECT_EQ(drmContextId2, osContext2.getDrmContextId());
EXPECT_EQ(0u, drmMock.receivedDestroyContextId);
}
@@ -180,17 +180,17 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext
drmMock.StoredCtxId = 123;
drmMock.preemptionSupported = false;
OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled);
OsContextLinux osContext2(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled);
OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false);
OsContextLinux osContext2(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled, true);
EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount);
drmMock.preemptionSupported = true;
OsContextLinux osContext3(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled);
OsContextLinux osContext3(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false);
EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount);
OsContextLinux osContext4(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled);
OsContextLinux osContext4(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled, true);
EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount);
EXPECT_EQ(drmMock.StoredCtxId, drmMock.receivedContextParamRequest.ctx_id);
EXPECT_EQ(static_cast<uint64_t>(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param);