mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
[9/n] Internal 4GB allocator
- Add new function to compute offset from the heap base. Change-Id: I1eda6e989675b767e17979181446c62444c12f9b
This commit is contained in:

committed by
sys_ocldev

parent
c4c35955d1
commit
8f0789bd3e
@ -144,3 +144,20 @@ TEST_F(LinearStreamTest, givenGraphicsAllocationWithGpuBaseAddressWhenItIsQuerie
|
||||
|
||||
EXPECT_EQ(gpuHeapBase, linearStream.getGpuBase());
|
||||
}
|
||||
|
||||
TEST_F(LinearStreamTest, given32BitHeapWhenItIsAskedForGpuoffsetThenOffsetFromBaseIsReturned) {
|
||||
auto allocationSize = 4096;
|
||||
std::unique_ptr<char> memoryPtr(new char[allocationSize]);
|
||||
uint64_t gpuHeapBase = 0x1000000;
|
||||
uint64_t gpuAddress = 0x1000017;
|
||||
|
||||
auto currentOffset = gpuAddress - gpuHeapBase;
|
||||
|
||||
GraphicsAllocation newGraphicsAllocation(memoryPtr.get(), gpuAddress, gpuHeapBase, allocationSize);
|
||||
linearStream.replaceGraphicsAllocation(&newGraphicsAllocation);
|
||||
|
||||
EXPECT_EQ(linearStream.getCurrentGpuOffsetFromHeapBase(), currentOffset);
|
||||
linearStream.getSpace(10);
|
||||
currentOffset += 10;
|
||||
EXPECT_EQ(linearStream.getCurrentGpuOffsetFromHeapBase(), currentOffset);
|
||||
}
|
||||
|
Reference in New Issue
Block a user