From dab49ada6c2e476a5e6e4c06298ed3bbebb5f868 Mon Sep 17 00:00:00 2001 From: ShawnLi Date: Mon, 22 Jul 2019 15:05:34 +0800 Subject: [PATCH] [Decode] Cleanup KW issues on Linux unintialize in constructor Change-Id: Ie26a0f5da4d95dcad0e14ff6161cfc1692b6497e --- .../agnostic/common/codec/hal/codechal_decode_hevc.cpp | 1 + .../agnostic/common/codec/hal/codechal_decode_vc1.cpp | 1 + .../agnostic/common/codec/hal/codechal_decode_vp9.cpp | 6 +++++- .../agnostic/common/codec/hal/codechal_decoder.cpp | 4 ++-- media_driver/agnostic/common/hw/mhw_mi.cpp | 3 +++ media_driver/agnostic/common/hw/mhw_mi.h | 4 ++-- .../agnostic/common/shared/media_perf_profiler.cpp | 3 ++- .../agnostic/gen8/codec/hal/codechal_decode_vc1_g8.cpp | 4 ++-- .../linux/common/codec/ddi/media_ddi_decode_base.cpp | 9 +++++++++ media_driver/linux/common/os/mos_gpucontext_specific.h | 4 ++-- media_driver/linux/ult/ult_app/driver_loader.h | 6 +++--- 11 files changed, 32 insertions(+), 13 deletions(-) diff --git a/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.cpp b/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.cpp index 7dd0e463050..3f2fd20ee34 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_decode_hevc.cpp @@ -2663,6 +2663,7 @@ CodechalDecodeHevc::CodechalDecodeHevc( m_saoLineBufferPicWidth(0), m_mvBufferProgrammed(false), m_dmemBufferIdx(0), + m_dmemBufferSize(0), m_dmemTransferSize(0), m_dmemBufferProgrammed(false), m_copyDataBufferSize(0), diff --git a/media_driver/agnostic/common/codec/hal/codechal_decode_vc1.cpp b/media_driver/agnostic/common/codec/hal/codechal_decode_vc1.cpp index ae90b208f1b..26fc86ced4b 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_decode_vc1.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_decode_vc1.cpp @@ -4815,6 +4815,7 @@ CodechalDecodeVc1::CodechalDecodeVc1( MOS_ZeroMemory(m_unequalFieldRefListIdx, sizeof(m_unequalFieldRefListIdx)); MOS_ZeroMemory(&m_destSurface, sizeof(m_destSurface)); MOS_ZeroMemory(&m_deblockSurface, sizeof(m_deblockSurface)); + MOS_ZeroMemory(&m_resDataBuffer, sizeof(m_resDataBuffer)); MOS_ZeroMemory(&m_resBitplaneBuffer, sizeof(m_resBitplaneBuffer)); MOS_ZeroMemory(&m_resSyncObjectWaContextInUse, sizeof(m_resSyncObjectWaContextInUse)); MOS_ZeroMemory(&m_resSyncObjectVideoContextInUse, sizeof(m_resSyncObjectVideoContextInUse)); diff --git a/media_driver/agnostic/common/codec/hal/codechal_decode_vp9.cpp b/media_driver/agnostic/common/codec/hal/codechal_decode_vp9.cpp index 910e79cc760..ce28d5c97c4 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_decode_vp9.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_decode_vp9.cpp @@ -168,6 +168,7 @@ CodechalDecodeVp9 ::CodechalDecodeVp9( m_vp9DepthIndicator(0), m_chromaFormatinProfile(0), m_dataSize(0), + m_dataOffset(0), m_frameCtxIdx(0), m_curMvTempBufIdx(0), m_colMvTempBufIdx(0), @@ -180,8 +181,11 @@ CodechalDecodeVp9 ::CodechalDecodeVp9( m_allocatedWidthInSb(0), m_allocatedHeightInSb(0), m_mvBufferSize(0), + m_resetSegIdBuffer(false), m_pendingResetPartial(0), - m_saveInterProbs(0) + m_saveInterProbs(0), + m_fullProbBufferUpdate(false), + m_dmemBufferSize(0) { CODECHAL_DECODE_FUNCTION_ENTER; diff --git a/media_driver/agnostic/common/codec/hal/codechal_decoder.cpp b/media_driver/agnostic/common/codec/hal/codechal_decoder.cpp index 0e0663384e3..23b881f2145 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_decoder.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_decoder.cpp @@ -229,6 +229,8 @@ CodechalDecode::CodechalDecode ( { CODECHAL_DECODE_FUNCTION_ENTER; + MOS_ZeroMemory(&m_dummyReference, sizeof(MOS_SURFACE)); + CODECHAL_DECODE_CHK_NULL_NO_STATUS_RETURN(hwInterface); CODECHAL_DECODE_CHK_NULL_NO_STATUS_RETURN(hwInterface->GetOsInterface()); CODECHAL_DECODE_CHK_NULL_NO_STATUS_RETURN(hwInterface->GetMiInterface()); @@ -251,8 +253,6 @@ CodechalDecode::CodechalDecode ( m_mode = standardInfo->Mode; m_isHybridDecoder = standardInfo->bIsHybridCodec ? true : false; - - MOS_ZeroMemory(&m_dummyReference, sizeof(MOS_SURFACE)); } MOS_STATUS CodechalDecode::SetGpuCtxCreatOption( diff --git a/media_driver/agnostic/common/hw/mhw_mi.cpp b/media_driver/agnostic/common/hw/mhw_mi.cpp index cf322484c8e..7a5988cd885 100644 --- a/media_driver/agnostic/common/hw/mhw_mi.cpp +++ b/media_driver/agnostic/common/hw/mhw_mi.cpp @@ -33,6 +33,9 @@ MhwMiInterface::MhwMiInterface( { MHW_FUNCTION_ENTER; + MOS_ZeroMemory(&UseGlobalGtt, sizeof(UseGlobalGtt)); + MOS_ZeroMemory(&MediaResetParam, sizeof(MediaResetParam)); + if (cpInterface == nullptr || osInterface == nullptr) { MHW_ASSERTMESSAGE("Invalid input pointers provided"); diff --git a/media_driver/agnostic/common/hw/mhw_mi.h b/media_driver/agnostic/common/hw/mhw_mi.h index bc53ee8dcd4..ce45e4b451a 100644 --- a/media_driver/agnostic/common/hw/mhw_mi.h +++ b/media_driver/agnostic/common/hw/mhw_mi.h @@ -729,7 +729,7 @@ class MhwMiInterface MOS_STATUS (*AddResourceToCmd) ( PMOS_INTERFACE pOsInterface, PMOS_COMMAND_BUFFER cmdBuffer, - PMHW_RESOURCE_PARAMS params); + PMHW_RESOURCE_PARAMS params) = nullptr; //! //! \brief Helper function to get GTT type (PGTT or GGTT) @@ -758,7 +758,7 @@ class MhwMiInterface } MediaResetParam; //! \brief Mmio registers address - MHW_MI_MMIOREGISTERS m_mmioRegisters; //!< mfx mmio registers + MHW_MI_MMIOREGISTERS m_mmioRegisters = {}; //!< mfx mmio registers }; diff --git a/media_driver/agnostic/common/shared/media_perf_profiler.cpp b/media_driver/agnostic/common/shared/media_perf_profiler.cpp index 6e7ce295d2a..951a9354dd7 100644 --- a/media_driver/agnostic/common/shared/media_perf_profiler.cpp +++ b/media_driver/agnostic/common/shared/media_perf_profiler.cpp @@ -106,12 +106,13 @@ struct NodeHeader MediaPerfProfiler::MediaPerfProfiler() { + MOS_ZeroMemory(&m_perfStoreBuffer, sizeof(m_perfStoreBuffer)); m_perfDataIndex = 0; m_ref = 0; m_initialized = false; m_profilerEnabled = 0; - + MOS_USER_FEATURE_VALUE_DATA userFeatureData; // Check whether profiler is enabled MOS_ZeroMemory(&userFeatureData, sizeof(userFeatureData)); diff --git a/media_driver/agnostic/gen8/codec/hal/codechal_decode_vc1_g8.cpp b/media_driver/agnostic/gen8/codec/hal/codechal_decode_vc1_g8.cpp index 8863a6f5658..c5358069e4e 100644 --- a/media_driver/agnostic/gen8/codec/hal/codechal_decode_vc1_g8.cpp +++ b/media_driver/agnostic/gen8/codec/hal/codechal_decode_vc1_g8.cpp @@ -289,12 +289,12 @@ CodechalDecodeVc1G8::CodechalDecodeVc1G8( PCODECHAL_STANDARD_INFO standardInfo) : CodechalDecodeVc1(hwInterface, debugInterface, standardInfo) { + MOS_ZeroMemory(&m_olpBatchBuffer, sizeof(m_olpBatchBuffer)); + CODECHAL_DECODE_CHK_NULL_NO_STATUS_RETURN(hwInterface); m_olpCurbeStaticDataLength = CODECHAL_DECODE_VC1_CURBE_SIZE_OLP_G8; - MOS_ZeroMemory(&m_olpBatchBuffer, sizeof(m_olpBatchBuffer)); - MOS_STATUS eStatus = CodecHalGetKernelBinaryAndSize( (uint8_t *)IGCODECKRN_G8, IDR_CODEC_AllVC1_NV12, 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 14832767d41..622aa890f67 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 @@ -39,6 +39,15 @@ DdiMediaDecode::DdiMediaDecode(DDI_DECODE_CONFIG_ATTR *ddiDecodeAttr) m_ddiDecodeAttr = ddiDecodeAttr; m_ddiDecodeCtx = nullptr; MOS_ZeroMemory(&m_destSurface, sizeof(m_destSurface)); + m_groupIndex = 0; + m_picWidthInMB = 0; + m_picHeightInMB = 0; + m_decProcessingType = 0; + m_width = 0; + m_height = 0; + m_streamOutEnabled = false; + m_sliceParamBufNum = 0; + m_sliceCtrlBufNum = 0; m_codechalSettings = CodechalSetting::CreateCodechalSetting(); } diff --git a/media_driver/linux/common/os/mos_gpucontext_specific.h b/media_driver/linux/common/os/mos_gpucontext_specific.h index 513cdb12d3e..eb3d886c945 100644 --- a/media_driver/linux/common/os/mos_gpucontext_specific.h +++ b/media_driver/linux/common/os/mos_gpucontext_specific.h @@ -237,9 +237,9 @@ class GpuContextSpecific : public GpuContext //! \brief Os context OsContext *m_osContext = nullptr; - MOS_GPUCTX_CREATOPTIONS_ENHANCED *m_createOptionEnhanced; + MOS_GPUCTX_CREATOPTIONS_ENHANCED *m_createOptionEnhanced = nullptr; MOS_LINUX_CONTEXT* m_i915Context = nullptr; - uint32_t m_i915ExecFlag; + uint32_t m_i915ExecFlag = 0; #if MOS_COMMAND_RESINFO_DUMP_SUPPORTED std::vector m_cmdResPtrs; //!< Command OS resource pointers registered by pfnRegisterResource diff --git a/media_driver/linux/ult/ult_app/driver_loader.h b/media_driver/linux/ult/ult_app/driver_loader.h index 349492a7ff2..205c8f98225 100644 --- a/media_driver/linux/ult/ult_app/driver_loader.h +++ b/media_driver/linux/ult/ult_app/driver_loader.h @@ -124,9 +124,9 @@ class DriverDllLoader public: - VADriverContext m_ctx; - VADriverVTable m_vtable; - VADriverVTableVPP m_vtable_vpp; + VADriverContext m_ctx = {}; + VADriverVTable m_vtable = {}; + VADriverVTableVPP m_vtable_vpp = {}; private: