Skip to content

Commit

Permalink
Revert "[Media Common] [VP] Remove mem decompress code and replace it…
Browse files Browse the repository at this point in the history
… with vebox copy"

This reverts commit 107dfc6.
  • Loading branch information
MicroYY authored and intel-mediadev committed Dec 6, 2023
1 parent 3910b70 commit 91a6605
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 282 deletions.
12 changes: 2 additions & 10 deletions media_common/agnostic/common/os/mos_os.h
Original file line number Diff line number Diff line change
Expand Up @@ -1005,19 +1005,11 @@ typedef struct _MOS_INTERFACE
PMOS_RESOURCE pOutputOsResource,
uint32_t copyWidth,
uint32_t copyHeight,
uint32_t copyInputOffset,
uint32_t copyOutputOffset,
uint32_t bpp,
bool bOutputCompressed);

MOS_STATUS (*pfnMonoSurfaceCopy) (
PMOS_INTERFACE pOsInterface,
PMOS_RESOURCE pInputOsResource,
PMOS_RESOURCE pOutputOsResource,
uint32_t copyWidth,
uint32_t copyHeight,
uint32_t copyInputOffset,
uint32_t copyOutputOffset,
bool bOutputCompressed);

MOS_STATUS (*pfnVerifyMosSurface) (
PMOS_SURFACE mosSurface,
bool &bIsValid);
Expand Down
2 changes: 1 addition & 1 deletion media_common/linux/common/os/mos_os_specific.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ struct _MOS_SPECIFIC_RESOURCE
MOS_PLANE_OFFSET YPlaneOffset; //!< Y surface plane offset
MOS_PLANE_OFFSET UPlaneOffset; //!< U surface plane offset
MOS_PLANE_OFFSET VPlaneOffset; //!< V surface plane offset
uint32_t dwOffset;

//!< to sync render target for multi-threading decoding mode
struct
Expand All @@ -387,6 +386,7 @@ struct _MOS_SPECIFIC_RESOURCE

