mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Refactor bo pinning
Change-Id: I451fa5225096829ea7131d159eb59f906817b2cd Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
d27374b468
commit
574cd634b9
@ -145,7 +145,7 @@ TEST_F(DrmBufferObjectTest, onPinIoctlFailed) {
|
||||
|
||||
bo->setAddress(reinterpret_cast<uint64_t>(buff.get()));
|
||||
BufferObject *boArray[1] = {boToPin.get()};
|
||||
auto ret = bo->pin(boArray, 1, osContext.get(), 0, 1);
|
||||
auto ret = bo->pin(boArray, 1, osContext.get(), 0, 1, true);
|
||||
EXPECT_EQ(EINVAL, ret);
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ TEST_F(DrmBufferObjectTest, givenResidentBOWhenPrintExecutionBufferIsSetToTrueTh
|
||||
BufferObject *boArray[1] = {bo.get()};
|
||||
|
||||
testing::internal::CaptureStdout();
|
||||
auto ret = bo->pin(boArray, 1, osContext.get(), 0, 1);
|
||||
auto ret = bo->pin(boArray, 1, osContext.get(), 0, 1, true);
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
@ -210,6 +210,7 @@ TEST_F(DrmBufferObjectTest, whenPrintExecutionBufferIsSetToTrueThenMessageFoundI
|
||||
TEST(DrmBufferObjectSimpleTest, givenInvalidBoWhenPinIsCalledThenErrorIsReturned) {
|
||||
std::unique_ptr<uint32_t[]> buff(new uint32_t[256]);
|
||||
std::unique_ptr<DrmMockCustom> mock(new DrmMockCustom);
|
||||
OsContextLinux osContext(*mock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
|
||||
ASSERT_NE(nullptr, mock.get());
|
||||
std::unique_ptr<TestedBufferObject> bo(new TestedBufferObject(mock.get()));
|
||||
ASSERT_NE(nullptr, bo.get());
|
||||
@ -224,8 +225,9 @@ TEST(DrmBufferObjectSimpleTest, givenInvalidBoWhenPinIsCalledThenErrorIsReturned
|
||||
mock->errnoValue = EFAULT;
|
||||
|
||||
BufferObject *boArray[1] = {boToPin.get()};
|
||||
auto ret = bo->pin(boArray, 1, nullptr, 0, 1);
|
||||
auto ret = bo->pin(boArray, 1, &osContext, 0, 1, true);
|
||||
EXPECT_EQ(EFAULT, ret);
|
||||
mock->ioctl_res = 0;
|
||||
}
|
||||
|
||||
TEST(DrmBufferObjectSimpleTest, givenBufferObjectWhenConstructedWithASizeThenTheSizeIsInitialized) {
|
||||
@ -256,7 +258,7 @@ TEST(DrmBufferObjectSimpleTest, givenArrayOfBosWhenPinnedThenAllBosArePinned) {
|
||||
BufferObject *array[3] = {boToPin.get(), boToPin2.get(), boToPin3.get()};
|
||||
|
||||
bo->setAddress(reinterpret_cast<uint64_t>(buff.get()));
|
||||
auto ret = bo->pin(array, 3, &osContext, 0, 1);
|
||||
auto ret = bo->pin(array, 3, &osContext, 0, 1, true);
|
||||
EXPECT_EQ(mock->ioctl_res, ret);
|
||||
|
||||
EXPECT_LT(0u, mock->execBuffer.batch_len);
|
||||
|
@ -3118,7 +3118,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDisabledForcePinAndEna
|
||||
PinBufferObject(Drm *drm) : BufferObject(drm, 1, 0, 1) {
|
||||
}
|
||||
|
||||
int pin(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId) override {
|
||||
int pin(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId, bool validateHostptr) override {
|
||||
for (size_t i = 0; i < numberOfBos; i++) {
|
||||
pinnedBoArray[i] = boToPin[i];
|
||||
}
|
||||
|
Reference in New Issue
Block a user