Debian Codegraph @

media_driver/agnostic/common/vp/hal/vphal_render_fast1ton.h

raw
1 /*
2 * Copyright (c) 2018-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 //! \file vphal_render_fast1ton.h
24 //! \brief Common interface and structure used in multi scaling output
25 //! \details This module contains video surface multi scaling output definitions for VPHAL
26 //!
27
28 #ifndef __VPHAL_RENDER_FAST1TON_H__
29 #define __VPHAL_RENDER_FAST1TON_H__
30
31 #include "mos_os.h"
32 #include "renderhal_legacy.h"
33 #include "vphal_render_common.h"
34
35 #define MAX_1TON_SUPPORT 3 // currently the multi output number max support 3
36
37 // Static Data for Gen9 fast1ton kernel
38 typedef struct _MEDIA_WALKER_FAST1TON_STATIC_DATA
39 {
40 // DWORD 0 - GRF R1.0
41 union
42 {
43 uint32_t Sampler_Index0; // avs sampler
44 } DW0;
45
46 // DWORD 1 - GRF R1.1
47 union
48 {
49 uint32_t Sampler_Index1; // avs sampler
50 } DW1;
51
52 // DWORD 2 - GRF R1.2
53 union
54 {
55 uint32_t Sampler_Index2; // avs sampler
56 } DW2;
57
58 // DWORD 3 - GRF R1.3
59 union
60 {
61 uint32_t Src_Index; // Input - NV12( Planar_420_8)
62 } DW3;
63
64 // DWORD 4 - GRF R1.4
65 union
66 {
67 uint32_t Dst_Y_Index0; // Output surface 0 NV12 Y channel w/o 16 aligned
68 uint32_t Dst_Index0; // Output surface 0 w/ 16 aligned
69 } DW4;
70
71 // DWORD 5 - GRF R1.5
72 union
73 {
74 uint32_t Dst_UV_Index0; // Output surface 0 NV12 UV channel w/o 16 aligned
75 } DW5;
76
77 // DWORD 6 - GRF R1.6
78 union
79 {
80 uint32_t Dst_Y_Index1; // Output surface 1 NV12 Y channel w/o 16 aligned
81 uint32_t Dst_Index1; // Output surface 1 w/ 16 aligned
82 } DW6;
83
84 // DWORD 7 - GRF R1.7
85 union
86 {
87 uint32_t Dst_UV_Index1; // Output surface 1 NV12 UV channel w/o 16 aligned
88 } DW7;
89
90 // DWORD 8 - GRF R2.0
91 union
92 {
93 uint32_t Dst_Y_Index2; // Output surface 2 NV12 Y channel w/o 16 aligned
94 uint32_t Dst_Index2; // Output surface 2 w/ 16 aligned
95 } DW8;
96
97 // DWORD 9 - GRF R2.0
98 union
99 {
100 uint32_t Dst_UV_Index2; // Output surface 2 NV12 UV channel w/o 16 aligned
101 } DW9;
102
103 // DWORD 10 - GRF R2.0
104 union
105 {
106 struct {
107 uint32_t Dst_16Aligned : 16; // 1 Enable 0 Disable (Bit 0 -2 are available, bit 0 maps to Output0, bit 1 maps to output1, and bit 2 maps to output2.)
108 uint32_t Dst_pitch0 : 16; // pitch of Output surface 0, Only available when 16 alignment is set
109 };
110 } DW10;
111
112 // DWORD 11 - GRF R2.0
113 union
114 {
115 struct {
116 uint32_t Dst_pitch1 : 16; // pitch of Output surface 1, Only available when 16 alignment is set
117 uint32_t Dst_pitch2 : 16; // pitch of Output surface 2, Only available when 16 alignment is set
118 };
119 } DW11;
120
121 // DWORD 12 - GRF R2.0
122 union
123 {
124 struct {
125 uint32_t Dst_UVOffset0 : 16; // UV Offset (Lines) of output surface 0 comparing to Y (Map to 2D).
126 uint32_t Dst_UVOffset1 : 16; // UV Offset (Lines) of output surface 1 comparing to Y (Map to 2D).
127 };
128 } DW12;
129
130 // DWORD 13 - GRF R2.0
131 union
132 {
133 struct {
134 uint32_t Dst_UVOffset2 : 16; // UV Offset (Lines) of output surface 2 comparing to Y (Map to 2D).
135 uint32_t Reversed : 16;
136 };
137 } DW13;
138
139 // DWORD 14 - GRF R2.0
140 union
141 {
142 float ScalingStep_H0; // Horizontal Scale Step for Output 0.
143 } DW14;
144
145 // DWORD 15 - GRF R2.0
146 union
147 {
148 float ScalingStep_V0; // Vertical Scale Step for Output 0.
149 } DW15;
150
151 // DWORD 16 - GRF R2.0
152 union
153 {
154 float ScalingStep_H1; // Horizontal Scale Step for Output 1.
155 } DW16;
156
157 // DWORD 17 - GRF R2.0
158 union
159 {
160 float ScalingStep_V1; // Vertical Scale Step for Output 1.
161 } DW17;
162
163 // DWORD 18 - GRF R2.0
164 union
165 {
166 float ScalingStep_H2; // Horizontal Scale Step for Output 2.
167 } DW18;
168
169 // DWORD 19 - GRF R2.0
170 union
171 {
172 float ScalingStep_V2; // Vertical Scale Step for Output 2.
173 } DW19;
174
175 // DWORD 20 - GRF R2.0
176 union
177 {
178 uint32_t Dst_OriginalX0; // Original X shift for surface 0
179 } DW20;
180
181 // DWORD 21 - GRF R2.0
182 union
183 {
184 uint32_t Dst_OriginalY0; // Original Y shift for surface 0
185 } DW21;
186
187 // DWORD 22 - GRF R2.0
188 union
189 {
190 uint32_t Dst_OriginalX1; // Original X shift for surface 1
191 } DW22;
192
193 // DWORD 23 - GRF R2.0
194 union
195 {
196 uint32_t Dst_OriginalY1; // Original Y shift for surface 1
197 } DW23;
198
199 // DWORD 24 - GRF R2.0
200 union
201 {
202 uint32_t Dst_OriginalX2; // Original X shift for surface 2
203 } DW24;
204
205 // DWORD 25 - GRF R2.0
206 union
207 {
208 uint32_t Dst_OriginalY2; // Original Y shift for surface 2
209 } DW25;
210 }MEDIA_WALKER_FAST1TON_STATIC_DATA, * PMEDIA_WALKER_FAST1TON_STATIC_DATA;
211
212 //!
213 //! \brief VPHAL fast 1toN render data
214 //!
215 typedef struct _VPHAL_FAST1TON_RENDER_DATA
216 {
217 int32_t iBlocksX;
218 int32_t iBlocksY;
219 int32_t iBindingTable;
220 int32_t iMediaID;
221 PRENDERHAL_MEDIA_STATE pMediaState;
222 float ScalingStep_H[MAX_1TON_SUPPORT];
223 float ScalingStep_V[MAX_1TON_SUPPORT];
224 float ScalingRatio_H[MAX_1TON_SUPPORT];
225 float ScalingRatio_V[MAX_1TON_SUPPORT];
226 // Kernel Information
227 PRENDERHAL_KERNEL_PARAM pKernelParam;
228 Kdll_CacheEntry KernelEntry;
229 int32_t iCurbeLength;
230 int32_t iInlineLength;
231
232 MHW_SAMPLER_STATE_PARAM SamplerStateParams[MAX_1TON_SUPPORT]; //!< Sampler State
233 PMHW_AVS_PARAMS pAVSParameters[MAX_1TON_SUPPORT]; //!< AVS parameters
234 MHW_SAMPLER_AVS_TABLE_PARAM mhwSamplerAvsTableParam[MAX_1TON_SUPPORT]; //!< params for AVS scaling 8x8 table
235
236 // Perf
237 VPHAL_PERFTAG PerfTag;
238
239 // Debug parameters
240 // Kernel Used for current rendering
241 char* pKernelName;
242 } VPHAL_FAST1TON_RENDER_DATA, *PVPHAL_FAST1TON_RENDER_DATA;
243
244 //!
245 //! \brief VPHAL fast 1toN render state
246 //!
247 typedef struct _VPHAL_FAST1TON_STATE *PVPHAL_FAST1TON_STATE;
248 typedef struct _VPHAL_FAST1TON_STATE
249 {
250 // External components and tables
251 PMOS_INTERFACE pOsInterface;
252 PRENDERHAL_INTERFACE pRenderHal;
253 Kdll_State *pKernelDllState;
254 MEDIA_FEATURE_TABLE *pSkuTable;
255 MEDIA_WA_TABLE *pWaTable;
256 bool bFtrMediaWalker;
257 MHW_AVS_PARAMS AVSParameters[MAX_1TON_SUPPORT]; //!< AVS for configure Sampler
258 MHW_SAMPLER_AVS_TABLE_PARAM mhwSamplerAvsTableParam[MAX_1TON_SUPPORT];
259 // Input and output surfaces
260 PVPHAL_SURFACE pSource;
261 PVPHAL_SURFACE pTarget[MAX_1TON_SUPPORT];
262 RENDERHAL_SURFACE RenderHalSource; // source for mhw
263 RENDERHAL_SURFACE RenderHalTarget[MAX_1TON_SUPPORT]; // target for mhw
264 uint32_t uDstCount;
265 bool Aligned16[MAX_1TON_SUPPORT];
266
267 // Internal parameters
268 // iBindingTableID: Binding table ID
269 // SurfMemObjCtl: Cache attributes for sampled surface and target surface
270 int32_t iBindingTableID;
271 VPHAL_FAST1TON_CACHE_CNTL SurfMemObjCtl;
272
273 // Platform dependent states
274 PRENDERHAL_KERNEL_PARAM pKernelParamTable;
275
276 // Null rendering flag for fast 1toN function
277 bool bNullHwRenderfast1toN;
278
279 // Feature reporting
280 VphalFeatureReport Reporting;
281
282 // Performance Related item
283 PVPHAL_RNDR_PERF_DATA pPerfData;
284
285 // Status table, Vide Pre-Processing Only
286 STATUS_TABLE_UPDATE_PARAMS StatusTableUpdateParams;
287
288 // Interface Functions
289 MOS_STATUS (* pfnInitialize) (
290 PVPHAL_FAST1TON_STATE pFast1toNState,
291 const VphalSettings *pSettings,
292 Kdll_State *pKernelDllState);
293
294 MOS_STATUS (* pfnDestroy) (
295 PVPHAL_FAST1TON_STATE pFast1toNState);
296
297 MOS_STATUS (* pfnRender) (
298 PVPHAL_FAST1TON_STATE pFast1toNState,
299 PVPHAL_RENDER_PARAMS pRenderParams);
300
301 MOS_STATUS (* pfnSetupSurfaceStates) (
302 PVPHAL_FAST1TON_STATE pFast1toNState,
303 PVPHAL_FAST1TON_RENDER_DATA pRenderData);
304
305 MOS_STATUS (* pfnLoadStaticData) (
306 PVPHAL_FAST1TON_STATE pFast1toNState,
307 PVPHAL_FAST1TON_RENDER_DATA pRenderData,
308 int32_t *piCurbeOffset);
309
310 MOS_STATUS (* pfnSetupKernel) (
311 PVPHAL_FAST1TON_STATE pFast1toNState,
312 PVPHAL_FAST1TON_RENDER_DATA pRenderData);
313
314 MOS_STATUS (* pfnSetSamplerStates) (
315 PVPHAL_FAST1TON_STATE pFast1toNState,
316 PVPHAL_FAST1TON_RENDER_DATA pRenderData);
317 } VPHAL_FAST1TON_STATE;
318
319
320 //!
321 //! \brief fast 1toN interface Initializations
322 //! \details Interface Initializations for 16Align
323 //! \param PVPHAL_16_ALIGN_STATE p16AlignState
324 //! [in] Pointer to the 16Align State
325 //! \param PRENDERHAL_INTERFACE pRenderHal
326 //! [in/out] Pointer to RenderHal Interface Structure
327 //! \return MOS_STATUS
328 //! Return MOS_STATUS_SUCCESS if successful, otherwise failed
329 //!
330 MOS_STATUS VpHal_Fast1toNInitInterface(
331 PVPHAL_FAST1TON_STATE pFast1toNState,
332 PRENDERHAL_INTERFACE pRenderHal);
333
334 //!
335 //! \brief check if intput/output is a fast 1toN case
336 //! \param [in] pRenderParams
337 //! Pointer to VPHAL render parameter
338 //! \param [in] pSrcSurface
339 //! Pointer to input surface.
340 //! \return ture if this case match fas 1toN condition, otherwise return fasle.
341 //!
342 bool VpHal_RndrIsFast1toNSupport(
343 PVPHAL_FAST1TON_STATE pFast1toNState,
344 PVPHAL_RENDER_PARAMS pRenderParams,
345 PVPHAL_SURFACE pSrcSurface);
346 #endif // __VPHAL_RENDER_FAST1TON_H__
347
348