Making DSH and IOH always resident
Change-Id: Ib114b92cb5ee153f213c15c935f8f1d1cfeb46eb
This commit is contained in:
parent
d516cd6edc
commit
b0a6d9131a
|
@ -67,7 +67,11 @@ void CommandStreamReceiver::processEviction() {
|
|||
void CommandStreamReceiver::makeNonResident(GraphicsAllocation &gfxAllocation) {
|
||||
if (gfxAllocation.residencyTaskCount != ObjectNotResident) {
|
||||
makeCoherent(gfxAllocation);
|
||||
getMemoryManager()->pushAllocationForEviction(&gfxAllocation);
|
||||
if (gfxAllocation.peekEvictable()) {
|
||||
getMemoryManager()->pushAllocationForEviction(&gfxAllocation);
|
||||
} else {
|
||||
gfxAllocation.setEvictable(true);
|
||||
}
|
||||
}
|
||||
|
||||
gfxAllocation.residencyTaskCount = ObjectNotResident;
|
||||
|
|
|
@ -299,8 +299,10 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
|||
auto sshAllocation = ssh.getGraphicsAllocation();
|
||||
|
||||
this->makeResident(*dshAllocation);
|
||||
dshAllocation->setEvictable(false);
|
||||
this->makeResident(*iohAllocation);
|
||||
this->makeResident(*sshAllocation);
|
||||
iohAllocation->setEvictable(false);
|
||||
|
||||
this->makeResident(*tagAllocation);
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
|||
osHandle sharedHandle;
|
||||
bool locked = false;
|
||||
uint32_t reuseCount = 0; // GraphicsAllocation can be reused by shared resources
|
||||
bool evictable = true;
|
||||
|
||||
public:
|
||||
enum AllocationType {
|
||||
|
@ -126,6 +127,9 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
|||
|
||||
int residencyTaskCount = ObjectNotResident;
|
||||
|
||||
void setEvictable(bool evictable) { this->evictable = evictable; }
|
||||
bool peekEvictable() const { return evictable; }
|
||||
|
||||
bool isResident() const { return residencyTaskCount != ObjectNotResident; }
|
||||
void setLocked(bool locked) { this->locked = locked; }
|
||||
bool isLocked() const { return locked; }
|
||||
|
|
|
@ -315,6 +315,29 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu
|
|||
EXPECT_EQ(expectedUsedSize, commandStream.getUsed());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrWhenflushTaskThenDshAndIohNotEvictable) {
|
||||
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
|
||||
pDevice->resetCommandStreamReceiver(mockCsr);
|
||||
DispatchFlags dispatchFlags;
|
||||
|
||||
mockCsr->flushTask(commandStream,
|
||||
0,
|
||||
dsh,
|
||||
ioh,
|
||||
ssh,
|
||||
taskLevel,
|
||||
dispatchFlags);
|
||||
|
||||
EXPECT_EQ(dsh.getGraphicsAllocation()->peekEvictable(), true);
|
||||
EXPECT_EQ(ssh.getGraphicsAllocation()->peekEvictable(), true);
|
||||
EXPECT_EQ(ioh.getGraphicsAllocation()->peekEvictable(), true);
|
||||
|
||||
dsh.getGraphicsAllocation()->setEvictable(false);
|
||||
EXPECT_EQ(dsh.getGraphicsAllocation()->peekEvictable(), false);
|
||||
dsh.getGraphicsAllocation()->setEvictable(true);
|
||||
EXPECT_EQ(dsh.getGraphicsAllocation()->peekEvictable(), true);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeAndMidThreadPreemptionWhenFlushTaskIsCalledThenSipKernelIsMadeResident) {
|
||||
auto mockCsr = new MockCsrHw2<FamilyType>(*platformDevices[0]);
|
||||
pDevice->resetCommandStreamReceiver(mockCsr);
|
||||
|
|
|
@ -668,15 +668,21 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
|
|||
mockCsr->overrideSubmissionAggregator(mockedSubmissionsAggregator);
|
||||
|
||||
auto commandBuffer = memManager->allocateGraphicsMemory(1024, 4096);
|
||||
auto dshAlloc = memManager->allocateGraphicsMemory(1024, 4096);
|
||||
auto iohAlloc = memManager->allocateGraphicsMemory(1024, 4096);
|
||||
auto sshAlloc = memManager->allocateGraphicsMemory(1024, 4096);
|
||||
|
||||
mockCsr->setTagAllocation(tagAllocation);
|
||||
|
||||
LinearStream cs(commandBuffer);
|
||||
LinearStream dsh(dshAlloc);
|
||||
LinearStream ioh(iohAlloc);
|
||||
LinearStream ssh(sshAlloc);
|
||||
|
||||
DispatchFlags dispatchFlags;
|
||||
dispatchFlags.guardCommandBufferWithPipeControl = true;
|
||||
dispatchFlags.requiresCoherency = true;
|
||||
mockCsr->flushTask(cs, 0u, cs, cs, cs, 0u, dispatchFlags);
|
||||
mockCsr->flushTask(cs, 0u, dsh, ioh, ssh, 0u, dispatchFlags);
|
||||
|
||||
auto &cmdBuffers = mockedSubmissionsAggregator->peekCommandBuffers();
|
||||
auto storedCommandBuffer = cmdBuffers.peekHead();
|
||||
|
@ -692,11 +698,14 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
|
|||
auto csrCommandStream = mockCsr->commandStream.getGraphicsAllocation();
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(csrCommandStream->getUnderlyingBuffer()), mockWddm->submitResult.commandBufferSubmitted);
|
||||
EXPECT_TRUE(((COMMAND_BUFFER_HEADER *)mockWddm->submitResult.commandHeaderSubmitted)->RequiresCoherency);
|
||||
EXPECT_EQ(3u, mockWddm->makeResidentResult.handleCount);
|
||||
EXPECT_EQ(6u, mockWddm->makeResidentResult.handleCount);
|
||||
|
||||
std::vector<D3DKMT_HANDLE> expectedHandles;
|
||||
expectedHandles.push_back(((WddmAllocation *)tagAllocation)->handle);
|
||||
expectedHandles.push_back(((WddmAllocation *)commandBuffer)->handle);
|
||||
expectedHandles.push_back(((WddmAllocation *)dshAlloc)->handle);
|
||||
expectedHandles.push_back(((WddmAllocation *)iohAlloc)->handle);
|
||||
expectedHandles.push_back(((WddmAllocation *)sshAlloc)->handle);
|
||||
expectedHandles.push_back(((WddmAllocation *)csrCommandStream)->handle);
|
||||
|
||||
for (auto i = 0u; i < mockWddm->makeResidentResult.handleCount; i++) {
|
||||
|
@ -712,8 +721,14 @@ HWTEST_F(WddmCommandStreamMockGdiTest, givenRecordedCommandBufferWhenItIsSubmitt
|
|||
|
||||
EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)tagAllocation)->getTrimCandidateListPosition());
|
||||
EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)commandBuffer)->getTrimCandidateListPosition());
|
||||
EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)dshAlloc)->getTrimCandidateListPosition());
|
||||
EXPECT_EQ(trimListUnusedPosition, ((WddmAllocation *)iohAlloc)->getTrimCandidateListPosition());
|
||||
EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)sshAlloc)->getTrimCandidateListPosition());
|
||||
EXPECT_NE(trimListUnusedPosition, ((WddmAllocation *)csrCommandStream)->getTrimCandidateListPosition());
|
||||
|
||||
memManager->freeGraphicsMemory(dshAlloc);
|
||||
memManager->freeGraphicsMemory(iohAlloc);
|
||||
memManager->freeGraphicsMemory(sshAlloc);
|
||||
memManager->freeGraphicsMemory(commandBuffer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue