diff --git a/shared/source/command_stream/command_stream_receiver.h b/shared/source/command_stream/command_stream_receiver.h index ed52200e82..d7f3de1b27 100644 --- a/shared/source/command_stream/command_stream_receiver.h +++ b/shared/source/command_stream/command_stream_receiver.h @@ -395,8 +395,6 @@ class CommandStreamReceiver { MOCKABLE_VIRTUAL bool isRcs() const; - virtual void initializeDefaultsForInternalEngine(){}; - virtual GraphicsAllocation *getClearColorAllocation() = 0; virtual void postInitFlagsSetup() = 0; diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index b3c3609caa..1a315509ba 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -478,11 +478,6 @@ bool Device::createEngine(EngineTypeUsage engineTypeUsage) { return false; } - bool internalUsage = (engineUsage == EngineUsage::internal); - if (internalUsage) { - commandStreamReceiver->initializeDefaultsForInternalEngine(); - } - if (commandStreamReceiver->needsPageTableManager()) { commandStreamReceiver->createPageTableManager(); } @@ -562,17 +557,11 @@ bool Device::initializeEngines() { } bool Device::createSecondaryEngine(CommandStreamReceiver *primaryCsr, EngineTypeUsage engineTypeUsage) { - auto engineUsage = engineTypeUsage.second; std::unique_ptr commandStreamReceiver = createCommandStreamReceiver(); if (!commandStreamReceiver) { return false; } - bool internalUsage = (engineUsage == EngineUsage::internal); - if (internalUsage) { - commandStreamReceiver->initializeDefaultsForInternalEngine(); - } - EngineDescriptor engineDescriptor(engineTypeUsage, getDeviceBitfield(), preemptionMode, false); auto osContext = executionEnvironment->memoryManager->createAndRegisterSecondaryOsContext(&primaryCsr->getOsContext(), commandStreamReceiver.get(), engineDescriptor); diff --git a/shared/source/os_interface/linux/drm_command_stream.h b/shared/source/os_interface/linux/drm_command_stream.h index 82fcf0e125..3bd9aa5f85 100644 --- a/shared/source/os_interface/linux/drm_command_stream.h +++ b/shared/source/os_interface/linux/drm_command_stream.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -40,8 +40,7 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver { // When drm is passed, DCSR will not free it at destruction DrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, - const DeviceBitfield deviceBitfield, - GemCloseWorkerMode mode = GemCloseWorkerMode::gemCloseWorkerActive); + const DeviceBitfield deviceBitfield); ~DrmCommandStreamReceiver() override; SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override; @@ -54,19 +53,13 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver { DrmMemoryManager *getMemoryManager() const; GmmPageTableMngr *createPageTableManager() override; - GemCloseWorkerMode peekGemCloseWorkerOperationMode() const { - return this->gemCloseWorkerOperationMode; - } - - void initializeDefaultsForInternalEngine() override { - gemCloseWorkerOperationMode = GemCloseWorkerMode::gemCloseWorkerInactive; - } - SubmissionStatus printBOsForSubmit(ResidencyContainer &allocationsForResidency, GraphicsAllocation &cmdBufferAllocation); bool waitUserFenceSupported() override { return isUserFenceWaitActive(); } bool waitUserFence(TaskCountType waitValue, uint64_t hostAddress, int64_t timeout, bool userInterrupt, uint32_t externalInterruptId, GraphicsAllocation *allocForInterruptWait) override; + bool isGemCloseWorkerActive() const; + using CommandStreamReceiver::pageTableManager; protected: @@ -78,7 +71,6 @@ class DrmCommandStreamReceiver : public DeviceCommandStreamReceiver { std::vector residency; std::vector execObjectsStorage; Drm *drm; - GemCloseWorkerMode gemCloseWorkerOperationMode; volatile uint32_t reserved = 0; int32_t kmdWaitTimeout = -1; diff --git a/shared/source/os_interface/linux/drm_command_stream.inl b/shared/source/os_interface/linux/drm_command_stream.inl index 12603039ea..932f43eda1 100644 --- a/shared/source/os_interface/linux/drm_command_stream.inl +++ b/shared/source/os_interface/linux/drm_command_stream.inl @@ -32,9 +32,8 @@ namespace NEO { template DrmCommandStreamReceiver::DrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, - const DeviceBitfield deviceBitfield, - GemCloseWorkerMode mode) - : BaseClass(executionEnvironment, rootDeviceIndex, deviceBitfield), gemCloseWorkerOperationMode(mode) { + const DeviceBitfield deviceBitfield) + : BaseClass(executionEnvironment, rootDeviceIndex, deviceBitfield) { auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get(); @@ -42,14 +41,6 @@ DrmCommandStreamReceiver::DrmCommandStreamReceiver(ExecutionEnvironme residency.reserve(512); execObjectsStorage.reserve(512); - if (this->drm->isVmBindAvailable()) { - gemCloseWorkerOperationMode = GemCloseWorkerMode::gemCloseWorkerInactive; - } - - if (debugManager.flags.EnableGemCloseWorker.get() != -1) { - gemCloseWorkerOperationMode = debugManager.flags.EnableGemCloseWorker.get() ? GemCloseWorkerMode::gemCloseWorkerActive : GemCloseWorkerMode::gemCloseWorkerInactive; - } - auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); auto &gfxCoreHelper = rootDeviceEnvironment->getHelper(); auto localMemoryEnabled = gfxCoreHelper.getEnableLocalMemory(*hwInfo); @@ -174,7 +165,7 @@ SubmissionStatus DrmCommandStreamReceiver::flush(BatchBuffer &batchBu auto ret = this->flushInternal(batchBuffer, allocationsForResidency); - if (this->gemCloseWorkerOperationMode == GemCloseWorkerMode::gemCloseWorkerActive) { + if (this->isGemCloseWorkerActive()) { bb->reference(); this->getMemoryManager()->peekGemCloseWorker()->push(bb); } @@ -377,6 +368,11 @@ bool DrmCommandStreamReceiver::waitUserFence(TaskCountType waitValue, return (ret == 0); } +template +bool DrmCommandStreamReceiver::isGemCloseWorkerActive() const { + return this->getMemoryManager()->peekGemCloseWorker() && !this->osContext->isInternalEngine() && this->getType() == CommandStreamReceiverType::hardware; +} + template bool DrmCommandStreamReceiver::isKmdWaitModeActive() { if (this->drm->isVmBindAvailable()) { diff --git a/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h b/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h index 529b1c2574..8b8f2f5696 100644 --- a/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h +++ b/shared/test/common/mocks/linux/mock_drm_command_stream_receiver.h @@ -46,15 +46,14 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver::blitterDirectSubmission; using CommandStreamReceiverHw::CommandStreamReceiver::lastSentSliceCount; - TestedDrmCommandStreamReceiver(GemCloseWorkerMode mode, - ExecutionEnvironment &executionEnvironment, + TestedDrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield) - : DrmCommandStreamReceiver(executionEnvironment, 0, deviceBitfield, mode) { + : DrmCommandStreamReceiver(executionEnvironment, 0, deviceBitfield) { } TestedDrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, const DeviceBitfield deviceBitfield) - : DrmCommandStreamReceiver(executionEnvironment, rootDeviceIndex, deviceBitfield, GemCloseWorkerMode::gemCloseWorkerInactive) { + : DrmCommandStreamReceiver(executionEnvironment, rootDeviceIndex, deviceBitfield) { } void overrideDispatchPolicy(DispatchMode overrideValue) { @@ -141,12 +140,11 @@ class TestedDrmCommandStreamReceiver : public DrmCommandStreamReceiver class TestedDrmCommandStreamReceiverWithFailingExec : public TestedDrmCommandStreamReceiver { public: - TestedDrmCommandStreamReceiverWithFailingExec(GemCloseWorkerMode mode, - ExecutionEnvironment &executionEnvironment, + TestedDrmCommandStreamReceiverWithFailingExec(ExecutionEnvironment &executionEnvironment, const DeviceBitfield deviceBitfield) - : TestedDrmCommandStreamReceiver(mode, - executionEnvironment, - deviceBitfield) { + : TestedDrmCommandStreamReceiver( + executionEnvironment, + deviceBitfield) { } TestedDrmCommandStreamReceiverWithFailingExec(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, diff --git a/shared/test/common/os_interface/linux/drm_command_stream_fixture.h b/shared/test/common/os_interface/linux/drm_command_stream_fixture.h index 2ae714a23c..515307b92c 100644 --- a/shared/test/common/os_interface/linux/drm_command_stream_fixture.h +++ b/shared/test/common/os_interface/linux/drm_command_stream_fixture.h @@ -59,7 +59,7 @@ class DrmCommandStreamTest : public ::testing::Test { PreemptionHelper::getDefaultPreemptionMode(*hwInfo))); osContext->ensureContextInitialized(false); - csr = new MockDrmCsr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerActive); + csr = new MockDrmCsr(executionEnvironment, 0, 1); ASSERT_NE(nullptr, csr); csr->setupContext(*osContext); diff --git a/shared/test/unit_test/os_interface/linux/device_command_stream_tests.cpp b/shared/test/unit_test/os_interface/linux/device_command_stream_tests.cpp index 7ccfbfdbd5..40e882a099 100644 --- a/shared/test/unit_test/os_interface/linux/device_command_stream_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/device_command_stream_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -16,6 +16,7 @@ #include "shared/source/os_interface/os_interface.h" #include "shared/test/common/fixtures/mock_aub_center_fixture.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" +#include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/helpers/execution_environment_helper.h" #include "shared/test/common/os_interface/linux/device_command_stream_fixture.h" #include "shared/test/common/test_macros/hw_test.h" @@ -47,18 +48,17 @@ HWTEST_F(DeviceCommandStreamLeaksTest, WhenCreatingDeviceCsrThenValidPointerIsRe EXPECT_NE(nullptr, ptr); } -HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) { - std::unique_ptr ptr(DeviceCommandStreamReceiver::create(false, *executionEnvironment, 0, 1)); - auto drmCsr = (DrmCommandStreamReceiver *)ptr.get(); - EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive); -} - HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWithAubDumWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) { + executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment); std::unique_ptr ptr(DeviceCommandStreamReceiver::create(true, *executionEnvironment, 0, 1)); + auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0, + EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::ThreadGroup, 0b1)); + ptr->setupContext(*osContext); auto drmCsrWithAubDump = (CommandStreamReceiverWithAUBDump> *)ptr.get(); - EXPECT_EQ(drmCsrWithAubDump->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive); + EXPECT_FALSE(drmCsrWithAubDump->isGemCloseWorkerActive()); auto aubCSR = static_cast> *>(ptr.get())->aubCSR.get(); EXPECT_NE(nullptr, aubCSR); + delete osContext; } HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenOsInterfaceIsNullptrThenValidateDrm) { @@ -74,36 +74,54 @@ HWTEST_F(DeviceCommandStreamLeaksTest, givenDisabledGemCloseWorkerWhenCsrIsCreat DebugManagerStateRestore restorer; debugManager.flags.EnableGemCloseWorker.set(0u); + executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment); + std::unique_ptr ptr(DeviceCommandStreamReceiver::create(false, *executionEnvironment, 0, 1)); + auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0, + EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::ThreadGroup, 0b1)); + ptr->setupContext(*osContext); auto drmCsr = (DrmCommandStreamReceiver *)ptr.get(); - EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerInactive); + EXPECT_FALSE(drmCsr->isGemCloseWorkerActive()); + delete osContext; } HWTEST_F(DeviceCommandStreamLeaksTest, givenEnabledGemCloseWorkerWhenCsrIsCreatedThenGemCloseWorkerActiveModeIsSelected) { DebugManagerStateRestore restorer; debugManager.flags.EnableGemCloseWorker.set(1u); + executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment); + std::unique_ptr ptr(DeviceCommandStreamReceiver::create(false, *executionEnvironment, 0, 1)); + auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0, + EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::ThreadGroup, 0b1)); + ptr->setupContext(*osContext); auto drmCsr = (DrmCommandStreamReceiver *)ptr.get(); - EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive); + EXPECT_TRUE(drmCsr->isGemCloseWorkerActive()); + delete osContext; } HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultGemCloseWorkerWhenCsrIsCreatedThenGemCloseWorkerActiveModeIsSelected) { + executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment); std::unique_ptr ptr(DeviceCommandStreamReceiver::create(false, *executionEnvironment, 0, 1)); + auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0, + EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::ThreadGroup, 0b1)); + ptr->setupContext(*osContext); auto drmCsr = (DrmCommandStreamReceiver *)ptr.get(); - EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive); + EXPECT_TRUE(drmCsr->isGemCloseWorkerActive()); + delete osContext; } -using DeviceCommandStreamSetInternalUsageTests = DeviceCommandStreamLeaksTest; - -HWTEST_F(DeviceCommandStreamSetInternalUsageTests, givenValidDrmCsrThenGemCloseWorkerOperationModeIsSetToInactiveWhenInternalUsageIsSet) { +HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultGemCloseWorkerWhenInternalCsrIsCreatedThenGemCloseWorkerInactiveModeIsSelected) { + executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment); std::unique_ptr ptr(DeviceCommandStreamReceiver::create(false, *executionEnvironment, 0, 1)); + auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0, + EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::internal}, PreemptionMode::ThreadGroup, 0b1)); + ptr->setupContext(*osContext); auto drmCsr = (DrmCommandStreamReceiver *)ptr.get(); - EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive); - drmCsr->initializeDefaultsForInternalEngine(); - EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerInactive); + EXPECT_FALSE(drmCsr->isGemCloseWorkerActive()); + delete osContext; } diff --git a/shared/test/unit_test/os_interface/linux/drm_command_stream_mm_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_command_stream_mm_tests.cpp index 6a33bbe804..1b8429f3f8 100644 --- a/shared/test/unit_test/os_interface/linux/drm_command_stream_mm_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_command_stream_mm_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -49,7 +49,7 @@ HWTEST_F(DrmCommandStreamMMTest, GivenForcePinThenMemoryManagerCreatesPinBb) { executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false); executionEnvironment.rootDeviceEnvironments[0]->initGmm(); - DrmCommandStreamReceiver csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + DrmCommandStreamReceiver csr(executionEnvironment, 0, 1); auto memoryManager = new TestedDrmMemoryManager(false, true, false, executionEnvironment); executionEnvironment.memoryManager.reset(memoryManager); @@ -69,7 +69,7 @@ HWTEST_F(DrmCommandStreamMMTest, givenForcePinDisabledWhenMemoryManagerIsCreated executionEnvironment.rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr(drm)); executionEnvironment.rootDeviceEnvironments[0]->initGmm(); - DrmCommandStreamReceiver csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + DrmCommandStreamReceiver csr(executionEnvironment, 0, 1); auto memoryManager = new TestedDrmMemoryManager(false, true, false, executionEnvironment); executionEnvironment.memoryManager.reset(memoryManager); diff --git a/shared/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp index 6a47e8c89b..64e96321f5 100644 --- a/shared/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp @@ -26,7 +26,7 @@ using namespace NEO; HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenL0ApiConfigWhenCreatingDrmCsrThenEnableImmediateDispatch) { VariableBackup backup(&apiTypeForUlts, ApiSpecificConfig::L0); - MockDrmCsr csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr csr(executionEnvironment, 0, 1); EXPECT_EQ(DispatchMode::immediateDispatch, csr.dispatchMode); } @@ -42,7 +42,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenEnabledDirectSubmissionWhenGetting debugManager.flags.EnableDrmCompletionFence.set(1); debugManager.flags.EnableDirectSubmission.set(1); debugManager.flags.DirectSubmissionDisableMonitorFence.set(0); - MockDrmCsr csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr csr(executionEnvironment, 0, 1); csr.setupContext(*osContext); EXPECT_EQ(nullptr, csr.completionFenceValuePointer); @@ -101,10 +101,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenExecBufferErrorWhenFlushInternalTh EXPECT_EQ(SubmissionStatus::outOfHostMemory, ret); } -HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDefaultDrmCSRWhenItIsCreatedThenGemCloseWorkerModeIsInactive) { - EXPECT_EQ(GemCloseWorkerMode::gemCloseWorkerInactive, static_cast *>(csr)->peekGemCloseWorkerOperationMode()); -} - HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenCommandStreamWhenItIsFlushedWithGemCloseWorkerInDefaultModeThenWorkerDecreasesTheRefCount) { auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize}); ASSERT_NE(nullptr, commandBuffer); @@ -263,13 +259,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDebugFlagSetWhenFlushingTh mm->freeGraphicsMemory(commandBuffer); } -HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmCsrCreatedWithInactiveGemCloseWorkerPolicyThenThreadIsNotCreated) { - TestedDrmCommandStreamReceiver testedCsr(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); - EXPECT_EQ(GemCloseWorkerMode::gemCloseWorkerInactive, testedCsr.peekGemCloseWorkerOperationMode()); -} - HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmAllocationWhenGetBufferObjectToModifyIsCalledForAGivenHandleIdThenTheCorrespondingBufferObjectGetsModified) { auto size = 1024u; auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, size, static_cast(0u), MemoryPool::memoryNull); @@ -968,9 +957,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); device->resetCommandStreamReceiver(testedCsr); @@ -999,9 +988,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_FALSE(testedCsr->useUserFenceWait); device->resetCommandStreamReceiver(testedCsr); @@ -1033,9 +1022,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = false; TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); device->resetCommandStreamReceiver(testedCsr); @@ -1063,9 +1052,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenWaitUserFenceFlagNotSetWhe debugManager.flags.EnableUserFenceForCompletionWait.set(0); TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_FALSE(testedCsr->useUserFenceWait); EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync()); device->resetCommandStreamReceiver(testedCsr); @@ -1104,9 +1093,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenGemWaitUsedWhenKmdTimeoutU debugManager.flags.EnableUserFenceForCompletionWait.set(0); TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_FALSE(testedCsr->useUserFenceWait); EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync()); device->resetCommandStreamReceiver(testedCsr); @@ -1129,9 +1118,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync()); device->resetCommandStreamReceiver(testedCsr); @@ -1178,9 +1167,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->configureGpuFaultCheckThreshold(); TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync()); @@ -1229,9 +1218,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = false; TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync()); device->resetCommandStreamReceiver(testedCsr); @@ -1257,9 +1246,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_FALSE(testedCsr->useUserFenceWait); EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync()); device->resetCommandStreamReceiver(testedCsr); @@ -1286,9 +1275,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; TestedDrmCommandStreamReceiver *testedCsr = - new TestedDrmCommandStreamReceiver(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + new TestedDrmCommandStreamReceiver( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync()); device->resetCommandStreamReceiver(testedCsr); @@ -1317,9 +1306,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; std::unique_ptr> testedCsr = - std::make_unique>(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + std::make_unique>( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync()); @@ -1334,9 +1323,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; std::unique_ptr> testedCsr = - std::make_unique>(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + std::make_unique>( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync()); @@ -1351,9 +1340,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; std::unique_ptr> testedCsr = - std::make_unique>(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + std::make_unique>( + *this->executionEnvironment, + 1); EXPECT_FALSE(testedCsr->useUserFenceWait); EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync()); @@ -1369,9 +1358,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; std::unique_ptr> testedCsr = - std::make_unique>(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + std::make_unique>( + *this->executionEnvironment, + 1); EXPECT_FALSE(testedCsr->useUserFenceWait); EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync()); @@ -1387,9 +1376,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, mock->isVmBindAvailableCall.returnValue = true; std::unique_ptr> testedCsr = - std::make_unique>(GemCloseWorkerMode::gemCloseWorkerInactive, - *this->executionEnvironment, - 1); + std::make_unique>( + *this->executionEnvironment, + 1); EXPECT_TRUE(testedCsr->useUserFenceWait); EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync()); @@ -1462,7 +1451,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContaine EncodeNoop::alignToCacheLine(cs); BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed()); - MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1); mockCsr.setupContext(*osContext.get()); auto res = mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations()); EXPECT_GT(operationHandler->mergeWithResidencyContainerCalled, 0u); @@ -1493,7 +1482,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContaine EncodeNoop::alignToCacheLine(cs); BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed()); - MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1); mockCsr.setupContext(*osContext.get()); auto res = mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations()); EXPECT_GT(operationHandler->mergeWithResidencyContainerCalled, 0u); @@ -1527,7 +1516,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenNoAllocsInMemoryOperationH EncodeNoop::alignToCacheLine(cs); BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed()); - MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1); mockCsr.setupContext(*osContext.get()); mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations()); @@ -1561,7 +1550,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocsInMemoryOperationHan EncodeNoop::alignToCacheLine(cs); BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed()); - MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1); mockCsr.setupContext(*osContext.get()); mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations()); diff --git a/shared/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp b/shared/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp index 01e7fa8967..7e40a20494 100644 --- a/shared/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_command_stream_tests_1.cpp @@ -1039,7 +1039,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmCommandStreamReceiverWhenCreate executionEnvironment.rootDeviceEnvironments[1]->initGmm(); executionEnvironment.rootDeviceEnvironments[1]->osInterface = std::make_unique(); executionEnvironment.rootDeviceEnvironments[1]->osInterface->setDriverModel(DrmMockCustom::create(*executionEnvironment.rootDeviceEnvironments[0])); - auto csr = std::make_unique>(executionEnvironment, 1, 1, GemCloseWorkerMode::gemCloseWorkerActive); + auto csr = std::make_unique>(executionEnvironment, 1, 1); auto pageTableManager = csr->createPageTableManager(); EXPECT_EQ(csr->pageTableManager.get(), pageTableManager); } @@ -1049,11 +1049,11 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenLocalMemoryEnabledWhenCreatingDrmC DebugManagerStateRestore restore; debugManager.flags.EnableLocalMemory.set(1); - MockDrmCsr csr1(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr csr1(executionEnvironment, 0, 1); EXPECT_EQ(DispatchMode::batchedDispatch, csr1.dispatchMode); debugManager.flags.CsrDispatchMode.set(static_cast(DispatchMode::immediateDispatch)); - MockDrmCsr csr2(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr csr2(executionEnvironment, 0, 1); EXPECT_EQ(DispatchMode::immediateDispatch, csr2.dispatchMode); } @@ -1061,11 +1061,11 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenLocalMemoryEnabledWhenCreatingDrmC DebugManagerStateRestore restore; debugManager.flags.EnableLocalMemory.set(0); - MockDrmCsr csr1(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr csr1(executionEnvironment, 0, 1); EXPECT_EQ(DispatchMode::immediateDispatch, csr1.dispatchMode); debugManager.flags.CsrDispatchMode.set(static_cast(DispatchMode::batchedDispatch)); - MockDrmCsr csr2(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive); + MockDrmCsr csr2(executionEnvironment, 0, 1); EXPECT_EQ(DispatchMode::batchedDispatch, csr2.dispatchMode); } } diff --git a/shared/test/unit_test/os_interface/linux/drm_command_stream_xehp_and_later_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_command_stream_xehp_and_later_prelim_tests.cpp index 590f04c02b..794f99e48a 100644 --- a/shared/test/unit_test/os_interface/linux/drm_command_stream_xehp_and_later_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_command_stream_xehp_and_later_prelim_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -360,8 +360,8 @@ class DrmCommandStreamForceTileTest : public ::testing::Test { } MockDrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield, - GemCloseWorkerMode mode, uint32_t inputHandleId) - : DrmCommandStreamReceiver(executionEnvironment, rootDeviceIndex, deviceBitfield, mode), expectedHandleId(inputHandleId) { + uint32_t inputHandleId) + : DrmCommandStreamReceiver(executionEnvironment, rootDeviceIndex, deviceBitfield), expectedHandleId(inputHandleId) { } SubmissionStatus processResidency(ResidencyContainer &allocationsForResidency, uint32_t handleId) override { @@ -393,7 +393,6 @@ class DrmCommandStreamForceTileTest : public ::testing::Test { csr = new MockDrmCommandStreamReceiver(executionEnvironment, rootDeviceIndex, 3, - GemCloseWorkerMode::gemCloseWorkerActive, expectedHandleId); ASSERT_NE(nullptr, csr); csr->setupContext(*osContext); @@ -514,7 +513,7 @@ struct DrmImplicitScalingCommandStreamTest : ::testing::Test { template std::unique_ptr> createCsr() { - auto csr = std::make_unique>(*executionEnvironment, 0, 0b11, GemCloseWorkerMode::gemCloseWorkerActive); + auto csr = std::make_unique>(*executionEnvironment, 0, 0b11); csr->setupContext(*osContext); return csr; } @@ -598,8 +597,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, whenForceExecu EngineDescriptorHelper::getDefaultDescriptor(gfxCoreHelper.getGpgpuEngineInstances(*executionEnvironment->rootDeviceEnvironments[0])[0], PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo))); osContext->ensureContextInitialized(false); - auto csr = std::make_unique(*executionEnvironment, 0, osContext->getDeviceBitfield(), - GemCloseWorkerMode::gemCloseWorkerActive); + auto csr = std::make_unique(*executionEnvironment, 0, osContext->getDeviceBitfield()); csr->setupContext(*osContext); auto tileInstancedBo0 = new BufferObject(0u, drm, 3, 40, 0, 1); @@ -641,8 +639,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, whenForceExecu uint32_t execCalled = 0; }; - auto csr = std::make_unique(*executionEnvironment, 0, osContext->getDeviceBitfield(), - GemCloseWorkerMode::gemCloseWorkerActive); + auto csr = std::make_unique(*executionEnvironment, 0, osContext->getDeviceBitfield()); csr->setupContext(*osContext); auto tileInstancedBo0 = new BufferObject(0u, drm, 3, 40, 0, 1); @@ -689,8 +686,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenDisabledI uint32_t execCalled = 0; uint32_t processResidencyCalled = 0; }; - auto csr = std::make_unique(*executionEnvironment, 0, osContext->getDeviceBitfield(), - GemCloseWorkerMode::gemCloseWorkerActive); + auto csr = std::make_unique(*executionEnvironment, 0, osContext->getDeviceBitfield()); csr->setupContext(*osContext); const auto size = 1024u; @@ -723,8 +719,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenMultiTile uint32_t execCalled = 0; }; - auto csr = std::make_unique(*executionEnvironment, 0, osContext->getDeviceBitfield(), - GemCloseWorkerMode::gemCloseWorkerActive); + auto csr = std::make_unique(*executionEnvironment, 0, osContext->getDeviceBitfield()); csr->setupContext(*osContext); const auto size = 1024u;