diff --git a/runtime/command_stream/command_stream_receiver.h b/runtime/command_stream/command_stream_receiver.h index 9e0c927505..b2023d820d 100644 --- a/runtime/command_stream/command_stream_receiver.h +++ b/runtime/command_stream/command_stream_receiver.h @@ -73,7 +73,7 @@ class CommandStreamReceiver { virtual bool flushBatchedSubmissions() = 0; - virtual void makeResident(GraphicsAllocation &gfxAllocation); + MOCKABLE_VIRTUAL void makeResident(GraphicsAllocation &gfxAllocation); virtual void makeNonResident(GraphicsAllocation &gfxAllocation); MOCKABLE_VIRTUAL void makeSurfacePackNonResident(ResidencyContainer &allocationsForResidency); virtual void processResidency(const ResidencyContainer &allocationsForResidency) {} diff --git a/runtime/os_interface/linux/drm_command_stream.h b/runtime/os_interface/linux/drm_command_stream.h index 76fe8a5e91..197f535702 100644 --- a/runtime/os_interface/linux/drm_command_stream.h +++ b/runtime/os_interface/linux/drm_command_stream.h @@ -38,7 +38,6 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver { gemCloseWorkerMode mode = gemCloseWorkerMode::gemCloseWorkerActive); bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override; - void makeResident(GraphicsAllocation &gfxAllocation) override; void processResidency(const ResidencyContainer &allocationsForResidency) override; void makeNonResident(GraphicsAllocation &gfxAllocation) override; bool waitForFlushStamp(FlushStamp &flushStampToWait) override; diff --git a/runtime/os_interface/linux/drm_command_stream.inl b/runtime/os_interface/linux/drm_command_stream.inl index 82a57803d2..de331a2b96 100644 --- a/runtime/os_interface/linux/drm_command_stream.inl +++ b/runtime/os_interface/linux/drm_command_stream.inl @@ -93,15 +93,6 @@ void DrmCommandStreamReceiver::exec(const BatchBuffer &batchBuffer, u this->residency.clear(); } -template -void DrmCommandStreamReceiver::makeResident(GraphicsAllocation &gfxAllocation) { - - if (gfxAllocation.getUnderlyingBufferSize() == 0) - return; - - CommandStreamReceiver::makeResident(gfxAllocation); -} - template void DrmCommandStreamReceiver::makeResident(BufferObject *bo) { if (bo) { diff --git a/runtime/os_interface/windows/wddm_device_command_stream.h b/runtime/os_interface/windows/wddm_device_command_stream.h index 132f9d98cf..9d0a1682ba 100644 --- a/runtime/os_interface/windows/wddm_device_command_stream.h +++ b/runtime/os_interface/windows/wddm_device_command_stream.h @@ -25,7 +25,6 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver virtual ~WddmCommandStreamReceiver(); bool flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override; - void makeResident(GraphicsAllocation &gfxAllocation) override; void processResidency(const ResidencyContainer &allocationsForResidency) override; void processEviction() override; bool waitForFlushStamp(FlushStamp &flushStampToWait) override; diff --git a/runtime/os_interface/windows/wddm_device_command_stream.inl b/runtime/os_interface/windows/wddm_device_command_stream.inl index 9233806167..ea71c0fe27 100644 --- a/runtime/os_interface/windows/wddm_device_command_stream.inl +++ b/runtime/os_interface/windows/wddm_device_command_stream.inl @@ -103,21 +103,6 @@ bool WddmCommandStreamReceiver::flush(BatchBuffer &batchBuffer, Resid return status; } -template -void WddmCommandStreamReceiver::makeResident(GraphicsAllocation &gfxAllocation) { - DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation =", &gfxAllocation); - - if (gfxAllocation.fragmentsStorage.fragmentCount == 0) { - DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "allocation default handle =", static_cast(gfxAllocation).getDefaultHandle()); - } else { - for (uint32_t allocationId = 0; allocationId < gfxAllocation.fragmentsStorage.fragmentCount; allocationId++) { - DBG_LOG(ResidencyDebugEnable, "Residency:", __FUNCTION__, "fragment handle =", gfxAllocation.fragmentsStorage.fragmentStorageData[allocationId].osHandleStorage->handle); - } - } - - CommandStreamReceiver::makeResident(gfxAllocation); -} - template void WddmCommandStreamReceiver::processResidency(const ResidencyContainer &allocationsForResidency) { bool success = static_cast(osContext)->getResidencyController().makeResidentResidencyAllocations(allocationsForResidency); diff --git a/unit_tests/mocks/linux/mock_drm_command_stream_receiver.h b/unit_tests/mocks/linux/mock_drm_command_stream_receiver.h index e9b6500c80..67a5854ecf 100644 --- a/unit_tests/mocks/linux/mock_drm_command_stream_receiver.h +++ b/unit_tests/mocks/linux/mock_drm_command_stream_receiver.h @@ -14,6 +14,7 @@ template class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver { public: using CommandStreamReceiver::commandStream; + using CommandStreamReceiver::makeResident; using DrmCommandStreamReceiver::makeResidentBufferObjects; using DrmCommandStreamReceiver::residency; using CommandStreamReceiverHw::CommandStreamReceiver::lastSentSliceCount; diff --git a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp index 22f1071961..3821dddd17 100644 --- a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp +++ b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp @@ -1096,18 +1096,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, GivenTwoAllocationsWhenBackingS csr->getResidencyAllocations().clear(); } -HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, makeResidentSizeZero) { - std::unique_ptr buffer(this->createBO(0)); - DrmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, buffer.get(), nullptr, buffer->peekSize(), (osHandle)0u, MemoryPool::MemoryNull); - EXPECT_EQ(nullptr, allocation.getUnderlyingBuffer()); - EXPECT_EQ(buffer->peekSize(), allocation.getUnderlyingBufferSize()); - - csr->makeResident(allocation); - csr->processResidency(csr->getResidencyAllocations()); - - EXPECT_FALSE(isResident(buffer.get())); -} - HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, Flush) { auto &cs = csr->getCS(); auto commandBuffer = static_cast(cs.getGraphicsAllocation());