mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 01:48:50 +08:00
Access GmmHelper and GmmClientContext via RootDeviceEnvironment
Related-To: NEO-3857 Change-Id: Ie9d719c9884fd89580ce3592a0d4d4cd42862f47 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
4a41c9741c
commit
74072d4916
@@ -104,6 +104,7 @@ EngineControl &ClDevice::getDefaultEngine() { return device.getDefaultEngine();
|
||||
EngineControl &ClDevice::getInternalEngine() { return device.getInternalEngine(); }
|
||||
MemoryManager *ClDevice::getMemoryManager() const { return device.getMemoryManager(); }
|
||||
GmmHelper *ClDevice::getGmmHelper() const { return device.getGmmHelper(); }
|
||||
GmmClientContext *ClDevice::getGmmClientContext() const { return device.getGmmClientContext(); }
|
||||
double ClDevice::getProfilingTimerResolution() { return device.getProfilingTimerResolution(); }
|
||||
double ClDevice::getPlatformHostTimerResolution() const { return device.getPlatformHostTimerResolution(); }
|
||||
bool ClDevice::isSimulation() const { return device.isSimulation(); }
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace NEO {
|
||||
class Device;
|
||||
class ExecutionEnvironment;
|
||||
class GmmHelper;
|
||||
class GmmClientContext;
|
||||
class MemoryManager;
|
||||
class PerformanceCounters;
|
||||
class SourceLevelDebugger;
|
||||
@@ -62,6 +63,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
|
||||
EngineControl &getInternalEngine();
|
||||
MemoryManager *getMemoryManager() const;
|
||||
GmmHelper *getGmmHelper() const;
|
||||
GmmClientContext *getGmmClientContext() const;
|
||||
double getProfilingTimerResolution();
|
||||
double getPlatformHostTimerResolution() const;
|
||||
bool isSimulation() const;
|
||||
|
||||
@@ -586,6 +586,7 @@ Buffer *Buffer::createBufferHwFromDevice(const Device *device,
|
||||
zeroCopy, isHostPtrSVM, isImageRedescribed);
|
||||
pBuffer->offset = offset;
|
||||
pBuffer->executionEnvironment = device->getExecutionEnvironment();
|
||||
pBuffer->rootDeviceEnvironment = pBuffer->executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()].get();
|
||||
return pBuffer;
|
||||
}
|
||||
|
||||
@@ -605,7 +606,7 @@ uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument) cons
|
||||
bool alignedMemObj = isAligned<MemoryConstants::cacheLineSize>(bufferAddress) &&
|
||||
isAligned<MemoryConstants::cacheLineSize>(bufferSize);
|
||||
|
||||
auto gmmHelper = executionEnvironment->getGmmHelper();
|
||||
auto gmmHelper = rootDeviceEnvironment->getGmmHelper();
|
||||
if (!disableL3Cache && !isMemObjUncacheableForSurfaceState() && (alignedMemObj || readOnlyMemObj || !isMemObjZeroCopy())) {
|
||||
return gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||
} else {
|
||||
|
||||
@@ -130,7 +130,7 @@ Image *Image::create(Context *context,
|
||||
Image *parentImage = castToObject<Image>(imageDesc->mem_object);
|
||||
auto &hwHelper = HwHelper::get(context->getDevice(0)->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
|
||||
auto clientContext = context->getDevice(0)->getExecutionEnvironment()->getGmmClientContext();
|
||||
auto clientContext = context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext();
|
||||
|
||||
do {
|
||||
size_t imageWidth = imageDesc->image_width;
|
||||
@@ -675,7 +675,7 @@ cl_int Image::getImageParams(Context *context,
|
||||
size_t *imageRowPitch,
|
||||
size_t *imageSlicePitch) {
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto clientContext = context->getDevice(0)->getExecutionEnvironment()->getGmmClientContext();
|
||||
auto clientContext = context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext();
|
||||
|
||||
ImageInfo imgInfo = {};
|
||||
cl_image_desc imageDescriptor = *imageDesc;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/gmm_helper/resource_info.h"
|
||||
@@ -34,7 +34,7 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
|
||||
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(memory);
|
||||
|
||||
auto gmm = getGraphicsAllocation()->getDefaultGmm();
|
||||
auto gmmHelper = executionEnvironment->getGmmHelper();
|
||||
auto gmmHelper = rootDeviceEnvironment->getGmmHelper();
|
||||
|
||||
auto imageDescriptor = Image::convertDescriptor(getImageDesc());
|
||||
ImageInfo imgInfo;
|
||||
@@ -133,7 +133,7 @@ void ImageHw<GfxFamily>::setMediaImageArg(void *memory) {
|
||||
using SURFACE_FORMAT = typename MEDIA_SURFACE_STATE::SURFACE_FORMAT;
|
||||
SURFACE_FORMAT surfaceFormat = MEDIA_SURFACE_STATE::SURFACE_FORMAT_Y8_UNORM_VA;
|
||||
|
||||
auto gmmHelper = executionEnvironment->getGmmHelper();
|
||||
auto gmmHelper = rootDeviceEnvironment->getGmmHelper();
|
||||
auto surfaceState = reinterpret_cast<MEDIA_SURFACE_STATE *>(memory);
|
||||
*surfaceState = GfxFamily::cmdInitMediaSurfaceState;
|
||||
|
||||
|
||||
@@ -47,7 +47,9 @@ MemObj::MemObj(Context *context,
|
||||
if (context) {
|
||||
context->incRefInternal();
|
||||
memoryManager = context->getMemoryManager();
|
||||
executionEnvironment = context->getDevice(0)->getExecutionEnvironment();
|
||||
auto device = context->getDevice(0);
|
||||
executionEnvironment = device->getExecutionEnvironment();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()].get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
namespace NEO {
|
||||
class ExecutionEnvironment;
|
||||
struct RootDeviceEnvironment;
|
||||
class GraphicsAllocation;
|
||||
struct KernelInfo;
|
||||
class MemoryManager;
|
||||
@@ -145,6 +146,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
MemObj *associatedMemObject = nullptr;
|
||||
cl_uint refCount = 0;
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
bool isZeroCopy;
|
||||
bool isHostPtrSVM;
|
||||
bool isObjectRedescribed;
|
||||
|
||||
@@ -158,7 +158,7 @@ GraphicsAllocation *OsAgnosticMemoryManager::createGraphicsAllocationFromSharedH
|
||||
graphicsAllocation->set32BitAllocation(requireSpecificBitness);
|
||||
|
||||
if (properties.imgInfo) {
|
||||
Gmm *gmm = new Gmm(executionEnvironment.getGmmClientContext(), *properties.imgInfo, createStorageInfoFromProperties(properties));
|
||||
Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getGmmClientContext(), *properties.imgInfo, createStorageInfoFromProperties(properties));
|
||||
graphicsAllocation->setDefaultGmm(gmm);
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ void OsAgnosticMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage, uin
|
||||
}
|
||||
|
||||
GraphicsAllocation *OsAgnosticMemoryManager::allocateShareableMemory(const AllocationData &allocationData) {
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.getGmmClientContext(), allocationData.hostPtr, allocationData.size, false);
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, allocationData.size, false);
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
|
||||
auto ptr = allocateSystemMemory(alignUp(allocationData.size, MemoryConstants::pageSize), MemoryConstants::pageSize);
|
||||
|
||||
@@ -146,7 +146,7 @@ DrmMemoryManager *DrmCommandStreamReceiver<GfxFamily>::getMemoryManager() const
|
||||
|
||||
template <typename GfxFamily>
|
||||
GmmPageTableMngr *DrmCommandStreamReceiver<GfxFamily>::createPageTableManager() {
|
||||
GmmPageTableMngr *gmmPageTableMngr = GmmPageTableMngr::create(this->executionEnvironment.getGmmClientContext(), TT_TYPE::AUXTT, nullptr);
|
||||
GmmPageTableMngr *gmmPageTableMngr = GmmPageTableMngr::create(this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex]->getGmmClientContext(), TT_TYPE::AUXTT, nullptr);
|
||||
gmmPageTableMngr->setCsrHandle(this);
|
||||
this->executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex]->pageTableManager.reset(gmmPageTableMngr);
|
||||
return gmmPageTableMngr;
|
||||
|
||||
@@ -136,7 +136,7 @@ GmmPageTableMngr *WddmCommandStreamReceiver<GfxFamily>::createPageTableManager()
|
||||
|
||||
auto rootDeviceEnvironment = executionEnvironment.rootDeviceEnvironments[this->rootDeviceIndex].get();
|
||||
|
||||
GmmPageTableMngr *gmmPageTableMngr = GmmPageTableMngr::create(executionEnvironment.getGmmClientContext(), TT_TYPE::AUXTT, &ttCallbacks);
|
||||
GmmPageTableMngr *gmmPageTableMngr = GmmPageTableMngr::create(rootDeviceEnvironment->getGmmClientContext(), TT_TYPE::AUXTT, &ttCallbacks);
|
||||
gmmPageTableMngr->setCsrHandle(this);
|
||||
rootDeviceEnvironment->pageTableManager.reset(gmmPageTableMngr);
|
||||
return gmmPageTableMngr;
|
||||
|
||||
@@ -252,7 +252,7 @@ std::unique_ptr<AsyncEventsHandler> Platform::setAsyncEventsHandler(std::unique_
|
||||
}
|
||||
|
||||
GmmHelper *Platform::peekGmmHelper() const {
|
||||
return executionEnvironment.getGmmHelper();
|
||||
return executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
|
||||
}
|
||||
|
||||
GmmClientContext *Platform::peekGmmClientContext() const {
|
||||
|
||||
@@ -151,7 +151,7 @@ GraphicsAllocation *GlBuffer::createGraphicsAllocation(Context *context, unsigne
|
||||
sharingFunctions->graphicsAllocationsForGlBufferReuse.push_back(std::make_pair(bufferId, graphicsAllocation));
|
||||
if (bufferInfo.pGmmResInfo) {
|
||||
DEBUG_BREAK_IF(graphicsAllocation->getDefaultGmm() != nullptr);
|
||||
auto clientContext = context->getDevice(0)->getExecutionEnvironment()->getGmmClientContext();
|
||||
auto clientContext = context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext();
|
||||
graphicsAllocation->setDefaultGmm(new Gmm(clientContext, bufferInfo.pGmmResInfo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace NEO {
|
||||
Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texture,
|
||||
cl_int *errcodeRet) {
|
||||
ErrorCodeHelper errorCode(errcodeRet, CL_INVALID_GL_OBJECT);
|
||||
auto clientContext = context->getDevice(0)->getExecutionEnvironment()->getGmmClientContext();
|
||||
auto clientContext = context->getDevice(0)->getRootDeviceEnvironment().getGmmClientContext();
|
||||
auto memoryManager = context->getMemoryManager();
|
||||
cl_image_desc imgDesc = {};
|
||||
cl_image_format imgFormat = {};
|
||||
|
||||
@@ -445,7 +445,7 @@ HWTEST_P(AubSurfaceDumpTests, givenGraphicsAllocationWhenGetDumpSurfaceIsCalledA
|
||||
imgDesc.image_height = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
MockGmm::queryImgParams(pDevice->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
MockMemoryManager::AllocationData allocationData;
|
||||
allocationData.imgInfo = &imgInfo;
|
||||
auto imageAllocation = memoryManager.allocateGraphicsMemoryForImage(allocationData);
|
||||
|
||||
@@ -98,7 +98,7 @@ HWTEST_P(AUBCreateImageArray, CheckArrayImages) {
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
imgInfo.linearStorage = !hwHelper.tilingAllowed(false, Image::isImage1d(imageDesc), false);
|
||||
auto queryGmm = MockGmm::queryImgParams(pDevice->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
|
||||
//allocate host_ptr
|
||||
auto pixelSize = 4;
|
||||
@@ -224,7 +224,7 @@ HWTEST_P(CopyHostPtrTest, imageWithDoubledRowPitchThatIsCreatedWithCopyHostPtrFl
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
|
||||
MockGmm::queryImgParams(pDevice->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
auto lineWidth = imageDesc.image_width * elementSize;
|
||||
auto passedRowPitch = imgInfo.rowPitch * 2;
|
||||
imageDesc.image_row_pitch = passedRowPitch;
|
||||
@@ -293,7 +293,7 @@ HWTEST_P(UseHostPtrTest, imageWithRowPitchCreatedWithUseHostPtrFlagCopiedActuall
|
||||
imageDesc.image_height = 1;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
MockGmm::queryImgParams(pDevice->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(pDevice->getGmmClientContext(), imgInfo);
|
||||
auto passedRowPitch = imgInfo.rowPitch + 32;
|
||||
imageDesc.image_row_pitch = passedRowPitch;
|
||||
unsigned char *pUseHostPtr = new unsigned char[passedRowPitch * imageDesc.image_height * elementSize];
|
||||
|
||||
@@ -482,7 +482,7 @@ HWTEST_F(BuiltInTests, givenAuxTranslationKernelWhenSettingKernelArgsThenSetVali
|
||||
{
|
||||
// read args
|
||||
auto argNum = 0;
|
||||
auto expectedMocs = pDevice->getExecutionEnvironment()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
|
||||
auto expectedMocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
|
||||
auto sshBase = mockAuxBuiltInOp.convertToAuxKernel[0]->getSurfaceStateHeap();
|
||||
auto sshOffset = mockAuxBuiltInOp.convertToAuxKernel[0]->getKernelInfo().kernelArgInfo[argNum].offsetHeap;
|
||||
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(sshBase, sshOffset));
|
||||
@@ -497,7 +497,7 @@ HWTEST_F(BuiltInTests, givenAuxTranslationKernelWhenSettingKernelArgsThenSetVali
|
||||
{
|
||||
// write args
|
||||
auto argNum = 1;
|
||||
auto expectedMocs = pDevice->getExecutionEnvironment()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||
auto expectedMocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||
auto sshBase = mockAuxBuiltInOp.convertToAuxKernel[0]->getSurfaceStateHeap();
|
||||
auto sshOffset = mockAuxBuiltInOp.convertToAuxKernel[0]->getKernelInfo().kernelArgInfo[argNum].offsetHeap;
|
||||
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(sshBase, sshOffset));
|
||||
@@ -529,7 +529,7 @@ HWTEST_F(BuiltInTests, givenAuxToNonAuxTranslationWhenSettingSurfaceStateThenSet
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = std::unique_ptr<Buffer>(Buffer::create(pContext, 0, MemoryConstants::pageSize, nullptr, retVal));
|
||||
buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
auto gmm = new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false);
|
||||
gmm->isRenderCompressed = true;
|
||||
buffer->getGraphicsAllocation()->setDefaultGmm(gmm);
|
||||
|
||||
@@ -575,7 +575,7 @@ HWTEST_F(BuiltInTests, givenNonAuxToAuxTranslationWhenSettingSurfaceStateThenSet
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
auto buffer = std::unique_ptr<Buffer>(Buffer::create(pContext, 0, MemoryConstants::pageSize, nullptr, retVal));
|
||||
buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
auto gmm = new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false);
|
||||
gmm->isRenderCompressed = true;
|
||||
buffer->getGraphicsAllocation()->setDefaultGmm(gmm);
|
||||
memObjsForAuxTranslation.insert(buffer.get());
|
||||
|
||||
@@ -519,7 +519,7 @@ HWTEST_F(EnqueueKernelTest, whenEnqueueKernelWithNoStatelessWriteWhenSbaIsBeingP
|
||||
EXPECT_EQ(csr.recordedDispatchFlags.l3CacheSettings, L3CachingSettings::l3AndL1On);
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto gmmHelper = this->pDevice->getExecutionEnvironment()->getGmmHelper();
|
||||
auto gmmHelper = this->pDevice->getGmmHelper();
|
||||
auto expectedMocsIndex = helper.getMocsIndex(*gmmHelper, true, true);
|
||||
EXPECT_EQ(expectedMocsIndex, csr.latestSentStatelessMocsConfig);
|
||||
}
|
||||
@@ -541,7 +541,7 @@ HWTEST_F(EnqueueKernelTest, whenEnqueueKernelWithNoStatelessWriteOnBlockedCodePa
|
||||
EXPECT_EQ(csr.recordedDispatchFlags.l3CacheSettings, L3CachingSettings::l3AndL1On);
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto gmmHelper = this->pDevice->getExecutionEnvironment()->getGmmHelper();
|
||||
auto gmmHelper = this->pDevice->getGmmHelper();
|
||||
auto expectedMocsIndex = helper.getMocsIndex(*gmmHelper, true, true);
|
||||
EXPECT_EQ(expectedMocsIndex, csr.latestSentStatelessMocsConfig);
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenAlignedPointerAndAlignedSizeWhenReadBuf
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto gmmHelper = csr.peekExecutionEnvironment().getGmmHelper();
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
auto mocsIndexL3on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
|
||||
auto mocsIndexL1on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
|
||||
|
||||
@@ -321,7 +321,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenNotAlignedPointerAndAlignedSizeWhenRead
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto gmmHelper = csr.peekExecutionEnvironment().getGmmHelper();
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
auto mocsIndexL3off = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
|
||||
auto mocsIndexL3on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
|
||||
auto mocsIndexL1on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
|
||||
@@ -362,7 +362,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenNotAlignedPointerAndSizeWhenBlockedRead
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto gmmHelper = csr.peekExecutionEnvironment().getGmmHelper();
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
auto mocsIndexL3off = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
|
||||
|
||||
EXPECT_EQ(mocsIndexL3off, csr.latestSentStatelessMocsConfig);
|
||||
|
||||
@@ -20,7 +20,7 @@ typedef EnqueueReadBufferTypeTest ReadWriteBufferCpuCopyTest;
|
||||
HWTEST_F(ReadWriteBufferCpuCopyTest, givenRenderCompressedGmmWhenAskingForCpuOperationThenDisallow) {
|
||||
cl_int retVal;
|
||||
std::unique_ptr<Buffer> buffer(Buffer::create(context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
auto gmm = new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false);
|
||||
gmm->isRenderCompressed = false;
|
||||
buffer->getGraphicsAllocation()->setDefaultGmm(gmm);
|
||||
|
||||
|
||||
@@ -672,7 +672,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
aubCsr->setAubWritable(true, *gfxAllocation);
|
||||
|
||||
auto gmm = new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false);
|
||||
gfxAllocation->setDefaultGmm(gmm);
|
||||
|
||||
for (bool compressed : {false, true}) {
|
||||
|
||||
@@ -540,7 +540,7 @@ TEST_F(PerformanceHintTest, givenCompressedImageWhenItsCreatedThenProperPerforma
|
||||
auto mockBuffer = std::unique_ptr<MockBuffer>(new MockBuffer());
|
||||
StorageInfo info;
|
||||
size_t t = 4;
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(device->getExecutionEnvironment()->getGmmClientContext(), static_cast<const void *>(nullptr), t, false, true, true, info));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(device->getGmmClientContext(), static_cast<const void *>(nullptr), t, false, true, true, info));
|
||||
gmm->isRenderCompressed = true;
|
||||
|
||||
mockBuffer->getGraphicsAllocation()->setDefaultGmm(gmm.get());
|
||||
@@ -660,7 +660,7 @@ TEST_F(PerformanceHintTest, givenUncompressedImageWhenItsCreatedThenProperPerfor
|
||||
auto mockBuffer = std::unique_ptr<MockBuffer>(new MockBuffer());
|
||||
StorageInfo info;
|
||||
size_t t = 4;
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(device->getExecutionEnvironment()->getGmmClientContext(), (const void *)nullptr, t, false, true, true, info));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(device->getGmmClientContext(), (const void *)nullptr, t, false, true, true, info));
|
||||
gmm->isRenderCompressed = false;
|
||||
|
||||
mockBuffer->getGraphicsAllocation()->setDefaultGmm(gmm.get());
|
||||
|
||||
@@ -39,7 +39,7 @@ class MockMM : public OsAgnosticMemoryManager {
|
||||
return alloc;
|
||||
}
|
||||
GraphicsAllocation *allocateGraphicsMemoryForImage(const AllocationData &allocationData) override {
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.getGmmClientContext(), *allocationData.imgInfo, StorageInfo{});
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo, StorageInfo{});
|
||||
AllocationProperties properties(allocationData.rootDeviceIndex, nullptr, false, GraphicsAllocation::AllocationType::SHARED_IMAGE, false);
|
||||
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(1, properties, false);
|
||||
alloc->setDefaultGmm(forceGmm);
|
||||
@@ -82,7 +82,7 @@ class D3D9Tests : public PlatformFixture, public ::testing::Test {
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
gmm = MockGmm::queryImgParams(pPlatform->peekExecutionEnvironment()->getGmmClientContext(), imgInfo).release();
|
||||
gmm = MockGmm::queryImgParams(pPlatform->getDevice(0)->getGmmClientContext(), imgInfo).release();
|
||||
mockGmmResInfo = reinterpret_cast<NiceMock<MockGmmResourceInfo> *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
memoryManager->forceGmm = gmm;
|
||||
@@ -1146,7 +1146,7 @@ TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNullWhenCreatingSharedSurfaceAnd
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
auto gmm = MockGmm::queryImgParams(device->getExecutionEnvironment()->getGmmClientContext(), imgInfo).release();
|
||||
auto gmm = MockGmm::queryImgParams(device->getGmmClientContext(), imgInfo).release();
|
||||
|
||||
auto memoryManager = std::make_unique<MockMM>(*device->executionEnvironment);
|
||||
memoryManager->forceGmm = gmm;
|
||||
@@ -1178,7 +1178,7 @@ TEST_F(D3D9MultiRootDeviceTest, givenD3DHandleIsNotNullWhenCreatingSharedSurface
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
auto gmm = MockGmm::queryImgParams(device->getExecutionEnvironment()->getGmmClientContext(), imgInfo).release();
|
||||
auto gmm = MockGmm::queryImgParams(device->getGmmClientContext(), imgInfo).release();
|
||||
|
||||
auto memoryManager = std::make_unique<MockMM>(*device->executionEnvironment);
|
||||
memoryManager->forceGmm = gmm;
|
||||
|
||||
@@ -75,7 +75,7 @@ class D3DTests : public PlatformFixture, public ::testing::Test {
|
||||
imgDesc.image_depth = 1;
|
||||
imgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
gmm = MockGmm::queryImgParams(pPlatform->peekExecutionEnvironment()->getGmmClientContext(), imgInfo).release();
|
||||
gmm = MockGmm::queryImgParams(pPlatform->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), imgInfo).release();
|
||||
mockGmmResInfo = reinterpret_cast<NiceMock<MockGmmResourceInfo> *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
mockMM->forceGmm = gmm;
|
||||
|
||||
@@ -120,7 +120,7 @@ struct UltCommandStreamReceiverTest
|
||||
commandStreamReceiver.isPreambleSent = true;
|
||||
commandStreamReceiver.lastPreemptionMode = pDevice->getPreemptionMode();
|
||||
commandStreamReceiver.setMediaVFEStateDirty(false);
|
||||
auto gmmHelper = commandStreamReceiver.peekExecutionEnvironment().getGmmHelper();
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
auto mocsIndex = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||
|
||||
commandStreamReceiver.latestSentStatelessMocsConfig = mocsIndex >> 1;
|
||||
|
||||
@@ -95,7 +95,7 @@ GEN12LPTEST_F(ImageClearColorFixture, givenMcsAllocationWhenSetArgIsCalledWithUn
|
||||
|
||||
auto surfaceState = FamilyType::cmdInitRenderSurfaceState;
|
||||
auto imageHw = static_cast<ImageHw<FamilyType> *>(image.get());
|
||||
mcsAlloc->setDefaultGmm(new Gmm(context->getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
mcsAlloc->setDefaultGmm(new Gmm(context->getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||
surfaceState.setSurfaceBaseAddress(0xABCDEF1000);
|
||||
imageHw->setMcsSurfaceInfo(msi);
|
||||
imageHw->setMcsAllocation(mcsAlloc);
|
||||
|
||||
@@ -26,7 +26,7 @@ struct Gen12LpWddmTest : public GdiDllFixture, ::testing::Test {
|
||||
executionEnvironment->initGmm();
|
||||
rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment)));
|
||||
gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(executionEnvironment->getGmmClientContext());
|
||||
gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(rootDeviceEnvironment->getGmmClientContext());
|
||||
wddm->gmmMemory.reset(gmmMemory);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,10 @@ extern bool copyInputArgs;
|
||||
struct GmmTests : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
}
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
ExecutionEnvironment *executionEnvironment = nullptr;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
};
|
||||
|
||||
TEST(GmmGlTests, givenGmmWhenAskedforCubeFaceIndexThenProperValueIsReturned) {
|
||||
@@ -64,7 +66,7 @@ TEST(GmmGlTests, givenGmmWhenAskedforCubeFaceIndexThenProperValueIsReturned) {
|
||||
TEST_F(GmmTests, resourceCreation) {
|
||||
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
|
||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
|
||||
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
||||
|
||||
@@ -79,7 +81,7 @@ TEST_F(GmmTests, resourceCreationUncacheable) {
|
||||
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
|
||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096, true));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, true));
|
||||
|
||||
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
||||
|
||||
@@ -95,7 +97,7 @@ TEST_F(GmmTests, resourceCleanupOnDelete) {
|
||||
std::unique_ptr<MemoryManager> mm(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment));
|
||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
|
||||
ASSERT_TRUE(gmm->gmmResourceInfo.get() != nullptr);
|
||||
|
||||
@@ -107,7 +109,7 @@ TEST_F(GmmTests, givenHostPointerWithHighestBitSetWhenGmmIsCreatedItHasTheSameAd
|
||||
auto address = reinterpret_cast<void *>(addressWithHighestBitSet);
|
||||
auto expectedAddress = castToUint64(address);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), address, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), address, 4096, false));
|
||||
EXPECT_EQ(gmm->resourceParams.pExistingSysMem, expectedAddress);
|
||||
}
|
||||
|
||||
@@ -117,7 +119,7 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGMM
|
||||
MemoryManager *mm = new MemoryManagerCreate<OsAgnosticMemoryManager>(false, false, *executionEnvironment);
|
||||
void *pSysMem = mm->allocateSystemMemory(4096, 4096);
|
||||
|
||||
auto gmmRes = new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, maxSize, false);
|
||||
auto gmmRes = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, maxSize, false);
|
||||
|
||||
ASSERT_TRUE(gmmRes->gmmResourceInfo.get() != nullptr);
|
||||
|
||||
@@ -130,8 +132,8 @@ TEST_F(GmmTests, GivenBufferSizeLargerThenMaxPitchWhenAskedForGmmCreationThenGMM
|
||||
TEST_F(GmmTests, givenGmmCreatedFromExistingGmmThenHelperDoesNotReleaseParentGmm) {
|
||||
auto size = 4096u;
|
||||
void *incomingPtr = (void *)0x1000;
|
||||
auto gmmRes = new Gmm(executionEnvironment->getGmmClientContext(), incomingPtr, size, false);
|
||||
auto gmmRes2 = new Gmm(executionEnvironment->getGmmClientContext(), gmmRes->gmmResourceInfo->peekHandle());
|
||||
auto gmmRes = new Gmm(rootDeviceEnvironment->getGmmClientContext(), incomingPtr, size, false);
|
||||
auto gmmRes2 = new Gmm(rootDeviceEnvironment->getGmmClientContext(), gmmRes->gmmResourceInfo->peekHandle());
|
||||
|
||||
//copy is being made
|
||||
EXPECT_NE(gmmRes2->gmmResourceInfo->peekHandle(), gmmRes->gmmResourceInfo->peekHandle());
|
||||
@@ -153,7 +155,7 @@ TEST_F(GmmTests, invalidImageTypeQuery) {
|
||||
imgDesc.image_type = 0; // invalid
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
EXPECT_THROW(MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo), std::exception);
|
||||
EXPECT_THROW(MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo), std::exception);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, validImageTypeQuery) {
|
||||
@@ -168,7 +170,7 @@ TEST_F(GmmTests, validImageTypeQuery) {
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
auto queryGmm = MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_GT(imgInfo.size, minSize);
|
||||
EXPECT_GT(imgInfo.rowPitch, 0u);
|
||||
@@ -198,20 +200,20 @@ TEST_F(GmmTests, validImageTypeQuery) {
|
||||
TEST_F(GmmTests, givenWidthWhenCreatingResourceThenSetWidth64Field) {
|
||||
const void *dummyPtr = reinterpret_cast<void *>(0x123);
|
||||
size_t allocationSize = std::numeric_limits<size_t>::max();
|
||||
Gmm gmm(executionEnvironment->getGmmClientContext(), dummyPtr, allocationSize, false);
|
||||
Gmm gmm(rootDeviceEnvironment->getGmmClientContext(), dummyPtr, allocationSize, false);
|
||||
EXPECT_EQ(static_cast<uint64_t>(allocationSize), gmm.resourceParams.BaseWidth64);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenNullptrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) {
|
||||
void *pSysMem = nullptr;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
|
||||
EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 1u);
|
||||
}
|
||||
|
||||
TEST_F(GmmTests, givenPtrWhenGmmConstructorIsCalledThenNoGfxMemoryIsProperlySet) {
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1111);
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096, false));
|
||||
|
||||
EXPECT_EQ(gmm->resourceParams.NoGfxMemory, 0u);
|
||||
}
|
||||
@@ -228,7 +230,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedThenItH
|
||||
ClSurfaceFormatInfo surfaceFormat = {{CL_RGBA, CL_FLOAT}, {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16}};
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
|
||||
auto queryGmm = MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation();
|
||||
|
||||
size_t expectedSize = imgDesc.image_row_pitch * imgDesc.image_height;
|
||||
@@ -249,7 +251,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedAndPitc
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat);
|
||||
EXPECT_EQ(imgInfo.imgDesc.imageRowPitch, imgDesc.image_row_pitch);
|
||||
auto queryGmm = MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation();
|
||||
|
||||
size_t expectedSize = imgDesc.image_row_pitch * imgDesc.image_height;
|
||||
@@ -269,14 +271,14 @@ TEST_F(GmmTests, givenPlanarFormatsWhenQueryingImageParamsThenUVOffsetIsQueried)
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatNV12);
|
||||
imgInfo.yOffsetForUVPlane = 0;
|
||||
MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_NE(0u, imgInfo.yOffsetForUVPlane);
|
||||
|
||||
imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormatP010);
|
||||
imgInfo.yOffsetForUVPlane = 0;
|
||||
|
||||
MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
EXPECT_NE(0u, imgInfo.yOffsetForUVPlane);
|
||||
}
|
||||
|
||||
@@ -289,7 +291,7 @@ TEST_F(GmmTests, givenTilingModeSetToTileYWhenHwSupportsTilingThenTileYFlagIsSet
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.linearStorage = false;
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment->getGmmClientContext(), imgInfo, StorageInfo{});
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), imgInfo, StorageInfo{});
|
||||
|
||||
EXPECT_EQ(gmm->resourceParams.Flags.Info.Linear, 0u);
|
||||
EXPECT_EQ(gmm->resourceParams.Flags.Info.TiledY, 0u);
|
||||
@@ -304,7 +306,7 @@ TEST_F(GmmTests, givenTilingModeSetToNonTiledWhenCreatingGmmThenLinearFlagIsSet)
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
imgInfo.linearStorage = true;
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment->getGmmClientContext(), imgInfo, StorageInfo{});
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), imgInfo, StorageInfo{});
|
||||
|
||||
EXPECT_EQ(gmm->resourceParams.Flags.Info.Linear, 1u);
|
||||
EXPECT_EQ(gmm->resourceParams.Flags.Info.TiledY, 0u);
|
||||
@@ -398,7 +400,7 @@ TEST_F(GmmTests, givenMipmapedInputWhenAskedForHalingThenNonDefaultValueIsReturn
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, mipLevel, nullptr);
|
||||
|
||||
auto queryGmm = MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_EQ(static_cast<int>(queryGmm->resourceParams.MaxLod), mipLevel);
|
||||
}
|
||||
@@ -415,7 +417,7 @@ struct GmmMediaCompressedTests : public GmmTests {
|
||||
void SetUp() override {
|
||||
GmmTests::SetUp();
|
||||
StorageInfo info;
|
||||
gmm = std::make_unique<Gmm>(executionEnvironment->getGmmClientContext(), nullptr, 4, false, true, true, info);
|
||||
gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 4, false, true, true, info);
|
||||
flags = gmm->gmmResourceInfo->getResourceFlags();
|
||||
flags->Gpu.CCS = true;
|
||||
flags->Gpu.UnifiedAuxSurface = true;
|
||||
@@ -531,7 +533,7 @@ TEST_P(GmmImgTest, updateImgInfoAndDesc) {
|
||||
}
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
auto queryGmm = MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
|
||||
auto mockResInfo = new NiceMock<MyMockGmmResourceInfo>(&queryGmm->resourceParams);
|
||||
queryGmm->gmmResourceInfo.reset(mockResInfo);
|
||||
@@ -595,7 +597,7 @@ TEST(GmmImgTest, givenImgInfoWhenUpdatingOffsetsCallGmmToGetOffsets) {
|
||||
imgDesc.image_array_size = 10;
|
||||
|
||||
ImageInfo imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
std::unique_ptr<Gmm> gmm = MockGmm::queryImgParams(platform()->peekExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
std::unique_ptr<Gmm> gmm = MockGmm::queryImgParams(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), imgInfo);
|
||||
MyMockGmmResourceInfo *mockGmmResourceInfo = new MyMockGmmResourceInfo(&gmm->resourceParams);
|
||||
gmm->gmmResourceInfo.reset(mockGmmResourceInfo);
|
||||
|
||||
@@ -619,7 +621,7 @@ TEST_F(GmmTests, copyResourceBlt) {
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
|
||||
auto gmm = MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto gmm = MockGmm::queryImgParams(rootDeviceEnvironment->getGmmClientContext(), imgInfo);
|
||||
auto mockResInfo = reinterpret_cast<NiceMock<MockGmmResourceInfo> *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
GMM_RES_COPY_BLT requestedCpuBlt = {};
|
||||
@@ -679,7 +681,7 @@ TEST_F(GmmTests, copyResourceBlt) {
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenReturnTrue) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, false));
|
||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
mockResource->setUnifiedAuxTranslationCapable();
|
||||
@@ -691,7 +693,7 @@ TEST(GmmTest, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenR
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThenReturnFalse) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, false));
|
||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
|
||||
mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 0;
|
||||
@@ -717,8 +719,8 @@ TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) {
|
||||
struct MyMockResourecInfo : public GmmResourceInfo {
|
||||
using GmmResourceInfo::resourceInfo;
|
||||
|
||||
MyMockResourecInfo(GMM_RESCREATE_PARAMS *inputParams) : GmmResourceInfo(platform()->peekExecutionEnvironment()->getGmmClientContext(), inputParams){};
|
||||
MyMockResourecInfo(GMM_RESOURCE_INFO *inputGmmResourceInfo) : GmmResourceInfo(platform()->peekExecutionEnvironment()->getGmmClientContext(), inputGmmResourceInfo){};
|
||||
MyMockResourecInfo(GMM_RESCREATE_PARAMS *inputParams) : GmmResourceInfo(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), inputParams){};
|
||||
MyMockResourecInfo(GMM_RESOURCE_INFO *inputGmmResourceInfo) : GmmResourceInfo(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), inputGmmResourceInfo){};
|
||||
};
|
||||
|
||||
GMM_RESCREATE_PARAMS gmmParams = {};
|
||||
@@ -742,12 +744,12 @@ TEST(GmmTest, whenResourceIsCreatedThenHandleItsOwnership) {
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenGmmWithNotSetMCSInResourceInfoGpuFlagsWhenCallHasMultisampleControlSurfaceThenReturnFalse) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, false));
|
||||
EXPECT_FALSE(gmm->hasMultisampleControlSurface());
|
||||
}
|
||||
|
||||
TEST(GmmTest, givenGmmWithSetMCSInResourceInfoGpuFlagsWhenCallhasMultisampleControlSurfaceThenReturnTrue) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 1, false));
|
||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
mockResource->setMultisampleControlSurface();
|
||||
EXPECT_TRUE(gmm->hasMultisampleControlSurface());
|
||||
@@ -761,7 +763,7 @@ TEST(GmmHelperTest, whenGmmHelperIsInitializedThenClientContextIsSet) {
|
||||
TEST(GmmHelperTest, givenPlatformAlreadyDestroyedWhenResourceIsBeingDestroyedThenObserveNoExceptions) {
|
||||
struct MockGmmResourecInfo : public GmmResourceInfo {
|
||||
using GmmResourceInfo::resourceInfo;
|
||||
MockGmmResourecInfo(GMM_RESCREATE_PARAMS *inputParams) : GmmResourceInfo(platform()->peekExecutionEnvironment()->getGmmClientContext(), inputParams){};
|
||||
MockGmmResourecInfo(GMM_RESCREATE_PARAMS *inputParams) : GmmResourceInfo(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), inputParams){};
|
||||
};
|
||||
|
||||
GMM_RESCREATE_PARAMS gmmParams = {};
|
||||
|
||||
@@ -260,7 +260,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvidedThe
|
||||
using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE;
|
||||
|
||||
ExecutionEnvironment &executionEnvironment = *pDevice->getExecutionEnvironment();
|
||||
auto gmmHelper = executionEnvironment.getGmmHelper();
|
||||
auto gmmHelper = pDevice->getGmmHelper();
|
||||
|
||||
void *stateBuffer = alignedMalloc(sizeof(RENDER_SURFACE_STATE), sizeof(RENDER_SURFACE_STATE));
|
||||
ASSERT_NE(nullptr, stateBuffer);
|
||||
@@ -345,7 +345,7 @@ HWTEST_F(HwHelperTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenU
|
||||
size_t allocSize = size;
|
||||
length.Length = static_cast<uint32_t>(allocSize - 1);
|
||||
GraphicsAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, cpuAddr, gpuAddr, 0u, allocSize, MemoryPool::MemoryNull);
|
||||
allocation.setDefaultGmm(new Gmm(executionEnvironment.getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false));
|
||||
allocation.setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), false));
|
||||
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
|
||||
helper.setRenderSurfaceStateForBuffer(executionEnvironment, stateBuffer, size, addr, 0, pitch, &allocation, false, type, true);
|
||||
EXPECT_EQ(length.SurfaceState.Depth + 1u, state->getDepth());
|
||||
@@ -669,7 +669,7 @@ TEST_F(HwHelperTest, givenAUBDumpForceAllToLocalMemoryDebugVarWhenSetThenGetEnab
|
||||
|
||||
TEST_F(HwHelperTest, givenVariousCachesRequestProperMOCSIndexesAreBeingReturned) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
auto gmmHelper = this->pDevice->getExecutionEnvironment()->getGmmHelper();
|
||||
auto gmmHelper = this->pDevice->getGmmHelper();
|
||||
auto expectedMocsForL3off = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
|
||||
auto expectedMocsForL3on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
|
||||
auto expectedMocsForL3andL1on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
|
||||
|
||||
@@ -188,7 +188,7 @@ HWTEST_F(BufferSetArgTest, givenNonPureStatefulArgWhenRenderCompressedBufferIsSe
|
||||
|
||||
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(pKernel->getSurfaceStateHeap(), pKernelInfo->kernelArgInfo[0].offsetHeap));
|
||||
buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
buffer->getGraphicsAllocation()->setDefaultGmm(new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), buffer->getGraphicsAllocation()->getUnderlyingBuffer(), buffer->getSize(), false));
|
||||
buffer->getGraphicsAllocation()->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), buffer->getGraphicsAllocation()->getUnderlyingBuffer(), buffer->getSize(), false));
|
||||
buffer->getGraphicsAllocation()->getDefaultGmm()->isRenderCompressed = true;
|
||||
pKernelInfo->requiresSshForBuffers = true;
|
||||
cl_mem clMem = buffer;
|
||||
|
||||
@@ -2185,7 +2185,7 @@ HWTEST_F(BufferSetSurfaceTests, givenRenderCompressedGmmResourceWhenSurfaceState
|
||||
|
||||
std::unique_ptr<Buffer> buffer(Buffer::create(&context, CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
buffer->getGraphicsAllocation()->setAllocationType(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED);
|
||||
auto gmm = new Gmm(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false);
|
||||
buffer->getGraphicsAllocation()->setDefaultGmm(gmm);
|
||||
gmm->isRenderCompressed = true;
|
||||
|
||||
@@ -2209,7 +2209,7 @@ HWTEST_F(BufferSetSurfaceTests, givenNonRenderCompressedGmmResourceWhenSurfaceSt
|
||||
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)->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false);
|
||||
buffer->getGraphicsAllocation()->setDefaultGmm(gmm);
|
||||
gmm->isRenderCompressed = false;
|
||||
|
||||
@@ -2290,8 +2290,8 @@ HWTEST_P(BufferL3CacheTests, givenMisalignedAndAlignedBufferWhenClEnqueueWriteIm
|
||||
|
||||
clEnqueueWriteImage(&cmdQ, image, false, origin, region, 0, 0, hostPtr, 0, nullptr, nullptr);
|
||||
|
||||
auto expect = ctx.getDevice(0)->getExecutionEnvironment()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||
auto expect2 = ctx.getDevice(0)->getExecutionEnvironment()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
|
||||
auto expect = ctx.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||
auto expect2 = ctx.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
|
||||
|
||||
EXPECT_NE(NULL, surfaceState->getMemoryObjectControlState());
|
||||
EXPECT_TRUE(expect == surfaceState->getMemoryObjectControlState() || expect2 == surfaceState->getMemoryObjectControlState());
|
||||
@@ -2311,8 +2311,8 @@ HWTEST_P(BufferL3CacheTests, givenMisalignedAndAlignedBufferWhenClEnqueueWriteBu
|
||||
|
||||
clEnqueueWriteBufferRect(&cmdQ, buffer, false, origin, origin, region, 0, 0, 0, 0, hostPtr, 0, nullptr, nullptr);
|
||||
|
||||
auto expect = ctx.getDevice(0)->getExecutionEnvironment()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||
auto expect2 = ctx.getDevice(0)->getExecutionEnvironment()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
|
||||
auto expect = ctx.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
|
||||
auto expect2 = ctx.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
|
||||
|
||||
EXPECT_NE(NULL, surfaceState->getMemoryObjectControlState());
|
||||
EXPECT_TRUE(expect == surfaceState->getMemoryObjectControlState() || expect2 == surfaceState->getMemoryObjectControlState());
|
||||
|
||||
@@ -304,7 +304,7 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag
|
||||
EXPECT_EQ(this->size, bufferGraphicsAllocation->getUnderlyingBufferSize());
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, &imageFromBuffer->getSurfaceFormatInfo());
|
||||
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_TRUE(queryGmm->gmmResourceInfo->getSizeAllocation() >= this->size);
|
||||
|
||||
@@ -341,7 +341,7 @@ TEST_F(Image2dFromBufferTest, givenMemoryManagerSupportingVirtualPaddingWhenImag
|
||||
EXPECT_EQ(bufferSize, bufferGraphicsAllocation->getUnderlyingBufferSize());
|
||||
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, &imageFromBuffer->getSurfaceFormatInfo());
|
||||
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
auto queryGmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
|
||||
EXPECT_GT(queryGmm->gmmResourceInfo->getSizeAllocation(), bufferSize);
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ HWTEST_F(CreateImage3DTest, calculate3dImageQpitchTiledAndLinear) {
|
||||
imageDesc.image_height = 1;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
auto imgInfo = MockGmm::initImgInfo(imageDesc, 0, surfaceFormat);
|
||||
MockGmm::queryImgParams(context->getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(context->getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
|
||||
auto image = Image::create(
|
||||
context,
|
||||
@@ -114,7 +114,7 @@ HWTEST_F(CreateImage3DTest, calculate3dImageQpitchTiledAndLinear) {
|
||||
|
||||
// query again
|
||||
surfaceFormat = Image::getSurfaceFormatFromTable(0, &imageFormat, context->getDevice(0)->getHardwareInfo().capabilityTable.clVersionSupport);
|
||||
MockGmm::queryImgParams(context->getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
MockGmm::queryImgParams(context->getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
|
||||
image = Image::create(
|
||||
context,
|
||||
|
||||
@@ -276,7 +276,7 @@ HWTEST_F(ImageSetArgTest, givenImageArraySizeGreaterThanOneButTypeIsNotImageArra
|
||||
imageInfo.imgDesc = Image::convertDescriptor(imageDesc);
|
||||
imageInfo.plane = GMM_NO_PLANE;
|
||||
|
||||
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), imageInfo);
|
||||
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), imageInfo);
|
||||
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{MemoryConstants::pageSize});
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false));
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
|
||||
@@ -613,7 +613,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationAndRenderCompressionWhenSetArgOnMult
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false));
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
|
||||
@@ -674,7 +674,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
|
||||
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false));
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
|
||||
@@ -704,7 +704,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
|
||||
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false));
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
|
||||
@@ -733,7 +733,7 @@ HWTEST_F(ImageSetArgTest, givenMcsAllocationWhenSetArgIsCalledWithUnifiedAuxCapa
|
||||
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
mcsAlloc->setDefaultGmm(new Gmm(pDevice->getGmmClientContext(), nullptr, 1, false));
|
||||
cl_image_desc imgDesc = Image2dDefaults::imageDesc;
|
||||
imgDesc.num_samples = 8;
|
||||
|
||||
|
||||
@@ -1377,7 +1377,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)->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||
uint64_t surfBsaseAddress = 0xABCDEF1000;
|
||||
surfaceState.setSurfaceBaseAddress(surfBsaseAddress);
|
||||
auto mockResource = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
@@ -1431,7 +1431,7 @@ HWTEST_F(HwImageTest, givenImageHwWithUnifiedSurfaceAndMcsWhenSettingParamsForMu
|
||||
|
||||
McsSurfaceInfo msi = {10, 20, 3};
|
||||
auto mcsAlloc = context.getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
mcsAlloc->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||
|
||||
auto mockMcsGmmResInfo = reinterpret_cast<::testing::NiceMock<MockGmmResourceInfo> *>(mcsAlloc->getDefaultGmm()->gmmResourceInfo.get());
|
||||
mockMcsGmmResInfo->setUnifiedAuxTranslationCapable();
|
||||
|
||||
@@ -99,7 +99,7 @@ TEST_P(CreateTiledImageTest, isTiledImageIsSetForSharedImages) {
|
||||
info.imgDesc = Image::convertDescriptor(imageDesc);
|
||||
info.plane = GMM_NO_PLANE;
|
||||
|
||||
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), info);
|
||||
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), info);
|
||||
|
||||
alloc->setDefaultGmm(gmm.release());
|
||||
|
||||
@@ -138,7 +138,7 @@ TEST_P(CreateNonTiledImageTest, isTiledImageIsNotSetForNonTiledSharedImage) {
|
||||
info.imgDesc = Image::convertDescriptor(imageDesc);
|
||||
info.plane = GMM_NO_PLANE;
|
||||
|
||||
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), info);
|
||||
auto gmm = MockGmm::queryImgParams(context.getDevice(0)->getGmmClientContext(), info);
|
||||
|
||||
alloc->setDefaultGmm(gmm.release());
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ TEST(MemObj, givenRenderCompressedGmmWhenAskingForMappingOnCpuThenDisallow) {
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
||||
@@ -340,7 +340,7 @@ TEST(MemObj, givenNonCpuAccessibleMemoryWhenAskingForMappingOnCpuThenDisallow) {
|
||||
context.memoryManager = &memoryManager;
|
||||
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false));
|
||||
allocation->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), nullptr, 1, false));
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(CL_MEM_READ_WRITE, 0, 0);
|
||||
MemObj memObj(&context, CL_MEM_OBJECT_BUFFER, memoryProperties, CL_MEM_READ_WRITE, 0,
|
||||
1, allocation->getUnderlyingBuffer(), nullptr, allocation, false, false, false);
|
||||
|
||||
@@ -770,7 +770,7 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerAndUnifiedAuxCapableAlloc
|
||||
executionEnvironment.initGmm();
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
|
||||
auto gmm = new Gmm(executionEnvironment.getGmmClientContext(), nullptr, 123, false);
|
||||
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 123, false);
|
||||
auto allocation = memoryManager.allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(gmm);
|
||||
|
||||
@@ -1299,7 +1299,7 @@ TEST(MemoryManager, givenShareableWhenAllocatingGraphicsMemoryThenAllocateSharea
|
||||
}
|
||||
|
||||
TEST_F(MemoryAllocatorTest, GivenSizeWhenGmmIsCreatedThenSuccess) {
|
||||
Gmm *gmm = new Gmm(executionEnvironment->getGmmClientContext(), nullptr, 65536, false);
|
||||
Gmm *gmm = new Gmm(device->getGmmClientContext(), nullptr, 65536, false);
|
||||
EXPECT_NE(nullptr, gmm);
|
||||
delete gmm;
|
||||
}
|
||||
@@ -2030,7 +2030,8 @@ TEST(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocati
|
||||
|
||||
TEST(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIs64KSuitableThenStandard64kHeapIsUsed) {
|
||||
GraphicsAllocation allocation{0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
|
||||
auto gmm = std::make_unique<Gmm>(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 0, false);
|
||||
auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, false);
|
||||
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
resourceInfo->is64KBPageSuitableValue = true;
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
@@ -2039,7 +2040,8 @@ TEST(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocati
|
||||
|
||||
TEST(HeapSelectorTest, givenFullAddressSpaceWhenSelectingHeapForExternalAllocationWithoutPtrAndResourceIsNot64KSuitableThenStandardHeapIsUsed) {
|
||||
GraphicsAllocation allocation{0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull};
|
||||
auto gmm = std::make_unique<Gmm>(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 0, false);
|
||||
auto rootDeviceEnvironment = platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0].get();
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, false);
|
||||
auto resourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
resourceInfo->is64KBPageSuitableValue = false;
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
|
||||
@@ -23,7 +23,7 @@ class MockGmm : public Gmm {
|
||||
using Gmm::Gmm;
|
||||
using Gmm::setupImageResourceParams;
|
||||
|
||||
MockGmm() : Gmm(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 1, false){};
|
||||
MockGmm() : Gmm(platform()->peekGmmClientContext(), nullptr, 1, false){};
|
||||
|
||||
static std::unique_ptr<Gmm> queryImgParams(GmmClientContext *clientContext, ImageInfo &imgInfo) {
|
||||
return std::unique_ptr<Gmm>(new Gmm(clientContext, imgInfo, {}));
|
||||
|
||||
@@ -62,7 +62,7 @@ GraphicsAllocation *MockMemoryManager::allocateGraphicsMemory64kb(const Allocati
|
||||
|
||||
auto allocation = OsAgnosticMemoryManager::allocateGraphicsMemory64kb(allocationData);
|
||||
if (allocation) {
|
||||
allocation->setDefaultGmm(new Gmm(executionEnvironment.getGmmClientContext(), allocation->getUnderlyingBuffer(), allocationData.size, false, preferRenderCompressedFlagPassed, true, {}));
|
||||
allocation->setDefaultGmm(new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocation->getUnderlyingBuffer(), allocationData.size, false, preferRenderCompressedFlagPassed, true, {}));
|
||||
allocation->getDefaultGmm()->isRenderCompressed = preferRenderCompressedFlagPassed;
|
||||
}
|
||||
return allocation;
|
||||
|
||||
@@ -2214,7 +2214,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto gmm = new Gmm(executionEnvironment->getGmmClientContext(), nullptr, 123, false);
|
||||
auto gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 123, false);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(gmm);
|
||||
|
||||
|
||||
@@ -48,8 +48,9 @@ class DrmMemoryManagerFixture : public MemoryManagementFixture {
|
||||
this->mock = mock;
|
||||
executionEnvironment = new MockExecutionEnvironment(*platformDevices);
|
||||
executionEnvironment->incRefInternal();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->setDrm(mock);
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
rootDeviceEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
rootDeviceEnvironment->osInterface->get()->setDrm(mock);
|
||||
|
||||
memoryManager = new (std::nothrow) TestedDrmMemoryManager(localMemoryEnabled, false, false, *executionEnvironment);
|
||||
//assert we have memory manager
|
||||
@@ -71,6 +72,7 @@ class DrmMemoryManagerFixture : public MemoryManagementFixture {
|
||||
|
||||
protected:
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
DrmMockCustom::IoctlResExt ioctlResExt = {0, 0};
|
||||
AllocationData allocationData;
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ TEST(FileLogger, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
|
||||
allocation.handle = 4;
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
allocation.memoryPool = MemoryPool::System64KBPages;
|
||||
auto gmm = std::make_unique<Gmm>(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 0, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
allocation.getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly = 0;
|
||||
|
||||
@@ -66,7 +66,7 @@ TEST(FileLogger, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIsNotLogg
|
||||
allocation.handle = 4;
|
||||
allocation.setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
allocation.memoryPool = MemoryPool::System64KBPages;
|
||||
auto gmm = std::make_unique<Gmm>(platform()->peekExecutionEnvironment()->getGmmClientContext(), nullptr, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), nullptr, 0, false);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
allocation.getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly = 0;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ Gmm *getGmm(void *ptr, size_t size) {
|
||||
size_t alignedSize = alignSizeWholePage(ptr, size);
|
||||
void *alignedPtr = alignUp(ptr, 4096);
|
||||
|
||||
Gmm *gmm = new Gmm(platform()->peekExecutionEnvironment()->getGmmClientContext(), alignedPtr, alignedSize, false);
|
||||
Gmm *gmm = new Gmm(platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->getGmmClientContext(), alignedPtr, alignedSize, false);
|
||||
EXPECT_NE(gmm->gmmResourceInfo.get(), nullptr);
|
||||
return gmm;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ TEST_F(Wddm20Tests, doubleCreation) {
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(executionEnvironment->getGmmClientContext(), nullptr, 1, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironemnt->getGmmClientContext(), nullptr, 1, false));
|
||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
@@ -430,7 +430,7 @@ TEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
@@ -467,7 +467,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
@@ -762,7 +762,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
|
||||
gdi->createAllocation = FailingCreateAllocation::mockCreateAllocation;
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment->getGmmClientContext(), fakePtr, 100, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironemnt->getGmmClientContext(), fakePtr, 100, false);
|
||||
WddmAllocation allocation(0, GraphicsAllocation::AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
|
||||
@@ -1153,7 +1153,7 @@ TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoSucceedsThenDeviceCallbacksAr
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoFailsThenDeviceIsNotConfigured) {
|
||||
|
||||
auto gmockGmmMemory = new ::testing::NiceMock<GmockGmmMemory>(executionEnvironment->getGmmClientContext());
|
||||
auto gmockGmmMemory = new ::testing::NiceMock<GmockGmmMemory>(rootDeviceEnvironment->getGmmClientContext());
|
||||
ON_CALL(*gmockGmmMemory, setDeviceInfo(::testing::_))
|
||||
.WillByDefault(::testing::Return(false));
|
||||
EXPECT_CALL(*gmockGmmMemory, configureDeviceAddressSpace(::testing::_,
|
||||
@@ -1172,7 +1172,7 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenNonGen12LPPlatformWhenConfigureDeviceAd
|
||||
if (platformDevices[0]->platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(executionEnvironment->getGmmClientContext());
|
||||
auto gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(rootDeviceEnvironment->getGmmClientContext());
|
||||
wddm->gmmMemory.reset(gmmMemory);
|
||||
ON_CALL(*gmmMemory, configureDeviceAddressSpace(::testing::_,
|
||||
::testing::_,
|
||||
|
||||
@@ -31,11 +31,12 @@ namespace NEO {
|
||||
struct WddmFixture : ::testing::Test {
|
||||
void SetUp() override {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = executionEnvironment->rootDeviceEnvironments[0]->osInterface.get();
|
||||
rootDeviceEnvironemnt = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironemnt));
|
||||
rootDeviceEnvironemnt->osInterface = std::make_unique<OSInterface>();
|
||||
rootDeviceEnvironemnt->osInterface->get()->setWddm(wddm);
|
||||
rootDeviceEnvironemnt->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = rootDeviceEnvironemnt->osInterface.get();
|
||||
gdi = new MockGdi();
|
||||
wddm->resetGdi(gdi);
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
@@ -50,6 +51,7 @@ struct WddmFixture : ::testing::Test {
|
||||
OSInterface *osInterface;
|
||||
std::unique_ptr<OsContextWin> osContext;
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
RootDeviceEnvironment *rootDeviceEnvironemnt = nullptr;
|
||||
|
||||
MockGdi *gdi = nullptr;
|
||||
MockWddmResidentAllocationsContainer *mockTemporaryResources;
|
||||
@@ -58,14 +60,15 @@ struct WddmFixture : ::testing::Test {
|
||||
struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
||||
void SetUp() override {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
GdiDllFixture::SetUp();
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment));
|
||||
wddmMockInterface = new WddmMockInterface20(*wddm);
|
||||
wddm->wddmInterface.reset(wddmMockInterface);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = executionEnvironment->rootDeviceEnvironments[0]->osInterface.get();
|
||||
rootDeviceEnvironment->osInterface = std::make_unique<OSInterface>();
|
||||
rootDeviceEnvironment->osInterface->get()->setWddm(wddm);
|
||||
rootDeviceEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
osInterface = rootDeviceEnvironment->osInterface.get();
|
||||
}
|
||||
|
||||
void init() {
|
||||
@@ -88,13 +91,15 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
|
||||
std::unique_ptr<OsContextWin> osContext;
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
WddmMockInterface20 *wddmMockInterface = nullptr;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
};
|
||||
|
||||
struct WddmInstrumentationGmmFixture {
|
||||
void SetUp() {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get())));
|
||||
gmmMem = new ::testing::NiceMock<GmockGmmMemory>(executionEnvironment->getGmmClientContext());
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment)));
|
||||
gmmMem = new ::testing::NiceMock<GmockGmmMemory>(rootDeviceEnvironment->getGmmClientContext());
|
||||
wddm->gmmMemory.reset(gmmMem);
|
||||
}
|
||||
void TearDown() {
|
||||
|
||||
@@ -40,7 +40,8 @@ class WddmKmDafListenerTest : public ::testing::Test {
|
||||
public:
|
||||
void SetUp() {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
wddmWithKmDafMock.reset(new WddmWithKmDafMock(*executionEnvironment->rootDeviceEnvironments[0].get(), new MockGdi()));
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
wddmWithKmDafMock.reset(new WddmWithKmDafMock(*rootDeviceEnvironment, new MockGdi()));
|
||||
wddmWithKmDafMock->init();
|
||||
wddmWithKmDafMock->featureTable->ftrKmdDaf = true;
|
||||
}
|
||||
@@ -49,6 +50,7 @@ class WddmKmDafListenerTest : public ::testing::Test {
|
||||
|
||||
std::unique_ptr<WddmWithKmDafMock> wddmWithKmDafMock;
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
};
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenLockResourceIsCalledThenKmDafListenerNotifyLockIsFedWithCorrectParams) {
|
||||
@@ -75,7 +77,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
uint64_t gpuPtr = 0u;
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, false);
|
||||
|
||||
wddmWithKmDafMock->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, wddmWithKmDafMock->getGfxPartition().Standard.Base,
|
||||
wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, gpuPtr);
|
||||
@@ -128,7 +130,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, false);
|
||||
auto handle = 0u;
|
||||
auto ptr = reinterpret_cast<void *>(0x10000);
|
||||
|
||||
@@ -142,7 +144,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment->getGmmClientContext(), nullptr, 1, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, false);
|
||||
auto handle = 0u;
|
||||
|
||||
wddmWithKmDafMock->createAllocation64k(gmm.get(), handle);
|
||||
@@ -157,7 +159,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafLi
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
|
||||
OsHandleStorage storage;
|
||||
OsHandle osHandle = {0};
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(executionEnvironment->getGmmClientContext(), nullptr, 1, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, false));
|
||||
storage.fragmentStorageData[0].osHandleStorage = &osHandle;
|
||||
storage.fragmentStorageData[0].fragmentSize = 100;
|
||||
storage.fragmentStorageData[0].osHandleStorage->gmm = gmm.get();
|
||||
|
||||
@@ -39,6 +39,7 @@ void WddmMemoryManagerFixture::SetUp() {
|
||||
GdiDllFixture::SetUp();
|
||||
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||
if (platformDevices[0]->capabilityTable.ftrRenderCompressedBuffers || platformDevices[0]->capabilityTable.ftrRenderCompressedImages) {
|
||||
GMM_TRANSLATIONTABLE_CALLBACKS dummyTTCallbacks = {};
|
||||
@@ -209,7 +210,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(executionEnvironment->getGmmClientContext(), nullptr, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, false));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@@ -229,7 +230,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(executionEnvironment->getGmmClientContext(), nullptr, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, false));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@@ -255,7 +256,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>(executionEnvironment->getGmmClientContext(), nullptr, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, false);
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@@ -473,7 +474,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
@@ -490,7 +491,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1), 0);
|
||||
@@ -522,7 +523,7 @@ TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllocW
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
@@ -545,7 +546,7 @@ TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleDoesNotReturn32Bit
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
@@ -567,7 +568,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
@@ -589,7 +590,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, size, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, size, GraphicsAllocation::AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
@@ -604,7 +605,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, size, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, false));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
wddm->failOpenSharedHandle = true;
|
||||
@@ -946,7 +947,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
|
||||
|
||||
storage.fragmentStorageData[0].osHandleStorage->handle = ALLOCATION_HANDLE;
|
||||
storage.fragmentStorageData[0].freeTheFragment = true;
|
||||
storage.fragmentStorageData[0].osHandleStorage->gmm = new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false);
|
||||
storage.fragmentStorageData[0].osHandleStorage->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false);
|
||||
|
||||
storage.fragmentStorageData[1].osHandleStorage = new OsHandle;
|
||||
storage.fragmentStorageData[1].osHandleStorage->handle = ALLOCATION_HANDLE;
|
||||
@@ -957,7 +958,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
|
||||
storage.fragmentStorageData[2].osHandleStorage = new OsHandle;
|
||||
storage.fragmentStorageData[2].osHandleStorage->handle = ALLOCATION_HANDLE;
|
||||
storage.fragmentStorageData[2].freeTheFragment = true;
|
||||
storage.fragmentStorageData[2].osHandleStorage->gmm = new Gmm(executionEnvironment->getGmmClientContext(), pSysMem, 4096u, false);
|
||||
storage.fragmentStorageData[2].osHandleStorage->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, false);
|
||||
storage.fragmentStorageData[2].residency = new ResidencyData;
|
||||
|
||||
memoryManager->cleanOsHandles(storage, 0);
|
||||
@@ -1002,7 +1003,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(executionEnvironment->getGmmClientContext(), ptr, size, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, false));
|
||||
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
@@ -1016,7 +1017,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(executionEnvironment->getGmmClientContext(), ptr, size, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, false));
|
||||
|
||||
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
||||
memoryManager->setDeferredDeleter(deleter);
|
||||
@@ -1032,7 +1033,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(executionEnvironment->getGmmClientContext(), ptr, size, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, false));
|
||||
|
||||
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
||||
memoryManager->setDeferredDeleter(deleter);
|
||||
@@ -1196,7 +1197,8 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage = new OsHandle();
|
||||
handleStorage.fragmentStorageData[0].residency = new ResidencyData();
|
||||
handleStorage.fragmentStorageData[0].freeTheFragment = true;
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage->gmm = new Gmm(executionEnvironment->getGmmClientContext(), ptr, size, false);
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, false);
|
||||
handleStorage.fragmentCount = 1;
|
||||
|
||||
FragmentStorage fragment = {};
|
||||
@@ -1230,7 +1232,8 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage = new OsHandle();
|
||||
handleStorage.fragmentStorageData[0].residency = new ResidencyData();
|
||||
handleStorage.fragmentStorageData[0].freeTheFragment = true;
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage->gmm = new Gmm(executionEnvironment->getGmmClientContext(), ptr, size, false);
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
handleStorage.fragmentStorageData[0].osHandleStorage->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, false);
|
||||
handleStorage.fragmentCount = 1;
|
||||
|
||||
FragmentStorage fragment = {};
|
||||
@@ -1515,14 +1518,15 @@ TEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledThen
|
||||
}
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpuVaThenMapAuxVa) {
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false));
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false));
|
||||
gmm->isRenderCompressed = true;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||
wddm.init();
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||
rootDeviceEnvironment->pageTableManager.reset(mockMngr);
|
||||
|
||||
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
|
||||
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
|
||||
@@ -1583,14 +1587,15 @@ TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleasei
|
||||
}
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false));
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false));
|
||||
gmm->isRenderCompressed = false;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
WddmMock wddm(*rootDeviceEnvironment);
|
||||
wddm.init();
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||
rootDeviceEnvironment->pageTableManager.reset(mockMngr);
|
||||
|
||||
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
||||
|
||||
@@ -1599,10 +1604,11 @@ TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMappedGp
|
||||
}
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(executionEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false));
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false));
|
||||
gmm->isRenderCompressed = false;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||
WddmMock wddm(*rootDeviceEnvironment);
|
||||
wddm.init();
|
||||
|
||||
auto result = wddm.mapGpuVirtualAddress(gmm.get(), 0, 0, 0, 0, gpuVa);
|
||||
@@ -1615,9 +1621,10 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUnse
|
||||
WddmMemoryManager memoryManager(*executionEnvironment);
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
rootDeviceEnvironment->pageTableManager.reset(mockMngr);
|
||||
|
||||
auto myGmm = new Gmm(executionEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false);
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false);
|
||||
myGmm->isRenderCompressed = false;
|
||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||
|
||||
@@ -1638,9 +1645,10 @@ TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsSetT
|
||||
WddmMemoryManager memoryManager(*executionEnvironment);
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
executionEnvironment->rootDeviceEnvironments[1]->pageTableManager.reset(mockMngr);
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
rootDeviceEnvironment->pageTableManager.reset(mockMngr);
|
||||
|
||||
auto myGmm = new Gmm(executionEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false);
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, false);
|
||||
myGmm->isRenderCompressed = true;
|
||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ class WddmMemoryManagerFixture : public GdiDllFixture {
|
||||
}
|
||||
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
std::unique_ptr<MockWddmMemoryManager> memoryManager;
|
||||
WddmMock *wddm;
|
||||
};
|
||||
@@ -47,17 +48,18 @@ class MockWddmMemoryManagerFixture {
|
||||
public:
|
||||
void SetUp() {
|
||||
executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
gdi = new MockGdi();
|
||||
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *executionEnvironment->rootDeviceEnvironments[0].get()));
|
||||
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment));
|
||||
wddm->resetGdi(gdi);
|
||||
constexpr uint64_t heap32Base = (is32bit) ? 0x1000 : 0x800000000000;
|
||||
wddm->setHeap32(heap32Base, 1000 * MemoryConstants::pageSize - 1);
|
||||
wddm->init();
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new OSInterface());
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->setWddm(wddm);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
rootDeviceEnvironment->osInterface.reset(new OSInterface());
|
||||
rootDeviceEnvironment->osInterface->get()->setWddm(wddm);
|
||||
rootDeviceEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
|
||||
@@ -75,6 +77,7 @@ class MockWddmMemoryManagerFixture {
|
||||
osContext->decRefInternal();
|
||||
}
|
||||
|
||||
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
std::unique_ptr<MockWddmMemoryManager> memoryManager;
|
||||
std::unique_ptr<CommandStreamReceiver> csr;
|
||||
|
||||
@@ -57,7 +57,7 @@ class CreateFromGlTexture : public ::testing::Test {
|
||||
|
||||
void updateImgInfoAndForceGmm() {
|
||||
imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
|
||||
gmm = MockGmm::queryImgParams(clContext.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), imgInfo);
|
||||
gmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmClientContext(), imgInfo);
|
||||
|
||||
tempMM.forceAllocationSize = imgInfo.size;
|
||||
tempMM.forceGmm = gmm.get();
|
||||
@@ -69,7 +69,7 @@ class CreateFromGlTexture : public ::testing::Test {
|
||||
mcsImgDesc.image_width = 128;
|
||||
mcsImgDesc.image_type = CL_MEM_OBJECT_IMAGE2D;
|
||||
auto mcsImgInfo = MockGmm::initImgInfo(mcsImgDesc, 0, nullptr);
|
||||
mcsGmm = MockGmm::queryImgParams(clContext.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), mcsImgInfo);
|
||||
mcsGmm = MockGmm::queryImgParams(clContext.getDevice(0)->getGmmClientContext(), mcsImgInfo);
|
||||
tempMM.forceMcsGmm = mcsGmm.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,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()->setDefaultGmm(new Gmm(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), (void *)0x100, 1, false));
|
||||
glBuffer1->getGraphicsAllocation()->setDefaultGmm(new Gmm(context.getDevice(0)->getGmmClientContext(), (void *)0x100, 1, false));
|
||||
|
||||
std::unique_ptr<Buffer> glBuffer2(GlBuffer::createSharedGlBuffer(&context, CL_MEM_READ_WRITE, bufferId1, &retVal));
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ TEST_F(glSharingTests, givenClGLBufferWhenItIsAcquiredTwiceThenAcuqireIsNotCalle
|
||||
|
||||
TEST_F(glSharingTests, givenClGLBufferWhenItIsCreatedAndGmmIsAvailableThenItIsUsedInGraphicsAllocation) {
|
||||
void *ptr = (void *)0x1000;
|
||||
auto gmm = new Gmm(context.getDevice(0)->getExecutionEnvironment()->getGmmClientContext(), ptr, 4096u, false);
|
||||
auto gmm = new Gmm(context.getDevice(0)->getGmmClientContext(), ptr, 4096u, false);
|
||||
|
||||
mockGlSharing->m_bufferInfoOutput.pGmmResInfo = gmm->gmmResourceInfo->peekHandle();
|
||||
mockGlSharing->uploadDataToBufferInfo();
|
||||
|
||||
@@ -64,7 +64,7 @@ class GlSharingTextureTests : public ::testing::Test {
|
||||
mockGlSharingFunctions = glSharing->sharingFunctions.release();
|
||||
clContext->setSharingFunctions(mockGlSharingFunctions);
|
||||
|
||||
tempMM->forceGmm = MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo);
|
||||
tempMM->forceGmm = MockGmm::queryImgParams(device->getGmmClientContext(), imgInfo);
|
||||
tempMM->forceAllocationSize = textureSize;
|
||||
textureSize = imgInfo.size;
|
||||
textureId = 1;
|
||||
|
||||
@@ -222,7 +222,7 @@ void EncodeMediaInterfaceDescriptorLoad<Family>::encode(CommandContainer &contai
|
||||
|
||||
template <typename Family>
|
||||
void EncodeStateBaseAddress<Family>::encode(CommandContainer &container) {
|
||||
auto gmmHelper = container.getDevice()->getExecutionEnvironment()->getGmmHelper();
|
||||
auto gmmHelper = container.getDevice()->getGmmHelper();
|
||||
|
||||
StateBaseAddressHelper<Family>::programStateBaseAddress(
|
||||
*container.getCommandStream(),
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/command_stream/experimental_command_buffer.h"
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
@@ -228,4 +229,8 @@ bool Device::getHostTimer(uint64_t *hostTimestamp) const {
|
||||
return getOSTime()->getCpuTime(hostTimestamp);
|
||||
}
|
||||
|
||||
GmmClientContext *Device::getGmmClientContext() const {
|
||||
return getGmmHelper()->getClientContext();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/common_types.h"
|
||||
#include "shared/source/helpers/engine_control.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
@@ -45,6 +46,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
EngineControl &getInternalEngine();
|
||||
MemoryManager *getMemoryManager() const;
|
||||
GmmHelper *getGmmHelper() const;
|
||||
GmmClientContext *getGmmClientContext() const;
|
||||
OSTime *getOSTime() const { return osTime.get(); };
|
||||
double getProfilingTimerResolution();
|
||||
double getPlatformHostTimerResolution() const;
|
||||
@@ -129,7 +131,6 @@ inline MemoryManager *Device::getMemoryManager() const {
|
||||
}
|
||||
|
||||
inline GmmHelper *Device::getGmmHelper() const {
|
||||
return executionEnvironment->getGmmHelper();
|
||||
return getRootDeviceEnvironment().getGmmHelper();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/gmm_helper/page_table_mngr.h"
|
||||
#include "shared/source/memory_manager/memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
@@ -27,4 +28,11 @@ void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::st
|
||||
const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const {
|
||||
return executionEnvironment.getHardwareInfo();
|
||||
}
|
||||
|
||||
GmmHelper *RootDeviceEnvironment::getGmmHelper() const {
|
||||
return executionEnvironment.getGmmHelper();
|
||||
}
|
||||
GmmClientContext *RootDeviceEnvironment::getGmmClientContext() const {
|
||||
return executionEnvironment.getGmmClientContext();
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
namespace NEO {
|
||||
|
||||
class AubCenter;
|
||||
class GmmClientContext;
|
||||
class GmmHelper;
|
||||
class ExecutionEnvironment;
|
||||
class GmmPageTableMngr;
|
||||
class MemoryOperationsHandler;
|
||||
@@ -30,6 +32,8 @@ struct RootDeviceEnvironment {
|
||||
|
||||
MOCKABLE_VIRTUAL void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
|
||||
bool initOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId);
|
||||
GmmHelper *getGmmHelper() const;
|
||||
GmmClientContext *getGmmClientContext() const;
|
||||
|
||||
std::unique_ptr<OSInterface> osInterface;
|
||||
std::unique_ptr<GmmPageTableMngr> pageTableManager;
|
||||
|
||||
@@ -380,7 +380,7 @@ GraphicsAllocation *MemoryManager::allocateGraphicsMemory(const AllocationData &
|
||||
}
|
||||
|
||||
GraphicsAllocation *MemoryManager::allocateGraphicsMemoryForImage(const AllocationData &allocationData) {
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.getGmmClientContext(), *allocationData.imgInfo, allocationData.storageInfo);
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), *allocationData.imgInfo, allocationData.storageInfo);
|
||||
|
||||
// AllocationData needs to be reconfigured for System Memory paths
|
||||
AllocationData allocationDataWithSize = allocationData;
|
||||
|
||||
@@ -283,7 +283,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(const AllocationData
|
||||
}
|
||||
|
||||
GraphicsAllocation *DrmMemoryManager::allocateShareableMemory(const AllocationData &allocationData) {
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.getGmmClientContext(), allocationData.hostPtr, allocationData.size, false);
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, allocationData.size, false);
|
||||
size_t bufferSize = allocationData.size;
|
||||
uint64_t gpuRange = acquireGpuRange(bufferSize, false, allocationData.rootDeviceIndex);
|
||||
|
||||
@@ -491,7 +491,7 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
|
||||
}
|
||||
}
|
||||
|
||||
Gmm *gmm = new Gmm(executionEnvironment.getGmmClientContext(), *properties.imgInfo, createStorageInfoFromProperties(properties));
|
||||
Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[properties.rootDeviceIndex]->getGmmClientContext(), *properties.imgInfo, createStorageInfoFromProperties(properties));
|
||||
drmAllocation->setDefaultGmm(gmm);
|
||||
}
|
||||
return drmAllocation;
|
||||
|
||||
@@ -126,7 +126,7 @@ bool Wddm::init() {
|
||||
return false;
|
||||
}
|
||||
if (!gmmMemory) {
|
||||
gmmMemory.reset(GmmMemory::create(rootDeviceEnvironment.executionEnvironment.getGmmClientContext()));
|
||||
gmmMemory.reset(GmmMemory::create(rootDeviceEnvironment.getGmmClientContext()));
|
||||
}
|
||||
|
||||
return configureDeviceAddressSpace();
|
||||
@@ -638,7 +638,7 @@ bool Wddm::openSharedHandle(D3DKMT_HANDLE handle, WddmAllocation *alloc) {
|
||||
alloc->resourceHandle = OpenResource.hResource;
|
||||
|
||||
auto resourceInfo = const_cast<void *>(allocationInfo[0].pPrivateDriverData);
|
||||
alloc->setDefaultGmm(new Gmm(rootDeviceEnvironment.executionEnvironment.getGmmClientContext(), static_cast<GMM_RESOURCE_INFO *>(resourceInfo)));
|
||||
alloc->setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), static_cast<GMM_RESOURCE_INFO *>(resourceInfo)));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -675,7 +675,7 @@ bool Wddm::openNTHandle(HANDLE handle, WddmAllocation *alloc) {
|
||||
alloc->resourceHandle = openResourceFromNtHandle.hResource;
|
||||
|
||||
auto resourceInfo = const_cast<void *>(allocationInfo2[0].pPrivateDriverData);
|
||||
alloc->setDefaultGmm(new Gmm(rootDeviceEnvironment.executionEnvironment.getGmmClientContext(), static_cast<GMM_RESOURCE_INFO *>(resourceInfo)));
|
||||
alloc->setDefaultGmm(new Gmm(rootDeviceEnvironment.getGmmClientContext(), static_cast<GMM_RESOURCE_INFO *>(resourceInfo)));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ WddmMemoryManager::WddmMemoryManager(ExecutionEnvironment &executionEnvironment)
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::allocateShareableMemory(const AllocationData &allocationData) {
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.getGmmClientContext(), allocationData.hostPtr, allocationData.size, false);
|
||||
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), allocationData.hostPtr, allocationData.size, false);
|
||||
auto allocation = std::make_unique<WddmAllocation>(allocationData.rootDeviceIndex, allocationData.type, nullptr, allocationData.size, nullptr, MemoryPool::SystemCpuInaccessible, allocationData.flags.shareable);
|
||||
allocation->setDefaultGmm(gmm.get());
|
||||
if (!createWddmAllocation(allocation.get(), nullptr)) {
|
||||
@@ -81,7 +81,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(const Allocati
|
||||
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(allocationData.rootDeviceIndex, allocationData.type, nullptr, sizeAligned, nullptr, MemoryPool::System64KBPages);
|
||||
|
||||
auto gmm = new Gmm(executionEnvironment.getGmmClientContext(), nullptr, sizeAligned, false, allocationData.flags.preferRenderCompressed, true, {});
|
||||
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), nullptr, sizeAligned, false, allocationData.flags.preferRenderCompressed, true, {});
|
||||
wddmAllocation->setDefaultGmm(gmm);
|
||||
|
||||
if (!getWddm(allocationData.rootDeviceIndex).createAllocation64k(gmm, wddmAllocation->getHandleToModify(0u))) {
|
||||
@@ -112,7 +112,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithAlignment(const
|
||||
auto wddmAllocation = std::make_unique<WddmAllocation>(allocationData.rootDeviceIndex, allocationData.type, pSysMem, sizeAligned, nullptr, MemoryPool::System4KBPages);
|
||||
wddmAllocation->setDriverAllocatedCpuPtr(pSysMem);
|
||||
|
||||
gmm = new Gmm(executionEnvironment.getGmmClientContext(), pSysMem, sizeAligned, allocationData.flags.uncacheable);
|
||||
gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), pSysMem, sizeAligned, allocationData.flags.uncacheable);
|
||||
|
||||
wddmAllocation->setDefaultGmm(gmm);
|
||||
void *mapPtr = wddmAllocation->getAlignedCpuPtr();
|
||||
@@ -147,7 +147,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForNonSvmHostPtr(co
|
||||
allocationData.size, nullptr, MemoryPool::System4KBPages);
|
||||
wddmAllocation->setAllocationOffset(offsetInPage);
|
||||
|
||||
auto gmm = new Gmm(executionEnvironment.getGmmClientContext(), alignedPtr, alignedSize, false);
|
||||
auto gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), alignedPtr, alignedSize, false);
|
||||
|
||||
wddmAllocation->setDefaultGmm(gmm);
|
||||
|
||||
@@ -174,7 +174,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryWithHostPtr(const A
|
||||
auto allocation = new WddmAllocation(allocationData.rootDeviceIndex, allocationData.type, const_cast<void *>(inputPtr), allocationData.size, reserve, MemoryPool::System4KBPages);
|
||||
allocation->setAllocationOffset(offset);
|
||||
|
||||
Gmm *gmm = new Gmm(executionEnvironment.getGmmClientContext(), ptrAligned, sizeAligned, false);
|
||||
Gmm *gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), ptrAligned, sizeAligned, false);
|
||||
allocation->setDefaultGmm(gmm);
|
||||
if (createWddmAllocation(allocation, reserve)) {
|
||||
return allocation;
|
||||
@@ -211,7 +211,7 @@ GraphicsAllocation *WddmMemoryManager::allocate32BitGraphicsMemoryImpl(const All
|
||||
wddmAllocation->set32BitAllocation(true);
|
||||
wddmAllocation->setAllocationOffset(offset);
|
||||
|
||||
gmm = new Gmm(executionEnvironment.getGmmClientContext(), ptrAligned, sizeAligned, false);
|
||||
gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmClientContext(), ptrAligned, sizeAligned, false);
|
||||
wddmAllocation->setDefaultGmm(gmm);
|
||||
|
||||
if (!createWddmAllocation(wddmAllocation.get(), nullptr)) {
|
||||
@@ -417,7 +417,7 @@ MemoryManager::AllocationStatus WddmMemoryManager::populateOsHandles(OsHandleSto
|
||||
handleStorage.fragmentStorageData[i].osHandleStorage = new OsHandle();
|
||||
handleStorage.fragmentStorageData[i].residency = new ResidencyData();
|
||||
|
||||
handleStorage.fragmentStorageData[i].osHandleStorage->gmm = new Gmm(executionEnvironment.getGmmClientContext(), handleStorage.fragmentStorageData[i].cpuPtr,
|
||||
handleStorage.fragmentStorageData[i].osHandleStorage->gmm = new Gmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmClientContext(), handleStorage.fragmentStorageData[i].cpuPtr,
|
||||
handleStorage.fragmentStorageData[i].fragmentSize, false);
|
||||
allocatedFragmentIndexes[allocatedFragmentsCounter] = i;
|
||||
allocatedFragmentsCounter++;
|
||||
|
||||
Reference in New Issue
Block a user