mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
y-tiling interface cleanup
Change-Id: If7e5ab7135eaa71d9215c87c2fc46188ffd42b02 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
ba2233dc6a
commit
aeb84b3e20
@@ -182,7 +182,7 @@ class VmeBuiltinDispatchInfoBuilder : public BuiltinDispatchInfoBuilder {
|
||||
return CL_INVALID_IMAGE_FORMAT_DESCRIPTOR;
|
||||
}
|
||||
|
||||
if (false == img->isTiledImage) {
|
||||
if (false == img->isTiledAllocation()) {
|
||||
//VME only works with tiled images.
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
@@ -97,23 +97,7 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo) {
|
||||
imageCount = static_cast<uint32_t>(imgInfo.imgDesc->image_array_size);
|
||||
}
|
||||
|
||||
resourceParams.Flags.Info.Linear = 1;
|
||||
|
||||
switch (imgInfo.tilingMode) {
|
||||
case TilingMode::DEFAULT:
|
||||
if (GmmHelper::allowTiling(*imgInfo.imgDesc)) {
|
||||
resourceParams.Flags.Info.TiledY = 1;
|
||||
}
|
||||
break;
|
||||
case TilingMode::TILE_Y:
|
||||
resourceParams.Flags.Info.TiledY = 1;
|
||||
break;
|
||||
case TilingMode::NON_TILED:
|
||||
break;
|
||||
default:
|
||||
UNRECOVERABLE_IF(true);
|
||||
break;
|
||||
}
|
||||
resourceParams.Flags.Info.Linear = imgInfo.linearStorage;
|
||||
|
||||
auto &hwHelper = HwHelper::get(GmmHelper::getInstance()->getHardwareInfo()->platform.eRenderCoreFamily);
|
||||
|
||||
@@ -134,10 +118,6 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo) {
|
||||
}
|
||||
|
||||
applyAuxFlagsForImage(imgInfo);
|
||||
if (!hwHelper.supportsYTiling() && resourceParams.Flags.Info.TiledY == 1) {
|
||||
resourceParams.Flags.Info.Linear = 0;
|
||||
resourceParams.Flags.Info.TiledY = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Gmm::queryImageParams(ImageInfo &imgInfo) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "runtime/helpers/get_info.h"
|
||||
#include "runtime/helpers/hw_info.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/memory_manager/graphics_allocation.h"
|
||||
#include "runtime/os_interface/os_library.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
@@ -81,21 +82,11 @@ void GmmHelper::queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation
|
||||
}
|
||||
|
||||
bool GmmHelper::allowTiling(const cl_image_desc &imageDesc) {
|
||||
// consider returning tiling type instead of bool
|
||||
if (DebugManager.flags.ForceLinearImages.get()) {
|
||||
return false;
|
||||
} else {
|
||||
auto imageType = imageDesc.image_type;
|
||||
auto imageType = imageDesc.image_type;
|
||||
auto buffer = castToObject<Buffer>(imageDesc.buffer);
|
||||
|
||||
if (imageType == CL_MEM_OBJECT_IMAGE1D ||
|
||||
imageType == CL_MEM_OBJECT_IMAGE1D_ARRAY ||
|
||||
imageType == CL_MEM_OBJECT_IMAGE1D_BUFFER ||
|
||||
((imageType == CL_MEM_OBJECT_IMAGE2D && imageDesc.buffer))) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return (!(DebugManager.flags.ForceLinearImages.get() || imageType == CL_MEM_OBJECT_IMAGE1D ||
|
||||
imageType == CL_MEM_OBJECT_IMAGE1D_ARRAY || imageType == CL_MEM_OBJECT_IMAGE1D_BUFFER || buffer));
|
||||
}
|
||||
|
||||
uint64_t GmmHelper::canonize(uint64_t address) {
|
||||
|
||||
@@ -42,7 +42,6 @@ class HwHelper {
|
||||
virtual bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual const AubMemDump::LrcaHelper &getCsTraits(aub_stream::EngineType engineType) const = 0;
|
||||
virtual bool supportsYTiling() const = 0;
|
||||
virtual bool hvAlign4Required() const = 0;
|
||||
virtual bool obtainRenderBufferCompressionPreference(const size_t size) const = 0;
|
||||
virtual void checkResourceCompatibility(Buffer *buffer, cl_int &errorCode) = 0;
|
||||
@@ -129,8 +128,6 @@ class HwHelperHw : public HwHelper {
|
||||
|
||||
bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
bool supportsYTiling() const override;
|
||||
|
||||
bool hvAlign4Required() const override;
|
||||
|
||||
bool obtainRenderBufferCompressionPreference(const size_t size) const override;
|
||||
|
||||
@@ -35,11 +35,6 @@ bool HwHelperHw<GfxFamily>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) con
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::supportsYTiling() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::hvAlign4Required() const {
|
||||
return true;
|
||||
|
||||
@@ -195,13 +195,6 @@ enum class OCLPlane {
|
||||
PLANE_UV
|
||||
};
|
||||
|
||||
enum class TilingMode {
|
||||
DEFAULT = 0,
|
||||
TILE_X = 1,
|
||||
TILE_Y = 2,
|
||||
NON_TILED
|
||||
};
|
||||
|
||||
struct SurfaceFormatInfo {
|
||||
cl_image_format OCLImageFormat;
|
||||
GMM_RESOURCE_FORMAT GMMSurfaceFormat;
|
||||
@@ -226,7 +219,7 @@ struct ImageInfo {
|
||||
GMM_YUV_PLANE_ENUM plane;
|
||||
uint32_t baseMipLevel;
|
||||
uint32_t mipCount;
|
||||
TilingMode tilingMode;
|
||||
bool linearStorage;
|
||||
bool preferRenderCompression;
|
||||
bool useLocalMemory;
|
||||
};
|
||||
|
||||
@@ -46,7 +46,6 @@ Image::Image(Context *context,
|
||||
bool zeroCopy,
|
||||
GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed,
|
||||
bool createTiledImage,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo &surfaceFormatInfo,
|
||||
@@ -62,7 +61,6 @@ Image::Image(Context *context,
|
||||
false,
|
||||
isObjectRedescribed),
|
||||
createFunction(nullptr),
|
||||
isTiledImage(createTiledImage),
|
||||
imageFormat(std::move(imageFormat)),
|
||||
imageDesc(imageDesc),
|
||||
surfaceFormatInfo(surfaceFormatInfo),
|
||||
@@ -183,8 +181,8 @@ Image *Image::create(Context *context,
|
||||
auto hostPtrRowPitch = imageDesc->image_row_pitch ? imageDesc->image_row_pitch : imageWidth * surfaceFormat->ImageElementSizeInBytes;
|
||||
auto hostPtrSlicePitch = imageDesc->image_slice_pitch ? imageDesc->image_slice_pitch : hostPtrRowPitch * imageHeight;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto isTilingAllowed = context->isSharedContext ? false : GmmHelper::allowTiling(*imageDesc) && !memoryProperties.forceLinearStorage;
|
||||
imgInfo.preferRenderCompression = MemObjHelper::isSuitableForRenderCompression(isTilingAllowed, memoryProperties,
|
||||
imgInfo.linearStorage = context->isSharedContext || !GmmHelper::allowTiling(*imageDesc) || memoryProperties.forceLinearStorage;
|
||||
imgInfo.preferRenderCompression = MemObjHelper::isSuitableForRenderCompression(!imgInfo.linearStorage, memoryProperties,
|
||||
context->peekContextType(), true);
|
||||
|
||||
switch (imageDesc->image_type) {
|
||||
@@ -247,7 +245,6 @@ Image *Image::create(Context *context,
|
||||
} else if (parentImage != nullptr) {
|
||||
memory = parentImage->getGraphicsAllocation();
|
||||
memory->getDefaultGmm()->queryImageParams(imgInfo);
|
||||
isTilingAllowed = parentImage->allowTiling();
|
||||
} else {
|
||||
errcodeRet = CL_OUT_OF_HOST_MEMORY;
|
||||
if (isValueSet(properties.flags, CL_MEM_USE_HOST_PTR)) {
|
||||
@@ -316,7 +313,7 @@ Image *Image::create(Context *context,
|
||||
}
|
||||
|
||||
image = createImageHw(context, properties, imgInfo.size, hostPtrToSet, surfaceFormat->OCLImageFormat,
|
||||
imageDescriptor, zeroCopy, memory, false, isTilingAllowed, 0, 0, surfaceFormat);
|
||||
imageDescriptor, zeroCopy, memory, false, 0, 0, surfaceFormat);
|
||||
|
||||
if (context->isProvidingPerformanceHints() && HwHelper::renderCompressedImagesSupported(context->getDevice(0)->getHardwareInfo())) {
|
||||
if (memory->getDefaultGmm()) {
|
||||
@@ -365,7 +362,7 @@ Image *Image::create(Context *context,
|
||||
copyRegion = {{imageWidth, imageHeight, std::max(imageDepth, imageCount)}};
|
||||
}
|
||||
|
||||
if (isTilingAllowed || !MemoryPool::isSystemMemoryPool(memory->getMemoryPool())) {
|
||||
if (!imgInfo.linearStorage || !MemoryPool::isSystemMemoryPool(memory->getMemoryPool())) {
|
||||
auto cmdQ = context->getSpecialQueue();
|
||||
|
||||
if (IsNV12Image(&image->getImageFormat())) {
|
||||
@@ -398,7 +395,7 @@ Image *Image::create(Context *context,
|
||||
Image *Image::createImageHw(Context *context, const MemoryProperties &properties, size_t size, void *hostPtr,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc,
|
||||
bool zeroCopy, GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed, bool createTiledImage, uint32_t baseMipLevel, uint32_t mipCount,
|
||||
bool isObjectRedescribed, uint32_t baseMipLevel, uint32_t mipCount,
|
||||
const SurfaceFormatInfo *surfaceFormatInfo) {
|
||||
const auto device = context->getDevice(0);
|
||||
const auto &hwInfo = device->getHardwareInfo();
|
||||
@@ -406,7 +403,7 @@ Image *Image::createImageHw(Context *context, const MemoryProperties &properties
|
||||
auto funcCreate = imageFactory[hwInfo.platform.eRenderCoreFamily].createImageFunction;
|
||||
DEBUG_BREAK_IF(nullptr == funcCreate);
|
||||
auto image = funcCreate(context, properties, size, hostPtr, imageFormat, imageDesc,
|
||||
zeroCopy, graphicsAllocation, isObjectRedescribed, createTiledImage, baseMipLevel, mipCount, surfaceFormatInfo, nullptr);
|
||||
zeroCopy, graphicsAllocation, isObjectRedescribed, baseMipLevel, mipCount, surfaceFormatInfo, nullptr);
|
||||
DEBUG_BREAK_IF(nullptr == image);
|
||||
image->createFunction = funcCreate;
|
||||
return image;
|
||||
@@ -415,10 +412,8 @@ Image *Image::createImageHw(Context *context, const MemoryProperties &properties
|
||||
Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler, McsSurfaceInfo &mcsSurfaceInfo,
|
||||
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation,
|
||||
cl_mem_flags flags, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) {
|
||||
bool isTiledImage = graphicsAllocation->getDefaultGmm()->gmmResourceInfo->getTileModeSurfaceState() != 0;
|
||||
|
||||
auto sharedImage = createImageHw(context, flags, graphicsAllocation->getUnderlyingBufferSize(),
|
||||
nullptr, imgInfo.surfaceFormat->OCLImageFormat, *imgInfo.imgDesc, false, graphicsAllocation, false, isTiledImage, baseMipLevel, mipCount, imgInfo.surfaceFormat);
|
||||
nullptr, imgInfo.surfaceFormat->OCLImageFormat, *imgInfo.imgDesc, false, graphicsAllocation, false, baseMipLevel, mipCount, imgInfo.surfaceFormat);
|
||||
sharedImage->setSharingHandler(sharingHandler);
|
||||
sharedImage->setMcsAllocation(mcsAllocation);
|
||||
sharedImage->setQPitch(imgInfo.qPitch);
|
||||
@@ -715,7 +710,7 @@ bool Image::isCopyRequired(ImageInfo &imgInfo, const void *hostPtr) {
|
||||
|
||||
auto hostPtrRowPitch = imgInfo.imgDesc->image_row_pitch ? imgInfo.imgDesc->image_row_pitch : imageWidth * imgInfo.surfaceFormat->ImageElementSizeInBytes;
|
||||
auto hostPtrSlicePitch = imgInfo.imgDesc->image_slice_pitch ? imgInfo.imgDesc->image_slice_pitch : hostPtrRowPitch * imgInfo.imgDesc->image_height;
|
||||
auto isTilingAllowed = GmmHelper::allowTiling(*imgInfo.imgDesc);
|
||||
auto isTilingAllowed = GmmHelper::allowTiling(*imgInfo.imgDesc) && !imgInfo.linearStorage;
|
||||
|
||||
size_t pointerPassedSize = hostPtrRowPitch * imageHeight * imageDepth * imageCount;
|
||||
auto alignedSizePassedPointer = alignSizeWholePage(const_cast<void *>(hostPtr), pointerPassedSize);
|
||||
@@ -865,7 +860,6 @@ Image *Image::redescribeFillImage() {
|
||||
this->isMemObjZeroCopy(),
|
||||
this->getGraphicsAllocation(),
|
||||
true,
|
||||
isTiledImage,
|
||||
this->baseMipLevel,
|
||||
this->mipCount,
|
||||
surfaceFormat,
|
||||
@@ -913,7 +907,6 @@ Image *Image::redescribe() {
|
||||
this->isMemObjZeroCopy(),
|
||||
this->getGraphicsAllocation(),
|
||||
true,
|
||||
isTiledImage,
|
||||
this->baseMipLevel,
|
||||
this->mipCount,
|
||||
surfaceFormat,
|
||||
|
||||
@@ -33,7 +33,6 @@ typedef Image *(*ImageCreatFunc)(Context *context,
|
||||
bool zeroCopy,
|
||||
GraphicsAllocation *graphicsAllocation,
|
||||
bool isImageRedescribed,
|
||||
bool createTiledImage,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo *surfaceFormatInfo,
|
||||
@@ -67,7 +66,7 @@ class Image : public MemObj {
|
||||
static Image *createImageHw(Context *context, const MemoryProperties &properties, size_t size, void *hostPtr,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc,
|
||||
bool zeroCopy, GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed, bool createTiledImage, uint32_t baseMipLevel, uint32_t mipCount, const SurfaceFormatInfo *surfaceFormatInfo = nullptr);
|
||||
bool isObjectRedescribed, uint32_t baseMipLevel, uint32_t mipCount, const SurfaceFormatInfo *surfaceFormatInfo = nullptr);
|
||||
|
||||
static Image *createSharedImage(Context *context, SharingHandler *sharingHandler, McsSurfaceInfo &mcsSurfaceInfo,
|
||||
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation,
|
||||
@@ -141,7 +140,6 @@ class Image : public MemObj {
|
||||
void setHostPtrSlicePitch(size_t pitch) { this->hostPtrSlicePitch = pitch; }
|
||||
size_t getImageCount() const { return imageCount; }
|
||||
void setImageCount(size_t imageCount) { this->imageCount = imageCount; }
|
||||
bool allowTiling() const override { return this->isTiledImage; }
|
||||
void setImageRowPitch(size_t rowPitch) { imageDesc.image_row_pitch = rowPitch; }
|
||||
void setImageSlicePitch(size_t slicePitch) { imageDesc.image_slice_pitch = slicePitch; }
|
||||
void setSurfaceOffsets(uint64_t offset, uint32_t xOffset, uint32_t yOffset, uint32_t yOffsetForUVPlane) {
|
||||
@@ -173,8 +171,6 @@ class Image : public MemObj {
|
||||
virtual void transformImage2dArrayTo3d(void *memory) = 0;
|
||||
virtual void transformImage3dTo2dArray(void *memory) = 0;
|
||||
|
||||
const bool isTiledImage;
|
||||
|
||||
bool hasSameDescriptor(const cl_image_desc &imageDesc) const;
|
||||
bool hasValidParentImageFormat(const cl_image_format &imageFormat) const;
|
||||
|
||||
@@ -191,7 +187,6 @@ class Image : public MemObj {
|
||||
bool zeroCopy,
|
||||
GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed,
|
||||
bool createTiledImage,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo &surfaceFormatInfo,
|
||||
@@ -246,13 +241,12 @@ class ImageHw : public Image {
|
||||
bool zeroCopy,
|
||||
GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed,
|
||||
bool createTiledImage,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo &surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets = nullptr)
|
||||
: Image(context, properties, size, hostPtr, imageFormat, imageDesc,
|
||||
zeroCopy, graphicsAllocation, isObjectRedescribed, createTiledImage, baseMipLevel, mipCount, surfaceFormatInfo, surfaceOffsets) {
|
||||
zeroCopy, graphicsAllocation, isObjectRedescribed, baseMipLevel, mipCount, surfaceFormatInfo, surfaceOffsets) {
|
||||
if (getImageDesc().image_type == CL_MEM_OBJECT_IMAGE1D ||
|
||||
getImageDesc().image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER ||
|
||||
getImageDesc().image_type == CL_MEM_OBJECT_IMAGE2D ||
|
||||
@@ -260,6 +254,22 @@ class ImageHw : public Image {
|
||||
getImageDesc().image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY) {
|
||||
this->imageDesc.image_depth = 0;
|
||||
}
|
||||
|
||||
switch (imageDesc.image_type) {
|
||||
case CL_MEM_OBJECT_IMAGE1D:
|
||||
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
|
||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||
surfaceType = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_1D;
|
||||
break;
|
||||
default:
|
||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||
case CL_MEM_OBJECT_IMAGE2D:
|
||||
surfaceType = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_2D;
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE3D:
|
||||
surfaceType = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_3D;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void setImageArg(void *memory, bool setAsMediaBlockImage, uint32_t mipLevel) override;
|
||||
@@ -283,43 +293,24 @@ class ImageHw : public Image {
|
||||
bool zeroCopy,
|
||||
GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed,
|
||||
bool createTiledImage,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo *surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets) {
|
||||
UNRECOVERABLE_IF(surfaceFormatInfo == nullptr);
|
||||
auto image = new ImageHw<GfxFamily>(context,
|
||||
properties,
|
||||
size,
|
||||
hostPtr,
|
||||
imageFormat,
|
||||
imageDesc,
|
||||
zeroCopy,
|
||||
graphicsAllocation,
|
||||
isObjectRedescribed,
|
||||
createTiledImage,
|
||||
baseMipLevel,
|
||||
mipCount,
|
||||
*surfaceFormatInfo,
|
||||
surfaceOffsets);
|
||||
|
||||
switch (imageDesc.image_type) {
|
||||
case CL_MEM_OBJECT_IMAGE1D:
|
||||
case CL_MEM_OBJECT_IMAGE1D_BUFFER:
|
||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||
image->surfaceType = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_1D;
|
||||
break;
|
||||
default:
|
||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||
case CL_MEM_OBJECT_IMAGE2D:
|
||||
image->surfaceType = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_2D;
|
||||
break;
|
||||
case CL_MEM_OBJECT_IMAGE3D:
|
||||
image->surfaceType = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_3D;
|
||||
break;
|
||||
}
|
||||
return image;
|
||||
return new ImageHw<GfxFamily>(context,
|
||||
properties,
|
||||
size,
|
||||
hostPtr,
|
||||
imageFormat,
|
||||
imageDesc,
|
||||
zeroCopy,
|
||||
graphicsAllocation,
|
||||
isObjectRedescribed,
|
||||
baseMipLevel,
|
||||
mipCount,
|
||||
*surfaceFormatInfo,
|
||||
surfaceOffsets);
|
||||
}
|
||||
|
||||
static int getShaderChannelValue(int inputShaderChannel, cl_channel_order imageChannelOrder) {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "runtime/context/context.h"
|
||||
#include "runtime/device/device.h"
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/helpers/get_info.h"
|
||||
#include "runtime/memory_manager/deferred_deleter.h"
|
||||
#include "runtime/memory_manager/internal_allocation_storage.h"
|
||||
@@ -344,8 +345,13 @@ bool MemObj::addMappedPtr(void *ptr, size_t ptrLength, cl_map_flags &mapFlags,
|
||||
mipLevel);
|
||||
}
|
||||
|
||||
bool MemObj::isTiledAllocation() const {
|
||||
auto gmm = graphicsAllocation->getDefaultGmm();
|
||||
return gmm && (gmm->gmmResourceInfo->getTileModeSurfaceState() != 0);
|
||||
}
|
||||
|
||||
bool MemObj::mappingOnCpuAllowed() const {
|
||||
return !allowTiling() && !peekSharingHandler() && !isMipMapped(this) && !DebugManager.flags.DisableZeroCopyForBuffers.get() &&
|
||||
return !isTiledAllocation() && !peekSharingHandler() && !isMipMapped(this) && !DebugManager.flags.DisableZeroCopyForBuffers.get() &&
|
||||
!(graphicsAllocation->getDefaultGmm() && graphicsAllocation->getDefaultGmm()->isRenderCompressed) &&
|
||||
MemoryPool::isSystemMemoryPool(graphicsAllocation->getMemoryPool());
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class MemObj : public BaseObject<_cl_mem> {
|
||||
bool writeMemObjFlagsInvalid();
|
||||
bool mapMemObjFlagsInvalid(cl_map_flags mapFlags);
|
||||
|
||||
virtual bool allowTiling() const { return false; }
|
||||
MOCKABLE_VIRTUAL bool isTiledAllocation() const;
|
||||
|
||||
void *getCpuAddressForMapping();
|
||||
void *getCpuAddressForMemoryTransfer();
|
||||
|
||||
@@ -270,7 +270,7 @@ void OsAgnosticMemoryManager::cleanOsHandles(OsHandleStorage &handleStorage) {
|
||||
GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryForImageImpl(const AllocationData &allocationData, std::unique_ptr<Gmm> gmm) {
|
||||
GraphicsAllocation *alloc = nullptr;
|
||||
|
||||
if (!GmmHelper::allowTiling(*allocationData.imgInfo->imgDesc) && allocationData.imgInfo->mipCount == 0) {
|
||||
if (allocationData.imgInfo->linearStorage && allocationData.imgInfo->mipCount == 0) {
|
||||
alloc = allocateGraphicsMemoryWithAlignment(allocationData);
|
||||
alloc->setDefaultGmm(gmm.release());
|
||||
return alloc;
|
||||
|
||||
@@ -54,7 +54,6 @@ set(RUNTIME_SRCS_OS_INTERFACE_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_linux.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/print.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/tiling_mode_helper.h
|
||||
)
|
||||
|
||||
if(UNIX)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "runtime/os_interface/linux/allocator_helper.h"
|
||||
#include "runtime/os_interface/linux/os_context_linux.h"
|
||||
#include "runtime/os_interface/linux/os_interface.h"
|
||||
#include "runtime/os_interface/linux/tiling_mode_helper.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
|
||||
@@ -264,7 +263,7 @@ DrmAllocation *DrmMemoryManager::allocateGraphicsMemory64kb(const AllocationData
|
||||
}
|
||||
|
||||
GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImageImpl(const AllocationData &allocationData, std::unique_ptr<Gmm> gmm) {
|
||||
if (!GmmHelper::allowTiling(*allocationData.imgInfo->imgDesc)) {
|
||||
if (allocationData.imgInfo->linearStorage) {
|
||||
auto alloc = allocateGraphicsMemoryWithAlignment(allocationData);
|
||||
if (alloc) {
|
||||
alloc->setDefaultGmm(gmm.release());
|
||||
@@ -443,7 +442,10 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
|
||||
DEBUG_BREAK_IF(ret != 0);
|
||||
((void)(ret));
|
||||
|
||||
properties.imgInfo->tilingMode = TilingModeHelper::convert(getTiling.tiling_mode);
|
||||
if (getTiling.tiling_mode == I915_TILING_NONE) {
|
||||
properties.imgInfo->linearStorage = true;
|
||||
}
|
||||
|
||||
Gmm *gmm = new Gmm(*properties.imgInfo, createStorageInfoFromProperties(properties));
|
||||
drmAllocation->setDefaultGmm(gmm);
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct TilingModeHelper {
|
||||
static TilingMode convert(uint32_t i915TilingMode) {
|
||||
switch (i915TilingMode) {
|
||||
case I915_TILING_X:
|
||||
return TilingMode::TILE_X;
|
||||
case I915_TILING_Y:
|
||||
return TilingMode::TILE_Y;
|
||||
case I915_TILING_NONE:
|
||||
default:
|
||||
return TilingMode::NON_TILED;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
@@ -49,7 +49,7 @@ WddmMemoryManager::WddmMemoryManager(ExecutionEnvironment &executionEnvironment)
|
||||
}
|
||||
|
||||
GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemoryForImageImpl(const AllocationData &allocationData, std::unique_ptr<Gmm> gmm) {
|
||||
if (!GmmHelper::allowTiling(*allocationData.imgInfo->imgDesc) && allocationData.imgInfo->mipCount == 0) {
|
||||
if (allocationData.imgInfo->linearStorage && allocationData.imgInfo->mipCount == 0) {
|
||||
return allocateGraphicsMemoryWithAlignment(allocationData);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user