From 944319b3d996f4645c73594df3d3fdfbf61b2825 Mon Sep 17 00:00:00 2001 From: Filip Hazubski Date: Thu, 21 Apr 2022 12:05:17 +0000 Subject: [PATCH] Correct media compression format for blitter operations on planar images Set most significant bit for chroma planes. Move common logic to helper function. Signed-off-by: Filip Hazubski --- opencl/source/helpers/cl_blit_properties.h | 2 + .../command_stream_receiver_hw_2_tests.cpp | 25 ++++++++ .../command_container/command_encoder.h | 2 + .../command_encoder_bdw_and_later.inl | 4 ++ .../command_encoder_xehp_and_later.inl | 9 +++ .../compression_params_xehp_and_later.inl | 8 +-- .../command_stream_receiver_hw_gen12lp.cpp | 10 +++- shared/source/helpers/blit_commands_helper.h | 6 +- .../blit_commands_helper_bdw_and_later.inl | 4 +- .../blit_commands_helper_xehp_and_later.inl | 11 +++- .../helpers/blit_commands_helper_tests.cpp | 3 +- ...st_blit_commands_helper_xehp_and_later.cpp | 58 ++++++++++++++++++- .../encoders/test_command_encoder.cpp | 14 ++++- 13 files changed, 139 insertions(+), 17 deletions(-) diff --git a/opencl/source/helpers/cl_blit_properties.h b/opencl/source/helpers/cl_blit_properties.h index ec0aab13fe..484fb2e04c 100644 --- a/opencl/source/helpers/cl_blit_properties.h +++ b/opencl/source/helpers/cl_blit_properties.h @@ -185,6 +185,7 @@ struct ClBlitProperties { auto ©Size = blitProperties.copySize; auto &bytesPerPixel = blitProperties.bytesPerPixel; auto &blitDirection = blitProperties.blitDirection; + auto &plane = isSource ? blitProperties.srcPlane : blitProperties.dstPlane; image->getSurfaceOffsets(surfaceOffsets); gpuAddress += surfaceOffsets.offset; @@ -194,6 +195,7 @@ struct ClBlitProperties { bytesPerPixel = image->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes; rowPitch = imageDesc.image_row_pitch; slicePitch = imageDesc.image_slice_pitch; + plane = image->getPlane(); if (imageDesc.image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) { if (blitDirection == BlitterConstants::BlitDirection::HostPtrToImage) { diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp index ab3b03aecd..060a41c08f 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp @@ -1534,6 +1534,31 @@ HWTEST_F(BcsTestsImages, givenImageWithSurfaceOffsetWhenAdjustBlitPropertiesForI EXPECT_EQ(blitProperties.dstGpuAddress, expectedGpuAddress); } +HWTEST_F(BcsTestsImages, givenImageWithPlaneSetWhenAdjustBlitPropertiesForImageIsCalledThenPlaneIsCorrect) { + cl_image_desc imgDesc = Image1dDefaults::imageDesc; + std::unique_ptr image(Image2dArrayHelper<>::create(context.get(), &imgDesc)); + + BlitProperties blitProperties{}; + + EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.dstPlane); + EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.srcPlane); + + ClBlitProperties::adjustBlitPropertiesForImage(image.get(), blitProperties, rowPitch, slicePitch, false); + ClBlitProperties::adjustBlitPropertiesForImage(image.get(), blitProperties, rowPitch, slicePitch, true); + EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.dstPlane); + EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.srcPlane); + + image->setPlane(GMM_YUV_PLANE_ENUM::GMM_PLANE_Y); + ClBlitProperties::adjustBlitPropertiesForImage(image.get(), blitProperties, rowPitch, slicePitch, false); + EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_PLANE_Y, blitProperties.dstPlane); + EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_NO_PLANE, blitProperties.srcPlane); + + image->setPlane(GMM_YUV_PLANE_ENUM::GMM_PLANE_U); + ClBlitProperties::adjustBlitPropertiesForImage(image.get(), blitProperties, rowPitch, slicePitch, true); + EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_PLANE_Y, blitProperties.dstPlane); + EXPECT_EQ(GMM_YUV_PLANE_ENUM::GMM_PLANE_U, blitProperties.srcPlane); +} + HWTEST_F(BcsTests, givenHostPtrToImageWhenConstructPropertiesIsCalledThenValuesAreSetCorrectly) { constexpr size_t hostAllocationSize = MemoryConstants::pageSize; auto hostAllocationPtr = allocateAlignedMemory(hostAllocationSize, MemoryConstants::pageSize); diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index dce354dd22..e60df4310a 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -309,6 +309,8 @@ struct EncodeWA { static void setAdditionalPipeControlFlagsForNonPipelineStateCommand(PipeControlArgs &args); static void addPipeControlBeforeStateBaseAddress(LinearStream &commandStream, const HardwareInfo &hwInfo, bool isRcs); + + static void adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, GMM_YUV_PLANE_ENUM plane); }; template diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index e84540a743..5c02dc68d3 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -438,6 +438,10 @@ inline void EncodeWA::addPipeControlBeforeStateBaseAddress(LinearStre NEO::EncodeWA::addPipeControlPriorToNonPipelinedStateCommand(commandStream, args, hwInfo, isRcs); } +template +inline void EncodeWA::adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, GMM_YUV_PLANE_ENUM plane) { +} + template inline void EncodeSurfaceState::encodeExtraBufferParams(EncodeSurfaceStateArgs &args) { auto surfaceState = reinterpret_cast(args.outMemory); diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index 64bc4a678f..394d823dd7 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -694,6 +694,15 @@ inline void EncodeWA::addPipeControlPriorToNonPipelinedStateCommand(Line MemorySynchronizationCommands::addPipeControl(commandStream, args); } +template +void EncodeWA::adjustCompressionFormatForPlanarImage(uint32_t &compressionFormat, GMM_YUV_PLANE_ENUM plane) { + if (plane == GMM_PLANE_Y) { + compressionFormat &= 0xf; + } else if ((plane == GMM_PLANE_U) || (plane == GMM_PLANE_V)) { + compressionFormat |= 0x10; + } +} + template inline void EncodeStoreMemory::programStoreDataImm(MI_STORE_DATA_IMM *cmdBuffer, uint64_t gpuAddress, diff --git a/shared/source/command_container/image_surface_state/compression_params_xehp_and_later.inl b/shared/source/command_container/image_surface_state/compression_params_xehp_and_later.inl index 71d457d7bb..a2a8c9f624 100644 --- a/shared/source/command_container/image_surface_state/compression_params_xehp_and_later.inl +++ b/shared/source/command_container/image_surface_state/compression_params_xehp_and_later.inl @@ -16,15 +16,11 @@ void EncodeSurfaceState::appendImageCompressionParams(R_SURFACE_STATE *s const auto ccsMode = R_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E; const auto mcsLceMode = R_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_MCS_LCE; if ((ccsMode == surfaceState->getAuxiliarySurfaceMode() || mcsLceMode == surfaceState->getAuxiliarySurfaceMode() || surfaceState->getMemoryCompressionEnable())) { - uint8_t compressionFormat; + uint32_t compressionFormat; auto gmmResourceInfo = allocation->getDefaultGmm()->gmmResourceInfo.get(); if (gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) { compressionFormat = gmmHelper->getClientContext()->getMediaSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat()); - if (plane == GMM_PLANE_Y) { - compressionFormat &= 0xf; - } else if ((plane == GMM_PLANE_U) || (plane == GMM_PLANE_V)) { - compressionFormat |= 0x10; - } + EncodeWA::adjustCompressionFormatForPlanarImage(compressionFormat, plane); } else { compressionFormat = gmmHelper->getClientContext()->getSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat()); } diff --git a/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp b/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp index 8bd53817b6..c3a7df7e4c 100644 --- a/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp +++ b/shared/source/gen12lp/command_stream_receiver_hw_gen12lp.cpp @@ -58,7 +58,9 @@ 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, const RootDeviceEnvironment &rootDeviceEnvironment) { +void BlitCommandsHelper::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, + GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails, + const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane) { if (allocation.getDefaultGmm()) { auto gmmResourceInfo = allocation.getDefaultGmm()->gmmResourceInfo.get(); if (!gmmResourceInfo->getResourceFlags()->Info.Linear) { @@ -90,8 +92,10 @@ void BlitCommandsHelper::appendBlitCommandsForImages(const BlitPropertie uint32_t mipTailLod = 0; auto compressionDetails = 0u; - getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, tileType, mipTailLod, compressionDetails, rootDeviceEnvironment); - getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, tileType, mipTailLod, compressionDetails, rootDeviceEnvironment); + getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, tileType, mipTailLod, compressionDetails, + rootDeviceEnvironment, blitProperties.srcPlane); + getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, tileType, mipTailLod, compressionDetails, + rootDeviceEnvironment, blitProperties.dstPlane); blitCmd.setSourcePitch(srcRowPitch); blitCmd.setDestinationPitch(dstRowPitch); diff --git a/shared/source/helpers/blit_commands_helper.h b/shared/source/helpers/blit_commands_helper.h index d8d1b6bc05..8f16c205a1 100644 --- a/shared/source/helpers/blit_commands_helper.h +++ b/shared/source/helpers/blit_commands_helper.h @@ -83,6 +83,8 @@ struct BlitProperties { Vec3 dstSize = 0; Vec3 srcSize = 0; size_t bytesPerPixel = 1; + GMM_YUV_PLANE_ENUM dstPlane = GMM_YUV_PLANE_ENUM::GMM_NO_PLANE; + GMM_YUV_PLANE_ENUM srcPlane = GMM_YUV_PLANE_ENUM::GMM_NO_PLANE; bool isImageOperation() const { return blitDirection == BlitterConstants::BlitDirection::HostPtrToImage || @@ -157,7 +159,9 @@ struct BlitCommandsHelper { static void appendTilingType(const GMM_TILE_TYPE srcTilingType, const GMM_TILE_TYPE dstTilingType, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd); 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, const RootDeviceEnvironment &rootDeviceEnvironment); + static void getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, GMM_TILE_TYPE &tileType, + 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, const HardwareInfo &hwInfo); static size_t getSizeForDebugPauseCommands(); 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 78991b96a8..07291498cd 100644 --- a/shared/source/helpers/blit_commands_helper_bdw_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_bdw_and_later.inl @@ -74,7 +74,9 @@ 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, const RootDeviceEnvironment &rootDeviceEnvironment) { +void BlitCommandsHelper::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, + GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails, + 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 da81cbf422..97b218b8b1 100644 --- a/shared/source/helpers/blit_commands_helper_xehp_and_later.inl +++ b/shared/source/helpers/blit_commands_helper_xehp_and_later.inl @@ -266,7 +266,9 @@ 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, const RootDeviceEnvironment &rootDeviceEnvironment) { +void BlitCommandsHelper::getBlitAllocationProperties(const GraphicsAllocation &allocation, uint32_t &pitch, uint32_t &qPitch, + GMM_TILE_TYPE &tileType, uint32_t &mipTailLod, uint32_t &compressionDetails, + const RootDeviceEnvironment &rootDeviceEnvironment, GMM_YUV_PLANE_ENUM plane) { if (allocation.getDefaultGmm()) { auto gmmResourceInfo = allocation.getDefaultGmm()->gmmResourceInfo.get(); mipTailLod = gmmResourceInfo->getMipTailStartLodSurfaceState(); @@ -285,6 +287,7 @@ void BlitCommandsHelper::getBlitAllocationProperties(const GraphicsAl auto gmmClientContext = rootDeviceEnvironment.getGmmClientContext(); if (resInfo.MediaCompressed) { compressionDetails = gmmClientContext->getMediaSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat()); + EncodeWA::adjustCompressionFormatForPlanarImage(compressionDetails, plane); } else if (resInfo.RenderCompressed) { compressionDetails = gmmClientContext->getSurfaceStateCompressionFormat(gmmResourceInfo->getResourceFormat()); } @@ -306,8 +309,10 @@ void BlitCommandsHelper::appendBlitCommandsForImages(const BlitProper auto srcCompressionFormat = blitCmd.getSourceCompressionFormat(); auto dstCompressionFormat = blitCmd.getDestinationCompressionFormat(); - getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, srcTileType, srcMipTailLod, srcCompressionFormat, rootDeviceEnvironment); - getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, dstTileType, dstMipTailLod, dstCompressionFormat, rootDeviceEnvironment); + getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, srcTileType, srcMipTailLod, srcCompressionFormat, + rootDeviceEnvironment, blitProperties.srcPlane); + getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, dstTileType, dstMipTailLod, dstCompressionFormat, + rootDeviceEnvironment, blitProperties.dstPlane); srcSlicePitch = std::max(srcSlicePitch, srcRowPitch * srcQPitch); dstSlicePitch = std::max(dstSlicePitch, dstRowPitch * dstQPitch); diff --git a/shared/test/common/helpers/blit_commands_helper_tests.cpp b/shared/test/common/helpers/blit_commands_helper_tests.cpp index ff7bfb20fd..11075e099f 100644 --- a/shared/test/common/helpers/blit_commands_helper_tests.cpp +++ b/shared/test/common/helpers/blit_commands_helper_tests.cpp @@ -529,7 +529,8 @@ HWTEST2_F(BlitTests, givenGen9AndGetBlitAllocationPropertiesThenCorrectValuesAre auto expectedMipTailLod = mipTailLod; auto compressionDetails = 0u; - NEO::BlitCommandsHelper::getBlitAllocationProperties(alloc, pitch, qPitch, tileType, mipTailLod, compressionDetails, pDevice->getRootDeviceEnvironment()); + NEO::BlitCommandsHelper::getBlitAllocationProperties(alloc, pitch, qPitch, tileType, mipTailLod, compressionDetails, + pDevice->getRootDeviceEnvironment(), GMM_YUV_PLANE_ENUM::GMM_NO_PLANE); EXPECT_EQ(expectedPitch, pitch); EXPECT_EQ(expectedQPitch, qPitch); diff --git a/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp b/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp index 0105dcfb32..f5c41cc951 100644 --- a/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp +++ b/shared/test/common/helpers/test_blit_commands_helper_xehp_and_later.cpp @@ -11,6 +11,7 @@ #include "shared/test/common/helpers/blit_commands_helper_tests.inl" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/mocks/mock_gmm.h" +#include "shared/test/common/mocks/mock_gmm_client_context.h" #include "shared/test/common/mocks/ult_device_factory.h" #include "gtest/gtest.h" @@ -606,7 +607,8 @@ HWTEST2_F(BlitTests, givenGmmParamsWhenGetBlitAllocationPropertiesIsCalledThenCo uint32_t mipTailLod = 0; uint32_t compressionFormat = 0; auto rowPitch = static_cast(properties.srcRowPitch); - BlitCommandsHelper::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod, compressionFormat, pDevice->getRootDeviceEnvironment()); + BlitCommandsHelper::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod, + compressionFormat, pDevice->getRootDeviceEnvironment(), GMM_YUV_PLANE_ENUM::GMM_NO_PLANE); if (compressionExpected) { EXPECT_GT(compressionFormat, 0u); @@ -616,6 +618,60 @@ HWTEST2_F(BlitTests, givenGmmParamsWhenGetBlitAllocationPropertiesIsCalledThenCo } } +HWTEST2_F(BlitTests, givenPlaneWhenGetBlitAllocationPropertiesIsCalledThenCompressionFormatIsProperlyAdjusted, CompressionParamsSupportedMatcher) { + using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT; + + struct { + uint8_t returnedCompressionFormat; + uint8_t expectedCompressionFormat; + GMM_YUV_PLANE_ENUM plane; + } testInputs[] = { + // regular image + {0x0, 0x0, GMM_NO_PLANE}, + {0xF, 0xF, GMM_NO_PLANE}, + {0x10, 0x10, GMM_NO_PLANE}, + {0x1F, 0x1F, GMM_NO_PLANE}, + // luma plane + {0x0, 0x0, GMM_PLANE_Y}, + {0xF, 0xF, GMM_PLANE_Y}, + {0x10, 0x0, GMM_PLANE_Y}, + {0x1F, 0xF, GMM_PLANE_Y}, + // chroma plane + {0x0, 0x10, GMM_PLANE_U}, + {0x0, 0x10, GMM_PLANE_V}, + {0xF, 0x1F, GMM_PLANE_U}, + {0xF, 0x1F, GMM_PLANE_V}, + {0x10, 0x10, GMM_PLANE_U}, + {0x10, 0x10, GMM_PLANE_V}, + {0x1F, 0x1F, GMM_PLANE_U}, + {0x1F, 0x1F, GMM_PLANE_V}, + }; + + auto gmm = std::make_unique(pDevice->getGmmClientContext()); + auto &resInfo = static_cast(gmm->gmmResourceInfo.get())->getResourceFlags()->Info; + resInfo.MediaCompressed = true; + MockGraphicsAllocation mockAllocationSrc(0, AllocationType::INTERNAL_HOST_MEMORY, + reinterpret_cast(0x1234), 0x1000, 0, sizeof(uint32_t), + MemoryPool::System4KBPages, MemoryManager::maxOsContextCount); + auto gmmClientContext = static_cast(pDevice->getGmmHelper()->getClientContext()); + 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; + auto rowPitch = static_cast(properties.srcRowPitch); + + for (auto &testInput : testInputs) { + gmmClientContext->compressionFormatToReturn = testInput.returnedCompressionFormat; + BlitCommandsHelper::getBlitAllocationProperties(*properties.srcAllocation, rowPitch, qPitch, tileType, mipTailLod, + compressionFormat, pDevice->getRootDeviceEnvironment(), testInput.plane); + + EXPECT_EQ(testInput.expectedCompressionFormat, compressionFormat); + } +} + HWTEST2_F(BlitTests, givenA0orA1SteppingAndCpuLocalMemoryAccessWhenCallingAppendExtraMemoryPropertiesThenTargetMemoryIsSet, IsXeHpCore) { using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT; DebugManagerStateRestore dbgRestore; diff --git a/shared/test/unit_test/encoders/test_command_encoder.cpp b/shared/test/unit_test/encoders/test_command_encoder.cpp index 885f3d6c24..fcd0bbbcd5 100644 --- a/shared/test/unit_test/encoders/test_command_encoder.cpp +++ b/shared/test/unit_test/encoders/test_command_encoder.cpp @@ -170,4 +170,16 @@ HWTEST_F(CommandEncoderTest, givenPlatformSupportingMiMemFenceWhenEncodingThenPr EXPECT_EQ(0u, size); EXPECT_EQ(0u, cmdStream.getUsed()); } -} \ No newline at end of file +} + +HWTEST2_F(CommandEncoderTest, whenAdjustCompressionFormatForPlanarImageThenNothingHappens, IsAtMostGen12lp) { + for (auto plane : {GMM_NO_PLANE, GMM_PLANE_Y, GMM_PLANE_U, GMM_PLANE_V}) { + uint32_t compressionFormat = 0u; + EncodeWA::adjustCompressionFormatForPlanarImage(compressionFormat, plane); + EXPECT_EQ(0u, compressionFormat); + + compressionFormat = 0xFFu; + EncodeWA::adjustCompressionFormatForPlanarImage(compressionFormat, plane); + EXPECT_EQ(0xFFu, compressionFormat); + } +}