Remove handleId from DrmCommandStreamReceiver

pass it as a function argument

Resolves: NEO-3856
Change-Id: I796ca1236ead97d179aefa0684c1234452c94744
Signed-off-by: Jablonski, Mateusz <mateusz.jablonski@intel.com>
This commit is contained in:
Jablonski, Mateusz
2020-02-03 17:50:53 +01:00
committed by sys_ocldev
parent 124a598677
commit 5de70b9416
22 changed files with 64 additions and 65 deletions

View File

@@ -40,7 +40,7 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override; bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
void makeNonResident(GraphicsAllocation &gfxAllocation) override; void makeNonResident(GraphicsAllocation &gfxAllocation) override;
void processResidency(const ResidencyContainer &allocationsForResidency) override; void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
void makeResidentExternal(AllocationView &allocationView); void makeResidentExternal(AllocationView &allocationView);
void makeNonResidentExternal(uint64_t gpuAddress); void makeNonResidentExternal(uint64_t gpuAddress);

View File

@@ -319,7 +319,7 @@ bool AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer, Resi
allocationsForResidency.push_back(batchBuffer.commandBufferAllocation); allocationsForResidency.push_back(batchBuffer.commandBufferAllocation);
processResidency(allocationsForResidency); processResidency(allocationsForResidency, 0u);
if (!this->standalone || DebugManager.flags.FlattenBatchBufferForAUBDump.get()) { if (!this->standalone || DebugManager.flags.FlattenBatchBufferForAUBDump.get()) {
allocationsForResidency.pop_back(); allocationsForResidency.pop_back();
@@ -700,7 +700,7 @@ int32_t AUBCommandStreamReceiverHw<GfxFamily>::expectMemory(const void *gfxAddre
} }
template <typename GfxFamily> template <typename GfxFamily>
void AUBCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency) { void AUBCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
if (subCaptureManager->isSubCaptureMode()) { if (subCaptureManager->isSubCaptureMode()) {
if (!subCaptureManager->isSubCaptureEnabled()) { if (!subCaptureManager->isSubCaptureEnabled()) {
return; return;

View File

@@ -74,7 +74,7 @@ class CommandStreamReceiver {
MOCKABLE_VIRTUAL void makeResident(GraphicsAllocation &gfxAllocation); MOCKABLE_VIRTUAL void makeResident(GraphicsAllocation &gfxAllocation);
virtual void makeNonResident(GraphicsAllocation &gfxAllocation); virtual void makeNonResident(GraphicsAllocation &gfxAllocation);
MOCKABLE_VIRTUAL void makeSurfacePackNonResident(ResidencyContainer &allocationsForResidency); MOCKABLE_VIRTUAL void makeSurfacePackNonResident(ResidencyContainer &allocationsForResidency);
virtual void processResidency(const ResidencyContainer &allocationsForResidency) {} virtual void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {}
virtual void processEviction(); virtual void processEviction();
void makeResidentHostPtrAllocation(GraphicsAllocation *gfxAllocation); void makeResidentHostPtrAllocation(GraphicsAllocation *gfxAllocation);

View File

@@ -45,7 +45,7 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
void downloadAllocation(GraphicsAllocation &gfxAllocation) override; void downloadAllocation(GraphicsAllocation &gfxAllocation) override;
void processEviction() override; void processEviction() override;
void processResidency(const ResidencyContainer &allocationsForResidency) override; void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) override; void writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits) override;
bool writeMemory(GraphicsAllocation &gfxAllocation) override; bool writeMemory(GraphicsAllocation &gfxAllocation) override;

View File

@@ -216,7 +216,7 @@ bool TbxCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer, Resi
batchBuffer.commandBufferAllocation->updateTaskCount(submissionTaskCount, osContext->getContextId()); batchBuffer.commandBufferAllocation->updateTaskCount(submissionTaskCount, osContext->getContextId());
// Write allocations for residency // Write allocations for residency
processResidency(allocationsForResidency); processResidency(allocationsForResidency, 0u);
if (subCaptureManager) { if (subCaptureManager) {
if (aubManager) { if (aubManager) {
@@ -454,7 +454,7 @@ void TbxCommandStreamReceiverHw<GfxFamily>::processEviction() {
} }
template <typename GfxFamily> template <typename GfxFamily>
void TbxCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency) { void TbxCommandStreamReceiverHw<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
for (auto &gfxAllocation : allocationsForResidency) { for (auto &gfxAllocation : allocationsForResidency) {
if (dumpTbxNonWritable) { if (dumpTbxNonWritable) {
this->setTbxWritable(true, *gfxAllocation); this->setTbxWritable(true, *gfxAllocation);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017-2019 Intel Corporation * Copyright (C) 2017-2020 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -38,7 +38,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
gemCloseWorkerMode mode = gemCloseWorkerMode::gemCloseWorkerActive); gemCloseWorkerMode mode = gemCloseWorkerMode::gemCloseWorkerActive);
bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override; bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
void processResidency(const ResidencyContainer &allocationsForResidency) override; void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
void makeNonResident(GraphicsAllocation &gfxAllocation) override; void makeNonResident(GraphicsAllocation &gfxAllocation) override;
bool waitForFlushStamp(FlushStamp &flushStampToWait) override; bool waitForFlushStamp(FlushStamp &flushStampToWait) override;
@@ -50,7 +50,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
} }
protected: protected:
void makeResidentBufferObjects(const DrmAllocation *drmAllocation); void makeResidentBufferObjects(const DrmAllocation *drmAllocation, uint32_t handleId);
void makeResident(BufferObject *bo); void makeResident(BufferObject *bo);
void flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency); void flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency);
void exec(const BatchBuffer &batchBuffer, uint32_t drmContextId); void exec(const BatchBuffer &batchBuffer, uint32_t drmContextId);
@@ -59,6 +59,5 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily> {
std::vector<drm_i915_gem_exec_object2> execObjectsStorage; std::vector<drm_i915_gem_exec_object2> execObjectsStorage;
Drm *drm; Drm *drm;
gemCloseWorkerMode gemCloseWorkerOperationMode; gemCloseWorkerMode gemCloseWorkerOperationMode;
uint32_t handleIndex = 0u;
}; };
} // namespace NEO } // namespace NEO

View File

@@ -111,7 +111,7 @@ void DrmCommandStreamReceiver<GfxFamily>::makeResident(BufferObject *bo) {
} }
template <typename GfxFamily> template <typename GfxFamily>
void DrmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &inputAllocationsForResidency) { void DrmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &inputAllocationsForResidency, uint32_t handleId) {
for (auto &alloc : inputAllocationsForResidency) { for (auto &alloc : inputAllocationsForResidency) {
auto drmAlloc = static_cast<const DrmAllocation *>(alloc); auto drmAlloc = static_cast<const DrmAllocation *>(alloc);
if (drmAlloc->fragmentsStorage.fragmentCount) { if (drmAlloc->fragmentsStorage.fragmentCount) {
@@ -123,7 +123,7 @@ void DrmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContai
} }
} }
} else { } else {
makeResidentBufferObjects(drmAlloc); makeResidentBufferObjects(drmAlloc, handleId);
} }
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019 Intel Corporation * Copyright (C) 2019-2020 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -10,14 +10,14 @@
namespace NEO { namespace NEO {
template <typename GfxFamily> template <typename GfxFamily>
void DrmCommandStreamReceiver<GfxFamily>::makeResidentBufferObjects(const DrmAllocation *drmAllocation) { void DrmCommandStreamReceiver<GfxFamily>::makeResidentBufferObjects(const DrmAllocation *drmAllocation, uint32_t handleId) {
auto bo = drmAllocation->getBO(); auto bo = drmAllocation->getBO();
makeResident(bo); makeResident(bo);
} }
template <typename GfxFamily> template <typename GfxFamily>
void DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency) { void DrmCommandStreamReceiver<GfxFamily>::flushInternal(const BatchBuffer &batchBuffer, const ResidencyContainer &allocationsForResidency) {
this->processResidency(allocationsForResidency); this->processResidency(allocationsForResidency, 0u);
this->exec(batchBuffer, static_cast<const OsContextLinux *>(osContext)->getDrmContextIds()[0]); this->exec(batchBuffer, static_cast<const OsContextLinux *>(osContext)->getDrmContextIds()[0]);
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017-2019 Intel Corporation * Copyright (C) 2017-2020 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -25,7 +25,7 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
virtual ~WddmCommandStreamReceiver(); virtual ~WddmCommandStreamReceiver();
bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override; bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
void processResidency(const ResidencyContainer &allocationsForResidency) override; void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override;
void processEviction() override; void processEviction() override;
bool waitForFlushStamp(FlushStamp &flushStampToWait) override; bool waitForFlushStamp(FlushStamp &flushStampToWait) override;

View File

@@ -73,7 +73,7 @@ bool WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer, Resid
batchBuffer.commandBufferAllocation->updateResidencyTaskCount(this->taskCount, this->osContext->getContextId()); batchBuffer.commandBufferAllocation->updateResidencyTaskCount(this->taskCount, this->osContext->getContextId());
} }
this->processResidency(allocationsForResidency); this->processResidency(allocationsForResidency, 0u);
COMMAND_BUFFER_HEADER *pHeader = reinterpret_cast<COMMAND_BUFFER_HEADER *>(commandBufferHeader); COMMAND_BUFFER_HEADER *pHeader = reinterpret_cast<COMMAND_BUFFER_HEADER *>(commandBufferHeader);
pHeader->RequiresCoherency = batchBuffer.requiresCoherency; pHeader->RequiresCoherency = batchBuffer.requiresCoherency;
@@ -108,7 +108,7 @@ bool WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchBuffer, Resid
} }
template <typename GfxFamily> template <typename GfxFamily>
void WddmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency) { void WddmCommandStreamReceiver<GfxFamily>::processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) {
bool success = static_cast<OsContextWin *>(osContext)->getResidencyController().makeResidentResidencyAllocations(allocationsForResidency); bool success = static_cast<OsContextWin *>(osContext)->getResidencyController().makeResidentResidencyAllocations(allocationsForResidency);
DEBUG_BREAK_IF(!success); DEBUG_BREAK_IF(!success);
} }

