From c4442ddad7f8a83bcd2d9db24ebfcae5c64531ed Mon Sep 17 00:00:00 2001 From: luleilei1 Date: Thu, 28 Sep 2023 10:25:24 +0800 Subject: [PATCH] Revert "[Decode] Fix some linux coverity issues" This reverts commit intel-innersource/drivers.gpu.unified#c1f57e463 --- .../codec/hal/codechal_decode_nv12top010.cpp | 4 ++-- .../codec/hal/codechal_decode_scalability.cpp | 1 - .../agnostic/common/codec/hal/codechal_hw.cpp | 1 - .../agnostic/common/codec/hal/codechal_hw.h | 2 +- .../gen10/hw/vdbox/mhw_vdbox_hcp_g10_X.cpp | 2 +- .../gen11/codec/hal/codechal_decode_avc_g11.cpp | 14 +++++++------- .../gen11/codec/hal/codechal_decode_hevc_g11.cpp | 9 +++------ .../gen11/codec/hal/codechal_decode_vp9_g11.cpp | 1 - .../codec/hal/codechal_huc_cmd_initializer_g11.cpp | 2 +- .../gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp | 2 +- .../agnostic/gen12/codec/hal/codechal_hw_g12_X.cpp | 1 + .../gen8/codec/hal/codechal_fei_avc_g8.cpp | 1 - .../gen9/codec/hal/codechal_fei_avc_g9.cpp | 4 ++-- .../common/codec/ddi/media_ddi_decode_avc.cpp | 3 +-- .../common/codec/ddi/media_ddi_decode_base.cpp | 6 ++++++ .../common/codec/ddi/media_ddi_decode_vc1.cpp | 2 +- .../av1/features/decode_av1_temporal_buffers_g12.h | 4 ++-- .../dec/av1/features/decode_av1_temporal_buffers.h | 4 ++-- .../hal/dec/shared/mmc/decode_mem_compression.cpp | 1 - .../common/codec/hal/shared/codec_hw_next.cpp | 1 - .../codec/ddi/dec/ddi_decode_avc_specific.cpp | 3 +-- .../codec/ddi/dec/ddi_decode_base_specific.cpp | 7 +++++++ .../media_interfaces_mtl/media_interfaces_mtl.cpp | 11 ----------- 23 files changed, 39 insertions(+), 47 deletions(-) diff --git a/media_driver/agnostic/common/codec/hal/codechal_decode_nv12top010.cpp b/media_driver/agnostic/common/codec/hal/codechal_decode_nv12top010.cpp index 8f8a1d4d19b..a3c041e233e 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_decode_nv12top010.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_decode_nv12top010.cpp @@ -94,9 +94,9 @@ MOS_STATUS CodechalDecodeNV12ToP010::Execute( surfaceRT->GetSurfaceDesc(surfaceWidth, surfaceHeight, format, sizePerPixel); SurfaceIndex *srcSurfaceIndex; - CODECHAL_DECODE_CHK_STATUS_RETURN(srcCmSurface2D->GetIndex(srcSurfaceIndex)); + srcCmSurface2D->GetIndex(srcSurfaceIndex); SurfaceIndex *dstSurfaceIndex; - CODECHAL_DECODE_CHK_STATUS_RETURN(dstCmSurface2D->GetIndex(dstSurfaceIndex)); + dstCmSurface2D->GetIndex(dstSurfaceIndex); CODECHAL_DECODE_CHK_STATUS_RETURN(m_cmDevice->CreateTask(m_cmTask)); CODECHAL_DECODE_CHK_NULL_RETURN(m_cmTask); diff --git a/media_driver/agnostic/common/codec/hal/codechal_decode_scalability.cpp b/media_driver/agnostic/common/codec/hal/codechal_decode_scalability.cpp index 52d7b8b7636..ecd2cb53a31 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_decode_scalability.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_decode_scalability.cpp @@ -2033,7 +2033,6 @@ MOS_STATUS CodecHalDecodeScalability_InitializeState ( GpuContext = MOS_VE_MULTINODESCALING_SUPPORTED(osInterface) ? MOS_GPU_CONTEXT_VIDEO4 : GpuContext; MHW_VDBOX_GPUNODE_LIMIT gpuNodeLimit; - MOS_ZeroMemory(&gpuNodeLimit, sizeof(MHW_VDBOX_GPUNODE_LIMIT)); CODECHAL_DECODE_CHK_STATUS_RETURN(vdboxMfxInterface->FindGpuNodeToUse( &gpuNodeLimit)); MOS_GPU_NODE videoGpuNode = (MOS_GPU_NODE)(gpuNodeLimit.dwGpuNodeToUse); diff --git a/media_driver/agnostic/common/codec/hal/codechal_hw.cpp b/media_driver/agnostic/common/codec/hal/codechal_hw.cpp index 040f8ada566..0eec7eee054 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_hw.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_hw.cpp @@ -38,7 +38,6 @@ CodechalHwInterface::CodechalHwInterface( // Basic intialization m_osInterface = osInterface; - MOS_ZeroMemory(&m_platform, sizeof(PLATFORM)); m_osInterface->pfnGetPlatform(m_osInterface, &m_platform); m_skuTable = m_osInterface->pfnGetSkuTable(m_osInterface); diff --git a/media_driver/agnostic/common/codec/hal/codechal_hw.h b/media_driver/agnostic/common/codec/hal/codechal_hw.h index 822e1e373bc..0194138362a 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_hw.h +++ b/media_driver/agnostic/common/codec/hal/codechal_hw.h @@ -478,7 +478,7 @@ class CodechalHwInterface { CODECHAL_HW_FUNCTION_ENTER; - if (MEDIA_IS_WA(m_waTable, WaHucStreamoutEnable) && m_osInterface) + if (MEDIA_IS_WA(m_waTable, WaHucStreamoutEnable)) { m_osInterface->pfnFreeResource( m_osInterface, diff --git a/media_driver/agnostic/gen10/hw/vdbox/mhw_vdbox_hcp_g10_X.cpp b/media_driver/agnostic/gen10/hw/vdbox/mhw_vdbox_hcp_g10_X.cpp index 127a665dcff..0b73f25d95e 100644 --- a/media_driver/agnostic/gen10/hw/vdbox/mhw_vdbox_hcp_g10_X.cpp +++ b/media_driver/agnostic/gen10/hw/vdbox/mhw_vdbox_hcp_g10_X.cpp @@ -2070,7 +2070,7 @@ MOS_STATUS MhwVdboxHcpInterfaceG10::AddHcpEncodeSliceStateCmd( = hevcSliceParams->slice_temporal_mvp_enable_flag; cmd.DW3.Sliceqp = hevcSliceParams->slice_qp_delta + hevcPicParams->QpY; cmd.DW3.SliceCbQpOffset = hevcSliceParams->slice_cb_qp_offset; - cmd.DW3.SliceCrQpOffset = hevcSliceParams->slice_cr_qp_offset; + cmd.DW3.SliceCbQpOffset = hevcSliceParams->slice_cr_qp_offset; cmd.DW3.Intrareffetchdisable = hevcSliceState->bIntraRefFetchDisable; cmd.DW4.SliceHeaderDisableDeblockingFilterFlag = hevcSliceParams->slice_deblocking_filter_disable_flag; diff --git a/media_driver/agnostic/gen11/codec/hal/codechal_decode_avc_g11.cpp b/media_driver/agnostic/gen11/codec/hal/codechal_decode_avc_g11.cpp index ed6cdf0d901..5b1396e8b24 100644 --- a/media_driver/agnostic/gen11/codec/hal/codechal_decode_avc_g11.cpp +++ b/media_driver/agnostic/gen11/codec/hal/codechal_decode_avc_g11.cpp @@ -233,13 +233,13 @@ MOS_STATUS CodechalDecodeAvcG11::DecodePrimitiveLevel() DecodeProcessingParams *decProcessingParams = (DecodeProcessingParams *)m_decodeParams.m_procParams; if (decProcessingParams != nullptr && decProcessingParams->m_isReferenceOnlyPattern) { - CODECHAL_DECODE_CHK_STATUS_RETURN(HucCopy(&cmdBuffer, - &m_destSurface.OsResource, - &decProcessingParams->m_outputSurface->OsResource, - decProcessingParams->m_outputSurface->dwSize, - m_destSurface.dwOffset, - decProcessingParams->m_outputSurface->dwOffset - )); + HucCopy(&cmdBuffer, + &m_destSurface.OsResource, + &decProcessingParams->m_outputSurface->OsResource, + decProcessingParams->m_outputSurface->dwSize, + m_destSurface.dwOffset, + decProcessingParams->m_outputSurface->dwOffset + ); } #endif diff --git a/media_driver/agnostic/gen11/codec/hal/codechal_decode_hevc_g11.cpp b/media_driver/agnostic/gen11/codec/hal/codechal_decode_hevc_g11.cpp index a9153bf76ff..89d7e7369c1 100644 --- a/media_driver/agnostic/gen11/codec/hal/codechal_decode_hevc_g11.cpp +++ b/media_driver/agnostic/gen11/codec/hal/codechal_decode_hevc_g11.cpp @@ -294,11 +294,9 @@ MOS_STATUS CodechalDecodeHevcG11::SetFrameStates () } CODECHAL_DECODE_CHK_STATUS_RETURN(CheckAndCopyBitstream()); - if (m_hevcPicParams->CurrPic.FrameIdx < CODECHAL_NUM_UNCOMPRESSED_SURFACE_HEVC) - { - PCODEC_REF_LIST destEntry = m_hevcRefList[m_hevcPicParams->CurrPic.FrameIdx]; - MOS_ZeroMemory(destEntry, sizeof(CODEC_REF_LIST)); - } + + PCODEC_REF_LIST destEntry = m_hevcRefList[m_hevcPicParams->CurrPic.FrameIdx]; + MOS_ZeroMemory(destEntry, sizeof(CODEC_REF_LIST)); if (m_incompletePicture) { @@ -666,7 +664,6 @@ MOS_STATUS CodechalDecodeHevcG11::SetAndPopulateVEHintParams( if (static_cast(m_mfxInterface)->IsScalabilitySupported() && MOS_VE_SUPPORTED(m_osInterface)) { CODECHAL_DECODE_SCALABILITY_SETHINT_PARMS scalSetParms; - MOS_ZeroMemory(&scalSetParms, sizeof(CODECHAL_DECODE_SCALABILITY_SETHINT_PARMS)); if (!MOS_VE_CTXBASEDSCHEDULING_SUPPORTED(m_osInterface)) { scalSetParms.bNeedSyncWithPrevious = true; diff --git a/media_driver/agnostic/gen11/codec/hal/codechal_decode_vp9_g11.cpp b/media_driver/agnostic/gen11/codec/hal/codechal_decode_vp9_g11.cpp index c583f344810..d9f7dbfe6ac 100644 --- a/media_driver/agnostic/gen11/codec/hal/codechal_decode_vp9_g11.cpp +++ b/media_driver/agnostic/gen11/codec/hal/codechal_decode_vp9_g11.cpp @@ -371,7 +371,6 @@ MOS_STATUS CodechalDecodeVp9G11::SetAndPopulateVEHintParams( if (static_cast(m_mfxInterface)->IsScalabilitySupported() && MOS_VE_SUPPORTED(m_osInterface)) { CODECHAL_DECODE_SCALABILITY_SETHINT_PARMS scalSetParms; - MOS_ZeroMemory(&scalSetParms, sizeof(CODECHAL_DECODE_SCALABILITY_SETHINT_PARMS)); if (!MOS_VE_CTXBASEDSCHEDULING_SUPPORTED(m_osInterface)) { scalSetParms.bNeedSyncWithPrevious = true; diff --git a/media_driver/agnostic/gen11/codec/hal/codechal_huc_cmd_initializer_g11.cpp b/media_driver/agnostic/gen11/codec/hal/codechal_huc_cmd_initializer_g11.cpp index 65da05cf84c..4489e5f0fc2 100644 --- a/media_driver/agnostic/gen11/codec/hal/codechal_huc_cmd_initializer_g11.cpp +++ b/media_driver/agnostic/gen11/codec/hal/codechal_huc_cmd_initializer_g11.cpp @@ -686,7 +686,7 @@ MOS_STATUS CodechalCmdInitializerG11::SetCopyDmem() m_osInterface, &m_cmdInitializerCopyDmemBuffer[m_encoder->m_currRecycledBufIdx][m_currentPass], &lockFlagsWriteOnly); CODECHAL_ENCODE_CHK_NULL_RETURN(hucCmdCopyDmem); - MOS_ZeroMemory(hucCmdCopyDmem, sizeof(HucComDmem)); + MOS_ZeroMemory(hucCmdCopyDmem, sizeof(hucCmdCopyDmem)); hucCmdCopyDmem->TotalOutputCommands = 1; diff --git a/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp b/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp index 424e2e9bf5e..6df0e5dcd96 100644 --- a/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp +++ b/media_driver/agnostic/gen11/hw/vdbox/mhw_vdbox_hcp_g11_X.cpp @@ -2917,7 +2917,7 @@ MOS_STATUS MhwVdboxHcpInterfaceG11::AddHcpEncodeSliceStateCmd( cmd.DW3.SliceTemporalMvpEnableFlag = hevcSliceParams->slice_temporal_mvp_enable_flag; cmd.DW3.Sliceqp = abs(hevcSliceParams->slice_qp_delta + hevcPicParams->QpY); cmd.DW3.SliceCbQpOffset = hevcSliceParams->slice_cb_qp_offset; - cmd.DW3.SliceCrQpOffset = hevcSliceParams->slice_cr_qp_offset; + cmd.DW3.SliceCbQpOffset = hevcSliceParams->slice_cr_qp_offset; cmd.DW3.Intrareffetchdisable = hevcSliceState->bIntraRefFetchDisable; cmd.DW4.SliceHeaderDisableDeblockingFilterFlag = hevcSliceParams->slice_deblocking_filter_disable_flag; diff --git a/media_driver/agnostic/gen12/codec/hal/codechal_hw_g12_X.cpp b/media_driver/agnostic/gen12/codec/hal/codechal_hw_g12_X.cpp index 053aca9e8b8..ad38b358d17 100644 --- a/media_driver/agnostic/gen12/codec/hal/codechal_hw_g12_X.cpp +++ b/media_driver/agnostic/gen12/codec/hal/codechal_hw_g12_X.cpp @@ -606,6 +606,7 @@ CodechalHwInterfaceG12::~CodechalHwInterfaceG12() if (m_avpInterface) { MOS_Delete(m_avpInterface); + m_avpInterface = nullptr; } } diff --git a/media_driver/agnostic/gen8/codec/hal/codechal_fei_avc_g8.cpp b/media_driver/agnostic/gen8/codec/hal/codechal_fei_avc_g8.cpp index d2cb0ab38bf..1de653fed46 100644 --- a/media_driver/agnostic/gen8/codec/hal/codechal_fei_avc_g8.cpp +++ b/media_driver/agnostic/gen8/codec/hal/codechal_fei_avc_g8.cpp @@ -7752,7 +7752,6 @@ MOS_STATUS CodechalEncodeAvcEncFeiG8::SetCurbeAvcPreProc(PCODECHAL_ENCODE_AVC_PR refWidth = 64; refHeight = 32; lenSP = 32; - break; case 8: // Exhaustive 48 SUs 64x32 window refWidth = 64; diff --git a/media_driver/agnostic/gen9/codec/hal/codechal_fei_avc_g9.cpp b/media_driver/agnostic/gen9/codec/hal/codechal_fei_avc_g9.cpp index 03c6c676d7c..4861734db0c 100644 --- a/media_driver/agnostic/gen9/codec/hal/codechal_fei_avc_g9.cpp +++ b/media_driver/agnostic/gen9/codec/hal/codechal_fei_avc_g9.cpp @@ -6711,10 +6711,10 @@ MOS_STATUS CodechalEncodeAvcEncFeiG9::SendAvcMfeMbEncSurfaces(PMOS_COMMAND_BUFFE } } - CODECHAL_ENCODE_CHK_STATUS_RETURN(m_cmDev->CreateVmeSurfaceG7_5(cmSurfForVME, &surfArrayL0[0], &surfArrayL1[0], refNum0, refNum1, cmVmeSurfIdx[0 + vmeIdx])); + m_cmDev->CreateVmeSurfaceG7_5(cmSurfForVME, &surfArrayL0[0], &surfArrayL1[0], refNum0, refNum1, cmVmeSurfIdx[0 + vmeIdx]); cmSurfaces->MBVMEInterPredictionSurfIndex = cmVmeSurfIdx[0 + vmeIdx]; - CODECHAL_ENCODE_CHK_STATUS_RETURN(m_cmDev->CreateVmeSurfaceG7_5(cmSurfForVME, &surfArrayL1[0], &surfArrayL1[0], refNum1, refNum1, cmVmeSurfIdx[1 + vmeIdx])); + m_cmDev->CreateVmeSurfaceG7_5(cmSurfForVME, &surfArrayL1[0], &surfArrayL1[0], refNum1, refNum1, cmVmeSurfIdx[1 + vmeIdx]); cmSurfaces->MBVMEInterPredictionMRSurfIndex = cmVmeSurfIdx[1 + vmeIdx]; CM_VME_SURFACE_STATE_PARAM vmeDimensionParam; diff --git a/media_driver/linux/common/codec/ddi/media_ddi_decode_avc.cpp b/media_driver/linux/common/codec/ddi/media_ddi_decode_avc.cpp index c9b8da0f97d..588bfcd36e8 100644 --- a/media_driver/linux/common/codec/ddi/media_ddi_decode_avc.cpp +++ b/media_driver/linux/common/codec/ddi/media_ddi_decode_avc.cpp @@ -251,8 +251,7 @@ VAStatus DdiDecodeAVC::ParsePicParams( for (i = 0; i < CODEC_MAX_NUM_REF_FRAME; i++) { //Check the surface id of reference list - if (avcPicParams->RefFrameList[i].FrameIdx < CODEC_AVC_NUM_UNCOMPRESSED_SURFACE - && VA_INVALID_ID == m_ddiDecodeCtx->RecListSurfaceID[avcPicParams->RefFrameList[i].FrameIdx]) + if (VA_INVALID_ID == m_ddiDecodeCtx->RecListSurfaceID[avcPicParams->RefFrameList[i].FrameIdx]) { //Set invalid flag avcPicParams->RefFrameList[i].PicFlags = PICTURE_INVALID; diff --git a/media_driver/linux/common/codec/ddi/media_ddi_decode_base.cpp b/media_driver/linux/common/codec/ddi/media_ddi_decode_base.cpp index ed98570feec..10dbbe7f1bc 100644 --- a/media_driver/linux/common/codec/ddi/media_ddi_decode_base.cpp +++ b/media_driver/linux/common/codec/ddi/media_ddi_decode_base.cpp @@ -1022,6 +1022,12 @@ VAStatus DdiMediaDecode::CreateBuffer( buf->format = Media_Format_CPU; break; case VASubsetsParameterBufferType: + //maximum entry point supported should not be more than 440 + if(numElements > 440) + { + va = VA_STATUS_ERROR_INVALID_PARAMETER; + goto CleanUpandReturn; + } buf->pData = (uint8_t*)MOS_AllocAndZeroMemory(size * numElements); buf->format = Media_Format_CPU; break; diff --git a/media_driver/linux/common/codec/ddi/media_ddi_decode_vc1.cpp b/media_driver/linux/common/codec/ddi/media_ddi_decode_vc1.cpp index 7c84c06573f..bbbdc0d3dcf 100644 --- a/media_driver/linux/common/codec/ddi/media_ddi_decode_vc1.cpp +++ b/media_driver/linux/common/codec/ddi/media_ddi_decode_vc1.cpp @@ -200,7 +200,7 @@ VAStatus DdiDecodeVC1::ParsePicParams( } uint32_t scaleFactor = 0; // See spec, table 40 && Figure 70 - if (picParam->b_picture_fraction < 21) + if ((picParam->b_picture_fraction >= 0) && (picParam->b_picture_fraction < 21)) { scaleFactor = FractionToScaleFactor[picParam->b_picture_fraction]; } diff --git a/media_driver/media_softlet/agnostic/gen12/codec/hal/dec/av1/features/decode_av1_temporal_buffers_g12.h b/media_driver/media_softlet/agnostic/gen12/codec/hal/dec/av1/features/decode_av1_temporal_buffers_g12.h index 57e7fd8ffe4..71479f04bf8 100644 --- a/media_driver/media_softlet/agnostic/gen12/codec/hal/dec/av1/features/decode_av1_temporal_buffers_g12.h +++ b/media_driver/media_softlet/agnostic/gen12/codec/hal/dec/av1/features/decode_av1_temporal_buffers_g12.h @@ -53,8 +53,8 @@ namespace decode inline Av1SharedBuf *RefSharedBuffer(Av1SharedBuf *sharedBuf); inline Av1SharedBuf *DeRefSharedBuffer(Av1SharedBuf *sharedBuf); MhwVdboxAvpInterface *m_avpInterface = nullptr; //!< Avp interface; - int32_t widthInSb = 0; - int32_t heightInSb = 0; + int32_t widthInSb; + int32_t heightInSb; MEDIA_CLASS_DEFINE_END(decode__Av1TempBufferOpInfG12) }; diff --git a/media_softlet/agnostic/common/codec/hal/dec/av1/features/decode_av1_temporal_buffers.h b/media_softlet/agnostic/common/codec/hal/dec/av1/features/decode_av1_temporal_buffers.h index 5b543a5a748..aeac066dde7 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/av1/features/decode_av1_temporal_buffers.h +++ b/media_softlet/agnostic/common/codec/hal/dec/av1/features/decode_av1_temporal_buffers.h @@ -56,8 +56,8 @@ namespace decode inline Av1SharedBuf *RefSharedBuffer(Av1SharedBuf *sharedBuf); inline Av1SharedBuf *DeRefSharedBuffer(Av1SharedBuf *sharedBuf); std::shared_ptr m_avpItf = nullptr; - int32_t widthInSb = 0; - int32_t heightInSb = 0; + int32_t widthInSb; + int32_t heightInSb; MEDIA_CLASS_DEFINE_END(decode__Av1TempBufferOpInf) }; diff --git a/media_softlet/agnostic/common/codec/hal/dec/shared/mmc/decode_mem_compression.cpp b/media_softlet/agnostic/common/codec/hal/dec/shared/mmc/decode_mem_compression.cpp index 082d92c905a..62895d0752d 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/shared/mmc/decode_mem_compression.cpp +++ b/media_softlet/agnostic/common/codec/hal/dec/shared/mmc/decode_mem_compression.cpp @@ -41,7 +41,6 @@ DecodeMemComp::DecodeMemComp(CodechalHwInterfaceNext *hwInterface, PMOS_INTERFAC if (hwInterface == nullptr) { CODEC_HW_ASSERT(hwInterface); - return; } else { diff --git a/media_softlet/agnostic/common/codec/hal/shared/codec_hw_next.cpp b/media_softlet/agnostic/common/codec/hal/shared/codec_hw_next.cpp index 04e682696ad..1dde0ecf8b1 100644 --- a/media_softlet/agnostic/common/codec/hal/shared/codec_hw_next.cpp +++ b/media_softlet/agnostic/common/codec/hal/shared/codec_hw_next.cpp @@ -46,7 +46,6 @@ CodechalHwInterfaceNext::CodechalHwInterfaceNext( CODEC_HW_ASSERT(osInterface); m_osInterface = osInterface; - MOS_ZeroMemory(&m_platform, sizeof(PLATFORM)); m_osInterface->pfnGetPlatform(m_osInterface, &m_platform); m_skuTable = m_osInterface->pfnGetSkuTable(m_osInterface); diff --git a/media_softlet/linux/common/codec/ddi/dec/ddi_decode_avc_specific.cpp b/media_softlet/linux/common/codec/ddi/dec/ddi_decode_avc_specific.cpp index 6d16c694fb5..ba869c85f01 100644 --- a/media_softlet/linux/common/codec/ddi/dec/ddi_decode_avc_specific.cpp +++ b/media_softlet/linux/common/codec/ddi/dec/ddi_decode_avc_specific.cpp @@ -256,8 +256,7 @@ VAStatus DdiDecodeAvc::ParsePicParams( for (i = 0; i < CODEC_MAX_NUM_REF_FRAME; i++) { // Check the surface id of reference list - if (avcPicParams->RefFrameList[i].FrameIdx < CODEC_AVC_NUM_UNCOMPRESSED_SURFACE && - VA_INVALID_ID == m_decodeCtx->RecListSurfaceID[avcPicParams->RefFrameList[i].FrameIdx]) + if (VA_INVALID_ID == m_decodeCtx->RecListSurfaceID[avcPicParams->RefFrameList[i].FrameIdx]) { // Set invalid flag avcPicParams->RefFrameList[i].PicFlags = PICTURE_INVALID; diff --git a/media_softlet/linux/common/codec/ddi/dec/ddi_decode_base_specific.cpp b/media_softlet/linux/common/codec/ddi/dec/ddi_decode_base_specific.cpp index 3a426d64ee2..f7806a9b050 100644 --- a/media_softlet/linux/common/codec/ddi/dec/ddi_decode_base_specific.cpp +++ b/media_softlet/linux/common/codec/ddi/dec/ddi_decode_base_specific.cpp @@ -1066,6 +1066,13 @@ VAStatus DdiDecodeBase::CreateBuffer( buf->format = Media_Format_CPU; break; case VASubsetsParameterBufferType: + // maximum entry point supported should not be more than 440 + if (numElements > 440) + { + va = VA_STATUS_ERROR_INVALID_PARAMETER; + MOS_FreeMemory(buf); + return va; + } buf->pData = (uint8_t*)MOS_AllocAndZeroMemory(size * numElements); buf->format = Media_Format_CPU; break; diff --git a/media_softlet/media_interface/media_interfaces_mtl/media_interfaces_mtl.cpp b/media_softlet/media_interface/media_interfaces_mtl/media_interfaces_mtl.cpp index cf00b449da1..7c945d1d2ac 100644 --- a/media_softlet/media_interface/media_interfaces_mtl/media_interfaces_mtl.cpp +++ b/media_softlet/media_interface/media_interfaces_mtl/media_interfaces_mtl.cpp @@ -485,7 +485,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( else #endif { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Decode mode requested invalid!"); return MOS_STATUS_INVALID_PARAMETER; } @@ -511,7 +510,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( m_codechalDevice = MOS_New(EncodeAvcVdencPipelineAdapterXe_Lpm_Plus_Base, hwInterface, debugInterface); if (m_codechalDevice == nullptr) { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); return MOS_STATUS_INVALID_PARAMETER; } @@ -519,7 +517,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( } else { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Encode allocation failed, AVC VME Encoder is not supported, please use AVC LowPower Encoder instead!"); return MOS_STATUS_INVALID_PARAMETER; } @@ -532,7 +529,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( m_codechalDevice = MOS_New(EncodeVp9VdencPipelineAdapterXe_Lpm_Plus, hwInterface, debugInterface); if (m_codechalDevice == nullptr) { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); return MOS_STATUS_INVALID_PARAMETER; } @@ -542,7 +538,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( #endif if (info->Mode == CODECHAL_ENCODE_MODE_MPEG2) { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Encode allocation failed, MPEG2 Encoder is not supported!"); return MOS_STATUS_INVALID_PARAMETER; } @@ -553,7 +548,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( m_codechalDevice = MOS_New(EncodeJpegPipelineAdapterXe_Lpm_Plus_Base, hwInterface, debugInterface); if (m_codechalDevice == nullptr) { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); return MOS_STATUS_INVALID_PARAMETER; } @@ -572,7 +566,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( } else { - MOS_Delete(hwInterface); return MOS_STATUS_INVALID_PARAMETER; } } @@ -586,7 +579,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( m_codechalDevice = MOS_New(EncodeHevcVdencPipelineAdapterXe_Lpm_Plus, hwInterface, debugInterface); if (m_codechalDevice == nullptr) { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); return MOS_STATUS_INVALID_PARAMETER; } @@ -594,7 +586,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( } else { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Encode allocation failed, HEVC VME Encoder is not supported."); return MOS_STATUS_INVALID_PARAMETER; } @@ -602,7 +593,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( else #endif { - MOS_Delete(hwInterface); CODECHAL_PUBLIC_ASSERTMESSAGE("Unsupported encode function requested."); return MOS_STATUS_INVALID_PARAMETER; } @@ -610,7 +600,6 @@ MOS_STATUS CodechalInterfacesXe_Lpm_Plus::Initialize( else { CODECHAL_PUBLIC_ASSERTMESSAGE("Unsupported codec function requested."); - MOS_Delete(hwInterface); return MOS_STATUS_INVALID_PARAMETER; }