mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Simplify preemption control on Linux
Change-Id: Ie0896cc8950f7fbb271b710b8bb221eb41ba0445 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
9e53740130
commit
f5508ed2d7
@@ -125,13 +125,15 @@ TEST(DrmTest, GivenDrmWhenAskedFor48BitAddressCorrectValueReturned) {
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
#if defined(I915_PARAM_HAS_PREEMPTION)
|
||||
TEST(DrmTest, GivenDrmWhenAskedForPreemptionCorrectValueReturned) {
|
||||
DrmMock *pDrm = new DrmMock;
|
||||
pDrm->StoredPreemptionSupport = 1;
|
||||
EXPECT_TRUE(pDrm->hasPreemption());
|
||||
pDrm->checkPreemptionSupport();
|
||||
EXPECT_TRUE(pDrm->isPreemptionSupported());
|
||||
|
||||
pDrm->StoredPreemptionSupport = 0;
|
||||
EXPECT_FALSE(pDrm->hasPreemption());
|
||||
pDrm->checkPreemptionSupport();
|
||||
EXPECT_FALSE(pDrm->isPreemptionSupported());
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
@@ -140,7 +142,7 @@ TEST(DrmTest, GivenDrmWhenAskedForContextThatPassedThenValidContextIdsReturned)
|
||||
EXPECT_EQ(0u, pDrm->lowPriorityContextId);
|
||||
pDrm->StoredRetVal = 0;
|
||||
pDrm->StoredCtxId = 2;
|
||||
EXPECT_TRUE(pDrm->contextCreate());
|
||||
pDrm->createLowPriorityContext();
|
||||
EXPECT_EQ(2u, pDrm->lowPriorityContextId);
|
||||
pDrm->StoredRetVal = 0;
|
||||
pDrm->StoredCtxId = 1;
|
||||
@@ -150,36 +152,17 @@ TEST(DrmTest, GivenDrmWhenAskedForContextThatPassedThenValidContextIdsReturned)
|
||||
TEST(DrmTest, GivenDrmWhenAskedForContextThatFailsThenFalseIsReturned) {
|
||||
DrmMock *pDrm = new DrmMock;
|
||||
pDrm->StoredRetVal = -1;
|
||||
EXPECT_FALSE(pDrm->contextCreate());
|
||||
EXPECT_THROW(pDrm->createLowPriorityContext(), std::exception);
|
||||
pDrm->StoredRetVal = 0;
|
||||
delete pDrm;
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenDrmWhenAskedForContextWithLowPriorityThatFailsThenFalseIsReturned) {
|
||||
DrmMock *pDrm = new DrmMock;
|
||||
EXPECT_TRUE(pDrm->contextCreate());
|
||||
pDrm->StoredRetVal = -1;
|
||||
EXPECT_FALSE(pDrm->setLowPriority());
|
||||
pDrm->StoredRetVal = 0;
|
||||
delete pDrm;
|
||||
}
|
||||
#else
|
||||
TEST(DrmTest, GivenDrmWhenAskedForContextWithLowPriorityThenFalseIsReturned) {
|
||||
DrmMock drmMock;
|
||||
EXPECT_FALSE(drmMock.contextCreate());
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenDrmWhenContextDestroyIsCalledThenThereAreNoLeaksOrCrashes) {
|
||||
DrmMock drmMock;
|
||||
drmMock.contextDestroy();
|
||||
drmMock.createLowPriorityContext();
|
||||
drmMock.destroyLowPriorityContext();
|
||||
}
|
||||
|
||||
TEST(DrmTest, GivenDrmWhenSetContextPriorityIsCalledThenFalseIsReturned) {
|
||||
DrmMock drmMock;
|
||||
EXPECT_FALSE(drmMock.setLowPriority());
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(DrmTest, getExecSoftPin) {
|
||||
DrmMock *pDrm = new DrmMock;
|
||||
int execSoftPin = 0;
|
||||
|
||||
Reference in New Issue
Block a user