View File

@@ -105,7 +105,7 @@ TEST_F(AUBcommandstreamTests, makeResident) {
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();
auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(buffer, size); auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(buffer, size);
ResidencyContainer allocationsForResidency = {graphicsAllocation}; ResidencyContainer allocationsForResidency = {graphicsAllocation};
commandStreamReceiver.processResidency(allocationsForResidency); commandStreamReceiver.processResidency(allocationsForResidency, 0u);
} }
HWTEST_F(AUBcommandstreamTests, expectMemorySingle) { HWTEST_F(AUBcommandstreamTests, expectMemorySingle) {
@@ -113,7 +113,7 @@ HWTEST_F(AUBcommandstreamTests, expectMemorySingle) {
size_t size = sizeof(buffer); size_t size = sizeof(buffer);
auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(&buffer, size); auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(&buffer, size);
ResidencyContainer allocationsForResidency = {graphicsAllocation}; ResidencyContainer allocationsForResidency = {graphicsAllocation};
pCommandStreamReceiver->processResidency(allocationsForResidency); pCommandStreamReceiver->processResidency(allocationsForResidency, 0u);
AUBCommandStreamFixture::expectMemory<FamilyType>(&buffer, &buffer, size); AUBCommandStreamFixture::expectMemory<FamilyType>(&buffer, &buffer, size);
} }
@@ -128,7 +128,7 @@ HWTEST_F(AUBcommandstreamTests, expectMemoryLarge) {
auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(buffer, sizeBuffer); auto graphicsAllocation = createResidentAllocationAndStoreItInCsr(buffer, sizeBuffer);
ResidencyContainer allocationsForResidency = {graphicsAllocation}; ResidencyContainer allocationsForResidency = {graphicsAllocation};
pCommandStreamReceiver->processResidency(allocationsForResidency); pCommandStreamReceiver->processResidency(allocationsForResidency, 0u);
AUBCommandStreamFixture::expectMemory<FamilyType>(buffer, buffer, sizeBuffer); AUBCommandStreamFixture::expectMemory<FamilyType>(buffer, buffer, sizeBuffer);
delete[] buffer; delete[] buffer;

View File

@@ -299,7 +299,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000); MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation}; ResidencyContainer allocationsForResidency = {&allocation};
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(aubCsr->writeMemoryCalled); EXPECT_FALSE(aubCsr->writeMemoryCalled);
} }
@@ -322,7 +322,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0); MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0);
ResidencyContainer allocationsForResidency = {&allocation}; ResidencyContainer allocationsForResidency = {&allocation};
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(aubCsr->writeMemoryCalled); EXPECT_FALSE(aubCsr->writeMemoryCalled);
} }
@@ -708,7 +708,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
ResidencyContainer allocationsForResidency = {gfxDefaultAllocation}; ResidencyContainer allocationsForResidency = {gfxDefaultAllocation};
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->isAubWritable(*gfxDefaultAllocation)); EXPECT_TRUE(aubCsr->isAubWritable(*gfxDefaultAllocation));
@@ -760,7 +760,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
auto gfxImageAllocation = MockGmm::allocateImage2d(*memoryManager); auto gfxImageAllocation = MockGmm::allocateImage2d(*memoryManager);
ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation}; ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation};
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(aubCsr->isAubWritable(*gfxBufferAllocation)); EXPECT_FALSE(aubCsr->isAubWritable(*gfxBufferAllocation));
EXPECT_FALSE(aubCsr->isAubWritable(*gfxImageAllocation)); EXPECT_FALSE(aubCsr->isAubWritable(*gfxImageAllocation));
@@ -785,7 +785,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
aubCsr->dumpAubNonWritable = true; aubCsr->dumpAubNonWritable = true;
ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation}; ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation};
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->isAubWritable(*gfxBufferAllocation)); EXPECT_TRUE(aubCsr->isAubWritable(*gfxBufferAllocation));
EXPECT_TRUE(aubCsr->isAubWritable(*gfxImageAllocation)); EXPECT_TRUE(aubCsr->isAubWritable(*gfxImageAllocation));
@@ -810,7 +810,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
aubCsr->dumpAubNonWritable = false; aubCsr->dumpAubNonWritable = false;
ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation}; ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation};
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(aubCsr->isAubWritable(*gfxBufferAllocation)); EXPECT_FALSE(aubCsr->isAubWritable(*gfxBufferAllocation));
EXPECT_FALSE(aubCsr->isAubWritable(*gfxImageAllocation)); EXPECT_FALSE(aubCsr->isAubWritable(*gfxImageAllocation));

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2019 Intel Corporation * Copyright (C) 2018-2020 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -624,7 +624,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
ASSERT_EQ(1u, aubCsr->externalAllocations.size()); ASSERT_EQ(1u, aubCsr->externalAllocations.size());
ResidencyContainer allocationsForResidency; ResidencyContainer allocationsForResidency;
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->writeMemoryParametrization.wasCalled); EXPECT_TRUE(aubCsr->writeMemoryParametrization.wasCalled);
EXPECT_EQ(addr, aubCsr->writeMemoryParametrization.receivedAllocationView.first); EXPECT_EQ(addr, aubCsr->writeMemoryParametrization.receivedAllocationView.first);
@@ -639,7 +639,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
ASSERT_EQ(1u, aubCsr->externalAllocations.size()); ASSERT_EQ(1u, aubCsr->externalAllocations.size());
ResidencyContainer allocationsForResidency; ResidencyContainer allocationsForResidency;
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->writeMemoryParametrization.wasCalled); EXPECT_TRUE(aubCsr->writeMemoryParametrization.wasCalled);
EXPECT_EQ(0u, aubCsr->writeMemoryParametrization.receivedAllocationView.first); EXPECT_EQ(0u, aubCsr->writeMemoryParametrization.receivedAllocationView.first);

