Store GmmHelper in Gmm class

Store GmmHelper in Gmm class instead of GmmClientContext

Related-To: NEO-6523
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2022-04-27 10:20:10 +00:00
committed by Compute-Runtime-Automation
parent 7eb70775ea
commit 9b778863b4
75 changed files with 457 additions and 456 deletions

View File

@@ -414,7 +414,7 @@ HWTEST_P(AubSurfaceDumpTests, givenGraphicsAllocationWhenGetDumpSurfaceIsCalledA
auto bufferAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
ASSERT_NE(nullptr, bufferAllocation);
MockBuffer::setAllocationType(bufferAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), isCompressed);
MockBuffer::setAllocationType(bufferAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), isCompressed);
std::unique_ptr<aub_stream::SurfaceInfo> surfaceInfo(AubAllocDump::getDumpSurfaceInfo<FamilyType>(*bufferAllocation, dumpFormat));
if (nullptr != surfaceInfo) {
@@ -439,7 +439,7 @@ HWTEST_P(AubSurfaceDumpTests, givenGraphicsAllocationWhenGetDumpSurfaceIsCalledA
imgDesc.imageHeight = 1;
imgDesc.imageType = ImageType::Image2D;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false);
MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false);
AllocationData allocationData;
allocationData.imgInfo = &imgInfo;
auto imageAllocation = memoryManager.allocateGraphicsMemoryForImage(allocationData);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -89,7 +89,7 @@ HWTEST_F(AUBCreateImageArray, Given1DImageArrayThenExpectationsMet) {
auto imageDescriptor = Image::convertDescriptor(imageDesc);
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(imageDesc), false);
auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false);
//allocate host_ptr
auto pixelSize = 4;
@@ -168,7 +168,7 @@ HWTEST_F(AUBCreateImageArray, Given2DImageArrayThenExpectationsMet) {
auto imageDescriptor = Image::convertDescriptor(imageDesc);
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(imageDesc), false);
auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false);
//allocate host_ptr
auto pixelSize = 4;
@@ -290,7 +290,7 @@ HWTEST_P(CopyHostPtrTest, GivenImageWithDoubledRowPitchWhenCreatedWithCopyHostPt
auto imageDescriptor = Image::convertDescriptor(imageDesc);
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false);
MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false);
auto lineWidth = imageDesc.image_width * elementSize;
auto passedRowPitch = imgInfo.rowPitch * 2;
imageDesc.image_row_pitch = passedRowPitch;
@@ -360,7 +360,7 @@ HWTEST_P(UseHostPtrTest, GivenImageWithRowPitchWhenCreatedWithUseHostPtrFlagThen
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto imageDescriptor = Image::convertDescriptor(imageDesc);
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo, false);
MockGmm::queryImgParams(pDevice->getGmmHelper(), imgInfo, false);
auto passedRowPitch = imgInfo.rowPitch + 32;
imageDesc.image_row_pitch = passedRowPitch;
unsigned char *pUseHostPtr = new unsigned char[passedRowPitch * imageDesc.image_height * elementSize];

View File

