1
1
/*
2
- * Copyright (C) 2018-2024 Intel Corporation
2
+ * Copyright (C) 2018-2025 Intel Corporation
3
3
*
4
4
* SPDX-License-Identifier: MIT
5
5
*
11
11
#include " shared/source/helpers/compiler_product_helper.h"
12
12
#include " shared/source/helpers/gfx_core_helper.h"
13
13
#include " shared/source/helpers/local_memory_access_modes.h"
14
- #include " shared/source/memory_manager/memory_operations_handler.h"
15
14
#include " shared/source/memory_manager/migration_sync_data.h"
16
15
#include " shared/source/memory_manager/unified_memory_manager.h"
17
16
#include " shared/test/common/fixtures/memory_management_fixture.h"
@@ -775,8 +774,10 @@ TEST_F(CompressedBuffersTests, givenBufferNotCompressedAllocationAndNoHostPtrWhe
775
774
hwInfo->capabilityTable .ftrRenderCompressedBuffers = true ;
776
775
buffer.reset (Buffer::create (context.get (), 0 , bufferSize, nullptr , retVal));
777
776
allocation = buffer->getGraphicsAllocation (device->getRootDeviceIndex ());
778
- auto &gfxCoreHelper = context->getDevice (0 )->getGfxCoreHelper ();
779
- if (gfxCoreHelper.isBufferSizeSuitableForCompression (bufferSize)) {
777
+ auto contextDevice = context->getDevice (0 );
778
+ auto &gfxCoreHelper = contextDevice->getGfxCoreHelper ();
779
+ auto &productHelper = contextDevice->getProductHelper ();
780
+ if (gfxCoreHelper.isBufferSizeSuitableForCompression (bufferSize) && !productHelper.isCompressionForbidden (*hwInfo)) {
780
781
EXPECT_FALSE (buffer->isMemObjZeroCopy ());
781
782
EXPECT_EQ (allocation->getAllocationType (), AllocationType::buffer);
782
783
EXPECT_EQ (!memoryManager->allocate32BitGraphicsMemoryImplCalled , allocation->isCompressionEnabled ());
@@ -797,9 +798,11 @@ TEST_F(CompressedBuffersTests, givenDebugVariableSetWhenHwFlagIsNotSetThenSelect
797
798
798
799
debugManager.flags .RenderCompressedBuffersEnabled .set (1 );
799
800
buffer.reset (Buffer::create (context.get (), 0 , bufferSize, nullptr , retVal));
800
- auto graphicsAllocation = buffer->getGraphicsAllocation (context->getDevice (0 )->getRootDeviceIndex ());
801
- auto &gfxCoreHelper = context->getDevice (0 )->getGfxCoreHelper ();
802
- if (gfxCoreHelper.isBufferSizeSuitableForCompression (bufferSize)) {
801
+ auto contextDevice = context->getDevice (0 );
802
+ auto graphicsAllocation = buffer->getGraphicsAllocation (contextDevice->getRootDeviceIndex ());
803
+ auto &gfxCoreHelper = contextDevice->getGfxCoreHelper ();
804
+ auto &productHelper = contextDevice->getProductHelper ();
805
+ if (gfxCoreHelper.isBufferSizeSuitableForCompression (bufferSize) && !productHelper.isCompressionForbidden (*hwInfo)) {
803
806
EXPECT_EQ (graphicsAllocation->getAllocationType (), AllocationType::buffer);
804
807
EXPECT_EQ (!memoryManager->allocate32BitGraphicsMemoryImplCalled , graphicsAllocation->isCompressionEnabled ());
805
808
} else if (!device->getProductHelper ().isNewCoherencyModelSupported ()) {
@@ -858,9 +861,11 @@ TEST_F(CompressedBuffersCopyHostMemoryTests, givenCompressedBufferWhenCopyFromHo
858
861
hwInfo->capabilityTable .ftrRenderCompressedBuffers = true ;
859
862
860
863
buffer.reset (Buffer::create (context.get (), CL_MEM_COPY_HOST_PTR, bufferSize, hostPtr, retVal));
861
- auto graphicsAllocation = buffer->getGraphicsAllocation (context->getDevice (0 )->getRootDeviceIndex ());
862
- auto &gfxCoreHelper = context->getDevice (0 )->getGfxCoreHelper ();
863
- if (gfxCoreHelper.isBufferSizeSuitableForCompression (bufferSize)) {
864
+ auto contextDevice = context->getDevice (0 );
865
+ auto graphicsAllocation = buffer->getGraphicsAllocation (contextDevice->getRootDeviceIndex ());
866
+ auto &gfxCoreHelper = contextDevice->getGfxCoreHelper ();
867
+ auto &productHelper = contextDevice->getProductHelper ();
868
+ if (gfxCoreHelper.isBufferSizeSuitableForCompression (bufferSize) && !productHelper.isCompressionForbidden (*hwInfo)) {
864
869
EXPECT_TRUE (graphicsAllocation->isCompressionEnabled ());
865
870
EXPECT_EQ (1u , mockCmdQ->writeBufferCounter );
866
871
EXPECT_TRUE (mockCmdQ->writeBufferBlocking );
@@ -900,8 +905,10 @@ TEST_F(CompressedBuffersCopyHostMemoryTests, givenNonCompressedBufferWhenCopyFro
900
905
}
901
906
902
907
TEST_F (CompressedBuffersCopyHostMemoryTests, givenCompressedBufferWhenWriteBufferFailsThenReturnErrorCode) {
903
- auto &gfxCoreHelper = context->getDevice (0 )->getGfxCoreHelper ();
904
- if (is32bit || !gfxCoreHelper.isBufferSizeSuitableForCompression (bufferSize)) {
908
+ auto contextDevice = context->getDevice (0 );
909
+ auto &gfxCoreHelper = contextDevice->getGfxCoreHelper ();
910
+ auto &productHelper = contextDevice->getProductHelper ();
911
+ if (is32bit || !gfxCoreHelper.isBufferSizeSuitableForCompression (bufferSize) || productHelper.isCompressionForbidden (*hwInfo)) {
905
912
return ;
906
913
}
907
914
hwInfo->capabilityTable .ftrRenderCompressedBuffers = true ;
0 commit comments