#if MOS_MEDIASOLO_SUPPORTED
//!< these fields are only used while MediaSolo is enabled(bSoloInUse of OS_Interface is true).
uint32_t dwOffset;
FILE* pFile;
char *pcFilePath;
int32_t bManualSwizzlingInUse;
Expand Down
67 changes: 4 additions & 63 deletions media_driver/linux/common/os/mos_os_specific.c
Original file line number Diff line number Diff line change
Expand Up @@ -3320,6 +3320,8 @@ MOS_STATUS Mos_Specific_MediaCopyResource2D(
PMOS_RESOURCE outputOsResource,
uint32_t copyWidth,
uint32_t copyHeight,
uint32_t copyInputOffset,
uint32_t copyOutputOffset,
uint32_t bpp,
bool bOutputCompressed)
{
Expand All @@ -3335,7 +3337,7 @@ MOS_STATUS Mos_Specific_MediaCopyResource2D(
if (osInterface->apoMosEnabled)
{
return MosInterface::MediaCopyResource2D(osInterface->osStreamState, inputOsResource, outputOsResource,
copyWidth, copyHeight, bpp, bOutputCompressed);
copyWidth, copyHeight, copyInputOffset, copyOutputOffset, bpp, bOutputCompressed);
}

pContext = osInterface->pOsContext;
Expand All @@ -3344,7 +3346,7 @@ MOS_STATUS Mos_Specific_MediaCopyResource2D(
outputOsResource && outputOsResource->bo && outputOsResource->pGmmResInfo)
{
// Double Buffer Copy can support any tile status surface with/without compression
pContext->pfnMediaMemoryCopy2D(pContext, inputOsResource, outputOsResource, copyWidth, copyHeight, 0, 0, bpp, bOutputCompressed);
pContext->pfnMediaMemoryCopy2D(pContext, inputOsResource, outputOsResource, copyWidth, copyHeight, copyInputOffset, copyOutputOffset, bpp, bOutputCompressed);
}

eStatus = MOS_STATUS_SUCCESS;
Expand All @@ -3353,66 +3355,6 @@ MOS_STATUS Mos_Specific_MediaCopyResource2D(
return eStatus;
}

//!
//! \brief Copy mono picture
//! \details This is the copy function dedicated to mono picture copy
//! \param PMOS_INTERFACE pOsInterface
//! [in] pointer to OS Interface structure
//! \param PMOS_RESOURCE inputOsResource
//! [in] Input Resource object
//! \param PMOS_RESOURCE outputOsResource
//! [out] output Resource object
//! \param [in] copyWidth
//! The 2D surface Width
//! \param [in] copyHeight
//! The 2D surface height
//! \param [in] copyInputOffset
//! The offset of copied surface from
//! \param [in] copyOutputOffset
//! The offset of copied to
//! \param [in] bOutputCompressed
//! true means apply compression on output surface, else output uncompressed surface
//! \return MOS_STATUS
//! MOS_STATUS_SUCCESS if successful
//!
MOS_STATUS Mos_Specific_MonoSurfaceCopy(
PMOS_INTERFACE osInterface,
PMOS_RESOURCE inputOsResource,
PMOS_RESOURCE outputOsResource,
uint32_t copyWidth,
uint32_t copyHeight,
uint32_t copyInputOffset,
uint32_t copyOutputOffset,
bool bOutputCompressed)
{
MOS_STATUS eStatus = MOS_STATUS_UNKNOWN;
MOS_OS_CONTEXT *pContext = nullptr;

//---------------------------------------
MOS_OS_CHK_NULL_RETURN(osInterface);
MOS_OS_CHK_NULL_RETURN(inputOsResource);
MOS_OS_CHK_NULL_RETURN(outputOsResource);
//---------------------------------------

if (osInterface->apoMosEnabled)
{
return MosInterface::MonoSurfaceCopy(osInterface->osStreamState, inputOsResource, outputOsResource, copyWidth, copyHeight, copyInputOffset, copyOutputOffset, bOutputCompressed);
}

pContext = osInterface->pOsContext;

if (inputOsResource && inputOsResource->bo && inputOsResource->pGmmResInfo &&
outputOsResource && outputOsResource->bo && outputOsResource->pGmmResInfo)
{
// Double Buffer Copy can support any tile status surface with/without compression
pContext->pfnMediaMemoryCopy2D(pContext, inputOsResource, outputOsResource, copyWidth, copyHeight, 0, 0, 16, bOutputCompressed);
}

eStatus = MOS_STATUS_SUCCESS;

return eStatus;
}

//!
//! \brief Get Mos Context
//! \details Get Mos Context info
Expand Down Expand Up @@ -7152,7 +7094,6 @@ MOS_STATUS Mos_Specific_InitInterface(
pOsInterface->pfnSetDecompSyncRes = Mos_Specific_SetDecompSyncRes;
pOsInterface->pfnDoubleBufferCopyResource = Mos_Specific_DoubleBufferCopyResource;
pOsInterface->pfnMediaCopyResource2D = Mos_Specific_MediaCopyResource2D;
pOsInterface->pfnMonoSurfaceCopy = Mos_Specific_MonoSurfaceCopy;
pOsInterface->pfnGetMosContext = Mos_Specific_GetMosContext;
pOsInterface->pfnUpdateResourceUsageType = Mos_Specific_UpdateResourceUsageType;
pOsInterface->pfnRegisterResource = Mos_Specific_RegisterResource;
Expand Down
4 changes: 2 additions & 2 deletions media_softlet/agnostic/common/codec/hal/codechal_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1979,7 +1979,7 @@ CodechalDebugInterface::CodechalDebugInterface()

uint32_t bpp = surface->OsResource.pGmmResInfo->GetBitsPerPixel();

CODECHAL_DEBUG_CHK_STATUS(m_osInterface->pfnMediaCopyResource2D(m_osInterface, &surface->OsResource, &m_temp2DSurfForCopy.OsResource, surface->dwPitch, sizeSrcSurface / (surface->dwPitch), bpp, false));
CODECHAL_DEBUG_CHK_STATUS(m_osInterface->pfnMediaCopyResource2D(m_osInterface, &surface->OsResource, &m_temp2DSurfForCopy.OsResource, surface->dwPitch, sizeSrcSurface / (surface->dwPitch), 0, 0, bpp, false));

lockedAddr = (uint8_t *)m_osInterface->pfnLockResource(m_osInterface, &m_temp2DSurfForCopy.OsResource, &lockFlags);
CODECHAL_DEBUG_CHK_NULL(lockedAddr);
Expand Down Expand Up @@ -2659,7 +2659,7 @@ MOS_STATUS CodechalDebugInterface::DumpRgbDataOnYUVSurface(

uint32_t bpp = surface->OsResource.pGmmResInfo->GetBitsPerPixel();

CODECHAL_DEBUG_CHK_STATUS(m_osInterface->pfnMediaCopyResource2D(m_osInterface, &surface->OsResource, &m_temp2DSurfForCopy.OsResource, surface->dwPitch, sizeSrcSurface / (surface->dwPitch), bpp, false));
CODECHAL_DEBUG_CHK_STATUS(m_osInterface->pfnMediaCopyResource2D(m_osInterface, &surface->OsResource, &m_temp2DSurfForCopy.OsResource, surface->dwPitch, sizeSrcSurface / (surface->dwPitch), 0, 0, bpp, false));
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,15 @@ namespace decode
}
else
{
m_osInterface->pfnMonoSurfaceCopy(
m_osInterface->pfnMediaCopyResource2D(
m_osInterface,
&m_basicFeature->m_resMonoPicChromaBuffer->OsResource,
&m_basicFeature->m_destSurface.OsResource,
pitch,
uvblockHeight * 2,
0,
dstOffset,
16,
false);
}
}
Expand All @@ -170,14 +171,15 @@ namespace decode
}
else
{
m_osInterface->pfnMonoSurfaceCopy(
m_osInterface->pfnMediaCopyResource2D(
m_osInterface,
&m_basicFeature->m_resMonoPicChromaBuffer->OsResource,
&m_basicFeature->m_destSurface.OsResource,
pitch,
uvsize / pitch,
0,
dstOffset,
16,
false);
}
}
Expand Down
53 changes: 1 addition & 52 deletions media_softlet/agnostic/common/os/mos_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1657,26 +1657,6 @@ class MosInterface
MOS_RESOURCE_HANDLE outputResource,
bool outputCompressed);