@@ -593,14 +593,14 @@ HWTEST2_P(AuxBuiltInTests, givenKernelWithAuxTranslationRequiredWhenEnqueueCalle
MockKernelObjForAuxTranslation mockKernelObjForAuxTranslation(kernelObjType);
if (kernelObjType == KernelObjForAuxTranslation::Type::MEM_OBJ) {
MockBuffer::setAllocationType(mockKernelObjForAuxTranslation.mockBuffer->getGraphicsAllocation(0), pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(mockKernelObjForAuxTranslation.mockBuffer->getGraphicsAllocation(0), pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
cl_mem clMem = mockKernelObjForAuxTranslation.mockBuffer.get();
mockKernel.mockKernel->setArgBuffer(0, sizeof(cl_mem *), &clMem);
} else {
auto gfxAllocation = mockKernelObjForAuxTranslation.mockGraphicsAllocation.get();
MockBuffer::setAllocationType(gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
auto ptr = reinterpret_cast<void *>(gfxAllocation->getGpuAddressToPatch());
mockKernel.mockKernel->setArgSvmAlloc(0, ptr, gfxAllocation, 0u);
@@ -703,7 +703,7 @@ HWTEST2_P(AuxBuiltInTests, givenAuxToNonAuxTranslationWhenSettingSurfaceStateThe
std::unique_ptr<Buffer> buffer = nullptr;
std::unique_ptr<GraphicsAllocation> gfxAllocation = nullptr;
auto gmm = std::unique_ptr<Gmm>(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto gmm = std::unique_ptr<Gmm>(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = true;
auto kernelObjsForAuxTranslation = std::make_unique<KernelObjsForAuxTranslation>();
@@ -758,7 +758,7 @@ HWTEST2_P(AuxBuiltInTests, givenNonAuxToAuxTranslationWhenSettingSurfaceStateThe
builtinOpParams.auxTranslationDirection = AuxTranslationDirection::NonAuxToAux;
MockKernelObjForAuxTranslation mockKernelObjForAuxTranslation(kernelObjType);
auto gmm = std::make_unique<Gmm>(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
gmm->isCompressionEnabled = true;
if (kernelObjType == MockKernelObjForAuxTranslation::Type::MEM_OBJ) {
mockKernelObjForAuxTranslation.mockBuffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex())->setDefaultGmm(gmm.release());

View File

@@ -163,9 +163,9 @@ struct BlitEnqueueTests : public ::testing::Test {
graphicsAllocation->setAllocationType(AllocationType::BUFFER);
if (compressed && !graphicsAllocation->getDefaultGmm()) {
auto clientContext = device->getRootDeviceEnvironment().getGmmClientContext();
auto gmmHelper = device->getRootDeviceEnvironment().getGmmHelper();
graphicsAllocation->setDefaultGmm(new Gmm(clientContext, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
graphicsAllocation->setDefaultGmm(new Gmm(gmmHelper, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
}
if (graphicsAllocation->getDefaultGmm()) {

View File

@@ -63,7 +63,7 @@ void CommandQueueHwFixture::forceMapBufferOnGpu(Buffer &buffer) {
buffer.setSharingHandler(new SharingHandler());
auto gfxAllocation = buffer.getGraphicsAllocation(clDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(clDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(clDevice->getGmmHelper()), handleId);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -378,7 +378,7 @@ TEST_F(EnqueueMapBufferTest, givenNonReadOnlyBufferWhenMappedOnGpuThenSetValidEv
buffer->setSharingHandler(new SharingHandler());
auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId);
}
buffer->forceDisallowCPUCopy = true;
@@ -426,7 +426,7 @@ TEST_F(EnqueueMapBufferTest, givenReadOnlyBufferWhenMappedOnGpuThenSetValidEvent
buffer->setSharingHandler(new SharingHandler());
auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId);
}
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, buffer.get());

View File

@@ -615,7 +615,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenForcedCpuCopyWhenEnqueueReadCompressedB
static_cast<MemoryAllocation *>(graphicsAllocation)->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer();
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
retVal = mockCmdQ->enqueueReadBuffer(buffer.get(),
CL_TRUE,
@@ -631,7 +631,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenForcedCpuCopyWhenEnqueueReadCompressedB
EXPECT_FALSE(graphicsAllocation->isLocked());
EXPECT_FALSE(mockCmdQ->cpuDataTransferHandlerCalled);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), false);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), false);
retVal = mockCmdQ->enqueueReadBuffer(buffer.get(),
CL_TRUE,

View File

@@ -444,7 +444,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse
allocation->overrideMemoryPool(MemoryPool::SystemCpuInaccessible);
void *ptr = srcBuffer->getCpuAddressForMemoryTransfer();
MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(),
CL_FALSE,
@@ -460,7 +460,7 @@ HWTEST_F(EnqueueWriteBufferTypeTest, givenForcedCpuCopyWhenEnqueueWriteCompresse
EXPECT_FALSE(allocation->isLocked());
EXPECT_FALSE(mockCmdQ->cpuDataTransferHandlerCalled);
MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), false);
MockBuffer::setAllocationType(allocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), false);
retVal = mockCmdQ->enqueueWriteBuffer(buffer.get(),
CL_FALSE,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -30,7 +30,7 @@ TEST_F(EnqueueKernelTest, givenKernelWithSharedObjArgsWhenEnqueueIsCalledThenRes
auto nonSharedBuffer = new MockBuffer;
MockGlSharing glSharing;
MockGmm mockGmm(pDevice->getGmmClientContext());
MockGmm mockGmm(pDevice->getGmmHelper());
glSharing.uploadDataToBufferInfo(1, 0, mockGmm.gmmResourceInfo->peekGmmResourceInfo());
pContext->setSharingFunctions(glSharing.sharingFunctions.release());
auto retVal = CL_SUCCESS;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -99,7 +99,7 @@ struct MultipleMapBufferTest : public ClDeviceFixture, public ::testing::Test {
buffer->setSharingHandler(new SharingHandler());
auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId);
}
}
return std::unique_ptr<MockBuffer<FamilyType>>(buffer);

View File

@@ -24,7 +24,7 @@ HWTEST_F(ReadWriteBufferCpuCopyTest, givenCompressedGmmWhenAskingForCpuOperation
cl_int retVal;
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = false;
auto allocation = buffer->getGraphicsAllocation(rootDeviceIndex);
allocation->setDefaultGmm(gmm);

View File

@@ -438,7 +438,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF
MockBuffer buffer;
cl_mem clMem = &buffer;
MockBuffer::setAllocationType(buffer.getGraphicsAllocation(0), pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(buffer.getGraphicsAllocation(0), pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
mockKernel.kernelInfo.addArgBuffer(0, 0, 0, 0);
mockKernel.kernelInfo.addExtendedMetadata(0, "arg0");
@@ -468,7 +468,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
mockKernel.kernelInfo.addExtendedMetadata(0, "arg0");
mockKernel.kernelInfo.addArgBuffer(0, 0, 0, 0);
@@ -501,7 +501,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
mockKernel.mockKernel->initialize();
mockKernel.mockKernel->setUnifiedMemoryExecInfo(&gfxAllocation);
@@ -534,7 +534,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenCallF
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
mockKernel.mockKernel->initialize();
@@ -567,7 +567,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeEnabledWhenKerne
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
mockKernel.kernelInfo.addExtendedMetadata(0, "arg0");
mockKernel.kernelInfo.addArgBuffer(0, 0, 0, 0);
@@ -594,7 +594,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeDisabledWhenCall
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
mockKernel.kernelInfo.addExtendedMetadata(0, "arg0");
mockKernel.kernelInfo.addArgBuffer(0, 0, 0, 0);
@@ -641,7 +641,7 @@ TEST_F(PerformanceHintTest, givenPrintDriverDiagnosticsDebugModeDisabledWhenCall
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(&gfxAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
mockKernel.mockKernel->initialize();
mockKernel.mockKernel->setUnifiedMemoryExecInfo(&gfxAllocation);
@@ -737,7 +737,7 @@ HWTEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerfor
auto mockBuffer = std::unique_ptr<MockBuffer>(new MockBuffer());
StorageInfo info;
size_t t = 4;
auto gmm = new Gmm(device->getGmmClientContext(), static_cast<const void *>(nullptr), t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
auto gmm = new Gmm(device->getGmmHelper(), static_cast<const void *>(nullptr), t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
gmm->isCompressionEnabled = true;
auto graphicsAllocation = mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex());
@@ -807,7 +807,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor
auto mockBuffer = std::unique_ptr<MockBuffer>(new MockBuffer());
StorageInfo info;
size_t t = 4;
auto gmm = new Gmm(device->getGmmClientContext(), (const void *)nullptr, t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
auto gmm = new Gmm(device->getGmmHelper(), (const void *)nullptr, t, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
gmm->isCompressionEnabled = false;
mockBuffer->getGraphicsAllocation(device->getRootDeviceIndex())->setDefaultGmm(gmm);

View File

@@ -40,7 +40,7 @@ class MockMM : public OsAgnosticMemoryManager {
return alloc;
}
GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override {
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo, StorageInfo{}, false);
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), *allocationData.imgInfo, StorageInfo{}, false);
AllocationProperties properties(allocationData.rootDeviceIndex, nullptr, false, AllocationType::SHARED_IMAGE, false, {});
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(1, properties, false, false);
alloc->setDefaultGmm(forceGmm);
@@ -83,7 +83,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
imgDesc.imageDepth = 1;
imgDesc.imageType = ImageType::Image2D;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
gmm = MockGmm::queryImgParams(pPlatform->getClDevice(0)->getGmmClientContext(), imgInfo, false).release();
gmm = MockGmm::queryImgParams(pPlatform->getClDevice(0)->getGmmHelper(), imgInfo, false).release();
mockGmmResInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
memoryManager->forceGmm = gmm;
@@ -1302,7 +1302,7 @@ TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNullWhenCreatingSharedSurfaceAnd
imgDesc.imageDepth = 1;
imgDesc.imageType = ImageType::Image2D;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto gmm = MockGmm::queryImgParams(device1->getGmmClientContext(), imgInfo, false).release();
auto gmm = MockGmm::queryImgParams(device1->getGmmHelper(), imgInfo, false).release();
auto memoryManager = std::make_unique<MockMM>(*device1->executionEnvironment);
memoryManager->forceGmm = gmm;
@@ -1336,7 +1336,7 @@ TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNotNullWhenCreatingSharedSurface
imgDesc.imageDepth = 1;
imgDesc.imageType = ImageType::Image2D;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto gmm = MockGmm::queryImgParams(device1->getGmmClientContext(), imgInfo, false).release();
auto gmm = MockGmm::queryImgParams(device1->getGmmHelper(), imgInfo, false).release();
auto memoryManager = std::make_unique<MockMM>(*device1->executionEnvironment);
memoryManager->forceGmm = gmm;

View File

@@ -86,7 +86,7 @@ class D3DTests : public PlatformFixture, public ::testing::Test {
imgDesc.imageDepth = 1;
imgDesc.imageType = ImageType::Image2D;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
gmm = MockGmm::queryImgParams(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), imgInfo, false).release();
gmm = MockGmm::queryImgParams(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmHelper(), imgInfo, false).release();
mockGmmResInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockMM->forceGmm = gmm;

View File

@@ -220,7 +220,7 @@ GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenCompressedBufferThenCheckResource
buffer.reset(Buffer::create(context.get(), 0, MemoryConstants::cacheLineSize, nullptr, retVal));
MockBuffer::setAllocationType(buffer->getGraphicsAllocation(rootDeviceIndex), context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(buffer->getGraphicsAllocation(rootDeviceIndex), context->getDevice(0)->getRootDeviceEnvironment().getGmmHelper(), true);
EXPECT_FALSE(helper.checkResourceCompatibility(*buffer->getGraphicsAllocation(rootDeviceIndex)));
}

View File

@@ -94,7 +94,7 @@ GEN12LPTEST_F(ImageClearColorFixture, givenMcsAllocationWhenSetArgIsCalledWithUn
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
mcsAlloc->setDefaultGmm(new Gmm(context->getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
mcsAlloc->setDefaultGmm(new Gmm(context->getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
surfaceState.setSurfaceBaseAddress(0xABCDEF1000);
imageHw->setMcsSurfaceInfo(msi);
imageHw->setMcsAllocation(mcsAlloc);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -37,7 +37,7 @@ GEN12LPTEST_F(Gen12LpKernelTest, GivenKernelWhenAtLeastOneArgIsMediaCompressedTh
MockBuffer buffer;
auto allocation = buffer.getGraphicsAllocation(pClDevice->getRootDeviceIndex());
auto gmm1 = new MockGmm(pDevice->getGmmClientContext());
auto gmm1 = new MockGmm(pDevice->getGmmHelper());
allocation->setGmm(gmm1, 0);
cl_mem clMem = &buffer;
@@ -49,7 +49,7 @@ GEN12LPTEST_F(Gen12LpKernelTest, GivenKernelWhenAtLeastOneArgIsMediaCompressedTh
MockBuffer bufferMediaCompressed;
bufferMediaCompressed.setSharingHandler(new SharingHandler());
allocation = bufferMediaCompressed.getGraphicsAllocation(pClDevice->getRootDeviceIndex());
auto gmm2 = new MockGmm(pDevice->getGmmClientContext());
auto gmm2 = new MockGmm(pDevice->getGmmHelper());
allocation->setGmm(gmm2, 0);
allocation->getGmm(0)->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = 1;
cl_mem clMem2 = &bufferMediaCompressed;

View File

@@ -76,7 +76,7 @@ TEST(GmmGlTests, givenGmmWhenAskedforCubeFaceIndexThenProperValueIsReturned) {
TEST_F(GmmTests, WhenGmmIsCreatedThenAllResourceAreCreated) {
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
@@ -91,7 +91,7 @@ TEST_F(GmmTests, GivenUncacheableWhenGmmIsCreatedThenAllResourceAreCreated) {
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC, false, {}, true));
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
@@ -108,7 +108,7 @@ TEST_F(GmmTests, givenHostPointerWithHighestBitSetWhenGmmIsCreatedThenItHasTheSa
auto address = reinterpret_cast<void *>(addressWithHighestBitSet);
auto expectedAddress = castToUint64(address);
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), address, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), address, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_EQ(gmm->resourceParams.pExistingSysMem, expectedAddress);
}
@@ -118,7 +118,7 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGmm
MemoryManager *mm = new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment);
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
auto gmmRes = new Gmm(getGmmClientContext(), pSysMem, maxSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmmRes = new Gmm(getGmmHelper(), pSysMem, maxSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
ASSERT_TRUE(gmmRes->gmmResourceInfo.get() != nullptr);
@@ -132,8 +132,8 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGmm
TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm) {
auto size = 4096u;
void *incomingPtr = (void *)0x1000;
auto gmmRes = new Gmm(getGmmClientContext(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmmRes2 = new Gmm(getGmmClientContext(), gmmRes->gmmResourceInfo->peekGmmResourceInfo());
auto gmmRes = new Gmm(getGmmHelper(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmmRes2 = new Gmm(getGmmHelper(), gmmRes->gmmResourceInfo->peekGmmResourceInfo());
// copy is being made
EXPECT_NE(gmmRes2->gmmResourceInfo->peekHandle(), gmmRes->gmmResourceInfo->peekGmmResourceInfo());
@@ -154,7 +154,7 @@ TEST_F(GmmTests, GivenInvalidImageSizeWhenQueryingImgParamsThenImageInfoReturnsS
imgDesc.imageType = ImageType::Image1D;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
EXPECT_EQ(imgInfo.size, 0u);
}
@@ -165,7 +165,7 @@ TEST_F(GmmTests, GivenInvalidImageTypeWhenQueryingImgParamsThenExceptionIsThrown
imgDesc.imageType = ImageType::Invalid;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
EXPECT_THROW(MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false), std::exception);
EXPECT_THROW(MockGmm::queryImgParams(getGmmHelper(), imgInfo, false), std::exception);
}
TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) {
@@ -180,7 +180,7 @@ TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) {
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
EXPECT_GT(imgInfo.size, minSize);
EXPECT_GT(imgInfo.rowPitch, 0u);
@@ -210,27 +210,27 @@ TEST_F(GmmTests, WhenQueryingImgParamsThenCorrectValuesAreReturned) {
TEST_F(GmmTests, givenWidthWhenCreatingResourceThenSetWidth64Field) {
const void *dummyPtr = reinterpret_cast<void *>(0x123);
size_t allocationSize = std::numeric_limits<size_t>::max();
Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
Gmm gmm(getGmmHelper(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_EQ(static_cast<uint64_t>(allocationSize), gmm.resourceParams.BaseWidth64);
}
TEST_F(GmmTests, givenNullptrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) {
void *pSysMem = nullptr;
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 1u);
}
HWTEST_F(GmmTests, givenGmmWithForceLocalMemThenNonLocalIsSetToFalse) {
void *pSysMem = nullptr;
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_EQ(gmm->resourceParams.Flags.Info.NonLocalOnly, 0u);
}
TEST_F(GmmTests, givenPtrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) {
void *pSysMem = reinterpret_cast<void *>(0x1111);
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), pSysMem, 4096, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 0u);
}
@@ -247,7 +247,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedThenItH
SurfaceFormatInfo surfaceFormat = {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16};
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation();
size_t expectedSize = imgDesc.imageRowPitch * imgDesc.imageHeight;
@@ -268,7 +268,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedAndPitc
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
EXPECT_EQ(imgInfo.imgDesc.imageRowPitch, imgDesc.imageRowPitch);
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation();
size_t expectedSize = imgDesc.imageRowPitch * imgDesc.imageHeight;
@@ -288,14 +288,14 @@ TEST_F(GmmTests, givenPlanarFormatsWhenQueryingImageParamsThenUvOffsetIsQueried)
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatNV12);
imgInfo.yOffsetForUVPlane = 0;
MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
EXPECT_NE(0u, imgInfo.yOffsetForUVPlane);
imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatP010);
imgInfo.yOffsetForUVPlane = 0;
MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
EXPECT_NE(0u, imgInfo.yOffsetForUVPlane);
}
@@ -308,7 +308,7 @@ TEST_F(GmmTests, givenTilingModeSetToTileYWhenHwSupportsTilingThenTileYFlagIsSet
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
imgInfo.linearStorage = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, StorageInfo{}, false);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), imgInfo, StorageInfo{}, false);
EXPECT_EQ(gmm->resourceParams.Flags.Info.Linear, 0u);
EXPECT_EQ(gmm->resourceParams.Flags.Info.TiledY, 0u);
@@ -323,7 +323,7 @@ TEST_F(GmmTests, givenTilingModeSetToNonTiledWhenCreatingGmmThenLinearFlagIsSet)
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
imgInfo.linearStorage = true;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, StorageInfo{}, false);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), imgInfo, StorageInfo{}, false);
EXPECT_EQ(gmm->resourceParams.Flags.Info.Linear, 1u);
EXPECT_EQ(gmm->resourceParams.Flags.Info.TiledY, 0u);
@@ -474,7 +474,7 @@ TEST_F(GmmTests, givenMipmapedInputWhenAskedForHalingThenNonDefaultValueIsReturn
auto imgInfo = MockGmm::initImgInfo(imgDesc, mipLevel, nullptr);
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
EXPECT_EQ(static_cast<int>(queryGmm->resourceParams.MaxLod), mipLevel);
}
@@ -491,7 +491,7 @@ struct GmmMediaCompressedTests : public GmmTests {
void SetUp() override {
GmmTests::SetUp();
StorageInfo info;
gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 4, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 4, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, info, true);
flags = gmm->gmmResourceInfo->getResourceFlags();
flags->Gpu.CCS = true;
flags->Gpu.UnifiedAuxSurface = true;
@@ -607,7 +607,7 @@ TEST_P(GmmImgTest, WhenUpdatingImgInfoAndDescThenInformationIsCorrect) {
}
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
auto mockResInfo = new MyMockGmmResourceInfo(&queryGmm->resourceParams);
queryGmm->gmmResourceInfo.reset(mockResInfo);
@@ -671,7 +671,7 @@ TEST_F(GmmImgTest, givenImgInfoWhenUpdatingOffsetsThenGmmIsCalledToGetOffsets) {
imgDesc.imageArraySize = 10;
ImageInfo imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
std::unique_ptr<Gmm> gmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
std::unique_ptr<Gmm> gmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
MyMockGmmResourceInfo *mockGmmResourceInfo = new MyMockGmmResourceInfo(&gmm->resourceParams);
gmm->gmmResourceInfo.reset(mockGmmResourceInfo);
@@ -695,7 +695,7 @@ TEST_F(GmmTests, GivenPlaneWhenCopyingResourceBltThenResourceIsCopiedCorrectly)
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto gmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto gmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
auto mockResInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
GMM_RES_COPY_BLT &requestedCpuBlt = mockResInfo->requestedResCopyBlt;
@@ -751,7 +751,7 @@ TEST_F(GmmTests, GivenPlaneWhenCopyingResourceBltThenResourceIsCopiedCorrectly)
}
TEST_F(GmmTests, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockResource->setUnifiedAuxTranslationCapable();
@@ -764,12 +764,12 @@ TEST_F(GmmTests, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityTh
TEST_F(GmmTests, givenAlignmentValueWhenConstructingGmmThenSetAlignmentInResourceCreateObject) {
const uint32_t alignment = 8096;
Gmm gmm{getGmmClientContext(), nullptr, 1, alignment, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true};
Gmm gmm{getGmmHelper(), nullptr, 1, alignment, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true};
EXPECT_EQ(alignment, gmm.resourceParams.BaseAlignment);
}
TEST_F(GmmTests, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 0;
@@ -788,14 +788,14 @@ TEST_F(GmmTests, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapability
TEST_F(GmmTests, whenLargePagesAreImplicitlyAllowedThenEnableOptimizationPadding) {
size_t allocationSize = 128;
Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
Gmm gmm(getGmmHelper(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding);
}
TEST_F(GmmTests, whenLargePagesAreExplicitlyAllowedAndUserPtrIsNullThenAllowOptimizationPadding) {
size_t allocationSize = 128;
bool allowLargePages = true;
Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
Gmm gmm(getGmmHelper(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding);
}
@@ -803,14 +803,14 @@ TEST_F(GmmTests, whenLargePagesAreExplicitlyDisallowedButUserPtrIsNotNullThenAll
const void *dummyPtr = reinterpret_cast<void *>(0x123);
size_t allocationSize = 128;
bool allowLargePages = false;
Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
Gmm gmm(getGmmHelper(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_FALSE(gmm.resourceParams.Flags.Info.NoOptimizationPadding);
}
TEST_F(GmmTests, whenLargePagesAreExplicitlyDisallowedAndUserPtrIsNullThenDisableOptimizationPadding) {
size_t allocationSize = 128;
bool allowLargePages = false;
Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
Gmm gmm(getGmmHelper(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_TRUE(gmm.resourceParams.Flags.Info.NoOptimizationPadding);
}
@@ -818,14 +818,14 @@ TEST_F(GmmTests, givenSizeIsMisallignedTo64kbWhenForceDisablingLargePagesThenSiz
const void *dummyPtr = reinterpret_cast<void *>(0x123);
size_t allocationSize = 256U;
bool allowLargePages = false;
Gmm gmm(getGmmClientContext(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
Gmm gmm(getGmmHelper(), dummyPtr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_EQ(allocationSize, gmm.resourceParams.BaseWidth64);
}
TEST_F(GmmTests, givenSizeIsAllignedTo64kbWhenForceDisablingLargePagesThenSizeIsAlteredToBreak64kbAlignment) {
size_t allocationSize = MemoryConstants::pageSize64k;
bool allowLargePages = false;
Gmm gmm(getGmmClientContext(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
Gmm gmm(getGmmHelper(), nullptr, allocationSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, allowLargePages);
EXPECT_EQ(allocationSize + MemoryConstants::pageSize, gmm.resourceParams.BaseWidth64);
}
@@ -958,16 +958,16 @@ TEST_F(GmmTests, whenGmmIsCreatedAndForceAllResourcesUncachedIsSetThenResourceUs
auto size = 4096u;
void *incomingPtr = (void *)0x1000;
auto gmm1 = std::make_unique<Gmm>(getGmmClientContext(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm1 = std::make_unique<Gmm>(getGmmHelper(), incomingPtr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
EXPECT_EQ(GMM_RESOURCE_USAGE_SURFACE_UNCACHED, gmm1->resourceParams.Usage);
ImageDescriptor imgDesc = {};
imgDesc.imageType = ImageType::Image1D;
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto gmm2 = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto gmm2 = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
EXPECT_EQ(GMM_RESOURCE_USAGE_SURFACE_UNCACHED, gmm2->resourceParams.Usage);
auto gmm3 = std::make_unique<Gmm>(getGmmClientContext(), gmm1->gmmResourceInfo->peekGmmResourceInfo());
auto gmm3 = std::make_unique<Gmm>(getGmmHelper(), gmm1->gmmResourceInfo->peekGmmResourceInfo());
EXPECT_EQ(GMM_RESOURCE_USAGE_SURFACE_UNCACHED, gmm3->resourceParams.Usage);
}
@@ -1002,12 +1002,12 @@ TEST_F(GmmTests, whenResourceIsCreatedThenHandleItsOwnership) {
using GmmEnvironmentTest = MockExecutionEnvironmentGmmFixtureTest;
TEST_F(GmmEnvironmentTest, givenGmmWithNotSetMCSInResourceInfoGpuFlagsWhenCallHasMultisampleControlSurfaceThenReturnFalse) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_FALSE(gmm->hasMultisampleControlSurface());
}
TEST_F(GmmEnvironmentTest, givenGmmWithSetMCSInResourceInfoGpuFlagsWhenCallhasMultisampleControlSurfaceThenReturnTrue) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockResource->setMultisampleControlSurface();
EXPECT_TRUE(gmm->hasMultisampleControlSurface());
@@ -1152,7 +1152,7 @@ struct GmmCompressionTests : public MockExecutionEnvironmentGmmFixtureTest {
};
TEST_F(GmmCompressionTests, givenEnabledAndNotPreferredE2ECWhenApplyingForBuffersThenDontSetValidFlags) {
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->resourceParams = {};
localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = true;
@@ -1165,7 +1165,7 @@ TEST_F(GmmCompressionTests, givenEnabledAndNotPreferredE2ECWhenApplyingForBuffer
}
TEST_F(GmmCompressionTests, givenDisabledAndPreferredE2ECWhenApplyingForBuffersThenDontSetValidFlags) {
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->resourceParams = {};
localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = false;
@@ -1182,7 +1182,7 @@ HWTEST_F(GmmCompressionTests, givenAllValidInputsWhenQueryingThenSetAppropriateF
EXPECT_TRUE(imgInfo.surfaceFormat->GMMSurfaceFormat != GMM_RESOURCE_FORMAT::GMM_FORMAT_NV12);
EXPECT_TRUE(imgInfo.plane == GMM_YUV_PLANE_ENUM::GMM_NO_PLANE);
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat();
auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
EXPECT_GT(compressionFormat, 0u);
@@ -1203,7 +1203,7 @@ TEST_F(GmmCompressionTests, givenAllValidInputsAndNoLocalMemoryRequestWhenQueryi
imgInfo.useLocalMemory = false;
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat();
auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
EXPECT_GT(compressionFormat, 0u);
@@ -1217,7 +1217,7 @@ TEST_F(GmmCompressionTests, givenAllValidInputsAndNoLocalMemoryRequestWhenQueryi
TEST_F(GmmCompressionTests, givenNotAllowedRenderCompressionWhenQueryingThenSetAppropriateFlags) {
localPlatformDevice->capabilityTable.ftrRenderCompressedImages = false;
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Info.Linear);
EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Info.RenderCompressed);
@@ -1231,7 +1231,7 @@ HWTEST_F(GmmCompressionTests, givenNotAllowedCompressionAndEnabledDebugFlagWhenQ
DebugManagerStateRestore restore;
DebugManager.flags.RenderCompressedImagesEnabled.set(1);
localPlatformDevice->capabilityTable.ftrRenderCompressedImages = false;
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Info.Linear);
EXPECT_EQ(1u, queryGmm->resourceParams.Flags.Info.RenderCompressed);
@@ -1242,7 +1242,7 @@ HWTEST_F(GmmCompressionTests, givenNotAllowedCompressionAndEnabledDebugFlagWhenQ
DebugManager.flags.RenderCompressedImagesEnabled.set(0);
localPlatformDevice->capabilityTable.ftrRenderCompressedImages = true;
queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Info.RenderCompressed);
EXPECT_EQ(0u, queryGmm->resourceParams.Flags.Gpu.CCS);
@@ -1252,7 +1252,7 @@ HWTEST_F(GmmCompressionTests, givenNotAllowedCompressionAndEnabledDebugFlagWhenQ
}
TEST_F(GmmCompressionTests, givenNotPreferredCompressionFlagWhenQueryingThenDisallow) {
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, false);
EXPECT_FALSE(queryGmm->isCompressionEnabled);
}
@@ -1260,7 +1260,7 @@ TEST_F(GmmCompressionTests, givenNotPreferredCompressionFlagWhenQueryingThenDisa
TEST_F(GmmCompressionTests, givenNV12FormatWhenQueryingThenDisallow) {
imgInfo.surfaceFormat = &SurfaceFormats::planarYuv()[0].surfaceFormat;
EXPECT_TRUE(imgInfo.surfaceFormat->GMMSurfaceFormat == GMM_RESOURCE_FORMAT::GMM_FORMAT_NV12);
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat();
auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
@@ -1278,14 +1278,14 @@ TEST_F(GmmCompressionTests, givenInvalidCompressionFormatAndFlatCcsFtrSetWhenQue
uint8_t invalidFormat = static_cast<uint8_t>(GMM_FLATCCS_FORMAT::GMM_FLATCCS_FORMAT_INVALID);
mockGmmClient->compressionFormatToReturn = invalidFormat;
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat();
auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
EXPECT_EQ(compressionFormat, invalidFormat);
EXPECT_FALSE(queryGmm->isCompressionEnabled);
mockGmmClient->compressionFormatToReturn = validFormat;
queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
EXPECT_TRUE(queryGmm->isCompressionEnabled);
}
@@ -1298,14 +1298,14 @@ TEST_F(GmmCompressionTests, givenInvalidCompressionFormatAndFlatCcsFtrNotSetWhen
uint8_t validFormat = static_cast<uint8_t>(GMM_FLATCCS_FORMAT::GMM_FLATCCS_FORMAT_INVALID);
mockGmmClient->compressionFormatToReturn = invalidFormat;
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
auto resourceFormat = queryGmm->gmmResourceInfo->getResourceFormat();
auto compressionFormat = getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
EXPECT_EQ(compressionFormat, invalidFormat);
EXPECT_FALSE(queryGmm->isCompressionEnabled);
mockGmmClient->compressionFormatToReturn = validFormat;
queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
EXPECT_TRUE(queryGmm->isCompressionEnabled);
}
@@ -1315,7 +1315,7 @@ TEST_F(GmmCompressionTests, givenPlaneFormatWhenQueryingThenDisallow) {
for (auto &plane : gmmPlane) {
imgInfo.plane = plane;
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
EXPECT_EQ(queryGmm->isCompressionEnabled,
plane == GMM_YUV_PLANE::GMM_NO_PLANE);
@@ -1325,24 +1325,24 @@ TEST_F(GmmCompressionTests, givenPlaneFormatWhenQueryingThenDisallow) {
TEST_F(GmmCompressionTests, givenPackedYuvFormatWhenQueryingThenDisallow) {
for (auto &surfaceFormat : SurfaceFormats::packedYuv()) {
imgInfo.surfaceFormat = &surfaceFormat.surfaceFormat;
auto queryGmm = MockGmm::queryImgParams(getGmmClientContext(), imgInfo, true);
auto queryGmm = MockGmm::queryImgParams(getGmmHelper(), imgInfo, true);
EXPECT_FALSE(queryGmm->isCompressionEnabled);
}
}
HWTEST_F(GmmCompressionTests, whenConstructedWithPreferCompressionFlagThenApplyAuxFlags) {
Gmm gmm1(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
Gmm gmm1(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_EQ(0u, gmm1.resourceParams.Flags.Info.RenderCompressed);
Gmm gmm2(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
Gmm gmm2(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_EQ(0u, gmm2.resourceParams.Flags.Info.RenderCompressed);
Gmm gmm3(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true);
Gmm gmm3(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, {}, true);
EXPECT_EQ(1u, gmm3.resourceParams.Flags.Info.RenderCompressed);
}
TEST_F(GmmCompressionTests, givenMediaCompressedImageApplyAuxFlagsForImageThenSetFlagsToCompressed) {
MockGmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
MockGmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm.resourceParams.Flags.Info.MediaCompressed = true;
gmm.resourceParams.Flags.Info.RenderCompressed = false;
gmm.setupImageResourceParams(imgInfo, true);
@@ -1351,7 +1351,7 @@ TEST_F(GmmCompressionTests, givenMediaCompressedImageApplyAuxFlagsForImageThenSe
}
TEST_F(GmmCompressionTests, givenRenderCompressedImageApplyAuxFlagsForImageThenSetFlagsToCompressed) {
MockGmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
MockGmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm.resourceParams.Flags.Info.MediaCompressed = false;
gmm.resourceParams.Flags.Info.RenderCompressed = true;
gmm.setupImageResourceParams(imgInfo, true);
@@ -1360,7 +1360,7 @@ TEST_F(GmmCompressionTests, givenRenderCompressedImageApplyAuxFlagsForImageThenS
}
HWTEST_F(GmmCompressionTests, givenEnabledAndPreferredE2ECWhenApplyingForBuffersThenSetValidFlags) {
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->resourceParams = {};
localPlatformDevice->capabilityTable.ftrRenderCompressedBuffers = true;
@@ -1374,7 +1374,7 @@ HWTEST_F(GmmCompressionTests, givenEnabledAndPreferredE2ECWhenApplyingForBuffers
HWTEST_F(GmmCompressionTests, givenDisabledE2ECAndEnabledDebugFlagWhenApplyingForBuffersThenSetValidFlags) {
DebugManagerStateRestore restore;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm.resourceParams = {};
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);
@@ -1420,7 +1420,7 @@ struct MultiTileGmmTests : GmmLocalMemoryTests {
};
TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUseSystemMemoryIsTrueThenNonLocalOnlyFlagIsSetAndLocalOnlyCleared) {
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
}
@@ -1430,7 +1430,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUsingLocalMemoryAndAllocation
storageInfo.isLockable = true;
storageInfo.memoryBanks.set(1);
storageInfo.systemMemoryPlacement = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NotLockable);
@@ -1441,7 +1441,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUsingLocalMemoryFalseAndAlloc
storageInfo.isLockable = false;
storageInfo.memoryBanks.set(1);
storageInfo.systemMemoryPlacement = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
@@ -1454,7 +1454,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndNotLockableAllocationAndStorageIn
storageInfo.memoryBanks.set(1);
storageInfo.systemMemoryPlacement = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
@@ -1471,7 +1471,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithLocalOnlyRequiredW
for (auto csrMode = static_cast<int32_t>(CommandStreamReceiverType::CSR_HW); csrMode < static_cast<int32_t>(CommandStreamReceiverType::CSR_TYPES_NUM); csrMode++) {
DebugManager.flags.SetCommandStreamReceiver.set(csrMode);
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
}
@@ -1480,7 +1480,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithLocalOnlyRequiredW
TEST_F(GmmLocalMemoryTests, givenSystemMemoryAndStorageInfoWithLocalOnlyRequiredWhenPreparingFlagsForGmmThenLocalOnlyIsNotSet) {
StorageInfo storageInfo{};
storageInfo.localOnlyRequired = true;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
}
@@ -1488,7 +1488,7 @@ TEST_F(GmmLocalMemoryTests, givenSystemMemoryAndStorageInfoWithLocalOnlyRequired
TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithoutLocalOnlyRequiredWhenPreparingFlagsForGmmThenLocalOnlyIsNotSet) {
StorageInfo storageInfo{};
storageInfo.localOnlyRequired = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
}
@@ -1501,7 +1501,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryAndCompressionEnabledWhenUsingLoc
storageInfo.systemMemoryPlacement = false;
storageInfo.memoryBanks.set(1);
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, storageInfo, true);
EXPECT_TRUE(gmm->isCompressionEnabled);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly);
@@ -1516,7 +1516,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUseSystemMemoryIsFalseAndAllo
storageInfo.memoryBanks.set(1);
storageInfo.systemMemoryPlacement = false;
storageInfo.isLockable = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
@@ -1541,7 +1541,7 @@ TEST_F(GmmLocalMemoryTests, givenUseLocalMemoryInImageInfoTrueWhenGmmIsCreatedTh
storageInfo.systemMemoryPlacement = false;
storageInfo.memoryBanks.set(1);
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, storageInfo, false);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), imgInfo, storageInfo, false);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
@@ -1568,7 +1568,7 @@ TEST_F(GmmLocalMemoryTests, givenUseCompressionAndLocalMemoryInImageInfoTrueWhen
storageInfo.memoryBanks.set(1);
storageInfo.systemMemoryPlacement = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, storageInfo, true);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), imgInfo, storageInfo, true);
EXPECT_TRUE(gmm->isCompressionEnabled);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly);
@@ -1590,7 +1590,7 @@ TEST_F(GmmLocalMemoryTests, givenUseLocalMemoryInImageInfoFalseWhenGmmIsCreatedT
imgInfo.useLocalMemory = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, StorageInfo{}, false);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), imgInfo, StorageInfo{}, false);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
}
@@ -1609,11 +1609,11 @@ TEST_F(MultiTileGmmTests, whenCreateGmmWithImageInfoThenEnableMultiTileArch) {
imgInfo.surfaceFormat = &surfaceFormat->surfaceFormat;
imgInfo.useLocalMemory = false;
auto gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, StorageInfo{}, false);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), imgInfo, StorageInfo{}, false);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.MultiTileArch.Enable);
imgInfo.useLocalMemory = true;
gmm = std::make_unique<Gmm>(getGmmClientContext(), imgInfo, StorageInfo{}, false);
gmm = std::make_unique<Gmm>(getGmmHelper(), imgInfo, StorageInfo{}, false);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.MultiTileArch.Enable);
}
@@ -1622,7 +1622,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWhenGmmIsCreatedWithEmptyMempo
StorageInfo storageInfo;
storageInfo.memoryBanks = 0;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(0u, gmm.resourceParams.MultiTileArch.TileInstanced);
@@ -1634,7 +1634,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWithoutCloningWhenGmmIsCreated
storageInfo.cloningOfPageTables = false;
storageInfo.systemMemoryPlacement = false;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.GpuVaMappingSet);
@@ -1646,7 +1646,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileAllocationWithoutCloningWhenGmmIsCreated
TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithNonLocalMemoryThenMultitileArchIsPropertlyFilled) {
StorageInfo storageInfo;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(customTileMask, gmm.resourceParams.MultiTileArch.GpuVaMappingSet);
@@ -1661,7 +1661,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithSpecificMemoryBanksT
storageInfo.memoryBanks = 1u;
storageInfo.cloningOfPageTables = false;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(storageInfo.memoryBanks, gmm.resourceParams.MultiTileArch.LocalMemPreferredSet);
@@ -1677,7 +1677,7 @@ TEST_F(MultiTileGmmTests, givenMultiTileWhenGmmIsCreatedWithCloningEnabledThenGp
storageInfo.systemMemoryPlacement = false;
storageInfo.pageTablesVisibility = 3u;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(storageInfo.memoryBanks, gmm.resourceParams.MultiTileArch.LocalMemPreferredSet);
@@ -1693,7 +1693,7 @@ TEST_F(MultiTileGmmTests, whenAllocationIsTileInstancedWithoutClonningPageTables
storageInfo.memoryBanks = 2u;
storageInfo.systemMemoryPlacement = false;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.TileInstanced);
@@ -1704,7 +1704,7 @@ TEST_F(MultiTileGmmTests, whenAllocationIsTileInstancedWithClonningPageTablesThe
storageInfo.cloningOfPageTables = true;
storageInfo.tileInstanced = true;
Gmm gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
Gmm gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, storageInfo, true);
EXPECT_EQ(1u, gmm.resourceParams.MultiTileArch.Enable);
EXPECT_EQ(0u, gmm.resourceParams.MultiTileArch.TileInstanced);

View File

@@ -491,7 +491,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenU
size_t allocSize = size;
length.Length = static_cast<uint32_t>(allocSize - 1);
GraphicsAllocation allocation(0, AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u);
allocation.setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.setDefaultGmm(new Gmm(pDevice->getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false);
EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth());
@@ -528,7 +528,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres
uint64_t gpuAddr = 0x4000u;
size_t allocSize = size;
GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 0u);
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.getDefaultGmm()->isCompressionEnabled = true;
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false);
@@ -560,7 +560,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmCompressionDisabledA
uint64_t gpuAddr = 0x4000u;
size_t allocSize = size;
GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false);
EXPECT_EQ(UnitTestHelper<FamilyType>::getCoherencyTypeSupported(RENDER_SURFACE_STATE::COHERENCY_TYPE_IA_COHERENT), state->getCoherencyType());
@@ -593,7 +593,7 @@ HWTEST_F(HwHelperTest, givenOverrideMocsIndexForScratchSpaceWhenSurfaceStateIsPr
uint64_t gpuAddr = 0x4000u;
size_t allocSize = size;
GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1);
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, false, false);
@@ -625,7 +625,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenGmmAndAllocationCompres
uint64_t gpuAddr = 0x4000u;
size_t allocSize = size;
GraphicsAllocation allocation(0, AllocationType::BUFFER, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull, 1u);
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmHelper(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation.getDefaultGmm()->isCompressionEnabled = true;
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
helper.setRenderSurfaceStateForBuffer(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true, false);
@@ -1036,7 +1036,7 @@ HWTEST_F(HwHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequiredFo
EXPECT_FALSE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
MockGmm mockGmm(pDevice->getGmmClientContext(), nullptr, 100, 100, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
MockGmm mockGmm(pDevice->getGmmHelper(), nullptr, 100, 100, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
mockGmm.resourceParams.Flags.Info.NotLockable = true;
graphicsAllocation.setDefaultGmm(&mockGmm);
@@ -1308,7 +1308,7 @@ TEST_F(HwHelperTest, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequir
HWTEST_F(HwHelperTest, whenSetCompressedFlagThenProperFlagSet) {
auto &hwHelper = HwHelper::get(renderCoreFamily);
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmClientContext());
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
gmm->resourceParams.Flags.Info.RenderCompressed = 0;
hwHelper.applyRenderCompressionFlag(*gmm, 1);

View File

@@ -657,7 +657,7 @@ TEST_F(KernelArgBufferTest, givenSetUnifiedMemoryExecInfoOnKernelWithIndirectSta
{AllocationType::BUFFER_HOST_MEMORY, false},
{AllocationType::SVM_GPU, true}}};
auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
MockGraphicsAllocation gfxAllocation;
gfxAllocation.setDefaultGmm(gmm.get());
@@ -697,7 +697,7 @@ TEST_F(KernelArgBufferTest, givenSVMAllocsManagerWithCompressedSVMAllocationsWhe
{AllocationType::BUFFER_HOST_MEMORY, false},
{AllocationType::SVM_GPU, true}}};
auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
MockGraphicsAllocation gfxAllocation;
gfxAllocation.setDefaultGmm(gmm.get());

View File

@@ -165,7 +165,7 @@ HWTEST_F(BufferSetArgTest, givenNonPureStatefulArgWhenCompressedBufferIsSetThenS
pKernelInfo->argAsPtr(0).bindful = 0;
auto graphicsAllocation = buffer->getGraphicsAllocation(pClDevice->getRootDeviceIndex());
graphicsAllocation->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), graphicsAllocation->getUnderlyingBuffer(), buffer->getSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
graphicsAllocation->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), graphicsAllocation->getUnderlyingBuffer(), buffer->getSize(), 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
graphicsAllocation->getDefaultGmm()->isCompressionEnabled = true;
cl_mem clMem = buffer;

View File

@@ -1711,7 +1711,7 @@ HWTEST_F(BufferSetSurfaceTests, givenCompressedGmmResourceWhenSurfaceStateIsProg
std::unique_ptr<Buffer> buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
auto graphicsAllocation = buffer->getGraphicsAllocation(rootDeviceIndex);
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
graphicsAllocation->setDefaultGmm(gmm);
gmm->isCompressionEnabled = true;
@@ -1732,7 +1732,7 @@ HWTEST_F(BufferSetSurfaceTests, givenNonCompressedGmmResourceWhenSurfaceStateIsP
auto retVal = CL_SUCCESS;
std::unique_ptr<Buffer> buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
buffer->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(gmm);
gmm->isCompressionEnabled = false;
@@ -1894,7 +1894,7 @@ HWTEST_F(BufferUnmapTest, givenBufferWithSharingHandlerWhenUnmappingThenUseNonBl
auto gfxAllocation = buffer->getGraphicsAllocation(pDevice->getRootDeviceIndex());
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pDevice->getGmmHelper()), handleId);
}
auto mappedPtr = clEnqueueMapBuffer(&cmdQ, buffer.get(), CL_TRUE, CL_MAP_WRITE, 0, 1, 0, nullptr, nullptr, &retVal);

View File

@@ -34,7 +34,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenDebugFlagSetWhenProgr
uint32_t defaultCompressionFormat = gmmContext->getSurfaceStateCompressionFormat(GMM_RESOURCE_FORMAT::GMM_FORMAT_GENERIC_8BIT);
auto retVal = CL_SUCCESS;
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true;
auto buffer = std::unique_ptr<Buffer>(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
@@ -76,7 +76,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenBufferAllocationInDev
auto &device = context.getDevice(0)->getDevice();
auto allocation = buffer->getGraphicsAllocation(device.getRootDeviceIndex());
auto gmm = new MockGmm(device.getGmmClientContext());
auto gmm = new MockGmm(device.getGmmHelper());
gmm->isCompressionEnabled = true;
allocation->setDefaultGmm(gmm);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -341,7 +341,7 @@ TEST_F(GetMemObjectInfo, GivenValidBufferWhenGettingCompressionOfMemObjectThenCo
EXPECT_EQ(CL_SUCCESS, retVal);
ASSERT_EQ(sizeof(cl_bool), sizeReturned);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), true);
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_COMPRESSION_INTEL,
@@ -351,7 +351,7 @@ TEST_F(GetMemObjectInfo, GivenValidBufferWhenGettingCompressionOfMemObjectThenCo
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(cl_bool{CL_TRUE}, usesCompression);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmClientContext(), false);
MockBuffer::setAllocationType(graphicsAllocation, pDevice->getRootDeviceEnvironment().getGmmHelper(), false);
retVal = buffer->getMemObjectInfo(
CL_MEM_USES_COMPRESSION_INTEL,

View File

@@ -340,7 +340,7 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag
auto imageDescriptor = Image::convertDescriptor(imageDesc);
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat);
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), imgInfo, false);
EXPECT_TRUE(queryGmm->gmmResourceInfo->getSizeAllocation() >= this->size);
@@ -372,7 +372,7 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag
auto imageDescriptor = Image::convertDescriptor(imageDesc);
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat);
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), imgInfo, false);
EXPECT_TRUE(queryGmm->gmmResourceInfo->getSizeAllocation() >= this->size);
@@ -412,7 +412,7 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag
auto imageDescriptor = Image::convertDescriptor(imageDesc);
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &imageFromBuffer->getSurfaceFormatInfo().surfaceFormat);
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo, false);
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), imgInfo, false);
EXPECT_GT(queryGmm->gmmResourceInfo->getSizeAllocation(), bufferSize);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -93,7 +93,7 @@ HWTEST_F(CreateImage3DTest, GivenTiledOrForcedLinearWhenCreatingImageThenPropert
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
auto imageDescriptor = Image::convertDescriptor(imageDesc);
auto imgInfo = MockGmm::initImgInfo(imageDescriptor, 0, &surfaceFormat->surfaceFormat);
MockGmm::queryImgParams(context->getDevice(0)->getGmmClientContext(), imgInfo, false);
MockGmm::queryImgParams(context->getDevice(0)->getGmmHelper(), imgInfo, false);
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, &context->getDevice(0)->getDevice());
auto image = Image::create(
@@ -118,7 +118,7 @@ HWTEST_F(CreateImage3DTest, GivenTiledOrForcedLinearWhenCreatingImageThenPropert
// query again
surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
MockGmm::queryImgParams(context->getDevice(0)->getGmmClientContext(), imgInfo, false);
MockGmm::queryImgParams(context->getDevice(0)->getGmmHelper(), imgInfo, false);
image = Image::create(
context,

View File

@@ -273,7 +273,7 @@ HWTEST_F(ImageSetArgTest, givenImageArraySizeGreaterThanOneButTypeIsNotImageArra
imageInfo.imgDesc = Image::convertDescriptor(imageDesc);
imageInfo.plane = GMM_NO_PLANE;
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imageInfo, false);
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), imageInfo, false);
allocation->setDefaultGmm(gmm.release());
auto image = std::unique_ptr<Image>{Image::createSharedImage(
@@ -514,7 +514,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithoutUnifiedAuxC
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8;
@@ -613,7 +613,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationAndCompressionWhenSetArgOnMultisampl
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8;
@@ -676,7 +676,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8;
@@ -708,7 +708,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8;
@@ -737,7 +737,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
McsSurfaceInfo msi = {10, 20, 3};
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
imgDesc.num_samples = 8;

View File

@@ -1699,7 +1699,7 @@ HWTEST_F(ImageTransformTest, givenSurfaceBaseAddressAndUnifiedSurfaceWhenSetUnif
MockContext context;
auto image = std::unique_ptr<Image>(ImageHelper<Image3dDefaults>::create(&context));
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
auto gmm = std::unique_ptr<Gmm>(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto gmm = std::unique_ptr<Gmm>(new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
uint64_t surfBsaseAddress = 0xABCDEF1000;
surfaceState.setSurfaceBaseAddress(surfBsaseAddress);
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());

View File

@@ -89,7 +89,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterImageTests, givenCompressionWhenAppendi
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, 128 * 256 * 4, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true;
auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@@ -130,7 +130,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterImageTests, givenImageFromBufferWhenSet
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, 128 * 256 * 4, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true;
auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@@ -173,7 +173,7 @@ HWTEST2_F(XeHPAndLaterImageTests, givenMcsAllocationWhenSetArgIsCalledWithUnifie
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getRootDeviceEnvironment().getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
surfaceState.setSurfaceBaseAddress(0xABCDEF1000);
imageHw->setMcsSurfaceInfo(msi);
imageHw->setMcsAllocation(mcsAlloc);
@@ -279,7 +279,7 @@ HWTEST2_F(XeHPAndLaterImageTests, givenCompressionWhenAppendingNewAllocationThen
gmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = true;
gmm->isCompressionEnabled = true;
auto mcsGmm = new MockGmm(context.getDevice(0)->getGmmClientContext());
auto mcsGmm = new MockGmm(context.getDevice(0)->getGmmHelper());
mcsGmm->isCompressionEnabled = true;
mcsGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = true;
mcsGmm->gmmResourceInfo->getResourceFlags()->Gpu.UnifiedAuxSurface = true;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -99,7 +99,7 @@ TEST_P(CreateTiledImageTest, GivenSharedTiledImageWhenCheckingIsTiledThenTrueRet
info.imgDesc = Image::convertDescriptor(imageDesc);
info.plane = GMM_NO_PLANE;
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), info, false);
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), info, false);
alloc->setDefaultGmm(gmm.release());
@@ -139,7 +139,7 @@ TEST_P(CreateNonTiledImageTest, GivenSharedNonTiledImageWhenCheckingIsTiledThenF
info.imgDesc = Image::convertDescriptor(imageDesc);
info.plane = GMM_NO_PLANE;
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), info, false);
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmHelper(), info, false);
alloc->setDefaultGmm(gmm.release());

View File

@@ -313,7 +313,7 @@ TEST(MemObj, givenCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false);
@@ -347,7 +347,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
context.memoryManager = &memoryManager;
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{context.getDevice(0)->getRootDeviceIndex(), MemoryConstants::pageSize});
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(CL_MEM_READ_WRITE, 0, 0, &context.getDevice(0)->getDevice());
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
1, allocation->getUnderlyingBuffer(), nullptr, GraphicsAllocationHelper::toMultiGraphicsAllocation(allocation), false, false, false);

View File

@@ -99,7 +99,7 @@ TEST_F(SubBufferTest, GivenAlignmentThatIsHigherThen4BytesWhenCheckedForValidity
cl_buffer_region region3 = {8, 4};
EXPECT_TRUE(buffer->isValidSubBufferOffset(region3.origin));
MockBuffer::setAllocationType(buffer->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()), context.getDevice(0)->getRootDeviceEnvironment().getGmmClientContext(), true);
MockBuffer::setAllocationType(buffer->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()), context.getDevice(0)->getRootDeviceEnvironment().getGmmHelper(), true);
EXPECT_FALSE(buffer->isValidSubBufferOffset(region.origin));
EXPECT_FALSE(buffer->isValidSubBufferOffset(region2.origin));

View File

@@ -975,7 +975,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAlloc
executionEnvironment.initGmm();
OsAgnosticMemoryManager memoryManager(executionEnvironment);
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{0, MemoryConstants::pageSize});
allocation->setDefaultGmm(gmm);
@@ -1849,7 +1849,7 @@ TEST(MemoryManager, givenShareableWhenAllocatingGraphicsMemoryThenAllocateSharea
}
TEST_F(MemoryAllocatorTest, GivenSizeWhenGmmIsCreatedThenNonNullPointerIsReturned) {
Gmm *gmm = new Gmm(device->getGmmClientContext(), nullptr, 65536, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
Gmm *gmm = new Gmm(device->getGmmHelper(), nullptr, 65536, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_NE(nullptr, gmm);
delete gmm;
}
@@ -2608,7 +2608,7 @@ TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAlloca
TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIs64KSuitableThenStandard64kHeapIsUsed) {
GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get();
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
resourceInfo->is64KBPageSuitableValue = true;
allocation.setDefaultGmm(gmm.get());
@@ -2618,7 +2618,7 @@ TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAlloca
TEST_F(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIsNot64KSuitableThenStandardHeapIsUsed) {
GraphicsAllocation allocation{0, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get();
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
resourceInfo->is64KBPageSuitableValue = false;
allocation.setDefaultGmm(gmm.get());
@@ -2885,7 +2885,7 @@ HWTEST_F(PageTableManagerTest, givenPageTableManagerWhenMapAuxGpuVaThenForAllEng
memoryManager->getRegisteredEngines()[1].commandStreamReceiver->pageTableManager.reset(mockMngr2);
MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull);
MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmClientContext());
MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper());
gmm.isCompressionEnabled = true;
allocation.setDefaultGmm(&gmm);
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
@@ -2929,7 +2929,7 @@ HWTEST_F(PageTableManagerTest, givenPageTableManagerWhenUpdateAuxTableGmmErrorTh
memoryManager->getRegisteredEngines()[0].commandStreamReceiver->pageTableManager.reset(mockMngr);
MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull);
MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmClientContext());
MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper());
gmm.isCompressionEnabled = true;
allocation.setDefaultGmm(&gmm);
@@ -2961,7 +2961,7 @@ HWTEST_F(PageTableManagerTest, givenNullPageTableManagerWhenMapAuxGpuVaThenNoThr
memoryManager->getRegisteredEngines()[0].commandStreamReceiver->pageTableManager.reset(nullptr);
MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull);
MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmClientContext());
MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper());
gmm.isCompressionEnabled = true;
allocation.setDefaultGmm(&gmm);
@@ -3004,7 +3004,7 @@ HWTEST_F(PageTableManagerTest, givenMemoryManagerThatSupportsPageTableManagerWhe
auto memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
MockGraphicsAllocation allocation(1u, AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull);
MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmClientContext());
MockGmm gmm(executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getGmmHelper());
allocation.setDefaultGmm(&gmm);
bool mapped = memoryManager->mapAuxGpuVA(&allocation);
auto hwInfo = executionEnvironment->rootDeviceEnvironments[allocation.getRootDeviceIndex()]->getHardwareInfo();

View File

@@ -98,8 +98,8 @@ TEST_F(MigrationControllerTests, givenNotLockableBufferAllocationWithDefinedLoca
auto srcAllocation = pBuffer->getMultiGraphicsAllocation().getGraphicsAllocation(0);
auto dstAllocation = pBuffer->getMultiGraphicsAllocation().getGraphicsAllocation(1);
auto gmm0 = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm1 = new Gmm(context.getDevice(1)->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm0 = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm1 = new Gmm(context.getDevice(1)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
srcAllocation->setDefaultGmm(gmm0);
dstAllocation->setDefaultGmm(gmm1);
@@ -212,4 +212,4 @@ TEST_F(MigrationControllerTests, whenHandleMigrationThenProperTagAddressAndTaskC
EXPECT_EQ(pCsr0->getTagAddress(), migrationSyncData->tagAddress);
EXPECT_EQ(pCsr0->peekTaskCount() + 1, migrationSyncData->latestTaskCountUsed);
}
}

View File

@@ -54,12 +54,12 @@ class MockBuffer : public MockBufferStorage, public Buffer {
void setAllocationType(uint32_t rootDeviceIndex, bool compressed) {
setAllocationType(multiGraphicsAllocation.getGraphicsAllocation(rootDeviceIndex),
device->getRootDeviceEnvironment().getGmmClientContext(), compressed);
device->getRootDeviceEnvironment().getGmmHelper(), compressed);
}
static void setAllocationType(GraphicsAllocation *graphicsAllocation, GmmClientContext *gmmClientContext, bool compressed) {
static void setAllocationType(GraphicsAllocation *graphicsAllocation, GmmHelper *gmmHelper, bool compressed) {
if (compressed && !graphicsAllocation->getDefaultGmm()) {
graphicsAllocation->setDefaultGmm(new Gmm(gmmClientContext, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, compressed, {}, true));
graphicsAllocation->setDefaultGmm(new Gmm(gmmHelper, nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, compressed, {}, true));
}
if (graphicsAllocation->getDefaultGmm()) {

View File

@@ -900,7 +900,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenPageTableManagerAndMapTrueWhenUpda
auto mockMngr = new MockGmmPageTableMngr();
csr->pageTableManager.reset(mockMngr);
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
auto gmm = std::make_unique<MockGmm>(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext());
auto gmm = std::make_unique<MockGmm>(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
auto result = csr->pageTableManager->updateAuxTable(0, gmm.get(), true);
EXPECT_EQ(0ull, mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseGpuVA);
EXPECT_EQ(gmm->gmmResourceInfo->peekHandle(), mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseResInfo);
@@ -915,7 +915,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenPageTableManagerAndMapFalseWhenUpd
auto mockMngr = new MockGmmPageTableMngr();
csr->pageTableManager.reset(mockMngr);
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
auto gmm = std::make_unique<MockGmm>(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext());
auto gmm = std::make_unique<MockGmm>(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
auto result = csr->pageTableManager->updateAuxTable(0, gmm.get(), false);
EXPECT_EQ(0ull, mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseGpuVA);
EXPECT_EQ(gmm->gmmResourceInfo->peekHandle(), mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseResInfo);

View File

@@ -2773,7 +2773,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation
mock->ioctl_expected.gemWait = 1;
mock->ioctl_expected.gemClose = 1;
auto gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 123, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize});
allocation->setDefaultGmm(gmm);

View File

@@ -28,7 +28,7 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
bool logFileCreated = fileExists(fileLogger.getLogFileName());
EXPECT_FALSE(logFileCreated);
MockWddmAllocation allocation(getGmmClientContext());
MockWddmAllocation allocation(getGmmHelper());
allocation.handle = 4;
allocation.setAllocationType(AllocationType::BUFFER);
allocation.memoryPool = MemoryPool::System64KBPages;
@@ -74,7 +74,7 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIs
auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u));
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext());
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper());
allocation.handle = 4;
allocation.setAllocationType(AllocationType::BUFFER);
allocation.memoryPool = MemoryPool::System64KBPages;

View File

@@ -14,12 +14,12 @@ namespace NEO {
class MockWddmAllocation : public WddmAllocation {
public:
MockWddmAllocation(GmmClientContext *gmmClientContext) : MockWddmAllocation(gmmClientContext, EngineLimits::maxHandleCount) {}
MockWddmAllocation(GmmClientContext *gmmClientContext, uint32_t numGmms) : WddmAllocation(0, numGmms, AllocationType::UNKNOWN,
nullptr, 0, nullptr, MemoryPool::MemoryNull, 0u, 3u),
gpuPtr(gpuAddress), handle(handles[0]) {
MockWddmAllocation(GmmHelper *gmmHelper) : MockWddmAllocation(gmmHelper, EngineLimits::maxHandleCount) {}
MockWddmAllocation(GmmHelper *gmmHelper, uint32_t numGmms) : WddmAllocation(0, numGmms, AllocationType::UNKNOWN,
nullptr, 0, nullptr, MemoryPool::MemoryNull, 0u, 3u),
gpuPtr(gpuAddress), handle(handles[0]) {
for (uint32_t i = 0; i < numGmms; i++) {
setGmm(new MockGmm(gmmClientContext), i);
setGmm(new MockGmm(gmmHelper), i);
setHandle(ALLOCATION_HANDLE, i);
}
}

View File

@@ -54,11 +54,11 @@ std::unique_ptr<HwDeviceIdWddm> createHwDeviceIdFromAdapterLuid(OsEnvironmentWin
using namespace NEO;
namespace GmmHelperFunctions {
Gmm *getGmm(void *ptr, size_t size, GmmClientContext *clientContext) {
Gmm *getGmm(void *ptr, size_t size, GmmHelper *gmmHelper) {
size_t alignedSize = alignSizeWholePage(ptr, size);
void *alignedPtr = alignUp(ptr, 4096);
Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
Gmm *gmm = new Gmm(gmmHelper, alignedPtr, alignedSize, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
EXPECT_NE(gmm->gmmResourceInfo.get(), nullptr);
return gmm;
}
@@ -89,7 +89,7 @@ TEST_F(Wddm20Tests, GivenExisitingContextWhenInitializingWddmThenCreateContextRe
}
TEST_F(Wddm20Tests, givenNullPageTableManagerAndCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) {
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockGmmRes->setUnifiedAuxTranslationCapable();
@@ -248,7 +248,7 @@ TEST_F(Wddm20Tests, whenInitPrivateDataThenDefaultValuesAreSet) {
TEST_F(Wddm20Tests, WhenCreatingAllocationAndDestroyingAllocationThenCorrectResultReturned) {
OsAgnosticMemoryManager mm(*executionEnvironment);
WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper());
allocation.setDefaultGmm(gmm);
auto status = wddm->createAllocation(&allocation);
@@ -272,7 +272,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSiz
size_t alignedPages = alignedSize / MemoryConstants::pageSize;
WddmAllocation allocation(0, AllocationType::UNKNOWN, ptr, 0x2100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmClientContext());
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmHelper());
allocation.setDefaultGmm(gmm);
auto status = wddm->createAllocation(&allocation);
@@ -314,7 +314,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenReserveCallWhenItIsCalledWithProperParamt
TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
void *fakePtr = reinterpret_cast<void *>(0x123);
WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmClientContext()));
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), getGmmHelper()));
allocation.setDefaultGmm(gmm.get());
auto status = wddm->createAllocation(&allocation);
@@ -332,7 +332,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmS
TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap0ThenItHasGpuAddressWithinHeapInternalLimits) {
void *alignedPtr = (void *)0x12000;
size_t alignedSize = 0x2000;
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(alignedPtr, alignedSize, getGmmClientContext()));
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(alignedPtr, alignedSize, getGmmHelper()));
uint64_t gpuAddress = 0u;
auto heapBase = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Base;
auto heapLimit = wddm->getGfxPartition().Heap32[static_cast<uint32_t>(HeapIndex::HEAP_INTERNAL_DEVICE_MEMORY)].Limit;
@@ -399,7 +399,7 @@ TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocati
TEST_F(Wddm20Tests, WhenMappingAndFreeingGpuVaThenReturnIsCorrect) {
OsAgnosticMemoryManager mm(*executionEnvironment);
WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper());
allocation.setDefaultGmm(gmm);
auto status = wddm->createAllocation(&allocation);
@@ -425,7 +425,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
OsAgnosticMemoryManager mm(*executionEnvironment);
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext()));
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper()));
allocation.setDefaultGmm(gmm.get());
auto status = wddm->createAllocation(&allocation);
@@ -443,7 +443,7 @@ TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenCreateResourceFlagIsEnabled) {
init();
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u);
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmClientContext()));
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmHelper()));
allocation.setDefaultGmm(gmm.get());
auto status = wddm->createAllocation(&allocation);
EXPECT_EQ(STATUS_SUCCESS, status);
@@ -460,7 +460,7 @@ TEST_F(WddmTestWithMockGdiDll, givenShareableAllocationWhenCreateThenSharedHandl
};
MemoryManagerCreate<MockWddmMemoryManager> memoryManager(false, false, *executionEnvironment);
WddmAllocation allocation(0, AllocationType::UNKNOWN, nullptr, MemoryConstants::pageSize, nullptr, MemoryPool::MemoryNull, true, 1u);
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmClientContext()));
auto gmm = std::unique_ptr<Gmm>(GmmHelperFunctions::getGmm(nullptr, MemoryConstants::pageSize, getGmmHelper()));
allocation.setDefaultGmm(gmm.get());
auto status = memoryManager.createGpuAllocationsWithRetry(&allocation);
EXPECT_TRUE(status);
@@ -484,7 +484,7 @@ TEST(WddmAllocationTest, whenAllocationIsNotShareableThenItDoesntReturnSharedHan
TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) {
OsAgnosticMemoryManager mm(*executionEnvironment);
WddmAllocation allocation(0, AllocationType::UNKNOWN, mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmClientContext());
Gmm *gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), getGmmHelper());
allocation.setDefaultGmm(gmm);
auto status = wddm->createAllocation(&allocation);
@@ -517,7 +517,7 @@ TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) {
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
void *pSysMem = (void *)0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
EXPECT_EQ(0u, status);
@@ -554,7 +554,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
void *pSysMem = (void *)0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
EXPECT_EQ(0u, status);
@@ -744,7 +744,7 @@ TEST_F(Wddm20Tests, WhenMakingNonResidentThenEvictIsCalled) {
}
TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedToDestroyAllocation) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.getResidencyData().updateCompletionData(10, osContext->getContextId());
allocation.handle = ALLOCATION_HANDLE;
@@ -770,7 +770,7 @@ TEST_F(Wddm20Tests, givenDestroyAllocationWhenItIsCalledThenAllocationIsPassedTo
}
TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.getResidencyData().updateCompletionData(10, osContext->getContextId());
allocation.handle = ALLOCATION_HANDLE;
@@ -793,7 +793,7 @@ TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalle
}
TEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.getResidencyData().updateCompletionData(10, osContext->getContextId());
allocation.handle = ALLOCATION_HANDLE;
@@ -850,7 +850,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
gdi->createAllocation2 = FailingCreateAllocation::mockCreateAllocation2;
void *fakePtr = reinterpret_cast<void *>(0x123);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmHelper(), fakePtr, 100, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
allocation.setDefaultGmm(gmm.get());
@@ -877,7 +877,7 @@ TEST_F(Wddm20Tests, givenReadOnlyMemoryWhenCreateAllocationFailsWithNoVideoMemor
handleStorage.fragmentStorageData[0].freeTheFragment = false;
handleStorage.fragmentStorageData[0].osHandleStorage = &handle;
handleStorage.fragmentStorageData[0].residency = &residency;
handle.gmm = GmmHelperFunctions::getGmm(nullptr, 0, getGmmClientContext());
handle.gmm = GmmHelperFunctions::getGmm(nullptr, 0, getGmmHelper());
NTSTATUS result = wddm->createAllocationsAndMapGpuVa(handleStorage);
@@ -964,7 +964,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeReside
}
TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeResidentAndMakeResidentCallFailsThenEvictTemporaryResourcesAndRetry) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.handle = 0x3;
WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
mockWddm.makeResidentStatus = false;
@@ -976,7 +976,7 @@ TEST_F(WddmLockWithMakeResidentTests, givenAllocationWhenApplyBlockingMakeReside
}
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryResourcesAreEvictedSuccessfullyThenCallMakeResidentOneMoreTime) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.handle = 0x3;
WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
mockWddm.makeResidentStatus = false;
@@ -990,7 +990,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndTemporaryR
}
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentStillFailsThenDontStoreTemporaryResource) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.handle = 0x2;
WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
mockWddm.makeResidentStatus = false;
@@ -1005,7 +1005,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeReside
}
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesAfterEvictThenStoreTemporaryResource) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.handle = 0x2;
WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
mockWddm.makeResidentResults = {false, true};
@@ -1021,7 +1021,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeReside
}
TEST_F(WddmLockWithMakeResidentTests, whenApplyBlockingMakeResidentAndMakeResidentPassesThenStoreTemporaryResource) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.handle = 0x2;
WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
auto mockTemporaryResources = static_cast<MockWddmResidentAllocationsContainer *>(mockWddm.temporaryResources.get());
@@ -1045,7 +1045,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesThenAcqui
}
TEST_F(WddmLockWithMakeResidentTests, whenEvictingAllTemporaryResourcesAndAllEvictionsSucceedThenReturnSuccess) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
WddmMock mockWddm(*executionEnvironment->rootDeviceEnvironments[0]);
auto mockTemporaryResources = static_cast<MockWddmResidentAllocationsContainer *>(mockWddm.temporaryResources.get());
mockTemporaryResources->resourceHandles.push_back(allocation.handle);
@@ -1134,7 +1134,7 @@ TEST_F(WddmLockWithMakeResidentTests, whenEvictingTemporaryResourceThenOtherReso
TEST_F(WddmLockWithMakeResidentTests, whenAlllocationNeedsBlockingMakeResidentBeforeLockThenLockWithBlockingMakeResident) {
WddmMemoryManager memoryManager(*executionEnvironment);
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
allocation.needsMakeResidentBeforeLock = false;
memoryManager.lockResource(&allocation);
EXPECT_EQ(1u, wddm->lockResult.called);

View File

@@ -84,7 +84,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
uint64_t gpuPtr = 0u;
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
wddmWithKmDafMock->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, wddmWithKmDafMock->getGfxPartition().Standard.Base,
wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, gpuPtr);
@@ -110,7 +110,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDa
}
TEST_F(WddmKmDafListenerTest, givenWddmWhenMakeResidentIsCalledThenKmDafListenerNotifyMakeResidentIsFedWithCorrectParams) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
wddmWithKmDafMock->makeResident(&allocation.handle, 1, false, nullptr, 0x1000);
@@ -123,7 +123,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenMakeResidentIsCalledThenKmDafListener
}
TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyEvictIsFedWithCorrectParams) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
uint64_t sizeToTrim;
wddmWithKmDafMock->evict(&allocation.handle, 1, sizeToTrim);
@@ -137,7 +137,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
}
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto handle = 0u;
auto resourceHandle = 0u;
auto ptr = reinterpret_cast<void *>(0x10000);
@@ -152,7 +152,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
}
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto handle = 0u;
wddmWithKmDafMock->createAllocation(gmm.get(), handle);
@@ -167,7 +167,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafLi
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
OsHandleStorage storage;
OsHandleWin osHandle;
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
storage.fragmentStorageData[0].osHandleStorage = &osHandle;
storage.fragmentStorageData[0].fragmentSize = 100;
static_cast<OsHandleWin *>(storage.fragmentStorageData[0].osHandleStorage)->gmm = gmm.get();

