mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 08:07:19 +08:00
Set allocation's lock state only in lockResource and unlockResource methods
Change-Id: I60f35801287166f5bdb0dfcd31ff0118c56ec22a Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
09c62ca44c
commit
f332bf369e
@@ -437,16 +437,16 @@ class OsAgnosticMemoryManagerForImagesWithNoHostPtr : public OsAgnosticMemoryMan
|
||||
imageAllocation->setCpuPtrAndGpuAddress(cpuPtr, imageAllocation->getGpuAddress());
|
||||
OsAgnosticMemoryManager::freeGraphicsMemoryImpl(imageAllocation);
|
||||
};
|
||||
void *lockResource(GraphicsAllocation *imageAllocation) override {
|
||||
void *lockResourceImpl(GraphicsAllocation &imageAllocation) override {
|
||||
lockResourceParam.wasCalled = true;
|
||||
lockResourceParam.inImageAllocation = imageAllocation;
|
||||
lockCpuPtr = alignedMalloc(imageAllocation->getUnderlyingBufferSize(), MemoryConstants::pageSize);
|
||||
lockResourceParam.inImageAllocation = &imageAllocation;
|
||||
lockCpuPtr = alignedMalloc(imageAllocation.getUnderlyingBufferSize(), MemoryConstants::pageSize);
|
||||
lockResourceParam.retCpuPtr = lockCpuPtr;
|
||||
return lockResourceParam.retCpuPtr;
|
||||
};
|
||||
void unlockResource(GraphicsAllocation *imageAllocation) override {
|
||||
void unlockResourceImpl(GraphicsAllocation &imageAllocation) override {
|
||||
unlockResourceParam.wasCalled = true;
|
||||
unlockResourceParam.inImageAllocation = imageAllocation;
|
||||
unlockResourceParam.inImageAllocation = &imageAllocation;
|
||||
alignedFree(lockCpuPtr);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2018 Intel Corporation
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -55,9 +55,20 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
|
||||
return alloc;
|
||||
}
|
||||
|
||||
MOCK_METHOD1(lockResource, void *(GraphicsAllocation *allocation));
|
||||
MOCK_METHOD1(unlockResource, void(GraphicsAllocation *allocation));
|
||||
void *lockResourceImpl(GraphicsAllocation &allocation) override {
|
||||
lockResourceCalled++;
|
||||
EXPECT_EQ(expectedLockingAllocation, &allocation);
|
||||
return lockResourceReturnValue;
|
||||
}
|
||||
void unlockResourceImpl(GraphicsAllocation &allocation) override {
|
||||
unlockResourceCalled++;
|
||||
EXPECT_EQ(expectedLockingAllocation, &allocation);
|
||||
}
|
||||
|
||||
int32_t lockResourceCalled = 0;
|
||||
int32_t unlockResourceCalled = 0;
|
||||
GraphicsAllocation *expectedLockingAllocation = nullptr;
|
||||
void *lockResourceReturnValue = nullptr;
|
||||
Gmm *forceGmm = nullptr;
|
||||
bool gmmOwnershipPassed = false;
|
||||
};
|
||||
@@ -72,16 +83,16 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
|
||||
gmm = MockGmm::queryImgParams(imgInfo).release();
|
||||
mockGmmResInfo = reinterpret_cast<NiceMock<MockGmmResourceInfo> *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
mockMM->forceGmm = gmm;
|
||||
memoryManager->forceGmm = gmm;
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
dbgRestore = new DebugManagerStateRestore();
|
||||
PlatformFixture::SetUp();
|
||||
mockMM = std::make_unique<NiceMock<MockMM>>(*pPlatform->peekExecutionEnvironment());
|
||||
memoryManager = std::make_unique<MockMM>(*pPlatform->peekExecutionEnvironment());
|
||||
context = new MockContext(pPlatform->getDevice(0));
|
||||
context->forcePreferD3dSharedResources(true);
|
||||
context->setMemoryManager(mockMM.get());
|
||||
context->setMemoryManager(memoryManager.get());
|
||||
|
||||
mockSharingFcns = new NiceMock<MockD3DSharingFunctions<D3D9>>();
|
||||
context->setSharingFunctions(mockSharingFcns);
|
||||
@@ -100,7 +111,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
|
||||
void TearDown() override {
|
||||
delete cmdQ;
|
||||
delete context;
|
||||
if (!mockMM->gmmOwnershipPassed) {
|
||||
if (!memoryManager->gmmOwnershipPassed) {
|
||||
delete gmm;
|
||||
}
|
||||
PlatformFixture::TearDown();
|
||||
@@ -117,7 +128,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
|
||||
|
||||
Gmm *gmm = nullptr;
|
||||
NiceMock<MockGmmResourceInfo> *mockGmmResInfo = nullptr;
|
||||
std::unique_ptr<NiceMock<MockMM>> mockMM;
|
||||
std::unique_ptr<MockMM> memoryManager;
|
||||
};
|
||||
|
||||
TEST_F(D3D9Tests, givenD3DDeviceParamWhenContextCreationThenSetProperValues) {
|
||||
@@ -520,9 +531,7 @@ TEST_F(D3D9Tests, acquireReleaseOnSharedResourceSurfaceAndEnabledInteropUserSync
|
||||
EXPECT_CALL(*mockSharingFcns, getTexture2dDesc(_, _)).Times(1).WillOnce(SetArgPointee<0>(mockSharingFcns->mockTexture2dDesc));
|
||||
EXPECT_CALL(*mockSharingFcns, getRenderTargetData(_, _)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect(_, _, _)).Times(0);
|
||||
EXPECT_CALL(*mockMM, lockResource(_)).Times(0);
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(0);
|
||||
EXPECT_CALL(*mockMM, unlockResource(_)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect(_)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, flushAndWait(_)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, updateSurface(_, _)).Times(0);
|
||||
@@ -538,6 +547,8 @@ TEST_F(D3D9Tests, acquireReleaseOnSharedResourceSurfaceAndEnabledInteropUserSync
|
||||
|
||||
retVal = clEnqueueReleaseDX9MediaSurfacesKHR(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(0, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(0, memoryManager->unlockResourceCalled);
|
||||
}
|
||||
|
||||
TEST_F(D3D9Tests, acquireReleaseOnSharedResourceSurfaceAndDisabledInteropUserSync) {
|
||||
@@ -549,9 +560,7 @@ TEST_F(D3D9Tests, acquireReleaseOnSharedResourceSurfaceAndDisabledInteropUserSyn
|
||||
EXPECT_CALL(*mockSharingFcns, getTexture2dDesc(_, _)).Times(1).WillOnce(SetArgPointee<0>(mockSharingFcns->mockTexture2dDesc));
|
||||
EXPECT_CALL(*mockSharingFcns, getRenderTargetData(_, _)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect(_, _, _)).Times(0);
|
||||
EXPECT_CALL(*mockMM, lockResource(_)).Times(0);
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(0);
|
||||
EXPECT_CALL(*mockMM, unlockResource(_)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect(_)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, flushAndWait(_)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, updateSurface(_, _)).Times(0);
|
||||
@@ -566,6 +575,8 @@ TEST_F(D3D9Tests, acquireReleaseOnSharedResourceSurfaceAndDisabledInteropUserSyn
|
||||
|
||||
retVal = clEnqueueReleaseDX9MediaSurfacesKHR(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(0, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(0, memoryManager->unlockResourceCalled);
|
||||
}
|
||||
|
||||
TEST_F(D3D9Tests, acquireReleaseOnSharedResourceSurfaceAndDisabledInteropUserSyncIntel) {
|
||||
@@ -577,9 +588,7 @@ TEST_F(D3D9Tests, acquireReleaseOnSharedResourceSurfaceAndDisabledInteropUserSyn
|
||||
EXPECT_CALL(*mockSharingFcns, getTexture2dDesc(_, _)).Times(1).WillOnce(SetArgPointee<0>(mockSharingFcns->mockTexture2dDesc));
|
||||
EXPECT_CALL(*mockSharingFcns, getRenderTargetData(_, _)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect(_, _, _)).Times(0);
|
||||
EXPECT_CALL(*mockMM, lockResource(_)).Times(0);
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(0);
|
||||
EXPECT_CALL(*mockMM, unlockResource(_)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect(_)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, flushAndWait(_)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, updateSurface(_, _)).Times(0);
|
||||
@@ -593,6 +602,8 @@ TEST_F(D3D9Tests, acquireReleaseOnSharedResourceSurfaceAndDisabledInteropUserSyn
|
||||
|
||||
retVal = clEnqueueReleaseDX9ObjectsINTEL(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(0, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(0, memoryManager->unlockResourceCalled);
|
||||
}
|
||||
|
||||
TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndLockable) {
|
||||
@@ -613,7 +624,8 @@ TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndLockable) {
|
||||
|
||||
EXPECT_CALL(*mockSharingFcns, getRenderTargetData(_, _)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect((IDirect3DSurface9 *)&dummyD3DSurface, _, D3DLOCK_READONLY)).Times(1).WillOnce(SetArgPointee<1>(lockedRect));
|
||||
EXPECT_CALL(*mockMM, lockResource(sharedImg->getGraphicsAllocation())).Times(1).WillOnce(::testing::Return(returnedLockedRes));
|
||||
memoryManager->lockResourceReturnValue = returnedLockedRes;
|
||||
memoryManager->expectedLockingAllocation = sharedImg->getGraphicsAllocation();
|
||||
|
||||
GMM_RES_COPY_BLT requestedResCopyBlt = {};
|
||||
GMM_RES_COPY_BLT expectedResCopyBlt = {};
|
||||
@@ -624,28 +636,29 @@ TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndLockable) {
|
||||
expectedResCopyBlt.Sys.BufferSize = lockedRect.Pitch * imgHeight;
|
||||
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(1).WillOnce(::testing::Invoke([&](GMM_RES_COPY_BLT *arg) {requestedResCopyBlt = *arg; return 1; }));
|
||||
EXPECT_CALL(*mockMM, unlockResource(sharedImg->getGraphicsAllocation())).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect((IDirect3DSurface9 *)&dummyD3DSurface)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, flushAndWait(_)).Times(1);
|
||||
|
||||
auto retVal = clEnqueueAcquireDX9MediaSurfacesKHR(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(1, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(1, memoryManager->unlockResourceCalled);
|
||||
EXPECT_TRUE(memcmp(&requestedResCopyBlt, &expectedResCopyBlt, sizeof(GMM_RES_COPY_BLT)) == 0);
|
||||
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect((IDirect3DSurface9 *)&dummyD3DSurface, _, 0u)).Times(1).WillOnce(SetArgPointee<1>(lockedRect));
|
||||
EXPECT_CALL(*mockMM, lockResource(sharedImg->getGraphicsAllocation())).Times(1).WillOnce(::testing::Return(returnedLockedRes));
|
||||
|
||||
requestedResCopyBlt = {};
|
||||
expectedResCopyBlt.Blt.Upload = 0;
|
||||
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(1).WillOnce(::testing::Invoke([&](GMM_RES_COPY_BLT *arg) {requestedResCopyBlt = *arg; return 1; }));
|
||||
EXPECT_CALL(*mockMM, unlockResource(sharedImg->getGraphicsAllocation())).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect((IDirect3DSurface9 *)&dummyD3DSurface)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, updateSurface(_, _)).Times(0);
|
||||
|
||||
retVal = clEnqueueReleaseDX9MediaSurfacesKHR(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_TRUE(memcmp(&requestedResCopyBlt, &expectedResCopyBlt, sizeof(GMM_RES_COPY_BLT)) == 0);
|
||||
EXPECT_EQ(2, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(2, memoryManager->unlockResourceCalled);
|
||||
}
|
||||
|
||||
TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndLockableIntel) {
|
||||
@@ -665,7 +678,8 @@ TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndLockableIntel) {
|
||||
|
||||
EXPECT_CALL(*mockSharingFcns, getRenderTargetData(_, _)).Times(0);
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect((IDirect3DSurface9 *)&dummyD3DSurface, _, D3DLOCK_READONLY)).Times(1).WillOnce(SetArgPointee<1>(lockedRect));
|
||||
EXPECT_CALL(*mockMM, lockResource(sharedImg->getGraphicsAllocation())).Times(1).WillOnce(::testing::Return(returnedLockedRes));
|
||||
memoryManager->lockResourceReturnValue = returnedLockedRes;
|
||||
memoryManager->expectedLockingAllocation = sharedImg->getGraphicsAllocation();
|
||||
|
||||
GMM_RES_COPY_BLT requestedResCopyBlt = {};
|
||||
GMM_RES_COPY_BLT expectedResCopyBlt = {};
|
||||
@@ -676,28 +690,29 @@ TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndLockableIntel) {
|
||||
expectedResCopyBlt.Sys.BufferSize = lockedRect.Pitch * imgHeight;
|
||||
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(1).WillOnce(::testing::Invoke([&](GMM_RES_COPY_BLT *arg) {requestedResCopyBlt = *arg; return 1; }));
|
||||
EXPECT_CALL(*mockMM, unlockResource(sharedImg->getGraphicsAllocation())).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect((IDirect3DSurface9 *)&dummyD3DSurface)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, flushAndWait(_)).Times(1);
|
||||
|
||||
auto retVal = clEnqueueAcquireDX9ObjectsINTEL(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_TRUE(memcmp(&requestedResCopyBlt, &expectedResCopyBlt, sizeof(GMM_RES_COPY_BLT)) == 0);
|
||||
EXPECT_EQ(1, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(1, memoryManager->unlockResourceCalled);
|
||||
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect((IDirect3DSurface9 *)&dummyD3DSurface, _, 0u)).Times(1).WillOnce(SetArgPointee<1>(lockedRect));
|
||||
EXPECT_CALL(*mockMM, lockResource(sharedImg->getGraphicsAllocation())).Times(1).WillOnce(::testing::Return(returnedLockedRes));
|
||||
|
||||
requestedResCopyBlt = {};
|
||||
expectedResCopyBlt.Blt.Upload = 0;
|
||||
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(1).WillOnce(::testing::Invoke([&](GMM_RES_COPY_BLT *arg) {requestedResCopyBlt = *arg; return 1; }));
|
||||
EXPECT_CALL(*mockMM, unlockResource(sharedImg->getGraphicsAllocation())).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect((IDirect3DSurface9 *)&dummyD3DSurface)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, updateSurface(_, _)).Times(0);
|
||||
|
||||
retVal = clEnqueueReleaseDX9ObjectsINTEL(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_TRUE(memcmp(&requestedResCopyBlt, &expectedResCopyBlt, sizeof(GMM_RES_COPY_BLT)) == 0);
|
||||
EXPECT_EQ(2, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(2, memoryManager->unlockResourceCalled);
|
||||
}
|
||||
|
||||
TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndNonLockable) {
|
||||
@@ -719,7 +734,8 @@ TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndNonLockable) {
|
||||
|
||||
EXPECT_CALL(*mockSharingFcns, getRenderTargetData((IDirect3DSurface9 *)&dummyD3DSurface, (IDirect3DSurface9 *)&dummyD3DSurfaceStaging)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect((IDirect3DSurface9 *)&dummyD3DSurfaceStaging, _, D3DLOCK_READONLY)).Times(1).WillOnce(SetArgPointee<1>(lockedRect));
|
||||
EXPECT_CALL(*mockMM, lockResource(sharedImg->getGraphicsAllocation())).Times(1).WillOnce(::testing::Return(returnedLockedRes));
|
||||
memoryManager->lockResourceReturnValue = returnedLockedRes;
|
||||
memoryManager->expectedLockingAllocation = sharedImg->getGraphicsAllocation();
|
||||
|
||||
GMM_RES_COPY_BLT requestedResCopyBlt = {};
|
||||
GMM_RES_COPY_BLT expectedResCopyBlt = {};
|
||||
@@ -730,28 +746,29 @@ TEST_F(D3D9Tests, acquireReleaseOnNonSharedResourceSurfaceAndNonLockable) {
|
||||
expectedResCopyBlt.Sys.BufferSize = lockedRect.Pitch * imgHeight;
|
||||
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(1).WillOnce(::testing::Invoke([&](GMM_RES_COPY_BLT *arg) {requestedResCopyBlt = *arg; return 1; }));
|
||||
EXPECT_CALL(*mockMM, unlockResource(sharedImg->getGraphicsAllocation())).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect((IDirect3DSurface9 *)&dummyD3DSurfaceStaging)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, flushAndWait(_)).Times(1);
|
||||
|
||||
auto retVal = clEnqueueAcquireDX9MediaSurfacesKHR(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_TRUE(memcmp(&requestedResCopyBlt, &expectedResCopyBlt, sizeof(GMM_RES_COPY_BLT)) == 0);
|
||||
EXPECT_EQ(1, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(1, memoryManager->unlockResourceCalled);
|
||||
|
||||
EXPECT_CALL(*mockSharingFcns, lockRect((IDirect3DSurface9 *)&dummyD3DSurfaceStaging, _, 0)).Times(1).WillOnce(SetArgPointee<1>(lockedRect));
|
||||
EXPECT_CALL(*mockMM, lockResource(sharedImg->getGraphicsAllocation())).Times(1).WillOnce(::testing::Return(returnedLockedRes));
|
||||
|
||||
requestedResCopyBlt = {};
|
||||
expectedResCopyBlt.Blt.Upload = 0;
|
||||
|
||||
EXPECT_CALL(*mockGmmResInfo, cpuBlt(_)).Times(1).WillOnce(::testing::Invoke([&](GMM_RES_COPY_BLT *arg) {requestedResCopyBlt = *arg; return 1; }));
|
||||
EXPECT_CALL(*mockMM, unlockResource(sharedImg->getGraphicsAllocation())).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, unlockRect((IDirect3DSurface9 *)&dummyD3DSurfaceStaging)).Times(1);
|
||||
EXPECT_CALL(*mockSharingFcns, updateSurface((IDirect3DSurface9 *)&dummyD3DSurfaceStaging, (IDirect3DSurface9 *)&dummyD3DSurface)).Times(1);
|
||||
|
||||
retVal = clEnqueueReleaseDX9MediaSurfacesKHR(cmdQ, 1, &clMem, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_TRUE(memcmp(&requestedResCopyBlt, &expectedResCopyBlt, sizeof(GMM_RES_COPY_BLT)) == 0);
|
||||
EXPECT_EQ(2, memoryManager->lockResourceCalled);
|
||||
EXPECT_EQ(2, memoryManager->unlockResourceCalled);
|
||||
}
|
||||
|
||||
TEST_F(D3D9Tests, givenInvalidClMemObjectPassedOnReleaseListWhenCallIsMadeThenFailureIsReturned) {
|
||||
@@ -767,6 +784,7 @@ TEST_F(D3D9Tests, givenResourcesCreatedFromDifferentDevicesWhenAcquireReleaseCal
|
||||
mockSharingFcns->setDevice(createdResourceDevice); // create call will pick this device
|
||||
auto sharedImg = std::unique_ptr<Image>(D3DSurface::create(context, &surfaceInfo, CL_MEM_READ_WRITE, 0, 0, nullptr));
|
||||
ASSERT_NE(nullptr, sharedImg.get());
|
||||
memoryManager->expectedLockingAllocation = sharedImg->getGraphicsAllocation();
|
||||
|
||||
mockSharingFcns->setDevice(nullptr); // force device change
|
||||
sharedImg->getSharingHandler()->acquire(sharedImg.get());
|
||||
|
||||
@@ -122,26 +122,6 @@ TEST(GraphicsAllocationTest, setSize) {
|
||||
EXPECT_EQ(size, gfxAllocation.getUnderlyingBufferSize());
|
||||
}
|
||||
|
||||
TEST(GraphicsAllocationTest, GivenGraphicsAllocationWhenLockingThenIsLocked) {
|
||||
void *cpuPtr = (void *)0x30000;
|
||||
uint64_t gpuAddr = 0x30000;
|
||||
uint64_t gpuBaseAddr = 0x10000;
|
||||
size_t size = 0x1000;
|
||||
|
||||
GraphicsAllocation gfxAllocation(cpuPtr, gpuAddr, gpuBaseAddr, size, 1u, false);
|
||||
|
||||
gfxAllocation.setLocked(false);
|
||||
EXPECT_FALSE(gfxAllocation.isLocked());
|
||||
gfxAllocation.setLocked(true);
|
||||
EXPECT_TRUE(gfxAllocation.isLocked());
|
||||
|
||||
gfxAllocation.setCpuPtrAndGpuAddress(cpuPtr, gpuAddr);
|
||||
cpuPtr = gfxAllocation.getUnderlyingBuffer();
|
||||
EXPECT_NE(nullptr, cpuPtr);
|
||||
gpuAddr = gfxAllocation.getGpuAddress();
|
||||
EXPECT_NE(0ULL, gpuAddr);
|
||||
}
|
||||
|
||||
TEST_F(MemoryAllocatorTest, allocateSystem) {
|
||||
auto ptr = memoryManager->allocateSystemMemory(sizeof(char), 0);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
@@ -810,9 +790,12 @@ TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenLockUnlockCalledThenReturnCp
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
|
||||
EXPECT_FALSE(allocation->isLocked());
|
||||
auto ptr = memoryManager.lockResource(allocation);
|
||||
EXPECT_EQ(ptrOffset(allocation->getUnderlyingBuffer(), static_cast<size_t>(allocation->allocationOffset)), ptr);
|
||||
EXPECT_TRUE(allocation->isLocked());
|
||||
memoryManager.unlockResource(allocation);
|
||||
EXPECT_FALSE(allocation->isLocked());
|
||||
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ class MockMemoryManager : public OsAgnosticMemoryManager {
|
||||
OsAgnosticMemoryManager::freeGraphicsMemoryImpl(gfxAllocation);
|
||||
};
|
||||
|
||||
void unlockResource(GraphicsAllocation *gfxAllocation) override {
|
||||
void unlockResourceImpl(GraphicsAllocation &gfxAllocation) override {
|
||||
unlockResourceCalled++;
|
||||
OsAgnosticMemoryManager::unlockResource(gfxAllocation);
|
||||
OsAgnosticMemoryManager::unlockResourceImpl(gfxAllocation);
|
||||
}
|
||||
|
||||
uint32_t freeGraphicsMemoryCalled = 0u;
|
||||
@@ -134,8 +134,8 @@ class FailMemoryManager : public MockMemoryManager {
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
void *lockResource(GraphicsAllocation *gfxAllocation) override { return nullptr; };
|
||||
void unlockResource(GraphicsAllocation *gfxAllocation) override{};
|
||||
void *lockResourceImpl(GraphicsAllocation &gfxAllocation) override { return nullptr; };
|
||||
void unlockResourceImpl(GraphicsAllocation &gfxAllocation) override{};
|
||||
|
||||
MemoryManager::AllocationStatus populateOsHandles(OsHandleStorage &handleStorage) override {
|
||||
return AllocationStatus::Error;
|
||||
|
||||
@@ -135,14 +135,14 @@ bool WddmMock::waitOnGPU(D3DKMT_HANDLE context) {
|
||||
return waitOnGPUResult.success = Wddm::waitOnGPU(context);
|
||||
}
|
||||
|
||||
void *WddmMock::lockResource(WddmAllocation *allocation) {
|
||||
void *WddmMock::lockResource(WddmAllocation &allocation) {
|
||||
lockResult.called++;
|
||||
auto ptr = Wddm::lockResource(allocation);
|
||||
lockResult.success = ptr != nullptr;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void WddmMock::unlockResource(WddmAllocation *allocation) {
|
||||
void WddmMock::unlockResource(WddmAllocation &allocation) {
|
||||
unlockResult.called++;
|
||||
unlockResult.success = true;
|
||||
Wddm::unlockResource(allocation);
|
||||
@@ -231,13 +231,13 @@ EvictionStatus WddmMock::evictAllTemporaryResources() {
|
||||
return evictAllTemporaryResourcesResult.status;
|
||||
}
|
||||
|
||||
EvictionStatus WddmMock::evictTemporaryResource(WddmAllocation *allocation) {
|
||||
EvictionStatus WddmMock::evictTemporaryResource(WddmAllocation &allocation) {
|
||||
evictTemporaryResourceResult.called++;
|
||||
evictTemporaryResourceResult.status = Wddm::evictTemporaryResource(allocation);
|
||||
return evictTemporaryResourceResult.status;
|
||||
}
|
||||
|
||||
void WddmMock::applyBlockingMakeResident(WddmAllocation *allocation) {
|
||||
void WddmMock::applyBlockingMakeResident(WddmAllocation &allocation) {
|
||||
applyBlockingMakeResidentResult.called++;
|
||||
return Wddm::applyBlockingMakeResident(allocation);
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ class WddmMock : public Wddm {
|
||||
bool queryAdapterInfo() override;
|
||||
bool submit(uint64_t commandBuffer, size_t size, void *commandHeader, OsContextWin &osContext) override;
|
||||
bool waitOnGPU(D3DKMT_HANDLE context) override;
|
||||
void *lockResource(WddmAllocation *allocation) override;
|
||||
void unlockResource(WddmAllocation *allocation) override;
|
||||
void *lockResource(WddmAllocation &allocation) override;
|
||||
void unlockResource(WddmAllocation &allocation) override;
|
||||
void kmDafLock(WddmAllocation *allocation) override;
|
||||
bool isKmDafEnabled() override;
|
||||
void setKmDafEnabled(bool state);
|
||||
@@ -84,8 +84,8 @@ class WddmMock : public Wddm {
|
||||
void releaseReservedAddress(void *reservedAddress) override;
|
||||
VOID *registerTrimCallback(PFND3DKMT_TRIMNOTIFICATIONCALLBACK callback, WddmResidencyController &residencyController) override;
|
||||
EvictionStatus evictAllTemporaryResources() override;
|
||||
EvictionStatus evictTemporaryResource(WddmAllocation *allocation) override;
|
||||
void applyBlockingMakeResident(WddmAllocation *allocation) override;
|
||||
EvictionStatus evictTemporaryResource(WddmAllocation &allocation) override;
|
||||
void applyBlockingMakeResident(WddmAllocation &allocation) override;
|
||||
std::unique_lock<SpinLock> acquireLock(SpinLock &lock) override;
|
||||
bool reserveValidAddressRange(size_t size, void *&reservedMem);
|
||||
GmmMemory *getGmmMemory() const;
|
||||
|
||||
@@ -825,26 +825,26 @@ TEST_F(Wddm20Tests, givenAllocationThatDoesntNeedMakeResidentBeforeLockWhenLockT
|
||||
EXPECT_FALSE(allocation.needsMakeResidentBeforeLock);
|
||||
EXPECT_TRUE(wddm->temporaryResources.empty());
|
||||
EXPECT_EQ(0u, wddm->makeResidentResult.called);
|
||||
wddm->lockResource(&allocation);
|
||||
wddm->lockResource(allocation);
|
||||
EXPECT_TRUE(wddm->temporaryResources.empty());
|
||||
EXPECT_EQ(0u, wddm->makeResidentResult.called);
|
||||
wddm->unlockResource(&allocation);
|
||||
wddm->unlockResource(allocation);
|
||||
}
|
||||
TEST_F(Wddm20Tests, givenAllocationThatNeedsMakeResidentBeforeLockWhenLockThenCallBlockingMakeResident) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
allocation.needsMakeResidentBeforeLock = true;
|
||||
wddm->lockResource(&allocation);
|
||||
wddm->lockResource(allocation);
|
||||
EXPECT_EQ(1u, wddm->applyBlockingMakeResidentResult.called);
|
||||
}
|
||||
TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenAcquireUniqueLock) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
wddm->applyBlockingMakeResident(&allocation);
|
||||
wddm->applyBlockingMakeResident(allocation);
|
||||
EXPECT_EQ(1u, wddm->acquireLockResult.called);
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(&wddm->temporaryResourcesLock), wddm->acquireLockResult.uint64ParamPassed);
|
||||
}
|
||||
TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenCallMakeResidentAndStoreAllocation) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
wddm->applyBlockingMakeResident(&allocation);
|
||||
wddm->applyBlockingMakeResident(allocation);
|
||||
EXPECT_EQ(1u, wddm->makeResidentResult.called);
|
||||
EXPECT_EQ(allocation.handle, wddm->temporaryResources.back());
|
||||
}
|
||||
@@ -852,7 +852,7 @@ TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentThenWaitForCurre
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
wddm->mockPagingFence = 0u;
|
||||
wddm->currentPagingFenceValue = 3u;
|
||||
wddm->applyBlockingMakeResident(&allocation);
|
||||
wddm->applyBlockingMakeResident(allocation);
|
||||
EXPECT_EQ(1u, wddm->makeResidentResult.called);
|
||||
EXPECT_EQ(3u, wddm->mockPagingFence);
|
||||
EXPECT_EQ(3u, wddm->getPagingFenceAddressResult.called);
|
||||
@@ -861,7 +861,7 @@ TEST_F(Wddm20Tests, givenAllocationWhenApplyBlockingMakeResidentAndMakeResidentC
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
GmockWddm gmockWddm;
|
||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(2).WillRepeatedly(::testing::Return(false));
|
||||
gmockWddm.applyBlockingMakeResident(&allocation);
|
||||
gmockWddm.applyBlockingMakeResident(allocation);
|
||||
EXPECT_EQ(1u, gmockWddm.evictAllTemporaryResourcesResult.called);
|
||||
}
|
||||
TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvictedSuccessfullyThenCallMakeResidentOneMoreTime) {
|
||||
@@ -870,7 +870,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvicted
|
||||
gmockWddm.temporaryResources.push_back(allocation.handle);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(3).WillRepeatedly(::testing::Return(false));
|
||||
gmockWddm.applyBlockingMakeResident(&allocation);
|
||||
gmockWddm.applyBlockingMakeResident(allocation);
|
||||
EXPECT_EQ(2u, gmockWddm.evictAllTemporaryResourcesResult.called);
|
||||
}
|
||||
TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDontStoreTemporaryResource) {
|
||||
@@ -881,7 +881,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDo
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(3).WillRepeatedly(::testing::Return(false));
|
||||
EXPECT_EQ(1u, gmockWddm.temporaryResources.size());
|
||||
gmockWddm.applyBlockingMakeResident(&allocation);
|
||||
gmockWddm.applyBlockingMakeResident(allocation);
|
||||
EXPECT_EQ(0u, gmockWddm.temporaryResources.size());
|
||||
}
|
||||
TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvictThenStoreTemporaryResource) {
|
||||
@@ -892,7 +892,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvict
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillRepeatedly(::testing::Return(true));
|
||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(2).WillOnce(::testing::Return(false)).WillOnce(::testing::Return(true));
|
||||
EXPECT_EQ(1u, gmockWddm.temporaryResources.size());
|
||||
gmockWddm.applyBlockingMakeResident(&allocation);
|
||||
gmockWddm.applyBlockingMakeResident(allocation);
|
||||
EXPECT_EQ(1u, gmockWddm.temporaryResources.size());
|
||||
EXPECT_EQ(0x2, gmockWddm.temporaryResources.back());
|
||||
}
|
||||
@@ -902,7 +902,7 @@ TEST_F(Wddm20Tests, whenApplyBlockingMakeResidentAndMakeResidentPassesThenStoreT
|
||||
GmockWddm gmockWddm;
|
||||
gmockWddm.temporaryResources.push_back(0x1);
|
||||
EXPECT_CALL(gmockWddm, makeResident(&allocation.handle, ::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||
gmockWddm.applyBlockingMakeResident(&allocation);
|
||||
gmockWddm.applyBlockingMakeResident(allocation);
|
||||
EXPECT_EQ(2u, gmockWddm.temporaryResources.size());
|
||||
EXPECT_EQ(0x2, gmockWddm.temporaryResources.back());
|
||||
}
|
||||
@@ -945,11 +945,13 @@ TEST_F(Wddm20Tests, givenThreeAllocationsWhenEvictingAllTemporaryResourcesAndOne
|
||||
EXPECT_EQ(EvictionStatus::FAILED, gmockWddm.evictAllTemporaryResourcesResult.status);
|
||||
}
|
||||
TEST_F(Wddm20Tests, givenNoTemporaryResourcesWhenEvictingTemporaryResourceThenEvictionIsNotApplied) {
|
||||
wddm->evictTemporaryResource(nullptr);
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
wddm->evictTemporaryResource(allocation);
|
||||
EXPECT_EQ(EvictionStatus::NOT_APPLIED, wddm->evictTemporaryResourceResult.status);
|
||||
}
|
||||
TEST_F(Wddm20Tests, whenEvictingTemporaryResourceThenAcquireTemporaryResourcesLock) {
|
||||
wddm->evictTemporaryResource(nullptr);
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
wddm->evictTemporaryResource(allocation);
|
||||
EXPECT_EQ(1u, wddm->acquireLockResult.called);
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(&wddm->temporaryResourcesLock), wddm->acquireLockResult.uint64ParamPassed);
|
||||
}
|
||||
@@ -958,7 +960,7 @@ TEST_F(Wddm20Tests, whenEvictingNonExistingTemporaryResourceThenEvictIsNotApplie
|
||||
allocation.handle = 0x1;
|
||||
wddm->temporaryResources.push_back(0x2);
|
||||
EXPECT_FALSE(wddm->temporaryResources.empty());
|
||||
wddm->evictTemporaryResource(&allocation);
|
||||
wddm->evictTemporaryResource(allocation);
|
||||
EXPECT_FALSE(wddm->temporaryResources.empty());
|
||||
EXPECT_EQ(EvictionStatus::NOT_APPLIED, wddm->evictTemporaryResourceResult.status);
|
||||
}
|
||||
@@ -967,7 +969,7 @@ TEST_F(Wddm20Tests, whenEvictingTemporaryResourceAndEvictFailsThenReturnFail) {
|
||||
GmockWddm gmockWddm;
|
||||
gmockWddm.temporaryResources.push_back(allocation.handle);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(false));
|
||||
gmockWddm.evictTemporaryResource(&allocation);
|
||||
gmockWddm.evictTemporaryResource(allocation);
|
||||
EXPECT_TRUE(gmockWddm.temporaryResources.empty());
|
||||
EXPECT_EQ(EvictionStatus::FAILED, gmockWddm.evictTemporaryResourceResult.status);
|
||||
}
|
||||
@@ -976,7 +978,7 @@ TEST_F(Wddm20Tests, whenEvictingTemporaryResourceAndEvictSucceedThenReturnSucces
|
||||
GmockWddm gmockWddm;
|
||||
gmockWddm.temporaryResources.push_back(allocation.handle);
|
||||
EXPECT_CALL(gmockWddm, evict(::testing::_, ::testing::_, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||
gmockWddm.evictTemporaryResource(&allocation);
|
||||
gmockWddm.evictTemporaryResource(allocation);
|
||||
EXPECT_TRUE(gmockWddm.temporaryResources.empty());
|
||||
EXPECT_EQ(EvictionStatus::SUCCESS, gmockWddm.evictTemporaryResourceResult.status);
|
||||
}
|
||||
@@ -987,7 +989,7 @@ TEST_F(Wddm20Tests, whenEvictingTemporaryResourceThenOtherResourcesRemainOnTheLi
|
||||
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, 1u, false};
|
||||
allocation.handle = 0x2;
|
||||
wddm->evictTemporaryResource(&allocation);
|
||||
wddm->evictTemporaryResource(allocation);
|
||||
|
||||
EXPECT_EQ(2u, wddm->temporaryResources.size());
|
||||
EXPECT_EQ(0x1, wddm->temporaryResources.front());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018 Intel Corporation
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -60,7 +60,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenLockResourceIsCalledThenKmDafListener
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
wddmWithKmDafMock->lockResource(&allocation);
|
||||
wddmWithKmDafMock->lockResource(allocation);
|
||||
|
||||
EXPECT_EQ(wddmWithKmDafMock->getFeatureTable()->ftrKmdDaf, wddmWithKmDafMock->getKmDafListenerMock().notifyLockParametrization.ftrKmdDaf);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyLockParametrization.hAdapter);
|
||||
@@ -74,7 +74,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
wddmWithKmDafMock->unlockResource(&allocation);
|
||||
wddmWithKmDafMock->unlockResource(allocation);
|
||||
|
||||
EXPECT_EQ(wddmWithKmDafMock->getFeatureTable()->ftrKmdDaf, wddmWithKmDafMock->getKmDafListenerMock().notifyUnlockParametrization.ftrKmdDaf);
|
||||
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyUnlockParametrization.hAdapter);
|
||||
|
||||
@@ -1480,14 +1480,14 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingLockedAllocationThatDoesntNeedMakeResidentBeforeLockThenDontEvictAllocationFromWddmTemporaryResources) {
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
allocation->setLocked(true);
|
||||
memoryManager->lockResource(allocation);
|
||||
EXPECT_FALSE(allocation->needsMakeResidentBeforeLock);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
EXPECT_EQ(0u, wddm->evictTemporaryResourceResult.called);
|
||||
}
|
||||
TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingNotLockedAllocationThatDoesntNeedMakeResidentBeforeLockThenDontEvictAllocationFromWddmTemporaryResources) {
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
allocation->setLocked(false);
|
||||
EXPECT_FALSE(allocation->isLocked());
|
||||
EXPECT_FALSE(allocation->needsMakeResidentBeforeLock);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
EXPECT_EQ(0u, wddm->evictTemporaryResourceResult.called);
|
||||
@@ -1495,14 +1495,14 @@ TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingNotLockedAllocationThatDoesntN
|
||||
TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingLockedAllocationThatNeedsMakeResidentBeforeLockThenEvictAllocationFromWddmTemporaryResources) {
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
allocation->needsMakeResidentBeforeLock = true;
|
||||
allocation->setLocked(true);
|
||||
memoryManager->lockResource(allocation);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
EXPECT_EQ(1u, wddm->evictTemporaryResourceResult.called);
|
||||
}
|
||||
TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingNotLockedAllocationThatNeedsMakeResidentBeforeLockThenDontEvictAllocationFromWddmTemporaryResources) {
|
||||
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}));
|
||||
allocation->needsMakeResidentBeforeLock = true;
|
||||
allocation->setLocked(false);
|
||||
EXPECT_FALSE(allocation->isLocked());
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
EXPECT_EQ(0u, wddm->evictTemporaryResourceResult.called);
|
||||
}
|
||||
Reference in New Issue
Block a user