Skip to content

Commit

Permalink
[Decode] Fix VC1 Green Line
Browse files Browse the repository at this point in the history
Modify SurfaceSize from Gmm instead of SurfaceHeight.

Change-Id: I73e30c1dbe6aed3f9480c4bcbc7ac8f4eed4d289
  • Loading branch information
wangqia6 authored and intel-mediadev committed Oct 17, 2019
1 parent fb1103f commit 4f1b231
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 8 additions & 5 deletions media_driver/agnostic/common/codec/hal/codechal_decode_vc1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ MOS_STATUS CodechalDecodeVc1::HandleSkipFrame()
MHW_GENERIC_PROLOG_PARAMS genericPrologParams;
MOS_SURFACE srcSurface;
uint8_t fwdRefIdx;
uint16_t surfaceHeight;
uint32_t surfaceSize;
MOS_SYNC_PARAMS syncParams;
MOS_STATUS eStatus = MOS_STATUS_SUCCESS;

Expand All @@ -1337,18 +1337,21 @@ MOS_STATUS CodechalDecodeVc1::HandleSkipFrame()
CODECHAL_DECODE_CHK_STATUS_RETURN(m_mmc->SetSurfaceMmcMode(&m_destSurface, &srcSurface));
#endif

surfaceHeight = MOS_ALIGN_CEIL(((srcSurface.dwHeight * 3) / 2), MOS_YTILE_H_ALIGNMENT);
surfaceSize = ((srcSurface.OsResource.pGmmResInfo->GetArraySize()) > 1) ?
((uint32_t)(srcSurface.OsResource.pGmmResInfo->GetQPitchPlanar(GMM_PLANE_Y) *
srcSurface.OsResource.pGmmResInfo->GetRenderPitch())) :
(uint32_t)(srcSurface.OsResource.pGmmResInfo->GetSizeMainSurface());

// HuC is present
if (m_hwInterface->m_noHuC)
{
CodechalDataCopyParams dataCopyParams;
MOS_ZeroMemory(&dataCopyParams, sizeof(CodechalDataCopyParams));
dataCopyParams.srcResource = &srcSurface.OsResource;
dataCopyParams.srcSize = surfaceHeight * m_destSurface.dwPitch;
dataCopyParams.srcSize = surfaceSize;
dataCopyParams.srcOffset = srcSurface.dwOffset;
dataCopyParams.dstResource = &m_destSurface.OsResource;
dataCopyParams.dstSize = surfaceHeight * m_destSurface.dwPitch;
dataCopyParams.dstSize = surfaceSize;
dataCopyParams.dstOffset = m_destSurface.dwOffset;

CODECHAL_DECODE_CHK_STATUS_RETURN(m_hwInterface->CopyDataSourceWithDrv(&dataCopyParams));
Expand Down Expand Up @@ -1381,7 +1384,7 @@ MOS_STATUS CodechalDecodeVc1::HandleSkipFrame()
&cmdBuffer, // pCmdBuffer
&srcSurface.OsResource, // presSrc
&m_destSurface.OsResource, // presDst
surfaceHeight * m_destSurface.dwPitch, // u32CopyLength
surfaceSize, // u32CopyLength
srcSurface.dwOffset, // u32CopyInputOffset
m_destSurface.dwOffset)); // u32CopyOutputOffset

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ MOS_STATUS CodechalDecodeVc1G11::HandleSkipFrame()
MHW_GENERIC_PROLOG_PARAMS genericPrologParams;
MOS_SURFACE srcSurface;
uint8_t fwdRefIdx;
uint16_t surfaceHeight;
uint32_t surfaceSize;
MOS_SYNC_PARAMS syncParams;
MOS_STATUS eStatus = MOS_STATUS_SUCCESS;

Expand All @@ -1119,17 +1119,20 @@ MOS_STATUS CodechalDecodeVc1G11::HandleSkipFrame()
CODECHAL_DECODE_CHK_STATUS_RETURN(m_mmc->SetSurfaceMmcMode(&m_destSurface, &srcSurface));
#endif

surfaceHeight = MOS_ALIGN_CEIL(((srcSurface.dwHeight * 3) / 2), MOS_YTILE_H_ALIGNMENT);
surfaceSize = ((srcSurface.OsResource.pGmmResInfo->GetArraySize()) > 1) ?
((uint32_t)(srcSurface.OsResource.pGmmResInfo->GetQPitchPlanar(GMM_PLANE_Y) *
srcSurface.OsResource.pGmmResInfo->GetRenderPitch())) :
(uint32_t)(srcSurface.OsResource.pGmmResInfo->GetSizeMainSurface());

if (m_hwInterface->m_noHuC)
{
CodechalDataCopyParams dataCopyParams;
MOS_ZeroMemory(&dataCopyParams, sizeof(CodechalDataCopyParams));
dataCopyParams.srcResource = &srcSurface.OsResource;
dataCopyParams.srcSize = surfaceHeight * m_destSurface.dwPitch;
dataCopyParams.srcSize = surfaceSize;
dataCopyParams.srcOffset = srcSurface.dwOffset;
dataCopyParams.dstResource = &m_destSurface.OsResource;
dataCopyParams.dstSize = surfaceHeight * m_destSurface.dwPitch;
dataCopyParams.dstSize = surfaceSize;
dataCopyParams.dstOffset = m_destSurface.dwOffset;

CODECHAL_DECODE_CHK_STATUS_RETURN(m_hwInterface->CopyDataSourceWithDrv(&dataCopyParams));
Expand Down Expand Up @@ -1162,7 +1165,7 @@ MOS_STATUS CodechalDecodeVc1G11::HandleSkipFrame()
&cmdBuffer, // pCmdBuffer
&srcSurface.OsResource, // presSrc
&m_destSurface.OsResource, // presDst
surfaceHeight * m_destSurface.dwPitch, // u32CopyLength
surfaceSize, // u32CopyLength
srcSurface.dwOffset, // u32CopyInputOffset
m_destSurface.dwOffset)); // u32CopyOutputOffset

Expand Down

0 comments on commit 4f1b231

Please sign in to comment.