View File

@@ -95,7 +95,7 @@ TEST(WddmMemoryManager, WhenWddmMemoryManagerIsCreatedThenItIsNonAssignable) {
TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) {
auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u));
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext());
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper());
MockOsContext osContext(1u, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular},
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo)));
allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u);
@@ -106,7 +106,7 @@ TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGetting
TEST(WddmAllocationTest, givenAllocationCreatedWithOsContextCountOneWhenItIsCreatedThenMaxOsContextCountIsUsedInstead) {
auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u));
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext());
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper());
allocation.setTrimCandidateListPosition(1u, 700u);
EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u));
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u));
@@ -115,7 +115,7 @@ TEST(WddmAllocationTest, givenAllocationCreatedWithOsContextCountOneWhenItIsCrea
TEST(WddmAllocationTest, givenRequestedContextIdTooLargeWhenGettingTrimCandidateListPositionThenReturnUnusedPosition) {
auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u));
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext());
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper());
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1u));
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(1000u));
}
@@ -302,7 +302,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
auto osHandle = 1u;
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
D3DDDI_OPENALLOCATIONINFO allocationInfo;
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@@ -322,7 +322,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
auto osHandle = 1u;
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
D3DDDI_OPENALLOCATIONINFO allocationInfo;
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@@ -348,7 +348,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
auto osHandle = 1u;
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, StorageInfo{}, true);
D3DDDI_OPENALLOCATIONINFO allocationInfo;
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@@ -556,7 +556,7 @@ TEST_F(WddmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationT
size_t size = 0x1000;
uint64_t gpuPtr = 0x123;
MockWddmAllocation gfxAllocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation gfxAllocation(rootDeviceEnvironment->getGmmHelper());
HostPtrEntryKey key{cpuPtr, gfxAllocation.getRootDeviceIndex()};
gfxAllocation.cpuPtr = cpuPtr;
gfxAllocation.size = size;
@@ -623,7 +623,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
auto osHandle = 1u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield);
@@ -639,7 +639,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestroyedThenDestroyAllocationFromGdiIsNotInvoked) {
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
D3DDDI_OPENALLOCATIONINFO allocationInfo;
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
@@ -666,7 +666,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestr
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1), 0, AllocationType::SHARED_IMAGE);
@@ -698,7 +698,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness
auto osHandle = 1u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
memoryManager->setForce32BitAllocations(true);
@@ -721,7 +721,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndNotRequiredSpecificBit
auto osHandle = 1u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
memoryManager->setForce32BitAllocations(true);
@@ -743,7 +743,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
auto osHandle = 1u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0);
@@ -765,7 +765,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
AllocationProperties properties(0, false, size, AllocationType::SHARED_BUFFER, false, false, 0);
@@ -871,7 +871,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
wddm->failOpenSharedHandle = true;
@@ -1018,7 +1018,7 @@ TEST_F(WddmMemoryManagerTest, GivenOffsetsWhenAllocatingGpuMemHostThenAllocatedO
if (memoryManager->isLimitedGPU(0)) {
GTEST_SKIP();
}
MockWddmAllocation alloc(rootDeviceEnvironment->getGmmClientContext()), allocOffseted(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation alloc(rootDeviceEnvironment->getGmmHelper()), allocOffseted(rootDeviceEnvironment->getGmmHelper());
// three pages
void *ptr = alignedMalloc(4 * 4096, 4096);
ASSERT_NE(nullptr, ptr);
@@ -1074,7 +1074,7 @@ TEST_F(WddmMemoryManagerTest, WhenAllocatingGpuMemThenOsInternalStorageIsPopulat
if (memoryManager->isLimitedGPU(0)) {
GTEST_SKIP();
}
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
// three pages
void *ptr = alignedMalloc(3 * 4096, 4096);
auto *gpuAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, false, 3 * MemoryConstants::pageSize}, ptr);
@@ -1092,7 +1092,7 @@ TEST_F(WddmMemoryManagerTest, WhenAllocatingGpuMemThenOsInternalStorageIsPopulat
}
TEST_F(WddmMemoryManagerTest, GivenAlignedPointerWhenAllocate32BitMemoryThenGmmCalledWithCorrectPointerAndSize) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
uint32_t size = 4096;
void *ptr = reinterpret_cast<void *>(4096);
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, size, ptr, AllocationType::BUFFER);
@@ -1102,7 +1102,7 @@ TEST_F(WddmMemoryManagerTest, GivenAlignedPointerWhenAllocate32BitMemoryThenGmmC
}
TEST_F(WddmMemoryManagerTest, GivenUnAlignedPointerAndSizeWhenAllocate32BitMemoryThenGmmCalledWithCorrectPointerAndSize) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
uint32_t size = 0x1001;
void *ptr = reinterpret_cast<void *>(0x1001);
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(rootDeviceIndex, size, ptr, AllocationType::BUFFER);
@@ -1200,7 +1200,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
osHandle0->handle = ALLOCATION_HANDLE;
storage.fragmentStorageData[0].freeTheFragment = true;
osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
storage.fragmentStorageData[1].osHandleStorage = osHandle1;
osHandle1->handle = ALLOCATION_HANDLE;
@@ -1211,7 +1211,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
storage.fragmentStorageData[2].osHandleStorage = osHandle2;
osHandle2->handle = ALLOCATION_HANDLE;
storage.fragmentStorageData[2].freeTheFragment = true;
osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), pSysMem, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
storage.fragmentStorageData[2].residency = new ResidencyData(maxOsContextCount);
memoryManager->cleanOsHandles(storage, 0);
@@ -1259,7 +1259,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCpuMemNotMeetRestriction
TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuVaFailThenFailToCreateAllocation) {
void *ptr = reinterpret_cast<void *>(0x1000);
size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
memoryManager->setDeferredDeleter(nullptr);
setMapGpuVaFailConfigFcn(0, 1);
@@ -1273,7 +1273,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) {
void *ptr = reinterpret_cast<void *>(0x10000);
size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
MockDeferredDeleter *deleter = new MockDeferredDeleter;
memoryManager->setDeferredDeleter(deleter);
@@ -1289,7 +1289,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) {
void *ptr = reinterpret_cast<void *>(0x1000);
size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
MockDeferredDeleter *deleter = new MockDeferredDeleter;
memoryManager->setDeferredDeleter(deleter);
@@ -1459,7 +1459,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount);
handleStorage.fragmentStorageData[0].freeTheFragment = true;
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
handleStorage.fragmentCount = 1;
FragmentStorage fragment = {};
@@ -1497,7 +1497,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount);
handleStorage.fragmentStorageData[0].freeTheFragment = true;
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), ptr, size, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
handleStorage.fragmentCount = 1;
FragmentStorage fragment = {};
@@ -1929,7 +1929,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag
GTEST_SKIP();
}
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = true;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
@@ -1961,7 +1961,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag
GTEST_SKIP();
}
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = true;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
@@ -2062,7 +2062,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenReleaseingThen
TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = false;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm(*rootDeviceEnvironment);
@@ -2088,7 +2088,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThe
TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
gmm->isCompressionEnabled = false;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm(*rootDeviceEnvironment);
@@ -2117,7 +2117,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsUnsetThenD
engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
}
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
myGmm->isCompressionEnabled = false;
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
@@ -2154,7 +2154,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsSetThenUpd
engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
}
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmHelper(), reinterpret_cast<void *>(123), 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
myGmm->isCompressionEnabled = true;
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
@@ -2274,7 +2274,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingAllocationWithReservedGpuVirtu
}
TEST_F(WddmMemoryManagerSimpleTest, givenAllocationWithReservedGpuVirtualAddressWhenMapCallFailsDuringCreateWddmAllocationThenReleasePreferredAddress) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), 1);
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), 1);
allocation.setAllocationType(AllocationType::KERNEL_ISA);
uint64_t gpuAddress = 0x123;
uint64_t sizeForFree = 0x1234;
@@ -2296,7 +2296,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationAndPreferredGpuVaI
}
uint32_t numGmms = 10;
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), numGmms);
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), numGmms);
allocation.setAllocationType(AllocationType::BUFFER);
allocation.storageInfo.multiStorage = true;
@@ -2600,7 +2600,7 @@ TEST(WddmMemoryManagerCopyMemoryToAllocationBanksTest, givenAllocationWithMultiT
wddm->init();
MemoryManagerCreate<WddmMemoryManager> memoryManager(true, true, executionEnvironment);
MockWddmAllocation mockAllocation(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext());
MockWddmAllocation mockAllocation(executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
mockAllocation.storageInfo.memoryBanks = 0b1111;
DeviceBitfield memoryBanksToCopy = 0b1010;
@@ -2634,7 +2634,7 @@ class WddmMemoryManagerMock : public MockWddmMemoryManagerFixture, public ::test
};
TEST_F(WddmMemoryManagerMock, givenAllocationWithReservedGpuVirtualAddressWhenMapCallFailsDuringCreateWddmAllocationThenReleasePreferredAddress) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext(), 4);
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), 4);
allocation.setAllocationType(AllocationType::KERNEL_ISA);
uint64_t gpuAddress = 0x123;
uint64_t sizeForFree = 0x1234;