View File

@@ -543,7 +543,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000); MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation}; ResidencyContainer allocationsForResidency = {&allocation};
aubCsr->processResidency(allocationsForResidency); aubCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr->writeMemoryCalled); EXPECT_TRUE(aubCsr->writeMemoryCalled);
} }
@@ -619,7 +619,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000); MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation}; ResidencyContainer allocationsForResidency = {&allocation};
aubCsr.processResidency(allocationsForResidency); aubCsr.processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(aubCsr.writeMemoryWithAubManagerCalled); EXPECT_TRUE(aubCsr.writeMemoryWithAubManagerCalled);
} }

View File

@@ -200,7 +200,7 @@ TEST_F(CommandStreamReceiverTest, WhenMakingResidentThenAllocationIsPushedToMemo
} }
TEST_F(CommandStreamReceiverTest, GivenNoParamatersWhenMakingResidentThenResidencyDoesNotOccur) { TEST_F(CommandStreamReceiverTest, GivenNoParamatersWhenMakingResidentThenResidencyDoesNotOccur) {
commandStreamReceiver->processResidency(commandStreamReceiver->getResidencyAllocations()); commandStreamReceiver->processResidency(commandStreamReceiver->getResidencyAllocations(), 0u);
auto &residencyAllocations = commandStreamReceiver->getResidencyAllocations(); auto &residencyAllocations = commandStreamReceiver->getResidencyAllocations();
EXPECT_EQ(0u, residencyAllocations.size()); EXPECT_EQ(0u, residencyAllocations.size());
} }

