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_hevc_pipeline_xe2_lpm_base.h
24 //! \brief    Defines the interface for hevc decode pipeline
25 //!
26 #ifndef __DECODE_HEVC_PIPELINE_XE2_LPM_BASE_H__
27 #define __DECODE_HEVC_PIPELINE_XE2_LPM_BASE_H__
28 
29 #include "decode_hevc_pipeline.h"
30 #include "codec_def_decode_hevc.h"
31 #include "decode_hevc_packet_long_xe2_lpm_base.h"
32 #include "decode_huc_packet_creator.h"
33 
34 namespace decode {
35 
36 class HevcPipelineXe2_Lpm_Base : public HevcPipeline, public HucPacketCreator
37 {
38 public:
39     //!
40     //! \brief  DecodePipeline constructor
41     //! \param  [in] hwInterface
42     //!         Pointer to CodechalHwInterface
43     //! \param  [in] debugInterface
44     //!         Pointer to CodechalDebugInterface
45     //!
46     HevcPipelineXe2_Lpm_Base(CodechalHwInterfaceNext *hwInterface, CodechalDebugInterface *debugInterface);
47 
~HevcPipelineXe2_Lpm_Base()48     virtual ~HevcPipelineXe2_Lpm_Base() {};
49 
50     virtual MOS_STATUS Init(void *settings) override;
51 
52     //!
53     //! \brief  Prepare interal parameters, should be invoked for each frame
54     //! \param  [in] params
55     //!         Pointer to the input parameters
56     //! \return MOS_STATUS
57     //!         MOS_STATUS_SUCCESS if success, else fail reason
58     //!
59     virtual MOS_STATUS Prepare(void *params) final;
60 
61     //!
62     //! \brief  Finish the execution for each frame
63     //! \return MOS_STATUS
64     //!         MOS_STATUS_SUCCESS if success, else fail reason
65     //!
66     virtual MOS_STATUS Execute() final;
67 
68     virtual MOS_STATUS GetStatusReport(void *status, uint16_t numStatus) override;
69 
70     virtual MOS_STATUS Destroy() override;
71 
72     uint32_t GetCompletedReport();
73 
74 protected:
75     virtual MOS_STATUS Initialize(void *settings) override;
76     virtual MOS_STATUS Uninitialize() override;
77 
78     //!
79     //! \brief  User Feature Key Report
80     //! \return MOS_STATUS
81     //!         MOS_STATUS_SUCCESS if success, else fail reason
82     //!
83     virtual MOS_STATUS UserFeatureReport() override;
84 
85     //!
86     //! \brief  Create sub packets
87     //! \param  [in] codecSettings
88     //!         Point to codechal settings
89     //! \return MOS_STATUS
90     //!         MOS_STATUS_SUCCESS if success, else fail reason
91     //!
92     virtual MOS_STATUS CreateSubPackets(DecodeSubPacketManager& subPacketManager, CodechalSetting &codecSettings) override;
93 
94     //!
95     //! \brief  Initialize scalability option
96     //! \param  [in] basicFeature
97     //!         Hevc decode basic feature
98     //! \return MOS_STATUS
99     //!         MOS_STATUS_SUCCESS if success, else fail reason
100     //!
101     MOS_STATUS InitScalabOption(HevcBasicFeature &basicFeature);
102 
103     //!
104     //! \brief  Allocate resource for Hevc decode
105     //! \return MOS_STATUS
106     //!         MOS_STATUS_SUCCESS if success, else fail reason
107     //!
108     MOS_STATUS AllocateResources(HevcBasicFeature &basicFeature);
109 
110 #ifdef _MMC_SUPPORTED
111     //!
112     //! \brief    Initialize MMC state
113     //!
114     //! \return   MOS_STATUS
115     //!           MOS_STATUS_SUCCESS if success
116     //!
117     virtual MOS_STATUS InitMmcState();
118 #endif
119 
120 #if USE_CODECHAL_DEBUG_TOOL
121     //!
122     //! \brief    Dump the parameters
123     //! \param  [in] basicFeature
124     //!         Reference to HevcBasicFeature
125     //! \return   MOS_STATUS
126     //!           MOS_STATUS_SUCCESS if success, else fail reason
127     //!
128     MOS_STATUS DumpParams(HevcBasicFeature &basicFeature);
129 #endif
130 
131     //!
132     //! \brief  Get the number of Vdbox
133     //! \return uint8_t
134     //!         Return the number of Vdbox
135     //!
136     virtual uint8_t GetSystemVdboxNumber() override;
137 
138 MEDIA_CLASS_DEFINE_END(decode__HevcPipelineXe2_Lpm_Base)
139 };
140 
141 }
142 #endif // !__DECODE_HEVC_PIPELINE_XE2_LPM_BASE_H__
143