View File

@@ -137,7 +137,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT
osContext->incRefInternal();
residencyController = &static_cast<OsContextWin *>(osContext)->getResidencyController();
gmmClientContext = executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext();
gmmHelper = executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper();
}
void TearDown() {
@@ -150,7 +150,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT
WddmMock *wddm = nullptr;
OsContext *osContext;
WddmResidencyController *residencyController;
GmmClientContext *gmmClientContext = nullptr;
GmmHelper *gmmHelper = nullptr;
};
struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
@@ -176,7 +176,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
osContext->incRefInternal();
residencyController = &static_cast<OsContextWin *>(osContext)->getResidencyController();
gmmClientContext = executionEnvironment->rootDeviceEnvironments[0]->getGmmClientContext();
gmmHelper = executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper();
}
void TearDown() {
@@ -191,7 +191,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
OsContext *osContext = nullptr;
MockGdi *gdi = nullptr;
WddmResidencyController *residencyController = nullptr;
GmmClientContext *gmmClientContext = nullptr;
GmmHelper *gmmHelper = nullptr;
};
TEST(WddmResidencyController, givenWddmResidencyControllerWhenItIsConstructedThenDoNotRegisterTrimCallback) {
@@ -271,7 +271,7 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenWddmResidencyControllerWhenItIsD
}
TEST_F(WddmResidencyControllerTest, givenUsedAllocationWhenCallingRemoveFromTrimCandidateListIfUsedThenRemoveIt) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation);
residencyController->removeFromTrimCandidateListIfUsed(&allocation, false);
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContextId));
@@ -284,13 +284,13 @@ TEST_F(WddmResidencyControllerTest, givenWddmResidencyControllerWhenIsMemoryExha
}
TEST_F(WddmResidencyControllerTest, givenUnusedAllocationWhenCallingRemoveFromTrimCandidateListIfUsedThenIgnore) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
residencyController->removeFromTrimCandidateListIfUsed(&allocation, false);
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(osContextId));
}
TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenAllocationIsPlacedInContainerAndAssignedPosition) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation);
EXPECT_NE(0u, residencyController->trimCandidateList.size());
@@ -303,7 +303,7 @@ TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenAllocationI
}
TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenDoNotInsertAllocationAlreadyOnTheList) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
residencyController->trimCandidateList.resize(0);
@@ -324,7 +324,7 @@ TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenDoNotInsert
}
TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenUnusedPositionIsAssigned) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation);
residencyController->removeFromTrimCandidateList(&allocation, false);
@@ -333,7 +333,7 @@ TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenUnusedP
}
TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenAllocationInAssignedPositionIsRemoved) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation);
size_t position = allocation.getTrimCandidateListPosition(osContextId);
@@ -346,7 +346,7 @@ TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenAllocat
}
TEST_F(WddmResidencyControllerTest, GivenOneAllocationWhenRemovingFromTrimCandidateListThenTrimCandidateListIsEmpty) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper());
residencyController->trimCandidateList.resize(0);
@@ -358,8 +358,8 @@ TEST_F(WddmResidencyControllerTest, GivenOneAllocationWhenRemovingFromTrimCandid
}
TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenLastAllocationAndAllPreviousEmptyEntriesAreRemoved) {
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
residencyController->trimCandidateList.resize(0);
@@ -379,9 +379,9 @@ TEST_F(WddmResidencyControllerTest, WhenRemovingFromTrimCandidateListThenLastAll
}
TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenSuccessivePositionIsAssigned) {
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation1);
residencyController->addToTrimCandidateList(&allocation2);
@@ -393,9 +393,9 @@ TEST_F(WddmResidencyControllerTest, WhenAddingToTrimCandidateListThenSuccessiveP
}
TEST_F(WddmResidencyControllerTest, GivenAllocationThatIsNotLastWhenRemovingFromTrimCandidateListAndCompactingThenRemoveEntry) {
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation1);
residencyController->addToTrimCandidateList(&allocation2);
@@ -411,9 +411,9 @@ TEST_F(WddmResidencyControllerTest, GivenAllocationThatIsNotLastWhenRemovingFrom
}
TEST_F(WddmResidencyControllerTest, GivenAllocationThatIsNotLastWhenRemovingFromTrimCandidateListThenReplaceWithNullEntry) {
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation1);
residencyController->addToTrimCandidateList(&allocation2);
@@ -429,10 +429,10 @@ TEST_F(WddmResidencyControllerTest, GivenAllocationThatIsNotLastWhenRemovingFrom
}
TEST_F(WddmResidencyControllerTest, WhenCompactingTrimCandidateListThenInitialNullEntriesAreRemovedAndPositionsAreUpdated) {
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation4(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation4(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation1);
residencyController->addToTrimCandidateList(&allocation2);
@@ -459,10 +459,10 @@ TEST_F(WddmResidencyControllerTest, WhenCompactingTrimCandidateListThenInitialNu
}
TEST_F(WddmResidencyControllerTest, WhenCompactingTrimCandidateListThenNonNullEntriesAreNotRemoved) {
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation4(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation4(rootDeviceEnvironment->getGmmHelper());
residencyController->addToTrimCandidateList(&allocation1);
residencyController->addToTrimCandidateList(&allocation2);
@@ -501,8 +501,8 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenNotUsedAllocationsFromPreviousPe
trimNotification.NumBytesToTrim = 0;
// allocations have fence value == 0 by default
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
allocation1.getResidencyData().updateCompletionData(0, osContextId);
allocation2.getResidencyData().updateCompletionData(0, osContextId);
@@ -537,8 +537,8 @@ TEST_F(WddmResidencyControllerWithGdiTest, givenOneUsedAllocationFromPreviousPer
trimNotification.NumBytesToTrim = 0;
// allocations have fence value == 0 by default
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
allocation1.getResidencyData().resident[osContextId] = true;
// mark allocation used from last periodic trim
allocation1.getResidencyData().updateCompletionData(0, osContextId);
@@ -654,9 +654,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, GivenZeroWhenTrimmingToBudgetThenTrue
TEST_F(WddmResidencyControllerWithGdiTest, WhenTrimmingToBudgetThenAllDoneAllocationsAreTrimmed) {
gdi->setNonZeroNumBytesToTrimInEvict();
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper());
allocation1.getResidencyData().resident[osContextId] = true;
allocation1.getResidencyData().updateCompletionData(0, osContextId);
@@ -693,7 +693,7 @@ TEST_F(WddmResidencyControllerWithGdiTest, WhenTrimmingToBudgetThenAllDoneAlloca
TEST_F(WddmResidencyControllerWithGdiTest, GivenNumBytesToTrimIsNotZeroWhenTrimmingToBudgetThenFalseIsReturned) {
gdi->setNonZeroNumBytesToTrimInEvict();
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
allocation1.getResidencyData().resident[osContextId] = true;
allocation1.getResidencyData().updateCompletionData(0, osContextId);
@@ -751,9 +751,9 @@ TEST_F(WddmResidencyControllerWithGdiTest, GivenNumBytesToTrimIsZeroWhenTrimming
TEST_F(WddmResidencyControllerWithGdiTest, WhenTrimmingToBudgetThenEvictedAllocationIsMarkedNonResident) {
gdi->setNonZeroNumBytesToTrimInEvict();
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation2(rootDeviceEnvironment->getGmmHelper());
MockWddmAllocation allocation3(rootDeviceEnvironment->getGmmHelper());
allocation1.getResidencyData().resident[osContextId] = true;
allocation1.getResidencyData().updateCompletionData(0, osContextId);
@@ -784,7 +784,7 @@ TEST_F(WddmResidencyControllerWithGdiTest, WhenTrimmingToBudgetThenEvictedAlloca
TEST_F(WddmResidencyControllerWithGdiTest, GivenLastFenceIsGreaterThanMonitoredWhenTrimmingToBudgetThenWaitForCpu) {
gdi->setNonZeroNumBytesToTrimInEvict();
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmClientContext());
MockWddmAllocation allocation1(rootDeviceEnvironment->getGmmHelper());
allocation1.getResidencyData().resident[osContextId] = true;
allocation1.getResidencyData().updateCompletionData(2, osContextId);
@@ -935,10 +935,10 @@ TEST_F(WddmResidencyControllerLockTest, givenPeriodicTrimAndTrimToBudgetWhenTrim
}
TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, WhenMakingResidentResidencyAllocationsThenAllAllocationsAreMarked) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation2(gmmClientContext);
MockWddmAllocation allocation3(gmmClientContext);
MockWddmAllocation allocation4(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);
MockWddmAllocation allocation3(gmmHelper);
MockWddmAllocation allocation4(gmmHelper);
ResidencyContainer residencyPack{&allocation1, &allocation2, &allocation3, &allocation4};
residencyController->makeResidentResidencyAllocations(residencyPack);
@@ -950,10 +950,10 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, WhenMakingResidentRes
}
TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, WhenMakingResidentResidencyAllocationsThenLastFenceIsUpdated) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation2(gmmClientContext);
MockWddmAllocation allocation3(gmmClientContext);
MockWddmAllocation allocation4(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);
MockWddmAllocation allocation3(gmmHelper);
MockWddmAllocation allocation4(gmmHelper);
ResidencyContainer residencyPack{&allocation1, &allocation2, &allocation3, &allocation4};
residencyController->getMonitoredFence().currentFenceValue = 20;
@@ -970,8 +970,8 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, GivenTripleAllocation
if (executionEnvironment->memoryManager.get()->isLimitedGPU(0)) {
GTEST_SKIP();
}
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation2(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1500);
wddm->callBaseMakeResident = true;
@@ -990,8 +990,8 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, GivenTripleAllocation
}
TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, GivenTripleAllocationsWhenMakingResidentResidencyAllocationsThenLastFencePlusOneIsSet) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation2(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);
WddmAllocation *allocationTriple = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, 2 * MemoryConstants::pageSize}, reinterpret_cast<void *>(0x1500)));
@@ -1008,10 +1008,10 @@ TEST_F(WddmResidencyControllerWithGdiAndMemoryManagerTest, GivenTripleAllocation
}
TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenDontMarkAllocationsAsResident) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation2(gmmClientContext);
MockWddmAllocation allocation3(gmmClientContext);
MockWddmAllocation allocation4(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);
MockWddmAllocation allocation3(gmmHelper);
MockWddmAllocation allocation4(gmmHelper);
wddm->makeResidentNumberOfBytesToTrim = 4 * 4096;
wddm->makeResidentStatus = false;
@@ -1029,8 +1029,8 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallin
}
TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenDontMarkTripleAllocationsAsResident) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation2(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);
wddm->callBaseCreateAllocationsAndMapGpuVa = true;
void *ptr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1500);
WddmAllocation *allocationTriple = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, 2 * MemoryConstants::pageSize}, ptr));
@@ -1053,7 +1053,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallin
}
TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenCallItAgainWithCantTrimFurtherSetToTrue) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
wddm->makeResidentNumberOfBytesToTrim = 4 * 4096;
wddm->makeResidentStatus = false;
@@ -1067,8 +1067,8 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallin
}
TEST_F(WddmResidencyControllerWithMockWddmTest, givenAllocationPackPassedWhenCallingMakeResidentResidencyAllocationsThenItIsUsed) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation2(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
MockWddmAllocation allocation2(gmmHelper);
allocation1.handle = 1;
allocation2.handle = 2;
ResidencyContainer residencyPack{&allocation1, &allocation2};
@@ -1083,7 +1083,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenAllocationPackPassedWhenCal
}
TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToBudgetSuceedsWhenCallingMakeResidentResidencyAllocationsThenSucceed) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
void *cpuPtr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1000);
size_t allocationSize = 0x1000;
WddmAllocation allocationToTrim(0, AllocationType::UNKNOWN, cpuPtr, allocationSize, nullptr, MemoryPool::MemoryNull, 0u, 1u);
@@ -1105,7 +1105,7 @@ TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsAndTrimToB
}
TEST_F(WddmResidencyControllerWithMockWddmTest, givenMakeResidentFailsWhenCallingMakeResidentResidencyAllocationsThenMemoryBudgetExhaustedIsSetToTrue) {
MockWddmAllocation allocation1(gmmClientContext);
MockWddmAllocation allocation1(gmmHelper);
ResidencyContainer residencyPack{&allocation1};
wddm->makeResidentResults = {false, true};

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -28,8 +28,8 @@ struct WddmMemoryOperationsHandlerTest : public WddmTest {
void SetUp() override {
WddmTest::SetUp();
wddmMemoryOperationsHandler = std::make_unique<WddmMemoryOperationsHandler>(wddm);
wddmAllocation = std::make_unique<MockWddmAllocation>(rootDeviceEnvironment->getGmmClientContext());
wddmFragmentedAllocation = std::make_unique<MockWddmAllocation>(rootDeviceEnvironment->getGmmClientContext());
wddmAllocation = std::make_unique<MockWddmAllocation>(rootDeviceEnvironment->getGmmHelper());
wddmFragmentedAllocation = std::make_unique<MockWddmAllocation>(rootDeviceEnvironment->getGmmHelper());
wddmAllocation->handle = 0x2u;
osHandleStorageFirst = std::make_unique<OsHandleWin>();

View File

@@ -58,7 +58,7 @@ class CreateFromGlTexture : public ::testing::Test {
void updateImgInfoAndForceGmm() {
imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
gmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmClientContext(), imgInfo, false);
gmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmHelper(), imgInfo, false);
tempMM.forceAllocationSize = imgInfo.size;
tempMM.forceGmm = gmm.get();
@@ -70,7 +70,7 @@ class CreateFromGlTexture : public ::testing::Test {
mcsImgDesc.imageWidth = 128;
mcsImgDesc.imageType = ImageType::Image2D;
auto mcsImgInfo = MockGmm::initImgInfo(mcsImgDesc, 0, nullptr);
mcsGmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmClientContext(), mcsImgInfo, false);
mcsGmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmHelper(), mcsImgInfo, false);
tempMM.forceMcsGmm = mcsGmm.get();
}
}

