Skip to content

Commit

Permalink
[Media Common] aligned GetSurface info for all compoment
Browse files Browse the repository at this point in the history
[Media Common] aligned GetSurface info for all compoment
GetSurfaceinfo is common function to get information from Gmm. Need aligned for all compoment and forbide to calucate it by themself

Change-Id: Ifb46317693b96d0b6a408fe0b9814ce272c0bb64
  • Loading branch information
fenhu authored and Zhong, Xiaoxia committed Jan 8, 2021
1 parent e4d6894 commit 4c5237b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 38 deletions.
29 changes: 29 additions & 0 deletions media_driver/linux/common/os/mos_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,9 @@ MOS_STATUS MosInterface::GetResourceInfo(
reqInfo[2].ArrayIndex = 0;
gmmResourceInfo->GetOffset(reqInfo[2]);
details.RenderOffset.YUV.Y.BaseOffset = reqInfo[2].Render.Offset;
details.RenderOffset.YUV.Y.XOffset = reqInfo[2].Render.XOffset;
details.RenderOffset.YUV.Y.YOffset = reqInfo[2].Render.YOffset;
details.LockOffset.YUV.Y = reqInfo[2].Lock.Offset;

// Get U/UV plane information (plane offset, X/Y offset)
reqInfo[0].ReqRender = true;
Expand All @@ -1649,6 +1652,7 @@ MOS_STATUS MosInterface::GetResourceInfo(
details.RenderOffset.YUV.U.BaseOffset = reqInfo[0].Render.Offset;
details.RenderOffset.YUV.U.XOffset = reqInfo[0].Render.XOffset;
details.RenderOffset.YUV.U.YOffset = reqInfo[0].Render.YOffset;
details.LockOffset.YUV.U = reqInfo[0].Lock.Offset;

// Get V plane information (plane offset, X/Y offset)
reqInfo[1].ReqRender = true;
Expand All @@ -1661,6 +1665,31 @@ MOS_STATUS MosInterface::GetResourceInfo(
details.RenderOffset.YUV.V.BaseOffset = reqInfo[1].Render.Offset;
details.RenderOffset.YUV.V.XOffset = reqInfo[1].Render.XOffset;
details.RenderOffset.YUV.V.YOffset = reqInfo[1].Render.YOffset;
details.LockOffset.YUV.V = reqInfo[1].Lock.Offset;

// Get Y plane information (plane offset, X / Y offset)
details.dwOffset = details.RenderOffset.YUV.Y.BaseOffset;
details.YPlaneOffset.iSurfaceOffset = details.RenderOffset.YUV.Y.BaseOffset;
details.YPlaneOffset.iXOffset = details.RenderOffset.YUV.Y.XOffset;
details.YPlaneOffset.iYOffset = details.RenderOffset.YUV.Y.YOffset;
details.YPlaneOffset.iLockSurfaceOffset = details.LockOffset.YUV.Y;

// Get U/UV plane information (plane offset, X/Y offset)
details.UPlaneOffset.iSurfaceOffset = details.RenderOffset.YUV.U.BaseOffset;
details.UPlaneOffset.iXOffset = details.RenderOffset.YUV.U.XOffset;
details.UPlaneOffset.iYOffset = details.RenderOffset.YUV.U.YOffset;
details.UPlaneOffset.iLockSurfaceOffset = details.LockOffset.YUV.U;

// Get V plane information (plane offset, X/Y offset)
details.VPlaneOffset.iSurfaceOffset = details.RenderOffset.YUV.V.BaseOffset;
details.VPlaneOffset.iXOffset = details.RenderOffset.YUV.V.XOffset;
details.VPlaneOffset.iYOffset = details.RenderOffset.YUV.V.YOffset;
details.VPlaneOffset.iLockSurfaceOffset = details.LockOffset.YUV.V;

details.YoffsetForUplane = (details.UPlaneOffset.iSurfaceOffset - details.dwOffset) / details.dwPitch +
details.UPlaneOffset.iYOffset;
details.YoffsetForVplane = (details.VPlaneOffset.iSurfaceOffset - details.dwOffset) / details.dwPitch +
details.VPlaneOffset.iYOffset;
}

return eStatus;
Expand Down
2 changes: 2 additions & 0 deletions media_driver/linux/common/os/mos_os_specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ struct MOS_SURFACE
// Tile Switch
MOS_TILE_MODE_GMM TileModeGMM; //!< [out] Transparent GMM Tiletype specifying in hwcmd finally
bool bGMMTileEnabled; //!< [out] GMM defined tile mode flag
uint32_t YoffsetForUplane; //!< [out] Y offset from U plane to Y plane.
uint32_t YoffsetForVplane; //!< [out] Y offset from V plane to Y plane.
};
typedef MOS_SURFACE *PMOS_SURFACE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,45 +490,15 @@ MOS_STATUS DecodeAllocator::GetSurfaceInfo(PMOS_SURFACE surface)
DECODE_CHK_NULL(m_allocator);
DECODE_CHK_NULL(surface);

MOS_SURFACE details;
MOS_ZeroMemory(&details, sizeof(details));
details.Format = Format_Invalid;

DECODE_CHK_STATUS(m_allocator->GetSurfaceInfo(&surface->OsResource, &details));

surface->Format = details.Format;
surface->dwWidth = details.dwWidth;
surface->dwHeight = details.dwHeight;
surface->dwPitch = details.dwPitch;
surface->dwDepth = details.dwDepth;
surface->dwQPitch = details.dwQPitch;
surface->bArraySpacing = details.bArraySpacing;
surface->TileType = details.TileType;
surface->TileModeGMM = details.TileModeGMM;
surface->bGMMTileEnabled = details.bGMMTileEnabled;
surface->dwOffset = details.RenderOffset.YUV.Y.BaseOffset;
surface->YPlaneOffset.iSurfaceOffset = details.RenderOffset.YUV.Y.BaseOffset;
surface->YPlaneOffset.iXOffset = details.RenderOffset.YUV.Y.XOffset;
surface->YPlaneOffset.iYOffset =
(surface->YPlaneOffset.iSurfaceOffset - surface->dwOffset) / surface->dwPitch +
details.RenderOffset.YUV.Y.YOffset;
surface->UPlaneOffset.iSurfaceOffset = details.RenderOffset.YUV.U.BaseOffset;
surface->UPlaneOffset.iXOffset = details.RenderOffset.YUV.U.XOffset;
surface->UPlaneOffset.iYOffset =
(surface->UPlaneOffset.iSurfaceOffset - surface->dwOffset) / surface->dwPitch +
details.RenderOffset.YUV.U.YOffset;
surface->UPlaneOffset.iLockSurfaceOffset = details.LockOffset.YUV.U;
surface->VPlaneOffset.iSurfaceOffset = details.RenderOffset.YUV.V.BaseOffset;
surface->VPlaneOffset.iXOffset = details.RenderOffset.YUV.V.XOffset;
surface->VPlaneOffset.iYOffset =
(surface->VPlaneOffset.iSurfaceOffset - surface->dwOffset) / surface->dwPitch +
details.RenderOffset.YUV.V.YOffset;
surface->VPlaneOffset.iLockSurfaceOffset = details.LockOffset.YUV.V;
surface->bCompressible = details.bCompressible;
surface->CompressionMode = details.CompressionMode;
surface->bIsCompressed = details.bIsCompressed;

surface->Format = Format_Invalid;
DECODE_CHK_STATUS(m_allocator->GetSurfaceInfo(&surface->OsResource, surface));
// Refine the surface's Yoffset as offset from Y plane, refer YOffsetForUCbInPixel, YOffsetForVCbInPixel.
surface->UPlaneOffset.iYOffset = (surface->UPlaneOffset.iSurfaceOffset - surface->dwOffset) / surface->dwPitch +
surface->UPlaneOffset.iYOffset;
surface->VPlaneOffset.iYOffset = (surface->VPlaneOffset.iSurfaceOffset - surface->dwOffset) / surface->dwPitch +
surface->VPlaneOffset.iYOffset;
return MOS_STATUS_SUCCESS;

}

MOS_STATUS DecodeAllocator::UpdateResoreceUsageType(
Expand Down

0 comments on commit 4c5237b

Please sign in to comment.