diff --git a/level_zero/core/source/image/image_hw.inl b/level_zero/core/source/image/image_hw.inl index bcbd681588..c41c9a45ca 100644 --- a/level_zero/core/source/image/image_hw.inl +++ b/level_zero/core/source/image/image_hw.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -192,14 +192,14 @@ ze_result_t ImageCoreFamily::initialize(Device *device, const ze_ { surfaceState = GfxFamily::cmdInitRenderSurfaceState; uint32_t minArrayElement, renderTargetViewExtent, depth; - NEO::setImageSurfaceState(&surfaceState, imgInfo, gmm, *gmmHelper, __GMM_NO_CUBE_MAP, - this->allocation->getGpuAddress(), surfaceOffsets, - isMediaFormatLayout, minArrayElement, renderTargetViewExtent); + NEO::ImageSurfaceStateHelper::setImageSurfaceState(&surfaceState, imgInfo, gmm, *gmmHelper, __GMM_NO_CUBE_MAP, + this->allocation->getGpuAddress(), surfaceOffsets, + isMediaFormatLayout, minArrayElement, renderTargetViewExtent); - NEO::setImageSurfaceStateDimensions(&surfaceState, imgInfo, __GMM_NO_CUBE_MAP, surfaceType, depth); + NEO::ImageSurfaceStateHelper::setImageSurfaceStateDimensions(&surfaceState, imgInfo, __GMM_NO_CUBE_MAP, surfaceType, depth); surfaceState.setSurfaceMinLOD(0u); surfaceState.setMIPCountLOD(0u); - NEO::setMipTailStartLOD(&surfaceState, gmm); + NEO::ImageSurfaceStateHelper::setMipTailStartLOD(&surfaceState, gmm); if (!isMediaFormatLayout) { surfaceState.setShaderChannelSelectRed( @@ -316,14 +316,14 @@ ze_result_t ImageCoreFamily::initialize(Device *device, const ze_ redescribedSurfaceState = GfxFamily::cmdInitRenderSurfaceState; uint32_t minArrayElement, renderTargetViewExtent, depth; - NEO::setImageSurfaceState(&redescribedSurfaceState, imgInfoRedescirebed, gmm, *gmmHelper, - __GMM_NO_CUBE_MAP, this->allocation->getGpuAddress(), surfaceOffsets, - desc->format.layout == ZE_IMAGE_FORMAT_LAYOUT_NV12, minArrayElement, renderTargetViewExtent); + NEO::ImageSurfaceStateHelper::setImageSurfaceState(&redescribedSurfaceState, imgInfoRedescirebed, gmm, *gmmHelper, + __GMM_NO_CUBE_MAP, this->allocation->getGpuAddress(), surfaceOffsets, + desc->format.layout == ZE_IMAGE_FORMAT_LAYOUT_NV12, minArrayElement, renderTargetViewExtent); - NEO::setImageSurfaceStateDimensions(&redescribedSurfaceState, imgInfoRedescirebed, __GMM_NO_CUBE_MAP, surfaceType, depth); + NEO::ImageSurfaceStateHelper::setImageSurfaceStateDimensions(&redescribedSurfaceState, imgInfoRedescirebed, __GMM_NO_CUBE_MAP, surfaceType, depth); redescribedSurfaceState.setSurfaceMinLOD(0u); redescribedSurfaceState.setMIPCountLOD(0u); - NEO::setMipTailStartLOD(&redescribedSurfaceState, gmm); + NEO::ImageSurfaceStateHelper::setMipTailStartLOD(&redescribedSurfaceState, gmm); if (imgInfoRedescirebed.surfaceFormat->gmmSurfaceFormat == GMM_FORMAT_R8_UINT_TYPE || imgInfoRedescirebed.surfaceFormat->gmmSurfaceFormat == GMM_FORMAT_R16_UINT_TYPE || @@ -364,7 +364,7 @@ void ImageCoreFamily::copySurfaceStateToSSH(void *surfaceStateHea &surfaceState, sizeof(RENDER_SURFACE_STATE)); if (isMediaBlockArg) { RENDER_SURFACE_STATE *dstRss = static_cast(destSurfaceState); - NEO::setWidthForMediaBlockSurfaceState(dstRss, imgInfo); + NEO::ImageSurfaceStateHelper::setWidthForMediaBlockSurfaceState(dstRss, imgInfo); } } diff --git a/opencl/source/mem_obj/image.inl b/opencl/source/mem_obj/image.inl index f71c520207..c2bf104df3 100644 --- a/opencl/source/mem_obj/image.inl +++ b/opencl/source/mem_obj/image.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,6 +10,7 @@ #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/gmm_helper/gmm.h" #include "shared/source/gmm_helper/gmm_helper.h" +#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/populate_factory.h" #include "shared/source/image/image_surface_state.h" @@ -41,7 +42,7 @@ void ImageHw::setImageArg(void *memory, bool setAsMediaBlockImage, ui uint32_t renderTargetViewExtent = 0; uint32_t minArrayElement = 0; - setImageSurfaceState(surfaceState, imgInfo, graphicsAllocation->getDefaultGmm(), *gmmHelper, cubeFaceIndex, graphicsAllocation->getGpuAddress(), surfaceOffsets, isNV12Image(&this->getImageFormat()), minArrayElement, renderTargetViewExtent); + ImageSurfaceStateHelper::setImageSurfaceState(surfaceState, imgInfo, graphicsAllocation->getDefaultGmm(), *gmmHelper, cubeFaceIndex, graphicsAllocation->getGpuAddress(), surfaceOffsets, isNV12Image(&this->getImageFormat()), minArrayElement, renderTargetViewExtent); uint32_t depth = 0; @@ -58,16 +59,16 @@ void ImageHw::setImageArg(void *memory, bool setAsMediaBlockImage, ui surfaceState->setSurfacePitch(static_cast(getSurfaceFormatInfo().surfaceFormat.imageElementSizeInBytes)); surfaceState->setSurfaceType(RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER); } else { - setImageSurfaceStateDimensions(surfaceState, imgInfo, cubeFaceIndex, surfaceType, depth); + ImageSurfaceStateHelper::setImageSurfaceStateDimensions(surfaceState, imgInfo, cubeFaceIndex, surfaceType, depth); if (setAsMediaBlockImage) { - setWidthForMediaBlockSurfaceState(surfaceState, imgInfo); + ImageSurfaceStateHelper::setWidthForMediaBlockSurfaceState(surfaceState, imgInfo); } } uint32_t mipCount = this->mipCount > 0 ? this->mipCount - 1 : 0; surfaceState->setSurfaceMinLOD(this->baseMipLevel + mipLevel); surfaceState->setMIPCountLOD(mipCount); - setMipTailStartLOD(surfaceState, gmm); + ImageSurfaceStateHelper::setMipTailStartLOD(surfaceState, gmm); cl_channel_order imgChannelOrder = getSurfaceFormatInfo().oclImageFormat.image_channel_order; int shaderChannelValue = ImageHw::getShaderChannelValue(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_RED, imgChannelOrder); @@ -119,7 +120,7 @@ void ImageHw::setAuxParamsForMultisamples(RENDER_SURFACE_STATE *surfa surfaceState->setAuxiliarySurfacePitch(mcsGmm->getUnifiedAuxPitchTiles()); surfaceState->setAuxiliarySurfaceQPitch(mcsGmm->getAuxQPitch()); EncodeSurfaceState::setClearColorParams(surfaceState, mcsGmm); - setUnifiedAuxBaseAddress(surfaceState, mcsGmm); + ImageSurfaceStateHelper::setUnifiedAuxBaseAddress(surfaceState, mcsGmm); } else if (mcsGmm->unifiedAuxTranslationCapable()) { EncodeSurfaceState::setImageAuxParamsForCCS(surfaceState, mcsGmm); } else { diff --git a/opencl/test/unit_test/mem_obj/image_tests.cpp b/opencl/test/unit_test/mem_obj/image_tests.cpp index 91f763ff1b..2e92be7a25 100644 --- a/opencl/test/unit_test/mem_obj/image_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image_tests.cpp @@ -1705,7 +1705,7 @@ HWTEST_F(ImageTransformTest, givenSurfaceBaseAddressAndUnifiedSurfaceWhenSetUnif EXPECT_EQ(0u, surfaceState.getAuxiliarySurfaceBaseAddress()); - setUnifiedAuxBaseAddress(&surfaceState, gmm.get()); + ImageSurfaceStateHelper::setUnifiedAuxBaseAddress(&surfaceState, gmm.get()); uint64_t offset = gmm->gmmResourceInfo->getUnifiedAuxSurfaceOffset(GMM_UNIFIED_AUX_TYPE::GMM_AUX_SURF); EXPECT_EQ(surfBsaseAddress + offset, surfaceState.getAuxiliarySurfaceBaseAddress()); diff --git a/shared/source/command_container/command_encoder_pre_xe2_hpg_core.inl b/shared/source/command_container/command_encoder_pre_xe2_hpg_core.inl index 9546c4affb..1c41d792d4 100644 --- a/shared/source/command_container/command_encoder_pre_xe2_hpg_core.inl +++ b/shared/source/command_container/command_encoder_pre_xe2_hpg_core.inl @@ -1,11 +1,13 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ +#include "shared/source/gmm_helper/gmm.h" #include "shared/source/gmm_helper/gmm_helper.h" +#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/release_helper/release_helper.h" namespace NEO { @@ -70,7 +72,7 @@ void EncodeSurfaceState::setImageAuxParamsForCCS(R_SURFACE_STATE *surfac setFlagsForMediaCompression(surfaceState, gmm); setClearColorParams(surfaceState, gmm); - setUnifiedAuxBaseAddress(surfaceState, gmm); + ImageSurfaceStateHelper::setUnifiedAuxBaseAddress(surfaceState, gmm); } template diff --git a/shared/source/command_container/command_encoder_xe2_hpg_core_and_later.inl b/shared/source/command_container/command_encoder_xe2_hpg_core_and_later.inl index 4e7865e653..43b635dbea 100644 --- a/shared/source/command_container/command_encoder_xe2_hpg_core_and_later.inl +++ b/shared/source/command_container/command_encoder_xe2_hpg_core_and_later.inl @@ -6,7 +6,9 @@ */ #include "shared/source/gmm_helper/client_context/gmm_client_context.h" +#include "shared/source/gmm_helper/gmm.h" #include "shared/source/gmm_helper/gmm_helper.h" +#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/helpers/hw_walk_order.h" namespace NEO { 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 0098e94630..9a3c0b1137 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -16,6 +16,7 @@ #include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/gmm_helper/client_context/gmm_client_context.h" +#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/helpers/basic_math.h" #include "shared/source/helpers/cache_policy.h" #include "shared/source/helpers/compiler_product_helper.h" diff --git a/shared/source/gen12lp/image_core_gen12lp.cpp b/shared/source/gen12lp/image_core_gen12lp.cpp index b941a30462..cc60f20a30 100644 --- a/shared/source/gen12lp/image_core_gen12lp.cpp +++ b/shared/source/gen12lp/image_core_gen12lp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,7 +10,11 @@ namespace NEO { -using Family = Gen12LpFamily; +using GfxFamily = Gen12LpFamily; +} -#include "shared/source/image/image_skl_and_later.inl" +#include "shared/source/image/image_surface_state.inl" + +namespace NEO { +template class ImageSurfaceStateHelper; } // namespace NEO diff --git a/shared/source/image/CMakeLists.txt b/shared/source/image/CMakeLists.txt index 2611f81940..e2253a068b 100644 --- a/shared/source/image/CMakeLists.txt +++ b/shared/source/image/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2020-2023 Intel Corporation +# Copyright (C) 2020-2025 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -7,7 +7,7 @@ set(NEO_CORE_IMAGE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state.h - ${CMAKE_CURRENT_SOURCE_DIR}/image_skl_and_later.inl + ${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state.inl ) set_property(GLOBAL PROPERTY NEO_CORE_IMAGE ${NEO_CORE_IMAGE}) diff --git a/shared/source/image/image_skl_and_later.inl b/shared/source/image/image_skl_and_later.inl deleted file mode 100644 index fd665bff9e..0000000000 --- a/shared/source/image/image_skl_and_later.inl +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (C) 2020-2024 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -template <> -void setMipTailStartLOD(Family::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) { - surfaceState->setMipTailStartLOD(0); - - if (gmm != nullptr) { - surfaceState->setMipTailStartLOD(gmm->gmmResourceInfo->getMipTailStartLODSurfaceState()); - } -} diff --git a/shared/source/image/image_surface_state.h b/shared/source/image/image_surface_state.h index c4bd681ecf..bfcb6390bc 100644 --- a/shared/source/image/image_surface_state.h +++ b/shared/source/image/image_surface_state.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,135 +7,25 @@ #pragma once -#include "shared/source/command_container/encode_surface_state.h" -#include "shared/source/debug_settings/debug_settings_manager.h" -#include "shared/source/gmm_helper/gmm.h" -#include "shared/source/gmm_helper/gmm_helper.h" -#include "shared/source/gmm_helper/resource_info.h" -#include "shared/source/helpers/basic_math.h" -#include "shared/source/helpers/surface_format_info.h" +#include namespace NEO { + +class Gmm; +struct SurfaceOffsets; +class GmmHelper; +struct ImageInfo; + template -inline void setImageSurfaceState(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo, Gmm *gmm, GmmHelper &gmmHelper, uint32_t cubeFaceIndex, uint64_t gpuAddress, const SurfaceOffsets &surfaceOffsets, bool isNV12Format, uint32_t &minimumArrayElement, uint32_t &renderTargetViewExtent) { +class ImageSurfaceStateHelper { + public: using RENDER_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE; - using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT; - using AUXILIARY_SURFACE_MODE = typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE; - - auto imageCount = std::max(imageInfo.imgDesc.imageDepth, imageInfo.imgDesc.imageArraySize); - if (imageCount == 0) { - imageCount = 1; - } - - bool isImageArray = imageInfo.imgDesc.imageArraySize > 1 && - (imageInfo.imgDesc.imageType == ImageType::image2DArray || - imageInfo.imgDesc.imageType == ImageType::image1DArray); - - isImageArray |= (imageInfo.imgDesc.imageType == ImageType::image2D || imageInfo.imgDesc.imageType == ImageType::image2DArray) && debugManager.flags.Force2dImageAsArray.get() == 1; - - renderTargetViewExtent = static_cast(imageCount); - minimumArrayElement = 0; - auto hAlign = RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT_HALIGN_DEFAULT; - auto vAlign = RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4; - - if (gmm) { - hAlign = static_cast(gmm->gmmResourceInfo->getHAlignSurfaceState()); - vAlign = static_cast(gmm->gmmResourceInfo->getVAlignSurfaceState()); - } - - if (cubeFaceIndex != __GMM_NO_CUBE_MAP) { - isImageArray = true; - renderTargetViewExtent = 1; - minimumArrayElement = cubeFaceIndex; - } - - surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE); - surfaceState->setAuxiliarySurfacePitch(1u); - surfaceState->setAuxiliarySurfaceQPitch(0u); - surfaceState->setAuxiliarySurfaceBaseAddress(0u); - surfaceState->setRenderTargetViewExtent(renderTargetViewExtent); - surfaceState->setMinimumArrayElement(minimumArrayElement); - - // SurfaceQpitch is in rows but must be a multiple of VALIGN - surfaceState->setSurfaceQPitch(imageInfo.qPitch); - - surfaceState->setSurfaceArray(isImageArray); - - surfaceState->setSurfaceHorizontalAlignment(hAlign); - surfaceState->setSurfaceVerticalAlignment(vAlign); - - uint32_t tileMode = gmm ? gmm->gmmResourceInfo->getTileModeSurfaceState() - : static_cast(RENDER_SURFACE_STATE::TILE_MODE_LINEAR); - - surfaceState->setTileMode(static_cast(tileMode)); - - surfaceState->setMemoryObjectControlState(gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE)); - - EncodeSurfaceState::setCoherencyType(surfaceState, RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT); - - surfaceState->setMultisampledSurfaceStorageFormat(RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_MSS); - - surfaceState->setSurfaceBaseAddress(gpuAddress + surfaceOffsets.offset); - surfaceState->setXOffset(surfaceOffsets.xOffset); - surfaceState->setYOffset(surfaceOffsets.yOffset); - - if (isNV12Format) { - surfaceState->setShaderChannelSelectAlpha(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_ONE); - surfaceState->setYOffsetForUOrUvPlane(surfaceOffsets.yOffsetForUVplane); - surfaceState->setXOffsetForUOrUvPlane(surfaceOffsets.xOffset); - } else { - surfaceState->setShaderChannelSelectAlpha(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_ALPHA); - surfaceState->setYOffsetForUOrUvPlane(0); - surfaceState->setXOffsetForUOrUvPlane(0); - } - - surfaceState->setSurfaceFormat(static_cast(imageInfo.surfaceFormat->genxSurfaceFormat)); -} - -template -inline void setImageSurfaceStateDimensions(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo, uint32_t cubeFaceIndex, typename GfxFamily::RENDER_SURFACE_STATE::SURFACE_TYPE surfaceType, uint32_t &depth) { - auto imageCount = std::max(imageInfo.imgDesc.imageDepth, imageInfo.imgDesc.imageArraySize); - if (imageCount == 0) { - imageCount = 1; - } - - auto imageHeight = imageInfo.imgDesc.imageHeight; - if (imageHeight == 0) { - imageHeight = 1; - } - - auto imageWidth = imageInfo.imgDesc.imageWidth; - if (imageWidth == 0) { - imageWidth = 1; - } - - if (cubeFaceIndex != __GMM_NO_CUBE_MAP) { - imageCount = __GMM_MAX_CUBE_FACE - cubeFaceIndex; - } - - depth = static_cast(imageCount); - surfaceState->setWidth(static_cast(imageWidth)); - surfaceState->setHeight(static_cast(imageHeight)); - surfaceState->setDepth(depth); - surfaceState->setSurfacePitch(static_cast(imageInfo.imgDesc.imageRowPitch)); - surfaceState->setSurfaceType(surfaceType); -} - -template -inline void setWidthForMediaBlockSurfaceState(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo) { - auto elSize = imageInfo.surfaceFormat->imageElementSizeInBytes; - auto numDwords = static_cast(Math::divideAndRoundUp(imageInfo.imgDesc.imageWidth * elSize, sizeof(uint32_t))); - surfaceState->setWidth(numDwords); -} - -template -inline void setUnifiedAuxBaseAddress(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm) { - uint64_t baseAddress = surfaceState->getSurfaceBaseAddress() + - gmm->gmmResourceInfo->getUnifiedAuxSurfaceOffset(GMM_UNIFIED_AUX_TYPE::GMM_AUX_SURF); - surfaceState->setAuxiliarySurfaceBaseAddress(baseAddress); -} - -template -void setMipTailStartLOD(typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, Gmm *gmm); + using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE; + static void setImageSurfaceState(RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo, Gmm *gmm, GmmHelper &gmmHelper, uint32_t cubeFaceIndex, uint64_t gpuAddress, const SurfaceOffsets &surfaceOffsets, bool isNV12Format, uint32_t &minimumArrayElement, uint32_t &renderTargetViewExtent); + static void setImageSurfaceStateDimensions(RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo, uint32_t cubeFaceIndex, SURFACE_TYPE surfaceType, uint32_t &depth); + static void setWidthForMediaBlockSurfaceState(RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo); + static void setUnifiedAuxBaseAddress(RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm); + static void setMipTailStartLOD(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm); +}; } // namespace NEO diff --git a/shared/source/image/image_surface_state.inl b/shared/source/image/image_surface_state.inl new file mode 100644 index 0000000000..b6de6dff38 --- /dev/null +++ b/shared/source/image/image_surface_state.inl @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2025 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/command_container/encode_surface_state.h" +#include "shared/source/debug_settings/debug_settings_manager.h" +#include "shared/source/gmm_helper/gmm.h" +#include "shared/source/gmm_helper/gmm_helper.h" +#include "shared/source/gmm_helper/resource_info.h" +#include "shared/source/helpers/basic_math.h" +#include "shared/source/helpers/surface_format_info.h" +#include "shared/source/image/image_surface_state.h" + +namespace NEO { + +template +void ImageSurfaceStateHelper::setImageSurfaceState(RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo, Gmm *gmm, GmmHelper &gmmHelper, uint32_t cubeFaceIndex, uint64_t gpuAddress, const SurfaceOffsets &surfaceOffsets, bool isNV12Format, uint32_t &minimumArrayElement, uint32_t &renderTargetViewExtent) { + + using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT; + using AUXILIARY_SURFACE_MODE = typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE; + + auto imageCount = std::max(imageInfo.imgDesc.imageDepth, imageInfo.imgDesc.imageArraySize); + if (imageCount == 0) { + imageCount = 1; + } + + bool isImageArray = imageInfo.imgDesc.imageArraySize > 1 && + (imageInfo.imgDesc.imageType == ImageType::image2DArray || + imageInfo.imgDesc.imageType == ImageType::image1DArray); + + isImageArray |= (imageInfo.imgDesc.imageType == ImageType::image2D || imageInfo.imgDesc.imageType == ImageType::image2DArray) && debugManager.flags.Force2dImageAsArray.get() == 1; + + renderTargetViewExtent = static_cast(imageCount); + minimumArrayElement = 0; + auto hAlign = RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT_HALIGN_DEFAULT; + auto vAlign = RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4; + + if (gmm) { + hAlign = static_cast(gmm->gmmResourceInfo->getHAlignSurfaceState()); + vAlign = static_cast(gmm->gmmResourceInfo->getVAlignSurfaceState()); + } + + if (cubeFaceIndex != __GMM_NO_CUBE_MAP) { + isImageArray = true; + renderTargetViewExtent = 1; + minimumArrayElement = cubeFaceIndex; + } + + surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE); + surfaceState->setAuxiliarySurfacePitch(1u); + surfaceState->setAuxiliarySurfaceQPitch(0u); + surfaceState->setAuxiliarySurfaceBaseAddress(0u); + surfaceState->setRenderTargetViewExtent(renderTargetViewExtent); + surfaceState->setMinimumArrayElement(minimumArrayElement); + + // SurfaceQpitch is in rows but must be a multiple of VALIGN + surfaceState->setSurfaceQPitch(imageInfo.qPitch); + + surfaceState->setSurfaceArray(isImageArray); + + surfaceState->setSurfaceHorizontalAlignment(hAlign); + surfaceState->setSurfaceVerticalAlignment(vAlign); + + uint32_t tileMode = gmm ? gmm->gmmResourceInfo->getTileModeSurfaceState() + : static_cast(RENDER_SURFACE_STATE::TILE_MODE_LINEAR); + + surfaceState->setTileMode(static_cast(tileMode)); + + surfaceState->setMemoryObjectControlState(gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE)); + + EncodeSurfaceState::setCoherencyType(surfaceState, RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT); + + surfaceState->setMultisampledSurfaceStorageFormat(RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_MSS); + + surfaceState->setSurfaceBaseAddress(gpuAddress + surfaceOffsets.offset); + surfaceState->setXOffset(surfaceOffsets.xOffset); + surfaceState->setYOffset(surfaceOffsets.yOffset); + + if (isNV12Format) { + surfaceState->setShaderChannelSelectAlpha(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_ONE); + surfaceState->setYOffsetForUOrUvPlane(surfaceOffsets.yOffsetForUVplane); + surfaceState->setXOffsetForUOrUvPlane(surfaceOffsets.xOffset); + } else { + surfaceState->setShaderChannelSelectAlpha(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_ALPHA); + surfaceState->setYOffsetForUOrUvPlane(0); + surfaceState->setXOffsetForUOrUvPlane(0); + } + + surfaceState->setSurfaceFormat(static_cast(imageInfo.surfaceFormat->genxSurfaceFormat)); +} + +template +void ImageSurfaceStateHelper::setImageSurfaceStateDimensions(RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo, uint32_t cubeFaceIndex, RENDER_SURFACE_STATE::SURFACE_TYPE surfaceType, uint32_t &depth) { + auto imageCount = std::max(imageInfo.imgDesc.imageDepth, imageInfo.imgDesc.imageArraySize); + if (imageCount == 0) { + imageCount = 1; + } + + auto imageHeight = imageInfo.imgDesc.imageHeight; + if (imageHeight == 0) { + imageHeight = 1; + } + + auto imageWidth = imageInfo.imgDesc.imageWidth; + if (imageWidth == 0) { + imageWidth = 1; + } + + if (cubeFaceIndex != __GMM_NO_CUBE_MAP) { + imageCount = __GMM_MAX_CUBE_FACE - cubeFaceIndex; + } + + depth = static_cast(imageCount); + surfaceState->setWidth(static_cast(imageWidth)); + surfaceState->setHeight(static_cast(imageHeight)); + surfaceState->setDepth(depth); + surfaceState->setSurfacePitch(static_cast(imageInfo.imgDesc.imageRowPitch)); + surfaceState->setSurfaceType(surfaceType); +} + +template +void ImageSurfaceStateHelper::setWidthForMediaBlockSurfaceState(RENDER_SURFACE_STATE *surfaceState, const ImageInfo &imageInfo) { + auto elSize = imageInfo.surfaceFormat->imageElementSizeInBytes; + auto numDwords = static_cast(Math::divideAndRoundUp(imageInfo.imgDesc.imageWidth * elSize, sizeof(uint32_t))); + surfaceState->setWidth(numDwords); +} + +template +void ImageSurfaceStateHelper::setUnifiedAuxBaseAddress(RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm) { + uint64_t baseAddress = surfaceState->getSurfaceBaseAddress() + + gmm->gmmResourceInfo->getUnifiedAuxSurfaceOffset(GMM_UNIFIED_AUX_TYPE::GMM_AUX_SURF); + surfaceState->setAuxiliarySurfaceBaseAddress(baseAddress); +} + +template +void ImageSurfaceStateHelper::setMipTailStartLOD(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) { + surfaceState->setMipTailStartLOD(0); + + if (gmm != nullptr) { + surfaceState->setMipTailStartLOD(gmm->gmmResourceInfo->getMipTailStartLODSurfaceState()); + } +} + +} // namespace NEO \ No newline at end of file diff --git a/shared/source/xe2_hpg_core/image_core_xe2_hpg_core.cpp b/shared/source/xe2_hpg_core/image_core_xe2_hpg_core.cpp index 05ed448515..ea079143a6 100644 --- a/shared/source/xe2_hpg_core/image_core_xe2_hpg_core.cpp +++ b/shared/source/xe2_hpg_core/image_core_xe2_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,7 +10,11 @@ namespace NEO { -using Family = Xe2HpgCoreFamily; +using GfxFamily = Xe2HpgCoreFamily; +} -#include "shared/source/image/image_skl_and_later.inl" +#include "shared/source/image/image_surface_state.inl" + +namespace NEO { +template class ImageSurfaceStateHelper; } // namespace NEO diff --git a/shared/source/xe3_core/image_core_xe3_core.cpp b/shared/source/xe3_core/image_core_xe3_core.cpp index 57c2d81325..140e70319e 100644 --- a/shared/source/xe3_core/image_core_xe3_core.cpp +++ b/shared/source/xe3_core/image_core_xe3_core.cpp @@ -10,7 +10,9 @@ namespace NEO { -using Family = Xe3CoreFamily; - -#include "shared/source/image/image_skl_and_later.inl" +using GfxFamily = Xe3CoreFamily; +} +#include "shared/source/image/image_surface_state.inl" +namespace NEO { +template class ImageSurfaceStateHelper; } // namespace NEO diff --git a/shared/source/xe_hpc_core/image_core_xe_hpc_core.cpp b/shared/source/xe_hpc_core/image_core_xe_hpc_core.cpp index b63dc86750..f8f320e988 100644 --- a/shared/source/xe_hpc_core/image_core_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/image_core_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,7 +10,9 @@ namespace NEO { -using Family = XeHpcCoreFamily; - -#include "shared/source/image/image_skl_and_later.inl" +using GfxFamily = XeHpcCoreFamily; +} +#include "shared/source/image/image_surface_state.inl" +namespace NEO { +template class ImageSurfaceStateHelper; } // namespace NEO diff --git a/shared/source/xe_hpg_core/image_core_xe_hpg_core.cpp b/shared/source/xe_hpg_core/image_core_xe_hpg_core.cpp index 8be82b7e1b..2586af4404 100644 --- a/shared/source/xe_hpg_core/image_core_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/image_core_xe_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -10,7 +10,9 @@ namespace NEO { -using Family = XeHpgCoreFamily; - -#include "shared/source/image/image_skl_and_later.inl" +using GfxFamily = XeHpgCoreFamily; +} +#include "shared/source/image/image_surface_state.inl" +namespace NEO { +template class ImageSurfaceStateHelper; } // namespace NEO diff --git a/shared/test/unit_test/gen12lp/image_surface_state_tests_gen12lp.cpp b/shared/test/unit_test/gen12lp/image_surface_state_tests_gen12lp.cpp index 7ed036c90a..f65290cda0 100644 --- a/shared/test/unit_test/gen12lp/image_surface_state_tests_gen12lp.cpp +++ b/shared/test/unit_test/gen12lp/image_surface_state_tests_gen12lp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -44,11 +44,11 @@ GEN12LPTEST_F(ImageSurfaceStateTestsGen12LP, givenGmmWithMediaCompressedWhenSetM auto surfaceState = std::make_unique(size); auto castSurfaceState = reinterpret_cast(surfaceState.get()); - setMipTailStartLOD(castSurfaceState, nullptr); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, nullptr); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), 0u); - setMipTailStartLOD(castSurfaceState, mockGmm.get()); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, mockGmm.get()); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), mockGmm->gmmResourceInfo->getMipTailStartLODSurfaceState()); } diff --git a/shared/test/unit_test/image/image_surface_state_fixture.h b/shared/test/unit_test/image/image_surface_state_fixture.h index abe87ffdb5..4dd7b3dd78 100644 --- a/shared/test/unit_test/image/image_surface_state_fixture.h +++ b/shared/test/unit_test/image/image_surface_state_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #pragma once #include "shared/source/gmm_helper/gmm_helper.h" +#include "shared/source/gmm_helper/resource_info.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/basic_math.h" #include "shared/source/image/image_surface_state.h" diff --git a/shared/test/unit_test/image/image_surface_state_tests.cpp b/shared/test/unit_test/image/image_surface_state_tests.cpp index b1271c645c..cf32e0723f 100644 --- a/shared/test/unit_test/image/image_surface_state_tests.cpp +++ b/shared/test/unit_test/image/image_surface_state_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -40,7 +40,7 @@ HWTEST2_F(ImageSurfaceStateTests, givenImageInfoWhenSetImageSurfaceStateThenProp const uint64_t gpuAddress = 0x000001a78a8a8000; uint32_t minArrayElement, renderTargetViewExtent; - setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); + ImageSurfaceStateHelper::setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT; @@ -76,7 +76,7 @@ HWTEST2_F(ImageSurfaceStateTests, givenImageInfoWhenSetImageSurfaceStateThenProp surfaceState = std::make_unique(size); castSurfaceState = reinterpret_cast(surfaceState.get()); - setImageSurfaceState(castSurfaceState, imageInfo, nullptr, *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, false, minArrayElement, renderTargetViewExtent); + ImageSurfaceStateHelper::setImageSurfaceState(castSurfaceState, imageInfo, nullptr, *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, false, minArrayElement, renderTargetViewExtent); EXPECT_EQ(castSurfaceState->getSurfaceHorizontalAlignment(), RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT_HALIGN_DEFAULT); EXPECT_EQ(castSurfaceState->getSurfaceVerticalAlignment(), RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4); @@ -95,7 +95,7 @@ HWTEST2_F(ImageSurfaceStateTests, givenImageInfoWhenSetImageSurfaceStateThenProp typename FamilyType::RENDER_SURFACE_STATE::SURFACE_TYPE surfaceType = RENDER_SURFACE_STATE::SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_3D; uint32_t depth; - setImageSurfaceStateDimensions(castSurfaceState, imageInfo, cubeFaceIndex, surfaceType, depth); + ImageSurfaceStateHelper::setImageSurfaceStateDimensions(castSurfaceState, imageInfo, cubeFaceIndex, surfaceType, depth); EXPECT_EQ(castSurfaceState->getWidth(), static_cast(imageInfo.imgDesc.imageWidth)); EXPECT_EQ(castSurfaceState->getHeight(), static_cast(imageInfo.imgDesc.imageHeight)); @@ -134,7 +134,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage2DWhen2dImageWAIsEnabledThenArrayFlag const uint64_t gpuAddress = 0x000001a78a8a8000; uint32_t minArrayElement, renderTargetViewExtent; - setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); + ImageSurfaceStateHelper::setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); EXPECT_TRUE(castSurfaceState->getSurfaceArray()); } @@ -158,7 +158,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage2DWhen2dImageWAIsDisabledThenArrayFla const uint64_t gpuAddress = 0x000001a78a8a8000; uint32_t minArrayElement, renderTargetViewExtent; - setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); + ImageSurfaceStateHelper::setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); EXPECT_FALSE(castSurfaceState->getSurfaceArray()); } @@ -182,7 +182,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage2DArrayOfSize1When2dImageWAIsEnabledT const uint64_t gpuAddress = 0x000001a78a8a8000; uint32_t minArrayElement, renderTargetViewExtent; - setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); + ImageSurfaceStateHelper::setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); EXPECT_TRUE(castSurfaceState->getSurfaceArray()); } @@ -206,7 +206,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage2DArrayOfSize1When2dImageWAIsDisabled const uint64_t gpuAddress = 0x000001a78a8a8000; uint32_t minArrayElement, renderTargetViewExtent; - setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); + ImageSurfaceStateHelper::setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); EXPECT_FALSE(castSurfaceState->getSurfaceArray()); } @@ -230,7 +230,7 @@ HWTEST_F(ImageSurfaceStateTests, givenImage1DWhen2dImageWAIsEnabledThenArrayFlag const uint64_t gpuAddress = 0x000001a78a8a8000; uint32_t minArrayElement, renderTargetViewExtent; - setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); + ImageSurfaceStateHelper::setImageSurfaceState(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true, minArrayElement, renderTargetViewExtent); EXPECT_FALSE(castSurfaceState->getSurfaceArray()); } @@ -245,7 +245,7 @@ struct ImageWidthTest : ImageSurfaceStateTests { void verifyProgramming(typename FamilyType::RENDER_SURFACE_STATE &renderSurfaceState, const std::array ¶ms) { for (auto ¶m : params) { imageInfo.imgDesc.imageWidth = param.imageWidth; - setWidthForMediaBlockSurfaceState(&renderSurfaceState, imageInfo); + ImageSurfaceStateHelper::setWidthForMediaBlockSurfaceState(&renderSurfaceState, imageInfo); EXPECT_EQ(param.expectedWidthInDwords, renderSurfaceState.getWidth()); } } diff --git a/shared/test/unit_test/xe2_hpg_core/image_surface_state_tests_xe2_hpg_core.cpp b/shared/test/unit_test/xe2_hpg_core/image_surface_state_tests_xe2_hpg_core.cpp index 18230a474f..761d3f230a 100644 --- a/shared/test/unit_test/xe2_hpg_core/image_surface_state_tests_xe2_hpg_core.cpp +++ b/shared/test/unit_test/xe2_hpg_core/image_surface_state_tests_xe2_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,11 +21,11 @@ XE2_HPG_CORETEST_F(ImageSurfaceStateTestsXe2HpgCore, givenGmmWithMediaCompressed auto surfaceState = std::make_unique(size); auto castSurfaceState = reinterpret_cast(surfaceState.get()); - setMipTailStartLOD(castSurfaceState, nullptr); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, nullptr); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), 0u); - setMipTailStartLOD(castSurfaceState, mockGmm.get()); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, mockGmm.get()); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), mockGmm->gmmResourceInfo->getMipTailStartLODSurfaceState()); } diff --git a/shared/test/unit_test/xe3_core/image_surface_state_tests_xe3_core.cpp b/shared/test/unit_test/xe3_core/image_surface_state_tests_xe3_core.cpp index 145568ef69..74920ea26c 100644 --- a/shared/test/unit_test/xe3_core/image_surface_state_tests_xe3_core.cpp +++ b/shared/test/unit_test/xe3_core/image_surface_state_tests_xe3_core.cpp @@ -22,11 +22,11 @@ XE3_CORETEST_F(ImageSurfaceStateTestsXe3Core, givenGmmWithMediaCompressedWhenSet auto surfaceState = std::make_unique(size); auto castSurfaceState = reinterpret_cast(surfaceState.get()); - setMipTailStartLOD(castSurfaceState, nullptr); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, nullptr); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), 0u); - setMipTailStartLOD(castSurfaceState, mockGmm.get()); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, mockGmm.get()); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), mockGmm->gmmResourceInfo->getMipTailStartLODSurfaceState()); } diff --git a/shared/test/unit_test/xe_hpc_core/image_surface_state_tests_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/image_surface_state_tests_xe_hpc_core.cpp index cebfb98c7f..5cbb774d75 100644 --- a/shared/test/unit_test/xe_hpc_core/image_surface_state_tests_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/image_surface_state_tests_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -47,11 +47,11 @@ XE_HPC_CORETEST_F(ImageSurfaceStateTestsXeHpcCore, givenGmmWithMediaCompressedWh auto surfaceState = std::make_unique(size); auto castSurfaceState = reinterpret_cast(surfaceState.get()); - setMipTailStartLOD(castSurfaceState, nullptr); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, nullptr); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), 0u); - setMipTailStartLOD(castSurfaceState, mockGmm.get()); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, mockGmm.get()); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), mockGmm->gmmResourceInfo->getMipTailStartLODSurfaceState()); } diff --git a/shared/test/unit_test/xe_hpg_core/image_surface_state_tests_xe_hpg_core.cpp b/shared/test/unit_test/xe_hpg_core/image_surface_state_tests_xe_hpg_core.cpp index e841d7e2d9..1456c45a1f 100644 --- a/shared/test/unit_test/xe_hpg_core/image_surface_state_tests_xe_hpg_core.cpp +++ b/shared/test/unit_test/xe_hpg_core/image_surface_state_tests_xe_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -47,11 +47,11 @@ XE_HPG_CORETEST_F(ImageSurfaceStateTestsXeHpgCore, givenGmmWithMediaCompressedWh auto surfaceState = std::make_unique(size); auto castSurfaceState = reinterpret_cast(surfaceState.get()); - setMipTailStartLOD(castSurfaceState, nullptr); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, nullptr); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), 0u); - setMipTailStartLOD(castSurfaceState, mockGmm.get()); + ImageSurfaceStateHelper::setMipTailStartLOD(castSurfaceState, mockGmm.get()); EXPECT_EQ(castSurfaceState->getMipTailStartLOD(), mockGmm->gmmResourceInfo->getMipTailStartLODSurfaceState()); }