View File

@@ -87,7 +87,7 @@ TEST_F(GlReusedBufferTests, givenMultipleBuffersWithReusedAllocationWhenReleasin
TEST_F(GlReusedBufferTests, givenMultipleBuffersWithReusedAllocationWhenCreatingThenReuseGmmResourceToo) {
std::unique_ptr<Buffer> glBuffer1(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal));
glBuffer1->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), (void *)0x100, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
glBuffer1->getGraphicsAllocation(rootDeviceIndex)->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmHelper(), (void *)0x100, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
std::unique_ptr<Buffer> glBuffer2(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal));

View File

@@ -256,7 +256,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredTwiceThenAcuqireIsNotCalle
TEST_F(glSharingTests, givenClGLBufferWhenItIsCreatedAndGmmIsAvailableThenItIsUsedInGraphicsAllocation) {
void *ptr = (void *)0x1000;
auto rootDeviceIndex = context.getDevice(0)->getRootDeviceIndex();
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), ptr, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), ptr, 4096u, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
mockGlSharing->m_bufferInfoOutput.pGmmResInfo = gmm->gmmResourceInfo->peekGmmResourceInfo();
mockGlSharing->uploadDataToBufferInfo();
@@ -902,7 +902,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledThenCopyOnGpu
auto gfxAllocation = buffer->getGraphicsAllocation(rootDeviceIndex);
auto pClDevice = context.getDevice(0);
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pClDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pClDevice->getGmmHelper()), handleId);
}
auto commandQueue = CommandQueue::create(&context, pClDevice, 0, false, retVal);
@@ -946,7 +946,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenMapAndUnmapBufferIsCalledTwiceThenReus
auto gfxAllocation = buffer->getGraphicsAllocation(rootDeviceIndex);
auto pClDevice = context.getDevice(0);
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
gfxAllocation->setGmm(new MockGmm(pClDevice->getGmmClientContext()), handleId);
gfxAllocation->setGmm(new MockGmm(pClDevice->getGmmHelper()), handleId);
}
auto commandQueue = CommandQueue::create(&context, pClDevice, 0, false, retVal);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -67,7 +67,7 @@ class GlSharingTextureTests : public ::testing::Test {
mockGlSharingFunctions = glSharing->sharingFunctions.release();
clContext->setSharingFunctions(mockGlSharingFunctions);
tempMM->forceGmm = MockGmm::queryImgParams(device->getGmmClientContext(), imgInfo, false);
tempMM->forceGmm = MockGmm::queryImgParams(device->getGmmHelper(), imgInfo, false);
tempMM->forceAllocationSize = textureSize;
textureSize = imgInfo.size;
textureId = 1;

View File

@@ -68,7 +68,7 @@ struct UnifiedSharingMockMemoryManager : MockMemoryManager {
rootDeviceIndex, false, false, false);
graphicsAllocation->setSharedHandle(static_cast<osHandle>(reinterpret_cast<uint64_t>(handle)));
graphicsAllocation->set32BitAllocation(false);
graphicsAllocation->setDefaultGmm(new MockGmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmClientContext()));
graphicsAllocation->setDefaultGmm(new MockGmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper()));
return graphicsAllocation;
}
};

