Debian Codegraph @

media_driver/agnostic/gen11/hw/mhw_vebox_g11_X.h

raw
1 /*
2 * Copyright (c) 2015-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 mhw_vebox_g11_X.h
24 //! \brief Defines functions for constructing vebox commands on Gen11-based platforms
25
26 #ifndef __MHW_VEBOX_G11_X_H__
27 #define __MHW_VEBOX_G11_X_H__
28
29 #include "mhw_vebox_generic.h"
30 #include "mhw_vebox_hwcmd_g11_X.h"
31
32 #define MHW_VEBOX_TIMESTAMP_PER_TICK_IN_NS_G11 83.333f
33
34 #if (_DEBUG || _RELEASE_INTERNAL)
35 #define MHW_VEBOX_IS_VEBOX_SPECIFIED_IN_CONFIG(keyval, VDId, shift, mask, bUseVD) \
36 do\
37 {\
38 int32_t TmpVal = keyval;\
39 while (TmpVal != 0) \
40 {\
41 if (((TmpVal) & (mask)) == (VDId))\
42 {\
43 bUseVD = true;\
44 break;\
45 }\
46 TmpVal >>= (shift);\
47 };\
48 }while(0)
49 #endif
50
51 const MHW_VEBOX_SETTINGS g_Vebox_Settings_g11 =
52 {
53 MHW_MAX_VEBOX_STATES, //!< uiNumInstances
54 MHW_SYNC_SIZE, //!< uiSyncSize
55 MHW_PAGE_SIZE, //!< uiDndiStateSize
56 MHW_PAGE_SIZE, //!< uiIecpStateSize
57 MHW_PAGE_SIZE * 2, //!< uiGamutStateSize
58 MHW_PAGE_SIZE, //!< uiVertexTableSize
59 MHW_PAGE_SIZE, //!< uiCapturePipeStateSize
60 MHW_PAGE_SIZE * 2, //!< uiGammaCorrectionStateSize
61 0 //!< uiHdrStateSize
62 };
63
64 class MhwVeboxInterfaceG11 : public MhwVeboxInterfaceGeneric<mhw_vebox_g11_X>
65 {
66 public:
67 // Chroma parameters
68 typedef struct _MHW_VEBOX_CHROMA_PARAMS
69 {
70 uint32_t dwPixRangeThresholdChromaU[MHW_PIXRANGETHRES_NUM];
71 uint32_t dwPixRangeWeightChromaU[MHW_PIXRANGETHRES_NUM];
72 uint32_t dwPixRangeThresholdChromaV[MHW_PIXRANGETHRES_NUM];
73 uint32_t dwPixRangeWeightChromaV[MHW_PIXRANGETHRES_NUM];
74 uint32_t dwHotPixelThresholdChromaU;
75 uint32_t dwHotPixelCountChromaU;
76 uint32_t dwHotPixelThresholdChromaV;
77 uint32_t dwHotPixelCountChromaV;
78 }MHW_VEBOX_CHROMA_PARAMS;
79
80 MhwVeboxInterfaceG11(
81 PMOS_INTERFACE pInputInterface);
82
83 virtual ~MhwVeboxInterfaceG11() { MHW_FUNCTION_ENTER; }
84
85 MOS_STATUS VeboxAdjustBoundary(
86 PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,
87 uint32_t *pdwSurfaceWidth,
88 uint32_t *pdwSurfaceHeight,
89 bool bDIEnable);
90
91 MOS_STATUS AddVeboxState(
92 PMOS_COMMAND_BUFFER pCmdBuffer,
93 PMHW_VEBOX_STATE_CMD_PARAMS pVeboxStateCmdParams,
94 bool bUseCmBuffer);
95
96 virtual MOS_STATUS AddVeboxDiIecp(
97 PMOS_COMMAND_BUFFER pCmdBuffer,
98 PMHW_VEBOX_DI_IECP_CMD_PARAMS pVeboxDiIecpCmdParams);
99
100 MOS_STATUS AddVeboxDndiState(
101 PMHW_VEBOX_DNDI_PARAMS pVeboxDndiParams);
102
103 MOS_STATUS AddVeboxIecpState(
104 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams);
105
106 MOS_STATUS AddVeboxGamutState(
107 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams,
108 PMHW_VEBOX_GAMUT_PARAMS pVeboxGamutParams);
109
110 MOS_STATUS FindVeboxGpuNodeToUse(
111 PMHW_VEBOX_GPUNODE_LIMIT pGpuNodeLimit);
112
113 MOS_STATUS AddVeboxIecpAceState(
114 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams);
115
116 MOS_STATUS SetVeboxIecpStateSTE(
117 mhw_vebox_g11_X::VEBOX_STD_STE_STATE_CMD *pVeboxStdSteState,
118 PMHW_COLORPIPE_PARAMS pColorPipeParams)
119 {
120 MOS_STATUS eStatus = MOS_STATUS_SUCCESS;
121
122 MHW_FUNCTION_ENTER;
123
124 MHW_CHK_NULL(pVeboxStdSteState);
125 MHW_CHK_NULL(pColorPipeParams);
126
127 MhwVeboxInterfaceGeneric<mhw_vebox_g11_X>::SetVeboxIecpStateSTE(pVeboxStdSteState, pColorPipeParams);
128 // Enable Skin Score Output surface to be written by Vebox
129 pVeboxStdSteState->DW1.StdScoreOutput = pColorPipeParams->bEnableLACE && pColorPipeParams->LaceParams.bSTD;
130
131 finish:
132 return eStatus;
133 }
134
135 //!
136 //! \brief Add VEBOX Scalar States for Gen10+
137 //! \details Add vebox scalar states
138 //! \param [in] pVeboxScalarParams
139 //! Pointer to VEBOX Scalar State Params
140 //! \return MOS_STATUS
141 //!
142 MOS_STATUS AddVeboxScalarState(
143 PMHW_VEBOX_SCALAR_PARAMS pVeboxScalarParams);
144
145 //!
146 //! \brief Set which vebox can be used by HW
147 //! \details VPHAL set whehter the VEBOX can be use by HW
148 //! \param [in] inputVebox0;
149 //! set whether Vebox0 can be used by HW
150 //! \param [in] inputVebox01;
151 //! set whether vebox1 can be use by HW
152 //! \return MOS_STATUS
153 //! MOS_STATUS_SUCCESS if success, else fail reason
154 MOS_STATUS SetVeboxInUse(
155 bool inputVebox0,
156 bool inputVebox1);
157
158 //!
159 //! \brief Set which vebox can be used by DNDI
160 //! \details VPHAL set Chroma parameters can be use by DNDI
161 //! \param [in] chromaParams;
162 //! Chroma parameters which will be used by DNDI
163 //! \return MOS_STATUS
164 //! MOS_STATUS_SUCCESS if success, else fail reason
165 MOS_STATUS SetVeboxChromaParams(
166 MHW_VEBOX_CHROMA_PARAMS *chromaParams);
167
168 //! \brief get the status for vebox's Scalability.
169 //! \details VPHAL will check whether the veobx support Scalabiltiy.
170 //! \return bool
171 //! false or true
172 bool IsScalabilitySupported();
173
174 virtual MOS_STATUS AddVeboxSurfaceControlBits(
175 PMHW_VEBOX_SURFACE_CNTL_PARAMS pVeboxSurfCntlParams,
176 uint32_t *pSurfCtrlBits);
177
178 //!
179 //! \brief Create Gpu Context for Vebox
180 //! \details Create Gpu Context for Vebox
181 //! \param [in] pOsInterface
182 //! OS interface
183 //! \param [in] VeboxGpuContext
184 //! Vebox Gpu Context
185 //! \param [in] VeboxGpuNode
186 //! Vebox Gpu Node
187 //! \return MOS_STATUS
188 //! MOS_STATUS_SUCCESS if success, else fail reason
189 //!
190 MOS_STATUS CreateGpuContext(
191 PMOS_INTERFACE pOsInterface,
192 MOS_GPU_CONTEXT VeboxGpuContext,
193 MOS_GPU_NODE VeboxGpuNode);
194
195 virtual MOS_STATUS AdjustBoundary(
196 PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,
197 uint32_t *pdwSurfaceWidth,
198 uint32_t *pdwSurfaceHeight,
199 bool bDIEnable);
200
201 private:
202 uint32_t m_BT2020InvPixelValue[256];
203 uint32_t m_BT2020FwdPixelValue[256];
204 uint32_t m_BT2020InvGammaLUT[256];
205 uint32_t m_BT2020FwdGammaLUT[256];
206 bool m_vebox0InUse;
207 bool m_vebox1InUse;
208 bool m_veboxScalabilitySupported;
209
210 uint32_t m_veboxSplitRatio;
211 MHW_VEBOX_CHROMA_PARAMS m_chromaParams;
212
213 //!
214 //! \brief Set Vebox Iecp State Back-End CSC
215 //! \details Set Back-End CSC part of the VEBOX IECP States
216 //! \param [in] pVeboxIecpState
217 //! Pointer to VEBOX IECP States
218 //! \param [in] pVeboxIecpParams
219 //! Pointer to VEBOX IECP State Params
220 //! \param [in] bEnableFECSC
221 //! Flag to enable FECSC
222 //! \return void
223 //!
224 void SetVeboxIecpStateBecsc(
225 mhw_vebox_g11_X::VEBOX_IECP_STATE_CMD *pVeboxIecpState,
226 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams,
227 bool bEnableFECSC);
228 //!
229 //! \brief Manual mode H2S
230 //! \details Manual mode H2S
231 // Based on WW23'16 algorithm design.
232 //! \param [in] pVeboxIecpParams
233 //! Pointer to VEBOX IECP State Params
234 //! \param [in] pVeboxGamutParams
235 //! Pointer to VEBOX Gamut State Params
236 //! \return MOS_STATUS
237 //!
238 MOS_STATUS VeboxInterface_H2SManualMode(
239 PMHW_VEBOX_HEAP pVeboxHeapInput,
240 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams,
241 PMHW_VEBOX_GAMUT_PARAMS pVeboxGamutParams);
242
243 //!
244 //! \brief Back end CSC setting, BT2020 YUV Full/Limited to BT2020 RGB Full (G10 +)
245 //! \details Back end CSC setting, BT2020 YUV Full/Limited to BT2020 RGB Full
246 //! \param [in] pVeboxIecpParams
247 //! Pointer to VEBOX IECP State Params
248 //! \param [in] pVeboxGamutParams
249 //! Pointer to VEBOX Gamut State Params
250 //! \return MOS_STATUS
251 //!
252 MOS_STATUS VeboxInterface_BT2020YUVToRGB(
253 PMHW_VEBOX_HEAP pVeboxHeapInput,
254 PMHW_VEBOX_IECP_PARAMS pVeboxIecpParams,
255 PMHW_VEBOX_GAMUT_PARAMS pVeboxGamutParams);
256
257 //!
258 //! \brief init VEBOX IECP States
259 //! \details init Vebox IECP states STD/E, ACE, TCC, Gamut
260 //! \param [in] pVeboxIecpStateCmd
261 //! Pointer to Vebox Interface Structure
262 //! \return viod
263 //!
264 void IecpStateInitialization(
265 mhw_vebox_g11_X::VEBOX_IECP_STATE_CMD *pVeboxIecpState);
266
267 #if (_DEBUG || _RELEASE_INTERNAL)
268 MOS_STATUS ValidateVeboxScalabilityConfig();
269 #endif
270
271 void SetVeboxSurfaces(
272 PMHW_VEBOX_SURFACE_PARAMS pSurfaceParam,
273 PMHW_VEBOX_SURFACE_PARAMS pDerivedSurfaceParam,
274 PMHW_VEBOX_SURFACE_PARAMS pSkinScoreSurfaceParam,
275 mhw_vebox_g11_X::VEBOX_SURFACE_STATE_CMD *pVeboxSurfaceState,
276 bool bIsOutputSurface,
277 bool bDIEnable);
278 };
279
280 #endif