Debian Codegraph @

media_driver/media_interface/media_interfaces_pvc/media_interfaces_pvc.h

raw
1 /*===================== begin_copyright_notice ==================================
2
3 # Copyright (c) 2021, Intel Corporation
4
5 # Permission is hereby granted, free of charge, to any person obtaining a
6 # copy of this software and associated documentation files (the "Software"),
7 # to deal in the Software without restriction, including without limitation
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 # and/or sell copies of the Software, and to permit persons to whom the
10 # Software is furnished to do so, subject to the following conditions:
11
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 # OTHER DEALINGS IN THE SOFTWARE.
22
23 ======================= end_copyright_notice ==================================*/
24 //!
25 //! \file media_interfaces_pvc.h
26 //! \brief All interfaces used for pvc that require factory creation
27 //!
28
29 #ifndef __MEDIA_INTERFACES_PVC_H__
30 #define __MEDIA_INTERFACES_PVC_H__
31
32 #include "media_interfaces_mhw.h"
33 #include "media_interfaces_mhw_next.h"
34 #include "media_interfaces_codechal.h"
35 #include "media_interfaces_mmd.h"
36 #include "media_interfaces_mcpy.h"
37 #include "media_interfaces_cmhal.h"
38 #include "media_interfaces_vphal.h"
39 #include "media_interfaces_renderhal.h"
40 #include "media_interfaces_nv12top010.h"
41 #include "media_interfaces_decode_histogram.h"
42
43 #include "mhw_cp_interface.h"
44 #include "mhw_mi_xe_xpm_base.h"
45 #include "mhw_render_xe_hpc.h"
46 #include "mhw_render_xe_hpg.h"
47 #include "mhw_sfc_xe_xpm.h"
48 #include "mhw_state_heap_xe_xpm.h"
49 #include "mhw_vebox_xe_xpm.h"
50 #include "mhw_vdbox_mfx_xe_xpm.h"
51 #include "mhw_vdbox_avp_xe_xpm.h"
52 #include "mhw_vdbox_hcp_xe_xpm_plus.h"
53 #include "mhw_vdbox_huc_xe_xpm_plus.h"
54 #include "mhw_vdbox_avp_g12_X.h"
55 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM
56 #include "mhw_vdbox_vdenc_xe_xpm_plus.h"
57 #include "mhw_vdbox_vdenc_xe_xpm_plus_ext.h"
58 #else
59 #include "mhw_vdbox_vdenc_g12_X.h"
60 #endif
61 #include "renderhal_memdecomp.h"
62 #include "mhw_blt_xe_hpc.h"
63 #include "vphal_xe_xpm_plus.h"
64 #include "media_copy_xe_xpm_plus.h"
65 #include "codechal_hw_xe_xpm_plus.h"
66
67 #ifdef _AVC_DECODE_SUPPORTED
68 #include "decode_avc_pipeline_adapter_m12.h"
69 #endif
70
71 #ifdef _HEVC_DECODE_SUPPORTED
72 #include "decode_hevc_pipeline_adapter_m12.h"
73 #endif
74
75 #ifdef _JPEG_DECODE_SUPPORTED
76 #include "decode_jpeg_pipeline_adapter_m12.h"
77 #endif
78
79 #ifdef _MPEG2_DECODE_SUPPORTED
80 #include "decode_mpeg2_pipeline_adapter_m12.h"
81 #endif
82
83 #ifdef _VC1_DECODE_SUPPORTED
84 #include "codechal_decode_vc1_xe_xpm.h"
85 #endif
86
87 #ifdef _VP8_DECODE_SUPPORTED
88 #include "codechal_decode_vp8_g12.h"
89 #endif
90
91 #ifdef _VP9_DECODE_SUPPORTED
92 #include "decode_vp9_pipeline_adapter_m12.h"
93 #endif
94
95 #ifdef _AV1_DECODE_SUPPORTED
96 #include "decode_av1_pipeline_adapter_g12.h"
97 #endif
98
99 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM
100 #ifdef _JPEG_ENCODE_SUPPORTED
101 #include "codechal_encode_jpeg_g12.h"
102 #endif
103
104 #include "codechal_encode_csc_ds_xe_xpm.h"
105 #include "codechal_encode_csc_ds_mdf_xe_xpm.h"
106
107 #ifdef _HEVC_ENCODE_VME_SUPPORTED
108 #include "codechal_encode_hevc_g12.h"
109 #include "codechal_encode_hevc_mbenc_xe_xpm.h"
110 #include "codechal_encode_csc_ds_mdf_g12.h"
111 #endif
112 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED
113 #include "codechal_vdenc_hevc_xe_xpm.h"
114 #ifdef _MEDIA_RESERVED
115 #include "encode_hevc_vdenc_pipeline_adapter_xe_xpm_plus.h"
116 #endif
117 #endif
118
119 #ifdef _AVC_ENCODE_VDENC_SUPPORTED
120 #include "codechal_vdenc_avc_xe_xpm_plus.h"
121 #endif
122
123
124 #ifdef _VP9_ENCODE_VDENC_SUPPORTED
125 #include "codechal_vdenc_vp9_g12.h"
126 #include "codechal_vdenc_vp9_xe_hpm.h"
127 #endif
128
129 #include "codechal_encoder_unsupported.h"
130 #endif
131 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM
132 #include "cm_hal_xe_xpm.h"
133 #endif
134 #include "vphal_xe_xpm.h"
135 #include "renderhal_xe_hpc.h"
136
137 #include "codechal_decode_histogram.h"
138 #include "decode_scalability_singlepipe.h"
139 #include "decode_scalability_multipipe.h"
140
141 class MhwInterfacesPvc : public MhwInterfaces
142 {
143 public:
144 using Mi = MhwMiInterfaceXe_Xpm_Base;
145 using Cp = MhwCpInterface;
146 using Render = MhwRenderInterfaceXe_Hpc;
147 using Sfc = MhwSfcInterfaceXe_Xpm;
148 using StateHeap = MHW_STATE_HEAP_INTERFACE_XE_XPM;
149 using Mfx = MhwVdboxMfxInterfaceXe_Xpm;
150 using Hcp = MhwVdboxHcpInterfaceXe_Xpm_PLUS;
151 using Avp = MhwVdboxAvpInterfaceXe_Xpm;
152 using Huc = MhwVdboxHucInterfaceXe_Xpm_Plus;
153 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM
154 using Vdenc = MhwVdboxVdencInterfaceG12ExtPvc;
155 #else
156 using Vdenc = MhwVdboxVdencInterfaceG12X;
157 #endif
158 using Vebox = MhwVeboxInterfaceXe_Xpm;
159 using Blt = MhwBltInterfaceXe_Hpc;
160
161 MOS_STATUS Initialize(
162 CreateParams params,
163 PMOS_INTERFACE osInterface);
164
165 };
166
167 class MhwInterfacesPvc_Next : public MhwInterfacesNext
168 {
169 public:
170 using Mi = MhwMiInterfaceXe_Xpm_Base;
171 using Cp = MhwCpInterface;
172 using Render = MhwRenderInterfaceXe_Hpc;
173 using Sfc = MhwSfcInterfaceXe_Xpm;
174 using StateHeap = MHW_STATE_HEAP_INTERFACE_XE_XPM;
175 using Mfx = MhwVdboxMfxInterfaceXe_Xpm;
176 using Hcp = MhwVdboxHcpInterfaceXe_Xpm_PLUS;
177 using Huc = MhwVdboxHucInterfaceXe_Xpm_Plus;
178 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM
179 using Vdenc = MhwVdboxVdencInterfaceG12ExtPvc;
180 #else
181 using Vdenc = MhwVdboxVdencInterfaceG12X;
182 #endif
183 using Vebox = MhwVeboxInterfaceXe_Xpm;
184 using Blt = MhwBltInterfaceXe_Hpc;
185
186 MOS_STATUS Initialize(
187 CreateParams params,
188 PMOS_INTERFACE osInterface);
189
190 //!
191 //! \brief Destroys all created MHW interfaces
192 //! \details If the HAL creation fails, this is used for cleanup
193 //!
194 virtual void Destroy();
195
196 std::shared_ptr<MhwMiInterface> m_miInterface = nullptr;
197
198 MhwRenderInterface *m_renderInterface = nullptr;
199 };
200
201 class MmdDeviceXe_Xpm_Plus : public MmdDevice
202 {
203 public:
204 using Mmd = MediaRenderDecompState;
205 MOS_STATUS Initialize(
206 PMOS_INTERFACE osInterface,
207 MhwInterfaces *mhwInterfaces);
208
209 MhwInterfaces* CreateMhwInterface(
210 PMOS_INTERFACE osInterface);
211 };
212
213 class McpyDeviceXe_Xpm_Plus : public McpyDevice
214 {
215 public:
216 using Mcpy = MediaCopyStateXe_Xpm_Plus;
217 MOS_STATUS Initialize(
218 PMOS_INTERFACE osInterface);
219 protected:
220 MhwInterfaces* CreateMhwInterface(
221 PMOS_INTERFACE osInterface);
222 };
223
224 class Nv12ToP010DeviceXe_Xpm_Plus : public Nv12ToP010Device
225 {
226 public:
227
228 MOS_STATUS Initialize(
229 PMOS_INTERFACE osInterface);
230 };
231
232 class CodechalDecodeInterfacesXe_Xpm_Plus
233 {
234 public:
235 #ifdef _AVC_DECODE_SUPPORTED
236 using Avc = DecodeAvcPipelineAdapterM12;
237 #endif
238 #ifdef _HEVC_DECODE_SUPPORTED
239 using Hevc = DecodeHevcPipelineAdapterM12;
240 #endif
241 #ifdef _JPEG_DECODE_SUPPORTED
242 using Jpeg = DecodeJpegPipelineAdapterM12;
243 #endif
244 #ifdef _MPEG2_DECODE_SUPPORTED
245 using Mpeg2 = DecodeMpeg2PipelineAdapterM12;
246 #endif
247 #ifdef _VC1_DECODE_SUPPORTED
248 using Vc1 = CodechalDecodeVc1Xe_Xpm;
249 #endif
250 #ifdef _VP8_DECODE_SUPPORTED
251 using Vp8 = CodechalDecodeVp8G12;
252 #endif
253 #ifdef _VP9_DECODE_SUPPORTED
254 using Vp9 = DecodeVp9PipelineAdapterG12;
255 #endif
256 #ifdef _AV1_DECODE_SUPPORTED
257 using Av1 = DecodeAv1PipelineAdapterG12;
258 #endif
259 };
260
261 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM
262 class CodechalEncodeInterfacesXe_Xpm_Plus
263 {
264 public:
265 using CscDs = CodechalEncodeCscDsXe_Xpm;
266 using CscDsMdf = CodechalEncodeCscDsMdfXe_Xpm;
267 #ifdef _VP9_ENCODE_VDENC_SUPPORTED
268 using Vp9 = CodechalVdencVp9StateXe_Xpm;
269 #endif
270 #ifdef _JPEG_ENCODE_SUPPORTED
271 using Jpeg = CodechalEncodeJpegStateG12;
272 #endif
273 #ifdef _HEVC_ENCODE_VME_SUPPORTED
274 using HevcEnc = CodechalEncHevcStateG12;
275 using HevcMbenc = CodecHalHevcMbencXe_Xpm;
276 #endif
277 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED
278 using HevcVdenc = CodechalVdencHevcStateXe_Xpm;
279 #endif
280 #ifdef _AVC_ENCODE_VDENC_SUPPORTED
281 using AvcVdenc = CodechalVdencAvcStateXe_Xpm_Plus;
282 #endif
283 };
284 #endif
285
286 class CodechalInterfacesXe_Xpm_Plus : public CodechalDevice
287 {
288 public:
289 using Decode = CodechalDecodeInterfacesXe_Xpm_Plus;
290 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM
291 using Encode = CodechalEncodeInterfacesXe_Xpm_Plus;
292 #endif
293 using Hw = CodechalHwInterfaceXe_Xpm_Plus;
294
295 MOS_STATUS Initialize(
296 void *standardInfo,
297 void *settings,
298 MhwInterfaces *mhwInterfaces,
299 PMOS_INTERFACE osInterface) override;
300
301 private:
302 MOS_STATUS CreateCodecHalInterface(MhwInterfaces *mhwInterfaces,
303 CodechalHwInterface *&pHwInterface,
304 CodechalDebugInterface *&pDebugInterface,
305 PMOS_INTERFACE osInterface,
306 CODECHAL_FUNCTION CodecFunction,
307 bool disableScalability);
308
309 MOS_STATUS CreateCodecHalInterface(MhwInterfaces *mhwInterfaces,
310 MhwInterfacesNext *&pMhwInterfacesNext,
311 CodechalHwInterfaceNext *&pHwInterface,
312 CodechalDebugInterface *&pDebugInterface,
313 PMOS_INTERFACE osInterface,
314 CODECHAL_FUNCTION CodecFunction,
315 bool disableScalability);
316 };
317
318 #define PVC_L3_CONFIG_COUNT 6
319 // 4KB per Way for Pvc, two Way per section
320 static const L3ConfigRegisterValues PVC_L3_PLANES[PVC_L3_CONFIG_COUNT] =
321 { // Rest R/W RO UTC CB Sum (in KB)
322 {0x00000200, 0, 0, 0}, // 512 0 0 0 0 512
323 {0xC0000000, 0x40000000, 0, 0}, // 384 0 0 128 0 512
324 {0xF0000000, 0x00000080, 0, 0}, // 480 0 0 0 32 512
325 {0x80000000, 0x80000000, 0, 0}, // 256 0 0 256 0 512
326 {0x40000000, 0x00000080, 0, 0}, // 0 128 352 0 32 512
327 {0x80000000, 0x70000080, 0, 0}, // 256 0 0 224 32 512
328 };
329
330 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM
331 class CMHalInterfacesXe_Xpm_Plus : public CMHalDevice
332 {
333 protected:
334 using CMHal = CmHalXe_Xpm;
335 MOS_STATUS Initialize(
336 CM_HAL_STATE *pCmState);
337 };
338 #endif
339
340 class VphalInterfacesXe_Xpm_Plus : public VphalDevice
341 {
342 public:
343 using VphalState = VphalStateXe_Xpm_Plus;
344
345 MOS_STATUS Initialize(
346 PMOS_INTERFACE osInterface,
347 bool bInitVphalState,
348 MOS_STATUS *eStatus,
349 bool clearViewMode = false);
350 };
351
352 class RenderHalInterfacesXe_Hpc : public RenderHalDevice
353 {
354 protected:
355 using XRenderHal = XRenderHal_Interface_Xe_Hpc;
356 MOS_STATUS Initialize();
357 };
358
359 class DecodeHistogramDeviceXe_Xpm_Plus : public DecodeHistogramDevice
360 {
361 public:
362 using DecodeHistogramG12 = CodechalDecodeHistogram;
363
364 MOS_STATUS Initialize(
365 CodechalHwInterface *hwInterface,
366 PMOS_INTERFACE osInterface);
367 };
368
369 #endif // __MEDIA_INTERFACES_PVC_H__