mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Pass number of os contexts to Graphics Allocation constructor
Mark unshareable allocations Change-Id: Ie745dc639d8c6b01e2275d29ee1fb4c6343df2bc Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
2f15ca0508
commit
352450adaa
@@ -114,7 +114,7 @@ HWTEST_F(AUBReadBuffer, reserveCanonicalGpuAddress) {
|
||||
|
||||
cl_float srcMemory[] = {1.0f, 2.0f, 3.0f, 4.0f};
|
||||
cl_float dstMemory[] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
GraphicsAllocation *srcAlocation = new GraphicsAllocation(srcMemory, 0xFFFF800400001000, 0xFFFF800400001000, sizeof(srcMemory));
|
||||
GraphicsAllocation *srcAlocation = new GraphicsAllocation(srcMemory, 0xFFFF800400001000, 0xFFFF800400001000, sizeof(srcMemory), 1u, false);
|
||||
|
||||
std::unique_ptr<Buffer> srcBuffer(Buffer::createBufferHw(&context,
|
||||
CL_MEM_USE_HOST_PTR,
|
||||
|
||||
@@ -294,7 +294,7 @@ TEST(CommandStreamReceiverSimpleTest, givenCommandStreamReceiverWhenItIsDestroye
|
||||
|
||||
bool destructorCalled = false;
|
||||
|
||||
auto mockGraphicsAllocation = new MockGraphicsAllocationWithDestructorTracing(nullptr, 0llu, 0llu, 1u);
|
||||
auto mockGraphicsAllocation = new MockGraphicsAllocationWithDestructorTracing(nullptr, 0llu, 0llu, 1u, 1u, false);
|
||||
mockGraphicsAllocation->destructorCalled = &destructorCalled;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.commandStreamReceivers.resize(1);
|
||||
@@ -358,27 +358,29 @@ TEST(CommandStreamReceiverMultiContextTests, givenMultipleCsrsWhenSameResourcesA
|
||||
auto &commandStreamReceiver0 = device0->getCommandStreamReceiver();
|
||||
auto &commandStreamReceiver1 = device1->getCommandStreamReceiver();
|
||||
|
||||
auto graphicsAllocation = executionEnvironment->memoryManager->allocateGraphicsMemory(4096u);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
|
||||
commandStreamReceiver0.makeResident(*graphicsAllocation);
|
||||
commandStreamReceiver1.makeResident(*graphicsAllocation);
|
||||
commandStreamReceiver0.makeResident(graphicsAllocation);
|
||||
EXPECT_EQ(1u, commandStreamReceiver0.getResidencyAllocations().size());
|
||||
EXPECT_EQ(0u, commandStreamReceiver1.getResidencyAllocations().size());
|
||||
|
||||
commandStreamReceiver1.makeResident(graphicsAllocation);
|
||||
EXPECT_EQ(1u, commandStreamReceiver0.getResidencyAllocations().size());
|
||||
EXPECT_EQ(1u, commandStreamReceiver1.getResidencyAllocations().size());
|
||||
|
||||
EXPECT_EQ(1u, graphicsAllocation->getResidencyTaskCount(0u));
|
||||
EXPECT_EQ(1u, graphicsAllocation->getResidencyTaskCount(1u));
|
||||
EXPECT_EQ(1u, graphicsAllocation.getResidencyTaskCount(0u));
|
||||
EXPECT_EQ(1u, graphicsAllocation.getResidencyTaskCount(1u));
|
||||
|
||||
commandStreamReceiver0.makeNonResident(*graphicsAllocation);
|
||||
commandStreamReceiver1.makeNonResident(*graphicsAllocation);
|
||||
commandStreamReceiver0.makeNonResident(graphicsAllocation);
|
||||
EXPECT_FALSE(graphicsAllocation.isResident(0u));
|
||||
EXPECT_TRUE(graphicsAllocation.isResident(1u));
|
||||
|
||||
EXPECT_FALSE(graphicsAllocation->isResident(0u));
|
||||
EXPECT_FALSE(graphicsAllocation->isResident(1u));
|
||||
commandStreamReceiver1.makeNonResident(graphicsAllocation);
|
||||
EXPECT_FALSE(graphicsAllocation.isResident(0u));
|
||||
EXPECT_FALSE(graphicsAllocation.isResident(1u));
|
||||
|
||||
EXPECT_EQ(1u, commandStreamReceiver0.getEvictionAllocations().size());
|
||||
EXPECT_EQ(1u, commandStreamReceiver1.getEvictionAllocations().size());
|
||||
|
||||
executionEnvironment->memoryManager->freeGraphicsMemory(graphicsAllocation);
|
||||
}
|
||||
|
||||
struct CreateAllocationForHostSurfaceTest : public ::testing::Test {
|
||||
|
||||
@@ -50,7 +50,7 @@ struct CnlPreambleWaCmds : public PreambleFixture {
|
||||
DeviceFixture::SetUpImpl(pHwInfo);
|
||||
HardwareParse::SetUp();
|
||||
if (pDevice->getPreemptionMode() == PreemptionMode::MidThread) {
|
||||
preemptionLocation.reset(new GraphicsAllocation(nullptr, 0llu, 0llu, 0));
|
||||
preemptionLocation.reset(new MockGraphicsAllocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -700,12 +700,12 @@ HWCMDTEST_F(IGFX_GEN8_CORE, KernelCommandsTest, usedBindingTableStatePointersFor
|
||||
|
||||
// setup global memory
|
||||
char globalBuffer[16];
|
||||
GraphicsAllocation gfxGlobalAlloc(globalBuffer, castToUint64(globalBuffer), 0llu, sizeof(globalBuffer));
|
||||
GraphicsAllocation gfxGlobalAlloc(globalBuffer, castToUint64(globalBuffer), 0llu, sizeof(globalBuffer), 1u, false);
|
||||
program.setGlobalSurface(&gfxGlobalAlloc);
|
||||
|
||||
// setup constant memory
|
||||
char constBuffer[16];
|
||||
GraphicsAllocation gfxConstAlloc(constBuffer, castToUint64(constBuffer), 0llu, sizeof(constBuffer));
|
||||
GraphicsAllocation gfxConstAlloc(constBuffer, castToUint64(constBuffer), 0llu, sizeof(constBuffer), 1u, false);
|
||||
program.setConstantSurface(&gfxConstAlloc);
|
||||
|
||||
// create kernel
|
||||
|
||||
@@ -863,7 +863,7 @@ TEST_F(KernelGlobalSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenGlobalS
|
||||
|
||||
char buffer[16];
|
||||
|
||||
GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8);
|
||||
GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8, 1u, false);
|
||||
uint64_t bufferAddress = (uint64_t)gfxAlloc.getUnderlyingBuffer();
|
||||
|
||||
// create kernel
|
||||
@@ -906,7 +906,7 @@ TEST_F(KernelGlobalSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenGlobalS
|
||||
|
||||
char buffer[16];
|
||||
|
||||
GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8);
|
||||
GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8, 1u, false);
|
||||
uint64_t bufferAddress = gfxAlloc.getGpuAddress();
|
||||
|
||||
// create kernel
|
||||
@@ -1038,7 +1038,7 @@ TEST_F(KernelConstantSurfaceTest, givenBuiltInKernelWhenKernelIsCreatedThenConst
|
||||
|
||||
char buffer[16];
|
||||
|
||||
GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8);
|
||||
GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8, 1u, false);
|
||||
uint64_t bufferAddress = (uint64_t)gfxAlloc.getUnderlyingBuffer();
|
||||
|
||||
// create kernel
|
||||
@@ -1080,7 +1080,7 @@ TEST_F(KernelConstantSurfaceTest, givenNDRangeKernelWhenKernelIsCreatedThenConst
|
||||
|
||||
char buffer[16];
|
||||
|
||||
GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8);
|
||||
GraphicsAllocation gfxAlloc((void *)buffer, (uint64_t)buffer - 8u, 8, 1u, false);
|
||||
uint64_t bufferAddress = gfxAlloc.getGpuAddress();
|
||||
|
||||
// create kernel
|
||||
|
||||
@@ -67,7 +67,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
||||
|
||||
UltCommandStreamReceiver(const HardwareInfo &hwInfoIn, ExecutionEnvironment &executionEnvironment) : BaseClass(hwInfoIn, executionEnvironment) {
|
||||
if (hwInfoIn.capabilityTable.defaultPreemptionMode == PreemptionMode::MidThread) {
|
||||
tempPreemptionLocation = std::make_unique<GraphicsAllocation>(nullptr, 0, 0, 0);
|
||||
tempPreemptionLocation = std::make_unique<GraphicsAllocation>(nullptr, 0, 0, 0, 1u, false);
|
||||
this->preemptionCsrAllocation = tempPreemptionLocation.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
using namespace OCLRT;
|
||||
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenTaskCountsAreInitializedProperly) {
|
||||
GraphicsAllocation graphicsAllocation1(nullptr, 0u, 0u, 0u);
|
||||
GraphicsAllocation graphicsAllocation2(nullptr, 0u, 0u);
|
||||
GraphicsAllocation graphicsAllocation1(nullptr, 0u, 0u, 0u, maxOsContextCount, true);
|
||||
GraphicsAllocation graphicsAllocation2(nullptr, 0u, 0u, maxOsContextCount, true);
|
||||
for (auto i = 0u; i < maxOsContextCount; i++) {
|
||||
EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation1.getTaskCount(i));
|
||||
EXPECT_EQ(MockGraphicsAllocation::objectNotUsed, graphicsAllocation2.getTaskCount(i));
|
||||
@@ -22,13 +22,13 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenIsCreatedThenTaskCountsA
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedTaskCountThenAllocationWasUsed) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
EXPECT_FALSE(graphicsAllocation.isUsed());
|
||||
graphicsAllocation.updateTaskCount(0u, 0u);
|
||||
EXPECT_TRUE(graphicsAllocation.isUsed());
|
||||
}
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedTaskCountThenOnlyOneTaskCountIsUpdated) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
graphicsAllocation.updateTaskCount(1u, 0u);
|
||||
EXPECT_EQ(1u, graphicsAllocation.getTaskCount(0u));
|
||||
for (auto i = 1u; i < maxOsContextCount; i++) {
|
||||
@@ -42,7 +42,7 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedTaskCountThenOnly
|
||||
}
|
||||
}
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedTaskCountToobjectNotUsedValueThenUnregisterContext) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
EXPECT_FALSE(graphicsAllocation.isUsed());
|
||||
graphicsAllocation.updateTaskCount(0u, 0u);
|
||||
EXPECT_TRUE(graphicsAllocation.isUsed());
|
||||
@@ -50,7 +50,7 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedTaskCountToobject
|
||||
EXPECT_FALSE(graphicsAllocation.isUsed());
|
||||
}
|
||||
TEST(GraphicsAllocationTest, whenTwoContextsUpdatedTaskCountAndOneOfThemUnregisteredThenOneContextUsageRemains) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
EXPECT_FALSE(graphicsAllocation.isUsed());
|
||||
graphicsAllocation.updateTaskCount(0u, 0u);
|
||||
graphicsAllocation.updateTaskCount(0u, 1u);
|
||||
@@ -64,7 +64,7 @@ TEST(GraphicsAllocationTest, whenTwoContextsUpdatedTaskCountAndOneOfThemUnregist
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedResidencyTaskCountToNonDefaultValueThenAllocationIsResident) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
EXPECT_FALSE(graphicsAllocation.isResident(0u));
|
||||
uint32_t residencyTaskCount = 1u;
|
||||
graphicsAllocation.updateResidencyTaskCount(residencyTaskCount, 0u);
|
||||
@@ -76,7 +76,7 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationWhenUpdatedResidencyTaskCoun
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, givenResidentGraphicsAllocationWhenResetResidencyTaskCountThenAllocationIsNotResident) {
|
||||
GraphicsAllocation graphicsAllocation(nullptr, 0u, 0u);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
graphicsAllocation.updateResidencyTaskCount(1, 0u);
|
||||
EXPECT_TRUE(graphicsAllocation.isResident(0u));
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ TEST(GraphicsAllocationTest, Ctor2) {
|
||||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
osHandle sharedHandle = Sharing::nonSharedResource;
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, size, sharedHandle);
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, size, sharedHandle, 1u, false);
|
||||
uint64_t expectedGpuAddr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(gfxAllocation.getUnderlyingBuffer()));
|
||||
|
||||
EXPECT_EQ(expectedGpuAddr, gfxAllocation.getGpuAddress());
|
||||
@@ -87,7 +87,7 @@ TEST(GraphicsAllocationTest, getGpuAddress) {
|
||||
uint64_t gpuBaseAddr = 0x10000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size);
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, 1u, false);
|
||||
|
||||
EXPECT_EQ(gpuAddr, gfxAllocation.getGpuAddress());
|
||||
|
||||
@@ -104,7 +104,7 @@ TEST(GraphicsAllocationTest, getGpuAddressToPatch) {
|
||||
uint64_t gpuBaseAddr = 0x10000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size);
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, 1u, false);
|
||||
|
||||
EXPECT_EQ(gpuAddr - gpuBaseAddr, gfxAllocation.getGpuAddressToPatch());
|
||||
}
|
||||
@@ -115,7 +115,7 @@ TEST(GraphicsAllocationTest, setSize) {
|
||||
uint64_t gpuBaseAddr = 0x10000;
|
||||
size_t size = 0x2000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size);
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, 1u, false);
|
||||
EXPECT_EQ(size, gfxAllocation.getUnderlyingBufferSize());
|
||||
|
||||
size = 0x3000;
|
||||
@@ -129,7 +129,7 @@ TEST(GraphicsAllocationTest, GivenGraphicsAllocationWhenLockingThenIsLocked) {
|
||||
uint64_t gpuBaseAddr = 0x10000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size);
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, 1u, false);
|
||||
|
||||
gfxAllocation.setLocked(false);
|
||||
EXPECT_FALSE(gfxAllocation.isLocked());
|
||||
@@ -1388,7 +1388,7 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation
|
||||
void *addressWithTrailingBitSet = reinterpret_cast<void *>(address);
|
||||
uint64_t expectedGpuAddress = 0xf0000000;
|
||||
osHandle sharedHandle{};
|
||||
GraphicsAllocation graphicsAllocation(addressWithTrailingBitSet, 1u, sharedHandle);
|
||||
GraphicsAllocation graphicsAllocation(addressWithTrailingBitSet, 1u, sharedHandle, 1u, false);
|
||||
EXPECT_EQ(expectedGpuAddress, graphicsAllocation.getGpuAddress());
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@ class MockGraphicsAllocation : public GraphicsAllocation {
|
||||
using GraphicsAllocation::objectNotResident;
|
||||
using GraphicsAllocation::objectNotUsed;
|
||||
|
||||
MockGraphicsAllocation(void *buffer, size_t sizeIn) : GraphicsAllocation(buffer, castToUint64(buffer), 0llu, sizeIn) {
|
||||
MockGraphicsAllocation() : MockGraphicsAllocation(true) {}
|
||||
MockGraphicsAllocation(bool shareable) : GraphicsAllocation(nullptr, 0u, 0, maxOsContextCount, shareable) {}
|
||||
MockGraphicsAllocation(void *buffer, size_t sizeIn) : GraphicsAllocation(buffer, castToUint64(buffer), 0llu, sizeIn, maxOsContextCount, false) {
|
||||
}
|
||||
void resetInspectionId() {
|
||||
this->inspectionId = 0;
|
||||
|
||||
@@ -107,7 +107,7 @@ TEST_F(DrmCommandStreamTest, makeResident) {
|
||||
.Times(0);
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(0);
|
||||
DrmAllocation graphicsAllocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull);
|
||||
DrmAllocation graphicsAllocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
csr->makeResident(graphicsAllocation);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ TEST_F(DrmCommandStreamTest, makeResidentTwiceTheSame) {
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(0);
|
||||
|
||||
DrmAllocation graphicsAllocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull);
|
||||
DrmAllocation graphicsAllocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
csr->makeResident(graphicsAllocation);
|
||||
@@ -137,7 +137,7 @@ TEST_F(DrmCommandStreamTest, makeResidentSizeZero) {
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(0);
|
||||
|
||||
DrmAllocation graphicsAllocation(nullptr, nullptr, 0, MemoryPool::MemoryNull);
|
||||
DrmAllocation graphicsAllocation(nullptr, nullptr, 0, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
}
|
||||
@@ -152,8 +152,8 @@ TEST_F(DrmCommandStreamTest, makeResidentResized) {
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(0);
|
||||
|
||||
DrmAllocation graphicsAllocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull);
|
||||
DrmAllocation graphicsAllocation2(nullptr, nullptr, 8192, MemoryPool::MemoryNull);
|
||||
DrmAllocation graphicsAllocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation graphicsAllocation2(nullptr, nullptr, 8192, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(graphicsAllocation);
|
||||
csr->makeResident(graphicsAllocation2);
|
||||
@@ -259,7 +259,7 @@ TEST_F(DrmCommandStreamTest, FlushInvalidAddress) {
|
||||
//allocate command buffer manually
|
||||
char *commandBuffer = new (std::nothrow) char[1024];
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
DrmAllocation commandBufferAllocation(nullptr, commandBuffer, 1024, MemoryPool::MemoryNull);
|
||||
DrmAllocation commandBufferAllocation(nullptr, commandBuffer, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
LinearStream cs(&commandBufferAllocation);
|
||||
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
@@ -401,8 +401,8 @@ TEST_F(DrmCommandStreamTest, FlushCheckFlags) {
|
||||
.Times(1)
|
||||
.WillRepeatedly(::testing::Return(0));
|
||||
|
||||
DrmAllocation allocation(nullptr, (void *)0x7FFFFFFF, 1024, MemoryPool::MemoryNull);
|
||||
DrmAllocation allocation2(nullptr, (void *)0x307FFFFFFF, 1024, MemoryPool::MemoryNull);
|
||||
DrmAllocation allocation(nullptr, (void *)0x7FFFFFFF, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
DrmAllocation allocation2(nullptr, (void *)0x307FFFFFFF, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
csr->makeResident(allocation);
|
||||
csr->makeResident(allocation2);
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
@@ -435,7 +435,7 @@ TEST_F(DrmCommandStreamTest, CheckDrmFree) {
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(2);
|
||||
|
||||
DrmAllocation allocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull);
|
||||
DrmAllocation allocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(allocation);
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
@@ -476,7 +476,7 @@ TEST_F(DrmCommandStreamTest, CheckDrmFreeCloseFailed) {
|
||||
.WillOnce(::testing::Return(-1));
|
||||
EXPECT_CALL(*mock, ioctl(DRM_IOCTL_I915_GEM_WAIT, ::testing::_))
|
||||
.Times(2);
|
||||
DrmAllocation allocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull);
|
||||
DrmAllocation allocation(nullptr, nullptr, 1024, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(allocation);
|
||||
csr->addBatchBufferEnd(cs, nullptr);
|
||||
@@ -1037,7 +1037,7 @@ typedef Test<DrmCommandStreamEnhancedFixture> DrmCommandStreamLeaksTest;
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeResident) {
|
||||
auto buffer = this->createBO(1024);
|
||||
auto allocation = new DrmAllocation(buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull);
|
||||
auto allocation = new DrmAllocation(buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
EXPECT_EQ(nullptr, allocation->getUnderlyingBuffer());
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
@@ -1059,8 +1059,8 @@ TEST_F(DrmCommandStreamLeaksTest, makeResident) {
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeResidentOnly) {
|
||||
BufferObject *buffer1 = this->createBO(4096);
|
||||
BufferObject *buffer2 = this->createBO(4096);
|
||||
auto allocation1 = new DrmAllocation(buffer1, nullptr, buffer1->peekSize(), MemoryPool::MemoryNull);
|
||||
auto allocation2 = new DrmAllocation(buffer2, nullptr, buffer2->peekSize(), MemoryPool::MemoryNull);
|
||||
auto allocation1 = new DrmAllocation(buffer1, nullptr, buffer1->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
auto allocation2 = new DrmAllocation(buffer2, nullptr, buffer2->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
EXPECT_EQ(nullptr, allocation1->getUnderlyingBuffer());
|
||||
EXPECT_EQ(nullptr, allocation2->getUnderlyingBuffer());
|
||||
|
||||
@@ -1087,7 +1087,7 @@ TEST_F(DrmCommandStreamLeaksTest, makeResidentOnly) {
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeResidentTwice) {
|
||||
auto buffer = this->createBO(1024);
|
||||
auto allocation = new DrmAllocation(buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull);
|
||||
auto allocation = new DrmAllocation(buffer, nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
csr->makeResident(*allocation);
|
||||
csr->processResidency(csr->getResidencyAllocations(), *osContext);
|
||||
@@ -1357,7 +1357,7 @@ TEST_F(DrmCommandStreamLeaksTest, GivenTwoAllocationsWhenBackingStorageIsDiffere
|
||||
|
||||
TEST_F(DrmCommandStreamLeaksTest, makeResidentSizeZero) {
|
||||
std::unique_ptr<BufferObject> buffer(this->createBO(0));
|
||||
DrmAllocation allocation(buffer.get(), nullptr, buffer->peekSize(), MemoryPool::MemoryNull);
|
||||
DrmAllocation allocation(buffer.get(), nullptr, buffer->peekSize(), MemoryPool::MemoryNull, 1u, false);
|
||||
EXPECT_EQ(nullptr, allocation.getUnderlyingBuffer());
|
||||
EXPECT_EQ(buffer->peekSize(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
@@ -1582,7 +1582,7 @@ class DrmMockBuffer : public Buffer {
|
||||
public:
|
||||
static DrmMockBuffer *create() {
|
||||
char *data = static_cast<char *>(::alignedMalloc(128, 64));
|
||||
DrmAllocation *alloc = new (std::nothrow) DrmAllocation(nullptr, &data, sizeof(data), MemoryPool::MemoryNull);
|
||||
DrmAllocation *alloc = new (std::nothrow) DrmAllocation(nullptr, &data, sizeof(data), MemoryPool::MemoryNull, 1u, false);
|
||||
return new DrmMockBuffer(data, 128, alloc);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class DrmGemCloseWorkerFixture {
|
||||
};
|
||||
class DrmAllocationWrapper : public DrmAllocation {
|
||||
public:
|
||||
DrmAllocationWrapper(BufferObject *bo) : DrmAllocation(bo, nullptr, 0, MemoryPool::MemoryNull) {
|
||||
DrmAllocationWrapper(BufferObject *bo) : DrmAllocation(bo, nullptr, 0, MemoryPool::MemoryNull, 1u, false) {
|
||||
}
|
||||
};
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
||||
@@ -118,7 +118,7 @@ TEST_F(DrmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationTo
|
||||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
DrmAllocation gfxAllocation(nullptr, cpuPtr, size, MemoryPool::MemoryNull);
|
||||
DrmAllocation gfxAllocation(nullptr, cpuPtr, size, MemoryPool::MemoryNull, 1u, false);
|
||||
memoryManager->addAllocationToHostPtrManager(&gfxAllocation);
|
||||
auto fragment = memoryManager->getHostPtrManager()->getFragment(gfxAllocation.getUnderlyingBuffer());
|
||||
EXPECT_NE(fragment, nullptr);
|
||||
@@ -1763,7 +1763,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnNullAl
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAllocationWithoutBufferObjectThenReturnNullPtr) {
|
||||
DrmAllocation drmAllocation(nullptr, nullptr, 0u, 0u);
|
||||
DrmAllocation drmAllocation(nullptr, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_EQ(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -1782,7 +1782,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledButFails
|
||||
BufferObjectMock(Drm *drm) : BufferObject(drm, 1, true) {}
|
||||
};
|
||||
BufferObjectMock bo(&drmMock);
|
||||
DrmAllocation drmAllocation(&bo, nullptr, 0u, 0u);
|
||||
DrmAllocation drmAllocation(&bo, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto ptr = memoryManager->lockResource(&drmAllocation);
|
||||
@@ -1793,7 +1793,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledButFails
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledOnAllocationWithoutBufferObjectThenReturnFalse) {
|
||||
DrmAllocation drmAllocation(nullptr, nullptr, 0u, 0u);
|
||||
DrmAllocation drmAllocation(nullptr, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_EQ(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, false);
|
||||
@@ -1810,7 +1810,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledButFai
|
||||
BufferObjectMock(Drm *drm) : BufferObject(drm, 1, true) {}
|
||||
};
|
||||
BufferObjectMock bo(&drmMock);
|
||||
DrmAllocation drmAllocation(&bo, nullptr, 0u, 0u);
|
||||
DrmAllocation drmAllocation(&bo, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, false);
|
||||
@@ -1826,7 +1826,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledOnAllo
|
||||
BufferObjectMock(Drm *drm) : BufferObject(drm, 1, true) {}
|
||||
};
|
||||
BufferObjectMock bo(&drmMock);
|
||||
DrmAllocation drmAllocation(&bo, nullptr, 0u, 0u);
|
||||
DrmAllocation drmAllocation(&bo, nullptr, 0u, 0u, 1u, false);
|
||||
EXPECT_NE(nullptr, drmAllocation.getBO());
|
||||
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, true);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace OCLRT {
|
||||
|
||||
class MockWddmAllocation : public WddmAllocation {
|
||||
public:
|
||||
MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u) {
|
||||
MockWddmAllocation() : WddmAllocation(nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x100);
|
||||
WddmAllocation allocation(fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(fakePtr, 0x2100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.gmm = gmm.get();
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -170,7 +170,7 @@ TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) {
|
||||
|
||||
TEST_F(Wddm20Tests, allocation) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -194,7 +194,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
|
||||
size_t underlyingPages = underlyingSize / MemoryConstants::pageSize;
|
||||
size_t alignedPages = alignedSize / MemoryConstants::pageSize;
|
||||
|
||||
WddmAllocation allocation(ptr, 0x2100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(ptr, 0x2100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -217,7 +217,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize()));
|
||||
|
||||
allocation.gmm = gmm.get();
|
||||
@@ -240,7 +240,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
void *alignedPtr = (void *)0x12000;
|
||||
size_t alignedSize = 0x2000;
|
||||
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -268,7 +268,7 @@ TEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAddressWithingHeap1Limits) {
|
||||
void *alignedPtr = (void *)0x12000;
|
||||
size_t alignedSize = 0x2000;
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
allocation.gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
@@ -318,7 +318,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati
|
||||
|
||||
TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -344,7 +344,7 @@ TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
|
||||
WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(nullptr, 100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -363,7 +363,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||
|
||||
allocation.gmm = gmm;
|
||||
@@ -568,7 +568,7 @@ TEST(DebugFlagTest, givenDebugManagerWhenGetForUseNoRingFlushesKmdModeIsCalledTh
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
D3DKMT_HANDLE handles[2] = {0};
|
||||
@@ -590,7 +590,7 @@ TEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
|
||||
TEST_F(Wddm20Tests, makeResidentMultipleHandlesWithReturnBytesToTrim) {
|
||||
OsAgnosticMemoryManager mm(false, false, executionEnvironment);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
D3DKMT_HANDLE handles[2] = {0};
|
||||
@@ -630,7 +630,7 @@ TEST_F(Wddm20Tests, makeNonResidentCallsEvict) {
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedToDestroyAllocation) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -658,7 +658,7 @@ TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedTo
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -681,7 +681,7 @@ TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalle
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.getResidencyData().updateCompletionData(10, osContext.get()->getContextId());
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -739,7 +739,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
auto gmm = std::make_unique<Gmm>(fakePtr, 100, false);
|
||||
WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation(fakePtr, 100, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
EXPECT_FALSE(wddm->createAllocation64k(&allocation));
|
||||
|
||||
@@ -84,7 +84,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
@@ -100,7 +100,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDaf
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDafListenerNotifyUnmapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
allocation.gpuPtr = GPUVA;
|
||||
|
||||
wddmWithKmDafMock->freeGpuVirtualAddres(allocation.gpuPtr, allocation.getUnderlyingBufferSize());
|
||||
@@ -140,7 +140,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
@@ -154,7 +154,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ TEST(WddmMemoryManager, NonAssignable) {
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 3u};
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 3u, false};
|
||||
OsContext osContext{nullptr, 1u};
|
||||
allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u);
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u));
|
||||
@@ -66,14 +66,14 @@ TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGetting
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenAllocationCreatedWithOsContextCountOneWhenItIsCreatedThenMaxOsContextCountIsUsedInstead) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u};
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
allocation.setTrimCandidateListPosition(3u, 700u);
|
||||
EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(3u));
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(2u));
|
||||
}
|
||||
|
||||
TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidateListPositionThenReturnUnusedPosition) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u};
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1u));
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1000u));
|
||||
}
|
||||
@@ -236,7 +236,7 @@ TEST_F(WddmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationT
|
||||
void *cpuPtr = (void *)0x30000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation gfxAllocation(cpuPtr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false);
|
||||
memoryManager->addAllocationToHostPtrManager(&gfxAllocation);
|
||||
auto fragment = memoryManager->getHostPtrManager()->getFragment(gfxAllocation.getUnderlyingBuffer());
|
||||
EXPECT_NE(fragment, nullptr);
|
||||
@@ -802,7 +802,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false);
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_FALSE(ret);
|
||||
@@ -818,7 +818,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false);
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_TRUE(ret);
|
||||
@@ -834,7 +834,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAnd
|
||||
|
||||
setMapGpuVaFailConfigFcn(0, 2);
|
||||
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocation(ptr, size, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false);
|
||||
allocation.gmm = gmm.get();
|
||||
bool ret = memoryManager->createWddmAllocation(&allocation, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
EXPECT_FALSE(ret);
|
||||
@@ -1191,7 +1191,6 @@ TEST_F(MockWddmMemoryManagerTest, givenDefaultMemoryManagerWhenItIsCreatedThenAs
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithNoRegisteredOsContextsWhenCallingIsMemoryBudgetExhaustedThenReturnFalse) {
|
||||
ASSERT_EQ(0u, memoryManager->getOsContextCount());
|
||||
EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted());
|
||||
}
|
||||
|
||||
|
||||
@@ -632,9 +632,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetReturnsFalseWhenNumBytesT
|
||||
}
|
||||
|
||||
TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetStopsEvictingWhenNumBytesToTrimIsZero) {
|
||||
WddmAllocation allocation1(reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 1u),
|
||||
allocation2(reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, 1u),
|
||||
allocation3(reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation1(reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false),
|
||||
allocation2(reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull, 1u, false),
|
||||
allocation3(reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@@ -727,8 +727,8 @@ TEST_F(WddmResidencyControllerWithGdiTest, trimToBudgetWaitsFromCpuWhenLastFence
|
||||
TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||
WddmAllocation allocation1(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation2(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation1(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
WddmAllocation allocation2(ptr, 0x1000, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@@ -786,9 +786,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenThreeAllocationsAlignedSizeBigge
|
||||
void *ptr2 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x3000);
|
||||
void *ptr3 = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x5000);
|
||||
|
||||
WddmAllocation allocation1(ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation2(ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation3(ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u);
|
||||
WddmAllocation allocation1(ptr1, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
WddmAllocation allocation2(ptr2, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
WddmAllocation allocation3(ptr3, underlyingSize, nullptr, MemoryPool::MemoryNull, 1u, false);
|
||||
|
||||
allocation1.getResidencyData().resident = true;
|
||||
allocation1.getResidencyData().updateCompletionData(0, osContextId);
|
||||
@@ -988,7 +988,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToB
|
||||
MockWddmAllocation allocation1;
|
||||
void *cpuPtr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1000);
|
||||
size_t allocationSize = 0x1000;
|
||||
WddmAllocation allocationToTrim(cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount());
|
||||
WddmAllocation allocationToTrim(cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, memoryManager->getOsContextCount(), false);
|
||||
|
||||
allocationToTrim.getResidencyData().updateCompletionData(residencyController->getMonitoredFence().lastSubmittedFence, osContext->getContextId());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user