1 /*
2 * Copyright (c) 2021-2024, 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_avc_pipeline_xe2_lpm_base.h
24 //! \brief    Defines the interface for avc decode pipeline
25 //!
26 #ifndef __DECODE_AVC_PIPELINE_XE2_LPM_BASE_H__
27 #define __DECODE_AVC_PIPELINE_XE2_LPM_BASE_H__
28 
29 #include "decode_avc_pipeline.h"
30 #include "decode_huc_packet_creator.h"
31 
32 namespace decode {
33 
34 class AvcDecodePktXe2_Lpm_Base;
35 class AvcPipelineXe2_Lpm_Base : public AvcPipeline, public HucPacketCreator
36 {
37 public:
38     //!
39     //! \brief  DecodePipeline constructor
40     //! \param  [in] hwInterface
41     //!         Pointer to CodechalHwInterface
42     //! \param  [in] debugInterface
43     //!         Pointer to CodechalDebugInterface
44     //!
45     AvcPipelineXe2_Lpm_Base(
46         CodechalHwInterfaceNext *   hwInterface,
47         CodechalDebugInterface *debugInterface);
48 
~AvcPipelineXe2_Lpm_Base()49     virtual ~AvcPipelineXe2_Lpm_Base(){};
50 
51     virtual MOS_STATUS Init(void *settings) override;
52 
53     //!
54     //! \brief  Prepare interal parameters, should be invoked for each frame
55     //! \param  [in] params
56     //!         Pointer to the input parameters
57     //! \return MOS_STATUS
58     //!         MOS_STATUS_SUCCESS if success, else fail reason
59     //!
60     virtual MOS_STATUS Prepare(void *params) final;
61 
62     //!
63     //! \brief  Finish the execution for each frame
64     //! \return MOS_STATUS
65     //!         MOS_STATUS_SUCCESS if success, else fail reason
66     //!
67     virtual MOS_STATUS Execute() final;
68 
69     virtual MOS_STATUS GetStatusReport(void *status, uint16_t numStatus) override;
70 
71     uint32_t GetCompletedReport();
72 
73     virtual MOS_STATUS Destroy() override;
74 
75 protected:
76     virtual MOS_STATUS Initialize(void *settings) override;
77     virtual MOS_STATUS Uninitialize() override;
78 
79     //!
80     //! \brief  User Feature Key Report
81     //! \return MOS_STATUS
82     //!         MOS_STATUS_SUCCESS if success, else fail reason
83     //!
84     virtual MOS_STATUS UserFeatureReport() override;
85 
86     //!
87     //! \brief  Create sub packets
88     //! \param  [in] codecSettings
89     //!         Point to codechal settings
90     //! \return MOS_STATUS
91     //!         MOS_STATUS_SUCCESS if success, else fail reason
92     //!
93     virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override;
94 
95     //!
96     //! \brief    Initialize MMC state
97     //!
98     //! \return   MOS_STATUS
99     //!           MOS_STATUS_SUCCESS if success
100     //!
101     virtual MOS_STATUS InitMmcState();
102 
103     //!
104     //! \brief  Initialize media context for decode pipeline
105     //! \return MOS_STATUS
106     //!         MOS_STATUS_SUCCESS if success, else fail reason
107     //!
108     MOS_STATUS InitContext();
109 
110 #if USE_CODECHAL_DEBUG_TOOL
111     //!
112     //! \brief    Dump the parameters
113     //! \param  [in] basicFeature
114     //!         Reference to AvcBasicFeature
115     //! \return   MOS_STATUS
116     //!           MOS_STATUS_SUCCESS if success, else fail reason
117     //!
118     MOS_STATUS DumpParams(AvcBasicFeature &basicFeature);
119 #endif
120 
121 private:
122     AvcDecodePktXe2_Lpm_Base* m_avcDecodePkt = nullptr;
123 
124 MEDIA_CLASS_DEFINE_END(decode__AvcPipelineXe2_Lpm_Base)
125 };
126 
127 }
128 #endif // !__DECODE_AVC_PIPELINE_XE2_LPM_BASE_H__
129 
130