Debian Codegraph @

media_driver/agnostic/gen8/vp/hal/vphal_render_vebox_g8_base.h

raw
1 /*
2 * Copyright (c) 2011-2018, 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_g8_base.h
24 //! \brief Interface and structure specific for BDW (GEN8) Vebox
25 //! \details Interface and structure specific for BDW (GEN8) Vebox
26 //!
27 #ifndef __VPHAL_RENDER_VEBOX_G8_BASE_H__
28 #define __VPHAL_RENDER_VEBOX_G8_BASE_H__
29
30 #include "vphal_render_vebox_base.h"
31
32 //!
33 //! \brief Vebox Statistics Surface definition
34 //!
35 #define VPHAL_VEBOX_STATISTICS_SIZE_G8 (288 * 4) // in DWORDs, twice per frame for 2 slices
36 #define VPHAL_VEBOX_STATISTICS_PER_FRAME_SIZE_G8 (288 * sizeof(uint32_t))
37 #define VPHAL_VEBOX_STATISTICS_SURFACE_FMD_OFFSET_G8 0x400
38 #define VPHAL_VEBOX_STATISTICS_SURFACE_GNE_OFFSET_G8 0x42C
39 #define VPHAL_VEBOX_STATISTICS_SURFACE_STD_OFFSET_G8 0x444
40
41 #define NOISE_ABSSUMTEMPORALDIFF_THRESHOLD_DEFAULT 32
42 #define NOISE_SPATIALCOMPLEXITYMATRIX_THRESHOLD_DEFAULT 32
43
44 struct VEBOX_STATE_UPDATE_STATIC_DATA_G8
45 {
46 // DWORD 0 - GRF R1.0
47 union
48 {
49 // DN State Update
50 struct
51 {
52 uint32_t OffsetToSlice0;
53 };
54
55 uint32_t Value;
56 } DW00;
57
58 // DWORD 1 - GRF R1.1
59 union
60 {
61 // DN State Update
62 struct
63 {
64 uint32_t OffsetToSlice1;
65 };
66
67 uint32_t Value;
68 } DW01;
69
70 // DWORD 2 - GRF R1.2
71 union
72 {
73 // DN State Update
74 struct
75 {
76 uint32_t FirstFrameFlag : 16;
77 uint32_t NoiseLevel : 16;
78 };
79
80 uint32_t Value;
81 } DW02;
82
83 // DWORD 3 - GRF R1.3
84 union
85 {
86 // Vebox Statistics Surface
87 struct
88 {
89 uint32_t VeboxStatisticsSurface;
90 };
91
92 uint32_t Value;
93 } DW03;
94
95 // DWORD 4 - GRF R1.4
96 union
97 {
98 // Vebox DnDi State Surface
99 struct
100 {
101 uint32_t VeboxDndiStateSurface;
102 };
103
104 uint32_t Value;
105 } DW04;
106
107 // DWORD 5 - GRF R1.5
108 union
109 {
110 // Vebox GNE surface
111 struct
112 {
113 uint32_t VeboxTempSurface;
114 };
115
116 uint32_t Value;
117 } DW05;
118 uint32_t dwPad[2];
119 };
120
121 typedef class VPHAL_VEBOX_STATE_G8_BASE *PVPHAL_VEBOX_STATE_G8_BASE;
122 class VPHAL_VEBOX_STATE_G8_BASE :virtual public VPHAL_VEBOX_STATE
123 {
124 public:
125 VPHAL_VEBOX_STATE_G8_BASE(
126 PMOS_INTERFACE pOsInterface,
127 PMHW_VEBOX_INTERFACE pVeboxInterface,
128 PRENDERHAL_INTERFACE pRenderHal,
129 PVPHAL_VEBOX_EXEC_STATE pVeboxExecState,
130 PVPHAL_RNDR_PERF_DATA pPerfData,
131 const VPHAL_DNDI_CACHE_CNTL &dndiCacheCntl,
132 MOS_STATUS *peStatus);
133
134 virtual ~VPHAL_VEBOX_STATE_G8_BASE() { }
135
136 virtual MOS_STATUS AllocateResources();
137
138 virtual void FreeResources();
139
140 virtual MOS_STATUS SetupVeboxKernel(
141 int32_t iKDTIndex);
142
143 virtual MOS_STATUS SetupDiIecpState(
144 bool bDiScdEnable,
145 PMHW_VEBOX_DI_IECP_CMD_PARAMS
146 pVeboxDiIecpCmdParams);
147
148 virtual void SetupSurfaceStates(
149 bool bDiVarianceEnable,
150 PVPHAL_VEBOX_SURFACE_STATE_CMD_PARAMS
151 pVeboxSurfaceStateCmdParams);
152
153 virtual MOS_STATUS SetupVeboxState(
154 bool bDiVarianceEnable,
155 PMHW_VEBOX_STATE_CMD_PARAMS pVeboxStateCmdParams);
156
157 virtual bool IsNeeded(
158 PCVPHAL_RENDER_PARAMS pcRenderParams,
159 RenderpassData *pRenderPassData);
160
161 #if VEBOX_AUTO_DENOISE_SUPPORTED
162 virtual MOS_STATUS LoadUpdateDenoiseKernelStaticData(
163 int32_t* iCurbeOffsetOutDN);
164
165 virtual MOS_STATUS SetupSurfaceStatesForDenoise();
166 #endif
167
168 virtual bool IsFormatSupported(
169 PVPHAL_SURFACE pSrcSurface);
170
171 virtual bool IsRTFormatSupported(
172 PVPHAL_SURFACE pSrcSurface,
173 PVPHAL_SURFACE pRTSurface);
174
175 virtual bool IsDnFormatSupported(
176 PVPHAL_SURFACE pSrcSurface);
177
178 virtual bool IsDiFormatSupported(
179 PVPHAL_SURFACE pSrcSurface);
180
181 virtual VPHAL_OUTPUT_PIPE_MODE GetOutputPipe(
182 PCVPHAL_RENDER_PARAMS pcRenderParams,
183 PVPHAL_SURFACE pSrcSurface,
184 bool* pbCompNeeded);
185
186 virtual bool UseKernelResource();
187
188 virtual void VeboxGetBeCSCMatrix(
189 PVPHAL_SURFACE pSrcSurface,
190 PVPHAL_SURFACE pOutSurface);
191
192 protected:
193 //!
194 //! \brief Setup Vebox_DI_IECP Command params for VEBOX final output surface on G75
195 //! \details Setup Vebox_DI_IECP Command params for VEBOX final output surface on G75
196 //! \param bDiScdEnable
197 //! [in] Is DI/Variances report enabled
198 //! \param pVeboxDiIecpCmdParams
199 //! [in/out] Pointer to VEBOX_DI_IECP command parameters
200 //! \return MOS_STATUS
201 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
202 //!
203 virtual MOS_STATUS SetupDiIecpStateForOutputSurf(
204 bool bDiScdEnable,
205 PMHW_VEBOX_DI_IECP_CMD_PARAMS pVeboxDiIecpCmdParams);
206
207 //!
208 //! \brief Get related surf parameters needed when allocate FFDI surface
209 //! \details Get related surf parameters needed when allocate FFDI surface
210 //! \param Format
211 //! [out] Format of FFDI surface
212 //! \param TileType
213 //! [out] Tile type of FFDI surface
214 //! \param ColorSpace
215 //! [out] Color space of FFDI surface
216 //! \param SampleType
217 //! [out] Sample type of FFDI surface
218 //! \return MOS_STATUS
219 //! Return MOS_STATUS_SUCCESS if success, otherwise failed
220 //!
221 virtual MOS_STATUS GetFFDISurfParams(
222 MOS_FORMAT &Format,
223 MOS_TILE_TYPE &TileType,
224 VPHAL_CSPACE &ColorSpace,
225 VPHAL_SAMPLE_TYPE &SampleType);
226
227 //!
228 //! \brief Check whether FFDI Surf is needed
229 //! \details For decide whether FFDI surf should be allocated or will be used
230 //! \return bool
231 //! Return true is needed, otherwise false
232 //!
233 virtual bool IsFFDISurfNeeded();
234
235 //!
236 //! \brief Check whether FFDN Surf is needed
237 //! \details For decide whether FFDN surf should be allocated or will be used
238 //! \return bool
239 //! Return true is needed, otherwise false
240 //!
241 virtual bool IsFFDNSurfNeeded();
242
243 //!
244 //! \brief Check whether STMM Surf is needed
245 //! \details For decide whether STMM surf should be allocated or will be used
246 //! \return bool
247 //! Return true is needed, otherwise false
248 //!
249 virtual bool IsSTMMSurfNeeded();
250
251 virtual MOS_STATUS VeboxQueryStatLayout(
252 VEBOX_STAT_QUERY_TYPE QueryType,
253 uint32_t* pQuery);
254
255 virtual void GetLumaDefaultValue(
256 PVPHAL_SAMPLER_STATE_DNDI_PARAM pLumaParams);
257
258 virtual MOS_STATUS SetDNDIParams(
259 PVPHAL_SURFACE pSrcSurface,
260 PVPHAL_SAMPLER_STATE_DNDI_PARAM pLumaParams,
261 PVPHAL_DNUV_PARAMS pChromaParams);
262
263 virtual VphalSfcState* CreateSfcState() { return nullptr; }
264
265 virtual bool IsDNOnly();
266 };
267
268 #endif // __VPHAL_RENDER_VEBOX_G8_BASE_H__