From 6134904825aa143ac9e568cbca9afc0565e3bb7e Mon Sep 17 00:00:00 2001 From: Cai_Jianxing Date: Wed, 6 Sep 2023 18:02:23 +0800 Subject: [PATCH] [VP] fix coverity issue2 fix coverity issue 2 --- .../agnostic/gen12/hw/mhw_vebox_g12_X.cpp | 64 ++++++++----------- .../agnostic/common/hw/mhw_state_heap.cpp | 2 +- 2 files changed, 27 insertions(+), 39 deletions(-) diff --git a/media_driver/agnostic/gen12/hw/mhw_vebox_g12_X.cpp b/media_driver/agnostic/gen12/hw/mhw_vebox_g12_X.cpp index 463cc5c8d1e..a61b89eb55a 100644 --- a/media_driver/agnostic/gen12/hw/mhw_vebox_g12_X.cpp +++ b/media_driver/agnostic/gen12/hw/mhw_vebox_g12_X.cpp @@ -3038,41 +3038,37 @@ MOS_STATUS MhwVeboxInterfaceG12::AddVeboxTilingConvert( } // Set Output surface compression status - if (outputSurface) + // Double Buffer copy + surface = outputSurface; + + if (outSurParams->CompressionMode != MOS_MMC_DISABLED) { - // Double Buffer copy - surface = outputSurface; + veboxOutputSurfCtrlBits.DW0.MemoryCompressionEnable = true; - if (outSurParams->CompressionMode != MOS_MMC_DISABLED) + if (outSurParams->CompressionMode == MOS_MMC_RC) { - veboxOutputSurfCtrlBits.DW0.MemoryCompressionEnable = true; - - if (outSurParams->CompressionMode == MOS_MMC_RC) - { - veboxOutputSurfCtrlBits.DW0.CompressionType = 1; - } - else - { - veboxOutputSurfCtrlBits.DW0.CompressionType = 0; - } + veboxOutputSurfCtrlBits.DW0.CompressionType = 1; } - - if (surface) + else { - switch (surface->TileType) - { - case MOS_TILE_YF: - veboxOutputSurfCtrlBits.DW0.TiledResourceModeForOutputFrameSurfaceBaseAddress = TRMODE_TILEYF; - break; - case MOS_TILE_YS: - veboxOutputSurfCtrlBits.DW0.TiledResourceModeForOutputFrameSurfaceBaseAddress = TRMODE_TILEYS; - break; - default: - veboxOutputSurfCtrlBits.DW0.TiledResourceModeForOutputFrameSurfaceBaseAddress = TRMODE_NONE; - break; - } + veboxOutputSurfCtrlBits.DW0.CompressionType = 0; } + } + if (surface) + { + switch (surface->TileType) + { + case MOS_TILE_YF: + veboxOutputSurfCtrlBits.DW0.TiledResourceModeForOutputFrameSurfaceBaseAddress = TRMODE_TILEYF; + break; + case MOS_TILE_YS: + veboxOutputSurfCtrlBits.DW0.TiledResourceModeForOutputFrameSurfaceBaseAddress = TRMODE_TILEYS; + break; + default: + veboxOutputSurfCtrlBits.DW0.TiledResourceModeForOutputFrameSurfaceBaseAddress = TRMODE_NONE; + break; + } } MOS_ZeroMemory(&ResourceParams, sizeof(MHW_RESOURCE_PARAMS)); @@ -3090,14 +3086,7 @@ MOS_STATUS MhwVeboxInterfaceG12::AddVeboxTilingConvert( MOS_ZeroMemory(&ResourceParams, sizeof(MHW_RESOURCE_PARAMS)); InitMocsParams(ResourceParams, &cmd.DW3_4.Value[0], 1, 6); - if (outputSurface) - { - ResourceParams.presResource = outputSurface; - } - else - { - ResourceParams.presResource = inputSurface; - } + ResourceParams.presResource = outputSurface; ResourceParams.HwCommandType = MOS_VEBOX_TILING_CONVERT; @@ -3105,8 +3094,7 @@ MOS_STATUS MhwVeboxInterfaceG12::AddVeboxTilingConvert( ResourceParams.dwLocationInCmd = 3; ResourceParams.pdwCmd = &(cmd.DW3_4.Value[0]); ResourceParams.bIsWritable = true; - ResourceParams.dwOffset = - (outputSurface != nullptr ? outSurParams->dwOffset : inSurParams->dwOffset) + veboxOutputSurfCtrlBits.DW0.Value; + ResourceParams.dwOffset = outSurParams->dwOffset + veboxOutputSurfCtrlBits.DW0.Value; MHW_CHK_STATUS(pfnAddResourceToCmd(m_osInterface, cmdBuffer, &ResourceParams)); m_osInterface->pfnAddCommand(cmdBuffer, &cmd, cmd.byteSize); diff --git a/media_softlet/agnostic/common/hw/mhw_state_heap.cpp b/media_softlet/agnostic/common/hw/mhw_state_heap.cpp index 2d01e57948a..9222596a595 100644 --- a/media_softlet/agnostic/common/hw/mhw_state_heap.cpp +++ b/media_softlet/agnostic/common/hw/mhw_state_heap.cpp @@ -995,7 +995,7 @@ MOS_STATUS XMHW_STATE_HEAP_INTERFACE::InitializeInterface( { m_ishManager.RegisterOsInterface(m_pOsInterface); m_ishManager.SetDefaultBehavior(StateHeapSettings.m_ishBehavior); - m_ishManager.SetInitialHeapSize(StateHeapSettings.dwIshSize); + MHW_MI_CHK_STATUS(m_ishManager.SetInitialHeapSize(StateHeapSettings.dwIshSize)); if (StateHeapSettings.m_ishBehavior == HeapManager::Behavior::extend || StateHeapSettings.m_ishBehavior == HeapManager::Behavior::destructiveExtend || StateHeapSettings.m_ishBehavior == HeapManager::Behavior::waitAndExtend)