Debian Codegraph @

media_softlet/agnostic/common/codec/hal/dec/shared/packet/decode_huc.h

raw
1 /*
2 * Copyright (c) 2021, 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 //!
24 //! \file decode_huc.h
25 //! \brief Defines the common interface for decode huc usage
26 //! \details The media huc interface is further sub-divided by different huc usages,
27 //! this file is for the base interface which is shared by all components.
28 //!
29
30 #ifndef __DECODE_HUC_H__
31 #define __DECODE_HUC_H__
32
33 #include "codec_hw_next.h"
34 #include "mos_defs.h"
35 #include "media_cmd_packet.h"
36 #include "media_pipeline.h"
37 #include "decode_basic_feature.h"
38 #include "decodecp_interface.h"
39 #include "decode_status_report.h"
40 #include "mhw_vdbox_huc_cmdpar.h"
41 #include "mhw_vdbox_huc_itf.h"
42
43
44 namespace decode
45 {
46 class DecodePipeline;
47
48 class DecodeHucBasic : public CmdPacket, public MediaStatusReportObserver
49 {
50 public:
51 //!
52 //! \brief Decode huc basic constructor
53 //!
54 DecodeHucBasic(MediaPipeline *pipeline, MediaTask *task, CodechalHwInterfaceNext *hwInterface);
55
56 //!
57 //! \brief Decode huc basic destructor
58 //!
59 virtual ~DecodeHucBasic();
60
61 virtual MOS_STATUS Init() override;
62
63 virtual MOS_STATUS AllocateResources();
64
65 virtual MOS_STATUS Destroy() override;
66
67 //!
68 //! \brief One frame is completed
69 //! \param [in] mfxStatus
70 //! pointer to status buffer which for MFX
71 //! \param [in] rcsStatus
72 //! pointer to status buffer which for RCS
73 //! \param [in, out] statusReport
74 //! pointer of DecodeStatusReport
75 //! \return MOS_STATUS
76 //! MOS_STATUS_SUCCESS if success, else fail reason
77 //!
78 virtual MOS_STATUS Completed(void* mfxStatus, void* rcsStatus, void* statusReport) override;
79
80 protected:
81 //!
82 //! \brief Assemble huc commands
83 //! \return MOS_STATUS
84 //! MOS_STATUS_SUCCESS if success, else fail reason
85 //!
86 virtual MOS_STATUS Execute(MOS_COMMAND_BUFFER& cmdBuffer, bool prologNeeded) = 0;
87
88
89 //!
90 //! \brief Store HucStatus MMIO to m_resHucStatusBuffer
91 //! \param [in] cmdBuffer
92 //! Pointer to command buffer
93 //! \return MOS_STATUS
94 //! MOS_STATUS_SUCCESS if success, else fail reason
95 //!
96 virtual MOS_STATUS StoreHucStatusRegister(MOS_COMMAND_BUFFER& cmdBuffer);
97
98 //!
99 //! \brief Store HucStatus2 MMIO to m_resHucStatus2Buffer
100 //! \param [in] cmdBuffer
101 //! Pointer to command buffer
102 //! \return MOS_STATUS
103 //! MOS_STATUS_SUCCESS if success, else fail reason
104 //!
105 virtual MOS_STATUS StoreHucStatus2Register(MOS_COMMAND_BUFFER& cmdBuffer);
106
107 //!
108 //! \brief Force wakeup VDBOX
109 //! \param [in] cmdBuffer
110 //! Pointer to command buffer
111 //! \param [in] mfxWakeup
112 //! MFX pipeline wakeup flag
113 //! \param [in] hcpWakeup
114 //! HCP wakeup flag
115 //! \return MOS_STATUS
116 //! MOS_STATUS_SUCCESS if success, else fail reason
117 //!
118 virtual MOS_STATUS AddForceWakeup(MOS_COMMAND_BUFFER& cmdBuffer, bool mfxWakeup, bool hcpWakeup);
119
120 //!
121 //! \brief Send prolog cmds
122 //! \param [in] cmdBuffer
123 //! Reference to command buffer
124 //! \return MOS_STATUS
125 //! MOS_STATUS_SUCCESS if success, else fail reason
126 //!
127 virtual MOS_STATUS SendPrologCmds(MOS_COMMAND_BUFFER& cmdBuffer);
128
129 //!
130 //! \brief Set HucStatus MMIO mask
131 //! \param [in] hucStatusMask
132 //! MMIO mask for HucStatus
133 //! \param [in] hucStatus2Mask
134 //! MMIO mask for HucStatus2
135 //!
136 void SetHucStatusMask(uint32_t hucStatusMask, uint32_t hucStatus2Mask);
137
138 virtual MOS_STATUS StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER* cmdBuffer) override;
139 virtual MOS_STATUS EndStatusReport(uint32_t srType, MOS_COMMAND_BUFFER* cmdBuffer) override;
140
141 virtual MOS_STATUS MemoryFlush(MOS_COMMAND_BUFFER &cmdBuffer);
142
143 DecodePipeline * m_pipeline = nullptr;
144 MediaFeatureManager * m_featureManager = nullptr;
145 DecodeAllocator * m_allocator = nullptr;
146 CodechalHwInterfaceNext *m_hwInterface = nullptr;
147 DecodeBasicFeature * m_basicFeature = nullptr;
148 DecodeCpInterface* m_decodecp = nullptr;
149
150 std::shared_ptr<mhw::vdbox::huc::Itf> m_hucItf = nullptr;
151 std::shared_ptr<mhw::vdbox::vdenc::Itf> m_vdencItf = nullptr;
152
153 static const uint32_t m_hucStatusInvalidMask = 0; //!< Invalid mask of Huc status MMIO
154 uint32_t m_hucStatusMask = m_hucStatusInvalidMask; //!< MMIO mask for HuC status
155 uint32_t m_hucStatus2Mask = m_hucStatusInvalidMask; //!< MMIO mask for HuC status2
156
157 MEDIA_CLASS_DEFINE_END(decode__DecodeHucBasic)
158 };
159 }
160 #endif // !__DECODE_HUC_H__