1 /*
2 * Copyright (c) 2019, 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_sub_packet.h
25 //! \brief    Defines the common interface for decode sub packet
26 //! \details  The decocode sub packet interface is further sub-divided by different packet usages,
27 //!           this file is for the base interface which is shared by all decode packets.
28 //!
29 
30 #ifndef __DECODE_SUB_PACKET_H__
31 #define __DECODE_SUB_PACKET_H__
32 
33 #include "mos_defs.h"
34 #include "codechal_setting.h"
35 #include "codec_hw_next.h"
36 #include "codec_def_decode.h"
37 #include "media_feature_manager.h"
38 #include "decodecp_interface.h"
39 
40 namespace decode
41 {
42 
43 class DecodePipeline;
44 
45 class DecodeSubPacket
46 {
47 public:
48     //!
49     //! \brief  Decode sub packet constructor
50     //!
51     DecodeSubPacket(DecodePipeline *pipeline, CodechalHwInterfaceNext *hwInterface);
52 
53     //!
54     //! \brief  Decode sub packet destructor
55     //!
~DecodeSubPacket()56     virtual ~DecodeSubPacket() {};
57 
58     //!
59     //! \brief  Initialize the media packet, allocate required resources
60     //! \return MOS_STATUS
61     //!         MOS_STATUS_SUCCESS if success, else fail reason
62     //!
63     virtual MOS_STATUS Init() = 0;
64 
65     //!
66     //! \brief  Prepare the parameters for command submission
67     //! \return MOS_STATUS
68     //!         MOS_STATUS_SUCCESS if success, else fail reason
69     //!
70     virtual MOS_STATUS Prepare() = 0;
71 
72     //! \brief  Calculate Command Size
73     //!
74     //! \param  [in, out] commandBufferSize
75     //!         requested size
76     //! \param  [in, out] requestedPatchListSize
77     //!         requested size
78     //! \return uint32_t
79     //!         Command size calculated
80     //!
81     virtual MOS_STATUS CalculateCommandSize(
82         uint32_t &commandBufferSize,
83         uint32_t &requestedPatchListSize) = 0;
84 
85 protected:
86     DecodePipeline *        m_pipeline = nullptr;
87     MediaFeatureManager *   m_featureManager = nullptr;
88     CodechalHwInterfaceNext      *m_hwInterface    = nullptr;
89     PMOS_INTERFACE          m_osInterface = nullptr;
90     DecodeCpInterface *     m_decodecp = nullptr;
91     std::shared_ptr<mhw::mi::Itf> m_miItf = nullptr;
92 
93 MEDIA_CLASS_DEFINE_END(decode__DecodeSubPacket)
94 };
95 
96 }
97 
98 #endif  // !__DECODE_SUB_PACKET_H__
99