Debian Codegraph @

media_driver/agnostic/gen9/vp/hal/vphal_render_vebox_g9_base.h

raw
1 /*
2 * Copyright (c) 2011-2017, 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 //! \file vphal_render_vebox_g9_base.h
24 //! \brief Interface and structure specific for SKL (GEN9) Vebox
25 //! \details Interface and structure specific for SKL (GEN9) Vebox
26 //!
27 #ifndef __VPHAL_RENDER_VEBOX_G9_BASE_H__
28 #define __VPHAL_RENDER_VEBOX_G9_BASE_H__
29
30 #include "vphal_render_vebox_base.h"
31
32 #define VPHAL_VEBOX_MAX_SLICES_G9 2
33
34 #define VPHAL_VEBOX_RGB_HISTOGRAM_SIZE_G9 (VPHAL_VEBOX_RGB_HISTOGRAM_SIZE_PER_SLICE * \
35 VPHAL_NUM_RGB_CHANNEL * \
36 VPHAL_VEBOX_MAX_SLICES_G9)
37 //!
38 //! \brief Temporal Denoise Definitions for SKL+
39 //!
40 #define NOISE_HISTORY_MAX_DEFAULT_G9 208
41 #define NOISE_NUMMOTIONPIXELS_THRESHOLD_DEFAULT_G9 2
42
43 //!
44 //! \brief SKL+ added 4 LSB for ASD/STAD/SCM/LTDT/TDT, hence shifting 4 below.
45 //!
46 #define NOISE_ABSSUMTEMPORALDIFF_THRESHOLD_LOW_G9 (32 << 4)
47 #define NOISE_ABSSUMTEMPORALDIFF_THRESHOLD_DEFAULT_G9 (32 << 4)
48 #define NOISE_ABSSUMTEMPORALDIFF_THRESHOLD_HIGH_G9 (40 << 4)
49 #define NOISE_SPATIALCOMPLEXITYMATRIX_THRESHOLD_LOW_G9 (32 << 4)
50 #define NOISE_SPATIALCOMPLEXITYMATRIX_THRESHOLD_DEFAULT_G9 (32 << 4)
51 #define NOISE_SPATIALCOMPLEXITYMATRIX_THRESHOLD_HIGH_G9 (40 << 4)
52 #define NOISE_LOWTEMPORALPIXELDIFF_THRESHOLD_LOW_G9 (4 << 4)
53 #define NOISE_LOWTEMPORALPIXELDIFF_THRESHOLD_DEFAULT_G9 (8 << 4)
54 #define NOISE_LOWTEMPORALPIXELDIFF_THRESHOLD_HIGH_G9 (8 << 4)
55 #define NOISE_TEMPORALPIXELDIFF_THRESHOLD_LOW_G9 (8 << 4)
56 #define NOISE_TEMPORALPIXELDIFF_THRESHOLD_DEFAULT_G9 (12 << 4)
57 #define NOISE_TEMPORALPIXELDIFF_THRESHOLD_HIGH_G9 (12 << 4)
58 #define NOISE_SUMABSTEMPORALDIFF_THRESHOLD_LOW_G9 (128 << 4)
59 #define NOISE_SUMABSTEMPORALDIFF_THRESHOLD_DEFAULT_G9 (128 << 4)
60 #define NOISE_SUMABSTEMPORALDIFF_THRESHOLD_HIGH_G9 (144 << 4)
61
62 //!
63 //! \brief Vebox Statistics Surface definition for SKL+
64 //!
65 #define VPHAL_VEBOX_STATISTICS_SIZE_G9 (32 * 4)
66 #define VPHAL_VEBOX_STATISTICS_PER_FRAME_SIZE_G9 (32 * sizeof(uint32_t))
67 #define VPHAL_VEBOX_STATISTICS_SURFACE_FMD_OFFSET_G9 0
68 #define VPHAL_VEBOX_STATISTICS_SURFACE_GNE_OFFSET_G9 0x2C
69 #define VPHAL_VEBOX_STATISTICS_SURFACE_STD_OFFSET_G9 0x44
70
71 //!
72 //! \brief Vebox Histogram Surface definition for SKL
73 //!
74 #define VPHAL_VEBOX_ACE_HISTOGRAM_SLICE0_OFFSET_G9 0x1C00
75 #define VPHAL_VEBOX_ACE_HISTOGRAM_SLICE1_OFFSET_G9 0x2400
76
77 struct VEBOX_STATE_UPDATE_STATIC_DATA_G9
78 {
79 // DWORD 0 - GRF R1.0
80 union
81 {
82 // DN State Update
83 struct
84 {
85 uint32_t OffsetToSlice0;
86 };
87
88 uint32_t Value;
89 } DW00;
90
91 // DWORD 1 - GRF R1.1
92 union
93 {
94 // DN State Update
95 struct
96 {
97 uint32_t OffsetToSlice1;
98 };
99
100 uint32_t Value;
101 } DW01;
102
103 // DWORD 2 - GRF R1.2
104 union
105 {
106 // DN State Update
107 struct
108 {
109 uint32_t FirstFrameFlag : 16;
110 uint32_t NoiseLevel : 16;
111 };
112
113 uint32_t Value;
114 } DW02;
115
116 // DWORD 3 - GRF R1.3
117 union
118 {
119 // RangeThr Adp2NLvl: 1 ifenabled, 0 otherwise
120 struct
121 {
122 uint32_t RangeThrAdp2NLvl : 16;
123 uint32_t reserved : 16;
124 };
125
126 uint32_t Value;
127 } DW03;
128
129 // DWORD 4 - GRF R1.4
130 union
131 {
132 // Vebox Statistics Surface
133 struct
134 {
135 uint32_t VeboxStatisticsSurface;
136 };
137
138 uint32_t Value;
139 } DW04;
140
141 // DWORD 5 - GRF R1.5
142 union
143 {
144 // Vebox DnDi State Surface
145 struct
146 {
147 uint32_t VeboxDndiStateSurface;
148 };
149
150 uint32_t Value;
151 } DW05;
152
153 // DWORD 6 - GRF R1.6
154 union
155 {
156 // Vebox GNE surface
157 struct
158 {
159 uint32_t VeboxTempSurface;
160 };
161
162 uint32_t Value;
163 } DW06;
164
165 // DWORD 7 - GRF R1.7
166 union
167 {
168 // Vebox Spatial Attributes Configuration Surface
169 struct
170 {
171 uint32_t VeboxSpatialAttributesConfigurationSurface;
172 };
173
174 uint32_t Value;
175 } DW07;
176 };
177
178 typedef class VPHAL_VEBOX_STATE_G9_BASE *PVPHAL_VEBOX_STATE_G9_BASE;
179 class VPHAL_VEBOX_STATE_G9_BASE:virtual public VPHAL_VEBOX_STATE
180 {
181 public:
182 VPHAL_VEBOX_STATE_G9_BASE(
183 PMOS_INTERFACE pOsInterface,
184 PMHW_VEBOX_INTERFACE pVeboxInterface,
185 PMHW_SFC_INTERFACE pSfcInterface,
186 PRENDERHAL_INTERFACE pRenderHal,
187 PVPHAL_VEBOX_EXEC_STATE pVeboxExecState,
188 PVPHAL_RNDR_PERF_DATA pPerfData,
189 const VPHAL_DNDI_CACHE_CNTL &dndiCacheCntl,
190 MOS_STATUS *peStatus);
191
192 virtual ~VPHAL_VEBOX_STATE_G9_BASE() { }
193
194 virtual MOS_STATUS AllocateResources();
195
196 virtual void FreeResources();
197
198 virtual MOS_STATUS SetupVeboxKernel(
199 int32_t iKDTIndex);
200
201 virtual MOS_STATUS SetupDiIecpState(
202 bool bDiScdEnable,
203 PMHW_VEBOX_DI_IECP_CMD_PARAMS
204 pVeboxDiIecpCmdParams);
205
206 virtual void SetupSurfaceStates(
207 bool bDiVarianceEnable,
208 PVPHAL_VEBOX_SURFACE_STATE_CMD_PARAMS
209 pVeboxSurfaceStateCmdParams);
210
211 virtual MOS_STATUS SetupVeboxState(
212 bool bDiVarianceEnable,
213 PMHW_VEBOX_STATE_CMD_PARAMS pVeboxStateCmdParams);
214
215 virtual bool IsNeeded(
216 PCVPHAL_RENDER_PARAMS pcRenderParams,
217 RenderpassData *pRenderPassData);
218
219 #if VEBOX_AUTO_DENOISE_SUPPORTED
220 virtual MOS_STATUS LoadUpdateDenoiseKernelStaticData(
221 int32_t* iCurbeOffsetOutDN);
222
223 virtual MOS_STATUS SetupSurfaceStatesForDenoise();
224 #endif
225
226 virtual bool IsFormatSupported(
227 PVPHAL_SURFACE pSrcSurface);
228
229 virtual bool IsRTFormatSupported(
230 PVPHAL_SURFACE pSrcSurface,
231 PVPHAL_SURFACE pRTSurface);
232
233 virtual bool IsDnFormatSupported(
234 PVPHAL_SURFACE pSrcSurface);
235
236 virtual bool IsDiFormatSupported(
237 PVPHAL_SURFACE pSrcSurface);
238
239 virtual VPHAL_OUTPUT_PIPE_MODE GetOutputPipe(
240 PCVPHAL_RENDER_PARAMS pcRenderParams,
241 PVPHAL_SURFACE pSrcSurface,
242 bool* pbCompNeeded);
243
244 virtual bool UseKernelResource();
245
246 virtual void VeboxGetBeCSCMatrix(
247 PVPHAL_SURFACE pSrcSurface,
248 PVPHAL_SURFACE pOutSurface);
249
250 protected:
251 //!
252 //! \brief Setup Vebox_DI_IECP Command params for VEBOX final output surface on G75
253 //! \details Setup Vebox_DI_IECP Command params for VEBOX final output surface on G75
254 //! \param bDiScdEnable
255 //! [in] Is DI/Variances report enabled
256 //! \param pVeboxDiIecpCmdParams
257 //! [in,out] Pointer to VEBOX_DI_IECP command parameters
258 //! \return MOS_STATUS
259 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
260 //!
261 virtual MOS_STATUS SetupDiIecpStateForOutputSurf(
262 bool bDiScdEnable,
263 PMHW_VEBOX_DI_IECP_CMD_PARAMS pVeboxDiIecpCmdParams);
264
265 //!
266 //! \brief IsFormatMMCSupported
267 //! \details Check if the format of vebox output surface is supported by MMC
268 //! \param [in] Format
269 //! \return bool true if suported, otherwise not supported
270 //!
271 virtual bool IsFormatMMCSupported(
272 MOS_FORMAT Format);
273
274 //!
275 //! \brief Get Output surface params needed when allocate surfaces
276 //! \details Get Output surface params needed when allocate surfaces
277 //! \param Format
278 //! [out] Format of output surface
279 //! \param TileType
280 //! [out] Tile type of output surface
281 //! \return MOS_STATUS
282 //! Return MOS_STATUS_SUCCESS if success, otherwise failed
283 //!
284 virtual MOS_STATUS GetOutputSurfParams(
285 MOS_FORMAT &Format,
286 MOS_TILE_TYPE &TileType);
287
288 //!
289 //! \brief Get related surf parameters needed when allocate FFDI surface
290 //! \details Get related surf parameters needed when allocate FFDI surface
291 //! \param ColorSpace
292 //! [out] Color space of FFDI surface
293 //! \param SampleType
294 //! [out] Sample type of FFDI surface
295 //! \return MOS_STATUS
296 //! Return MOS_STATUS_SUCCESS if success, otherwise failed
297 //!
298 virtual MOS_STATUS GetFFDISurfParams(
299 VPHAL_CSPACE &ColorSpace,
300 VPHAL_SAMPLE_TYPE &SampleType);
301
302 //!
303 //! \brief Check for DN only case
304 //! \details Check for DN only case
305 //! \return bool
306 //! Return true if DN only case, otherwise not
307 //!
308 virtual bool IsDNOnly();
309
310 //!
311 //! \brief Check whether FFDI Surf is needed
312 //! \details For decide whether FFDI surf should be allocated or will be used
313 //! \return bool
314 //! Return true is needed, otherwise false
315 //!
316 virtual bool IsFFDISurfNeeded();
317
318 //!
319 //! \brief Check whether FFDN Surf is needed
320 //! \details For decide whether FFDN surf should be allocated or will be used
321 //! \return bool
322 //! Return true is needed, otherwise false
323 //!
324 virtual bool IsFFDNSurfNeeded();
325
326 //!
327 //! \brief Check whether STMM Surf is needed
328 //! \details For decide whether STMM surf should be allocated or will be used
329 //! \return bool
330 //! Return true is needed, otherwise false
331 //!
332 virtual bool IsSTMMSurfNeeded();
333
334 //!
335 //! \brief Get output surface of Vebox
336 //! \details Get output surface of Vebox in current operation
337 //! \param bDiVarianceEnable
338 //! [in] Is DI/Variances report enabled
339 //! \return PVPHAL_SURFACE
340 //! Corresponding output surface pointer
341 //!
342 virtual PVPHAL_SURFACE GetSurfOutput(
343 bool bDiVarianceEnable);
344
345 virtual MOS_STATUS VeboxQueryStatLayout(
346 VEBOX_STAT_QUERY_TYPE QueryType,
347 uint32_t* pQuery);
348
349 //!
350 //! \brief Check if 2 passes CSC are supported on the platform
351 //!
352 virtual bool Is2PassesCscPlatformSupported()
353 {
354 return true;
355 }
356
357 virtual void GetLumaDefaultValue(
358 PVPHAL_SAMPLER_STATE_DNDI_PARAM pLumaParams);
359
360 virtual MOS_STATUS SetDNDIParams(
361 PVPHAL_SURFACE pSrcSurface,
362 PVPHAL_SAMPLER_STATE_DNDI_PARAM pLumaParams,
363 PVPHAL_DNUV_PARAMS pChromaParams);
364
365 virtual VphalSfcState* CreateSfcState();
366 };
367
368 #endif // __VPHAL_RENDER_VEBOX_G9_BASE_H__