diff --git a/opencl/test/unit_test/xe3_core/command_stream_receiver_hw_tests_xe3_core.cpp b/opencl/test/unit_test/xe3_core/command_stream_receiver_hw_tests_xe3_core.cpp index c676b51916..ca9dcad2b4 100644 --- a/opencl/test/unit_test/xe3_core/command_stream_receiver_hw_tests_xe3_core.cpp +++ b/opencl/test/unit_test/xe3_core/command_stream_receiver_hw_tests_xe3_core.cpp @@ -440,6 +440,10 @@ XE3_CORETEST_F(Xe3BcsTests, givenCompressibleDstBuffersWhenAppendBlitCommandsFor BlitCommandsHelper::appendBlitCommandsForBuffer(blitProperties, *bltCmd, rootDeviceEnvironment); auto compressionFormat = 2; + if (pClDevice->getProductHelper().isCompressionFormatFromGmmRequired()) { + auto resourceFormat = dstAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat(); + compressionFormat = pClDevice->getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); + } EXPECT_EQ(compressionFormat, bltCmd->getCompressionFormat()); } @@ -475,6 +479,10 @@ XE3_CORETEST_F(Xe3BcsTests, givenCompressibleSrcBuffersWhenAppendBlitCommandsFor BlitCommandsHelper::appendBlitCommandsForBuffer(blitProperties, *bltCmd, rootDeviceEnvironment); auto compressionFormat = 2; + if (pClDevice->getProductHelper().isCompressionFormatFromGmmRequired()) { + auto resourceFormat = srcAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat(); + compressionFormat = pClDevice->getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); + } EXPECT_EQ(compressionFormat, bltCmd->getCompressionFormat()); } diff --git a/shared/source/os_interface/product_helper.h b/shared/source/os_interface/product_helper.h index 3fcc7a2641..511ebd02c1 100644 --- a/shared/source/os_interface/product_helper.h +++ b/shared/source/os_interface/product_helper.h @@ -278,6 +278,7 @@ class ProductHelper { virtual bool checkBcsForDirectSubmissionStop() const = 0; virtual bool shouldRegisterEnqueuedWalkerWithProfiling() const = 0; virtual bool isInterruptSupported() const = 0; + virtual bool isCompressionFormatFromGmmRequired() const = 0; virtual bool getStorageInfoLocalOnlyFlag(LocalMemAllocationMode usmDeviceAllocationMode, bool defaultValue) const = 0; virtual ~ProductHelper() = default; diff --git a/shared/source/os_interface/product_helper.inl b/shared/source/os_interface/product_helper.inl index af7b707c09..3251e5b773 100644 --- a/shared/source/os_interface/product_helper.inl +++ b/shared/source/os_interface/product_helper.inl @@ -1103,4 +1103,10 @@ template bool ProductHelperHw::isInterruptSupported() const { return false; } + +template +bool ProductHelperHw::isCompressionFormatFromGmmRequired() const { + return false; +} + } // namespace NEO diff --git a/shared/source/os_interface/product_helper_hw.h b/shared/source/os_interface/product_helper_hw.h index aca251fa0a..a3ac7d184d 100644 --- a/shared/source/os_interface/product_helper_hw.h +++ b/shared/source/os_interface/product_helper_hw.h @@ -215,6 +215,7 @@ class ProductHelperHw : public ProductHelper { bool checkBcsForDirectSubmissionStop() const override; bool shouldRegisterEnqueuedWalkerWithProfiling() const override; bool isInterruptSupported() const override; + bool isCompressionFormatFromGmmRequired() const override; ~ProductHelperHw() override = default; diff --git a/shared/source/xe3_core/command_stream_receiver_hw_xe3_core.cpp b/shared/source/xe3_core/command_stream_receiver_hw_xe3_core.cpp index dce53fbd64..cc4366c5ea 100644 --- a/shared/source/xe3_core/command_stream_receiver_hw_xe3_core.cpp +++ b/shared/source/xe3_core/command_stream_receiver_hw_xe3_core.cpp @@ -171,6 +171,10 @@ void BlitCommandsHelper::appendBlitCommandsMemCopy(const BlitProperties if (dstAllocation) { if (dstAllocation->isCompressionEnabled()) { compressionFormat = 2; + if (rootDeviceEnvironment.getProductHelper().isCompressionFormatFromGmmRequired()) { + auto resourceFormat = dstAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat(); + compressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); + } } } @@ -178,6 +182,10 @@ void BlitCommandsHelper::appendBlitCommandsMemCopy(const BlitProperties if (srcAllocation) { if (srcAllocation->isCompressionEnabled()) { compressionFormat = 2; + if (rootDeviceEnvironment.getProductHelper().isCompressionFormatFromGmmRequired()) { + auto resourceFormat = srcAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat(); + compressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); + } } } } diff --git a/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp b/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp index d2d5de8b35..088054064d 100644 --- a/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp +++ b/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp @@ -9,6 +9,8 @@ #include "shared/source/command_container/command_encoder.h" #include "shared/source/command_stream/command_stream_receiver.h" +#include "shared/source/gmm_helper/client_context/gmm_client_context.h" +#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/helpers/blit_properties.h" #include "shared/source/helpers/definitions/command_encoder_args.h" #include "shared/test/common/cmd_parse/hw_parse.h" @@ -650,8 +652,6 @@ HWTEST2_F(BlitTests, givenXe3CoreWhenAppendBlitCommandsMemCopyIsCalledThenNothin HWTEST2_F(BlitTests, givenXe3CoreWhenDstGraphicAlloctionWhenAppendBlitCommandsMemCopyIsCalledThenCompressionChanged, IsXe3Core) { auto bltCmd = FamilyType::cmdInitXyCopyBlt; BlitProperties properties = {}; - DebugManagerStateRestore dbgRestore; - uint32_t newCompressionFormat = 2; auto gmm = std::make_unique(pDevice->getGmmHelper()); @@ -663,6 +663,11 @@ HWTEST2_F(BlitTests, givenXe3CoreWhenDstGraphicAlloctionWhenAppendBlitCommandsMe properties.dstAllocation = &mockAllocation; properties.srcAllocation = nullptr; NEO::BlitCommandsHelper::appendBlitCommandsMemCopy(properties, bltCmd, pDevice->getRootDeviceEnvironment()); + + if (pDevice->getProductHelper().isCompressionFormatFromGmmRequired()) { + auto resourceFormat = mockAllocation.getDefaultGmm()->gmmResourceInfo->getResourceFormat(); + newCompressionFormat = pDevice->getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat); + } EXPECT_EQ(bltCmd.getCompressionFormat(), newCompressionFormat); }