Assign pat_index to BO during creation

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-04-19 19:24:19 +00:00
committed by Compute-Runtime-Automation
parent 5911515ed0
commit 06fa316a75
31 changed files with 376 additions and 256 deletions

View File

@@ -241,7 +241,7 @@ TEST(DrmPrelimTest, givenContextDebugNotAvailableWhenCheckedForSupportThenTrueIs
TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinDefaultEngineContextThenExtensionsArePassedToVmBindIoctl) {
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
MockBufferObject bo(&drm, 0, 0, 1);
MockBufferObject bo(&drm, 3, 0, 0, 1);
bo.addBindExtHandle(4);
bo.addBindExtHandle(5);
@@ -261,7 +261,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinDefaultE
TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinInternalContextThenExtensionsAreNotPassedToVmBindIoctl) {
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
MockBufferObject bo(&drm, 0, 0, 1);
MockBufferObject bo(&drm, 3, 0, 0, 1);
bo.addBindExtHandle(4);
bo.addBindExtHandle(5);
@@ -275,7 +275,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinInternal
TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinCopyEngineContextThenExtensionsAreNotPassedToVmBindIoctl) {
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
MockBufferObject bo(&drm, 0, 0, 1);
MockBufferObject bo(&drm, 3, 0, 0, 1);
bo.addBindExtHandle(4);
bo.addBindExtHandle(5);
@@ -291,7 +291,7 @@ TEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenBindingWithinCopyEngi
HWTEST_F(DrmDebugPrelimTest, givenAddedBindExtHandlesInBoWhenUnbindingThenExtensionsAreNotSet) {
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
MockBufferObject bo(&drm, 0, 0, 1);
MockBufferObject bo(&drm, 3, 0, 0, 1);
bo.addBindExtHandle(4);
bo.addBindExtHandle(5);

View File

@@ -281,7 +281,7 @@ TEST(DrmBufferObjectTestPrelim, givenBufferObjectSetToColourWithBindWhenBindingT
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
BufferObjectMock bo(&drm, 1, 0, 1);
BufferObjectMock bo(&drm, 3, 1, 0, 1);
bo.setColourWithBind();
bo.setColourChunk(MemoryConstants::pageSize64k);
bo.addColouringAddress(0xffeeffee);
@@ -338,7 +338,7 @@ TEST(DrmBufferObjectTestPrelim, givenBufferObjectMarkedForCaptureWhenBindingThen
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
BufferObjectMock bo(&drm, 1, 0, 1);
BufferObjectMock bo(&drm, 3, 1, 0, 1);
OsContextLinux osContext(drm, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized();
bo.markForCapture();
@@ -358,7 +358,7 @@ TEST(DrmBufferObjectTestPrelim, givenNoActiveDirectSubmissionAndForceUseImmediat
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->initializeMemoryManager();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
BufferObjectMock bo(&drm, 1, 0, 1);
BufferObjectMock bo(&drm, 3, 1, 0, 1);
OsContextLinux osContext(drm, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized();
@@ -376,7 +376,7 @@ TEST(DrmBufferObjectTestPrelim, whenBindingThenImmediateFlagIsSetAndExtensionLis
executionEnvironment->initializeMemoryManager();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
drm.setDirectSubmissionActive(true);
BufferObjectMock bo(&drm, 1, 0, 1);
BufferObjectMock bo(&drm, 3, 1, 0, 1);
OsContextLinux osContext(drm, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized();
osContext.setDirectSubmissionActive();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -29,6 +29,7 @@ class DrmMemManagerFixture {
executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(new DrmMock(*executionEnvironment->rootDeviceEnvironments[0])));
memManager = std::unique_ptr<FrontWindowMemManagerMock>(new FrontWindowMemManagerMock(*executionEnvironment));

View File

@@ -23,7 +23,7 @@ TEST(DrmVmBindTest, givenBoRequiringImmediateBindWhenBindingThenImmediateFlagIsP
executionEnvironment->initializeMemoryManager();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
MockBufferObject bo(&drm, 0, 0, 1);
MockBufferObject bo(&drm, 3, 0, 0, 1);
bo.requireImmediateBinding(true);
OsContextLinux osContext(drm, 0u, EngineDescriptorHelper::getDefaultDescriptor());
@@ -43,7 +43,7 @@ TEST(DrmVmBindTest, givenBoRequiringExplicitResidencyWhenBindingThenMakeResident
drm.pageFaultSupported = true;
for (auto requireResidency : {false, true}) {
MockBufferObject bo(&drm, 0, 0, 1);
MockBufferObject bo(&drm, 3, 0, 0, 1);
bo.requireExplicitResidency(requireResidency);
OsContextLinux osContext(drm, 0u, EngineDescriptorHelper::getDefaultDescriptor());
@@ -83,7 +83,7 @@ TEST(DrmVmBindTest, givenBoNotRequiringExplicitResidencyWhenCallingWaitForBindTh
drm.pageFaultSupported = true;
for (auto requireResidency : {false, true}) {
MockBufferObject bo(&drm, 0, 0, 1);
MockBufferObject bo(&drm, 3, 0, 0, 1);
bo.requireExplicitResidency(requireResidency);
OsContextLinux osContext(drm, 0u, EngineDescriptorHelper::getDefaultDescriptor());
@@ -118,7 +118,7 @@ TEST(DrmVmBindTest, givenUseKmdMigrationWhenCallingBindBoOnUnifiedSharedMemoryTh
osContext.ensureContextInitialized();
uint32_t vmHandleId = 0;
MockBufferObject bo(&drm, 0, 0, 1);
MockBufferObject bo(&drm, 3, 0, 0, 1);
MockDrmAllocation allocation(AllocationType::UNIFIED_SHARED_MEMORY, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;

View File

@@ -207,7 +207,7 @@ TEST_F(IoctlHelperPrelimFixture, givenPrelimsWhenWaitUserFenceThenCorrectValueRe
TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemAdviseFailsThenDontUpdateMemAdviceFlags) {
drm->ioctlRetVal = -1;
MockBufferObject bo(drm.get(), 0, 0, 1);
MockBufferObject bo(drm.get(), 3, 0, 0, 1);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;
@@ -221,7 +221,7 @@ TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemAdviseFailsThenDont
}
TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemAdviseWithNonAtomicIsCalledThenUpdateTheCorrespondingVmAdviceForBufferObject) {
MockBufferObject bo(drm.get(), 0, 0, 1);
MockBufferObject bo(drm.get(), 3, 0, 0, 1);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;
@@ -237,7 +237,7 @@ TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemAdviseWithNonAtomic
}
TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemAdviseWithDevicePreferredLocationIsCalledThenUpdateTheCorrespondingVmAdviceForBufferObject) {
MockBufferObject bo(drm.get(), 0, 0, 1);
MockBufferObject bo(drm.get(), 3, 0, 0, 1);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;
@@ -253,7 +253,7 @@ TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemAdviseWithDevicePre
}
TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemPrefetchSucceedsThenReturnTrue) {
MockBufferObject bo(drm.get(), 0, 0, 1);
MockBufferObject bo(drm.get(), 3, 0, 0, 1);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;
@@ -262,7 +262,7 @@ TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemPrefetchSucceedsThe
}
TEST_F(IoctlHelperPrelimFixture, givenDrmAllocationWhenSetMemPrefetchFailsThenReturnFalse) {
MockBufferObject bo(drm.get(), 0, 0, 1);
MockBufferObject bo(drm.get(), 3, 0, 0, 1);
MockDrmAllocation allocation(AllocationType::BUFFER, MemoryPool::LocalMemory);
allocation.bufferObjects[0] = &bo;