1 /*
2 * Copyright (c) 2019-2020, 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_scalability_option.h
25 //! \brief    Defines the decode scalability option
26 
27 #ifndef __DECODE_SCALABILITY_OPTION_H__
28 #define __DECODE_SCALABILITY_OPTION_H__
29 #include "media_scalability_option.h"
30 #include "decode_scalability_defs.h"
31 #include "media_class_trace.h"
32 #include "mos_defs.h"
33 #include "mos_resource_defs.h"
34 struct ScalabilityPars;
35 
36 namespace decode {
37 class DecodeScalabilityOption : public MediaScalabilityOption
38 {
39 public:
40     //!
41     //! \brief  decode scalability option constructor
42     //! \param  [in] pOption
43     //!         Pointer to input scalability option
44     //!
DecodeScalabilityOption()45     DecodeScalabilityOption() {};
46 
47     //!
48     //! \brief  decode scalability option constructor
49     //! \param  [in] option
50     //!         Pointer to input scalability option
51     //!
52     DecodeScalabilityOption(const DecodeScalabilityOption &option);
53 
54     //!
55     //! \brief  decode scalability option destructor
56     //
~DecodeScalabilityOption()57     ~DecodeScalabilityOption() {};
58 
59     //!
60     //! \brief  Set scalability option
61     //! \param  [in] params
62     //!         Pointer to the input parameters to set scalability option
63     //! \return MOS_STATUS
64     //!         MOS_STATUS_SUCCESS if success, else fail reason
65     //!
66     virtual MOS_STATUS SetScalabilityOption(ScalabilityPars *params);
67     //!
68     //! \brief  check if scalability option matched with current option
69     //! \param  [in] params
70     //!         Pointer to the input parameters for compare
71     //! \return bool
72     //!         Ture if matched, else false
73     //!
74     virtual bool IsScalabilityOptionMatched(ScalabilityPars *params);
75     //!
76     //! \brief  check if scalability option matched with current option
77     //! \param  [in] scalabOption
78     //!         Input scalability option for compare
79     //! \return bool
80     //!         Ture if matched, else false
81     //!
82     virtual bool IsScalabilityOptionMatched(MediaScalabilityOption &scalabOption);
83 
84     //!
85     //! \brief  check if SFC flag is set
86     //! \return bool
87     //!         Ture for using SFC
88     //!
IsUsingSFC()89     bool IsUsingSFC() { return m_usingSFC; };
90 
91     //!
92     //! \brief  check if Slim vdbox flag is set
93     //! \return bool
94     //!         Ture for using slim vdbox
95     //!
IsUsingSlimVdbox()96     bool IsUsingSlimVdbox() { return m_usingSlimVdbox; };
97 
98     //! \brief  Get decode scalability mode
99     //! \return ScalabilityMode
100     //!         Return decode scalability mode
101     //!
GetMode()102     ScalabilityMode GetMode() { return m_mode; }
103 
104     //! \brief  Get max pipe number of multipe pipe mode
105     //! \return uint8_t
106     //!         Return decode scalability mode
107     //!
GetMaxMultiPipeNum()108     uint8_t GetMaxMultiPipeNum() { return m_maxNumMultiPipe; }
109 
110     //! \brief  Get FE separate submission flag
111     //! \return bool
112     //!         Return true if FE separate submission, else return false
113     //!
IsFESeparateSubmission()114     bool IsFESeparateSubmission() { return m_FESeparateSubmission; }
115 
116     //! \brief  Get LRCA count
117     //! \return uint32_t
118     //!         Return LRCA count
119     //!
120     uint32_t GetLRCACount();
121 
122 private:
IsRextFormat(MOS_FORMAT format)123     inline static bool IsRextFormat(MOS_FORMAT format)
124     {
125         return ((format != Format_NV12) && (format != Format_P010));
126     }
127 
128     virtual bool IsSinglePipeDecode(DecodeScalabilityPars &params);
129 
130     virtual bool IsRealTileDecode(DecodeScalabilityPars &params);
131 
132     virtual bool IsResolutionMatchMultiPipeThreshold1(
133         uint32_t frameWidth, uint32_t frameHeight, MOS_FORMAT surfaceFormat);
134     virtual bool IsResolutionMatchMultiPipeThreshold2(
135         uint32_t frameWidth, uint32_t frameHeight);
136 
137 #if (_DEBUG || _RELEASE_INTERNAL)
138     inline static uint8_t GetUserPipeNum(uint8_t numVdbox, uint8_t userPipeNum);
139 #endif
140 
141 protected:
142     static const uint8_t m_typicalNumMultiPipe = 2;
143     static const uint8_t m_maxNumMultiPipe = 3;
144 
145     bool m_usingSFC = false;
146     bool m_usingSlimVdbox = false;
147 
148     bool            m_FESeparateSubmission = false;
149     ScalabilityMode m_mode                 = scalabilitySingleMode;
150 
151 MEDIA_CLASS_DEFINE_END(decode__DecodeScalabilityOption)
152 };
153 }
154 #endif // !__DECODE_SCALABILITY_OPTION_H__
155