mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 16:45:25 +08:00
Pass context to isSuitableForRenderCompression method
Related-To: NEO-3691 Change-Id: I3417e647f4219451922a4dc905726366b4448890 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
e1ff6603b2
commit
e0594d4716
@@ -501,7 +501,7 @@ TEST_F(PerformanceHintTest, givenUncompressedBufferWhenItsCreatedThenProperPerfo
|
||||
if (context->getMemoryManager()) {
|
||||
isCompressed = MemObjHelper::isSuitableForRenderCompression(
|
||||
HwHelper::renderCompressedBuffersSupported(hwInfo),
|
||||
memoryProperties, context->peekContextType(),
|
||||
memoryProperties, *context,
|
||||
HwHelper::get(hwInfo.platform.eRenderCoreFamily).obtainRenderBufferCompressionPreference(size)) &&
|
||||
!is32bit && !context->isSharedContext &&
|
||||
(!isValueSet(properties.flags, CL_MEM_USE_HOST_PTR) || context->getMemoryManager()->isLocalMemorySupported()) &&
|
||||
|
||||
@@ -330,7 +330,10 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende
|
||||
|
||||
TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, false, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, true, false, true);
|
||||
if (is32bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
} else {
|
||||
@@ -340,7 +343,10 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB
|
||||
|
||||
TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturnedIn64Bit) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, true, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, false, true, true);
|
||||
if (is32bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
} else {
|
||||
@@ -350,13 +356,19 @@ TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocatio
|
||||
|
||||
TEST(Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, true, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = true;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, false, false, true);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
TEST(Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, true, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, false, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = true;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, true, false, true);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
@@ -364,7 +376,10 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQuerie
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, false, false, true);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
@@ -372,7 +387,10 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueried
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, true, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, false, true, true);
|
||||
if (is64bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
|
||||
} else {
|
||||
@@ -384,7 +402,10 @@ TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsRet
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, false, false, true);
|
||||
if (is64bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER, type);
|
||||
} else {
|
||||
@@ -396,7 +417,10 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffers
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, false, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, true, false, true);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
@@ -404,7 +428,10 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, true, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, true, true, true);
|
||||
if (is64bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
|
||||
} else {
|
||||
@@ -416,7 +443,10 @@ TEST(Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemory
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, true, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, true, true, true);
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
}
|
||||
|
||||
@@ -424,7 +454,10 @@ TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocatio
|
||||
MemoryProperties properties;
|
||||
properties.flags = CL_MEM_ALLOC_HOST_PTR;
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(properties);
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true, false, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, true, false, true);
|
||||
if (is64bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
|
||||
} else {
|
||||
@@ -434,7 +467,10 @@ TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocatio
|
||||
|
||||
TEST(Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
|
||||
MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags({});
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, false, ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false, false, true);
|
||||
MockContext context;
|
||||
context.setContextType(ContextType::CONTEXT_TYPE_UNRESTRICTIVE);
|
||||
context.isSharedContext = false;
|
||||
auto type = MockPublicAccessBuffer::getGraphicsAllocationType(memoryProperties, context, false, false, true);
|
||||
if (is32bit) {
|
||||
EXPECT_EQ(GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user