From 4b9ed1df9b52e94a7fde72dc9ac7d33695291c75 Mon Sep 17 00:00:00 2001 From: Gu_Peiyi Date: Tue, 2 Jul 2024 14:46:40 +0800 Subject: [PATCH] [VP] Integrate L0 FC l0 fc enable and tool enable --- media_common/agnostic/common/hw/mhw_render.h | 2 + .../agnostic/common/hw/mhw_state_heap.h | 1 + .../agnostic/common/renderhal/renderhal.h | 9 +- .../agnostic/common/vp/hal/vp_common_defs.h | 2 +- .../Xe2_HPG/hw/mhw_render_xe2_hpg_next_impl.h | 2 + .../agnostic/common/hw/mhw_render_cmdpar.h | 1 + .../agnostic/common/renderhal/renderhal.cpp | 102 ++- .../renderhal_platform_interface_next.cpp | 104 ++- .../renderhal_platform_interface_next.h | 16 +- .../shared/packet/media_render_cmd_packet.cpp | 3 + .../shared/packet/media_render_cmd_packet.h | 3 + .../common/vp/hal/feature_manager/hw_filter.h | 1 - .../vp/hal/feature_manager/vp_kernelset.cpp | 5 - .../features/kernel_args/igvpfc_scale_args.h | 51 -- .../hal/features/kernel_args/media_srcs.cmake | 1 - .../common/vp/hal/features/media_srcs.cmake | 2 - .../vp/hal/features/vp_l0_fc_filter.cpp | 864 ------------------ .../common/vp/hal/features/vp_l0_fc_filter.h | 216 ----- .../common/vp/hal/packet/media_srcs.cmake | 2 - .../vp/hal/packet/vp_render_cmd_packet.cpp | 25 - .../vp/hal/packet/vp_render_cmd_packet.h | 2 - .../common/vp/hal/packet/vp_render_common.h | 1 + .../vp/hal/packet/vp_render_kernel_obj.cpp | 8 + .../vp/hal/packet/vp_render_kernel_obj.h | 16 +- .../vp/hal/packet/vp_render_l0_fc_kernel.cpp | 357 -------- .../vp/hal/packet/vp_render_l0_fc_kernel.h | 74 -- 26 files changed, 243 insertions(+), 1627 deletions(-) delete mode 100644 media_softlet/agnostic/common/vp/hal/features/kernel_args/igvpfc_scale_args.h delete mode 100644 media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.cpp delete mode 100644 media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.h delete mode 100644 media_softlet/agnostic/common/vp/hal/packet/vp_render_l0_fc_kernel.cpp delete mode 100644 media_softlet/agnostic/common/vp/hal/packet/vp_render_l0_fc_kernel.h diff --git a/media_common/agnostic/common/hw/mhw_render.h b/media_common/agnostic/common/hw/mhw_render.h index f9d491cae2..5abd00c1b6 100644 --- a/media_common/agnostic/common/hw/mhw_render.h +++ b/media_common/agnostic/common/hw/mhw_render.h @@ -307,6 +307,8 @@ typedef struct _MHW_GPGPU_WALKER_PARAMS bool isGenerateLocalID; MHW_EMIT_LOCAL_MODE emitLocal; + + bool hasBarrier; } MHW_GPGPU_WALKER_PARAMS, *PMHW_GPGPU_WALKER_PARAMS; diff --git a/media_common/agnostic/common/hw/mhw_state_heap.h b/media_common/agnostic/common/hw/mhw_state_heap.h index 8405033e5c..f6f7e05093 100644 --- a/media_common/agnostic/common/hw/mhw_state_heap.h +++ b/media_common/agnostic/common/hw/mhw_state_heap.h @@ -451,6 +451,7 @@ typedef struct _MHW_ID_ENTRY_PARAMS int32_t iCrsThdConDataRdLn; //! PMHW_STATE_HEAP pGeneralStateHeap; //! General state heap in use MemoryBlock *memoryBlock; //! Memory block associated with the state heap + uint32_t preferredSlmAllocationSize; //! SLM Allocation Size for per SubSlice } MHW_ID_ENTRY_PARAMS, *PMHW_ID_ENTRY_PARAMS; typedef struct _MHW_PLANE_SETTING diff --git a/media_common/agnostic/common/renderhal/renderhal.h b/media_common/agnostic/common/renderhal/renderhal.h index 8b3d5600de..0121cffb8e 100644 --- a/media_common/agnostic/common/renderhal/renderhal.h +++ b/media_common/agnostic/common/renderhal/renderhal.h @@ -1023,7 +1023,8 @@ typedef struct _RENDERHAL_SURFACE_STATE_PARAMS uint32_t bVmeUse : 1; // Flag for VME use uint32_t bBufferUse : 1; // Flags for 1D buffer use uint32_t bSurfaceTypeDefined : 1; - uint32_t : 2; + uint32_t : 1; + uint32_t forceCommonSurfaceMessage : 1; uint32_t surfaceType : 11; MOS_COMPONENT Component : 4; RENDERHAL_MEMORY_OBJECT_CONTROL MemObjCtl; // Caching attributes @@ -1378,6 +1379,12 @@ typedef struct _RENDERHAL_INTERFACE PRENDERHAL_INTERFACE pRenderHal, PRENDERHAL_SURFACE_STATE_PARAMS pParams); + MOS_STATUS (*pfnGetPlaneDefinitionForCommonMessage) ( + PRENDERHAL_INTERFACE pRenderHal, + MOS_FORMAT format, + bool isRenderTarget, + RENDERHAL_PLANE_DEFINITION &planeDefinition); + //--------------------------- // State Setup - HW + OS Specific //--------------------------- diff --git a/media_common/agnostic/common/vp/hal/vp_common_defs.h b/media_common/agnostic/common/vp/hal/vp_common_defs.h index 8319583d1b..36af3cc65d 100644 --- a/media_common/agnostic/common/vp/hal/vp_common_defs.h +++ b/media_common/agnostic/common/vp/hal/vp_common_defs.h @@ -184,7 +184,7 @@ enum VpKernelID // mediacopy-render copy kernelRenderCopy, - kernelFcDScale444, + kernelL0FcCommon, baseKernelMaxNumID }; diff --git a/media_softlet/agnostic/Xe_R/Xe2_HPG/hw/mhw_render_xe2_hpg_next_impl.h b/media_softlet/agnostic/Xe_R/Xe2_HPG/hw/mhw_render_xe2_hpg_next_impl.h index b407186d4f..25615473e4 100644 --- a/media_softlet/agnostic/Xe_R/Xe2_HPG/hw/mhw_render_xe2_hpg_next_impl.h +++ b/media_softlet/agnostic/Xe_R/Xe2_HPG/hw/mhw_render_xe2_hpg_next_impl.h @@ -194,6 +194,8 @@ class Impl : public render::Impl cmd.InterfaceDescriptor.DW5.NumberOfThreadsInGpgpuThreadGroup = params.dwNumberofThreadsInGPGPUGroup; cmd.InterfaceDescriptor.DW5.SharedLocalMemorySize = params.dwSharedLocalMemorySize; + cmd.InterfaceDescriptor.DW7.PreferredSlmAllocationSizePerSubslice = params.preferredSlmAllocationSize; + // when Barriers is not 0, the EU fusion will close. // Assigns barrier count. if (params.bBarrierEnable) diff --git a/media_softlet/agnostic/common/hw/mhw_render_cmdpar.h b/media_softlet/agnostic/common/hw/mhw_render_cmdpar.h index c58415a0a8..3510ec86e2 100644 --- a/media_softlet/agnostic/common/hw/mhw_render_cmdpar.h +++ b/media_softlet/agnostic/common/hw/mhw_render_cmdpar.h @@ -390,6 +390,7 @@ struct _MHW_PAR_T(COMPUTE_WALKER) uint8_t *inlineData = nullptr; bool isGenerateLocalId = false; MHW_EMIT_LOCAL_MODE emitLocal = MHW_EMIT_LOCAL_NONE; + uint32_t preferredSlmAllocationSize = 0; }; diff --git a/media_softlet/agnostic/common/renderhal/renderhal.cpp b/media_softlet/agnostic/common/renderhal/renderhal.cpp index 8c33768035..c829c7515e 100644 --- a/media_softlet/agnostic/common/renderhal/renderhal.cpp +++ b/media_softlet/agnostic/common/renderhal/renderhal.cpp @@ -4016,6 +4016,12 @@ MOS_STATUS RenderHal_GetSurfaceStateEntries( } } + if (pParams->forceCommonSurfaceMessage) + { + MHW_RENDERHAL_CHK_NULL_RETURN(pRenderHal->pfnGetPlaneDefinitionForCommonMessage); + MHW_RENDERHAL_CHK_STATUS_RETURN(pRenderHal->pfnGetPlaneDefinitionForCommonMessage(pRenderHal, pSurface->Format, pRenderHalSurface->SurfType == RENDERHAL_SURF_OUT_RENDERTARGET, PlaneDefinition)); + } + // Get plane definitions MHW_RENDERHAL_ASSERT(PlaneDefinition < RENDERHAL_PLANES_DEFINITION_COUNT); *piNumEntries = pRenderHal->pPlaneDefinitions[PlaneDefinition].dwNumPlanes; @@ -4061,7 +4067,14 @@ MOS_STATUS RenderHal_GetSurfaceStateEntries( // Adjust the width if (bWidthInDword) { - if (PlaneDefinition == RENDERHAL_PLANES_R32G32B32A32F) + if (pParams->forceCommonSurfaceMessage && + (PlaneDefinition == RENDERHAL_PLANES_R8 || + PlaneDefinition == RENDERHAL_PLANES_R16_UNORM)) + { + //For packed 422 formats, single channel format is used for writing, so the width need to be double. + dwSurfaceWidth = dwSurfaceWidth << 1; + } + else if (PlaneDefinition == RENDERHAL_PLANES_R32G32B32A32F) { dwSurfaceWidth = dwSurfaceWidth << 2; } @@ -4135,7 +4148,7 @@ MOS_STATUS RenderHal_GetSurfaceStateEntries( pSurfaceEntry->YUVPlane = pPlane->ui8PlaneID; pSurfaceEntry->bAVS = pPlane->bAdvanced; - pSurfaceEntry->isOutput = pParams->isOutput; + pSurfaceEntry->isOutput = pParams->isOutput; pSurfaceEntry->bVertStride = pParams->bVertStride; pSurfaceEntry->bVertStrideOffs = pParams->bVertStrideOffs; pSurfaceEntry->bTiledSurface = (pSurface->TileType != MOS_TILE_LINEAR) @@ -4161,6 +4174,89 @@ MOS_STATUS RenderHal_GetSurfaceStateEntries( return eStatus; } +//! +//! \brief Get Plane Definition For L0 FC +//! \details Get Specific Plane Definition for L0 FC usage +//! \param PRENDERHAL_INTERFACE pRenderHal +//! [in] Pointer to Hardware Interface Structure +//! \param MOS_FORMAT format +//! [in] surface format +//! \param bool isRenderTaget +//! [in] the surface type is RENDERHAL_SURF_OUT_RENDERTARGET +//! \param RENDERHAL_PLANE_DEFINITION &planeDefinition +//! [out] Plane Definition +//! \return MOS_STATUS +//! Error code if invalid parameters, MOS_STATUS_SUCCESS otherwise +//! +MOS_STATUS RenderHal_GetPlaneDefinitionForCommonMessage( + PRENDERHAL_INTERFACE pRenderHal, + MOS_FORMAT format, + bool isRenderTarget, + RENDERHAL_PLANE_DEFINITION& planeDefinition) +{ + switch (format) + { + case Format_A8R8G8B8: + case Format_X8R8G8B8: + case Format_A16R16G16B16: + case Format_R10G10B10A2: + case Format_AYUV: + case Format_A16R16G16B16F: + case Format_A8B8G8R8: + case Format_X8B8G8R8: + case Format_A16B16G16R16: + case Format_B10G10R10A2: + case Format_A16B16G16R16F: + case Format_Y410: + case Format_NV12: + case Format_P010: + case Format_P016: + case Format_P210: + case Format_P216: + //already handled rightly in normal non-adv GetPlaneDefinition + break; + case Format_400P: + planeDefinition = RENDERHAL_PLANES_R8; + break; + case Format_YUY2: + case Format_YUYV: + case Format_YVYU: + case Format_UYVY: + case Format_VYUY: + if (isRenderTarget) + { + //For writing, packed 422 formats use R8 to write each channel separately + planeDefinition = RENDERHAL_PLANES_R8; + } + else + { + //For reading, packed 422 formats use R8G8 for Y and A8R8G8B8 for UV + planeDefinition = RENDERHAL_PLANES_YUY2_2PLANES; + } + break; + case Format_Y210: + case Format_Y216: + if (isRenderTarget) + { + //For writing, packed 422 formats use R16 to write each channel separately + planeDefinition = RENDERHAL_PLANES_R16_UNORM; + } + else + { + //For reading, packed 422 formats use RG16 for Y and ARGB16 for UV + planeDefinition = RENDERHAL_PLANES_Y210; + } + break; + case Format_Y416: + planeDefinition = RENDERHAL_PLANES_A16B16G16R16; + break; + default: + return MOS_STATUS_INVALID_PARAMETER; + } + + return MOS_STATUS_SUCCESS; +} + //! //! \brief Enable Palette //! \details Enable HW palette - reuse previous palette data @@ -7074,6 +7170,8 @@ MOS_STATUS RenderHal_InitInterface( pRenderHal->pfnSetSurfaceStateBuffer = RenderHal_SetSurfaceStateBuffer; pRenderHal->pfnCalculateYOffset = RenderHal_CalculateYOffset; + pRenderHal->pfnGetPlaneDefinitionForCommonMessage = RenderHal_GetPlaneDefinitionForCommonMessage; + // Media states management functions pRenderHal->pfnAllocateBB = RenderHal_AllocateBB; pRenderHal->pfnFreeBB = RenderHal_FreeBB; diff --git a/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.cpp b/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.cpp index fe71d153c1..ce6b389999 100644 --- a/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.cpp +++ b/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.cpp @@ -917,9 +917,74 @@ bool XRenderHal_Platform_Interface_Next::PerThreadScratchSpaceStart64Byte(RENDER return true; } +uint32_t XRenderHal_Platform_Interface_Next::CalculatePreferredSlmAllocationSizeFromSlmSize( + RENDERHAL_INTERFACE *renderHal, + uint32_t slmSize, + uint32_t numberOfThreadsPerThreadGroup) +{ + if (!renderHal || !renderHal->pOsInterface || !renderHal->pOsInterface->pfnGetGtSystemInfo) + { + MHW_RENDERHAL_ASSERTMESSAGE("renderhal or osInterface or pfnGetGtSystemInfo is nullptr"); + return 0; + } + if (numberOfThreadsPerThreadGroup == 0) + { + MHW_RENDERHAL_ASSERTMESSAGE("numberOfThreadsPerThreadGroup is 0"); + return 0; + } + + MEDIA_SYSTEM_INFO *gtInfo = renderHal->pOsInterface->pfnGetGtSystemInfo(renderHal->pOsInterface); + if (!gtInfo) + { + MHW_RENDERHAL_ASSERTMESSAGE("GtSystemInfo is nullptr"); + return 0; + } + if (gtInfo->SubSliceCount == 0) + { + MHW_RENDERHAL_ASSERTMESSAGE("SubSliceCount is 0"); + return 0; + } + uint32_t preferredSlmAllicationSize = 0; + slmSize = slmSize / 1024 + (slmSize % 1024 != 0); + uint32_t threadsPerDssCount = gtInfo->ThreadCount / gtInfo->SubSliceCount; + uint32_t workGroupCountPerDss = (threadsPerDssCount + numberOfThreadsPerThreadGroup - 1) / numberOfThreadsPerThreadGroup; + uint32_t slmSizePerSubSlice = slmSize * workGroupCountPerDss; + if (slmSize == 0) + { + preferredSlmAllicationSize = 0; + } + else if (slmSizePerSubSlice <= 16) + { + preferredSlmAllicationSize = 1; + } + else if (slmSizePerSubSlice <= 32) + { + preferredSlmAllicationSize = 2; + } + else if (slmSizePerSubSlice > 256) + { + if (slmSizePerSubSlice > 384) + { + MHW_RENDERHAL_ASSERTMESSAGE("slmSizePerSubSlice %d is bigger than max size", slmSizePerSubSlice); + } + else + { + preferredSlmAllicationSize = 10; + } + } + else + { + preferredSlmAllicationSize = slmSizePerSubSlice / 32 + (slmSizePerSubSlice % 32 != 0) + 1; + } + + return preferredSlmAllicationSize; +} + uint32_t XRenderHal_Platform_Interface_Next::EncodeSLMSize(uint32_t SLMSize) { uint32_t EncodedValue; + SLMSize = SLMSize / 1024 + (SLMSize % 1024 != 0); + if (SLMSize <= 2) { EncodedValue = SLMSize; @@ -929,6 +994,10 @@ uint32_t XRenderHal_Platform_Interface_Next::EncodeSLMSize(uint32_t SLMSize) EncodedValue = 0; do { + if (SLMSize != 1 && (SLMSize & 0x1) != 0) + { + ++SLMSize; + } SLMSize >>= 1; EncodedValue++; } while (SLMSize); @@ -1154,7 +1223,7 @@ MOS_STATUS XRenderHal_Platform_Interface_Next::SendComputeWalker( pRenderHal->pStateHeap->dwOffsetSampler + pGpGpuWalkerParams->InterfaceDescriptorOffset * pRenderHal->pStateHeap->dwSizeSamplers; mhwIdEntryParams.dwBindingTableOffset = pGpGpuWalkerParams->BindingTableID * pRenderHal->pStateHeap->iBindingTableSize; - mhwIdEntryParams.dwSharedLocalMemorySize = pGpGpuWalkerParams->SLMSize; + mhwIdEntryParams.dwSharedLocalMemorySize = m_renderHal->pfnEncodeSLMSize(m_renderHal, pGpGpuWalkerParams->SLMSize); if (pGpGpuWalkerParams->isGenerateLocalID && pGpGpuWalkerParams->emitLocal != MHW_EMIT_LOCAL_NONE) { //When COMPUTE_WALKER Emit Local ID is enabled, thread group number need to divide MHW_RENDER_ENGINE_NUMBER_OF_THREAD_UNIT @@ -1169,9 +1238,11 @@ MOS_STATUS XRenderHal_Platform_Interface_Next::SendComputeWalker( { mhwIdEntryParams.dwNumberofThreadsInGPGPUGroup = pGpGpuWalkerParams->ThreadWidth * pGpGpuWalkerParams->ThreadHeight; } + mhwIdEntryParams.preferredSlmAllocationSize = CalculatePreferredSlmAllocationSizeFromSlmSize(m_renderHal, pGpGpuWalkerParams->SLMSize, mhwIdEntryParams.dwNumberofThreadsInGPGPUGroup); //This only a WA to disable EU fusion for multi-layer blending cases or single layer do colorfill and rotation together. //Need remove it after kernel or compiler fix it. mhwIdEntryParams.bBarrierEnable = pRenderHal->eufusionBypass ? 1 : 0; + mhwIdEntryParams.bBarrierEnable |= pGpGpuWalkerParams->hasBarrier; pGpGpuWalkerParams->IndirectDataStartAddress = pGpGpuWalkerParams->IndirectDataStartAddress + pRenderHal->pStateHeap->pCurMediaState->dwOffset; MHW_RENDERHAL_CHK_NULL_RETURN(m_renderItf); @@ -1472,28 +1543,29 @@ MHW_SETPAR_DECL_SRC(COMPUTE_WALKER, XRenderHal_Platform_Interface_Next) MHW_RENDERHAL_CHK_NULL_RETURN(m_gpgpuWalkerParams); MHW_RENDERHAL_CHK_NULL_RETURN(m_interfaceDescriptorParams); - params.IndirectDataLength = m_gpgpuWalkerParams->IndirectDataLength; + params.IndirectDataLength = m_gpgpuWalkerParams->IndirectDataLength; params.IndirectDataStartAddress = m_gpgpuWalkerParams->IndirectDataStartAddress; - params.ThreadWidth = m_gpgpuWalkerParams->ThreadWidth; - params.ThreadHeight = m_gpgpuWalkerParams->ThreadHeight; - params.ThreadDepth = m_gpgpuWalkerParams->ThreadDepth; + params.ThreadWidth = m_gpgpuWalkerParams->ThreadWidth; + params.ThreadHeight = m_gpgpuWalkerParams->ThreadHeight; + params.ThreadDepth = m_gpgpuWalkerParams->ThreadDepth; - params.GroupWidth = m_gpgpuWalkerParams->GroupWidth; - params.GroupHeight = m_gpgpuWalkerParams->GroupHeight; - params.GroupDepth = m_gpgpuWalkerParams->GroupDepth; + params.GroupWidth = m_gpgpuWalkerParams->GroupWidth; + params.GroupHeight = m_gpgpuWalkerParams->GroupHeight; + params.GroupDepth = m_gpgpuWalkerParams->GroupDepth; params.GroupStartingX = m_gpgpuWalkerParams->GroupStartingX; params.GroupStartingY = m_gpgpuWalkerParams->GroupStartingY; params.GroupStartingZ = m_gpgpuWalkerParams->GroupStartingZ; - params.dwKernelOffset = m_interfaceDescriptorParams->dwKernelOffset; - params.dwSamplerCount = m_interfaceDescriptorParams->dwSamplerCount; - params.dwSamplerOffset = m_interfaceDescriptorParams->dwSamplerOffset; - params.dwBindingTableOffset = m_interfaceDescriptorParams->dwBindingTableOffset;; - params.bBarrierEnable = m_interfaceDescriptorParams->bBarrierEnable; + params.dwKernelOffset = m_interfaceDescriptorParams->dwKernelOffset; + params.dwSamplerCount = m_interfaceDescriptorParams->dwSamplerCount; + params.dwSamplerOffset = m_interfaceDescriptorParams->dwSamplerOffset; + params.dwBindingTableOffset = m_interfaceDescriptorParams->dwBindingTableOffset; + params.bBarrierEnable = m_interfaceDescriptorParams->bBarrierEnable; params.dwNumberofThreadsInGPGPUGroup = m_interfaceDescriptorParams->dwNumberofThreadsInGPGPUGroup; - params.dwSharedLocalMemorySize = m_interfaceDescriptorParams->dwSharedLocalMemorySize; - params.IndirectDataStartAddress = m_gpgpuWalkerParams->IndirectDataStartAddress; - params.forcePreferredSLMZero = m_gpgpuWalkerParams->ForcePreferredSLMZero; + params.dwSharedLocalMemorySize = m_interfaceDescriptorParams->dwSharedLocalMemorySize; + params.preferredSlmAllocationSize = m_interfaceDescriptorParams->preferredSlmAllocationSize; + params.IndirectDataStartAddress = m_gpgpuWalkerParams->IndirectDataStartAddress; + params.forcePreferredSLMZero = m_gpgpuWalkerParams->ForcePreferredSLMZero; if (m_gpgpuWalkerParams->ThreadDepth == 0) { diff --git a/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.h b/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.h index a75c95d57b..80dd82f983 100644 --- a/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.h +++ b/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.h @@ -285,11 +285,25 @@ class XRenderHal_Platform_Interface_Next : public XRenderHal_Platform_Interface, //! \brief Encode SLM Size for Interface Descriptor //! \details Setup SLM size //! \param uint32_t SLMSize - //! [in] SLM size in 1K + //! [in] SLM size //! \return encoded output //! uint32_t EncodeSLMSize(uint32_t SLMSize) override; + //! + //! \brief Calculate Preferred Slm Allocation Size for Interface Descriptor + //! \details Setup Preferred Slm Allocation Size size + //! \param PRENDERHAL_INTERFACE pRenderHal + //! [in] Pointer to RenderHal interface + //! \param uint32_t SLMSize + //! [in] SLM size + //! \return Preferred Slm Allocation Size + //! + virtual uint32_t CalculatePreferredSlmAllocationSizeFromSlmSize( + RENDERHAL_INTERFACE *renderHal, + uint32_t slmSize, + uint32_t numberOfThreadsPerThreadGroup); + //! //! \brief Set Chroma Direction //! \details Setup Chroma Direction for hpg_base diff --git a/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.cpp b/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.cpp index a995853bcb..bdc86be7f7 100644 --- a/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.cpp +++ b/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.cpp @@ -1114,6 +1114,9 @@ MOS_STATUS RenderCmdPacket::PrepareComputeWalkerParams(KERNEL_WALKER_PARAMS para gpgpuWalker.isGenerateLocalID = params.isGenerateLocalID; gpgpuWalker.emitLocal = params.emitLocal; + + gpgpuWalker.SLMSize = params.slmSize; + gpgpuWalker.hasBarrier = params.hasBarrier; return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.h b/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.h index e0194c4e2e..3e864f5c1a 100644 --- a/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.h +++ b/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.h @@ -117,6 +117,9 @@ typedef struct _KERNEL_WALKER_PARAMS bool isGenerateLocalID; MHW_EMIT_LOCAL_MODE emitLocal; + + bool hasBarrier; + uint32_t slmSize; }KERNEL_WALKER_PARAMS, * PKERNEL_WALKER_PARAMS; diff --git a/media_softlet/agnostic/common/vp/hal/feature_manager/hw_filter.h b/media_softlet/agnostic/common/vp/hal/feature_manager/hw_filter.h index a412373283..e4093a2043 100644 --- a/media_softlet/agnostic/common/vp/hal/feature_manager/hw_filter.h +++ b/media_softlet/agnostic/common/vp/hal/feature_manager/hw_filter.h @@ -49,7 +49,6 @@ #include "vp_hdr_render_filter.h" #include "vp_di_filter.h" #include "vp_fc_filter.h" -#include "vp_l0_fc_filter.h" namespace vp { diff --git a/media_softlet/agnostic/common/vp/hal/feature_manager/vp_kernelset.cpp b/media_softlet/agnostic/common/vp/hal/feature_manager/vp_kernelset.cpp index 371162ef44..fd9a8f0d16 100644 --- a/media_softlet/agnostic/common/vp/hal/feature_manager/vp_kernelset.cpp +++ b/media_softlet/agnostic/common/vp/hal/feature_manager/vp_kernelset.cpp @@ -30,7 +30,6 @@ #include "vp_render_vebox_hdr_3dlut_kernel.h" #include "vp_render_vebox_hvs_kernel.h" #include "vp_render_hdr_kernel.h" -#include "vp_render_l0_fc_kernel.h" #include "vp_render_vebox_hdr_3dlut_l0_kernel.h" using namespace vp; @@ -153,10 +152,6 @@ MOS_STATUS VpKernelSet::CreateSingleKernelObject( kernel = (VpRenderKernelObj *)MOS_New(VpRenderHdrKernel, m_hwInterface, m_allocator); VP_RENDER_CHK_NULL_RETURN(kernel); break; - case kernelFcDScale444: - kernel = (VpRenderKernelObj *)MOS_New(VpRenderL0FcKernel, m_hwInterface, kernelId, kernelIndex, m_allocator); - VP_RENDER_CHK_NULL_RETURN(kernel); - break; default: VP_RENDER_ASSERTMESSAGE("No supported kernel, return"); return MOS_STATUS_UNIMPLEMENTED; diff --git a/media_softlet/agnostic/common/vp/hal/features/kernel_args/igvpfc_scale_args.h b/media_softlet/agnostic/common/vp/hal/features/kernel_args/igvpfc_scale_args.h deleted file mode 100644 index b09db07c18..0000000000 --- a/media_softlet/agnostic/common/vp/hal/features/kernel_args/igvpfc_scale_args.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2024, Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * 'Software'), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// !!! WARNING - AUTO GENERATED FILE. DO NOT EDIT DIRECTLY. !!! -// Generated by KernelBinToSource.exe tool -//////////////////////////////////////////////////////////////////////////////// - -#ifndef __IGVPFC_SCALE_ENUM_H__ -#define __IGVPFC_SCALE_ENUM_H__ - -enum ARGS_FC_SCALE_PA_444D -{ - FC_SCALE_PA_444D_INPUT, - FC_SCALE_PA_444D_OUTPUT, - FC_SCALE_PA_444D_SHIFT, - FC_SCALE_PA_444D_INPUTIMAGESMPL, - FC_SCALE_PA_444D_OFFSET, - FC_SCALE_PA_444D_BITNUM, - FC_SCALE_PA_444D_ENQUEUED_LOCAL_SIZE, - FC_SCALE_PA_444D_INPUT_IMAGE_HEIGHT, - FC_SCALE_PA_444D_OUTPUT_IMAGE_HEIGHT, - FC_SCALE_PA_444D_INPUT_IMAGE_WIDTH, - FC_SCALE_PA_444D_OUTPUT_IMAGE_WIDTH, - FC_SCALE_PA_444D_INPUTIMAGESMPL_SAMPLER_SNAP_WA, - FC_SCALE_PA_444D_GLOBAL_ID_OFFSET, - FC_SCALE_PA_444D_LOCAL_SIZE, - FC_SCALE_PA_444D_MAX -}; - -#endif // __IGVPFC_SCALE_ENUM_H__ diff --git a/media_softlet/agnostic/common/vp/hal/features/kernel_args/media_srcs.cmake b/media_softlet/agnostic/common/vp/hal/features/kernel_args/media_srcs.cmake index 91f65552df..95ecf021de 100644 --- a/media_softlet/agnostic/common/vp/hal/features/kernel_args/media_srcs.cmake +++ b/media_softlet/agnostic/common/vp/hal/features/kernel_args/media_srcs.cmake @@ -23,7 +23,6 @@ set(TMP_SOURCES_ ) set(TMP_HEADERS_ - ${CMAKE_CURRENT_LIST_DIR}/igvpfc_scale_args.h ${CMAKE_CURRENT_LIST_DIR}/igvp3dlut_args.h ) diff --git a/media_softlet/agnostic/common/vp/hal/features/media_srcs.cmake b/media_softlet/agnostic/common/vp/hal/features/media_srcs.cmake index 6ae8f4e00e..e887da3191 100644 --- a/media_softlet/agnostic/common/vp/hal/features/media_srcs.cmake +++ b/media_softlet/agnostic/common/vp/hal/features/media_srcs.cmake @@ -34,7 +34,6 @@ set(TMP_SOURCES_ ${CMAKE_CURRENT_LIST_DIR}/vp_di_filter.cpp ${CMAKE_CURRENT_LIST_DIR}/vp_fc_filter.cpp ${CMAKE_CURRENT_LIST_DIR}/vp_cgc_filter.cpp - ${CMAKE_CURRENT_LIST_DIR}/vp_l0_fc_filter.cpp ) set(TMP_HEADERS_ @@ -51,7 +50,6 @@ set(TMP_HEADERS_ ${CMAKE_CURRENT_LIST_DIR}/vp_di_filter.h ${CMAKE_CURRENT_LIST_DIR}/vp_fc_filter.h ${CMAKE_CURRENT_LIST_DIR}/vp_cgc_filter.h - ${CMAKE_CURRENT_LIST_DIR}/vp_l0_fc_filter.h ) set(SOFTLET_VP_SOURCES_ diff --git a/media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.cpp b/media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.cpp deleted file mode 100644 index e29385c9b8..0000000000 --- a/media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.cpp +++ /dev/null @@ -1,864 +0,0 @@ -/* -* Copyright (c) 2024, Intel Corporation -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -*/ -//! -//! \file vp_l0_fc_filter.cpp -//! \brief Defines the common interface for denoise -//! this file is for the base interface which is shared by all l0 fc in driver. -//! -#include "vp_l0_fc_filter.h" -#include "vp_render_cmd_packet.h" -#include "hw_filter.h" -#include "sw_filter_pipe.h" -#include "vp_hal_ddi_utils.h" -#include "igvpfc_scale_args.h" -#include - -namespace vp -{ - -VpL0FcFilter::VpL0FcFilter(PVP_MHWINTERFACE vpMhwInterface) : VpFilter(vpMhwInterface) -{ -} - -MOS_STATUS VpL0FcFilter::Init() -{ - VP_FUNC_CALL(); - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpL0FcFilter::Prepare() -{ - VP_FUNC_CALL(); - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpL0FcFilter::Destroy() -{ - VP_FUNC_CALL(); - - if (m_renderL0FcParams) - { - MOS_Delete(m_renderL0FcParams); - m_renderL0FcParams = nullptr; - } - - for (auto &handle : m_scalingKrnArgs) - { - KRN_ARG &krnArg = handle.second; - MOS_FreeMemAndSetNull(krnArg.pData); - } - - return MOS_STATUS_SUCCESS; -} - -void L0_FC_KERNEL_PARAM::Init() -{ - kernelArgs.clear(); - kernelName.clear(); - kernelId = kernelCombinedFc; - threadWidth = 0; - threadHeight = 0; -} - -void _RENDER_L0_FC_PARAMS::Init() -{ - fc_kernelParams.clear(); -} - -MOS_STATUS VpL0FcFilter::SetExecuteEngineCaps( - SwFilterPipe *executingPipe, - VP_EXECUTE_CAPS vpExecuteCaps) -{ - VP_FUNC_CALL(); - - m_executingPipe = executingPipe; - m_executeCaps = vpExecuteCaps; - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpL0FcFilter::InitCompParams(L0_FC_KERNEL_PARAMS &compParams, SwFilterPipe &executingPipe) -{ - MOS_ZeroMemory(&compParams, sizeof(compParams)); - - //L0 FC only supports scaling kernel only for now - for (uint32_t layerIndex = 0; layerIndex < executingPipe.GetSurfaceCount(true); ++layerIndex) - { - SwFilterScaling *scaling = dynamic_cast(executingPipe.GetSwFilter(true, 0, FeatureType::FeatureTypeScaling)); - L0_FC_KERNEL_PARAM scalingKrnParam = {}; - VP_PUBLIC_CHK_STATUS_RETURN(AddScalingKrn(scaling, SurfaceType(SurfaceTypeFcInputLayer0 + layerIndex), SurfaceTypeFcTarget0, scalingKrnParam)); - compParams.push_back(scalingKrnParam); - } - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpL0FcFilter::AddScalingKrn(SwFilterScaling *scaling, SurfaceType inputSurf, SurfaceType outputSurf, L0_FC_KERNEL_PARAM ¶m) -{ - VP_PUBLIC_CHK_NULL_RETURN(m_pvpMhwInterface); - VP_PUBLIC_CHK_NULL_RETURN(m_pvpMhwInterface->m_vpPlatformInterface); - VP_PUBLIC_CHK_NULL_RETURN(scaling); - RECT srcRect = scaling->GetSwFilterParams().input.rcSrc; - RECT trgRect = scaling->GetSwFilterParams().input.rcDst; - - if (scaling->GetSwFilterParams().interlacedScalingType != ISCALING_NONE || - !IS_ALPHA_FORMAT_RGB8(scaling->GetSwFilterParams().formatInput) || - !IS_ALPHA_FORMAT_RGB8(scaling->GetSwFilterParams().formatOutput) || - srcRect.left != 0 || - srcRect.top != 0 || - trgRect.left != 0 || - trgRect.top != 0) - { - //L0 FC only support RGB32 right now - //L0 FC only support no left/top cropping now - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); - } - - - uint32_t inputWidth = MOS_MIN(scaling->GetSwFilterParams().input.dwWidth, static_cast(srcRect.right - srcRect.left)); - uint32_t inputHeight = MOS_MIN(scaling->GetSwFilterParams().input.dwHeight, static_cast(srcRect.bottom - srcRect.top)); - uint32_t targetWidth = scaling->GetSwFilterParams().output.dwWidth; - uint32_t targetHeight = scaling->GetSwFilterParams().output.dwHeight; - uint32_t bitNumber = 8; - float shift[2] = {VP_HW_LINEAR_SHIFT, VP_HW_LINEAR_SHIFT}; - float offset[2] = {VP_SAMPLER_BIAS, VP_SAMPLER_BIAS}; - uint32_t localWidth = 32; - uint32_t localHeight = 32; - uint32_t localDepth = 1; - uint32_t threadWidth = targetWidth / localWidth + (targetWidth % localWidth != 0); - uint32_t threadHeight = targetHeight / localHeight + (targetHeight % localHeight != 0); - KERNEL_ARGS krnArgs = {}; - param = {}; - - auto handle = m_pvpMhwInterface->m_vpPlatformInterface->GetKernelPool().find("PA_444D_fc_scale"); - VP_PUBLIC_CHK_NOT_FOUND_RETURN(handle, &m_pvpMhwInterface->m_vpPlatformInterface->GetKernelPool()); - KERNEL_BTIS kernelBtis = handle->second.GetKernelBtis(); - KERNEL_ARGS kernelArgs = handle->second.GetKernelArgs(); - - for (auto const &kernelArg : kernelArgs) - { - uint32_t uIndex = kernelArg.uIndex; - auto argHandle = m_scalingKrnArgs.find(uIndex); - if (argHandle == m_scalingKrnArgs.end()) - { - KRN_ARG krnArg = {}; - argHandle = m_scalingKrnArgs.insert(std::make_pair(uIndex, krnArg)).first; - VP_PUBLIC_CHK_NOT_FOUND_RETURN(argHandle, &m_scalingKrnArgs); - } - KRN_ARG &krnArg = argHandle->second; - bool bInit = true; - krnArg.uIndex = uIndex; - krnArg.eArgKind = kernelArg.eArgKind; - if (krnArg.pData == nullptr) - { - if (kernelArg.uSize > 0) - { - krnArg.uSize = kernelArg.uSize; - krnArg.pData = MOS_AllocAndZeroMemory(kernelArg.uSize); - } - } - else - { - VP_PUBLIC_CHK_VALUE_RETURN(krnArg.uSize, kernelArg.uSize); - MOS_ZeroMemory(krnArg.pData, krnArg.uSize); - } - - switch (krnArg.uIndex) - { - case FC_SCALE_PA_444D_OUTPUT_IMAGE_HEIGHT: - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - *(uint32_t *)krnArg.pData = targetHeight; - break; - case FC_SCALE_PA_444D_OUTPUT_IMAGE_WIDTH: - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - *(uint32_t *)krnArg.pData = targetWidth; - break; - case FC_SCALE_PA_444D_INPUT_IMAGE_WIDTH: - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - *(uint32_t *)krnArg.pData = inputWidth; - break; - case FC_SCALE_PA_444D_INPUT_IMAGE_HEIGHT: - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - *(uint32_t *)krnArg.pData = inputHeight; - break; - case FC_SCALE_PA_444D_BITNUM: - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - *(uint32_t *)krnArg.pData = bitNumber; - break; - case FC_SCALE_PA_444D_SHIFT: - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - MOS_SecureMemcpy(krnArg.pData, krnArg.uSize, shift, sizeof(shift)); - break; - case FC_SCALE_PA_444D_OFFSET: - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - MOS_SecureMemcpy(krnArg.pData, krnArg.uSize, offset, sizeof(offset)); - break; - case FC_SCALE_PA_444D_INPUTIMAGESMPL: - krnArg.uOffsetInPayload = kernelArg.uOffsetInPayload; - break; - case FC_SCALE_PA_444D_ENQUEUED_LOCAL_SIZE: - case FC_SCALE_PA_444D_LOCAL_SIZE: - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - static_cast(krnArg.pData)[0] = localWidth; - static_cast(krnArg.pData)[1] = localHeight; - static_cast(krnArg.pData)[2] = localDepth; - break; - default: - bInit = false; - break; - } - - if (bInit) - { - krnArgs.push_back(krnArg); - } - } - - for (auto const &kernelBti : kernelBtis) - { - uint32_t uIndex = kernelBti.first; - auto argHandle = m_scalingKrnArgs.find(uIndex); - if (argHandle == m_scalingKrnArgs.end()) - { - KRN_ARG krnArg = {}; - argHandle = m_scalingKrnArgs.insert(std::make_pair(uIndex, krnArg)).first; - VP_PUBLIC_CHK_NOT_FOUND_RETURN(argHandle, &m_scalingKrnArgs); - } - KRN_ARG &krnArg = argHandle->second; - krnArg.uIndex = uIndex; - krnArg.eArgKind = ARG_KIND_SURFACE; - bool bInit = true; - if (krnArg.pData == nullptr) - { - krnArg.uSize = 8; - krnArg.pData = MOS_AllocAndZeroMemory(krnArg.uSize); - VP_PUBLIC_CHK_NULL_RETURN(krnArg.pData); - } - else - { - VP_PUBLIC_CHK_VALUE_RETURN(krnArg.uSize, 8); - MOS_ZeroMemory(krnArg.pData, krnArg.uSize); - } - - switch (krnArg.uIndex) - { - case FC_SCALE_PA_444D_INPUT: - *(uint32_t *)krnArg.pData = inputSurf; - break; - case FC_SCALE_PA_444D_OUTPUT: - *(uint32_t *)krnArg.pData = outputSurf; - break; - default: - bInit = false; - break; - } - - if (bInit) - { - krnArgs.push_back(krnArg); - } - } - - param.kernelArgs = krnArgs; - param.kernelName = "PA_444D_fc_scale"; - param.kernelId = kernelFcDScale444; - param.threadWidth = threadWidth; - param.threadHeight = threadHeight; - param.localWidth = localWidth; - param.localHeight = localHeight; - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpL0FcFilter::CalculateEngineParams() -{ - VP_FUNC_CALL(); - if (m_executeCaps.bRender) - { - // create a filter Param buffer - if (!m_renderL0FcParams) - { - m_renderL0FcParams = (PRENDER_L0_FC_PARAMS)MOS_New(RENDER_L0_FC_PARAMS); - - if (m_renderL0FcParams == nullptr) - { - VP_PUBLIC_ASSERTMESSAGE("render l0 fc Pamas buffer allocate failed, return nullpointer"); - return MOS_STATUS_NO_SPACE; - } - } - else - { - m_renderL0FcParams->Init(); - } - - InitCompParams(m_renderL0FcParams->fc_kernelParams, *m_executingPipe); - } - else - { - VP_PUBLIC_ASSERTMESSAGE("Wrong engine caps! Vebox should be used for Dn"); - } - return MOS_STATUS_SUCCESS; -} - - -/****************************************************************************************************/ -/* HwFilter L0 Fc Parameter */ -/****************************************************************************************************/ -HwFilterParameter *HwFilterL0FcParameter::Create(HW_FILTER_L0_FC_PARAM ¶m, FeatureType featureType) -{ - VP_FUNC_CALL(); - - HwFilterL0FcParameter *p = MOS_New(HwFilterL0FcParameter, featureType); - if (p) - { - if (MOS_FAILED(p->Initialize(param))) - { - MOS_Delete(p); - return nullptr; - } - } - return p; -} - -HwFilterL0FcParameter::HwFilterL0FcParameter(FeatureType featureType) : HwFilterParameter(featureType) -{ -} - -HwFilterL0FcParameter::~HwFilterL0FcParameter() -{ -} - -MOS_STATUS HwFilterL0FcParameter::ConfigParams(HwFilter &hwFilter) -{ - VP_FUNC_CALL(); - - return hwFilter.ConfigParam(m_Params); -} - -MOS_STATUS HwFilterL0FcParameter::Initialize(HW_FILTER_L0_FC_PARAM ¶m) -{ - VP_FUNC_CALL(); - - m_Params = param; - return MOS_STATUS_SUCCESS; -} - - -/****************************************************************************************************/ -/* Packet L0 Fc Parameter */ -/****************************************************************************************************/ -VpPacketParameter *VpRenderL0FcParameter::Create(HW_FILTER_L0_FC_PARAM ¶m) -{ - VP_FUNC_CALL(); - - if (nullptr == param.pPacketParamFactory) - { - return nullptr; - } - VpRenderL0FcParameter *p = dynamic_cast(param.pPacketParamFactory->GetPacketParameter(param.pHwInterface)); - if (p) - { - if (MOS_FAILED(p->Initialize(param))) - { - VpPacketParameter *pParam = p; - param.pPacketParamFactory->ReturnPacketParameter(pParam); - return nullptr; - } - } - return p; -} - -VpRenderL0FcParameter::VpRenderL0FcParameter(PVP_MHWINTERFACE pHwInterface, PacketParamFactoryBase *packetParamFactory) : VpPacketParameter(packetParamFactory), m_fcFilter(pHwInterface) -{ -} -VpRenderL0FcParameter::~VpRenderL0FcParameter() {} - -bool VpRenderL0FcParameter::SetPacketParam(VpCmdPacket *pPacket) -{ - VP_FUNC_CALL(); - - VpRenderCmdPacket *renderPacket = dynamic_cast(pPacket); - if (nullptr == renderPacket) - { - return false; - } - - PRENDER_L0_FC_PARAMS params = m_fcFilter.GetFcParams(); - if (nullptr == params) - { - return false; - } - return MOS_SUCCEEDED(renderPacket->SetL0FcParams(params)); -} - -MOS_STATUS VpRenderL0FcParameter::Initialize(HW_FILTER_L0_FC_PARAM ¶ms) -{ - VP_FUNC_CALL(); - - VP_PUBLIC_CHK_STATUS_RETURN(m_fcFilter.Init()); - VP_PUBLIC_CHK_STATUS_RETURN(m_fcFilter.SetExecuteEngineCaps(params.executingPipe, params.vpExecuteCaps)); - VP_PUBLIC_CHK_STATUS_RETURN(m_fcFilter.CalculateEngineParams()); - return MOS_STATUS_SUCCESS; -} - - -/****************************************************************************************************/ -/* Policy FC Feature Handler */ -/****************************************************************************************************/ - -MOS_STATUS PolicyL0FcFeatureHandler::UpdateFeaturePipe(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index) -{ - VP_FUNC_CALL(); - - FeatureType type = feature.GetFeatureType(); - - if (caps.bRenderHdr) - { - // HDR Kernel - return PolicyFeatureHandler::UpdateFeaturePipe(caps, feature, featurePipe, executePipe, isInputPipe, index); - } - else - { - // FC - if (FeatureTypeLumakeyOnRender == type || - FeatureTypeBlendingOnRender == type || - FeatureTypeAlphaOnRender == type || - FeatureTypeCscOnRender == type || - FeatureTypeScalingOnRender == type || - FeatureTypeRotMirOnRender == type || - FeatureTypeDiOnRender == type || - FeatureTypeProcampOnRender == type) - { - return PolicyFeatureHandler::UpdateFeaturePipe(caps, feature, featurePipe, executePipe, isInputPipe, index); - } - else if (FeatureTypeColorFillOnRender == type) - { - // Only apply color fill on 1st pass. - VP_PUBLIC_CHK_STATUS_RETURN(featurePipe.RemoveSwFilter(&feature)); - VP_PUBLIC_CHK_STATUS_RETURN(executePipe.AddSwFilterUnordered(&feature, isInputPipe, index)); - } - else - { - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_INVALID_PARAMETER); - } - } - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS PolicyL0FcFeatureHandler::UpdateUnusedFeature(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index) -{ - // feature.GetFilterEngineCaps().bEnabled should be used here instead of feature.IsFeatureEnabled(caps) - // to ensure the feature does not be enabled. - // feature.IsFeatureEnabled(caps) being false means the feature is not being used in current workload, - // in which case, the feature itself may be enable and need be processed in following workloads. - if (0 == caps.bOutputPipeFeatureInuse && - !feature.GetFilterEngineCaps().bEnabled && - (feature.GetFilterEngineCaps().forceEnableForSfc || - feature.GetFilterEngineCaps().forceEnableForFc)) - { - // To avoid filter being destroyed in Policy::UpdateFeaturePipe. - feature.GetFilterEngineCaps().usedForNextPass = 1; - } - return MOS_STATUS_SUCCESS; -} - -/****************************************************************************************************/ -/* Policy FC Handler */ -/****************************************************************************************************/ -PolicyL0FcHandler::PolicyL0FcHandler(VP_HW_CAPS &hwCaps) : PolicyFeatureHandler(hwCaps) -{ - m_Type = FeatureTypeFc; -} -PolicyL0FcHandler::~PolicyL0FcHandler() -{ -} - -bool PolicyL0FcHandler::IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps) -{ - VP_FUNC_CALL(); - - return vpExecuteCaps.bComposite; -} - -HwFilterParameter *PolicyL0FcHandler::CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface) -{ - VP_FUNC_CALL(); - - if (IsFeatureEnabled(vpExecuteCaps)) - { - HW_FILTER_L0_FC_PARAM param = {}; - param.type = m_Type; - param.pHwInterface = pHwInterface; - param.vpExecuteCaps = vpExecuteCaps; - param.pPacketParamFactory = &m_PacketParamFactory; - param.executingPipe = &swFilterPipe; - param.pfnCreatePacketParam = PolicyL0FcHandler::CreatePacketParam; - - HwFilterParameter *pHwFilterParam = GetHwFeatureParameterFromPool(); - - if (pHwFilterParam) - { - if (MOS_FAILED(((HwFilterL0FcParameter *)pHwFilterParam)->Initialize(param))) - { - ReleaseHwFeatureParameter(pHwFilterParam); - } - } - else - { - pHwFilterParam = HwFilterL0FcParameter::Create(param, m_Type); - } - - return pHwFilterParam; - } - else - { - return nullptr; - } -} - -MOS_STATUS PolicyL0FcHandler::UpdateFeaturePipe(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index) -{ - VP_FUNC_CALL(); - VP_PUBLIC_ASSERTMESSAGE("Should not coming here!"); - return MOS_STATUS_SUCCESS; -} - -bool IsInterlacedInputSupported(VP_SURFACE &input); - -bool IsBobDiEnabled(SwFilterDeinterlace *di, VP_SURFACE &input); - -static MOS_STATUS IsChromaSamplingNeeded(bool &isChromaUpSamplingNeeded, bool &isChromaDownSamplingNeeded, VPHAL_SURFACE_TYPE surfType, int layerIndex, MOS_FORMAT inputFormat, MOS_FORMAT outputFormat) -{ - VPHAL_COLORPACK srcColorPack = VpHalDDIUtils::GetSurfaceColorPack(inputFormat); - VPHAL_COLORPACK dstColorPack = VpHalDDIUtils::GetSurfaceColorPack(outputFormat); - - if (SURF_IN_PRIMARY == surfType && - // when 3D sampler been used, PL2 chromasitting kernel does not support sub-layer chromasitting - ((IS_PL2_FORMAT(inputFormat) && 0 == layerIndex) || - inputFormat == Format_YUY2)) - { - isChromaUpSamplingNeeded = ((srcColorPack == VPHAL_COLORPACK_420 && - (dstColorPack == VPHAL_COLORPACK_422 || dstColorPack == VPHAL_COLORPACK_444)) || - (srcColorPack == VPHAL_COLORPACK_422 && dstColorPack == VPHAL_COLORPACK_444)); - isChromaDownSamplingNeeded = ((srcColorPack == VPHAL_COLORPACK_444 && - (dstColorPack == VPHAL_COLORPACK_422 || dstColorPack == VPHAL_COLORPACK_420)) || - (srcColorPack == VPHAL_COLORPACK_422 && dstColorPack == VPHAL_COLORPACK_420)); - } - else - { - isChromaUpSamplingNeeded = false; - isChromaDownSamplingNeeded = false; - } - - return MOS_STATUS_SUCCESS; -} - -static MOS_STATUS Get3DSamplerScalingMode(VPHAL_SCALING_MODE &scalingMode, SwFilterSubPipe &pipe, int layerIndex, VP_SURFACE &input, VP_SURFACE &output) -{ - bool isChromaUpSamplingNeeded = false; - bool isChromaDownSamplingNeeded = false; - VP_PUBLIC_CHK_STATUS_RETURN(IsChromaSamplingNeeded(isChromaUpSamplingNeeded, isChromaDownSamplingNeeded, input.SurfType, layerIndex, input.osSurface->Format, output.osSurface->Format)); - - SwFilterScaling *scaling = dynamic_cast(pipe.GetSwFilter(FeatureType::FeatureTypeScaling)); - - bool iscalingEnabled = scaling ? ISCALING_INTERLEAVED_TO_INTERLEAVED == scaling->GetSwFilterParams().interlacedScalingType : false; - bool fieldWeaving = scaling ? ISCALING_FIELD_TO_INTERLEAVED == scaling->GetSwFilterParams().interlacedScalingType : false; - - // The rectangle in VP_SURFACE contains the rotation information. - // The rectangle in ScalingFilter has been adjusted based on the rotation, - // which can be used directly here. - bool isScalingNeeded = false; - if (scaling) - { - auto &scalingParamsInput = scaling->GetSwFilterParams().input; - isScalingNeeded = (scalingParamsInput.rcDst.right - scalingParamsInput.rcDst.left) != (scalingParamsInput.rcSrc.right - scalingParamsInput.rcSrc.left) || - (scalingParamsInput.rcDst.bottom - scalingParamsInput.rcDst.top) != (scalingParamsInput.rcSrc.bottom - scalingParamsInput.rcSrc.top); - } - else - { - isScalingNeeded = false; - } - - if (!isScalingNeeded && - !isChromaUpSamplingNeeded && - !isChromaDownSamplingNeeded && - (input.SampleType == SAMPLE_PROGRESSIVE || iscalingEnabled || fieldWeaving)) - { - scalingMode = VPHAL_SCALING_NEAREST; - } - else - { - scalingMode = VPHAL_SCALING_BILINEAR; - } - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS PolicyL0FcHandler::AddInputLayerForProcess(bool &bSkip, std::vector &layerIndexes, VPHAL_SCALING_MODE &scalingMode, int index, VP_SURFACE &input, SwFilterSubPipe &pipe, VP_SURFACE &output, VP_EXECUTE_CAPS &caps) -{ - bSkip = false; - --m_resCounter.layers; - - if (VPHAL_PALETTE_NONE != input.Palette.PaletteType) - { - --m_resCounter.palettes; - } - - SwFilterProcamp *procamp = dynamic_cast(pipe.GetSwFilter(FeatureType::FeatureTypeProcamp)); - if (procamp && procamp->IsFeatureEnabled(caps) && - procamp->GetSwFilterParams().procampParams && - procamp->GetSwFilterParams().procampParams->bEnabled) - { - --m_resCounter.procamp; - } - - SwFilterLumakey *lumakey = dynamic_cast(pipe.GetSwFilter(FeatureType::FeatureTypeLumakey)); - if (lumakey) - { - --m_resCounter.lumaKeys; - if (m_resCounter.lumaKeys < 0 || layerIndexes.size() > 1) - { - bSkip = true; - VP_PUBLIC_NORMALMESSAGE("Scaling Info: layer %d is not selected. lumaKeys %d, layerIndexes.size() %d", - index, - m_resCounter.lumaKeys, - layerIndexes.size()); - return MOS_STATUS_SUCCESS; - } - if (layerIndexes.size() == 1) - { - m_resCounter.sampler = VP_COMP_MAX_SAMPLER; - } - } - - SwFilterScaling *scaling = dynamic_cast(pipe.GetSwFilter(FeatureType::FeatureTypeScaling)); - SwFilterDeinterlace *di = dynamic_cast(pipe.GetSwFilter(FeatureType::FeatureTypeDi)); - VPHAL_SAMPLE_TYPE sampleType = input.SampleType; - bool samplerLumakeyEnabled = m_hwCaps.m_rules.isAvsSamplerSupported; - - if (nullptr == scaling) - { - VP_PUBLIC_ASSERTMESSAGE("Scaling Info: Scaling filter does not exist on layer %d!", index); - VP_PUBLIC_CHK_NULL_RETURN(scaling); - } - - scalingMode = scaling->GetSwFilterParams().scalingMode; - - // Disable AVS scaling mode - if (!m_hwCaps.m_rules.isAvsSamplerSupported) - { - if (VPHAL_SCALING_AVS == scalingMode) - { - scalingMode = VPHAL_SCALING_BILINEAR; - } - } - - if (!IsInterlacedInputSupported(input)) - { - sampleType = SAMPLE_PROGRESSIVE; - // Disable DI - if (di && di->IsFeatureEnabled(caps)) - { - di->GetFilterEngineCaps().bEnabled = false; - } - // Disable Iscaling - if (scaling->IsFeatureEnabled(caps) && - ISCALING_NONE != scaling->GetSwFilterParams().interlacedScalingType) - { - scaling->GetSwFilterParams().interlacedScalingType = ISCALING_NONE; - } - } - - // Number of AVS, but lumaKey and BOB DI needs 3D sampler instead of AVS sampler. - if (VPHAL_SCALING_AVS == scalingMode && - nullptr == lumakey && !IsBobDiEnabled(di, input)) - { - --m_resCounter.avs; - } - // Number of Sampler filter mode, we had better only support Nearest or Bilinear filter in one phase - // If two filters are used together, the later filter overwrite the first and cause output quality issue. - else - { - VP_PUBLIC_CHK_STATUS_RETURN(Get3DSamplerScalingMode(scalingMode, pipe, layerIndexes.size(), input, output)); - - // If bilinear needed for one layer, it will also be used by other layers. - // nearest only be used if it is used by all layers. - int32_t samplerMask = (VP_COMP_SAMPLER_BILINEAR | VP_COMP_SAMPLER_NEAREST); - - // Use sampler luma key feature only if this is not the bottom most layer - if (samplerLumakeyEnabled && lumakey && layerIndexes.size() > 0 && !IS_PL3_FORMAT(input.osSurface->Format)) - { - m_resCounter.sampler &= VP_COMP_SAMPLER_LUMAKEY; - } - else if (m_resCounter.sampler & samplerMask) - { - m_resCounter.sampler &= samplerMask; - } - else - { - // switch to AVS if AVS sampler is not used, decrease the count of comp phase - // For isAvsSamplerSupported == false case, curent layer will be rejected, since m_resCounter.avs == 0. - scalingMode = VPHAL_SCALING_AVS; - --m_resCounter.avs; - } - } - - // Fails if any of the limits are reached - // Output structure has reason why failed :-) - // multi-passes if rotation is not the same as Layer 0 rotation - // single pass if Primary layer needs rotation and remaining layer does not need rotation - if (m_resCounter.layers < 0 || - m_resCounter.palettes < 0 || - m_resCounter.procamp < 0 || - m_resCounter.lumaKeys < 0 || - m_resCounter.avs < 0 || - m_resCounter.sampler == 0) - { - //Multipass - bSkip = true; - VP_PUBLIC_NORMALMESSAGE("Scaling Info: layer %d is not selected. layers %d, palettes %d, procamp %d, lumaKeys %d, avs %d, sampler %d", - index, - m_resCounter.layers, - m_resCounter.palettes, - m_resCounter.procamp, - m_resCounter.lumaKeys, - m_resCounter.avs, - m_resCounter.sampler); - return MOS_STATUS_SUCCESS; - } - - VP_PUBLIC_NORMALMESSAGE("Scaling Info: scalingMode %d is selected for layer %d", scalingMode, index); - MT_LOG2(MT_VP_HAL_FC_SCALINGINFO, MT_NORMAL, MT_VP_HAL_FC_LAYER, index, MT_VP_HAL_SCALING_MODE, scalingMode); - - // Append source to compositing operation - scaling->GetSwFilterParams().scalingMode = scalingMode; - - if (di) - { - di->GetSwFilterParams().sampleTypeInput = sampleType; - } - - input.SampleType = sampleType; - layerIndexes.push_back(index); - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS PolicyL0FcHandler::RemoveTransparentLayers(SwFilterPipe &featurePipe) -{ - for (uint32_t i = 0; i < featurePipe.GetSurfaceCount(true); ++i) - { - SwFilterSubPipe *subpipe = featurePipe.GetSwFilterSubPipe(true, i); - - auto blending = dynamic_cast(featurePipe.GetSwFilter(true, i, FeatureTypeBlending)); - if (nullptr == blending) - { - continue; - } - - auto ¶m = blending->GetSwFilterParams(); - - //----------------------------------- - // Alpha blending optimization. - // If Constant blending and one of the following is true, disable blending. - // If Src+Constant blending and one of the following is true, fall back to Src blending. - // Condition; alpha <= 0. Layer is 100% transparent. - // Condition; alpha >= 1. Layer is 100% opaque. - //----------------------------------- - if (param.blendingParams && - ((param.blendingParams->BlendType == BLEND_CONSTANT) || - (param.blendingParams->BlendType == BLEND_CONSTANT_SOURCE) || - (param.blendingParams->BlendType == BLEND_CONSTANT_PARTIAL))) - { - float fAlpha = param.blendingParams->fAlpha; - - // Don't render layer with alpha <= 0.0f - if (fAlpha <= 0.0f) - { - VP_PUBLIC_NORMALMESSAGE("Layer %d skipped: BlendType %d, fAlpha %d", - i, - param.blendingParams->BlendType, - param.blendingParams->fAlpha); - VP_PUBLIC_CHK_STATUS_RETURN(featurePipe.DestroySurface(true, i)); - } - } - } - featurePipe.Update(); - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS PolicyL0FcHandler::LayerSelectForProcess(std::vector &layerIndexes, SwFilterPipe &featurePipe, VP_EXECUTE_CAPS &caps) -{ - layerIndexes.clear(); - m_resCounter.Reset(m_hwCaps.m_rules.isAvsSamplerSupported); - - VP_PUBLIC_CHK_STATUS_RETURN(RemoveTransparentLayers(featurePipe)); - - bool skip = false; - VP_SURFACE *output = featurePipe.GetSurface(false, 0); - bool bilinearInUseFor3DSampler = false; - VP_PUBLIC_CHK_NULL_RETURN(output); - - for (uint32_t i = 0; i < featurePipe.GetSurfaceCount(true); ++i) - { - VPHAL_SCALING_MODE scalingMode = VPHAL_SCALING_NEAREST; - VP_SURFACE *input = featurePipe.GetSurface(true, i); - SwFilterSubPipe *subpipe = featurePipe.GetSwFilterSubPipe(true, i); - VP_PUBLIC_CHK_NULL_RETURN(input); - VP_PUBLIC_CHK_NULL_RETURN(subpipe); - VP_PUBLIC_CHK_STATUS_RETURN(AddInputLayerForProcess(skip, layerIndexes, scalingMode, i, *input, *subpipe, *output, caps)); - if (skip) - { - break; - } - - if (VPHAL_SCALING_BILINEAR == scalingMode) - { - bilinearInUseFor3DSampler = true; - } - } - - // Use bilinear for layers, which is using nearest. - if (bilinearInUseFor3DSampler) - { - for (uint32_t i = 0; i < layerIndexes.size(); ++i) - { - SwFilterSubPipe *subpipe = featurePipe.GetSwFilterSubPipe(true, layerIndexes[i]); - VP_PUBLIC_CHK_NULL_RETURN(subpipe); - SwFilterScaling *scaling = dynamic_cast(subpipe->GetSwFilter(FeatureType::FeatureTypeScaling)); - if (scaling && VPHAL_SCALING_NEAREST == scaling->GetSwFilterParams().scalingMode) - { - scaling->GetSwFilterParams().scalingMode = VPHAL_SCALING_BILINEAR; - VP_PUBLIC_NORMALMESSAGE("Scaling Info: Force nearest to bilinear for layer %d (%d)", layerIndexes[i], i); - MT_LOG3(MT_VP_HAL_FC_SCALINGINFO, MT_NORMAL, MT_VP_HAL_FC_LAYER, layerIndexes[i], MT_VP_HAL_SCALING_MODE, VPHAL_SCALING_NEAREST, MT_VP_HAL_SCALING_MODE_FORCE, VPHAL_SCALING_BILINEAR); - } - } - } - - // No procamp in target being used. - return MOS_STATUS_SUCCESS; -} -} \ No newline at end of file diff --git a/media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.h b/media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.h deleted file mode 100644 index f1136994b2..0000000000 --- a/media_softlet/agnostic/common/vp/hal/features/vp_l0_fc_filter.h +++ /dev/null @@ -1,216 +0,0 @@ -/* -* Copyright (c) 2024, Intel Corporation -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -*/ -//! -//! \file vp_l0_fc_filter.h -//! \brief Defines the common interface for denoise -//! this file is for the base interface which is shared by all l0 fc in driver. - - -#ifndef __VP_L0_FC_FILTER_H__ -#define __VP_L0_FC_FILTER_H__ -#include "vp_filter.h" -#include "sw_filter.h" - -namespace vp{ - -struct L0_FC_KERNEL_PARAM -{ - KERNEL_ARGS kernelArgs; - std::string kernelName; - VpKernelID kernelId; - uint32_t threadWidth; - uint32_t threadHeight; - uint32_t localWidth; - uint32_t localHeight; - void Init(); -}; - -using L0_FC_KERNEL_PARAMS = std::vector; -struct _RENDER_L0_FC_PARAMS -{ - L0_FC_KERNEL_PARAMS fc_kernelParams = {}; - void Init(); -}; -using RENDER_L0_FC_PARAMS = _RENDER_L0_FC_PARAMS; -using PRENDER_L0_FC_PARAMS = RENDER_L0_FC_PARAMS *; - -class VpL0FcFilter : public VpFilter -{ -public: - VpL0FcFilter(PVP_MHWINTERFACE vpMhwInterface); - - ~VpL0FcFilter() - { - Destroy(); - }; - - virtual MOS_STATUS Init() override; - - virtual MOS_STATUS Prepare() override; - - virtual MOS_STATUS Destroy() override; - - virtual MOS_STATUS SetExecuteEngineCaps( - SwFilterPipe *executingPipe, - VP_EXECUTE_CAPS vpExecuteCaps); - - MOS_STATUS CalculateEngineParams(); - PRENDER_L0_FC_PARAMS GetFcParams() - { - return m_renderL0FcParams; - } - -protected: - MOS_STATUS InitCompParams(L0_FC_KERNEL_PARAMS &compParams, SwFilterPipe &executingPipe); - MOS_STATUS AddScalingKrn(SwFilterScaling *scaling, SurfaceType inputSurf, SurfaceType outputSurf, L0_FC_KERNEL_PARAM ¶m); - - SwFilterPipe *m_executingPipe = nullptr; - PRENDER_L0_FC_PARAMS m_renderL0FcParams = nullptr; - - KERNEL_INDEX_ARG_MAP m_scalingKrnArgs; - -MEDIA_CLASS_DEFINE_END(vp__VpL0FcFilter) -}; - -struct HW_FILTER_L0_FC_PARAM : public HW_FILTER_PARAM -{ - SwFilterPipe *executingPipe; -}; - -class HwFilterL0FcParameter : public HwFilterParameter -{ -public: - static HwFilterParameter *Create(HW_FILTER_L0_FC_PARAM ¶m, FeatureType featureType); - HwFilterL0FcParameter(FeatureType featureType); - virtual ~HwFilterL0FcParameter(); - virtual MOS_STATUS ConfigParams(HwFilter &hwFilter); - - MOS_STATUS Initialize(HW_FILTER_L0_FC_PARAM ¶m); - -private: - HW_FILTER_L0_FC_PARAM m_Params = {}; - -MEDIA_CLASS_DEFINE_END(vp__HwFilterL0FcParameter) -}; - -class VpRenderL0FcParameter : public VpPacketParameter -{ -public: - static VpPacketParameter *Create(HW_FILTER_L0_FC_PARAM ¶m); - VpRenderL0FcParameter(PVP_MHWINTERFACE pHwInterface, PacketParamFactoryBase *packetParamFactory); - virtual ~VpRenderL0FcParameter(); - - virtual bool SetPacketParam(VpCmdPacket *pPacket); - -private: - MOS_STATUS Initialize(HW_FILTER_L0_FC_PARAM ¶ms); - - VpL0FcFilter m_fcFilter; - -MEDIA_CLASS_DEFINE_END(vp__VpRenderL0FcParameter) -}; - -class PolicyL0FcFeatureHandler : public PolicyFeatureHandler -{ -public: - PolicyL0FcFeatureHandler(VP_HW_CAPS &hwCaps) : PolicyFeatureHandler(hwCaps) - { - m_Type = FeatureTypeFc; - } - virtual ~PolicyL0FcFeatureHandler() - { - } - virtual bool IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps) - { - // Not create hwFilters for single FC features. - return false; - } - virtual HwFilterParameter *CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface) - { - return nullptr; - } - virtual MOS_STATUS UpdateFeaturePipe(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index); - static VpPacketParameter *CreatePacketParam(HW_FILTER_PARAM ¶m) - { - return nullptr; - } - virtual MOS_STATUS UpdateUnusedFeature(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index); - -MEDIA_CLASS_DEFINE_END(vp__PolicyL0FcFeatureHandler) -}; - -class PolicyL0FcHandler : public PolicyFeatureHandler -{ -public: - PolicyL0FcHandler(VP_HW_CAPS &hwCaps); - virtual ~PolicyL0FcHandler(); - virtual bool IsFeatureEnabled(VP_EXECUTE_CAPS vpExecuteCaps); - virtual HwFilterParameter *CreateHwFilterParam(VP_EXECUTE_CAPS vpExecuteCaps, SwFilterPipe &swFilterPipe, PVP_MHWINTERFACE pHwInterface); - virtual MOS_STATUS UpdateFeaturePipe(VP_EXECUTE_CAPS caps, SwFilter &feature, SwFilterPipe &featurePipe, SwFilterPipe &executePipe, bool isInputPipe, int index); - static VpPacketParameter *CreatePacketParam(HW_FILTER_PARAM ¶m) - { - if (param.type != FeatureTypeFcOnRender) - { - VP_PUBLIC_ASSERTMESSAGE("Invalid parameter for FC!"); - return nullptr; - } - - HW_FILTER_L0_FC_PARAM *fcParam = (HW_FILTER_L0_FC_PARAM *)(¶m); - return VpRenderL0FcParameter::Create(*fcParam); - } - - virtual MOS_STATUS LayerSelectForProcess(std::vector &layerIndexes, SwFilterPipe &featurePipe, VP_EXECUTE_CAPS &caps); - -private: - MOS_STATUS RemoveTransparentLayers(SwFilterPipe &featurePipe); - virtual MOS_STATUS AddInputLayerForProcess(bool &bSkip, std::vector &layerIndexes, VPHAL_SCALING_MODE &scalingMode, int index, VP_SURFACE &input, SwFilterSubPipe &pipe, VP_SURFACE &output, VP_EXECUTE_CAPS &caps); - - PacketParamFactory m_PacketParamFactory; - - // Resource counters - struct - { - int32_t layers; - int32_t palettes; - int32_t avs; - int32_t procamp; - int32_t lumaKeys; - int32_t sampler; - - void Reset(bool isAvsSamplerSupported) - { - // Next step to init it from hw caps object. - layers = VP_COMP_MAX_LAYERS; - palettes = VP_COMP_MAX_PALETTES; - procamp = VP_COMP_MAX_PROCAMP; - lumaKeys = VP_COMP_MAX_LUMA_KEY; - avs = isAvsSamplerSupported ? VP_COMP_MAX_AVS : 0; - sampler = VP_COMP_MAX_SAMPLER; - } - } m_resCounter = {}; - -MEDIA_CLASS_DEFINE_END(vp__PolicyL0FcHandler) -}; - -} - -#endif \ No newline at end of file diff --git a/media_softlet/agnostic/common/vp/hal/packet/media_srcs.cmake b/media_softlet/agnostic/common/vp/hal/packet/media_srcs.cmake index 0a4b36a895..438017fd91 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/media_srcs.cmake +++ b/media_softlet/agnostic/common/vp/hal/packet/media_srcs.cmake @@ -32,7 +32,6 @@ set(TMP_SOURCES_ ${CMAKE_CURRENT_LIST_DIR}/vp_render_vebox_hdr_3dlut_kernel.cpp ${CMAKE_CURRENT_LIST_DIR}/vp_render_vebox_hvs_kernel.cpp ${CMAKE_CURRENT_LIST_DIR}/vp_render_hdr_kernel.cpp - ${CMAKE_CURRENT_LIST_DIR}/vp_render_l0_fc_kernel.cpp ${CMAKE_CURRENT_LIST_DIR}/vp_render_vebox_hdr_3dlut_l0_kernel.cpp ${CMAKE_CURRENT_LIST_DIR}/vp_frametracker.cpp ) @@ -56,7 +55,6 @@ set(TMP_HEADERS_ ${CMAKE_CURRENT_LIST_DIR}/vp_render_vebox_hdr_3dlut_kernel.h ${CMAKE_CURRENT_LIST_DIR}/vp_render_vebox_hvs_kernel.h ${CMAKE_CURRENT_LIST_DIR}/vp_render_hdr_kernel.h - ${CMAKE_CURRENT_LIST_DIR}/vp_render_l0_fc_kernel.h ${CMAKE_CURRENT_LIST_DIR}/vp_render_vebox_hdr_3dlut_l0_kernel.h ${CMAKE_CURRENT_LIST_DIR}/vp_frametracker.h ) diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.cpp index 6aad76c24e..78ef920a47 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.cpp @@ -2076,31 +2076,6 @@ MOS_STATUS VpRenderCmdPacket::SetFcParams(PRENDER_FC_PARAMS params) return MOS_STATUS_SUCCESS; } -MOS_STATUS VpRenderCmdPacket::SetL0FcParams(PRENDER_L0_FC_PARAMS params) -{ - VP_FUNC_CALL(); - VP_RENDER_CHK_NULL_RETURN(params); - - KERNEL_PARAMS kernelParam = {}; - for (auto &krnParams : params->fc_kernelParams) - { - kernelParam.kernelId = krnParams.kernelId; - kernelParam.kernelArgs = krnParams.kernelArgs; - kernelParam.kernelThreadSpace.uWidth = krnParams.threadWidth; - kernelParam.kernelThreadSpace.uHeight = krnParams.threadHeight; - kernelParam.kernelThreadSpace.uLocalWidth = krnParams.localWidth; - kernelParam.kernelThreadSpace.uLocalHeight = krnParams.localHeight; - kernelParam.syncFlag = true; - - m_renderKernelParams.push_back(kernelParam); - } - - m_submissionMode = MULTI_KERNELS_SINGLE_MEDIA_STATE; - m_isMultiBindingTables = true; - m_isLargeSurfaceStateNeeded = true; - return MOS_STATUS_SUCCESS; -} - MOS_STATUS VpRenderCmdPacket::SetHdr3DLutParams( PRENDER_HDR_3DLUT_CAL_PARAMS params) { diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.h b/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.h index c069bbde1f..39d786e33f 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.h +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.h @@ -63,8 +63,6 @@ class VpRenderCmdPacket : virtual public RenderCmdPacket, virtual public VpCmdPa virtual MOS_STATUS SetFcParams(PRENDER_FC_PARAMS params); - virtual MOS_STATUS SetL0FcParams(PRENDER_L0_FC_PARAMS params); - virtual MOS_STATUS SetHdr3DLutParams(PRENDER_HDR_3DLUT_CAL_PARAMS params); virtual MOS_STATUS SetDnHVSParams(PRENDER_DN_HVS_CAL_PARAMS params); diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_common.h b/media_softlet/agnostic/common/vp/hal/packet/vp_render_common.h index 24a89aef3c..475a973870 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_common.h +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_common.h @@ -116,6 +116,7 @@ struct KRN_EXECUTE_ENV bool bHas4GBBuffers; uint8_t uiWorkGroupWalkOrderDimensions[3]; uint64_t uiPrivateSize; + uint32_t uiSlmSize; }; using SurfaceIndex = uint32_t; diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.cpp index 0b41bd2a67..822f56cf38 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.cpp @@ -158,6 +158,12 @@ MOS_STATUS VpRenderKernelObj::SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_S return MOS_STATUS_SUCCESS; } +MOS_STATUS VpRenderKernelObj::SetKernelStatefulSurfaces(KERNEL_ARG_INDEX_SURFACE_MAP& statefulSurfaces) +{ + VP_FUNC_CALL(); + return MOS_STATUS_SUCCESS; +} + // Only for Adv kernels. MOS_STATUS VpRenderKernelObj::SetKernelConfigs( KERNEL_PARAMS& kernelParams, @@ -172,6 +178,8 @@ MOS_STATUS VpRenderKernelObj::SetKernelConfigs( VP_RENDER_CHK_STATUS_RETURN(SetKernelArgs(kernelParams.kernelArgs, sharedContext)); + VP_RENDER_CHK_STATUS_RETURN(SetKernelStatefulSurfaces(kernelParams.kernelStatefulSurfaces)); + VP_RENDER_CHK_STATUS_RETURN(SetProcessSurfaceGroup(surfaces)); // when UseIndependentSamplerGroup is true, each kernel will set their own sampler state group in VpRenderCmdPacket::SetupSamplerStates() diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.h b/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.h index 41b8701952..33890b1a45 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.h +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.h @@ -82,6 +82,7 @@ typedef struct _SURFACE_PARAMS { SurfaceType surfType; bool isOutput; + bool needVerticalStirde; } SURFACE_PARAMS, *PSURFACE_PARAMS; using KERNEL_CONFIGS = std::map; // Only for legacy/non-cm kernels @@ -96,12 +97,13 @@ using KERNEL_STATELESS_BUFF_CONFIG = std::map; typedef struct _KERNEL_PARAMS { - VpKernelID kernelId; - KERNEL_ARGS kernelArgs; - KERNEL_THREAD_SPACE kernelThreadSpace; - bool syncFlag; - bool flushL1; - KERNEL_TUNING_PARAMS kernelTuningParams; + VpKernelID kernelId; + KERNEL_ARGS kernelArgs; + KERNEL_THREAD_SPACE kernelThreadSpace; + bool syncFlag; + bool flushL1; + KERNEL_TUNING_PARAMS kernelTuningParams; + KERNEL_ARG_INDEX_SURFACE_MAP kernelStatefulSurfaces; } KERNEL_PARAMS; struct MEDIA_OBJECT_KA2_INLINE_DATA @@ -538,6 +540,8 @@ class VpRenderKernelObj virtual MOS_STATUS SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext); + virtual MOS_STATUS SetKernelStatefulSurfaces(KERNEL_ARG_INDEX_SURFACE_MAP &statefulSurfaces); + virtual MOS_STATUS SetupSurfaceState() = 0; virtual MOS_STATUS SetKernelConfigs(KERNEL_CONFIGS& kernelConfigs); diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_l0_fc_kernel.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_l0_fc_kernel.cpp deleted file mode 100644 index 0992c285df..0000000000 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_l0_fc_kernel.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* -* Copyright (c) 2024, Intel Corporation -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -*/ -//! -//! \file vp_render_vebox_update_cmd_packet.cpp -//! \brief render packet which used in by mediapipline. -//! \details render packet provide the structures and generate the cmd buffer which mediapipline will used. -//! - -#include "vp_render_l0_fc_kernel.h" - -using namespace vp; - -VpRenderL0FcKernel::VpRenderL0FcKernel(PVP_MHWINTERFACE hwInterface, VpKernelID kernelID, uint32_t kernelIndex, PVpAllocator allocator) : VpRenderKernelObj(hwInterface, kernelID, kernelIndex, "", allocator) -{ - m_renderHal = hwInterface ? hwInterface->m_renderHal : nullptr; - m_layer = kernelIndex; - - switch (kernelID) - { - case kernelFcDScale444: - m_kernelName = "PA_444D_fc_scale"; - break; - default: - m_kernelName.assign(""); - VP_RENDER_ASSERTMESSAGE("Kernel ID cannot map to Kernel Name"); - break; - } - m_isAdvKernel = true; - m_useIndependentSamplerGroup = true; - m_kernelBinaryID = VP_ADV_KERNEL_BINARY_ID(kernelID); -} - -VpRenderL0FcKernel::~VpRenderL0FcKernel() -{ - MOS_SafeFreeMemory(m_curbe); - m_curbe = nullptr; -} - -MOS_STATUS VpRenderL0FcKernel::Init(VpRenderKernel &kernel) -{ - VP_FUNC_CALL(); - - VP_RENDER_NORMALMESSAGE("Initializing L0 FC krn %s", kernel.GetKernelName().c_str()); - - m_kernelSize = kernel.GetKernelSize(); - - uint8_t *pKernelBin = (uint8_t *)kernel.GetKernelBinPointer(); - VP_RENDER_CHK_NULL_RETURN(pKernelBin); - - m_kernelBinary = pKernelBin + kernel.GetKernelBinOffset(); - - m_kernelArgs = kernel.GetKernelArgs(); - - for (auto arg : m_kernelArgs) - { - arg.pData = nullptr; - } - - m_kernelBtis = kernel.GetKernelBtis(); - - m_kernelEnv = kernel.GetKernelExeEnv(); - - m_curbeSize = kernel.GetCurbeSize(); - - m_inlineData.resize(m_kernelEnv.uInlineDataPayloadSize); - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpRenderL0FcKernel::SetSamplerStates(KERNEL_SAMPLER_STATE_GROUP &samplerStateGroup) -{ - VP_FUNC_CALL(); - - if (m_kernelEnv.bHasSample) - { - samplerStateGroup.clear(); - MHW_SAMPLER_STATE_PARAM samplerStateParam = {}; - - samplerStateParam.Unorm.SamplerFilterMode = MHW_SAMPLER_FILTER_BILINEAR; - samplerStateParam.Unorm.MagFilter = MHW_GFX3DSTATE_MAPFILTER_LINEAR; - samplerStateParam.Unorm.MinFilter = MHW_GFX3DSTATE_MAPFILTER_LINEAR; - - samplerStateParam.Unorm.AddressU = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; - samplerStateParam.Unorm.AddressV = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; - samplerStateParam.Unorm.AddressW = MHW_GFX3DSTATE_TEXCOORDMODE_CLAMP; - - samplerStateParam.bInUse = true; - samplerStateParam.SamplerType = MHW_SAMPLER_TYPE_3D; - - samplerStateGroup.insert(std::make_pair(m_samplerIndex, samplerStateParam)); - } - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpRenderL0FcKernel::SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext) -{ - VP_FUNC_CALL(); - - //All pData will be free in VpL0FcFilter::Destroy so no need to free here - for (KRN_ARG &srcArg : kernelArgs) - { - for (KRN_ARG &dstArg : m_kernelArgs) - { - if (srcArg.uIndex == dstArg.uIndex) - { - if (dstArg.eArgKind == ARG_KIND_GENERAL || dstArg.eArgKind == ARG_KIND_INLINE) - { - if (srcArg.pData == nullptr) - { - VP_RENDER_ASSERTMESSAGE("The Kernel Argument General Data is null! KernelID %d, argIndex %d", m_kernelId, dstArg.uIndex); - return MOS_STATUS_INVALID_PARAMETER; - } - else - { - dstArg.eArgKind = srcArg.eArgKind; - dstArg.pData = srcArg.pData; - srcArg.pData = nullptr; - } - } - else if (dstArg.eArgKind == ARG_KIND_SAMPLER) - { - m_samplerIndex = dstArg.uOffsetInPayload; - } - } - } - - if (srcArg.eArgKind == ARG_KIND_SURFACE) - { - if (srcArg.pData == nullptr) - { - VP_RENDER_ASSERTMESSAGE("The Kernel Argument Surface is null! KernelID %d, argIndex %d", m_kernelId, srcArg.uIndex); - return MOS_STATUS_INVALID_PARAMETER; - } - else - { - SURFACE_PARAMS surfaceParams; - surfaceParams.isOutput = srcArg.isOutput; - surfaceParams.surfType = *(SurfaceType *)srcArg.pData; - m_argIndexSurfMap.insert(std::make_pair(srcArg.uIndex, surfaceParams)); - srcArg.pData = nullptr; - } - } - - if (srcArg.pData != nullptr) - { - srcArg.pData = nullptr; - VP_RENDER_ASSERTMESSAGE("The Kernel Argument is set but not used. KernelID %d, argIndex %d", m_kernelId, srcArg.uIndex); - } - } - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpRenderL0FcKernel::GetCurbeState(void *&curbe, uint32_t &curbeLength) -{ - VP_FUNC_CALL(); - curbeLength = m_curbeSize; - - VP_RENDER_NORMALMESSAGE("KernelID %d, Curbe Size %d\n", m_kernelId, curbeLength); - - if (curbeLength == 0) - { - return MOS_STATUS_INVALID_PARAMETER; - } - - uint8_t *pCurbe = (uint8_t *)MOS_AllocAndZeroMemory(curbeLength); - VP_RENDER_CHK_NULL_RETURN(pCurbe); - MOS_FreeMemAndSetNull(m_curbe); - m_curbe = pCurbe; - - for (auto &arg : m_kernelArgs) - { - switch (arg.eArgKind) - { - case ARG_KIND_GENERAL: - case ARG_KIND_SURFACE: - if (arg.pData != nullptr) - { - MOS_SecureMemcpy(pCurbe + arg.uOffsetInPayload, arg.uSize, arg.pData, arg.uSize); - VP_RENDER_NORMALMESSAGE("Setting Curbe State KernelID %d, index %d , value %d, argKind %d", m_kernelId, arg.uIndex, *(uint32_t *)arg.pData, arg.eArgKind); - } - else - { - VP_RENDER_NORMALMESSAGE("KernelID %d, index %d, argKind %d is empty", m_kernelId, arg.uIndex, arg.eArgKind); - } - break; - case ARG_KIND_INLINE: - case ARG_KIND_SAMPLER: - break; - default: - VP_PUBLIC_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); - } - } - - curbe = pCurbe; - - PrintCurbe(pCurbe, curbeLength); - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpRenderL0FcKernel::SetupSurfaceState() -{ - VP_FUNC_CALL(); - - KERNEL_SURFACE_STATE_PARAM kernelSurfaceParam; - - for (auto it = m_kernelBtis.begin(); it != m_kernelBtis.end(); ++it) - { - uint32_t argIndex = it->first; - uint32_t bti = it->second; - - VP_RENDER_NORMALMESSAGE("Setting Surface State for L0 FC. KernelID %d, layer %d, argIndex %d , bti %d", m_kernelId, m_layer, argIndex, bti); - - MOS_ZeroMemory(&kernelSurfaceParam, sizeof(KERNEL_SURFACE_STATE_PARAM)); - kernelSurfaceParam.surfaceOverwriteParams.updatedRenderSurfaces = true; - kernelSurfaceParam.surfaceOverwriteParams.bindedKernel = true; - PRENDERHAL_SURFACE_STATE_PARAMS pRenderSurfaceParams = &kernelSurfaceParam.surfaceOverwriteParams.renderSurfaceParams; - pRenderSurfaceParams->bAVS = false; - pRenderSurfaceParams->Boundary = RENDERHAL_SS_BOUNDARY_ORIGINAL; - SurfaceType surfType = SurfaceTypeInvalid; - MOS_HW_RESOURCE_DEF resourceType = MOS_HW_RESOURCE_USAGE_VP_INTERNAL_READ_WRITE_RENDER; - - auto surfHandle = m_argIndexSurfMap.find(argIndex); - VP_PUBLIC_CHK_NOT_FOUND_RETURN(surfHandle, &m_argIndexSurfMap); - surfType = surfHandle->second.surfType; - if (surfType == SurfaceTypeInvalid) - { - VP_RENDER_NORMALMESSAGE("Will skip surface argIndex %d, bti %d for it is set as invalid", argIndex, bti); - continue; - } - pRenderSurfaceParams->isOutput = surfHandle->second.isOutput; - if (m_surfaceState.find(surfType) != m_surfaceState.end()) - { - UpdateCurbeBindingIndex(surfType, bti); - continue; - } - auto surf = m_surfaceGroup->find(surfType); - if (m_surfaceGroup->end() == surf) - { - VP_RENDER_ASSERTMESSAGE("surf was not found %d", surfType); - return MOS_STATUS_NULL_POINTER; - } - VP_RENDER_CHK_NULL_RETURN(surf->second); - VP_RENDER_CHK_NULL_RETURN(surf->second->osSurface); - kernelSurfaceParam.surfaceOverwriteParams.updatedSurfaceParams = true; - kernelSurfaceParam.surfaceOverwriteParams.format = surf->second->osSurface->Format; - kernelSurfaceParam.surfaceOverwriteParams.width = MOS_MIN(surf->second->osSurface->dwWidth, static_cast(surf->second->rcSrc.right)); - kernelSurfaceParam.surfaceOverwriteParams.height = MOS_MIN(surf->second->osSurface->dwHeight, static_cast(surf->second->rcSrc.bottom)); - - pRenderSurfaceParams->MemObjCtl = (m_renderHal->pOsInterface->pfnCachePolicyGetMemoryObject( - resourceType, - m_renderHal->pOsInterface->pfnGetGmmClientContext(m_renderHal->pOsInterface))) - .DwordValue; - pRenderSurfaceParams->Component = COMPONENT_VPCommon; - - if (surf->second->osSurface->Type == MOS_GFXRES_BUFFER) - { - kernelSurfaceParam.surfaceOverwriteParams.updatedSurfaceParams = true; - kernelSurfaceParam.surfaceOverwriteParams.bufferResource = true; - } - - m_surfaceState.insert(std::make_pair(surfType, kernelSurfaceParam)); - - UpdateCurbeBindingIndex(surfType, bti); - } - - return MOS_STATUS_SUCCESS; -} - -MOS_STATUS VpRenderL0FcKernel::GetWalkerSetting(KERNEL_WALKER_PARAMS &walkerParam, KERNEL_PACKET_RENDER_DATA &renderData) -{ - VP_FUNC_CALL(); - - walkerParam = m_walkerParam; - - walkerParam.iBindingTable = renderData.bindingTable; - walkerParam.iMediaID = renderData.mediaID; - walkerParam.iCurbeOffset = renderData.iCurbeOffset; - // Should use renderData.iCurbeLength instead of kernelSettings.CURBE_Length. - // kernelSettings.CURBE_Length is 32 aligned with 5 bits shift. - // renderData.iCurbeLength is RENDERHAL_CURBE_BLOCK_ALIGN(64) aligned. - walkerParam.iCurbeLength = renderData.iCurbeLength; - - return MOS_STATUS_SUCCESS; -} - -// Only for Adv kernels. -MOS_STATUS VpRenderL0FcKernel::SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1) -{ - VP_FUNC_CALL(); - MOS_ZeroMemory(&m_walkerParam, sizeof(KERNEL_WALKER_PARAMS)); - - m_walkerParam.iBlocksX = threadSpace.uWidth; - m_walkerParam.iBlocksY = threadSpace.uHeight; - m_walkerParam.threadWidth = threadSpace.uLocalWidth; - m_walkerParam.threadHeight = threadSpace.uLocalHeight; - m_walkerParam.threadDepth = 1; - m_walkerParam.isVerticalPattern = false; - m_walkerParam.bSyncFlag = bSyncFlag; - - m_walkerParam.pipeControlParams.bUpdateNeeded = true; - m_walkerParam.pipeControlParams.bEnableDataPortFlush = true; - m_walkerParam.pipeControlParams.bUnTypedDataPortCacheFlush = true; - m_walkerParam.pipeControlParams.bFlushRenderTargetCache = false; - m_walkerParam.pipeControlParams.bInvalidateTextureCache = false; - - for (auto &arg : m_kernelArgs) - { - if (arg.eArgKind == ARG_KIND_INLINE) - { - if (arg.pData != nullptr) - { - MOS_SecureMemcpy(m_inlineData.data() + arg.uOffsetInPayload, arg.uSize, arg.pData, arg.uSize); - VP_RENDER_NORMALMESSAGE("Setting Inline Data KernelID %d, index %d , value %d, argKind %d", m_kernelId, arg.uIndex, *(uint32_t *)arg.pData, arg.eArgKind); - } - else - { - VP_RENDER_NORMALMESSAGE("KernelID %d, index %d, argKind %d is empty", m_kernelId, arg.uIndex, arg.eArgKind); - } - } - } - m_walkerParam.inlineDataLength = m_inlineData.size(); - m_walkerParam.inlineData = m_inlineData.data(); - - if (m_kernelEnv.uSimdSize != 1 && - (m_kernelEnv.uiWorkGroupWalkOrderDimensions[0] != 0 || - m_kernelEnv.uiWorkGroupWalkOrderDimensions[1] != 0 || - m_kernelEnv.uiWorkGroupWalkOrderDimensions[2] != 0)) - { - m_walkerParam.isEmitInlineParameter = true; - m_walkerParam.isGenerateLocalID = true; - m_walkerParam.emitLocal = MHW_EMIT_LOCAL_XYZ; - } - - return MOS_STATUS_SUCCESS; -} \ No newline at end of file diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_l0_fc_kernel.h b/media_softlet/agnostic/common/vp/hal/packet/vp_render_l0_fc_kernel.h deleted file mode 100644 index 020c432d18..0000000000 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_l0_fc_kernel.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2024, Intel Corporation -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -*/ -#ifndef __VP_RENDER_L0_FC_KERNEL_H__ -#define __VP_RENDER_L0_FC_KERNEL_H__ - -#include "vp_platform_interface.h" -#include "vp_render_kernel_obj.h" -#include "vp_render_cmd_packet.h" - -namespace vp -{ - -class VpRenderL0FcKernel : public VpRenderKernelObj -{ -public: - VpRenderL0FcKernel(PVP_MHWINTERFACE hwInterface, VpKernelID kernelID, uint32_t kernelIndex, PVpAllocator allocator); - virtual ~VpRenderL0FcKernel(); - - virtual MOS_STATUS Init(VpRenderKernel &kernel); - virtual MOS_STATUS GetCurbeState(void *&curbe, uint32_t &curbeLength); - virtual uint32_t GetInlineDataSize() override - { - return 0; - } - virtual MOS_STATUS SetSamplerStates(KERNEL_SAMPLER_STATE_GROUP &samplerStateGroup); - virtual MOS_STATUS GetWalkerSetting(KERNEL_WALKER_PARAMS &walkerParam, KERNEL_PACKET_RENDER_DATA &renderData); - - MOS_STATUS FreeCurbe(void *&curbe) - { - return MOS_STATUS_SUCCESS; - } - -protected: - virtual MOS_STATUS SetupSurfaceState() override; - virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1 = false); - virtual MOS_STATUS SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext); - - PRENDERHAL_INTERFACE m_renderHal = nullptr; - - //kernel Arguments - KERNEL_ARGS m_kernelArgs = {}; - KERNEL_BTIS m_kernelBtis = {}; - KRN_EXECUTE_ENV m_kernelEnv = {}; - KERNEL_WALKER_PARAMS m_walkerParam = {}; - void *m_curbe = nullptr; - uint32_t m_layer = 0; - uint32_t m_curbeSize = 0; - uint32_t m_samplerIndex = 0; - std ::vector m_inlineData = {}; - KERNEL_ARG_INDEX_SURFACE_MAP m_argIndexSurfMap = {}; - -MEDIA_CLASS_DEFINE_END(vp__VpRenderL0FcKernel) -}; -} // namespace vp -#endif //__VP_RENDER_L0_FC_KERNEL_H__