Adjust gmmHelper decanonize method accessing point in getDumpSurfaceInfo

Accessing decanonize method as a member of GmmHelper class object

Related-To: NEO-6523
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2022-05-12 10:40:45 +00:00
committed by Compute-Runtime-Automation
parent e722afbefb
commit 170d628f57
4 changed files with 27 additions and 4 deletions

View File

@ -402,7 +402,7 @@ struct AubSurfaceDumpTests : public AubAllocDumpTests,
AubAllocDumpTests::TearDown();
}
bool isCompressed = false;
bool isCompressed = true;
AubAllocDump::DumpFormat dumpFormat = AubAllocDump::DumpFormat::NONE;
};
@ -413,6 +413,8 @@ HWTEST_P(AubSurfaceDumpTests, givenGraphicsAllocationWhenGetDumpSurfaceIsCalledA
if (AubAllocDump::isBufferDumpFormat(dumpFormat)) {
auto bufferAllocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
bufferAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
ASSERT_NE(nullptr, bufferAllocation);
MockBuffer::setAllocationType(bufferAllocation, gmmHelper, isCompressed);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 Intel Corporation
* Copyright (C) 2019-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -43,10 +43,12 @@ SurfaceInfo *getDumpSurfaceInfo(GraphicsAllocation &gfxAllocation, DumpFormat du
SurfaceInfo *surfaceInfo = nullptr;
if (isBufferDumpFormat(dumpFormat)) {
auto gmmHelper = gfxAllocation.getDefaultGmm()->getGmmHelper();
using RENDER_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE;
using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT;
surfaceInfo = new SurfaceInfo();
surfaceInfo->address = GmmHelper::decanonize(gfxAllocation.getGpuAddress());
surfaceInfo->address = gmmHelper->decanonize(gfxAllocation.getGpuAddress());
surfaceInfo->width = static_cast<uint32_t>(gfxAllocation.getUnderlyingBufferSize());
surfaceInfo->height = 1;
surfaceInfo->pitch = static_cast<uint32_t>(gfxAllocation.getUnderlyingBufferSize());
@ -57,11 +59,13 @@ SurfaceInfo *getDumpSurfaceInfo(GraphicsAllocation &gfxAllocation, DumpFormat du
surfaceInfo->dumpType = (AubAllocDump::DumpFormat::BUFFER_TRE == dumpFormat) ? dumpType::tre : dumpType::bin;
} else if (isImageDumpFormat(dumpFormat)) {
auto gmm = gfxAllocation.getDefaultGmm();
auto gmmHelper = gmm->getGmmHelper();
if (gmm->gmmResourceInfo->getNumSamples() > 1) {
return nullptr;
}
surfaceInfo = new SurfaceInfo();
surfaceInfo->address = GmmHelper::decanonize(gfxAllocation.getGpuAddress());
surfaceInfo->address = gmmHelper->decanonize(gfxAllocation.getGpuAddress());
surfaceInfo->width = static_cast<uint32_t>(gmm->gmmResourceInfo->getBaseWidth());
surfaceInfo->height = static_cast<uint32_t>(gmm->gmmResourceInfo->getBaseHeight());
surfaceInfo->pitch = static_cast<uint32_t>(gmm->gmmResourceInfo->getRenderPitch());

View File

@ -273,7 +273,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
aubCsr.dumpAllocation(*gfxAllocation);
@ -327,6 +330,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenCompressedGraphicsAllocationWritabl
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
aubCsr.dumpAllocation(*gfxAllocation);
@ -421,6 +426,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
auto &csrOsContext = aubCsr.getOsContext();
@ -490,6 +496,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenDumpAllocatio
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setAllocDumpable(false, false);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
aubCsr.dumpAllocation(*gfxAllocation);
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
@ -516,7 +523,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
aubCsr.dumpAllocation(*gfxAllocation);
@ -548,6 +558,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenUsmAllocationWhenDumpAllocationIsCa
ASSERT_NE(nullptr, ptr);
auto gfxAllocation = svmManager->getSVMAlloc(ptr)->gpuAllocations.getGraphicsAllocation(0);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
ASSERT_NE(nullptr, gfxAllocation);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));

View File

@ -933,7 +933,10 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWritableWhenDumpAllocatio
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), MemoryConstants::pageSize, AllocationType::BUFFER, pDevice->getDeviceBitfield()});
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
tbxCsr.dumpAllocation(*gfxAllocation);
@ -958,6 +961,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setAllocDumpable(false, false);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
tbxCsr.dumpAllocation(*gfxAllocation);
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);
@ -1030,6 +1034,7 @@ HWTEST_F(TbxCommandStreamTests, givenGraphicsAllocationWhenDumpAllocationIsCalle
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
gfxAllocation->setAllocDumpable(false, false);
gfxAllocation->setDefaultGmm(new Gmm(pDevice->executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, false, {}, true));
tbxCsr.dumpAllocation(*gfxAllocation);
EXPECT_FALSE(mockHardwareContext->dumpSurfaceCalled);