From 5921165bb7cb5306daaa191726de7f00e53a5080 Mon Sep 17 00:00:00 2001 From: SteveZIntel Date: Wed, 25 Dec 2024 15:17:19 +0800 Subject: [PATCH] [Decode] Null HW Mode Proxy enabling This patch is for Null HW Mode Proxy Enabling --- .../common/os/mos_util_user_feature_keys.h | 3 + .../dec/hevc/packet/decode_hevc_packet.cpp | 42 ++- .../hal/dec/hevc/packet/decode_hevc_packet.h | 2 + .../packet/decode_hevc_packet_back_end.cpp | 1 + .../packet/decode_hevc_packet_front_end.cpp | 1 + .../hevc/packet/decode_hevc_packet_long.cpp | 1 + .../packet/decode_hevc_packet_real_tile.cpp | 1 + .../codec/hal/dec/shared/media_srcs.cmake | 1 + .../decode_nullhw_proxy_test_packet.cpp | 242 ++++++++++++++++++ .../decode_nullhw_proxy_test_packet.h | 75 ++++++ .../dec/shared/nullhwproxy/media_srcs.cmake | 43 ++++ .../agnostic/common/os/mos_user_setting.cpp | 9 +- 12 files changed, 417 insertions(+), 4 deletions(-) create mode 100644 media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/decode_nullhw_proxy_test_packet.cpp create mode 100644 media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/decode_nullhw_proxy_test_packet.h create mode 100644 media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/media_srcs.cmake diff --git a/media_common/agnostic/common/os/mos_util_user_feature_keys.h b/media_common/agnostic/common/os/mos_util_user_feature_keys.h index 661077c26ac..159fc59be94 100644 --- a/media_common/agnostic/common/os/mos_util_user_feature_keys.h +++ b/media_common/agnostic/common/os/mos_util_user_feature_keys.h @@ -421,6 +421,9 @@ #define __MEDIA_USER_FEATURE_VALUE_VP_MMC_IN_USE "VP MMC In Use" #define __MEDIA_USER_FEATURE_VALUE_NULLHW_ENABLE "NULL HW Enable" +#if (_DEBUG || _RELEASE_INTERNAL) +#define __MEDIA_USER_FEATURE_VALUE_NULLHW_PROXY_REPEAT_COUNT "NULL HW Proxy Repeat Count" +#endif #define __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_PLATFORM "MockAdaptor Platform" #define __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_STEPPING "MockAdaptor Stepping" #define __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_DEVICE "MockAdaptor Device ID" diff --git a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet.cpp b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet.cpp index d8a71b8a378..fffe8849a89 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet.cpp +++ b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet.cpp @@ -27,7 +27,9 @@ #include "decode_status_report_defs.h" #include "decode_predication_packet.h" #include "decode_marker_packet.h" - +#if (_DEBUG || _RELEASE_INTERNAL) +#include "decode_nullhw_proxy_test_packet.h" +#endif namespace decode { MOS_STATUS HevcDecodePkt::Init() @@ -47,6 +49,28 @@ MOS_STATUS HevcDecodePkt::Init() m_allocator = m_hevcPipeline->GetDecodeAllocator(); DECODE_CHK_NULL(m_allocator); +#if (_DEBUG || _RELEASE_INTERNAL) + if (m_osInterface->bNullHwIsEnabled) + { + auto nullhwProxy = DecodeNullHWProxyTestPkt::Instance(); + DECODE_CHK_NULL(nullhwProxy); + nullhwProxy->Init(m_hevcPipeline, m_osInterface); + } +#endif + + return MOS_STATUS_SUCCESS; +} + +MOS_STATUS HevcDecodePkt::Destroy() +{ +#if (_DEBUG || _RELEASE_INTERNAL) + if (m_osInterface->bNullHwIsEnabled) + { + auto nullhwProxy = DecodeNullHWProxyTestPkt::Instance(); + DECODE_CHK_NULL(nullhwProxy); + DECODE_CHK_STATUS(nullhwProxy->Destory()); + } +#endif return MOS_STATUS_SUCCESS; } @@ -233,13 +257,25 @@ MOS_STATUS HevcDecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER* { DECODE_FUNC_CALL(); DECODE_CHK_NULL(cmdBuffer); - DECODE_CHK_STATUS(MediaPacket::StartStatusReportNext(srType, cmdBuffer)); + DECODE_CHK_NULL(m_hevcPipeline); + DECODE_CHK_NULL(m_osInterface); SetPerfTag(CODECHAL_DECODE_MODE_HEVCVLD, m_hevcBasicFeature->m_pictureCodingType); MediaPerfProfiler *perfProfiler = MediaPerfProfiler::Instance(); DECODE_CHK_NULL(perfProfiler); - DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd((void*)m_hevcPipeline, m_osInterface, m_miItf, cmdBuffer)); + DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd((void *)m_hevcPipeline, m_osInterface, m_miItf, cmdBuffer)); + +#if (_DEBUG || _RELEASE_INTERNAL) + if (m_osInterface->bNullHwIsEnabled) + { + DecodeNullHWProxyTestPkt *nullhwProxy = DecodeNullHWProxyTestPkt::Instance(); + DECODE_CHK_NULL(nullhwProxy); + nullhwProxy->AddNullHwProxyCmd(m_hevcPipeline, m_osInterface, cmdBuffer); + } +#endif + + DECODE_CHK_STATUS(MediaPacket::StartStatusReportNext(srType, cmdBuffer)); return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet.h b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet.h index 2f1659a8817..fa0ae5781dd 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet.h +++ b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet.h @@ -86,6 +86,8 @@ class HevcDecodePkt : public CmdPacket, public MediaStatusReportObserver //! virtual MOS_STATUS Completed(void *mfxStatus, void *rcsStatus, void *statusReport) override; + virtual MOS_STATUS Destroy() override; + protected: void SetPerfTag(CODECHAL_MODE mode, uint16_t picCodingType); diff --git a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_back_end.cpp b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_back_end.cpp index c2858528a2c..636323f399a 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_back_end.cpp +++ b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_back_end.cpp @@ -50,6 +50,7 @@ MOS_STATUS HevcDecodeBackEndPkt::Init() MOS_STATUS HevcDecodeBackEndPkt::Destroy() { + DECODE_CHK_STATUS(HevcDecodePkt::Destroy()); m_statusReport->UnregistObserver(this); return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_front_end.cpp b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_front_end.cpp index bce6c677d21..8f33285498c 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_front_end.cpp +++ b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_front_end.cpp @@ -54,6 +54,7 @@ MOS_STATUS HevcDecodeFrontEndPkt::Init() MOS_STATUS HevcDecodeFrontEndPkt::Destroy() { + DECODE_CHK_STATUS(HevcDecodePkt::Destroy()); m_statusReport->UnregistObserver(this); return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_long.cpp b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_long.cpp index 190a1c45339..860c838b2a2 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_long.cpp +++ b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_long.cpp @@ -54,6 +54,7 @@ MOS_STATUS HevcDecodeLongPkt::Init() MOS_STATUS HevcDecodeLongPkt::Destroy() { + DECODE_CHK_STATUS(HevcDecodePkt::Destroy()); m_statusReport->UnregistObserver(this); return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_real_tile.cpp b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_real_tile.cpp index 1453c93b1bd..a710cbda4a8 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_real_tile.cpp +++ b/media_softlet/agnostic/common/codec/hal/dec/hevc/packet/decode_hevc_packet_real_tile.cpp @@ -54,6 +54,7 @@ MOS_STATUS HevcDecodeRealTilePkt::Init() MOS_STATUS HevcDecodeRealTilePkt::Destroy() { + DECODE_CHK_STATUS(HevcDecodePkt::Destroy()); m_statusReport->UnregistObserver(this); return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/codec/hal/dec/shared/media_srcs.cmake b/media_softlet/agnostic/common/codec/hal/dec/shared/media_srcs.cmake index e0c830b969c..d9a023a3f7f 100644 --- a/media_softlet/agnostic/common/codec/hal/dec/shared/media_srcs.cmake +++ b/media_softlet/agnostic/common/codec/hal/dec/shared/media_srcs.cmake @@ -26,6 +26,7 @@ media_include_subdirectory(scalability) media_include_subdirectory(statusreport) media_include_subdirectory(mmc) media_include_subdirectory(hucItf) +media_include_subdirectory(nullhwproxy) set(SOFTLET_DECODE_COMMON_SOURCES_ ${SOFTLET_DECODE_COMMON_SOURCES_} diff --git a/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/decode_nullhw_proxy_test_packet.cpp b/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/decode_nullhw_proxy_test_packet.cpp new file mode 100644 index 00000000000..6f60fff7320 --- /dev/null +++ b/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/decode_nullhw_proxy_test_packet.cpp @@ -0,0 +1,242 @@ +/* +* Copyright (c) 2024, Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ +//! +//! \file decode_nullhw_proxy_test_packet.cpp +//! + +#include "decode_nullhw_proxy_test_packet.h" +#include "decode_resource_auto_lock.h" + +namespace decode +{ +#if (_DEBUG || _RELEASE_INTERNAL) + MOS_STATUS DecodeNullHWProxyTestPkt::Init(DecodePipeline *pipeline, MOS_INTERFACE *osInterface) + { + MOS_STATUS status = MOS_STATUS_SUCCESS; + DECODE_CHK_NULL(osInterface); + PMOS_CONTEXT pOsContext = osInterface->pOsContext; + DECODE_CHK_NULL(pOsContext); + m_allocator = pipeline->GetDecodeAllocator(); + DECODE_CHK_NULL(m_allocator); + MediaUserSettingSharedPtr userSettingPtr = osInterface->pfnGetUserSettingInstance(osInterface); + ReadUserSetting( + userSettingPtr, + m_isNullHWEnabled, + __MEDIA_USER_FEATURE_VALUE_NULLHW_ENABLE, + MediaUserSetting::Group::Device); + if (!m_isNullHWEnabled) //NullHW is Not Enabled, return + { + return MOS_STATUS_SUCCESS; + } + ReadUserSetting( + userSettingPtr, + m_repeatCount, + __MEDIA_USER_FEATURE_VALUE_NULLHW_PROXY_REPEAT_COUNT, + MediaUserSetting::Group::Device); + + if (m_dataStoreBuf == nullptr) + { + m_dataStoreBuf = m_allocator->AllocateBuffer(2 * sizeof(uint32_t), "Store data buffer", resourceInternalReadWriteCache, notLockableVideoMem, true, 0); + DECODE_CHK_NULL(m_dataStoreBuf); + } + if (m_secondLevelBBArray == nullptr) + { + m_secondLevelBBArray = m_allocator->AllocateBatchBufferArray( + CODECHAL_CACHELINE_SIZE, 1, 64, true, lockableVideoMem); + DECODE_CHK_NULL(m_secondLevelBBArray); + } + m_miItf = pipeline->GetHwInterface()->GetMiInterfaceNext(); + DECODE_CHK_NULL(m_miItf); + + MOS_ZeroMemory(&m_conditionalBbEndDummy, sizeof(m_conditionalBbEndDummy)); + + return status; + } + + MOS_STATUS DecodeNullHWProxyTestPkt::Destory() + { + DECODE_CHK_NULL(m_allocator); + DECODE_CHK_STATUS(m_allocator->Destroy(m_dataStoreBuf)); + DECODE_CHK_STATUS(m_allocator->Destroy(m_secondLevelBBArray)); + + return MOS_STATUS_SUCCESS; + } + + MOS_STATUS DecodeNullHWProxyTestPkt::Init2ndLevelCmdBuffer(MHW_BATCH_BUFFER& batchBuffer, uint8_t* batchBufBase) + { + DECODE_FUNC_CALL(); + + auto &cmdBuffer = m_statusCheckCmdBuffer; + MOS_ZeroMemory(&cmdBuffer, sizeof(MOS_COMMAND_BUFFER)); + cmdBuffer.pCmdBase = (uint32_t *)batchBufBase; + cmdBuffer.pCmdPtr = cmdBuffer.pCmdBase; + cmdBuffer.iRemaining = batchBuffer.iSize; + cmdBuffer.OsResource = batchBuffer.OsResource; + + return MOS_STATUS_SUCCESS; + } + + //! + //! \brief Send conditional batch buffer end cmd + //! \details Send conditional batch buffer end cmd + //! + //! \param [in] resource + //! Reource used in conditional batch buffer end cmd + //! \param [in] offset + //! Reource offset used in mi atomic dword cmd + //! \param [in] compData + //! Compare data + //! \param [in] disableCompMask + //! Indicate disabling compare mask + //! \param [in] enableEndCurrentBatchBuffLevel + //! End Current Batch Buffer Level + //! \param [in] compareOperation + //! Compare operation + //! \param [in,out] cmdBuffer + //! command buffer + //! + //! \return MOS_STATUS + //! MOS_STATUS_SUCCESS if success, else fail reason + //! + MOS_STATUS DecodeNullHWProxyTestPkt::SendCondBbEndCmd( + PMOS_RESOURCE resource, + uint32_t offset, + uint32_t compData, + bool disableCompMask, + bool enableEndCurrentBatchBuffLevel, + uint32_t compareOperation, + PMOS_COMMAND_BUFFER cmdBuffer) + { + MOS_STATUS eStatus = MOS_STATUS_SUCCESS; + + CODEC_HW_FUNCTION_ENTER; + DECODE_CHK_NULL(m_miItf); + + if (!Mos_ResourceIsNull(&m_conditionalBbEndDummy)) + { + auto &par = m_miItf->GETPAR_MI_FLUSH_DW(); + par = {}; + par.postSyncOperation = 1; + par.pOsResource = &m_conditionalBbEndDummy; + par.dwDataDW1 = 0; + CODEC_HW_CHK_STATUS_RETURN(m_miItf->ADDCMD_MI_FLUSH_DW(cmdBuffer)); + } + + auto &par = m_miItf->GETPAR_MI_CONDITIONAL_BATCH_BUFFER_END(); + par = {}; + par.presSemaphoreBuffer = resource; + par.dwOffset = offset; + par.dwValue = compData; + par.bDisableCompareMask = disableCompMask; + par.dwParamsType = mhw::mi::MHW_MI_ENHANCED_CONDITIONAL_BATCH_BUFFER_END_PARAMS::ENHANCED_PARAMS; + if (enableEndCurrentBatchBuffLevel) + { + par.enableEndCurrentBatchBuffLevel = enableEndCurrentBatchBuffLevel; + par.compareOperation = compareOperation; + } + eStatus = m_miItf->ADDCMD_MI_CONDITIONAL_BATCH_BUFFER_END(cmdBuffer); + + return eStatus; + } + + MOS_STATUS DecodeNullHWProxyTestPkt::Pack2ndLevelCmds(DecodePipeline* pipeline, MOS_COMMAND_BUFFER& cmdBuffer) + { + DECODE_FUNC_CALL(); + + // MI_ATOMIC: ADD 1 TO ORIGINAL DATA + auto &par = m_miItf->GETPAR_MI_ATOMIC(); + par = {}; + par.pOsResource = &m_dataStoreBuf->OsResource; + par.dwResourceOffset = sizeof(uint32_t); + par.dwDataSize = sizeof(uint32_t); + par.Operation = mhw::mi::MHW_MI_ATOMIC_INC; + DECODE_CHK_STATUS(m_miItf->ADDCMD_MI_ATOMIC(&cmdBuffer)); + + // check if loop stops + uint32_t compareOperation = 2; //COMPARE_OPERATION_MADLESSTHANIDD; + uint32_t compData = m_repeatCount; + + DECODE_CHK_STATUS(SendCondBbEndCmd( + &m_dataStoreBuf->OsResource, 0, compData, false, true, compareOperation, &cmdBuffer)); + + // Chained BB loop + auto &chainedBBStartPar = m_miItf->GETPAR_MI_BATCH_BUFFER_START(); + MOS_ZeroMemory(&chainedBBStartPar, sizeof(mhw::mi::MI_BATCH_BUFFER_START_PAR)); + chainedBBStartPar.secondLevelBatchBuffer = false; + DECODE_CHK_STATUS(m_miItf->ADDCMD_MI_BATCH_BUFFER_START(&cmdBuffer, m_batchBuf)); + + return MOS_STATUS_SUCCESS; + } + + MOS_STATUS DecodeNullHWProxyTestPkt::AddNullHwProxyCmd(DecodePipeline *pipeline, MOS_INTERFACE *osInterface, PMOS_COMMAND_BUFFER cmdBuffer) + { + DECODE_FUNC_CALL(); + + if (!m_isNullHWEnabled || m_repeatCount == 0) + { + return MOS_STATUS_SUCCESS; + } + + DECODE_CHK_NULL(cmdBuffer); + DECODE_CHK_NULL(pipeline); + DECODE_CHK_NULL(osInterface); + DECODE_CHK_NULL(m_miItf); + + // add 2nd level BB before start status reporting + auto &par = m_miItf->MHW_GETPAR_F(MI_STORE_DATA_IMM)(); + par = {}; + par.pOsResource = &m_dataStoreBuf->OsResource; + par.dwResourceOffset = 0; + par.dwValue = 0xFFFFFF; + + DECODE_CHK_STATUS(m_miItf->MHW_ADDCMD_F(MI_STORE_DATA_IMM)(cmdBuffer)); + + // clear the data store buffer each time + par.dwResourceOffset = sizeof(uint32_t); + par.dwValue = 0; + DECODE_CHK_STATUS(m_miItf->MHW_ADDCMD_F(MI_STORE_DATA_IMM)(cmdBuffer)); + + // prepare 2nd level chained BB + m_batchBuf = m_secondLevelBBArray->Fetch(); + if (m_batchBuf != nullptr) + { + ResourceAutoLock resLock(m_allocator, &m_batchBuf->OsResource); + uint8_t *batchBufBase = (uint8_t *)resLock.LockResourceForWrite(); + DECODE_CHK_NULL(batchBufBase); + DECODE_CHK_STATUS(Init2ndLevelCmdBuffer(*m_batchBuf, batchBufBase)); + m_statusCheckCmdBuffer.cmdBuf1stLvl = cmdBuffer; + DECODE_CHK_STATUS(Pack2ndLevelCmds(pipeline, m_statusCheckCmdBuffer)); + if (!osInterface->pfnIsMismatchOrderProgrammingSupported()) + { + DECODE_CHK_STATUS(m_miItf->AddMiBatchBufferEnd(&m_statusCheckCmdBuffer, nullptr)); + } + } + + auto &BBStartPar = m_miItf->GETPAR_MI_BATCH_BUFFER_START(); + MOS_ZeroMemory(&BBStartPar, sizeof(mhw::mi::MI_BATCH_BUFFER_START_PAR)); + BBStartPar.secondLevelBatchBuffer = true; // set chained BB mode + DECODE_CHK_STATUS(m_miItf->ADDCMD_MI_BATCH_BUFFER_START(cmdBuffer, m_batchBuf)); + + return MOS_STATUS_SUCCESS; + } +#endif +} diff --git a/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/decode_nullhw_proxy_test_packet.h b/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/decode_nullhw_proxy_test_packet.h new file mode 100644 index 00000000000..4585166a4fe --- /dev/null +++ b/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/decode_nullhw_proxy_test_packet.h @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2024, Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ +//! +//! \file decode_nullhw_proxy_test_packet.h +//! +#ifndef __DECODE_NULLHW_PROXY_TEST_PACKET_H__ +#define __DECODE_NULLHW_PROXY_TEST_PACKET_H__ +#include "decode_allocator.h" +#include "decode_utils.h" +#include "decode_pipeline.h" +#include "mhw_mi_itf.h" +namespace decode +{ +#if (_DEBUG || _RELEASE_INTERNAL) +class DecodeNullHWProxyTestPkt +{ +private: + DecodeNullHWProxyTestPkt() {} + MOS_BUFFER *m_dataStoreBuf = nullptr; + BatchBufferArray *m_secondLevelBBArray = nullptr; + PMHW_BATCH_BUFFER m_batchBuf = nullptr; + DecodeAllocator *m_allocator = nullptr; + int32_t m_isNullHWEnabled = 0; + int32_t m_repeatCount = 0; + MOS_COMMAND_BUFFER m_statusCheckCmdBuffer = {}; + std::shared_ptr m_miItf; + MOS_RESOURCE m_conditionalBbEndDummy; //!> Dummy Resource for conditional batch buffer end WA +public: + ~DecodeNullHWProxyTestPkt() + { + Destory(); + } + DecodeNullHWProxyTestPkt(const DecodeNullHWProxyTestPkt &) = delete; + DecodeNullHWProxyTestPkt &operator=(const DecodeNullHWProxyTestPkt &) = delete; + static DecodeNullHWProxyTestPkt* Instance() + { + static DecodeNullHWProxyTestPkt instance; + return &instance; + } + MOS_STATUS Init(DecodePipeline* pipeline, MOS_INTERFACE *osInterface); + MOS_STATUS Destory(); + MOS_STATUS Init2ndLevelCmdBuffer(MHW_BATCH_BUFFER &batchBuffer, uint8_t *batchBufBase); + MOS_STATUS Pack2ndLevelCmds(DecodePipeline *pipeline, MOS_COMMAND_BUFFER &cmdBuffer); + MOS_STATUS AddNullHwProxyCmd(DecodePipeline *pipeline, MOS_INTERFACE *osInterface, PMOS_COMMAND_BUFFER cmdBuffer); + MOS_STATUS SendCondBbEndCmd( + PMOS_RESOURCE resource, + uint32_t offset, + uint32_t compData, + bool disableCompMask, + bool enableEndCurrentBatchBuffLevel, + uint32_t compareOperation, + PMOS_COMMAND_BUFFER cmdBuffer); +}; +#endif +} +#endif diff --git a/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/media_srcs.cmake b/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/media_srcs.cmake new file mode 100644 index 00000000000..3aa63b86231 --- /dev/null +++ b/media_softlet/agnostic/common/codec/hal/dec/shared/nullhwproxy/media_srcs.cmake @@ -0,0 +1,43 @@ +# Copyright (c) 2024, Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + + +set(TMP_HEADERS_ + ${CMAKE_CURRENT_LIST_DIR}/decode_nullhw_proxy_test_packet.h +) +set(TMP_SOURCES_ + ${CMAKE_CURRENT_LIST_DIR}/decode_nullhw_proxy_test_packet.cpp +) +set(SOFTLET_ENCODE_COMMON_HEADERS_ + ${SOFTLET_DECODE_COMMON_HEADERS_} + ${TMP_HEADERS_} +) +set(SOFTLET_DECODE_COMMON_SOURCES_ + ${SOFTLET_DECODE_COMMON_SOURCES_} + ${TMP_SOURCES_} +) +source_group( CodecHalNext\\Shared\\Decode\\Proprietary FILES ${TMP_HEADERS_} ${TMP_SOURCES_}) +set(TMP_HEADERS_ "") +set(TMP_SOURCES_ "") + +set(SOFTLET_DECODE_COMMON_PRIVATE_INCLUDE_DIRS_ + ${SOFTLET_DECODE_COMMON_PRIVATE_INCLUDE_DIRS_} + ${CMAKE_CURRENT_LIST_DIR} +) \ No newline at end of file diff --git a/media_softlet/agnostic/common/os/mos_user_setting.cpp b/media_softlet/agnostic/common/os/mos_user_setting.cpp index 5ad93546ee1..5303e7b8c4b 100644 --- a/media_softlet/agnostic/common/os/mos_user_setting.cpp +++ b/media_softlet/agnostic/common/os/mos_user_setting.cpp @@ -1375,7 +1375,14 @@ MOS_STATUS MosUserSetting::InitUserSettingForDebug(MediaUserSettingSharedPtr use MediaUserSetting::Group::Device, 0, true); // "Enable NULL HW or not" - +#if (_DEBUG || _RELEASE_INTERNAL) + DeclareUserSettingKeyForDebug( + userSettingPtr, + __MEDIA_USER_FEATURE_VALUE_NULLHW_PROXY_REPEAT_COUNT, + MediaUserSetting::Group::Device, + 0, + true); +#endif DeclareUserSettingKeyForDebug( userSettingPtr, __MEDIA_USER_FEATURE_VALUE_MOCKADAPTOR_PLATFORM,