diff --git a/media_driver/agnostic/common/vp/hal/vphal_render_vebox_memdecomp.cpp b/media_driver/agnostic/common/vp/hal/vphal_render_vebox_memdecomp.cpp index acb9eae97c..0d89cdbe48 100644 --- a/media_driver/agnostic/common/vp/hal/vphal_render_vebox_memdecomp.cpp +++ b/media_driver/agnostic/common/vp/hal/vphal_render_vebox_memdecomp.cpp @@ -29,6 +29,8 @@ #include "vphal_debug.h" #include "vp_utils.h" +#define DECOMPRESSION_WIDTH_ALIGNMENT_IN_BYTE 32 + MediaVeboxDecompState::MediaVeboxDecompState(): MediaMemDecompBaseState(), m_osInterface(nullptr), @@ -663,7 +665,32 @@ MOS_STATUS MediaVeboxDecompState::GetResourceInfo(PMOS_SURFACE surface) &resDetails)); surface->Format = resDetails.Format; +#if defined(LINUX) && !defined(WDDM_LINUX) + if ((surface->Format == Format_NV12 || surface->Format == Format_P010) && surface->OsResource.iWidth & 1 != 0) + { + uint32_t bitsPerPixel = 8; + if (surface->Format == Format_P010) + { + bitsPerPixel = 16; + } + uint32_t alignWidth = MOS_ALIGN_CEIL(resDetails.dwWidth, DECOMPRESSION_WIDTH_ALIGNMENT_IN_BYTE*8/bitsPerPixel); + if (alignWidth <= resDetails.dwPitch*8/bitsPerPixel) + { + surface->dwWidth = alignWidth; + } + else + { + VPHAL_MEMORY_DECOMP_ASSERTMESSAGE("May got green line corruption."); + surface->dwWidth = resDetails.dwWidth; + } + } + else + { + surface->dwWidth = resDetails.dwWidth; + } +#else surface->dwWidth = resDetails.dwWidth; +#endif surface->dwHeight = resDetails.dwHeight; surface->dwPitch = resDetails.dwPitch; surface->dwDepth = resDetails.dwDepth; diff --git a/media_driver/linux/common/ddi/media_libva.cpp b/media_driver/linux/common/ddi/media_libva.cpp index a4cb3d5983..89156c2192 100755 --- a/media_driver/linux/common/ddi/media_libva.cpp +++ b/media_driver/linux/common/ddi/media_libva.cpp @@ -5192,7 +5192,7 @@ VAStatus SwizzleSurface(PDDI_MEDIA_CONTEXT mediaCtx, PGMM_RESOURCE_INFO pGmmResI memset(&gmmResCopyBlt, 0x0, sizeof(GMM_RES_COPY_BLT)); uiPicHeight = pGmmResInfo->GetBaseHeight(); - uiSize = pGmmResInfo->GetSizeSurface(); + uiSize = pGmmResInfo->GetSizeMainSurface(); uiPitch = pGmmResInfo->GetRenderPitch(); gmmResCopyBlt.Gpu.pData = pLockedAddr; gmmResCopyBlt.Sys.pData = pResourceBase; diff --git a/media_driver/linux/common/ddi/media_libva_util.cpp b/media_driver/linux/common/ddi/media_libva_util.cpp index fd0f8a0636..c2078682e5 100755 --- a/media_driver/linux/common/ddi/media_libva_util.cpp +++ b/media_driver/linux/common/ddi/media_libva_util.cpp @@ -529,6 +529,7 @@ VAStatus DdiMediaUtil_AllocateSurface( uiPlanesOrAuxPlanes = mediaSurface->pSurfDesc->uiPlanes/2; gmmCustomParams.AuxSurf.BaseAlignment = {0}; gmmCustomParams.Size = (uiPlanesOrAuxPlanes == 1) ? mediaSurface->pSurfDesc->uiOffsets[1]:mediaSurface->pSurfDesc->uiOffsets[2]; + gmmCustomParams.NoOfPlanes = mediaSurface->pSurfDesc->uiPlanes/2; } switch(uiPlanesOrAuxPlanes) {