View File

@@ -565,7 +565,7 @@ XE_HP_CORE_TEST_F(BlitXE_HP_CORETests, givenDebugFlagSetWhenCompressionIsUsedThe
blitCmd.setDestinationX2CoordinateRight(1);
blitCmd.setDestinationY2CoordinateBottom(1);
auto gmm = std::make_unique<MockGmm>(clDevice->getGmmClientContext());
auto gmm = std::make_unique<MockGmm>(clDevice->getGmmHelper());
gmm->isCompressionEnabled = true;
MockGraphicsAllocation mockAllocation(0, AllocationType::INTERNAL_HOST_MEMORY, reinterpret_cast<void *>(0x1234),
0x1000, 0, sizeof(uint32_t), MemoryPool::System4KBPages, MemoryManager::maxOsContextCount);

View File

@@ -167,7 +167,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true;
auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@@ -241,7 +241,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true;
auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@@ -284,7 +284,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = false;
auto buffer = castToObject<Buffer>(imageDesc.mem_object);
@@ -327,7 +327,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenDecompressInL3ForImage2dFr
imageDesc.mem_object = clCreateBuffer(&context, CL_MEM_READ_WRITE, imageDesc.image_height * imageDesc.image_width, nullptr, &retVal);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper()->getClientContext(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
auto gmm = new Gmm(context.getDevice(0)->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true);
gmm->isCompressionEnabled = true;
gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;