diff --git a/media_common/agnostic/common/vp/hal/vp_common.h b/media_common/agnostic/common/vp/hal/vp_common.h index aacb54e8b32..3bda5f91125 100644 --- a/media_common/agnostic/common/vp/hal/vp_common.h +++ b/media_common/agnostic/common/vp/hal/vp_common.h @@ -130,6 +130,9 @@ struct VPHAL_SURFACE uint32_t dwWidth = 0; //!< Surface width uint32_t dwHeight = 0; //!< Surface height uint32_t dwPitch = 0; //!< Surface pitch + uint32_t dwYPitch = 0; //!< Surface Y plane pitch + uint32_t dwUPitch = 0; //!< Surface U plane pitch + uint32_t dwVPitch = 0; //!< Surface V plane pitch MOS_TILE_TYPE TileType = MOS_TILE_X; //!< Tile Type MOS_TILE_MODE_GMM TileModeGMM = MOS_TILE_LINEAR_GMM; //!< Tile Mode from GMM Definition bool bGMMTileEnabled = false; //!< GMM Tile Mode Flag diff --git a/media_common/linux/common/os/mos_os_specific.h b/media_common/linux/common/os/mos_os_specific.h index eb2ded3195c..69c3c9e794c 100644 --- a/media_common/linux/common/os/mos_os_specific.h +++ b/media_common/linux/common/os/mos_os_specific.h @@ -449,7 +449,10 @@ struct MOS_SURFACE uint32_t dwOffset; // Surface Offset (Y/Base) MOS_PLANE_OFFSET YPlaneOffset; // Y surface plane offset MOS_PLANE_OFFSET UPlaneOffset; // U surface plane offset - MOS_PLANE_OFFSET VPlaneOffset; // V surface plane + MOS_PLANE_OFFSET VPlaneOffset; // V surface plane offset + uint32_t dwYPitch; // Y surface plane pitch + uint32_t dwUPitch; // U surface plane pitch + uint32_t dwVPitch; // V surface plane pitch union { diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_common.c b/media_driver/agnostic/common/vp/hal/vphal_render_common.c index 10f97554414..1e64432a1a2 100644 --- a/media_driver/agnostic/common/vp/hal/vphal_render_common.c +++ b/media_driver/agnostic/common/vp/hal/vphal_render_common.c @@ -973,6 +973,9 @@ MOS_STATUS VpHal_RndrCommonInitRenderHalSurface( pRenderHalSurface->OsSurface.dwWidth = pVpSurface->dwWidth; pRenderHalSurface->OsSurface.dwHeight = pVpSurface->dwHeight; pRenderHalSurface->OsSurface.dwPitch = pVpSurface->dwPitch; + pRenderHalSurface->OsSurface.dwYPitch = pVpSurface->dwYPitch; + pRenderHalSurface->OsSurface.dwUPitch = pVpSurface->dwUPitch; + pRenderHalSurface->OsSurface.dwVPitch = pVpSurface->dwVPitch; pRenderHalSurface->OsSurface.Format = pVpSurface->Format; pRenderHalSurface->OsSurface.TileType = pVpSurface->TileType; pRenderHalSurface->OsSurface.TileModeGMM = pVpSurface->TileModeGMM; diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp b/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp index 95da3199e9e..3e59709dd35 100644 --- a/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp +++ b/media_driver/agnostic/common/vp/hal/vphal_render_composite.cpp @@ -6829,17 +6829,23 @@ bool CompositeState::BuildFilter( // Y_Uoffset(Height*2 + Height/2) of RENDERHAL_PLANES_YV12 define Bitfield_Range(0, 13) on gen9+. // The max value is 16383. So use PL3 kernel to avoid out of range when Y_Uoffset is larger than 16383. // Use PL3 plane to avoid YV12 blending issue with DI enabled and U channel shift issue with not 4-aligned height - if ((pFilter->format == Format_YV12) && - (pSrc->ScalingMode != VPHAL_SCALING_AVS) && - (pSrc->bIEF != true) && - (pSrc->SurfType != SURF_OUT_RENDERTARGET) && - m_pRenderHal->bEnableYV12SinglePass && - !pSrc->pDeinterlaceParams && - !pSrc->bInterlacedScaling && - MOS_IS_ALIGNED(pSrc->dwHeight, 4) && - ((pSrc->dwHeight * 2 + pSrc->dwHeight / 2) < RENDERHAL_MAX_YV12_PLANE_Y_U_OFFSET_G9)) - { - pFilter->format = Format_YV12_Planar; + if (pFilter->format == Format_YV12) + { + if (m_pOsInterface->trinityPath == TRINITY9_ENABLED) + { + pFilter->format = Format_PL3; + } + else if ((pSrc->ScalingMode != VPHAL_SCALING_AVS) && + (pSrc->bIEF != true) && + (pSrc->SurfType != SURF_OUT_RENDERTARGET) && + m_pRenderHal->bEnableYV12SinglePass && + !pSrc->pDeinterlaceParams && + !pSrc->bInterlacedScaling && + MOS_IS_ALIGNED(pSrc->dwHeight, 4) && + ((pSrc->dwHeight * 2 + pSrc->dwHeight / 2) < RENDERHAL_MAX_YV12_PLANE_Y_U_OFFSET_G9)) + { + pFilter->format = Format_YV12_Planar; + } } if (pFilter->format == Format_A8R8G8B8 || diff --git a/media_softlet/agnostic/common/renderhal/renderhal.cpp b/media_softlet/agnostic/common/renderhal/renderhal.cpp index d88ab7542c9..1d7d67b9d77 100644 --- a/media_softlet/agnostic/common/renderhal/renderhal.cpp +++ b/media_softlet/agnostic/common/renderhal/renderhal.cpp @@ -3224,6 +3224,7 @@ MOS_STATUS RenderHal_GetSurfaceStateEntries( uint16_t wVXOffset; uint16_t wVYOffset; bool bIsChromaSitEnabled; + bool bIsTri9YV12; //------------------------------------------------ MHW_RENDERHAL_CHK_NULL_RETURN(pRenderHal); @@ -3247,6 +3248,11 @@ MOS_STATUS RenderHal_GetSurfaceStateEntries( PlaneDefinition = RENDERHAL_PLANES_DEFINITION_COUNT; bIsChromaSitEnabled = 0; + // In trinity9, YV12 format will use 3 Planes + bIsTri9YV12 = pSurface->Format == Format_YV12 && + pRenderHal->pOsInterface != nullptr && + pRenderHal->pOsInterface->trinityPath == TRINITY9_ENABLED; + pRenderHal->bIsAVS = pParams->bAVS; // Check palette allocations @@ -3639,6 +3645,7 @@ MOS_STATUS RenderHal_GetSurfaceStateEntries( PlaneDefinition = (pRenderHal->bEnableYV12SinglePass && !pRenderHalSurface->pDeinterlaceParams && !pRenderHalSurface->bInterlacedScaling && + pRenderHal->pOsInterface->trinityPath != TRINITY9_ENABLED && MOS_IS_ALIGNED(pSurface->dwHeight, 4) && pRenderHalSurface->SurfType != RENDERHAL_SURF_OUT_RENDERTARGET && (pSurface->dwHeight * 2 + pSurface->dwHeight / 2) < RENDERHAL_MAX_YV12_PLANE_Y_U_OFFSET_G9)? @@ -4087,14 +4094,20 @@ MOS_STATUS RenderHal_GetSurfaceStateEntries( pSurfaceEntry->dwHeight = MOS_MAX(1, dwSurfaceHeight); pSurfaceEntry->bWidthInDword = bWidthInDword; - if (pPlane->ui8PlaneID == MHW_U_PLANE || - pPlane->ui8PlaneID == MHW_V_PLANE) + if (pPlane->ui8PlaneID == MHW_U_PLANE || pPlane->ui8PlaneID == MHW_V_PLANE) { - pSurfaceEntry->dwPitch = dwUVPitch; + if (bIsTri9YV12) + { + pSurfaceEntry->dwPitch = (pPlane->ui8PlaneID == MHW_U_PLANE) ? pSurface->dwUPitch : pSurface->dwVPitch; + } + else + { + pSurfaceEntry->dwPitch = dwUVPitch; + } } else { - pSurfaceEntry->dwPitch = pSurface->dwPitch; + pSurfaceEntry->dwPitch = bIsTri9YV12 ? pSurface->dwYPitch : pSurface->dwPitch; } pSurfaceEntry->dwQPitch = pSurface->dwQPitch; diff --git a/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_allocator.cpp b/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_allocator.cpp index 199625462ae..5460ebe75d4 100644 --- a/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_allocator.cpp +++ b/media_softlet/agnostic/common/vp/hal/bufferMgr/vp_allocator.cpp @@ -611,6 +611,9 @@ MOS_STATUS VpAllocator::GetSurfaceInfo(VPHAL_SURFACE *surface, VPHAL_GET_SURFACE surface->dwWidth = resDetails.dwWidth; surface->dwHeight = resDetails.dwHeight; surface->dwPitch = resDetails.dwPitch; + surface->dwYPitch = resDetails.dwYPitch; + surface->dwUPitch = resDetails.dwUPitch; + surface->dwVPitch = resDetails.dwVPitch; surface->dwSlicePitch = resDetails.dwSlicePitch; surface->dwDepth = resDetails.dwDepth; surface->TileType = resDetails.TileType; diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_fc_kernel.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_fc_kernel.cpp index 91bf6077998..ecdc24a49f7 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_fc_kernel.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_fc_kernel.cpp @@ -852,17 +852,25 @@ MOS_STATUS VpRenderFcKernel::BuildFilter( // Y_Uoffset(Height*2 + Height/2) of RENDERHAL_PLANES_YV12 define Bitfield_Range(0, 13) on gen9+. // The max value is 16383. So use PL3 kernel to avoid out of range when Y_Uoffset is larger than 16383. // Use PL3 plane to avoid YV12 blending issue with DI enabled and U channel shift issue with not 4-aligned height - if ((pFilter->format == Format_YV12) && - (src->scalingMode != VPHAL_SCALING_AVS) && - (src->iefEnabled != true) && - (src->surf->SurfType != SURF_OUT_RENDERTARGET) && - m_renderHal->bEnableYV12SinglePass && - !src->diParams && - !src->iscalingEnabled && - MOS_IS_ALIGNED(src->surf->osSurface->dwHeight, 4) && - ((src->surf->osSurface->dwHeight * 2 + src->surf->osSurface->dwHeight / 2) < RENDERHAL_MAX_YV12_PLANE_Y_U_OFFSET_G9)) - { - pFilter->format = Format_YV12_Planar; + if (pFilter->format == Format_YV12) + { + if (m_renderHal->pOsInterface != nullptr && + m_renderHal->pOsInterface->trinityPath == TRINITY9_ENABLED) + { + pFilter->format = Format_PL3; + } + else if ( + (src->scalingMode != VPHAL_SCALING_AVS) && + (src->iefEnabled != true) && + (src->surf->SurfType != SURF_OUT_RENDERTARGET) && + m_renderHal->bEnableYV12SinglePass && + !src->diParams && + !src->iscalingEnabled && + MOS_IS_ALIGNED(src->surf->osSurface->dwHeight, 4) && + ((src->surf->osSurface->dwHeight * 2 + src->surf->osSurface->dwHeight / 2) < RENDERHAL_MAX_YV12_PLANE_Y_U_OFFSET_G9)) + { + pFilter->format = Format_YV12_Planar; + } } if (pFilter->format == Format_A8R8G8B8 ||