diff --git a/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp b/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp index 3fdd00e587..2747bb9fa9 100644 --- a/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp +++ b/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp @@ -63,8 +63,7 @@ void BlitCommandsHelper::appendColorDepth(const BlitProperties &blitProp template <> void BlitCommandsHelper::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails, - uint32_t &compressionType, const RootDeviceEnvironment &rootDeviceEnvironment, - GMM_YUV_PLANE_ENUM plane) { + const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane) { if (allocation.getDefaultGmm()) { auto gmmResourceInfo = allocation.getDefaultGmm()->gmmResourceInfo.get(); if (!gmmResourceInfo->getResourceFlags()->Info.Linear) { @@ -95,12 +94,11 @@ void BlitCommandsHelper::appendBlitCommandsForImages(const BlitPropertie auto dstRowPitch = static_cast(blitProperties.dstRowPitch); uint32_t mipTailLod = 0; auto compressionDetails = 0u; - auto compressionType = 0u; getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, tileType, mipTailLod, compressionDetails, - compressionType, rootDeviceEnvironment, blitProperties.srcPlane); + rootDeviceEnvironment, blitProperties.srcPlane); getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, tileType, mipTailLod, compressionDetails, - compressionType, rootDeviceEnvironment, blitProperties.dstPlane); + rootDeviceEnvironment, blitProperties.dstPlane); blitCmd.setSourcePitch(srcRowPitch); blitCmd.setDestinationPitch(dstRowPitch); diff --git a/shared/source/generated/xe_hpg_core/hw_cmds_generated_xe_hpg_core.inl b/shared/source/generated/xe_hpg_core/hw_cmds_generated_xe_hpg_core.inl index c0f6c97017..da56320be9 100644 --- a/shared/source/generated/xe_hpg_core/hw_cmds_generated_xe_hpg_core.inl +++ b/shared/source/generated/xe_hpg_core/hw_cmds_generated_xe_hpg_core.inl @@ -3351,7 +3351,7 @@ struct XY_BLOCK_COPY_BLT { uint32_t DestinationPitch : BITFIELD_RANGE(0, 17); uint32_t DestinationAuxiliarysurfacemode : BITFIELD_RANGE(18, 20); uint32_t DestinationMOCS : BITFIELD_RANGE(21, 27); - uint32_t DestinationCompressionType : BITFIELD_RANGE(28, 28); + uint32_t DestinationControlSurfaceType : BITFIELD_RANGE(28, 28); uint32_t DestinationCompressionEnable : BITFIELD_RANGE(29, 29); uint32_t DestinationTiling : BITFIELD_RANGE(30, 31); @@ -3381,7 +3381,7 @@ struct XY_BLOCK_COPY_BLT { uint32_t SourcePitch : BITFIELD_RANGE(0, 17); uint32_t SourceAuxiliarysurfacemode : BITFIELD_RANGE(18, 20); uint32_t SourceMOCS : BITFIELD_RANGE(21, 27); - uint32_t SourceCompressionType : BITFIELD_RANGE(28, 28); + uint32_t SourceControlSurfaceType : BITFIELD_RANGE(28, 28); uint32_t SourceCompressionEnable : BITFIELD_RANGE(29, 29); uint32_t SourceTiling : BITFIELD_RANGE(30, 31); @@ -3497,9 +3497,9 @@ struct XY_BLOCK_COPY_BLT { AUXILIARY_SURFACE_MODE_AUX_CCS_E = 5, }; - enum COMPRESSION_TYPE { - COMPRESSION_TYPE_3D_COMPRESSION = 0, - COMPRESSION_TYPE_MEDIA_COMPRESSION = 1, + enum CONTROL_SURFACE_TYPE { + CONTROL_SURFACE_TYPE_3D = 0, + CONTROL_SURFACE_TYPE_MEDIA = 1, }; enum COMPRESSION_ENABLE { @@ -3619,12 +3619,12 @@ struct XY_BLOCK_COPY_BLT { return (TheStructure.Common.DestinationMOCS); } - inline void setDestinationCompressionType(const COMPRESSION_TYPE value) { - TheStructure.Common.DestinationCompressionType = value; + inline void setDestinationControlSurfaceType(const CONTROL_SURFACE_TYPE value) { + TheStructure.Common.DestinationControlSurfaceType = value; } - inline COMPRESSION_TYPE getDestinationCompressionType() const { - return static_cast(TheStructure.Common.DestinationCompressionType); + inline CONTROL_SURFACE_TYPE getDestinationControlSurfaceType() const { + return static_cast(TheStructure.Common.DestinationControlSurfaceType); } inline void setDestinationCompressionEnable(const COMPRESSION_ENABLE value) { @@ -3747,12 +3747,12 @@ struct XY_BLOCK_COPY_BLT { return (TheStructure.Common.SourceMOCS); } - inline void setSourceCompressionType(const COMPRESSION_TYPE value) { - TheStructure.Common.SourceCompressionType = value; + inline void setSourceControlSurfaceType(const CONTROL_SURFACE_TYPE value) { + TheStructure.Common.SourceControlSurfaceType = value; } - inline COMPRESSION_TYPE getSourceCompressionType() const { - return static_cast(TheStructure.Common.SourceCompressionType); + inline CONTROL_SURFACE_TYPE getSourceControlSurfaceType() const { + return static_cast(TheStructure.Common.SourceControlSurfaceType); } inline void setSourceCompressionEnable(const COMPRESSION_ENABLE value) { @@ -4089,7 +4089,7 @@ struct XY_FAST_COLOR_BLT { uint32_t DestinationPitch : BITFIELD_RANGE(0, 17); uint32_t DestinationAuxiliarysurfacemode : BITFIELD_RANGE(18, 20); uint32_t DestinationMOCS : BITFIELD_RANGE(21, 27); - uint32_t DestinationCompressionType : BITFIELD_RANGE(28, 28); + uint32_t DestinationControlSurfaceType : BITFIELD_RANGE(28, 28); uint32_t DestinationCompressionEnable : BITFIELD_RANGE(29, 29); uint32_t DestinationTiling : BITFIELD_RANGE(30, 31); @@ -4190,9 +4190,9 @@ struct XY_FAST_COLOR_BLT { DESTINATION_CLEAR_VALUE_ENABLE_ENABLE = 1, }; - enum DESTINATION_COMPRESSION_TYPE { - DESTINATION_COMPRESSION_TYPE_3D_COMPRESSION = 0, - DESTINATION_COMPRESSION_TYPE_MEDIA_COMPRESSION = 1, + enum DESTINATION_CONTROL_SURFACE_TYPE { + DESTINATION_CONTROL_SURFACE_TYPE_3D = 0, + DESTINATION_CONTROL_SURFACE_TYPE_MEDIA = 1, }; enum DESTINATION_COMPRESSION_ENABLE { @@ -4304,12 +4304,12 @@ struct XY_FAST_COLOR_BLT { return (TheStructure.Common.DestinationMOCS); } - inline void setDestinationCompressionType(const DESTINATION_COMPRESSION_TYPE value) { - TheStructure.Common.DestinationCompressionType = value; + inline void setDestinationControlSurfaceType(const DESTINATION_CONTROL_SURFACE_TYPE value) { + TheStructure.Common.DestinationControlSurfaceType = value; } - inline DESTINATION_COMPRESSION_TYPE getDestinationCompressionType() const { - return static_cast(TheStructure.Common.DestinationCompressionType); + inline DESTINATION_CONTROL_SURFACE_TYPE getDestinationControlSurfaceType() const { + return static_cast(TheStructure.Common.DestinationControlSurfaceType); } inline void setDestinationCompressionEnable(const DESTINATION_COMPRESSION_ENABLE value) { diff --git a/shared/source/helpers/blit_commands_helper.h b/shared/source/helpers/blit_commands_helper.h index a7294af646..a49a436a08 100644 --- a/shared/source/helpers/blit_commands_helper.h +++ b/shared/source/helpers/blit_commands_helper.h @@ -61,6 +61,7 @@ struct BlitCommandsHelper { static void appendBlitCommandsMemCopy(const BlitProperties &blitProperties, typename GfxFamily::XY_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment); static void appendBlitCommandsBlockCopy(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment); static void appendBlitCommandsForImages(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment, uint32_t &srcSlicePitch, uint32_t &dstSlicePitch); + static void adjustControlSurfaceType(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd); static void appendExtraMemoryProperties(typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment); static void appendExtraMemoryProperties(typename GfxFamily::XY_COLOR_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment); template @@ -72,7 +73,7 @@ struct BlitCommandsHelper { static void appendSliceOffsets(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, uint32_t sliceIndex, const RootDeviceEnvironment &rootDeviceEnvironment, uint32_t srcSlicePitch, uint32_t dstSlicePitch); static void appendBaseAddressOffset(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const uint32_t originalSliceIndex, const bool isSource); static void getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, GMM_TILE_TYPE &tileType, - uint32_t &mipTailLod, uint32_t &compressionDetails, uint32_t &compressionType, + uint32_t &mipTailLod, uint32_t &compressionDetails, const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane); static void dispatchDebugPauseCommands(LinearStream &commandStream, uint64_t debugPauseStateGPUAddress, DebugPauseState confirmationTrigger, DebugPauseState waitCondition, RootDeviceEnvironment &rootDeviceEnvironment); diff --git a/shared/source/helpers/blit_commands_helper_base.inl b/shared/source/helpers/blit_commands_helper_base.inl index 9d136a6b23..722fcc43e2 100644 --- a/shared/source/helpers/blit_commands_helper_base.inl +++ b/shared/source/helpers/blit_commands_helper_base.inl @@ -545,4 +545,7 @@ size_t BlitCommandsHelper::getWaCmdsSize(const BlitPropertiesContaine return 0; } +template +void BlitCommandsHelper::adjustControlSurfaceType(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {} + } // namespace NEO diff --git a/shared/source/helpers/blit_commands_helper_bdw_and_later.inl b/shared/source/helpers/blit_commands_helper_bdw_and_later.inl index c7e1f04630..10603fa344 100644 --- a/shared/source/helpers/blit_commands_helper_bdw_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_bdw_and_later.inl @@ -76,8 +76,7 @@ void BlitCommandsHelper::appendSliceOffsets(const BlitProperties &bli template void BlitCommandsHelper::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails, - uint32_t &compressionType, const RootDeviceEnvironment &rootDeviceEnvironment, - GMM_YUV_PLANE_ENUM plane) { + const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane) { } template diff --git a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl index c6fa62b07a..8eab10e7ed 100644 --- a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl @@ -260,8 +260,7 @@ void BlitCommandsHelper::appendColorDepth(const BlitProperties &blitP template void BlitCommandsHelper::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails, - uint32_t &compressionType, const RootDeviceEnvironment &rootDeviceEnvironment, - GMM_YUV_PLANE_ENUM plane) { + const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane) { using XY_BLOCK_COPY_BLT = typename GfxFamily::XY_BLOCK_COPY_BLT; if (allocation.getDefaultGmm()) { @@ -283,17 +282,14 @@ void BlitCommandsHelper::getBlitAllocationProperties(const GraphicsAl if (resInfo.MediaCompressed) { compressionDetails = gmmClientContext->getMediaSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat()); EncodeWA::adjustCompressionFormatForPlanarImage(compressionDetails, plane); - compressionType = XY_BLOCK_COPY_BLT::COMPRESSION_TYPE::COMPRESSION_TYPE_MEDIA_COMPRESSION; } else if (resInfo.RenderCompressed) { compressionDetails = gmmClientContext->getSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat()); - compressionType = XY_BLOCK_COPY_BLT::COMPRESSION_TYPE::COMPRESSION_TYPE_3D_COMPRESSION; } } } template void BlitCommandsHelper::appendBlitCommandsForImages(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd, const RootDeviceEnvironment &rootDeviceEnvironment, uint32_t &srcSlicePitch, uint32_t &dstSlicePitch) { - using COMPRESSION_TYPE = typename GfxFamily::XY_BLOCK_COPY_BLT::COMPRESSION_TYPE; auto srcTileType = GMM_NOT_TILED; auto dstTileType = GMM_NOT_TILED; auto srcAllocation = blitProperties.srcAllocation; @@ -306,13 +302,11 @@ void BlitCommandsHelper::appendBlitCommandsForImages(const BlitProper auto dstMipTailLod = 0u; auto srcCompressionFormat = blitCmd.getSourceCompressionFormat(); auto dstCompressionFormat = blitCmd.getDestinationCompressionFormat(); - auto srcCompressionType = static_cast(blitCmd.getSourceCompressionType()); - auto dstCompressionType = static_cast(blitCmd.getDestinationCompressionType()); getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, srcTileType, srcMipTailLod, srcCompressionFormat, - srcCompressionType, rootDeviceEnvironment, blitProperties.srcPlane); + rootDeviceEnvironment, blitProperties.srcPlane); getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, dstTileType, dstMipTailLod, dstCompressionFormat, - dstCompressionType, rootDeviceEnvironment, blitProperties.dstPlane); + rootDeviceEnvironment, blitProperties.dstPlane); srcSlicePitch = std::max(srcSlicePitch, srcRowPitch * srcQPitch); dstSlicePitch = std::max(dstSlicePitch, dstRowPitch * dstQPitch); @@ -331,11 +325,10 @@ void BlitCommandsHelper::appendBlitCommandsForImages(const BlitProper blitCmd.setDestinationSurfaceDepth(static_cast(blitProperties.dstSize.z)); blitCmd.setSourceCompressionFormat(srcCompressionFormat); blitCmd.setDestinationCompressionFormat(dstCompressionFormat); - blitCmd.setSourceCompressionType(static_cast(srcCompressionType)); - blitCmd.setDestinationCompressionType(static_cast(dstCompressionType)); appendTilingType(srcTileType, dstTileType, blitCmd); appendClearColor(blitProperties, blitCmd); + adjustControlSurfaceType(blitProperties, blitCmd); } template diff --git a/shared/source/xe_hpg_core/command_stream_receiver_hw_xe_hpg_core.cpp b/shared/source/xe_hpg_core/command_stream_receiver_hw_xe_hpg_core.cpp index 6c3650df4f..20f7c1ef78 100644 --- a/shared/source/xe_hpg_core/command_stream_receiver_hw_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/command_stream_receiver_hw_xe_hpg_core.cpp @@ -43,6 +43,35 @@ MemoryCompressionState CommandStreamReceiverHw::getMemoryCompressionStat return memoryCompressionState; } +template <> +void BlitCommandsHelper::adjustControlSurfaceType(const BlitProperties &blitProperties, typename Family::XY_BLOCK_COPY_BLT &blitCmd) { + using CONTROL_SURFACE_TYPE = typename Family::XY_BLOCK_COPY_BLT::CONTROL_SURFACE_TYPE; + using COMPRESSION_ENABLE = typename Family::XY_BLOCK_COPY_BLT::COMPRESSION_ENABLE; + auto srcAllocation = blitProperties.srcAllocation; + + if (srcAllocation->getDefaultGmm()) { + auto gmmResourceInfo = srcAllocation->getDefaultGmm()->gmmResourceInfo.get(); + auto resInfo = gmmResourceInfo->getResourceFlags()->Info; + if (resInfo.MediaCompressed) { + blitCmd.setSourceControlSurfaceType(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_MEDIA); + } else if (resInfo.RenderCompressed) { + blitCmd.setSourceControlSurfaceType(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_3D); + } + } + + auto dstAllocation = blitProperties.dstAllocation; + if (dstAllocation->getDefaultGmm()) { + auto gmmResourceInfo = dstAllocation->getDefaultGmm()->gmmResourceInfo.get(); + auto resInfo = gmmResourceInfo->getResourceFlags()->Info; + if (resInfo.MediaCompressed) { + blitCmd.setDestinationControlSurfaceType(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_MEDIA); + blitCmd.setDestinationCompressionEnable(COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE); + } else if (resInfo.RenderCompressed) { + blitCmd.setDestinationControlSurfaceType(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_3D); + } + } +} + template class CommandStreamReceiverHw; template struct BlitCommandsHelper; template void BlitCommandsHelper::appendColorDepth(const BlitProperties &blitProperties, typename Family::XY_BLOCK_COPY_BLT &blitCmd); 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 93ce216697..b6d4633af8 100644 --- a/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp +++ b/shared/test/unit_test/helpers/blit_commands_helper_tests.cpp @@ -548,10 +548,9 @@ HWTEST2_F(BlitTests, givenGen9AndGetBlitAllocationPropertiesThenCorrectValuesAre auto expectedtileType = tileType; auto expectedMipTailLod = mipTailLod; auto compressionDetails = 0u; - auto compressionType = 0u; NEO::BlitCommandsHelper::getBlitAllocationProperties(alloc, pitch, qPitch, tileType, mipTailLod, compressionDetails, - compressionType, pDevice->getRootDeviceEnvironment(), + pDevice->getRootDeviceEnvironment(), GMM_YUV_PLANE_ENUM::GMM_NO_PLANE); EXPECT_EQ(expectedPitch, pitch); @@ -705,4 +704,4 @@ HWTEST_F(BlitTests, givenPlatformWhenCallingDispatchPreBlitCommandThenNoneMiFlus auto estimatedSizeWithNode = BlitCommandsHelper::estimateBlitCommandsSize( blitPropertiesContainer2, false, true, false, false, pDevice->getRootDeviceEnvironment()); EXPECT_NE(estimatedSizeWithoutNode, estimatedSizeWithNode); -} \ No newline at end of file +} diff --git a/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp b/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp index 7f22181776..326eaa87c4 100644 --- a/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp +++ b/shared/test/unit_test/helpers/test_blit_commands_helper_xehp_and_later.cpp @@ -591,85 +591,6 @@ HWTEST2_F(BlitTests, givenResourcesWithoutGmmsWhenAppendSurfaceTypeThenSurfaceTy EXPECT_EQ(bltCmd.getDestinationSurfaceType(), dstSurfaceType); } -HWTEST2_F(BlitTests, givenGmmParamsWhenGetBlitAllocationPropertiesIsCalledThenCompressionFormatIsSet, IsXeHpCore) { - std::tuple params[]{ - {false, false, false}, - {false, true, true}, - {true, false, true}}; - - for (auto &[mediaCompressed, renderCompressed, compressionExpected] : params) { - auto gmm = std::make_unique(pDevice->getGmmHelper()); - auto resourceInfo = static_cast(gmm->gmmResourceInfo.get()); - auto &resInfo = resourceInfo->getResourceFlags()->Info; - resInfo.MediaCompressed = mediaCompressed; - resInfo.RenderCompressed = renderCompressed; - MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); - mockAllocationSrc.setGmm(gmm.get(), 0); - BlitProperties properties = {}; - properties.srcAllocation = &mockAllocationSrc; - uint32_t qPitch = static_cast(properties.copySize.y); - GMM_TILE_TYPE tileType = GMM_NOT_TILED; - uint32_t mipTailLod = 0; - uint32_t compressionFormat = 0; - uint32_t compressionType = 0; - auto rowPitch = static_cast(properties.srcRowPitch); - BlitCommandsHelper::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod, - compressionFormat, compressionType, pDevice->getRootDeviceEnvironment(), - GMM_YUV_PLANE_ENUM::GMM_NO_PLANE); - - if (compressionExpected) { - EXPECT_GT(compressionFormat, 0u); - } else { - EXPECT_EQ(compressionFormat, 0u); - } - } -} - -HWTEST2_F(BlitTests, givenGmmParamsWhenGetBlitAllocationPropertiesIsCalledThenCompressionTypeIsSet, IsWithinXeGfxFamily) { - using COMPRESSION_TYPE = typename FamilyType::XY_BLOCK_COPY_BLT::COMPRESSION_TYPE; - constexpr uint32_t undefinedCompressionType = 0x888; - constexpr uint32_t mediaCompressionType = static_cast(COMPRESSION_TYPE::COMPRESSION_TYPE_MEDIA_COMPRESSION); - constexpr uint32_t renderCompressionType = static_cast(COMPRESSION_TYPE::COMPRESSION_TYPE_3D_COMPRESSION); - - std::tuple params[]{ - {false, false, false}, - {false, true, true}, - {true, false, true}}; - - for (auto &[mediaCompressed, renderCompressed, compressionExpected] : params) { - auto gmm = std::make_unique(pDevice->getGmmHelper()); - auto resourceInfo = static_cast(gmm->gmmResourceInfo.get()); - auto &resInfo = resourceInfo->getResourceFlags()->Info; - resInfo.MediaCompressed = mediaCompressed; - resInfo.RenderCompressed = renderCompressed; - MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, - reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), - MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); - mockAllocationSrc.setGmm(gmm.get(), 0); - BlitProperties properties = {}; - properties.srcAllocation = &mockAllocationSrc; - uint32_t qPitch = static_cast(properties.copySize.y); - GMM_TILE_TYPE tileType = GMM_NOT_TILED; - uint32_t mipTailLod = 0; - uint32_t compressionFormat = 0; - uint32_t compressionType = undefinedCompressionType; - auto rowPitch = static_cast(properties.srcRowPitch); - BlitCommandsHelper::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod, - compressionFormat, compressionType, pDevice->getRootDeviceEnvironment(), - GMM_YUV_PLANE_ENUM::GMM_NO_PLANE); - - if (!compressionExpected) { - EXPECT_EQ(compressionType, undefinedCompressionType); - } else if (mediaCompressed) { - EXPECT_EQ(compressionType, mediaCompressionType); - } else { - EXPECT_EQ(compressionType, renderCompressionType); - } - } -} - HWTEST2_F(BlitTests, givenPlaneWhenGetBlitAllocationPropertiesIsCalledThenCompressionFormatIsProperlyAdjusted, CompressionParamsSupportedMatcher) { struct { uint8_t returnedCompressionFormat; @@ -711,14 +632,12 @@ HWTEST2_F(BlitTests, givenPlaneWhenGetBlitAllocationPropertiesIsCalledThenCompre GMM_TILE_TYPE tileType = GMM_NOT_TILED; uint32_t mipTailLod = 0; uint32_t compressionFormat = 0; - uint32_t compressionType = 0; auto rowPitch = static_cast(properties.srcRowPitch); for (auto &testInput : testInputs) { gmmClientContext->compressionFormatToReturn = testInput.returnedCompressionFormat; BlitCommandsHelper::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod, - compressionFormat, compressionType, - pDevice->getRootDeviceEnvironment(), testInput.plane); + compressionFormat, pDevice->getRootDeviceEnvironment(), testInput.plane); EXPECT_EQ(testInput.expectedCompressionFormat, compressionFormat); } @@ -962,7 +881,8 @@ HWTEST2_F(BlitTests, givenLinearResourceInfoWithNotZeroPitchWhenAppendImageComma EXPECT_NE(bltCmd.getSourcePitch(), gmm->gmmResourceInfo->getRenderPitch()); } -HWTEST2_F(BlitTests, givenCompressionInfoWhenAppendImageCommandsThenCorrectPropertiesAreSet, IsXeHpOrXeHpgCore) { +HWTEST2_F(BlitTests, givenCompressionInfoWhenAppendImageCommandsThenCorrectPropertiesAreSet, IsXeHpgCore) { + using COMPRESSION_ENABLE = typename FamilyType::XY_BLOCK_COPY_BLT::COMPRESSION_ENABLE; auto verifyCompressionFormat = [](bool mediaCompressed, bool renderCompressed, uint32_t compressionFormat) { if (mediaCompressed || renderCompressed) { EXPECT_GT(compressionFormat, 0u); @@ -971,16 +891,16 @@ HWTEST2_F(BlitTests, givenCompressionInfoWhenAppendImageCommandsThenCorrectPrope } }; - auto verifyCompressionType = [](bool mediaCompressed, bool renderCompressed, uint32_t compressionType) { - using COMPRESSION_TYPE = typename FamilyType::XY_BLOCK_COPY_BLT::COMPRESSION_TYPE; - constexpr auto mediaCompressionType = static_cast(COMPRESSION_TYPE::COMPRESSION_TYPE_MEDIA_COMPRESSION); - constexpr auto renderCompressionType = static_cast(COMPRESSION_TYPE::COMPRESSION_TYPE_3D_COMPRESSION); + auto verifyControlSurfaceType = [](bool mediaCompressed, bool renderCompressed, uint32_t controlSurfaceType) { + using CONTROL_SURFACE_TYPE = typename FamilyType::XY_BLOCK_COPY_BLT::CONTROL_SURFACE_TYPE; + constexpr auto mediaControlSurfaceType = static_cast(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_MEDIA); + constexpr auto renderControlSurfaceType = static_cast(CONTROL_SURFACE_TYPE::CONTROL_SURFACE_TYPE_3D); if (mediaCompressed) { - EXPECT_EQ(compressionType, mediaCompressionType); + EXPECT_EQ(controlSurfaceType, mediaControlSurfaceType); } else if (renderCompressed) { - EXPECT_EQ(compressionType, renderCompressionType); + EXPECT_EQ(controlSurfaceType, renderControlSurfaceType); } else { - EXPECT_EQ(compressionType, 0u); + EXPECT_EQ(controlSurfaceType, 0u); } }; @@ -1019,14 +939,22 @@ HWTEST2_F(BlitTests, givenCompressionInfoWhenAppendImageCommandsThenCorrectPrope mockAllocationDst.setGmm(gmmDst.get(), 0); properties.dstAllocation = &mockAllocationDst; auto bltCmd = FamilyType::cmdInitXyBlockCopyBlt; + bltCmd.setDestinationCompressionEnable(COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE); + bltCmd.setSourceCompressionEnable(COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE); BlitCommandsHelper::appendBlitCommandsForImages(properties, bltCmd, pDevice->getRootDeviceEnvironment(), srcSlicePitch, dstSlicePitch); verifyCompressionFormat(mediaCompressedSrc, renderCompressedSrc, bltCmd.getSourceCompressionFormat()); verifyCompressionFormat(mediaCompressedDst, renderCompressedDst, bltCmd.getDestinationCompressionFormat()); - verifyCompressionType(mediaCompressedSrc, renderCompressedSrc, bltCmd.getSourceCompressionType()); - verifyCompressionType(mediaCompressedDst, renderCompressedDst, bltCmd.getDestinationCompressionType()); + verifyControlSurfaceType(mediaCompressedSrc, renderCompressedSrc, bltCmd.getSourceControlSurfaceType()); + verifyControlSurfaceType(mediaCompressedDst, renderCompressedDst, bltCmd.getDestinationControlSurfaceType()); + EXPECT_EQ(bltCmd.getSourceCompressionEnable(), COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE); + if (mediaCompressedDst) { + EXPECT_EQ(bltCmd.getDestinationCompressionEnable(), COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_DISABLE); + } else { + EXPECT_EQ(bltCmd.getDestinationCompressionEnable(), COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE); + } } } } @@ -1405,4 +1333,4 @@ HWTEST2_F(BlitTests, givenDispatchDummyBlitWhenForceDummyBlitWaDisabledThenAddit BlitCommandsHelper::dispatchDummyBlit(stream, waArgsWhenBcs); EXPECT_EQ(expectedSize, stream.getUsed()); EXPECT_EQ(nullptr, rootDeviceEnvironment.getDummyAllocation()); -} \ No newline at end of file +}