Add obtainRenderBufferCompressionPreference function

Change-Id: I0413a1d754c5ffccb28c8c5432d0149f0757e98e
Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich
2019-03-19 12:57:47 +01:00
committed by sys_ocldev
parent a25cca2099
commit d27b5b59aa
8 changed files with 28 additions and 19 deletions

View File

@@ -40,6 +40,7 @@ class HwHelper {
virtual bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const = 0;
virtual const AubMemDump::LrcaHelper &getCsTraits(EngineInstanceT engineInstance) const = 0;
virtual bool supportsYTiling() const = 0;
virtual bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo) const = 0;
static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo);
static bool renderCompressedImagesSupported(const HardwareInfo &hwInfo);
static bool cacheFlushAfterWalkerSupported(const HardwareInfo &hwInfo);
@@ -120,6 +121,8 @@ class HwHelperHw : public HwHelper {
bool supportsYTiling() const override;
bool obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo) const override;
bool timestampPacketWriteSupported() const override;
bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const override;

View File

@@ -32,6 +32,11 @@ bool HwHelperHw<Family>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const
return false;
}
template <typename Family>
bool HwHelperHw<Family>::obtainRenderBufferCompressionPreference(const HardwareInfo &hwInfo) const {
return true;
}
template <typename Family>
void HwHelperHw<Family>::setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) {
caps->image3DMaxHeight = 16384;

View File

@@ -136,7 +136,8 @@ Buffer *Buffer::create(Context *context,
context->isSharedContext,
context->peekContextType(),
HwHelper::renderCompressedBuffersSupported(context->getDevice(0)->getHardwareInfo()),
memoryManager->isLocalMemorySupported());
memoryManager->isLocalMemorySupported(),
HwHelper::get(context->getDevice(0)->getHardwareInfo().pPlatform->eRenderCoreFamily).obtainRenderBufferCompressionPreference(context->getDevice(0)->getHardwareInfo()));
checkMemory(properties.flags, size, hostPtr, errcodeRet, alignementSatisfied, copyMemoryFromHostPtr, memoryManager);
@@ -337,7 +338,7 @@ void Buffer::checkMemory(cl_mem_flags flags,
GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(const MemoryProperties &properties, bool sharedContext,
ContextType contextType, bool renderCompressedBuffers,
bool isLocalMemoryEnabled) {
bool isLocalMemoryEnabled, bool preferCompression) {
if (is32bit || sharedContext || isValueSet(properties.flags, CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL)) {
return GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
}
@@ -346,7 +347,7 @@ GraphicsAllocation::AllocationType Buffer::getGraphicsAllocationType(const Memor
return GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY;
}
if (MemObjHelper::isSuitableForRenderCompression(renderCompressedBuffers, properties, contextType)) {
if (MemObjHelper::isSuitableForRenderCompression(renderCompressedBuffers, properties, contextType, preferCompression)) {
return GraphicsAllocation::AllocationType::BUFFER_COMPRESSED;
}
return GraphicsAllocation::AllocationType::BUFFER;

View File

@@ -142,7 +142,7 @@ class Buffer : public MemObj {
MemoryManager *memMngr);
static GraphicsAllocation::AllocationType getGraphicsAllocationType(const MemoryProperties &properties, bool sharedContext,
ContextType contextType, bool renderCompressedBuffers,
bool localMemoryEnabled);
bool localMemoryEnabled, bool preferCompression);
static bool isReadOnlyMemoryPermittedByFlags(cl_mem_flags flags);
void transferData(void *dst, void *src, size_t copySize, size_t copyOffset);

View File

@@ -181,7 +181,7 @@ Image *Image::create(Context *context,
auto hostPtrSlicePitch = imageDesc->image_slice_pitch ? imageDesc->image_slice_pitch : hostPtrRowPitch * imageHeight;
auto isTilingAllowed = context->isSharedContext ? false : GmmHelper::allowTiling(*imageDesc);
imgInfo.preferRenderCompression = MemObjHelper::isSuitableForRenderCompression(isTilingAllowed, flags,
context->peekContextType());
context->peekContextType(), true);
bool zeroCopy = false;
bool transferNeeded = false;

View File

@@ -46,7 +46,7 @@ StorageInfo MemObjHelper::getStorageInfo(const MemoryProperties &properties) {
return {};
}
bool MemObjHelper::isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, ContextType contextType) {
bool MemObjHelper::isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, ContextType contextType, bool preferCompression) {
return renderCompressed;
}

View File

@@ -101,7 +101,7 @@ class MemObjHelper {
return isFieldValid(flags, allValidFlags);
}
static bool isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, ContextType contextType);
static bool isSuitableForRenderCompression(bool renderCompressed, const MemoryProperties &properties, ContextType contextType, bool preferCompression);
protected:
static bool checkUsedFlagsForBuffer(const MemoryProperties &properties) {