diff --git a/shared/source/os_interface/linux/ioctl_helper.cpp b/shared/source/os_interface/linux/ioctl_helper.cpp index 097b870029..b9c0078423 100644 --- a/shared/source/os_interface/linux/ioctl_helper.cpp +++ b/shared/source/os_interface/linux/ioctl_helper.cpp @@ -86,7 +86,7 @@ int IoctlHelper::createDrmContext(Drm &drm, OsContextLinux &osContext, uint32_t const auto numberOfCCS = drm.getRootDeviceEnvironment().getHardwareInfo()->gtSystemInfo.CCSInfo.NumberOfCCSEnabled; const bool debuggableContext = drm.isContextDebugSupported() && drm.getRootDeviceEnvironment().executionEnvironment.isDebuggingEnabled() && !osContext.isInternalEngine(); - const bool debuggableContextCooperative = debuggableContext && numberOfCCS > 0; + const bool debuggableContextCooperative = drm.getRootDeviceEnvironment().executionEnvironment.getDebuggingMode() == DebuggingMode::Offline ? false : (debuggableContext && numberOfCCS > 0); auto drmContextId = drm.createDrmContext(drmVmId, drm.isVmBindAvailable(), osContext.isCooperativeEngine() || debuggableContextCooperative); if (drmContextId < 0) { return drmContextId; diff --git a/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp index dff6961fef..7394147f79 100644 --- a/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_with_prelim_tests.cpp @@ -518,6 +518,37 @@ TEST_F(IoctlHelperPrelimFixture, givenProgramDebuggingAndContextDebugSupportedWh EXPECT_TRUE(drm->capturedCooperativeContextRequest); } +TEST_F(IoctlHelperPrelimFixture, givenProgramDebuggingModeAndContextDebugSupportedAndRegularEngineUsageWhenCreatingContextThenCooperativeFlagIsNotPassedInOfflineDebuggingMode) { + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online); + drm->contextDebugSupported = true; + drm->callBaseCreateDrmContext = false; + + OsContextLinux osContext(*drm, 0, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular})); + osContext.ensureContextInitialized(); + + EXPECT_NE(static_cast(-1), drm->passedContextDebugId); + + if (executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->gtSystemInfo.CCSInfo.NumberOfCCSEnabled > 0) { + EXPECT_TRUE(drm->capturedCooperativeContextRequest); + } else { + EXPECT_FALSE(drm->capturedCooperativeContextRequest); + } + + executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Offline); + + OsContextLinux osContext2(*drm, 0, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular})); + osContext2.ensureContextInitialized(); + + EXPECT_NE(static_cast(-1), drm->passedContextDebugId); + EXPECT_FALSE(drm->capturedCooperativeContextRequest); + + OsContextLinux osContext3(*drm, 0, 5u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Cooperative})); + osContext3.ensureContextInitialized(); + + EXPECT_NE(static_cast(-1), drm->passedContextDebugId); + EXPECT_TRUE(drm->capturedCooperativeContextRequest); +} + TEST(IoctlHelperPrelimTest, givenProgramDebuggingAndContextDebugSupportedWhenInitializingContextThenVmIsCreatedWithAllNecessaryFlags) { auto executionEnvironment = std::make_unique(); executionEnvironment->setDebuggingMode(NEO::DebuggingMode::Online);