Skip to content

Commit 2358173

Browse files
Fix reserved size in shared BOs
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
1 parent 6a4ed40 commit 2358173

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2007,7 +2007,6 @@ TEST_F(DrmMemoryManagerWithLocalMemoryTest, givenDrmMemoryManagerWithLocalMemory
20072007

20082008
EXPECT_NE(nullptr, graphicsAllocation->getUnderlyingBuffer());
20092009
EXPECT_EQ(size, graphicsAllocation->getUnderlyingBufferSize());
2010-
EXPECT_EQ(alignUp(size, 2 * MemoryConstants::megaByte), graphicsAllocation->getReservedAddressSize());
20112010
EXPECT_EQ(MemoryPool::SystemCpuInaccessible, graphicsAllocation->getMemoryPool());
20122011
EXPECT_EQ(this->mock->inputFd, static_cast<int32_t>(handle));
20132012

@@ -2020,6 +2019,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryTest, givenDrmMemoryManagerWithLocalMemory
20202019
EXPECT_EQ(this->mock->outputHandle, static_cast<uint32_t>(bo->peekHandle()));
20212020
EXPECT_EQ(gpuAddress, bo->peekAddress());
20222021
EXPECT_EQ(size, bo->peekSize());
2022+
EXPECT_EQ(alignUp(size, 2 * MemoryConstants::megaByte), bo->peekUnmapSize());
20232023

20242024
EXPECT_EQ(handle, graphicsAllocation->peekSharedHandle());
20252025

shared/source/os_interface/linux/drm_memory_manager.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,6 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
580580
auto boHandle = openFd.handle;
581581
auto bo = findAndReferenceSharedBufferObject(boHandle);
582582

583-
uint64_t gpuRange = 0llu;
584-
size_t reservedRange = 0u;
585-
586583
if (bo == nullptr) {
587584
size_t size = lseekFunction(handle, 0, SEEK_END);
588585

@@ -596,11 +593,10 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
596593
if (requireSpecificBitness && this->force32bitAllocations) {
597594
heapIndex = HeapIndex::HEAP_EXTERNAL;
598595
}
599-
gpuRange = acquireGpuRange(size, properties.rootDeviceIndex, heapIndex);
596+
auto gpuRange = acquireGpuRange(size, properties.rootDeviceIndex, heapIndex);
600597

601598
bo->setAddress(gpuRange);
602599
bo->setUnmapSize(size);
603-
reservedRange = size;
604600

605601
pushSharedBufferObject(bo);
606602
}
@@ -609,9 +605,6 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
609605

610606
auto drmAllocation = new DrmAllocation(properties.rootDeviceIndex, properties.allocationType, bo, reinterpret_cast<void *>(bo->gpuAddress), bo->size,
611607
handle, MemoryPool::SystemCpuInaccessible);
612-
if (reservedRange) {
613-
drmAllocation->setReservedAddressRange(reinterpret_cast<void *>(gpuRange), reservedRange);
614-
}
615608

616609
if (requireSpecificBitness && this->force32bitAllocations) {
617610
drmAllocation->set32BitAllocation(true);

0 commit comments

Comments
 (0)