//!
//! \brief Use media copy to copy resource
//!
//! \param [in] streamState
//! Handle of Os Stream State
//! \param [in] inputResource
//! Source resource.
//! \param [out] outputResource
//! Destination resource.
//! \param [in] preferMethod
//! Preferred copy engine.
//! \return MOS_STATUS
//! Return MOS_STATUS_SUCCESS if successful, otherwise failed
//!
static MOS_STATUS UnifiedMediaCopyResource(
MOS_STREAM_HANDLE streamState,
MOS_RESOURCE_HANDLE inputResource,
MOS_RESOURCE_HANDLE outputResource,
int preferMethod);

//!
//! \brief Copy Resource to Another Buffer
//! \details Decompress and Copy Resource to Another 2D Buffer
Expand All @@ -1701,45 +1681,14 @@ class MosInterface
//! MOS_STATUS_SUCCESS if successful
//!
static MOS_STATUS MediaCopyResource2D(
MOS_STREAM_HANDLE streamState,
MOS_RESOURCE_HANDLE inputResource,
MOS_RESOURCE_HANDLE outputResource,
uint32_t copyWidth,
uint32_t copyHeight,
uint32_t bpp,
bool outputCompressed);

//!
//! \brief Copy Mono Resource to Another Buffer
//! \details Decompress and Copy Mono Resource to Another 2D Buffer
//!
//! \param [in] streamState
//! Handle of Os Stream State
//! \param inputResource
//! [in] Input Resource object
//! \param outputResource
//! [out] output Resource object
//! \param [in] copyWidth
//! The 2D surface Width
//! \param [in] copyHeight
//! The 2D surface height
//! \param [in] copyInputOffset
//! The offset of copied surface from
//! \param [in] copyOutputOffset
//! The offset of copied to
//! \param [in] outputCompressed
//! True means apply compression on output surface, else output uncompressed surface
//! \return MOS_STATUS
//! MOS_STATUS_SUCCESS if successful
//!
static MOS_STATUS MonoSurfaceCopy(
MOS_STREAM_HANDLE streamState,
MOS_RESOURCE_HANDLE inputResource,
MOS_RESOURCE_HANDLE outputResource,
uint32_t copyWidth,
uint32_t copyHeight,
uint32_t copyInputOffset,
uint32_t copyOutputOffset,
uint32_t bpp,
bool outputCompressed);

//!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ uint32_t GetMinRequiredSurfaceSizeInBytes(uint32_t pitch, uint32_t height, MOS_F
case Format_P8:
case Format_L8:
case Format_A8:
case Format_Y16U:
nBytes = pitch * height;
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ MOS_STATUS VeboxCopyStateNext::GetResourceInfo(PMOS_SURFACE surface)
surface->bGMMTileEnabled = resDetails.bGMMTileEnabled;
surface->bCompressible = resDetails.bCompressible;
surface->bIsCompressed = resDetails.bIsCompressed;
surface->dwOffset = resDetails.RenderOffset.YUV.Y.BaseOffset + surface->OsResource.dwOffset;
surface->dwOffset = resDetails.RenderOffset.YUV.Y.BaseOffset;
surface->YPlaneOffset.iSurfaceOffset = resDetails.RenderOffset.YUV.Y.BaseOffset;
surface->YPlaneOffset.iXOffset = resDetails.RenderOffset.YUV.Y.XOffset;
surface->YPlaneOffset.iYOffset = resDetails.RenderOffset.YUV.Y.YOffset;
Expand Down Expand Up @@ -606,8 +606,7 @@ bool VeboxCopyStateNext::IsFormatSupported(PMOS_SURFACE surface)
surface->Format != Format_A8B8G8R8 &&
surface->Format != Format_X8R8G8B8 &&
surface->Format != Format_X8B8G8R8 &&
surface->Format != Format_P8 &&
surface->Format != Format_Y16U)
surface->Format != Format_P8)
{
VEBOX_COPY_NORMALMESSAGE("Unsupported Source Format '0x%08x' for VEBOX Decompression.", surface->Format);
return bRet;
Expand Down
Loading

0 comments on commit 91a6605

Please sign in to comment.