Skip to content

Commit

Permalink
[Media Common][VP] Coverity issues clean up
Browse files Browse the repository at this point in the history
For Coverity issues clean up.
  • Loading branch information
VickyZengg authored and intel-mediadev committed Aug 31, 2023
1 parent b8849cd commit 55b8982
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ VeboxCopyState::~VeboxCopyState()
m_veboxInterface->DestroyHeap();
m_veboxInterface = nullptr;
}

if (m_mhwInterfaces)
{
m_mhwInterfaces->Destroy();
MOS_Delete(m_mhwInterfaces);
}
}

MOS_STATUS VeboxCopyState::Initialize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,7 @@ MOS_STATUS VPHAL_VEBOX_STATE::VeboxSendVeboxCmd_Prepare(
PVPHAL_VEBOX_STATE pVeboxState = this;
PVPHAL_VEBOX_RENDER_DATA pRenderData = GetLastExecRenderData();

VPHAL_RENDER_CHK_NULL(pRenderData);
// Switch GPU context to VEBOX
VPHAL_RENDER_CHK_STATUS(pOsInterface->pfnSetGpuContext(pOsInterface, MOS_GPU_CONTEXT_VEBOX));

Expand Down Expand Up @@ -2964,6 +2965,7 @@ MOS_STATUS VPHAL_VEBOX_STATE::VeboxCopyAndUpdateVeboxState(

MOS_STATUS eStatus = MOS_STATUS_SUCCESS;

VPHAL_RENDER_CHK_NULL(pRenderData);
VPHAL_RENDER_ASSERT(pVeboxState);
VPHAL_RENDER_ASSERT(pRenderData);
VPHAL_RENDER_ASSERT(pSrcSurface);
Expand Down Expand Up @@ -3392,6 +3394,7 @@ MOS_STATUS VPHAL_VEBOX_STATE::VeboxRenderMode0(
PVPHAL_VEBOX_STATE pVeboxState = this;
PVPHAL_VEBOX_RENDER_DATA pRenderData = GetLastExecRenderData();

VPHAL_RENDER_CHK_NULL(pRenderData);
VPHAL_RENDER_ASSERT(pVeboxState);
VPHAL_RENDER_ASSERT(pRenderData);
VPHAL_RENDER_ASSERT(pSrcSurface);
Expand Down Expand Up @@ -3662,6 +3665,8 @@ MOS_STATUS VPHAL_VEBOX_STATE::Render(
bDIVeboxBypass = false;
pRenderData = pVeboxState->GetLastExecRenderData();

VPHAL_RENDER_CHK_NULL(pRenderData);

VPHAL_DBG_STATE_DUMPPER_SET_CURRENT_STAGE(VPHAL_DBG_STAGE_VEBOX);

// Check bSameSamples only when reference is avaliable, DI, Variance Query is enabled
Expand Down
5 changes: 2 additions & 3 deletions media_driver/agnostic/gen12/hw/mhw_state_heap_g12.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,9 @@ MOS_STATUS MHW_STATE_HEAP_INTERFACE_G12_X::SetSurfaceState(
pParams->psSurface->dwPitch : pParams->dwPitchToUse[i];
if (pParams->psSurface->MmcState == MOS_MEMCOMP_MC)
{
CmdInit.DW7.MemoryCompressionEnable =
(pParams->psSurface->MmcState == MOS_MEMCOMP_RC || pParams->psSurface->MmcState == MOS_MEMCOMP_MC) ? 1 : 0;
CmdInit.DW7.MemoryCompressionEnable = 1;
CmdInit.DW7.MemoryCompressionMode = 0;
CmdInit.DW4.DecompressInL3 = (pParams->psSurface->MmcState == MOS_MEMCOMP_MC) ? 1 : 0;
CmdInit.DW4.DecompressInL3 = 1;
}
else if(pParams->psSurface->MmcState == MOS_MEMCOMP_RC)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,7 @@ bool VPHAL_VEBOX_STATE_G12_BASE::IsNeeded(
pSrcSurface = pRenderPassData->pSrcSurface;

VPHAL_RENDER_CHK_NULL(pSrcSurface);
VPHAL_RENDER_CHK_NULL(pRenderData);

// Check whether VEBOX is available
// VTd doesn't support VEBOX
Expand Down
6 changes: 3 additions & 3 deletions media_driver/agnostic/gen12_tgllp/vp/hal/vphal_g12_tgllp.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class VphalStateG12Tgllp : public VphalState
{
bComputeContextEnabled = computeContextEnabled ? true : false;
}
#endif

if (!MEDIA_IS_SKU(m_skuTable, FtrCCSNode))
{
Expand All @@ -90,9 +89,10 @@ class VphalStateG12Tgllp : public VphalState

if (bComputeContextEnabled)
{
m_renderGpuContext = MOS_GPU_CONTEXT_COMPUTE;
m_renderGpuNode = MOS_GPU_NODE_COMPUTE;
m_renderGpuContext = MOS_GPU_CONTEXT_COMPUTE;
m_renderGpuNode = MOS_GPU_NODE_COMPUTE;
}
#endif
}

//!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ MOS_STATUS CodechalInterfacesNextXe_Hpm::Initialize(
if (CodecHalIsDecode(CodecFunction))
{
CODECHAL_PUBLIC_ASSERTMESSAGE("Decode allocation failed, Decoder with CodechalDeviceNext is not supported!");
MOS_Delete(hwInterface);
return MOS_STATUS_INVALID_PARAMETER;

}
Expand All @@ -876,20 +877,23 @@ MOS_STATUS CodechalInterfacesNextXe_Hpm::Initialize(
}
else
{
MOS_Delete(hwInterface);
return MOS_STATUS_INVALID_PARAMETER;
}
}
else
#endif
{
CODECHAL_PUBLIC_ASSERTMESSAGE("Unsupported encode function requested.");
MOS_Delete(hwInterface);
return MOS_STATUS_INVALID_PARAMETER;
}

}
else
{
CODECHAL_PUBLIC_ASSERTMESSAGE("Unsupported codec function requested.");
MOS_Delete(hwInterface);
return MOS_STATUS_INVALID_PARAMETER;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,9 @@ MOS_STATUS VpVeboxCmdPacketLegacy::SetUpdatedExecuteResource(
{
VP_FUNC_CALL();

VP_RENDER_CHK_NULL_RETURN(inputSurface);
VP_RENDER_CHK_NULL_RETURN(outputSurface);

m_allocator->UpdateResourceUsageType(&inputSurface->osSurface->OsResource, MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_FF);
m_allocator->UpdateResourceUsageType(&outputSurface->osSurface->OsResource, MOS_HW_RESOURCE_USAGE_VP_OUTPUT_PICTURE_FF);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,16 @@ MOS_STATUS MediaMemDeCompNext::MemoryDecompress(PMOS_RESOURCE targetResource)
{
VPHAL_MEMORY_DECOMP_CHK_NULL_RETURN(m_renderMutex);
MosUtilities::MosLockMutex(m_renderMutex);
VPHAL_MEMORY_DECOMP_CHK_STATUS_RETURN(RenderDecompCMD(&targetSurface));
MosUtilities::MosUnlockMutex(m_renderMutex);
eStatus = RenderDecompCMD(&targetSurface);
if (eStatus != MOS_STATUS_SUCCESS)
{
MosUtilities::MosUnlockMutex(m_renderMutex);
VPHAL_MEMORY_DECOMP_CHK_STATUS_RETURN(eStatus);
}
else
{
MosUtilities::MosUnlockMutex(m_renderMutex);
}
}
}
}
Expand Down

0 comments on commit 55b8982

Please sign in to comment.