From 2bf08aaa67f5e046dcfadd8af16626a70cc5af68 Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Mon, 20 Sep 2021 11:52:08 +0000 Subject: [PATCH] Set compression format for AUX_MCS_LCE mode Signed-off-by: Maciej Plewka --- .../mem_obj/image_tests_xehp_and_later.cpp | 21 +++++++++++++++++++ .../compression_params_xehp_and_later.inl | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp b/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp index 76d523f79b..23712dde81 100644 --- a/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp +++ b/opencl/test/unit_test/mem_obj/image_tests_xehp_and_later.cpp @@ -663,3 +663,24 @@ HWTEST2_F(XeHPAndLaterImageHelperTests, givenNotMediaCompressedImageWhenAppendin EXPECT_EQ(expectedGetSurfaceStateCompressionFormatCalled, gmmClientContext->getSurfaceStateCompressionFormatCalled); EXPECT_EQ(expectedGetMediaSurfaceStateCompressionFormatCalled, gmmClientContext->getMediaSurfaceStateCompressionFormatCalled); } + +HWTEST2_F(XeHPAndLaterImageHelperTests, givenAuxModeMcsLceWhenAppendingSurfaceStateParamsForCompressionThenCallAppriopriateFunction, CompressionParamsSupportedMatcher) { + using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; + using AUXILIARY_SURFACE_MODE = typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE; + RENDER_SURFACE_STATE rss{}; + platformsImpl->clear(); + rss.setMemoryCompressionEnable(false); + rss.setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_MCS_LCE); + mockGmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true; + gmmClientContext->compressionFormatToReturn = mockCompressionFormat; + const auto expectedGetSurfaceStateCompressionFormatCalled = gmmClientContext->getSurfaceStateCompressionFormatCalled; + const auto expectedGetMediaSurfaceStateCompressionFormatCalled = gmmClientContext->getMediaSurfaceStateCompressionFormatCalled + 1; + + EncodeSurfaceState::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(), + context->getDevice(0)->getGmmHelper(), false); + + EXPECT_EQ(platform(), nullptr); + EXPECT_EQ(mockCompressionFormat, rss.getCompressionFormat()); + EXPECT_EQ(expectedGetSurfaceStateCompressionFormatCalled, gmmClientContext->getSurfaceStateCompressionFormatCalled); + EXPECT_EQ(expectedGetMediaSurfaceStateCompressionFormatCalled, gmmClientContext->getMediaSurfaceStateCompressionFormatCalled); +} \ No newline at end of file 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 da39f49c4c..ee6b989347 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 @@ -13,7 +13,8 @@ namespace NEO { template void EncodeSurfaceState::appendImageCompressionParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation, GmmHelper *gmmHelper, bool imageFromBuffer) { const auto ccsMode = R_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E; - if ((ccsMode == surfaceState->getAuxiliarySurfaceMode() || surfaceState->getMemoryCompressionEnable())) { + 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; auto gmmResourceInfo = allocation->getDefaultGmm()->gmmResourceInfo.get(); if (gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) {