View File

@@ -40,7 +40,7 @@ struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
flushParametrization.receivedBatchBuffer = &batchBuffer; flushParametrization.receivedBatchBuffer = &batchBuffer;
flushParametrization.receivedEngine = osContext->getEngineType(); flushParametrization.receivedEngine = osContext->getEngineType();
flushParametrization.receivedAllocationsForResidency = &allocationsForResidency; flushParametrization.receivedAllocationsForResidency = &allocationsForResidency;
processResidency(allocationsForResidency); processResidency(allocationsForResidency, 0u);
flushStamp->setStamp(flushParametrization.flushStampToReturn); flushStamp->setStamp(flushParametrization.flushStampToReturn);
return true; return true;
} }
@@ -51,7 +51,7 @@ struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
gfxAllocation.updateResidencyTaskCount(1, osContext->getContextId()); gfxAllocation.updateResidencyTaskCount(1, osContext->getContextId());
} }
void processResidency(const ResidencyContainer &allocationsForResidency) override { void processResidency(const ResidencyContainer &allocationsForResidency, uint32_t handleId) override {
processResidencyParameterization.wasCalled = true; processResidencyParameterization.wasCalled = true;
processResidencyParameterization.receivedAllocationsForResidency = &allocationsForResidency; processResidencyParameterization.receivedAllocationsForResidency = &allocationsForResidency;
} }

