mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
fix: Set vmbind user fence when makeMemoryResident
Related-To: NEO-11977, GSD-10293 Signed-off-by: Chandio, Bibrak Qamar <bibrak.qamar.chandio@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
894b788267
commit
80dc4fb43a
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -55,6 +55,45 @@ TEST(DrmBindTest, givenBindNotCompleteWhenWaitForBindThenWaitUserFenceIoctlIsCal
|
||||
EXPECT_EQ(-1, drm.waitUserFenceParams[0].timeout);
|
||||
}
|
||||
|
||||
TEST(DrmBindTest, givenBindAlreadyCompleteWhenwaitForBindGivenFenceValThenWaitUserFenceIoctlIsNotCalled) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
|
||||
drm.pagingFence[0] = 31u;
|
||||
uint64_t fenceValToWait = 31u;
|
||||
|
||||
drm.waitForBindGivenFenceVal(0u, fenceValToWait);
|
||||
|
||||
EXPECT_EQ(0u, drm.waitUserFenceParams.size());
|
||||
|
||||
drm.pagingFence[0] = 49u;
|
||||
|
||||
drm.waitForBindGivenFenceVal(0u, fenceValToWait);
|
||||
|
||||
EXPECT_EQ(0u, drm.waitUserFenceParams.size());
|
||||
}
|
||||
|
||||
TEST(DrmBindTest, givenBindNotCompleteWhenwaitForBindGivenFenceValThenWaitUserFenceIoctlIsCalled) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
|
||||
drm.pagingFence[0] = 26u;
|
||||
uint64_t fenceValToWait = 31u;
|
||||
|
||||
drm.waitForBindGivenFenceVal(0u, fenceValToWait);
|
||||
|
||||
EXPECT_EQ(1u, drm.waitUserFenceParams.size());
|
||||
EXPECT_EQ(0u, drm.waitUserFenceParams[0].ctxId);
|
||||
EXPECT_EQ(castToUint64(&drm.pagingFence[0]), drm.waitUserFenceParams[0].address);
|
||||
EXPECT_EQ(drm.ioctlHelper->getWaitUserFenceSoftFlag(), drm.waitUserFenceParams[0].flags);
|
||||
EXPECT_EQ(fenceValToWait, drm.waitUserFenceParams[0].value);
|
||||
EXPECT_EQ(-1, drm.waitUserFenceParams[0].timeout);
|
||||
}
|
||||
|
||||
TEST(DrmBindTest, whenCheckingVmBindAvailabilityThenIoctlHelperSupportIsUsed) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -450,7 +450,7 @@ TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoBoundAndUnboundThenCorrectB
|
||||
auto osContext = engines[contextId].osContext;
|
||||
osContext->ensureContextInitialized(false);
|
||||
|
||||
bo.bind(osContext, 0);
|
||||
bo.bind(osContext, 0, false);
|
||||
EXPECT_TRUE(bo.bindInfo[contextId][0]);
|
||||
|
||||
bo.unbind(osContext, 0);
|
||||
@@ -461,7 +461,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindSucceedsThenPr
|
||||
struct DrmMockToSucceedBindBufferObject : public DrmMock {
|
||||
DrmMockToSucceedBindBufferObject(RootDeviceEnvironment &rootDeviceEnvironment)
|
||||
: DrmMock(rootDeviceEnvironment) {}
|
||||
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) override { return 0; }
|
||||
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, const bool forcePagingFence) override { return 0; }
|
||||
int unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) override { return 0; }
|
||||
};
|
||||
|
||||
@@ -496,7 +496,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindSucceedsThenPr
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
|
||||
bo.bind(osContext, 0);
|
||||
bo.bind(osContext, 0, false);
|
||||
EXPECT_TRUE(bo.bindInfo[contextId][0]);
|
||||
|
||||
std::string bindOutput = testing::internal::GetCapturedStdout();
|
||||
@@ -518,7 +518,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindFailsThenPrint
|
||||
struct DrmMockToFailBindBufferObject : public DrmMock {
|
||||
DrmMockToFailBindBufferObject(RootDeviceEnvironment &rootDeviceEnvironment)
|
||||
: DrmMock(rootDeviceEnvironment) {}
|
||||
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) override { return -1; }
|
||||
int bindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo, const bool forcePagingFence) override { return -1; }
|
||||
int unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObject *bo) override { return -1; }
|
||||
int getErrno() override { return EINVAL; }
|
||||
};
|
||||
@@ -554,7 +554,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindFailsThenPrint
|
||||
|
||||
testing::internal::CaptureStderr();
|
||||
|
||||
bo.bind(osContext, 0);
|
||||
bo.bind(osContext, 0, false);
|
||||
EXPECT_FALSE(bo.bindInfo[contextId][0]);
|
||||
|
||||
std::string bindOutput = testing::internal::GetCapturedStderr();
|
||||
@@ -600,7 +600,7 @@ TEST(DrmBufferObject, givenDrmWhenBindOperationFailsThenFenceValueNotGrow) {
|
||||
auto contextId = osContextCount / 2;
|
||||
auto osContext = engines[contextId].osContext;
|
||||
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
|
||||
drm->bindBufferObject(osContext, 0, &bo);
|
||||
drm->bindBufferObject(osContext, 0, &bo, false);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue);
|
||||
}
|
||||
@@ -631,11 +631,299 @@ TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsThenFenceValueGrow) {
|
||||
auto contextId = osContextCount / 2;
|
||||
auto osContext = engines[contextId].osContext;
|
||||
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
|
||||
drm->bindBufferObject(osContext, 0, &bo);
|
||||
drm->bindBufferObject(osContext, 0, &bo, false);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
|
||||
}
|
||||
|
||||
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceThenFenceValueGrow) {
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(1);
|
||||
|
||||
class MockOsContextLinuxUnbind : public OsContextLinux {
|
||||
public:
|
||||
using OsContextLinux::drmContextIds;
|
||||
using OsContextLinux::fenceVal;
|
||||
using OsContextLinux::pagingFence;
|
||||
|
||||
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
|
||||
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
|
||||
|
||||
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
|
||||
waitForPagingFenceGivenFenceValCalled = true;
|
||||
}
|
||||
|
||||
bool waitForPagingFenceGivenFenceValCalled = false;
|
||||
};
|
||||
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
|
||||
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drm->requirePerContextVM = false;
|
||||
drm->isVMBindImmediateSupported = true;
|
||||
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
|
||||
ioctlHelper->isWaitBeforeBindRequiredResult = true;
|
||||
drm->ioctlHelper.reset(ioctlHelper.release());
|
||||
|
||||
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext->ensureContextInitialized(false);
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
|
||||
// Make sure to disable the debugging mode
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::disabled);
|
||||
uint64_t initFenceValue = 10u;
|
||||
drm->fenceVal[0] = initFenceValue;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
|
||||
|
||||
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
|
||||
auto osContextCount = engines.size();
|
||||
|
||||
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
|
||||
drm->bindBufferObject(osContext, 0, &bo, true);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
|
||||
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
|
||||
delete osContext;
|
||||
}
|
||||
|
||||
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceNotWaitOnUserFenceAfterBindAndUnbindThenFenceValueGrow) {
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(0);
|
||||
|
||||
class MockOsContextLinuxUnbind : public OsContextLinux {
|
||||
public:
|
||||
using OsContextLinux::drmContextIds;
|
||||
using OsContextLinux::fenceVal;
|
||||
using OsContextLinux::pagingFence;
|
||||
|
||||
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
|
||||
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
|
||||
|
||||
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
|
||||
waitForPagingFenceGivenFenceValCalled = true;
|
||||
}
|
||||
|
||||
bool waitForPagingFenceGivenFenceValCalled = false;
|
||||
};
|
||||
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
|
||||
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drm->requirePerContextVM = false;
|
||||
drm->isVMBindImmediateSupported = true;
|
||||
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
|
||||
ioctlHelper->isWaitBeforeBindRequiredResult = true;
|
||||
drm->ioctlHelper.reset(ioctlHelper.release());
|
||||
|
||||
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext->ensureContextInitialized(false);
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
|
||||
// Make sure to disable the debugging mode
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::disabled);
|
||||
uint64_t initFenceValue = 10u;
|
||||
drm->fenceVal[0] = initFenceValue;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
|
||||
|
||||
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
|
||||
auto osContextCount = engines.size();
|
||||
|
||||
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
|
||||
drm->bindBufferObject(osContext, 0, &bo, true);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
|
||||
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
|
||||
delete osContext;
|
||||
}
|
||||
|
||||
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceWithWaitOnUserFenceAfterBindAndUnbindAndNotUseVMBindImmediateThenFenceValueGrow) {
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(1);
|
||||
|
||||
class MockOsContextLinuxUnbind : public OsContextLinux {
|
||||
public:
|
||||
using OsContextLinux::drmContextIds;
|
||||
using OsContextLinux::fenceVal;
|
||||
using OsContextLinux::pagingFence;
|
||||
|
||||
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
|
||||
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
|
||||
|
||||
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
|
||||
waitForPagingFenceGivenFenceValCalled = true;
|
||||
}
|
||||
|
||||
bool waitForPagingFenceGivenFenceValCalled = false;
|
||||
};
|
||||
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
|
||||
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drm->requirePerContextVM = false;
|
||||
// Making the useVMBindImmediate() false
|
||||
drm->isVMBindImmediateSupported = false;
|
||||
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
|
||||
ioctlHelper->isWaitBeforeBindRequiredResult = true;
|
||||
drm->ioctlHelper.reset(ioctlHelper.release());
|
||||
|
||||
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext->ensureContextInitialized(false);
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
|
||||
// Make sure to disable the debugging mode
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::disabled);
|
||||
uint64_t initFenceValue = 10u;
|
||||
drm->fenceVal[0] = initFenceValue;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
|
||||
|
||||
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
|
||||
auto osContextCount = engines.size();
|
||||
|
||||
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
|
||||
drm->bindBufferObject(osContext, 0, &bo, true);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
|
||||
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
|
||||
delete osContext;
|
||||
}
|
||||
|
||||
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceWithDebuggingEnabledWithWaitOnUserFenceAfterBindAndUnbindAndNotUseVMBindImmediateThenFenceValueDoesNotGrow) {
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(1);
|
||||
|
||||
class MockOsContextLinuxUnbind : public OsContextLinux {
|
||||
public:
|
||||
using OsContextLinux::drmContextIds;
|
||||
using OsContextLinux::fenceVal;
|
||||
using OsContextLinux::pagingFence;
|
||||
|
||||
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
|
||||
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
|
||||
|
||||
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
|
||||
waitForPagingFenceGivenFenceValCalled = true;
|
||||
}
|
||||
|
||||
bool waitForPagingFenceGivenFenceValCalled = false;
|
||||
};
|
||||
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
|
||||
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drm->requirePerContextVM = false;
|
||||
// Making the useVMBindImmediate() false
|
||||
drm->isVMBindImmediateSupported = false;
|
||||
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
|
||||
ioctlHelper->isWaitBeforeBindRequiredResult = true;
|
||||
drm->ioctlHelper.reset(ioctlHelper.release());
|
||||
|
||||
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext->ensureContextInitialized(false);
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
|
||||
// Make sure to enable the debugging mode
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::online);
|
||||
uint64_t initFenceValue = 10u;
|
||||
drm->fenceVal[0] = initFenceValue;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
|
||||
|
||||
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
|
||||
auto osContextCount = engines.size();
|
||||
|
||||
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
|
||||
drm->bindBufferObject(osContext, 0, &bo, true);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue);
|
||||
EXPECT_FALSE(osContext->waitForPagingFenceGivenFenceValCalled);
|
||||
delete osContext;
|
||||
}
|
||||
|
||||
TEST(DrmBufferObject, givenDrmWhenBindOperationSucceedsWithForcePagingFenceNotWaitOnUserFenceAfterBindAndUnbindAndNotUseVMBindImmediateThenFenceValueGrow) {
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.EnableWaitOnUserFenceAfterBindAndUnbind.set(0);
|
||||
|
||||
class MockOsContextLinuxUnbind : public OsContextLinux {
|
||||
public:
|
||||
using OsContextLinux::drmContextIds;
|
||||
using OsContextLinux::fenceVal;
|
||||
using OsContextLinux::pagingFence;
|
||||
|
||||
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
|
||||
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
|
||||
|
||||
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
|
||||
waitForPagingFenceGivenFenceValCalled = true;
|
||||
}
|
||||
|
||||
bool waitForPagingFenceGivenFenceValCalled = false;
|
||||
};
|
||||
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
|
||||
auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drm->requirePerContextVM = false;
|
||||
// Making the useVMBindImmediate() false
|
||||
drm->isVMBindImmediateSupported = false;
|
||||
auto ioctlHelper = std::make_unique<MockIoctlHelper>(*drm);
|
||||
ioctlHelper->isWaitBeforeBindRequiredResult = true;
|
||||
drm->ioctlHelper.reset(ioctlHelper.release());
|
||||
|
||||
auto osContext = new MockOsContextLinuxUnbind(*drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext->ensureContextInitialized(false);
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
|
||||
// Make sure to disable the debugging mode
|
||||
executionEnvironment->setDebuggingMode(DebuggingMode::disabled);
|
||||
uint64_t initFenceValue = 10u;
|
||||
drm->fenceVal[0] = initFenceValue;
|
||||
std::unique_ptr<Device> device(MockDevice::createWithExecutionEnvironment<MockDevice>(defaultHwInfo.get(), executionEnvironment, 0));
|
||||
|
||||
auto &engines = device->getExecutionEnvironment()->memoryManager->getRegisteredEngines(device->getRootDeviceIndex());
|
||||
auto osContextCount = engines.size();
|
||||
|
||||
MockBufferObject bo(device->getRootDeviceIndex(), drm, 3, 0, 0, osContextCount);
|
||||
drm->bindBufferObject(osContext, 0, &bo, true);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
|
||||
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
|
||||
delete osContext;
|
||||
}
|
||||
|
||||
TEST(DrmBufferObject, givenDrmWhenUnBindOperationFailsThenFenceValueNotGrow) {
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
executionEnvironment->setDebuggingMode(NEO::DebuggingMode::online);
|
||||
@@ -748,11 +1036,11 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsAndForceFenceWaitThenFe
|
||||
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
|
||||
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
|
||||
|
||||
void waitForPagingFence() override {
|
||||
waitForPagingFenceCalled = true;
|
||||
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
|
||||
waitForPagingFenceGivenFenceValCalled = true;
|
||||
}
|
||||
|
||||
bool waitForPagingFenceCalled = false;
|
||||
bool waitForPagingFenceGivenFenceValCalled = false;
|
||||
};
|
||||
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
@@ -785,7 +1073,7 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsAndForceFenceWaitThenFe
|
||||
drm->unbindBufferObject(static_cast<OsContext *>(osContext), 0, &bo);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue + 1);
|
||||
EXPECT_TRUE(osContext->waitForPagingFenceCalled);
|
||||
EXPECT_TRUE(osContext->waitForPagingFenceGivenFenceValCalled);
|
||||
delete osContext;
|
||||
}
|
||||
|
||||
@@ -803,11 +1091,11 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsWaitBeforeBindFalseAndF
|
||||
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
|
||||
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
|
||||
|
||||
void waitForPagingFence() override {
|
||||
waitForPagingFenceCalled = true;
|
||||
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
|
||||
waitForPagingFenceGivenFenceValCalled = true;
|
||||
}
|
||||
|
||||
bool waitForPagingFenceCalled = false;
|
||||
bool waitForPagingFenceGivenFenceValCalled = false;
|
||||
};
|
||||
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
@@ -840,7 +1128,7 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsWaitBeforeBindFalseAndF
|
||||
drm->unbindBufferObject(static_cast<OsContext *>(osContext), 0, &bo);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue);
|
||||
EXPECT_FALSE(osContext->waitForPagingFenceCalled);
|
||||
EXPECT_FALSE(osContext->waitForPagingFenceGivenFenceValCalled);
|
||||
delete osContext;
|
||||
}
|
||||
|
||||
@@ -858,11 +1146,11 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsWaitBeforeBindTrueAndFo
|
||||
MockOsContextLinuxUnbind(Drm &drm, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor)
|
||||
: OsContextLinux(drm, rootDeviceIndex, contextId, engineDescriptor) {}
|
||||
|
||||
void waitForPagingFence() override {
|
||||
waitForPagingFenceCalled = true;
|
||||
void waitForPagingFenceGivenFenceVal(uint64_t fenceValToWait) override {
|
||||
waitForPagingFenceGivenFenceValCalled = true;
|
||||
}
|
||||
|
||||
bool waitForPagingFenceCalled = false;
|
||||
bool waitForPagingFenceGivenFenceValCalled = false;
|
||||
};
|
||||
|
||||
auto executionEnvironment = new ExecutionEnvironment;
|
||||
@@ -895,7 +1183,7 @@ TEST(DrmBufferObject, givenDrmWhenUnBindOperationSucceedsWaitBeforeBindTrueAndFo
|
||||
drm->unbindBufferObject(static_cast<OsContext *>(osContext), 0, &bo);
|
||||
|
||||
EXPECT_EQ(drm->fenceVal[0], initFenceValue);
|
||||
EXPECT_FALSE(osContext->waitForPagingFenceCalled);
|
||||
EXPECT_FALSE(osContext->waitForPagingFenceGivenFenceValCalled);
|
||||
delete osContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -835,7 +835,7 @@ struct MockDrmAllocationBindBO : public DrmAllocation {
|
||||
}
|
||||
|
||||
ADDMETHOD_NOBASE(bindBO, int, 0,
|
||||
(BufferObject * bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind));
|
||||
(BufferObject * bo, OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence));
|
||||
};
|
||||
|
||||
struct MockDrmAllocationBindBOs : public DrmAllocation {
|
||||
@@ -844,7 +844,7 @@ struct MockDrmAllocationBindBOs : public DrmAllocation {
|
||||
}
|
||||
|
||||
ADDMETHOD_NOBASE(bindBOs, int, 0,
|
||||
(OsContext * osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind));
|
||||
(OsContext * osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence));
|
||||
};
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOsFailsThenMakeBOsResidentReturnsError) {
|
||||
@@ -855,7 +855,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOsFailsThenMakeBOsRes
|
||||
auto allocation = new MockDrmAllocationBindBOs(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
allocation->bindBOsResult = -1;
|
||||
|
||||
auto res = allocation->makeBOsResident(&csr->getOsContext(), 0, nullptr, true);
|
||||
auto res = allocation->makeBOsResident(&csr->getOsContext(), 0, nullptr, true, false);
|
||||
EXPECT_NE(res, 0);
|
||||
EXPECT_EQ(allocation->fragmentsStorage.fragmentCount, 0u);
|
||||
EXPECT_GT(allocation->bindBOsCalled, 0u);
|
||||
@@ -884,7 +884,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFragmentStorageAndBindBOFa
|
||||
memcpy(&prevStorage, &allocation->fragmentsStorage, sizeof(OsHandleStorage));
|
||||
memcpy(&allocation->fragmentsStorage, &storage, sizeof(OsHandleStorage));
|
||||
|
||||
auto res = allocation->makeBOsResident(&csr->getOsContext(), 0, nullptr, true);
|
||||
auto res = allocation->makeBOsResident(&csr->getOsContext(), 0, nullptr, true, false);
|
||||
EXPECT_NE(res, 0);
|
||||
EXPECT_EQ(allocation->fragmentsStorage.fragmentCount, 1u);
|
||||
EXPECT_GT(allocation->bindBOCalled, 0u);
|
||||
@@ -902,7 +902,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOFailsThenBindBOsRetu
|
||||
auto allocation = new MockDrmAllocationBindBO(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
allocation->bindBOResult = -1;
|
||||
|
||||
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false);
|
||||
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false, false);
|
||||
EXPECT_NE(res, 0);
|
||||
EXPECT_GT(allocation->bindBOCalled, 0u);
|
||||
|
||||
@@ -920,7 +920,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOFailsWithMultipleMem
|
||||
allocation->storageInfo.memoryBanks = 0b11;
|
||||
EXPECT_EQ(allocation->storageInfo.getNumBanks(), 2u);
|
||||
|
||||
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false);
|
||||
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false, false);
|
||||
EXPECT_NE(res, 0);
|
||||
EXPECT_GT(allocation->bindBOCalled, 0u);
|
||||
|
||||
@@ -939,7 +939,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenBindBOFailsWithMultipleMem
|
||||
allocation->storageInfo.memoryBanks = 0b11;
|
||||
EXPECT_EQ(allocation->storageInfo.getNumBanks(), 2u);
|
||||
|
||||
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false);
|
||||
auto res = allocation->bindBOs(&csr->getOsContext(), 0u, &static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr)->residency, false, false);
|
||||
EXPECT_NE(res, 0);
|
||||
EXPECT_GT(allocation->bindBOCalled, 0u);
|
||||
|
||||
@@ -1417,7 +1417,7 @@ struct MockMergeResidencyContainerMemoryOperationsHandler : public DrmMemoryOper
|
||||
(OsContext * osContext, ResidencyContainer &residencyContainer));
|
||||
|
||||
ADDMETHOD_NOBASE(makeResidentWithinOsContext, NEO::MemoryOperationsStatus, NEO::MemoryOperationsStatus::success,
|
||||
(OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable));
|
||||
(OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence));
|
||||
};
|
||||
|
||||
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContainerFailsThenFlushReturnsError) {
|
||||
@@ -1534,7 +1534,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocsInMemoryOperationHan
|
||||
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo)));
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
LinearStream cs(commandBuffer);
|
||||
@@ -1558,7 +1558,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocInMemoryOperationsInt
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
csr->flush(batchBuffer, csr->getResidencyAllocations());
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -678,7 +678,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenProcessResidencyFailingOnO
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
|
||||
testedCsr->processResidencyCallBase = false;
|
||||
@@ -700,7 +700,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenProcessResidencyFailingOnO
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
|
||||
testedCsr->processResidencyCallBase = false;
|
||||
@@ -722,7 +722,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenFailingExecWhenFlushingThe
|
||||
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
|
||||
|
||||
auto allocation = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
executionEnvironment->rootDeviceEnvironments[csr->getRootDeviceIndex()]->memoryOperationsInterface->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
|
||||
testedCsr->processResidencyCallBase = true;
|
||||
@@ -1085,9 +1085,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenPrintBOsForSubmitWhenPrint
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
|
||||
std::vector<BufferObject *> bos;
|
||||
allocation1.makeBOsResident(&csr->getOsContext(), 0, &bos, true);
|
||||
allocation2.makeBOsResident(&csr->getOsContext(), 0, &bos, true);
|
||||
cmdBuffer.makeBOsResident(&csr->getOsContext(), 0, &bos, true);
|
||||
allocation1.makeBOsResident(&csr->getOsContext(), 0, &bos, true, false);
|
||||
allocation2.makeBOsResident(&csr->getOsContext(), 0, &bos, true, false);
|
||||
cmdBuffer.makeBOsResident(&csr->getOsContext(), 0, &bos, true, false);
|
||||
|
||||
std::stringstream expected;
|
||||
expected << "Buffer object for submit\n";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -351,7 +351,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinDefaultE
|
||||
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
|
||||
EXPECT_NE(0u, drm.context.receivedVmBind->extensions);
|
||||
|
||||
@@ -371,7 +371,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinInternal
|
||||
|
||||
OsContextLinux osContext(drm, 0, 0u, {{aub_stream::EngineType::ENGINE_RCS, EngineUsage::internal}, 1 /*deviceBitfield*/, PreemptionMode::Disabled, true /* isRootDevice*/});
|
||||
osContext.ensureContextInitialized(false);
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
|
||||
EXPECT_FALSE(drm.context.receivedVmBindUuidExt[0]);
|
||||
}
|
||||
@@ -387,7 +387,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinCopyEngi
|
||||
|
||||
OsContextLinux osContext(drm, 0, 0u, {{aub_stream::EngineType::ENGINE_BCS, EngineUsage::regular}, 1 /*deviceBitfield*/, PreemptionMode::Disabled, true /* isRootDevice*/});
|
||||
osContext.ensureContextInitialized(false);
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
|
||||
EXPECT_FALSE(drm.context.receivedVmBindUuidExt[0]);
|
||||
}
|
||||
@@ -402,7 +402,7 @@ HWTEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenUnbindingThenExtens
|
||||
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
EXPECT_NE(0u, drm.context.receivedVmBind.value().extensions);
|
||||
|
||||
bo.unbind(&osContext, 0);
|
||||
|
||||
@@ -5936,7 +5936,7 @@ TEST_F(DrmMemoryManagerTest, givenPageFaultIsUnSupportedWhenCallingBindBoOnBuffe
|
||||
allocation.bufferObjects[0] = &bo;
|
||||
|
||||
std::vector<BufferObject *> bufferObjects;
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true);
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true, false);
|
||||
|
||||
EXPECT_FALSE(allocation.shouldAllocationPageFault(&drm));
|
||||
EXPECT_FALSE(bo.isExplicitResidencyRequired());
|
||||
@@ -5965,7 +5965,7 @@ TEST_F(DrmMemoryManagerTest, givenPageFaultIsSupportedAndKmdMigrationEnabledForB
|
||||
debugManager.flags.UseKmdMigrationForBuffers.set(useKmdMigrationForBuffers);
|
||||
|
||||
std::vector<BufferObject *> bufferObjects;
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true);
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true, false);
|
||||
|
||||
if (useKmdMigrationForBuffers > 0) {
|
||||
EXPECT_TRUE(allocation.shouldAllocationPageFault(&drm));
|
||||
@@ -6004,7 +6004,7 @@ TEST_F(DrmMemoryManagerTest, givenPageFaultIsSupportedWhenCallingBindBoOnAllocat
|
||||
allocation.shouldPageFault = shouldAllocationPageFault;
|
||||
|
||||
std::vector<BufferObject *> bufferObjects;
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true);
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, &bufferObjects, true, false);
|
||||
|
||||
EXPECT_EQ(shouldAllocationPageFault, allocation.shouldAllocationPageFault(&drm));
|
||||
EXPECT_EQ(!shouldAllocationPageFault, bo.isExplicitResidencyRequired());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -261,8 +261,8 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest2, givenOperationHandler
|
||||
EXPECT_EQ(operationHandlerDefault->getRootDeviceIndex(), 0u);
|
||||
EXPECT_EQ(operationHandler->getRootDeviceIndex(), 1u);
|
||||
|
||||
operationHandlerDefault->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationDefault, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
operationHandlerDefault->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationDefault, 1), false, false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
operationHandlerDefault->setRootDeviceIndex(1u);
|
||||
operationHandler->setRootDeviceIndex(0u);
|
||||
@@ -294,7 +294,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest2, whenNoSpaceLeftOnDevi
|
||||
EXPECT_EQ(allocationDefault, registeredAllocations[1]);
|
||||
|
||||
EXPECT_EQ(operationHandler->evictUnusedCalled, 0u);
|
||||
auto res = operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
auto res = operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
EXPECT_EQ(MemoryOperationsStatus::outOfMemory, res);
|
||||
EXPECT_EQ(operationHandler->evictUnusedCalled, 1u);
|
||||
|
||||
@@ -309,17 +309,17 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenObjectAlwaysResidentAndNotUsedWh
|
||||
for (auto &engine : device->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateTaskCount(GraphicsAllocation::objectNotUsed, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
for (auto &engine : device->getSubDevice(0u)->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
for (auto &engine : device->getSubDevice(1u)->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateTaskCount(GraphicsAllocation::objectNotUsed, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
|
||||
EXPECT_EQ(mock->context.vmBindCalled, 2u);
|
||||
@@ -375,17 +375,17 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, whenEvictUnusedResourcesWithWaitFor
|
||||
for (auto &engine : device->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
for (auto &engine : device->getSubDevice(0u)->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
for (auto &engine : device->getSubDevice(1u)->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
*device->getSubDevice(1u)->getDefaultEngine().commandStreamReceiver->getTagAddress() = 5;
|
||||
|
||||
@@ -420,17 +420,17 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenRunningOutOfMemoryThenUnusedAlloc
|
||||
for (auto &engine : device->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
for (auto &engine : device->getSubDevice(0u)->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
for (auto &engine : device->getSubDevice(1u)->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 10;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
*device->getSubDevice(1u)->getDefaultEngine().commandStreamReceiver->getTagAddress() = 5;
|
||||
|
||||
@@ -450,17 +450,17 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenUsedAllocationInBothSubdevicesWh
|
||||
for (auto &engine : device->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 5;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
for (auto &engine : device->getSubDevice(0u)->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 5;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
for (auto &engine : device->getSubDevice(1u)->getAllEngines()) {
|
||||
*engine.commandStreamReceiver->getTagAddress() = 5;
|
||||
allocation->updateTaskCount(8u, engine.osContext->getContextId());
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(engine.osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
}
|
||||
|
||||
EXPECT_EQ(mock->context.vmBindCalled, 2u);
|
||||
@@ -473,12 +473,12 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenUsedAllocationInBothSubdevicesWh
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryOperationsHandlerBindTest, givenResidencyWithinOsContextFailsThenThenMergeWithResidencyContainertReturnsError) {
|
||||
TEST_F(DrmMemoryOperationsHandlerBindTest, givenResidencyWithinOsContextFailsThenMergeWithResidencyContainertReturnsError) {
|
||||
struct MockDrmMemoryOperationsHandlerBindResidencyFail : public DrmMemoryOperationsHandlerBind {
|
||||
MockDrmMemoryOperationsHandlerBindResidencyFail(RootDeviceEnvironment &rootDeviceEnvironment, uint32_t rootDeviceIndex)
|
||||
: DrmMemoryOperationsHandlerBind(rootDeviceEnvironment, rootDeviceIndex) {}
|
||||
|
||||
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
|
||||
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
|
||||
return NEO::MemoryOperationsStatus::failed;
|
||||
}
|
||||
};
|
||||
@@ -539,7 +539,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenMakeBOsResidentFailsThenMakeResi
|
||||
: DrmAllocation(rootDeviceIndex, 1u /*num gmms*/, allocationType, bos, ptrIn, gpuAddress, sizeIn, pool) {
|
||||
}
|
||||
|
||||
int makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind) override {
|
||||
int makeBOsResident(OsContext *osContext, uint32_t vmHandleId, std::vector<BufferObject *> *bufferObjects, bool bind, const bool forcePagingFence) override {
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
@@ -552,7 +552,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenMakeBOsResidentFailsThenMakeResi
|
||||
auto allocation = new MockDrmAllocationBOsResident(0, AllocationType::unknown, bos, nullptr, 0u, size, MemoryPool::localMemory);
|
||||
auto graphicsAllocation = static_cast<GraphicsAllocation *>(allocation);
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&graphicsAllocation, 1), false), MemoryOperationsStatus::outOfMemory);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&graphicsAllocation, 1), false, false), MemoryOperationsStatus::outOfMemory);
|
||||
delete allocation;
|
||||
}
|
||||
|
||||
@@ -581,19 +581,19 @@ TEST_F(DrmMemoryOperationsHandlerBindTest,
|
||||
allocation->storageInfo.subDeviceBitfield = 0b0011;
|
||||
auto graphicsAllocation = static_cast<GraphicsAllocation *>(allocation);
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&graphicsAllocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&graphicsAllocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
delete allocation;
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenMakeResidentWithinOsContextEvictableAllocationThenAllocationIsNotMarkedAsAlwaysResident) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_TRUE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
|
||||
|
||||
EXPECT_EQ(operationHandler->evict(device, *allocation), MemoryOperationsStatus::success);
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
EXPECT_FALSE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
@@ -603,12 +603,12 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenMakeRe
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
allocation->storageInfo.isChunked = true;
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_TRUE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
|
||||
|
||||
EXPECT_EQ(operationHandler->evict(device, *allocation), MemoryOperationsStatus::success);
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
EXPECT_FALSE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
@@ -619,12 +619,12 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenMakeRe
|
||||
allocation->storageInfo.isChunked = true;
|
||||
allocation->storageInfo.memoryBanks = 0x5;
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_TRUE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
|
||||
|
||||
EXPECT_EQ(operationHandler->evict(device, *allocation), MemoryOperationsStatus::success);
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResidentWithinOsContext(device->getDefaultEngine().osContext, ArrayRef<GraphicsAllocation *>(&allocation, 1), true, false), MemoryOperationsStatus::success);
|
||||
EXPECT_FALSE(allocation->isAlwaysResident(device->getDefaultEngine().osContext->getContextId()));
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
@@ -634,7 +634,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenChangi
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::memoryNotFound);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->evict(device, *allocation), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::memoryNotFound);
|
||||
@@ -649,7 +649,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDeviceWithMultipleSubdevicesWhen
|
||||
EXPECT_EQ(operationHandler->isResident(device->getSubDevice(0u), *allocation), MemoryOperationsStatus::memoryNotFound);
|
||||
EXPECT_EQ(operationHandler->isResident(device->getSubDevice(1u), *allocation), MemoryOperationsStatus::memoryNotFound);
|
||||
|
||||
auto retVal = operationHandler->makeResident(device->getSubDevice(1u), ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
auto retVal = operationHandler->makeResident(device->getSubDevice(1u), ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
EXPECT_EQ(retVal, MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::memoryNotFound);
|
||||
@@ -677,7 +677,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenIoctlFailDuringEvictingThenUnreco
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::memoryNotFound);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::success);
|
||||
|
||||
mock->context.vmUnbindReturn = -1;
|
||||
@@ -691,8 +691,8 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenIoctlFailDuringEvictingThenUnreco
|
||||
TEST_F(DrmMemoryOperationsHandlerBindTest, whenMakeResidentTwiceThenAllocIsBoundOnlyOnce) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation), MemoryOperationsStatus::success);
|
||||
|
||||
EXPECT_EQ(mock->context.vmBindCalled, 2u);
|
||||
@@ -712,7 +712,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenNoVmBindSupportInDrmWhenCheckFor
|
||||
mock->context.vmBindCalled = 0u;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
EXPECT_FALSE(mock->context.vmBindCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
@@ -727,7 +727,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenVmBindSupportAndNoMultiTileWhenC
|
||||
mock->context.vmBindCalled = 0u;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
EXPECT_FALSE(mock->context.vmBindCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
@@ -741,7 +741,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenDisabledVmBindWhenCreateDrmHandl
|
||||
mock->context.vmBindCalled = false;
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
handler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
EXPECT_FALSE(mock->context.vmBindCalled);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
@@ -1072,9 +1072,9 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenCsrTagAllocatorsWhenDestructin
|
||||
auto hwTimeStampsAlloc = csr->getEventTsAllocator()->getTag()->getBaseGraphicsAllocation()->getDefaultGraphicsAllocation();
|
||||
auto hwPerfCounterAlloc = csr->getEventPerfCountAllocator(4)->getTag()->getBaseGraphicsAllocation()->getDefaultGraphicsAllocation();
|
||||
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(×tampStorageAlloc, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&hwTimeStampsAlloc, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&hwPerfCounterAlloc, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(×tampStorageAlloc, 1), false, false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&hwTimeStampsAlloc, 1), false, false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&hwPerfCounterAlloc, 1), false, false);
|
||||
|
||||
csr.reset();
|
||||
|
||||
@@ -1113,7 +1113,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenPatIndexProgrammingEnabledWhen
|
||||
|
||||
bo.setPatIndex(mock->getPatIndex(allocation.getDefaultGmm(), allocation.getAllocationType(), CacheRegion::defaultRegion, CachePolicy::writeBack, (debugFlag == 1 && closSupported), true));
|
||||
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false);
|
||||
|
||||
if (!patIndexProgrammingSupported) {
|
||||
EXPECT_FALSE(mock->context.receivedVmBindPatIndex);
|
||||
@@ -1184,7 +1184,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenUncachedDebugFlagSetWhenVmBind
|
||||
mock->context.receivedVmUnbindPatIndex.reset();
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
auto expectedIndex = productHelper.overridePatIndex(true, static_cast<uint64_t>(MockGmmClientContextBase::MockPatIndex::uncached), allocation->getAllocationType());
|
||||
|
||||
@@ -1214,7 +1214,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(×tampStorageAlloc, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(×tampStorageAlloc, 1), false, false);
|
||||
|
||||
EXPECT_EQ(1u, mock->context.receivedVmBindPatIndex.value());
|
||||
|
||||
@@ -1245,7 +1245,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh
|
||||
|
||||
GraphicsAllocation *allocPtr = &allocation;
|
||||
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
|
||||
|
||||
EXPECT_EQ(2u, mock->context.receivedVmBindPatIndex.value());
|
||||
|
||||
@@ -1276,7 +1276,7 @@ HWTEST_F(DrmMemoryOperationsHandlerBindTest, givenDebugFlagSetWhenVmBindCalledTh
|
||||
|
||||
GraphicsAllocation *allocPtr = &allocation;
|
||||
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocPtr, 1), false, false);
|
||||
|
||||
EXPECT_EQ(3u, mock->context.receivedVmBindPatIndex.value());
|
||||
|
||||
@@ -1308,7 +1308,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenClosEnabledAndAllocationToBeCach
|
||||
EXPECT_TRUE(static_cast<DrmAllocation *>(allocation)->setCacheAdvice(mock, 32 * MemoryConstants::kiloByte, cacheRegion, false));
|
||||
|
||||
mock->context.receivedVmBindPatIndex.reset();
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false);
|
||||
operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation, 1), false, false);
|
||||
|
||||
auto patIndex = productHelper.getPatIndex(cacheRegion, CachePolicy::writeBack);
|
||||
|
||||
@@ -1375,7 +1375,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenPreviouslyLockedMemoryWhenCallin
|
||||
EXPECT_EQ(operationHandler->isResident(device, *mockDrmAllocation), MemoryOperationsStatus::memoryNotFound);
|
||||
EXPECT_FALSE(mockDrmAllocation->isLockedMemory());
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&mockDrmAllocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&mockDrmAllocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->isResident(device, *mockDrmAllocation), MemoryOperationsStatus::success);
|
||||
EXPECT_FALSE(mockDrmAllocation->isLockedMemory());
|
||||
EXPECT_FALSE(mockBo.isExplicitLockedMemoryRequired());
|
||||
@@ -1393,7 +1393,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenLockedAndResidentAllocationsWhen
|
||||
EXPECT_EQ(operationHandler->lock(device, ArrayRef<GraphicsAllocation *>(&allocation1, 1)), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation1), MemoryOperationsStatus::success);
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation2, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<GraphicsAllocation *>(&allocation2, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->isResident(device, *allocation2), MemoryOperationsStatus::success);
|
||||
|
||||
operationHandler->useBaseEvictUnused = true;
|
||||
@@ -1410,7 +1410,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, givenLockedAndResidentAllocationsWhen
|
||||
|
||||
TEST_F(DrmMemoryOperationsHandlerBindTest, whenCallingMakeResidentThenVerifyImmediateBindingIsRequired) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
|
||||
auto bo = static_cast<DrmAllocation *>(allocation)->getBO();
|
||||
EXPECT_TRUE(bo->isImmediateBindingRequired());
|
||||
@@ -1420,7 +1420,7 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenCallingMakeResidentThenVerifyImme
|
||||
TEST_F(DrmMemoryOperationsHandlerBindTest, givenDrmMemoryOperationBindWhenCallingEvictAfterCallingResidentThenVerifyImmediateBindingIsNotRequired) {
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(operationHandler->makeResident(device, ArrayRef<NEO::GraphicsAllocation *>(&allocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
|
||||
auto bo = static_cast<DrmAllocation *>(allocation)->getBO();
|
||||
EXPECT_TRUE(bo->isImmediateBindingRequired());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2024 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -23,7 +23,7 @@ struct MockDrmMemoryOperationsHandlerDefault : public DrmMemoryOperationsHandler
|
||||
using BaseClass = DrmMemoryOperationsHandlerDefault;
|
||||
using DrmMemoryOperationsHandlerDefault::DrmMemoryOperationsHandlerDefault;
|
||||
using DrmMemoryOperationsHandlerDefault::residency;
|
||||
ADDMETHOD(makeResidentWithinOsContext, MemoryOperationsStatus, true, MemoryOperationsStatus::success, (OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable), (osContext, gfxAllocations, evictable));
|
||||
ADDMETHOD(makeResidentWithinOsContext, MemoryOperationsStatus, true, MemoryOperationsStatus::success, (OsContext * osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence), (osContext, gfxAllocations, evictable, forcePagingFence));
|
||||
ADDMETHOD(flushDummyExec, MemoryOperationsStatus, true, MemoryOperationsStatus::success, (Device * device, ArrayRef<GraphicsAllocation *> gfxAllocations), (device, gfxAllocations));
|
||||
ADDMETHOD(evictWithinOsContext, MemoryOperationsStatus, true, MemoryOperationsStatus::success, (OsContext * osContext, GraphicsAllocation &gfxAllocation), (osContext, gfxAllocation));
|
||||
};
|
||||
@@ -73,7 +73,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, whenMakingAllocationResidentThenAlloc
|
||||
initializeAllocation(1);
|
||||
EXPECT_EQ(1u, drmAllocation->storageInfo.getNumBanks());
|
||||
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->residency.size(), 1u);
|
||||
EXPECT_TRUE(drmMemoryOperationsHandler->residency.find(allocationPtr) != drmMemoryOperationsHandler->residency.end());
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->isResident(nullptr, *allocationPtr), MemoryOperationsStatus::success);
|
||||
@@ -84,7 +84,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, whenEvictingResidentAllocationThenAll
|
||||
EXPECT_EQ(1u, drmAllocation->storageInfo.getNumBanks());
|
||||
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->residency.size(), 0u);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->isResident(nullptr, *allocationPtr), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->residency.size(), 1u);
|
||||
EXPECT_TRUE(drmMemoryOperationsHandler->residency.find(allocationPtr) != drmMemoryOperationsHandler->residency.end());
|
||||
@@ -174,7 +174,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenCallingMake
|
||||
drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false;
|
||||
|
||||
initializeAllocation(1);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->flushDummyExecCalled, 0u);
|
||||
}
|
||||
TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenMakeResidentWithinOsContextReturnFailhenFlushDummyExecNotCalled) {
|
||||
@@ -183,7 +183,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenMakeResiden
|
||||
drmMemoryOperationsHandler->makeResidentWithinOsContextResult = MemoryOperationsStatus::failed;
|
||||
|
||||
initializeAllocation(1);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true, false);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->flushDummyExecCalled, 0u);
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenCallingMake
|
||||
drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false;
|
||||
|
||||
initializeAllocation(1);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true, false);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->flushDummyExecCalled, 1u);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenFlushReturn
|
||||
drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false;
|
||||
|
||||
initializeAllocation(1);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true, false);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->evictWithinOsContextCalled, 1u);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ TEST_F(DrmMemoryOperationsHandlerBaseTest, givenOperationsHandlerWhenFlushReturn
|
||||
drmMemoryOperationsHandler->makeResidentWithinOsContextCallBase = false;
|
||||
|
||||
initializeAllocation(1);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true);
|
||||
drmMemoryOperationsHandler->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), true, false);
|
||||
EXPECT_EQ(drmMemoryOperationsHandler->evictWithinOsContextCalled, 0u);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -53,7 +53,7 @@ struct DrmMemoryOperationsHandlerWithAubDumpTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(DrmMemoryOperationsHandlerWithAubDumpTest, whenMakingAllocationResidentThenAllocationIsResident) {
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->residency.size(), 1u);
|
||||
EXPECT_TRUE(drmMemoryOperationsHandlerWithAubDumpMock->residency.find(allocationPtr) != drmMemoryOperationsHandlerWithAubDumpMock->residency.end());
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, graphicsAllocation), MemoryOperationsStatus::success);
|
||||
@@ -66,7 +66,7 @@ TEST_F(DrmMemoryOperationsHandlerWithAubDumpTest, givenRegularAllocationWhenFree
|
||||
mockAubMemoryOperationsHandler->setAubManager(&aubManager);
|
||||
allocationPtr->setAubWritable(true, 0xff);
|
||||
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(device.get(), ArrayRef<GraphicsAllocation *>(&allocationPtr, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->residency.size(), 1u);
|
||||
EXPECT_TRUE(drmMemoryOperationsHandlerWithAubDumpMock->residency.find(allocationPtr) != drmMemoryOperationsHandlerWithAubDumpMock->residency.end());
|
||||
EXPECT_EQ(1u, mockAubMemoryOperationsHandler->residentAllocations.size());
|
||||
@@ -90,7 +90,7 @@ TEST_F(DrmMemoryOperationsHandlerWithAubDumpTest, whenEvictingResidentAllocation
|
||||
GraphicsAllocation *mockDrmAllocation = new MockDrmAllocation(AllocationType::unknown, MemoryPool::localMemory, bos);
|
||||
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->residency.size(), 0u);
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&mockDrmAllocation, 1), false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->makeResident(nullptr, ArrayRef<GraphicsAllocation *>(&mockDrmAllocation, 1), false, false), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->isResident(nullptr, *mockDrmAllocation), MemoryOperationsStatus::success);
|
||||
EXPECT_EQ(drmMemoryOperationsHandlerWithAubDumpMock->residency.size(), 1u);
|
||||
EXPECT_TRUE(drmMemoryOperationsHandlerWithAubDumpMock->residency.find(mockDrmAllocation) != drmMemoryOperationsHandlerWithAubDumpMock->residency.end());
|
||||
|
||||
@@ -390,7 +390,7 @@ TEST(DrmBufferObjectTestPrelim, givenBufferObjectSetToColourWithBindWhenBindingT
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
ASSERT_TRUE(drm.context.receivedVmBind);
|
||||
EXPECT_EQ(drm.context.receivedVmBind->length, MemoryConstants::pageSize64k);
|
||||
EXPECT_EQ(drm.context.receivedVmBind->start, 0xffeeffee);
|
||||
@@ -462,7 +462,7 @@ TEST(DrmBufferObjectTestPrelim, givenBufferObjectMarkedForCaptureWhenBindingThen
|
||||
osContext.ensureContextInitialized(false);
|
||||
bo.markForCapture();
|
||||
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
ASSERT_TRUE(drm.context.receivedVmBind);
|
||||
EXPECT_TRUE(drm.context.receivedVmBind->flags & DrmPrelimHelper::getCaptureVmBindFlag());
|
||||
}
|
||||
@@ -479,7 +479,7 @@ TEST(DrmBufferObjectTestPrelim, givenNoActiveDirectSubmissionAndForceUseImmediat
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
ASSERT_TRUE(drm.context.receivedVmBind);
|
||||
EXPECT_TRUE(drm.context.receivedVmBind->flags & DrmPrelimHelper::getImmediateVmBindFlag());
|
||||
EXPECT_NE(drm.context.receivedVmBind->extensions, 0u);
|
||||
@@ -496,7 +496,7 @@ TEST(DrmBufferObjectTestPrelim, whenBindingThenImmediateFlagIsSetAndExtensionLis
|
||||
osContext.ensureContextInitialized(false);
|
||||
osContext.setDirectSubmissionActive();
|
||||
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
ASSERT_TRUE(drm.context.receivedVmBind);
|
||||
EXPECT_TRUE(drm.context.receivedVmBind->flags & DrmPrelimHelper::getImmediateVmBindFlag());
|
||||
EXPECT_NE(drm.context.receivedVmBind->extensions, 0u);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -29,7 +29,7 @@ TEST(DrmVmBindTest, givenBoRequiringImmediateBindWhenBindingThenImmediateFlagIsP
|
||||
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
bo.bind(&osContext, 0);
|
||||
bo.bind(&osContext, 0, false);
|
||||
|
||||
EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag(), drm.context.receivedVmBind->flags);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ TEST(DrmVmBindTest, givenBoRequiringExplicitResidencyWhenBindingThenMakeResident
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
uint32_t vmHandleId = 0;
|
||||
bo.bind(&osContext, vmHandleId);
|
||||
bo.bind(&osContext, vmHandleId, false);
|
||||
|
||||
if (requireResidency) {
|
||||
EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag() | DrmPrelimHelper::getMakeResidentVmBindFlag(), drm.context.receivedVmBind->flags);
|
||||
@@ -77,7 +77,7 @@ TEST(DrmVmBindTest,
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
uint32_t vmHandleId = 0;
|
||||
bo.bind(&osContext, vmHandleId);
|
||||
bo.bind(&osContext, vmHandleId, false);
|
||||
|
||||
if (requireResidency) {
|
||||
EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag() | DrmPrelimHelper::getMakeResidentVmBindFlag(), drm.context.receivedVmBind->flags);
|
||||
@@ -105,7 +105,7 @@ TEST(DrmVmBindTest, givenPerContextVmsAndBoRequiringExplicitResidencyWhenBinding
|
||||
MockOsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
uint32_t vmHandleId = 0;
|
||||
bo.bind(&osContext, vmHandleId);
|
||||
bo.bind(&osContext, vmHandleId, false);
|
||||
|
||||
if (requireResidency) {
|
||||
EXPECT_EQ(DrmPrelimHelper::getImmediateVmBindFlag() | DrmPrelimHelper::getMakeResidentVmBindFlag(), drm.context.receivedVmBind->flags);
|
||||
@@ -144,7 +144,7 @@ TEST(DrmVmBindTest, whenCallingWaitForBindThenWaitUserFenceIsCalled) {
|
||||
OsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
uint32_t vmHandleId = 0;
|
||||
bo.bind(&osContext, vmHandleId);
|
||||
bo.bind(&osContext, vmHandleId, false);
|
||||
|
||||
drm.waitForBind(vmHandleId);
|
||||
|
||||
@@ -171,7 +171,7 @@ TEST(DrmVmBindTest, givenUseKmdMigrationWhenCallingBindBoOnUnifiedSharedMemoryTh
|
||||
MockDrmAllocation allocation(0u, AllocationType::unifiedSharedMemory, MemoryPool::localMemory);
|
||||
allocation.bufferObjects[0] = &bo;
|
||||
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true);
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true, false);
|
||||
|
||||
EXPECT_TRUE(allocation.shouldAllocationPageFault(&drm));
|
||||
EXPECT_FALSE(bo.isExplicitResidencyRequired());
|
||||
@@ -194,7 +194,7 @@ TEST(DrmVmBindTest, givenDrmWithPageFaultSupportWhenCallingBindBoOnUnifiedShared
|
||||
MockDrmAllocation allocation(0u, AllocationType::unifiedSharedMemory, MemoryPool::localMemory);
|
||||
allocation.bufferObjects[0] = &bo;
|
||||
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true);
|
||||
allocation.bindBO(&bo, &osContext, vmHandleId, nullptr, true, false);
|
||||
|
||||
auto &productHelper = drm.getRootDeviceEnvironment().getHelper<ProductHelper>();
|
||||
auto kmdMigrationSupported = productHelper.isKmdMigrationSupported();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2024 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -116,3 +116,49 @@ TEST(OSContextLinux, givenPerContextVmsAndBindCompleteWhenWaitForPagingFenceThen
|
||||
|
||||
EXPECT_EQ(0u, drm.waitUserFenceParams.size());
|
||||
}
|
||||
|
||||
TEST(OSContextLinux, givenPerContextVmsAndBindNotCompleteWhenWaitForPagingFenceGivenFenceValThenContextFenceIsPassedToWaitUserFenceIoctl) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
drm.requirePerContextVM = true;
|
||||
|
||||
MockOsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
|
||||
drm.pagingFence[0] = 26u;
|
||||
|
||||
osContext.pagingFence[0] = 46u;
|
||||
uint64_t fenceValToWait = 51u;
|
||||
|
||||
osContext.waitForPagingFenceGivenFenceVal(fenceValToWait);
|
||||
|
||||
EXPECT_EQ(1u, drm.waitUserFenceParams.size());
|
||||
EXPECT_EQ(0u, drm.waitUserFenceParams[0].ctxId);
|
||||
EXPECT_EQ(castToUint64(&osContext.pagingFence[0]), drm.waitUserFenceParams[0].address);
|
||||
EXPECT_EQ(drm.ioctlHelper->getWaitUserFenceSoftFlag(), drm.waitUserFenceParams[0].flags);
|
||||
EXPECT_EQ(fenceValToWait, drm.waitUserFenceParams[0].value);
|
||||
EXPECT_EQ(-1, drm.waitUserFenceParams[0].timeout);
|
||||
|
||||
drm.requirePerContextVM = false;
|
||||
osContext.waitForPagingFenceGivenFenceVal(fenceValToWait);
|
||||
|
||||
EXPECT_EQ(castToUint64(&drm.pagingFence[0]), drm.waitUserFenceParams[1].address);
|
||||
EXPECT_EQ(drm.ioctlHelper->getWaitUserFenceSoftFlag(), drm.waitUserFenceParams[1].flags);
|
||||
EXPECT_EQ(fenceValToWait, drm.waitUserFenceParams[1].value);
|
||||
}
|
||||
|
||||
TEST(OSContextLinux, givenPerContextVmsAndBindCompleteWhenWaitForPagingFenceGivenFenceValThenWaitUserFenceIoctlIsNotCalled) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||
drm.requirePerContextVM = true;
|
||||
|
||||
MockOsContextLinux osContext(drm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor());
|
||||
osContext.ensureContextInitialized(false);
|
||||
|
||||
osContext.pagingFence[0] = 3u;
|
||||
uint64_t fenceValToWait = 3u;
|
||||
|
||||
osContext.waitForPagingFenceGivenFenceVal(fenceValToWait);
|
||||
|
||||
EXPECT_EQ(0u, drm.waitUserFenceParams.size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user