mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Correct image initialization for linear storage allocations 2/2
Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
580fdd757c
commit
5618d4dfa4
@ -436,22 +436,18 @@ Image *Image::create(Context *context,
|
||||
hostPtr, allocationInfo[rootDeviceIndex].mapAllocation, 0, nullptr, nullptr);
|
||||
}
|
||||
} else {
|
||||
void *pDestinationAddress = allocationInfo[rootDeviceIndex].memory->getUnderlyingBuffer();
|
||||
auto isNotInSystemMemory = !MemoryPool::isSystemMemoryPool(allocationInfo[rootDeviceIndex].memory->getMemoryPool());
|
||||
auto &allocations = image->getMultiGraphicsAllocation().getGraphicsAllocations();
|
||||
if (isNotInSystemMemory) {
|
||||
for (auto &pAllocation : allocations) {
|
||||
context->getMemoryManager()->lockResource(pAllocation);
|
||||
}
|
||||
pDestinationAddress = context->getMemoryManager()->lockResource(allocationInfo[rootDeviceIndex].memory);
|
||||
}
|
||||
|
||||
image->transferData(allocationInfo[rootDeviceIndex].memory->getUnderlyingBuffer(), imgInfo.rowPitch, imgInfo.slicePitch,
|
||||
image->transferData(pDestinationAddress, imgInfo.rowPitch, imgInfo.slicePitch,
|
||||
const_cast<void *>(hostPtr), hostPtrRowPitch, hostPtrSlicePitch,
|
||||
copyRegion, copyOrigin);
|
||||
|
||||
if (isNotInSystemMemory) {
|
||||
for (auto &pAllocation : allocations) {
|
||||
context->getMemoryManager()->unlockResource(pAllocation);
|
||||
}
|
||||
context->getMemoryManager()->unlockResource(allocationInfo[rootDeviceIndex].memory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ class Image : public MemObj {
|
||||
|
||||
void getOsSpecificImageInfo(const cl_mem_info ¶mName, size_t *srcParamSize, void **srcParam);
|
||||
|
||||
void transferData(void *dst, size_t dstRowPitch, size_t dstSlicePitch,
|
||||
MOCKABLE_VIRTUAL void transferData(void *dst, size_t dstRowPitch, size_t dstSlicePitch,
|
||||
void *src, size_t srcRowPitch, size_t srcSlicePitch,
|
||||
std::array<size_t, 3> copyRegion, std::array<size_t, 3> copyOrigin);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -41,8 +41,9 @@ struct MultipleMapImageTest : public ClDeviceFixture, public ::testing::Test {
|
||||
const ClSurfaceFormatInfo *surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets) {
|
||||
auto memoryStorage = multiGraphicsAllocation.getDefaultGraphicsAllocation()->getUnderlyingBuffer();
|
||||
return new MockImage<T>(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, imageFormat, imageDesc, zeroCopy, multiGraphicsAllocation,
|
||||
isObjectRedescribed, baseMipLevel, mipCount, *surfaceFormatInfo, surfaceOffsets);
|
||||
return new MockImage<T>(context, memoryProperties, flags, flagsIntel, size, memoryStorage, hostPtr, imageFormat, imageDesc,
|
||||
zeroCopy, std::move(multiGraphicsAllocation), isObjectRedescribed, baseMipLevel, mipCount,
|
||||
*surfaceFormatInfo, surfaceOffsets);
|
||||
};
|
||||
|
||||
void transferDataToHostPtr(MemObjSizeArray ©Size, MemObjOffsetArray ©Offset) override {
|
||||
|
@ -83,7 +83,9 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
|
||||
|
||||
void *lockResourceImpl(GraphicsAllocation &gfxAllocation) override {
|
||||
lockResourceCalled++;
|
||||
return OsAgnosticMemoryManager::lockResourceImpl(gfxAllocation);
|
||||
auto pLockedMemory = OsAgnosticMemoryManager::lockResourceImpl(gfxAllocation);
|
||||
lockResourcePointers.push_back(pLockedMemory);
|
||||
return pLockedMemory;
|
||||
}
|
||||
|
||||
void unlockResourceImpl(GraphicsAllocation &gfxAllocation) override {
|
||||
@ -121,6 +123,7 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
|
||||
uint32_t freeGraphicsMemoryCalled = 0u;
|
||||
uint32_t unlockResourceCalled = 0u;
|
||||
uint32_t lockResourceCalled = 0u;
|
||||
std::vector<void *> lockResourcePointers;
|
||||
uint32_t handleFenceCompletionCalled = 0u;
|
||||
uint32_t waitForEnginesCompletionCalled = 0u;
|
||||
bool allocationCreated = false;
|
||||
|
@ -495,6 +495,11 @@ bool HwHelperHw<GfxFamily>::useSystemMemoryPlacementForISA(const HardwareInfo &h
|
||||
return !getEnableLocalMemory(hwInfo);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool MemorySynchronizationCommands<GfxFamily>::isPipeControlPriorToPipelineSelectWArequired(const HardwareInfo &hwInfo) {
|
||||
return false;
|
||||
|
@ -98,11 +98,6 @@ uint64_t HwHelperHw<GfxFamily>::getGpuTimeStampInNS(uint64_t timeStamp, double f
|
||||
return static_cast<uint64_t>(timeStamp * frequency);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void MemorySynchronizationCommands<GfxFamily>::addPipeControlWA(LinearStream &commandStream, uint64_t gpuAddress, const HardwareInfo &hwInfo) {
|
||||
}
|
||||
|
Reference in New Issue
Block a user