View File

@@ -276,7 +276,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc
EXPECT_FALSE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId())); EXPECT_FALSE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
ResidencyContainer allocationsForResidency = {graphicsAllocation}; ResidencyContainer allocationsForResidency = {graphicsAllocation};
tbxCsr->processResidency(allocationsForResidency); tbxCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId())); EXPECT_TRUE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
EXPECT_EQ(tbxCsr->peekTaskCount() + 1, graphicsAllocation->getResidencyTaskCount(tbxCsr->getOsContext().getContextId())); EXPECT_EQ(tbxCsr->peekTaskCount() + 1, graphicsAllocation->getResidencyTaskCount(tbxCsr->getOsContext().getContextId()));
@@ -295,7 +295,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenProcessResidenc
EXPECT_FALSE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId())); EXPECT_FALSE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
ResidencyContainer allocationsForResidency = {graphicsAllocation}; ResidencyContainer allocationsForResidency = {graphicsAllocation};
tbxCsr->processResidency(allocationsForResidency); tbxCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId())); EXPECT_TRUE(graphicsAllocation->isResident(tbxCsr->getOsContext().getContextId()));
EXPECT_EQ(tbxCsr->peekTaskCount() + 1, graphicsAllocation->getResidencyTaskCount(tbxCsr->getOsContext().getContextId())); EXPECT_EQ(tbxCsr->peekTaskCount() + 1, graphicsAllocation->getResidencyTaskCount(tbxCsr->getOsContext().getContextId()));
@@ -522,7 +522,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000); MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation}; ResidencyContainer allocationsForResidency = {&allocation};
tbxCsr.processResidency(allocationsForResidency); tbxCsr.processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(tbxCsr.writeMemoryWithAubManagerCalled); EXPECT_TRUE(tbxCsr.writeMemoryWithAubManagerCalled);
} }
@@ -788,7 +788,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithDumpT
tbxCsr->dumpTbxNonWritable = true; tbxCsr->dumpTbxNonWritable = true;
ResidencyContainer allocationsForResidency = {gfxAllocation}; ResidencyContainer allocationsForResidency = {gfxAllocation};
tbxCsr->processResidency(allocationsForResidency); tbxCsr->processResidency(allocationsForResidency, 0u);
EXPECT_TRUE(tbxCsr->isTbxWritable(*gfxAllocation)); EXPECT_TRUE(tbxCsr->isTbxWritable(*gfxAllocation));
EXPECT_FALSE(tbxCsr->dumpTbxNonWritable); EXPECT_FALSE(tbxCsr->dumpTbxNonWritable);
@@ -808,7 +808,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithoutDu
EXPECT_FALSE(tbxCsr->dumpTbxNonWritable); EXPECT_FALSE(tbxCsr->dumpTbxNonWritable);
ResidencyContainer allocationsForResidency = {gfxAllocation}; ResidencyContainer allocationsForResidency = {gfxAllocation};
tbxCsr->processResidency(allocationsForResidency); tbxCsr->processResidency(allocationsForResidency, 0u);
EXPECT_FALSE(tbxCsr->isTbxWritable(*gfxAllocation)); EXPECT_FALSE(tbxCsr->isTbxWritable(*gfxAllocation));
EXPECT_FALSE(tbxCsr->dumpTbxNonWritable); EXPECT_FALSE(tbxCsr->dumpTbxNonWritable);

