1 /*
2 * Copyright (c) 2022, 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 #include "vp_user_setting.h"
23 #include "vp_utils.h"
24 
InitVpUserSetting(MediaUserSettingSharedPtr userSettingPtr,bool clearViewMode)25 MOS_STATUS VpUserSetting::InitVpUserSetting(MediaUserSettingSharedPtr userSettingPtr, bool clearViewMode)
26 {
27     //skip for clearview perf purpose, debug dump common key needed.
28     if (!clearViewMode)
29     {
30         DeclareUserSettingKey(  //For debugging purpose. true for disabling SFC
31             userSettingPtr,
32             __VPHAL_VEBOX_DISABLE_SFC,
33             MediaUserSetting::Group::Sequence,
34             0,
35             true);
36 
37         DeclareUserSettingKey(  //Disabling SFC DTR output. 1: Disable, 0: Enable
38             userSettingPtr,
39             __MEDIA_USER_FEATURE_VALUE_SFC_OUTPUT_DTR_DISABLE,
40             MediaUserSetting::Group::Sequence,
41             1,
42             true);
43 
44         DeclareUserSettingKey(  // For Notify which datapath Vebox used
45             userSettingPtr,
46             __VPHAL_VEBOX_OUTPUTPIPE_MODE,
47             MediaUserSetting::Group::Sequence,
48             0,
49             true);
50 
51         DeclareUserSettingKey(  //For Notify which feature Vebox used
52             userSettingPtr,
53             __VPHAL_VEBOX_FEATURE_INUSE,
54             MediaUserSetting::Group::Sequence,
55             0,
56             true);
57 
58         DeclareUserSettingKey(  //Disabling SFC Centering output. 1 -- Disable, 0 -- Enable.
59             userSettingPtr,
60             __MEDIA_USER_FEATURE_VALUE_SFC_OUTPUT_CENTERING_DISABLE,
61             MediaUserSetting::Group::Sequence,
62             0,
63             true);
64 
65         DeclareUserSettingKey(  // VP Bypass Composition Mode
66             userSettingPtr,
67             __VPHAL_BYPASS_COMPOSITION,
68             MediaUserSetting::Group::Sequence,
69             0,
70             true);
71 
72         DeclareUserSettingKey(
73             userSettingPtr,
74             __MEDIA_USER_FEATURE_VALUE_VEBOX_TGNE_ENABLE_VP,
75             MediaUserSetting::Group::Sequence,
76             1,
77             true);  // Enable Vebox GNE. 1: Enable, 0: Disable
78 
79         DeclareUserSettingKey(  //Slice Shutdown Control
80             userSettingPtr,
81             __VPHAL_RNDR_SSD_CONTROL,
82             MediaUserSetting::Group::Sequence,
83             0,
84             true);
85 
86         DeclareUserSettingKey(  // FALSE if CSC coefficient setting mode is Patch mode, otherwise Curbe mode
87             userSettingPtr,
88             __MEDIA_USER_FEATURE_VALUE_CSC_COEFF_PATCH_MODE_DISABLE,
89             MediaUserSetting::Group::Sequence,
90             0,
91             true);
92 
93         DeclareUserSettingKey(
94             userSettingPtr,
95             __MEDIA_USER_FEATURE_VALUE_DISABLE_DN,
96             MediaUserSetting::Group::Sequence,
97             0,
98             true);
99 
100         DeclareUserSettingKey(
101             userSettingPtr,
102             __MEDIA_USER_FEATURE_VALUE_DISABLE_PACKET_REUSE,
103             MediaUserSetting::Group::Sequence,
104             0,
105             true);
106 
107         DeclareUserSettingKey(
108             userSettingPtr,
109             __MEDIA_USER_FEATURE_VALUE_ENABLE_PACKET_REUSE_TEAMS_ALWAYS,
110             MediaUserSetting::Group::Sequence,
111             0,
112             true);
113 
114         DeclareUserSettingKey(
115             userSettingPtr,
116             __MEDIA_USER_FEATURE_VALUE_FORCE_ENABLE_VEBOX_OUTPUT_SURF,
117             MediaUserSetting::Group::Sequence,
118             0,
119             true);
120 
121         DeclareUserSettingKey(
122             userSettingPtr,
123             __VPHAL_HDR_LUT_MODE,
124             MediaUserSetting::Group::Sequence,
125             0,
126             true);
127 
128         DeclareUserSettingKey(
129             userSettingPtr,
130             __VPHAL_HDR_GPU_GENERTATE_3DLUT,
131             MediaUserSetting::Group::Sequence,
132             0,
133             true);
134 
135         DeclareUserSettingKey(
136             userSettingPtr,
137             __VPHAL_HDR_DISABLE_AUTO_MODE,
138             MediaUserSetting::Group::Sequence,
139             0,
140             true);
141 
142         DeclareUserSettingKey(
143             userSettingPtr,
144             __VPHAL_HDR_SPLIT_FRAME_PORTIONS,
145             MediaUserSetting::Group::Sequence,
146             1,
147             true);
148 
149         DeclareUserSettingKey(  // Eanble Apogeios path in VP PipeLine. 1: enabled, 0: disabled.
150             userSettingPtr,
151             __MEDIA_USER_FEATURE_VALUE_VPP_APOGEIOS_ENABLE,
152             MediaUserSetting::Group::Sequence,
153             uint32_t(0),
154             true);
155 
156         DeclareUserSettingKey(  // VP Render Target Compression Mode
157             userSettingPtr,
158             __VPHAL_RT_MMC_COMPRESSMODE,
159             MediaUserSetting::Group::Sequence,
160             0,
161             true);
162 
163 #if (_DEBUG || _RELEASE_INTERNAL)
164         DeclareUserSettingKey(  // VP Render Target Old Cache Usage
165             userSettingPtr,
166             __VPHAL_RT_Old_Cache_Setting,
167             MediaUserSetting::Group::Sequence,
168             0,
169             true);
170 #endif
171 
172         DeclareUserSettingKey(  // VP Render Target Cache Usage
173             userSettingPtr,
174             __VPHAL_RT_Cache_Setting,
175             MediaUserSetting::Group::Sequence,
176             0,
177             true);
178 
179         DeclareUserSettingKey(  // VP Primary Input Compression Mode
180             userSettingPtr,
181             __VPHAL_PRIMARY_MMC_COMPRESSMODE,
182             MediaUserSetting::Group::Sequence,
183             0,
184             true);
185 
186 #if (_DEBUG || _RELEASE_INTERNAL)
187         DeclareUserSettingKeyForDebug(  // FORCE VP DECOMPRESSED OUTPUT
188             userSettingPtr,
189             __VPHAL_RNDR_FORCE_VP_DECOMPRESSED_OUTPUT,
190             MediaUserSetting::Group::Sequence,
191             0,
192             true);
193 
194         DeclareUserSettingKeyForDebug(  //Software Scoreboard enable Control
195             userSettingPtr,
196             __VPHAL_RNDR_SCOREBOARD_CONTROL,
197             MediaUserSetting::Group::Sequence,
198             1,
199             true);
200 
201         DeclareUserSettingKeyForDebug(  // CM based FC enable Control
202             userSettingPtr,
203             __VPHAL_RNDR_CMFC_CONTROL,
204             MediaUserSetting::Group::Sequence,
205             0,
206             true);
207 
208         DeclareUserSettingKeyForDebug(
209             userSettingPtr,
210             __VPHAL_FORCE_3DLUT_INTERPOLATION,
211             MediaUserSetting::Group::Sequence,
212             0,
213             true);
214 
215         DeclareUserSettingKeyForDebug(
216             userSettingPtr,
217             __VPHAL_FORCE_VP_3DLUT_KERNEL_ONLY,
218             MediaUserSetting::Group::Sequence,
219             0,
220             true);
221 
222         DeclareUserSettingKeyForDebug(  //Enable 1K 1DLUT
223             userSettingPtr,
224             __VPHAL_ENABLE_1K_1DLUT,
225             MediaUserSetting::Group::Sequence,
226             0,
227             true);
228 
229         DeclareUserSettingKeyForDebug(
230             userSettingPtr,
231             __VPHAL_VEBOX_HDR_MODE,
232             MediaUserSetting::Group::Sequence,
233             0,
234             true);  //"HDR Mode. 0x1: H2S kernel, 0x3: H2H kernel, 0x21 65size H2S, 0x23 65size H2H, 0x31 33size H2S, 0x33 33size H2H."
235 
236         DeclareUserSettingKeyForDebug(  // For quality tuning purpose
237             userSettingPtr,
238             __VPHAL_HDR_ENABLE_QUALITY_TUNING,
239             MediaUserSetting::Group::Sequence,
240             0,
241             true);
242 
243         DeclareUserSettingKeyForDebug(  //For bit match purpose
244             userSettingPtr,
245             __VPHAL_HDR_ENABLE_KERNEL_DUMP,
246             MediaUserSetting::Group::Sequence,
247             0,
248             true);
249 
250         DeclareUserSettingKeyForDebug(  // For HDR H2S RGB-based tone mapping
251             userSettingPtr,
252             __VPHAL_HDR_H2S_RGB_TM,
253             MediaUserSetting::Group::Sequence,
254             0,
255             true);
256 
257         DeclareUserSettingKeyForDebug(  // VP Compression Enable
258             userSettingPtr,
259             __VPHAL_MMC_ENABLE,
260             MediaUserSetting::Group::Sequence,
261             0,
262             true);
263 
264         DeclareUserSettingKeyForDebug(  // VP Render Target Compressible
265             userSettingPtr,
266             __VPHAL_RT_MMC_COMPRESSIBLE,
267             MediaUserSetting::Group::Sequence,
268             0,
269             true);
270 
271         DeclareUserSettingKeyForDebug(  // VP Primary Input Compressible
272             userSettingPtr,
273             __VPHAL_PRIMARY_MMC_COMPRESSIBLE,
274             MediaUserSetting::Group::Sequence,
275             0,
276             true);
277 
278         DeclareUserSettingKeyForDebug(  // VP Enable Compute Context
279             userSettingPtr,
280             __VPHAL_ENABLE_COMPUTE_CONTEXT,
281             MediaUserSetting::Group::Sequence,
282             0,
283             true);
284 
285         DeclareUserSettingKeyForDebug(  // Force VP Memorycopy Outputcompressed
286             userSettingPtr,
287             __VPHAL_VEBOX_FORCE_VP_MEMCOPY_OUTPUTCOMPRESSED,
288             MediaUserSetting::Group::Sequence,
289             0,
290             true);
291 
292         DeclareUserSettingKeyForDebug(  // VP Composition 8Tap Adaptive Enable
293             userSettingPtr,
294             __VPHAL_COMP_8TAP_ADAPTIVE_ENABLE,
295             MediaUserSetting::Group::Sequence,
296             0,
297             true);
298 
299         DeclareUserSettingKeyForDebug(  // Set SFC NV12/P010 Linear Output
300             userSettingPtr,
301             __VPHAL_ENABLE_SFC_NV12_P010_LINEAR_OUTPUT,
302             MediaUserSetting::Group::Sequence,
303             0,
304             true);
305 
306         DeclareUserSettingKeyForDebug(  // Set SFC RGBP Linear/Tile RGB24 Linear Output
307             userSettingPtr,
308             __VPHAL_ENABLE_SFC_RGBP_RGB24_OUTPUT,
309             MediaUserSetting::Group::Sequence,
310             0,
311             true);
312 
313        DeclareUserSettingKey(  // Enable HDR 3DLut table caculate by CPU. 1: enabled, 0: disabled.
314             userSettingPtr,
315             __VPHAL_HDR_3DLUT_CPU_PATH,
316             MediaUserSetting::Group::Sequence,
317             0,
318             true);
319 #endif
320     }
321 
322 #if (_DEBUG || _RELEASE_INTERNAL)
323     DeclareUserSettingKeyForDebug(  // VP Parameters Dump Outfile
324         userSettingPtr,
325         __VPHAL_DBG_PARAM_DUMP_OUTFILE_KEY_NAME,
326         MediaUserSetting::Group::Sequence,
327         "",
328         true);
329 
330     DeclareUserSettingKeyForDebug(  // VP Parameters Dump Start Frame
331         userSettingPtr,
332         __VPHAL_DBG_PARAM_DUMP_START_FRAME_KEY_NAME,
333         MediaUserSetting::Group::Sequence,
334         1,
335         true);
336 
337     DeclareUserSettingKeyForDebug(  // VP Parameters Dump End Frame
338         userSettingPtr,
339         __VPHAL_DBG_PARAM_DUMP_END_FRAME_KEY_NAME,
340         MediaUserSetting::Group::Sequence,
341         0,
342         true);
343 
344     DeclareUserSettingKeyForDebug(  // Vphal Debug Dump Output Directory
345         userSettingPtr,
346         __VPHAL_DBG_DUMP_OUTPUT_DIRECTORY,
347         MediaUserSetting::Group::Sequence,
348         "",
349         true);
350 
351     DeclareUserSettingKeyForDebug(  // VP parameter dump sku and wa info enable
352         userSettingPtr,
353         __VPHAL_DBG_PARA_DUMP_ENABLE_SKUWA_DUMP,
354         MediaUserSetting::Group::Sequence,
355         0,
356         true);
357 
358     DeclareUserSettingKeyForDebug(
359         userSettingPtr,
360         __MEDIA_USER_FEATURE_VALUE_INTER_FRAME_MEMORY_NINJA_START_COUNTER,
361         MediaUserSetting::Group::Sequence,
362         0,
363         true);
364 
365     DeclareUserSettingKeyForDebug(
366         userSettingPtr,
367         __MEDIA_USER_FEATURE_VALUE_INTER_FRAME_MEMORY_NINJA_END_COUNTER,
368         MediaUserSetting::Group::Sequence,
369         0,
370         true);
371 
372     DeclareUserSettingKeyForDebug(
373         userSettingPtr,
374         __MEDIA_USER_FEATURE_VALUE_ENABLE_IFNCC,
375         MediaUserSetting::Group::Sequence,
376         0,
377         true);
378 
379     DeclareUserSettingKeyForDebug(
380         userSettingPtr,
381         __MEDIA_USER_FEATURE_VALUE_ENABLE_VP_L0_3DLUT,
382         MediaUserSetting::Group::Sequence,
383         0,
384         true);
385 
386     DeclareUserSettingKeyForDebug(
387         userSettingPtr,
388         __MEDIA_USER_FEATURE_VALUE_VP_L0_3DLUT_ENABLED,
389         MediaUserSetting::Group::Sequence,
390         0,
391         true);
392 
393     DeclareUserSettingKeyForDebug(
394         userSettingPtr,
395         __MEDIA_USER_FEATURE_VALUE_ENABLE_VP_L0_FC,
396         MediaUserSetting::Group::Sequence,
397         0,
398         true);
399 
400     DeclareUserSettingKeyForDebug(
401         userSettingPtr,
402         __MEDIA_USER_FEATURE_VALUE_DISABLE_VP_L0_FC_FP,
403         MediaUserSetting::Group::Sequence,
404         0,
405         true);
406 
407     DeclareUserSettingKeyForDebug(
408         userSettingPtr,
409         __MEDIA_USER_FEATURE_VALUE_VP_L0_FC_ENABLED,
410         MediaUserSetting::Group::Sequence,
411         0,
412         true);
413 
414     DeclareUserSettingKeyForDebug(
415         userSettingPtr,
416         __MEDIA_USER_FEATURE_VALUE_VP_L0_FC_REPORT,
417         MediaUserSetting::Group::Sequence,
418         0,
419         true);
420 
421     DeclareUserSettingKeyForDebug(
422         userSettingPtr,
423         __MEDIA_USER_FEATURE_VALUE_ENABLE_VESFC_LINEAR_OUTPUT_BY_TILECONVERT,
424         MediaUserSetting::Group::Device,
425         0,
426         true);
427 
428 #endif
429 
430     return MOS_STATUS_SUCCESS;
431 }