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     vp_user_feature_control.h
25 //! \brief    vp user feature control.
26 //!
27 #ifndef __VP_USER_FEATURE_CONTROL_H__
28 #define __VP_USER_FEATURE_CONTROL_H__
29 
30 #include "mos_os.h"
31 #include "vp_pipeline_common.h"
32 #include "vp_platform_interface.h"
33 
34 namespace vp
35 {
36 
37 class VpUserFeatureControl
38 {
39 
40 public:
41     VpUserFeatureControl(MOS_INTERFACE &osInterface, VpPlatformInterface *vpPlatformInterface, void *owner = nullptr);
42     virtual ~VpUserFeatureControl();
43 
44     struct CONTROL_VALUES
45     {
46         // Control values
47         bool disableVeboxOutput             = false; // If true (VPHAL_COMP_BYPASS_DISABLED), output from vebox directly is not allowed, otherwise, output from vebox is allowed.
48         bool disableSfc                     = false;
49         bool computeContextEnabled          = true;
50         bool eufusionBypassWaEnabled        = false;
51         bool disableDn                      = false;
52         bool cscCosffPatchModeDisabled      = false;
53         bool ForceEnableVeboxOutputSurf     = false;
54         bool veboxTypeH                     = false;
55         bool is3DLutKernelOnly              = false;
56 
57 #if (_DEBUG || _RELEASE_INTERNAL)
58         bool forceDecompressedOutput        = false;
59         uint32_t force3DLutInterpolation    = 0;
60         uint32_t enabledSFCNv12P010LinearOutput = 0;
61         uint32_t enabledSFCRGBPRGB24Output  = 0;
62         bool     enableIFNCC                    = false;
63         bool     bEnableL03DLut                 = false;
64         bool     bForceL0FC                     = false;
65         bool     bDisableL0FcFp                 = false;
66 #endif
67         bool disablePacketReuse             = false;
68         bool enablePacketReuseTeamsAlways   = false;
69 
70         VPHAL_HDR_LUT_MODE globalLutMode      = VPHAL_HDR_LUT_MODE_NONE;  //!< Global LUT mode control for debugging purpose
71         bool               gpuGenerate3DLUT   = false;                        //!< Flag for per frame GPU generation of 3DLUT
72         bool               isExternal3DLutSupport  = true;
73         bool               disableAutoMode    = false;
74         bool               clearVideoViewMode = false;
75         uint32_t           splitFramePortions = 1;
76         bool               decompForInterlacedSurfWaEnabled = false;
77         bool               enableSFCLinearOutputByTileConvert = false;
78     };
79 
Is3DLutKernelOnly()80     uint32_t Is3DLutKernelOnly()
81     {
82         return m_ctrlVal.is3DLutKernelOnly;
83     }
84 
85 #if (_DEBUG || _RELEASE_INTERNAL)
IsForceDecompressedOutput()86     bool IsForceDecompressedOutput()
87     {
88         return m_ctrlVal.forceDecompressedOutput;
89     }
90 
Force3DLutInterpolation()91     uint32_t Force3DLutInterpolation()
92     {
93         return m_ctrlVal.force3DLutInterpolation;
94     }
95 
EnabledSFCNv12P010LinearOutput()96     uint32_t EnabledSFCNv12P010LinearOutput()
97     {
98         return m_ctrlVal.enabledSFCNv12P010LinearOutput;
99     }
100 
EnabledSFCRGBPRGB24Output()101     uint32_t EnabledSFCRGBPRGB24Output()
102     {
103         return m_ctrlVal.enabledSFCRGBPRGB24Output;
104     }
105 
EnableIFNCC()106     bool EnableIFNCC()
107     {
108         return m_ctrlVal.enableIFNCC;
109     }
110 
EnableL03DLut()111     bool EnableL03DLut()
112     {
113         return m_ctrlVal.bEnableL03DLut;
114     }
115 
DisableL0FcFp()116     bool DisableL0FcFp()
117     {
118         return m_ctrlVal.bDisableL0FcFp;
119     }
120 #endif
121 
IsSFCLinearOutputByTileConvertEnabled()122     bool IsSFCLinearOutputByTileConvertEnabled()
123     {
124         return m_ctrlVal.enableSFCLinearOutputByTileConvert;
125     }
126 
127     virtual MOS_STATUS CreateUserSettingForDebug();
128 
129     virtual MOS_STATUS Update(PVP_PIPELINE_PARAMS params);
130 
131     bool EnableL0FC();
132 
IsVeboxOutputSurfEnabled()133     bool IsVeboxOutputSurfEnabled()
134     {
135         return m_ctrlVal.ForceEnableVeboxOutputSurf;
136     }
137 
IsVeboxOutputDisabled()138     bool IsVeboxOutputDisabled()
139     {
140         return m_ctrlVal.disableVeboxOutput;
141     }
142 
IsSfcDisabled()143     bool IsSfcDisabled()
144     {
145         return m_ctrlVal.disableSfc;
146     }
147 
IsComputeContextEnabled()148     bool IsComputeContextEnabled()
149     {
150         return m_ctrlVal.computeContextEnabled;
151     }
152 
IsEufusionBypassWaEnabled()153     bool IsEufusionBypassWaEnabled()
154     {
155         return m_ctrlVal.eufusionBypassWaEnabled;
156     }
157 
IsDisableDn()158     bool IsDisableDn()
159     {
160         return m_ctrlVal.disableDn;
161     }
162 
IsCscCosffPatchModeDisabled()163     bool IsCscCosffPatchModeDisabled()
164     {
165         return m_ctrlVal.cscCosffPatchModeDisabled;
166     }
167 
IsPacketReuseDisabled()168     bool IsPacketReuseDisabled()
169     {
170         return m_ctrlVal.disablePacketReuse;
171     }
172 
IsPacketReuseEnabledTeamsAlways()173     bool IsPacketReuseEnabledTeamsAlways()
174     {
175         return m_ctrlVal.enablePacketReuseTeamsAlways;
176     }
177 
GetGlobalLutMode()178     uint32_t GetGlobalLutMode()
179     {
180         return m_ctrlVal.globalLutMode;
181     }
182 
IsGpuGenerate3DLUT()183     bool IsGpuGenerate3DLUT()
184     {
185         return m_ctrlVal.gpuGenerate3DLUT;
186     }
187 
IsExternal3DLutSupport()188     bool IsExternal3DLutSupport()
189     {
190         return m_ctrlVal.isExternal3DLutSupport;
191     }
192 
IsDisableAutoMode()193     bool IsDisableAutoMode()
194     {
195         return m_ctrlVal.disableAutoMode;
196     }
197 
IsClearVideoViewMode()198     bool IsClearVideoViewMode()
199     {
200         return m_ctrlVal.clearVideoViewMode;
201     }
202 
IsDecompForInterlacedSurfWaEnabled()203     bool IsDecompForInterlacedSurfWaEnabled()
204     {
205         return m_ctrlVal.decompForInterlacedSurfWaEnabled;
206     }
207 
IsVeboxTypeHMode()208     bool IsVeboxTypeHMode()
209     {
210         return m_ctrlVal.veboxTypeH;
211     }
212 
SetClearVideoViewMode(bool mode)213     MOS_STATUS SetClearVideoViewMode(bool mode)
214     {
215         m_ctrlVal.clearVideoViewMode = mode;
216         return MOS_STATUS_SUCCESS;
217     }
218 
GetSplitFramePortions()219     uint32_t GetSplitFramePortions()
220     {
221         return m_ctrlVal.splitFramePortions;
222     }
223 
ForceRenderPath(bool status)224     MOS_STATUS ForceRenderPath(bool status)
225     {
226         m_ctrlVal.disableSfc                = status;
227         m_ctrlVal.disableVeboxOutput        = status;
228         m_ctrlValDefault.disableSfc         = status;
229         m_ctrlValDefault.disableVeboxOutput = status;
230 
231         return MOS_STATUS_SUCCESS;
232     }
233 
234     virtual PMOS_OCA_LOG_USER_FEATURE_CONTROL_INFO GetOcaFeautreControlInfo();
235 
236     const void *m_owner = nullptr; // The object who create current instance.
237 
238 protected:
239     PMOS_INTERFACE m_osInterface = nullptr;
240     VpPlatformInterface *m_vpPlatformInterface = nullptr;
241 
242     CONTROL_VALUES m_ctrlValDefault = {};
243     CONTROL_VALUES m_ctrlVal        = {};
244     MediaUserSettingSharedPtr m_userSettingPtr = nullptr;  //!< usersettingInstance
245     PMOS_OCA_LOG_USER_FEATURE_CONTROL_INFO m_pOcaFeatureControlInfo = nullptr;
246 
247     MEDIA_CLASS_DEFINE_END(vp__VpUserFeatureControl)
248 };
249 
250 
251 }
252 #endif // !__VP_USER_FEATURE_CONTROL_H__
253