View File

@@ -122,7 +122,7 @@ class DrmCommandStreamEnhancedTest : public ::testing::Test {
template <typename GfxFamily> template <typename GfxFamily>
void makeResidentBufferObjects(const DrmAllocation *drmAllocation) { void makeResidentBufferObjects(const DrmAllocation *drmAllocation) {
static_cast<TestedDrmCommandStreamReceiver<GfxFamily> *>(csr)->makeResidentBufferObjects(drmAllocation); static_cast<TestedDrmCommandStreamReceiver<GfxFamily> *>(csr)->makeResidentBufferObjects(drmAllocation, 0u);
} }
template <typename GfxFamily> template <typename GfxFamily>

View File

@@ -565,7 +565,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenGemCloseWorkerInactiveMode
csr->makeResident(*dummyAllocation); csr->makeResident(*dummyAllocation);
EXPECT_EQ(1u, bo->getRefCount()); EXPECT_EQ(1u, bo->getRefCount());
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeNonResident(*dummyAllocation); csr->makeNonResident(*dummyAllocation);
EXPECT_EQ(1u, bo->getRefCount()); EXPECT_EQ(1u, bo->getRefCount());
@@ -585,7 +585,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenTwoAllocationsWhenBackingS
EXPECT_TRUE(allocation->isResident(osContextId)); EXPECT_TRUE(allocation->isResident(osContextId));
EXPECT_TRUE(allocation2->isResident(osContextId)); EXPECT_TRUE(allocation2->isResident(osContextId));
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(allocation->isResident(osContextId)); EXPECT_TRUE(allocation->isResident(osContextId));
EXPECT_TRUE(allocation2->isResident(osContextId)); EXPECT_TRUE(allocation2->isResident(osContextId));
@@ -840,7 +840,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResident) {
EXPECT_EQ(nullptr, allocation->getUnderlyingBuffer()); EXPECT_EQ(nullptr, allocation->getUnderlyingBuffer());
csr->makeResident(*allocation); csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(buffer)); EXPECT_TRUE(isResident<FamilyType>(buffer));
EXPECT_EQ(1u, buffer->getRefCount()); EXPECT_EQ(1u, buffer->getRefCount());
@@ -861,7 +861,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResidentOnly) {
csr->makeResident(*allocation1); csr->makeResident(*allocation1);
csr->makeResident(*allocation2); csr->makeResident(*allocation2);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(buffer1)); EXPECT_TRUE(isResident<FamilyType>(buffer1));
EXPECT_TRUE(isResident<FamilyType>(buffer2)); EXPECT_TRUE(isResident<FamilyType>(buffer2));
@@ -881,14 +881,14 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResidentTwice) {
auto allocation = new DrmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, buffer, nullptr, buffer->peekSize(), (osHandle)0u, MemoryPool::MemoryNull); auto allocation = new DrmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, buffer, nullptr, buffer->peekSize(), (osHandle)0u, MemoryPool::MemoryNull);
csr->makeResident(*allocation); csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(buffer)); EXPECT_TRUE(isResident<FamilyType>(buffer));
EXPECT_EQ(1u, buffer->getRefCount()); EXPECT_EQ(1u, buffer->getRefCount());
csr->getResidencyAllocations().clear(); csr->getResidencyAllocations().clear();
csr->makeResident(*allocation); csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(buffer)); EXPECT_TRUE(isResident<FamilyType>(buffer));
EXPECT_EQ(1u, buffer->getRefCount()); EXPECT_EQ(1u, buffer->getRefCount());
@@ -910,7 +910,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResidentTwiceWhenFragmentSt
csr->makeResident(*allocation); csr->makeResident(*allocation);
csr->makeResident(*allocation); csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
for (int i = 0; i < maxFragmentsCount; i++) { for (int i = 0; i < maxFragmentsCount; i++) {
ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr, ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr,
reqs.allocationFragments[i].allocationPtr); reqs.allocationFragments[i].allocationPtr);
@@ -946,7 +946,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFragmentedAllocationsWithR
csr->makeResident(*graphicsAllocation); csr->makeResident(*graphicsAllocation);
csr->makeResident(*graphicsAllocation2); csr->makeResident(*graphicsAllocation2);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
auto &osContext = csr->getOsContext(); auto &osContext = csr->getOsContext();
@@ -972,7 +972,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFragmentedAllocationsWithR
csr->makeResident(*graphicsAllocation); csr->makeResident(*graphicsAllocation);
csr->makeResident(*graphicsAllocation2); csr->makeResident(*graphicsAllocation2);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[0].residency->resident[osContext.getContextId()]); EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[0].residency->resident[osContext.getContextId()]);
EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[1].residency->resident[osContext.getContextId()]); EXPECT_TRUE(graphicsAllocation->fragmentsStorage.fragmentStorageData[1].residency->resident[osContext.getContextId()]);
@@ -1005,7 +1005,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenAllocationCreatedFromThree
ASSERT_EQ(3u, allocation->fragmentsStorage.fragmentCount); ASSERT_EQ(3u, allocation->fragmentsStorage.fragmentCount);
csr->makeResident(*allocation); csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
for (int i = 0; i < maxFragmentsCount; i++) { for (int i = 0; i < maxFragmentsCount; i++) {
ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr, ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr,
@@ -1036,7 +1036,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenAllocationsContainingDiffe
ASSERT_EQ(2u, reqs.requiredFragmentsCount); ASSERT_EQ(2u, reqs.requiredFragmentsCount);
csr->makeResident(*allocation); csr->makeResident(*allocation);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
for (unsigned int i = 0; i < reqs.requiredFragmentsCount; i++) { for (unsigned int i = 0; i < reqs.requiredFragmentsCount; i++) {
ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr, ASSERT_EQ(allocation->fragmentsStorage.fragmentStorageData[i].cpuPtr,
@@ -1061,7 +1061,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenAllocationsContainingDiffe
ASSERT_EQ(1u, reqs.requiredFragmentsCount); ASSERT_EQ(1u, reqs.requiredFragmentsCount);
csr->makeResident(*allocation2); csr->makeResident(*allocation2);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
for (unsigned int i = 0; i < reqs.requiredFragmentsCount; i++) { for (unsigned int i = 0; i < reqs.requiredFragmentsCount; i++) {
ASSERT_EQ(allocation2->fragmentsStorage.fragmentStorageData[i].cpuPtr, ASSERT_EQ(allocation2->fragmentsStorage.fragmentStorageData[i].cpuPtr,
@@ -1090,7 +1090,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenTwoAllocationsWhenBackingS
csr->makeResident(*allocation); csr->makeResident(*allocation);
csr->makeResident(*allocation2); csr->makeResident(*allocation2);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_EQ(getResidencyVector<FamilyType>().size(), 1u); EXPECT_EQ(getResidencyVector<FamilyType>().size(), 1u);
@@ -1124,7 +1124,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, ClearResidencyWhenFlushNotCalle
EXPECT_EQ(getResidencyVector<FamilyType>().size(), 0u); EXPECT_EQ(getResidencyVector<FamilyType>().size(), 0u);
csr->makeResident(*allocation1); csr->makeResident(*allocation1);
csr->makeResident(*allocation2); csr->makeResident(*allocation2);
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(isResident<FamilyType>(allocation1->getBO())); EXPECT_TRUE(isResident<FamilyType>(allocation1->getBO()));
EXPECT_TRUE(isResident<FamilyType>(allocation2->getBO())); EXPECT_TRUE(isResident<FamilyType>(allocation2->getBO()));
@@ -1266,7 +1266,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, MakeResidentClearResidencyAlloc
csr->makeResident(*allocation2); csr->makeResident(*allocation2);
EXPECT_NE(0u, csr->getResidencyAllocations().size()); EXPECT_NE(0u, csr->getResidencyAllocations().size());
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeSurfacePackNonResident(csr->getResidencyAllocations()); csr->makeSurfacePackNonResident(csr->getResidencyAllocations());
EXPECT_EQ(0u, csr->getResidencyAllocations().size()); EXPECT_EQ(0u, csr->getResidencyAllocations().size());
@@ -1284,7 +1284,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMultipleMakeResidentWhenMa
EXPECT_NE(0u, csr->getResidencyAllocations().size()); EXPECT_NE(0u, csr->getResidencyAllocations().size());
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeSurfacePackNonResident(csr->getResidencyAllocations()); csr->makeSurfacePackNonResident(csr->getResidencyAllocations());
EXPECT_EQ(0u, csr->getResidencyAllocations().size()); EXPECT_EQ(0u, csr->getResidencyAllocations().size());
@@ -1349,7 +1349,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, BufferResidency) {
//make it resident 8 times //make it resident 8 times
for (int c = 0; c < 8; c++) { for (int c = 0; c < 8; c++) {
csr->makeResident(*buffer->getGraphicsAllocation()); csr->makeResident(*buffer->getGraphicsAllocation());
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident(osContextId)); EXPECT_TRUE(buffer->getGraphicsAllocation()->isResident(osContextId));
EXPECT_EQ(buffer->getGraphicsAllocation()->getResidencyTaskCount(osContextId), csr->peekTaskCount() + 1); EXPECT_EQ(buffer->getGraphicsAllocation()->getResidencyTaskCount(osContextId), csr->peekTaskCount() + 1);
} }

View File

@@ -1948,7 +1948,7 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatShareTheSameBufferOb
testedCsr->makeResident(*graphicsAllocation2); testedCsr->makeResident(*graphicsAllocation2);
EXPECT_EQ(2u, testedCsr->getResidencyAllocations().size()); EXPECT_EQ(2u, testedCsr->getResidencyAllocations().size());
testedCsr->processResidency(testedCsr->getResidencyAllocations()); testedCsr->processResidency(testedCsr->getResidencyAllocations(), 0u);
EXPECT_EQ(1u, testedCsr->residency.size()); EXPECT_EQ(1u, testedCsr->residency.size());
@@ -1976,7 +1976,7 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatDoesnShareTheSameBuf
testedCsr->makeResident(*graphicsAllocation2); testedCsr->makeResident(*graphicsAllocation2);
EXPECT_EQ(2u, testedCsr->getResidencyAllocations().size()); EXPECT_EQ(2u, testedCsr->getResidencyAllocations().size());
testedCsr->processResidency(testedCsr->getResidencyAllocations()); testedCsr->processResidency(testedCsr->getResidencyAllocations(), 0u);
EXPECT_EQ(2u, testedCsr->residency.size()); EXPECT_EQ(2u, testedCsr->residency.size());

View File

@@ -715,7 +715,7 @@ TEST_F(WddmCommandStreamMockGdiTest, makeResidentClearsResidencyAllocations) {
EXPECT_EQ(trimListUnusedPosition, static_cast<WddmAllocation *>(commandBuffer)->getTrimCandidateListPosition(csr->getOsContext().getContextId())); EXPECT_EQ(trimListUnusedPosition, static_cast<WddmAllocation *>(commandBuffer)->getTrimCandidateListPosition(csr->getOsContext().getContextId()));
csr->processResidency(csr->getResidencyAllocations()); csr->processResidency(csr->getResidencyAllocations(), 0u);
csr->makeSurfacePackNonResident(csr->getResidencyAllocations()); csr->makeSurfacePackNonResident(csr->getResidencyAllocations());

View File

@@ -660,8 +660,8 @@ HWTEST_P(ProgramFromBinaryTest, givenIsaAllocationUsedByMultipleCsrsWhenItIsDele
csr0.makeResident(*kernelAllocation); csr0.makeResident(*kernelAllocation);
csr1.makeResident(*kernelAllocation); csr1.makeResident(*kernelAllocation);
csr0.processResidency(csr0.getResidencyAllocations()); csr0.processResidency(csr0.getResidencyAllocations(), 0u);
csr1.processResidency(csr1.getResidencyAllocations()); csr1.processResidency(csr1.getResidencyAllocations(), 0u);
csr0.makeNonResident(*kernelAllocation); csr0.makeNonResident(*kernelAllocation);
csr1.makeNonResident(*kernelAllocation); csr1.makeNonResident(*kernelAllocation);