Debian Codegraph @

media_softlet/agnostic/common/vp/hal/feature_manager/vp_feature_caps.h

raw
1 /*
2 * Copyright (c) 2020-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 vp_feature_caps.h
25 //! \brief Defines the common interface for vp features caps on diff engines
26 //! \details The vp feature caps is designed based on vp engines
27 //! this file is for the base interface which is shared by all components.
28 //!
29 #ifndef __VP_FEATURE_CAPS_H__
30 #define __VP_FEATURE_CAPS_H__
31 #include "vp_utils.h"
32 #include "mos_resource_defs.h"
33
34 #define SUPPORTED 1
35 #define UNSUPPORTED 0
36
37 #define VP_SFC_RESOLUTION_FEASIBLE(_InputWidth, _InputHeight, _OutputWidth, _OutputHeight, _90D_Rotation) \
38
39
40 #define VP_FF_SFC_FORMAT(SurfaceFormat, bInput, bOutput, _MaxResolution, _InputMinResolution, _OutputMinResolution, _HorizUnit, _VertUnit, _RotationSupported, _MirrorSupported, _CscSupported, _ScalingSupported, \
41 _SrcAlphaSupported, _ConstAlphaSupported, _IScalingSupported, _DetheringSupported, _IefSupported, _Max_ScalingRatio, _Min_ScalingRatio) \
42 { \
43 sfcHwEntry[SurfaceFormat].inputSupported = bInput; \
44 sfcHwEntry[SurfaceFormat].outputSupported = bOutput; \
45 sfcHwEntry[SurfaceFormat].maxResolution = _MaxResolution; \
46 sfcHwEntry[SurfaceFormat].inputMinResolution = _InputMinResolution; \
47 sfcHwEntry[SurfaceFormat].outputMinResolution = _OutputMinResolution; \
48 sfcHwEntry[SurfaceFormat].horizontalAlignUnit = _HorizUnit; \
49 sfcHwEntry[SurfaceFormat].verticalAlignUnit = _VertUnit; \
50 sfcHwEntry[SurfaceFormat].rotationSupported = _RotationSupported; \
51 sfcHwEntry[SurfaceFormat].mirrorSupported = _MirrorSupported; \
52 sfcHwEntry[SurfaceFormat].cscSupported = _CscSupported; \
53 sfcHwEntry[SurfaceFormat].scalingSupported = _ScalingSupported; \
54 sfcHwEntry[SurfaceFormat].sourceAlphaSupported = _SrcAlphaSupported; \
55 sfcHwEntry[SurfaceFormat].constAlphaSupported = _ConstAlphaSupported; \
56 sfcHwEntry[SurfaceFormat].iScalingSupported = _IScalingSupported; \
57 sfcHwEntry[SurfaceFormat].detheringSupported = _DetheringSupported; \
58 sfcHwEntry[SurfaceFormat].minScalingRatio = _Min_ScalingRatio; \
59 sfcHwEntry[SurfaceFormat].maxScalingRatio = _Max_ScalingRatio; \
60 sfcHwEntry[SurfaceFormat].iefSupported = _IefSupported; \
61 } \
62
63 enum VP_TILE_MODE_MASK
64 {
65 VP_TILE_MODE_MASK_UNUSED = 0, // 000
66 VP_TILE_MODE_MASK_TILE4 = 1, // 001 1st bit: tile4
67 VP_TILE_MODE_MASK_TILE64 = 2, // 010 2nd bit: tile64
68 VP_TILE_MODE_MASK_LINEAR = 4 // 100 3rd bit linear
69 };
70
71 //!
72 //! \ brief VP SFC Tile Mode Format support
73 //!
74 enum VP_SFC_OUTUT_SUPPORT
75 {
76 VP_SFC_OUTPUT_SUPPORT_NONE = 0,
77 VP_SFC_OUTPUT_SUPPORT_TILE_ONLY = (VP_TILE_MODE_MASK_TILE4 | VP_TILE_MODE_MASK_TILE64),
78 VP_SFC_OUTPUT_SUPPORT_LINEAR_ONLY = VP_TILE_MODE_MASK_LINEAR,
79 VP_SFC_OUTPUT_SUPPORT_ALL = (VP_TILE_MODE_MASK_TILE4 | VP_TILE_MODE_MASK_TILE64 | VP_TILE_MODE_MASK_LINEAR)
80 };
81
82 inline uint32_t VpGetFormatTileSupport(MOS_TILE_MODE_GMM tileMode)
83 {
84 switch (tileMode)
85 {
86 case MOS_TILE_64_GMM: //tile64
87 return VP_TILE_MODE_MASK_TILE64;
88 case MOS_TILE_LINEAR_GMM: //tilelinear
89 return VP_TILE_MODE_MASK_LINEAR;
90 case MOS_TILE_4_GMM: // tile4
91 default:
92 return VP_TILE_MODE_MASK_TILE4;
93 }
94 }
95
96 typedef struct VP_SFC_ENTRY_REC
97 {
98 bool inputSupported;
99 VP_SFC_OUTUT_SUPPORT outputSupported; // 1st bit: tile4, 2nd bit: tile64, 3rd bit linear
100 uint32_t maxResolution;
101 uint32_t inputMinResolution;
102 uint32_t outputMinResolution;
103 float maxScalingRatio;
104 float minScalingRatio;
105 uint32_t horizontalAlignUnit;
106 uint32_t verticalAlignUnit;
107 bool rotationSupported;
108 bool mirrorSupported;
109 bool cscSupported;
110 bool scalingSupported;
111 bool sourceAlphaSupported;
112 bool constAlphaSupported;
113 bool iScalingSupported;
114 bool detheringSupported;
115 bool iefSupported;
116 }VP_SFC_ENTRY_REC;
117
118 #define VP_FF_VEBOX_FORMAT(SurfaceFormat, bInput, bOutput, _MaxWidth, _MaxHeight, _MinWidth, _MinHeight, _HorizUnit, _VertUnit, _HdrSupported, _CapturePipeSupported, \
119 _DNSupported, _DISupported, _LACESupported, _FrontCscSupported, _BackEndCscSupported, _3DLutSupported, _IecpSupported, _bHsbMode, \
120 _TCCSupported, _ACESupported, _STESupported, _CGCSupported) \
121 { \
122 veboxHwEntry[SurfaceFormat].inputSupported = bInput; \
123 veboxHwEntry[SurfaceFormat].outputSupported = bOutput; \
124 veboxHwEntry[SurfaceFormat].maxWidth = _MaxWidth; \
125 veboxHwEntry[SurfaceFormat].maxHeight = _MaxHeight; \
126 veboxHwEntry[SurfaceFormat].minWidth = _MinWidth; \
127 veboxHwEntry[SurfaceFormat].minHeight = _MinHeight; \
128 veboxHwEntry[SurfaceFormat].horizontalAlignUnit = _HorizUnit; \
129 veboxHwEntry[SurfaceFormat].verticalAlignUnit = _VertUnit; \
130 veboxHwEntry[SurfaceFormat].hdrSupported = _HdrSupported; \
131 veboxHwEntry[SurfaceFormat].capturePipeSupported = _CapturePipeSupported; \
132 veboxHwEntry[SurfaceFormat].denoiseSupported = _DNSupported; \
133 veboxHwEntry[SurfaceFormat].deinterlaceSupported = _DISupported; \
134 veboxHwEntry[SurfaceFormat].laceSupported = _LACESupported; \
135 veboxHwEntry[SurfaceFormat].frontCscSupported = _FrontCscSupported; \
136 veboxHwEntry[SurfaceFormat].backEndCscSupported = _BackEndCscSupported; \
137 veboxHwEntry[SurfaceFormat].b3dLutSupported = _3DLutSupported; \
138 veboxHwEntry[SurfaceFormat].iecp = _IecpSupported; \
139 veboxHwEntry[SurfaceFormat].hsb = _bHsbMode; \
140 veboxHwEntry[SurfaceFormat].tccSupported = _TCCSupported; \
141 veboxHwEntry[SurfaceFormat].aceSupported = _ACESupported; \
142 veboxHwEntry[SurfaceFormat].tccSupported = _TCCSupported; \
143 veboxHwEntry[SurfaceFormat].steSupported = _STESupported; \
144 veboxHwEntry[SurfaceFormat].cgcSupported = _CGCSupported; \
145 } \
146
147 typedef struct VP_VEBOX_ENTRY_REC
148 {
149 bool inputSupported;
150 bool outputSupported;
151 uint32_t maxWidth;
152 uint32_t maxHeight;
153 uint32_t minWidth;
154 uint32_t minHeight;
155 float maxScalingRatio;
156 float minScalingRatio;
157 uint32_t horizontalAlignUnit;
158 uint32_t verticalAlignUnit;
159 bool hdrSupported; // Gamut Expansion, HDR and Forward Gamma Correction are mutually exclusive.
160 bool capturePipeSupported;
161 bool denoiseSupported;
162 bool deinterlaceSupported;
163 bool laceSupported;
164 bool frontCscSupported;
165 bool backEndCscSupported;
166 bool b3dLutSupported;
167 bool iecp;// all IECP features like procamp/STD/Gamut etc
168 bool hsb;// high speed bypass mode
169 bool tccSupported;
170 bool aceSupported;
171 bool steSupported;
172 bool cgcSupported;
173 }VP_VEBOX_ENTRY_REC;
174
175 struct VP_POLICY_RULES
176 {
177 struct
178 {
179 struct
180 {
181 bool enable = false; // true if enable 2 pass scaling.
182 struct
183 {
184 float ratioFor1stPass = 0; // scaling ratio for 1st pass when 2 pass downscaling needed. valid value in [minSfcScalingRatio, 1).
185 float minRatioEnlarged = 0; // min ratio enlarged according to minSfcScalingRatio. valid value is [ratioFor1stPass, 1).
186 // minRatio for 2 pass upscaling is minSfcScalingRatio * minRatioEnlarged.
187 bool scalingIn1stPassIf1PassEnough = false; // For 1 pass enough case, if true, do scaling in 1st pass, otherwise, do scaling in 2nd pass.
188 // e.g. ratioX being 1/2 and ratioY being 1/16, if true, width will do scaling in 1st pass,
189 // otherwise, width will do scaling in 2nd pass
190 } downScaling;
191 struct
192 {
193 float ratioFor1stPass = 0; // scaling ratio for 1st pass when 2 pass upscaling needed. valid value in (1, maxSfcScalingRatio].
194 float maxRatioEnlarged = 0; // Max ratio enlarged according to maxSfcScalingRatio. valid value is (1, ratioFor1stPass].
195 // maxRatio for 2 pass upscaling is maxSfcScalingRatio * maxRatioEnlarged.
196 bool scalingIn1stPassIf1PassEnough = false; // For 1 pass enough case, if true, do scaling in 1st pass, otherwise, do scaling in 2nd pass.
197 // e.g. ratioX being 2 and ratioY being 16, if true, width will do scaling in 1st pass,
198 // otherwise, width will do scaling in 2nd pass
199 } upScaling;
200 } scaling;
201 struct
202 {
203 bool enable = false;
204 } csc;
205 } sfcMultiPassSupport;
206
207 bool isAvsSamplerSupported;
208 bool isHDR3DLutKernelEnabled;
209 bool is1K1DLutSurfaceInUse;
210 bool isHDR33LutSizeEnabled = false;
211 };
212
213 struct VP_HW_CAPS
214 {
215 VP_SFC_ENTRY_REC m_sfcHwEntry[Format_Count] = {};
216 VP_VEBOX_ENTRY_REC m_veboxHwEntry[Format_Count] = {};
217 VP_POLICY_RULES m_rules = {};
218 };
219
220 #endif// __VP_FEATURE_CAPS_H__