1 /* 2 * Copyright (c) 2019-2023, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file decode_huc_s2l_packet_m12.h 24 //! \brief Defines the implementation of huc S2L packet for M12 25 //! 26 27 #ifndef __DECODE_HUC_S2L_PACKET_M12_H__ 28 #define __DECODE_HUC_S2L_PACKET_M12_H__ 29 30 #include "decode_huc_s2l_xe_m_base_packet.h" 31 #include "codechal_hw_g12_X.h" 32 #include "decode_huc_authcheck_packet_m12.h" 33 34 namespace decode 35 { 36 struct HucHevcS2lPicBssM12 : public HucHevcS2lPicBssXe_M_Base 37 { 38 uint8_t IsRealTileEnable; 39 uint8_t NumScalablePipes; 40 uint8_t IsSCCIBCMode; 41 uint8_t IsSCCPLTMode; 42 uint8_t MVRControlIdc; 43 uint8_t UseSliceACTOffset; 44 int8_t pps_act_y_qp_offset; 45 int8_t pps_act_cb_qp_offset; 46 int8_t pps_act_cr_qp_offset; 47 uint8_t PredictorPaletteSize; 48 uint16_t PredictorPaletteEntries[3][128]; 49 uint32_t BatchBufferSize; 50 }; 51 52 struct HucHevcS2lBssM12 53 { 54 // Platfrom information 55 uint32_t ProductFamily; 56 uint16_t RevId; 57 58 // Flag to indicate if create dummy HCP_REF_IDX_STATE or not 59 uint32_t DummyRefIdxState; 60 61 //Flag to indicate if insert dummy HCP_VD_CONTROL_STATE or not 62 uint32_t DummyVDControlState; 63 64 //Flag to indicate if insert MFX_WAIT and VD_PIPELINE_FLUSH for Scalability 65 uint32_t WaTileFlushScalability; 66 67 // Picture level DMEM data 68 HucHevcS2lPicBssM12 PictureBss; 69 70 // Slice level DMEM data 71 HucHevcS2lSliceBssXe_M_Base SliceBss[CODECHAL_HEVC_MAX_NUM_SLICES_LVL_6]; 72 }; 73 74 class HucS2lPktM12 : public HucS2lPktXe_M_Base 75 { 76 public: HucS2lPktM12(MediaPipeline * pipeline,MediaTask * task,CodechalHwInterface * hwInterface)77 HucS2lPktM12(MediaPipeline *pipeline, MediaTask *task, CodechalHwInterface *hwInterface) 78 : HucS2lPktXe_M_Base(pipeline, task, hwInterface) 79 { 80 m_hwInterface = dynamic_cast<CodechalHwInterfaceG12*>(hwInterface); 81 } 82 ~HucS2lPktM12()83 virtual ~HucS2lPktM12() {} 84 85 MOS_STATUS Submit(MOS_COMMAND_BUFFER *commandBuffer, uint8_t packetPhase = otherPacket) override; 86 87 //! 88 //! \brief Get Packet Name 89 //! \return std::string 90 //! GetPacketName()91 virtual std::string GetPacketName() override 92 { 93 return "S2L_DECODE_PASS" + std::to_string(static_cast<uint32_t>(m_hevcPipeline->GetCurrentPass())) + "_"; 94 } 95 96 //! 97 //! \brief Prepare interal parameters, should be invoked for each frame 98 //! \return MOS_STATUS 99 //! MOS_STATUS_SUCCESS if success, else fail reason 100 //! 101 virtual MOS_STATUS Prepare() override; 102 GetHucAuthCmdBuffer()103 PMHW_BATCH_BUFFER GetHucAuthCmdBuffer() { return m_hucAuthPkt ? m_hucAuthPkt->GetSecondLvlBB() : nullptr; }; 104 105 protected: 106 virtual MOS_STATUS AllocateResources() override; 107 virtual MOS_STATUS Destroy() override; 108 109 virtual MOS_STATUS Execute(MOS_COMMAND_BUFFER& cmdBuffer, bool prologNeeded) override; 110 111 MOS_STATUS PackPictureLevelCmds(MOS_COMMAND_BUFFER &cmdBuffer); 112 MOS_STATUS PackSliceLevelCmds(MOS_COMMAND_BUFFER &cmdBuffer); 113 114 virtual MOS_STATUS AddHucPipeModeSelect(MOS_COMMAND_BUFFER &cmdBuffer) override; 115 116 virtual MOS_STATUS SetHucDmemPictureBss(HucHevcS2lPicBssXe_M_Base &hucHevcS2LPicBss) override; 117 MOS_STATUS SetDmemBuffer(); 118 119 MOS_STATUS VdPipelineFlush(MOS_COMMAND_BUFFER &cmdBuffer); 120 121 CodechalHwInterfaceG12 *m_hwInterface = nullptr; 122 123 BufferArray *m_s2lDmemBufferArray = nullptr; //!< S2L DMEM buffer array 124 125 DecodeHucAuthCheckPktM12 *m_hucAuthPkt = nullptr; 126 MEDIA_CLASS_DEFINE_END(decode__HucS2lPktM12) 127 }; 128 129 } // namespace decode 130 #endif 131