1414#include " runtime/gmm_helper/resource_info.h"
1515#include " runtime/helpers/array_count.h"
1616#include " runtime/helpers/hw_helper.h"
17+ #include " runtime/helpers/memory_properties_flags_helpers.h"
1718#include " runtime/helpers/options.h"
1819#include " runtime/mem_obj/buffer.h"
1920#include " runtime/memory_manager/allocations_list.h"
@@ -321,8 +322,8 @@ TEST(Buffer, givenAllocHostPtrFlagPassedToBufferCreateWhenNoSharedContextOrRende
321322}
322323
323324TEST (Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturnedIn64Bit) {
324- MemoryProperties properties ;
325- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties , false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , false , true );
325+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags ({}) ;
326+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties , false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , false , true );
326327 if (is32bit) {
327328 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
328329 } else {
@@ -331,8 +332,8 @@ TEST(Buffer, givenRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenB
331332}
332333
333334TEST (Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturnedIn64Bit) {
334- MemoryProperties properties ;
335- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties , false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , true , true );
335+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags ({}) ;
336+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties , false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , true , true );
336337 if (is32bit) {
337338 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
338339 } else {
@@ -341,28 +342,30 @@ TEST(Buffer, givenRenderCompressedBuffersDisabledLocalMemoryEnabledWhenAllocatio
341342}
342343
343344TEST (Buffer, givenSharedContextWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
344- MemoryProperties properties ;
345- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties , true , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , false , true );
345+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags ({}) ;
346+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties , true , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , false , true );
346347 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
347348}
348349
349350TEST (Buffer, givenSharedContextAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
350- MemoryProperties properties ;
351- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties , true , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , false , true );
351+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags ({}) ;
352+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties , true , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , false , true );
352353 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
353354}
354355
355356TEST (Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledWhenAllocationTypeIsQueriedThenBufferHostMemoryTypeIsReturned) {
356357 MemoryProperties properties;
357358 properties.flags = CL_MEM_USE_HOST_PTR;
358- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , false , true );
359+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (properties);
360+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , false , true );
359361 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
360362}
361363
362364TEST (Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
363365 MemoryProperties properties;
364366 properties.flags = CL_MEM_USE_HOST_PTR;
365- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , true , true );
367+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (properties);
368+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , true , true );
366369 if (is64bit) {
367370 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER, type);
368371 } else {
@@ -373,7 +376,8 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledWhenAllocationTypeIsQueried
373376TEST (Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
374377 MemoryProperties properties;
375378 properties.flags = CL_MEM_ALLOC_HOST_PTR;
376- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , false , true );
379+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (properties);
380+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , false , true );
377381 if (is64bit) {
378382 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER, type);
379383 } else {
@@ -384,14 +388,16 @@ TEST(Buffer, givenAllocHostPtrFlagWhenAllocationTypeIsQueriedThenBufferTypeIsRet
384388TEST (Buffer, givenUseHostPtrFlagAndLocalMemoryDisabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
385389 MemoryProperties properties;
386390 properties.flags = CL_MEM_USE_HOST_PTR;
387- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , false , true );
391+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (properties);
392+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , false , true );
388393 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
389394}
390395
391396TEST (Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferMemoryTypeIsReturned) {
392397 MemoryProperties properties;
393398 properties.flags = CL_MEM_USE_HOST_PTR;
394- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , true , true );
399+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (properties);
400+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , true , true );
395401 if (is64bit) {
396402 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
397403 } else {
@@ -402,14 +408,16 @@ TEST(Buffer, givenUseHostPtrFlagAndLocalMemoryEnabledAndRenderCompressedBuffersE
402408TEST (Buffer, givenUseHostPointerFlagAndForceSharedPhysicalStorageWhenLocalMemoryIsEnabledThenBufferHostMemoryTypeIsReturned) {
403409 MemoryProperties properties;
404410 properties.flags = CL_MEM_USE_HOST_PTR | CL_MEM_FORCE_SHARED_PHYSICAL_MEMORY_INTEL;
405- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , true , true );
411+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (properties);
412+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , true , true );
406413 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
407414}
408415
409416TEST (Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocationTypeIsQueriedThenBufferCompressedTypeIsReturned) {
410417 MemoryProperties properties;
411418 properties.flags = CL_MEM_ALLOC_HOST_PTR;
412- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , false , true );
419+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags (properties);
420+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties, false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, true , false , true );
413421 if (is64bit) {
414422 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_COMPRESSED, type);
415423 } else {
@@ -418,8 +426,8 @@ TEST(Buffer, givenAllocHostPtrFlagAndRenderCompressedBuffersEnabledWhenAllocatio
418426}
419427
420428TEST (Buffer, givenZeroFlagsNoSharedContextAndRenderCompressedBuffersDisabledWhenAllocationTypeIsQueriedThenBufferTypeIsReturned) {
421- MemoryProperties properties ;
422- auto type = MockPublicAccessBuffer::getGraphicsAllocationType (properties , false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , false , true );
429+ MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags ({}) ;
430+ auto type = MockPublicAccessBuffer::getGraphicsAllocationType (memoryProperties , false , ContextType::CONTEXT_TYPE_UNRESTRICTIVE, false , false , true );
423431 if (is32bit) {
424432 EXPECT_EQ (GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, type);
425433 } else {
0 commit comments