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_xehp_sdv.h
26 //! \brief    All interfaces used for XeHP that require factory creation
27 //!
28 
29 #ifndef __MEDIA_INTERFACES_XE_XPM_H__
30 #define __MEDIA_INTERFACES_XE_XPM_H__
31 
32 #include "media_interfaces_mhw.h"
33 #include "media_interfaces_codechal.h"
34 #include "media_interfaces_mmd.h"
35 #include "media_interfaces_mcpy.h"
36 #include "media_interfaces_cmhal.h"
37 #include "media_interfaces_vphal.h"
38 #include "media_interfaces_renderhal.h"
39 #include "media_interfaces_nv12top010.h"
40 #include "media_interfaces_decode_histogram.h"
41 #include "media_interfaces_hwinfo_device.h"
42 
43 #include "mhw_cp_interface.h"
44 #if IGFX_GEN12_SUPPORTED
45 #include "mhw_mi_g12_X.h"
46 #endif
47 #include "mhw_render_xe_hp.h"
48 #include "mhw_sfc_xe_xpm.h"
49 #include "mhw_state_heap_xe_xpm.h"
50 #include "mhw_vebox_xe_xpm.h"
51 #include "mhw_vdbox_mfx_xe_xpm.h"
52 #include "mhw_vdbox_hcp_xe_xpm.h"
53 #include "mhw_vdbox_avp_xe_xpm.h"
54 #include "mhw_vdbox_huc_g12_X.h"
55 #include "mhw_vdbox_avp_g12_X.h"
56 #ifdef IGFX_XEHP_SDV_ENABLE_NON_UPSTREAM
57 #include "mhw_vdbox_vdenc_xe_xpm.h"
58 #include "mhw_vdbox_vdenc_xe_xpm_ext.h"
59 #else
60 #include "mhw_vdbox_vdenc_g12_X.h"
61 #endif
62 #include "vphal_render_vebox_memdecomp_xe_xpm.h"
63 #include "media_copy_xe_xpm_base.h"
64 #include "mhw_blt_xe_hp_base.h"
65 
66 #include "codechal_hw_xe_xpm.h"
67 
68 #ifdef _AVC_DECODE_SUPPORTED
69 #include "decode_avc_pipeline_adapter_m12.h"
70 #endif
71 
72 #ifdef _HEVC_DECODE_SUPPORTED
73 #include "decode_hevc_pipeline_adapter_m12.h"
74 #endif
75 
76 #ifdef _JPEG_DECODE_SUPPORTED
77 #include "decode_jpeg_pipeline_adapter_m12.h"
78 #endif
79 
80 #ifdef _MPEG2_DECODE_SUPPORTED
81 #include "decode_mpeg2_pipeline_adapter_m12.h"
82 #endif
83 
84 #ifdef _VC1_DECODE_SUPPORTED
85 #include "codechal_decode_vc1_xe_xpm.h"
86 #endif
87 
88 #ifdef _VP8_DECODE_SUPPORTED
89 #include "codechal_decode_vp8_g12.h"
90 #endif
91 
92 #ifdef _VP9_DECODE_SUPPORTED
93 #include "decode_vp9_pipeline_adapter_m12.h"
94 #endif
95 
96 #ifdef _AV1_DECODE_SUPPORTED
97 #include "decode_av1_pipeline_adapter_g12.h"
98 #endif
99 
100 #ifdef IGFX_XEHP_SDV_ENABLE_NON_UPSTREAM
101 #ifdef _JPEG_ENCODE_SUPPORTED
102 #include "codechal_encode_jpeg_g12.h"
103 #endif
104 
105 #include "codechal_encode_csc_ds_mdf_xe_xpm.h"
106 
107 #ifdef _MPEG2_ENCODE_VME_SUPPORTED
108 #include "codechal_encode_mpeg2_g12.h"
109 #include "codechal_encode_mpeg2_mdf_xe_xpm.h"
110 #endif
111 
112 #ifdef _HEVC_ENCODE_VME_SUPPORTED
113 #include "codechal_encode_hevc_g12.h"
114 #include "codechal_encode_hevc_mbenc_xe_xpm.h"
115 #include "codechal_encode_csc_ds_mdf_g12.h"
116 #endif
117 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED
118 #include "codechal_vdenc_hevc_xe_xpm.h"
119 #ifdef _APOGEIOS_SUPPORTED
120 #include "decode_hevc_pipeline_adapter_m12.h"
121 #endif
122 #endif
123 
124 #ifdef _AVC_ENCODE_VME_SUPPORTED
125 #include "codechal_encode_avc_g12.h"
126 #include "codechal_encode_avc_mdf_xe_xpm.h"
127 #endif
128 #ifdef _AVC_ENCODE_VDENC_SUPPORTED
129 #include "codechal_vdenc_avc_xe_xpm.h"
130 #endif
131 
132 
133 #ifdef _VP9_ENCODE_VDENC_SUPPORTED
134 #include "codechal_vdenc_vp9_g12.h"
135 #include "codechal_vdenc_vp9_xe_hpm.h"
136 #ifdef _APOGEIOS_SUPPORTED
137 #include "encode_vp9_vdenc_pipeline_adapter_xe_xpm.h"
138 #endif
139 #endif
140 
141 
142 #ifdef IGFX_XEHP_SDV_ENABLE_NON_UPSTREAM
143 #include "cm_hal_xe_xpm.h"
144 #endif
145 #endif
146 #include "vphal_xe_xpm.h"
147 #include "renderhal_xe_hp.h"
148 
149 #include "codechal_decode_histogram.h"
150 #include "codechal_decode_histogram_g12.h"
151 
152 #include "decode_scalability_singlepipe.h"
153 #include "decode_scalability_multipipe.h"
154 class MhwInterfacesXehp_Sdv : public MhwInterfaces
155 {
156 public:
157     MhwVdboxAvpInterface *m_avpInterface = nullptr;
158 
159     using Mi        = MhwMiInterfaceG12;
160     using Cp        = MhwCpInterface;
161     using Render    = MhwRenderInterfaceXe_Hp;
162     using Sfc       = MhwSfcInterfaceXe_Xpm;
163     using StateHeap = MHW_STATE_HEAP_INTERFACE_XE_XPM;
164     using Mfx       = MhwVdboxMfxInterfaceXe_Xpm;
165     using Hcp       = MhwVdboxHcpInterfaceXe_Xpm;
166     using Avp       = MhwVdboxAvpInterfaceXe_Xpm;
167     using Huc       = MhwVdboxHucInterfaceG12;
168 #ifdef IGFX_XEHP_SDV_ENABLE_NON_UPSTREAM
169     using Vdenc     = MhwVdboxVdencInterfaceG12ExtXehp;
170 #else
171     using Vdenc     = MhwVdboxVdencInterfaceG12X;
172 #endif
173     using Vebox     = MhwVeboxInterfaceXe_Xpm;
174     using Blt       = MhwBltInterfaceXe_Hp_Base;
175 
176     virtual MOS_STATUS Initialize(
177         CreateParams params,
178         PMOS_INTERFACE osInterface);
179 
180 };
181 
182 class MmdDeviceXe_Xpm : public MmdDevice
183 {
184 public:
185     using Mmd  = MediaVeboxDecompStateXe_Xpm;
186 
187     MOS_STATUS Initialize(
188         PMOS_INTERFACE osInterface,
189         MhwInterfaces *mhwInterfaces);
190 
191     MhwInterfaces* CreateMhwInterface(
192         PMOS_INTERFACE osInterface);
193 };
194 
195 class McpyDeviceXe_Xpm : public McpyDevice
196 {
197 public:
198     using Mcpy  = MediaCopyStateXe_Xpm_Base;
199 
200     MOS_STATUS Initialize(
201         PMOS_INTERFACE osInterface,
202         MhwInterfaces *mhwInterfaces);
203 
204     MhwInterfaces* CreateMhwInterface(
205         PMOS_INTERFACE osInterface);
206 };
207 
208 class Nv12ToP010DeviceXe_Xpm : public Nv12ToP010Device
209 {
210 public:
211 
212     MOS_STATUS Initialize(
213         PMOS_INTERFACE osInterface);
214 };
215 
216 class CodechalDecodeInterfacesXe_Xpm
217 {
218 public:
219 #ifdef _AVC_DECODE_SUPPORTED
220     using Avc = DecodeAvcPipelineAdapterM12;
221 #endif
222 #ifdef _HEVC_DECODE_SUPPORTED
223     using Hevc = DecodeHevcPipelineAdapterM12;
224 #endif
225 #ifdef _JPEG_DECODE_SUPPORTED
226     using Jpeg = DecodeJpegPipelineAdapterM12;
227 #endif
228 #ifdef _MPEG2_DECODE_SUPPORTED
229     using Mpeg2 = DecodeMpeg2PipelineAdapterM12;
230 #endif
231 #ifdef _VC1_DECODE_SUPPORTED
232     using Vc1 = CodechalDecodeVc1Xe_Xpm;
233 #endif
234 #ifdef _VP8_DECODE_SUPPORTED
235     using Vp8 = CodechalDecodeVp8G12;
236 #endif
237 #ifdef _VP9_DECODE_SUPPORTED
238     using Vp9 = DecodeVp9PipelineAdapterG12;
239 #endif
240 #ifdef _AV1_DECODE_SUPPORTED
241     using Av1 = DecodeAv1PipelineAdapterG12;
242 #endif
243 };
244 
245 #ifdef IGFX_XEHP_SDV_ENABLE_NON_UPSTREAM
246 class CodechalEncodeInterfacesXe_Xpm
247 {
248 public:
249     using CscDs = CodechalEncodeCscDsMdfXe_Xpm;
250     using CscDsMdf = CodechalEncodeCscDsMdfXe_Xpm;
251 #ifdef _VP9_ENCODE_VDENC_SUPPORTED
252     using Vp9 = CodechalVdencVp9StateXe_Xpm;
253 #endif
254 #ifdef _JPEG_ENCODE_SUPPORTED
255     using Jpeg = CodechalEncodeJpegStateG12;
256 #endif
257 #ifdef _MPEG2_ENCODE_VME_SUPPORTED
258     using Mpeg2 = CodechalEncodeMpeg2EncMdfG12;
259 #endif
260 #ifdef _HEVC_ENCODE_VME_SUPPORTED
261     using HevcEnc = CodechalEncHevcStateG12;
262     using HevcMbenc = CodecHalHevcMbencXe_Xpm;
263 #endif
264 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED
265     using HevcVdenc = CodechalVdencHevcStateXe_Xpm;
266 #endif
267 #ifdef _AVC_ENCODE_VME_SUPPORTED
268     using AvcEnc = CodechalEncodeAvcEncMdfG12;
269 #endif
270 #ifdef _AVC_ENCODE_VDENC_SUPPORTED
271     using AvcVdenc = CodechalVdencAvcStateXe_Xpm;
272 #endif
273 };
274 #endif
275 class CodechalInterfacesXe_Xpm : public CodechalDevice
276 {
277 public:
278     using Decode = CodechalDecodeInterfacesXe_Xpm;
279 #ifdef IGFX_XEHP_SDV_ENABLE_NON_UPSTREAM
280     using Encode = CodechalEncodeInterfacesXe_Xpm;
281 #endif
282     using Hw = CodechalHwInterfaceXe_Xpm;
283 
284     MOS_STATUS Initialize(
285         void *standardInfo,
286         void *settings,
287         MhwInterfaces *mhwInterfaces,
288         PMOS_INTERFACE osInterface) override;
289 };
290 
291 #ifdef IGFX_XEHP_SDV_ENABLE_NON_UPSTREAM
292 class CMHalInterfacesXe_Xpm : public CMHalDevice
293 {
294 protected:
295     using CMHal = CmHalXe_Xpm;
296     MOS_STATUS Initialize(
297         CM_HAL_STATE *pCmState);
298 };
299 #endif
300 
301 class VphalInterfacesXe_Xpm : public VphalDevice
302 {
303 public:
304     using VphalState = VphalStateXe_Xpm;
305 
306     MOS_STATUS Initialize(
307         PMOS_INTERFACE  osInterface,
308         bool            bInitVphalState,
309         MOS_STATUS      *eStatus,
310         bool            clearViewMode = false);
311 
312     MOS_STATUS CreateVpPlatformInterface(
313         PMOS_INTERFACE           osInterface,
314         MOS_STATUS *             eStatus);
315 };
316 
317 class RenderHalInterfacesXe_Xpm : public RenderHalDevice
318 {
319 protected:
320     using XRenderHal = XRenderHal_Interface_Xe_Hp;
321     MOS_STATUS Initialize();
322 };
323 
324 class DecodeHistogramDeviceXe_Xpm : public DecodeHistogramDevice
325 {
326 public:
327     using DecodeHistogramG12 = CodechalDecodeHistogramG12;
328 
329     MOS_STATUS Initialize(
330         CodechalHwInterface *hwInterface,
331         PMOS_INTERFACE osInterface);
332 };
333 
334 class MediaInterfacesHwInfoDeviceXe_Xpm : public MediaInterfacesHwInfoDevice
335 {
336 public:
337     virtual MOS_STATUS Initialize(PLATFORM platform) override;
338 };
339 
340 
341 #endif // __MEDIA_INTERFACES_XE_XPM_H__
342