1 /*
2 * Copyright (c) 2017-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     media_interfaces_g12_tgllp.h
24 //! \brief    All interfaces used for TGLLP that require factory creation
25 //!
26 
27 #ifndef __MEDIA_INTERFACES_G12_TGLLP_H__
28 #define __MEDIA_INTERFACES_G12_TGLLP_H__
29 
30 #include "media_interfaces_mhw.h"
31 #include "media_interfaces_codechal.h"
32 #include "media_interfaces_mmd.h"
33 #include "media_interfaces_mcpy.h"
34 #include "media_interfaces_cmhal.h"
35 #include "media_interfaces_vphal.h"
36 #include "media_interfaces_renderhal.h"
37 #include "media_interfaces_nv12top010.h"
38 #include "media_interfaces_decode_histogram.h"
39 #include "media_interfaces_hwinfo_device.h"
40 
41 #include "mhw_cp_interface.h"
42 #include "mhw_mi_g12_X.h"
43 #include "mhw_render_g12_X.h"
44 #include "mhw_sfc_g12_X.h"
45 #include "mhw_state_heap_g12.h"
46 #include "mhw_vebox_g12_X.h"
47 #include "mhw_vdbox_mfx_g12_X.h"
48 #include "mhw_vdbox_hcp_g12_X.h"
49 #include "mhw_vdbox_huc_g12_X.h"
50 #include "mhw_vdbox_vdenc_g12_X.h"
51 #include "mhw_blt_legacy.h"
52 #include "mhw_vdbox_avp_g12_X.h"
53 
54 #ifdef IGFX_VDENC_INTERFACE_EXT_SUPPORT
55 #include "mhw_vdbox_vdenc_g12_X_ext.h"
56 #endif
57 
58 #include "vphal_render_vebox_memdecomp_g12.h"
59 #include "media_copy_m12_0.h"
60 
61 #include "codechal_hw_g12_X.h"
62 #ifdef _AVC_DECODE_SUPPORTED
63 #include "codechal_decode_avc_g12.h"
64 #ifdef _APOGEIOS_SUPPORTED
65 #include "decode_avc_pipeline_adapter_m12.h"
66 #endif
67 #endif
68 #include "codechal_decode_downsampling_g12.h"
69 
70 #ifdef _HEVC_DECODE_SUPPORTED
71 #include "codechal_decode_hevc_g12.h"
72 #endif
73 
74 #ifdef _JPEG_DECODE_SUPPORTED
75 #include "codechal_decode_jpeg_g12.h"
76 #endif
77 
78 #ifdef _MPEG2_DECODE_SUPPORTED
79 #include "codechal_decode_mpeg2_g12.h"
80 #ifdef _APOGEIOS_SUPPORTED
81 #include "decode_mpeg2_pipeline_adapter_m12.h"
82 #endif
83 #endif
84 
85 #ifdef _VC1_DECODE_SUPPORTED
86 #include "codechal_decode_vc1_g12.h"
87 #endif
88 
89 #ifdef _VP8_DECODE_SUPPORTED
90 #include "codechal_decode_vp8_g12.h"
91 #endif
92 
93 #ifdef _VP9_DECODE_SUPPORTED
94 #include "codechal_decode_vp9_g12.h"
95 #endif
96 
97 #ifdef _JPEG_ENCODE_SUPPORTED
98 #include "codechal_encode_jpeg_g12.h"
99 #ifdef _APOGEIOS_SUPPORTED
100 #include "decode_jpeg_pipeline_adapter_m12.h"
101 #endif
102 #endif
103 
104 #ifdef _AV1_DECODE_SUPPORTED
105 #include "decode_av1_pipeline_adapter_g12.h"
106 #endif
107 
108 #include "codechal_encode_csc_ds_g12.h"
109 #include "codechal_encode_csc_ds_mdf_g12.h"
110 
111 #ifdef _VP9_ENCODE_VDENC_SUPPORTED
112 #include "codechal_vdenc_vp9_g12.h"
113 #ifdef _APOGEIOS_SUPPORTED
114 #include "encode_vp9_vdenc_pipeline_adapter_m12.h"
115 #endif
116 #endif
117 
118 #ifdef _MPEG2_ENCODE_VME_SUPPORTED
119 #include "codechal_encode_mpeg2_g12.h"
120 #endif
121 
122 #ifdef _HEVC_ENCODE_VME_SUPPORTED
123 #include "codechal_encode_hevc_g12.h"
124 #include "codechal_encode_hevc_mbenc_g12.h"
125 #endif
126 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED
127 #include "codechal_vdenc_hevc_g12.h"
128 #ifdef _APOGEIOS_SUPPORTED
129 #include "decode_hevc_pipeline_adapter_m12.h"
130 #include "decode_vp9_pipeline_adapter_m12.h"
131 #endif
132 #endif
133 
134 #ifdef _AVC_ENCODE_VME_SUPPORTED
135 #include "codechal_encode_avc_g12.h"
136 #endif
137 #ifdef _AVC_ENCODE_VDENC_SUPPORTED
138 #include "codechal_vdenc_avc_g12.h"
139 #endif
140 
141 #include "cm_hal_g12.h"
142 #include "vphal_g12_tgllp.h"
143 #include "renderhal_g12_0.h"
144 
145 #include "codechal_decode_histogram_g12.h"
146 #include "decode_scalability_singlepipe.h"
147 #include "decode_scalability_multipipe.h"
148 
149 #if LINUX
150 #include "vp_pipeline_adapter_g12.h"
151 #endif
152 
153 
154 class MhwInterfacesG12Tgllp : public MhwInterfaces
155 {
156 public:
157     MhwVdboxAvpInterface *m_avpInterface = nullptr;
158 
159     using Mi = MhwMiInterfaceG12;
160     using Cp = MhwCpInterface;
161     using Render = MhwRenderInterfaceG12;
162     using Sfc = MhwSfcInterfaceG12;
163     using StateHeap = MHW_STATE_HEAP_INTERFACE_G12_X; // to be updated when headers regenerated
164     using Mfx = MhwVdboxMfxInterfaceG12;
165     using Hcp = MhwVdboxHcpInterfaceG12;
166     using Huc = MhwVdboxHucInterfaceG12;
167     using Avp = MhwVdboxAvpInterfaceG12;
168 #ifdef IGFX_VDENC_INTERFACE_EXT_SUPPORT
169     using Vdenc = MhwVdboxVdencInterfaceG12ExtX;
170 #else
171     using Vdenc = MhwVdboxVdencInterfaceG12X;
172 #endif
173     using Vebox = MhwVeboxInterfaceG12;
174     using Blt     = MhwBltInterface;
175 
176     MOS_STATUS Initialize(
177         CreateParams params,
178         PMOS_INTERFACE osInterface);
179 
180     //!
181     //! \brief    Destroys all created MHW interfaces
182     //! \details  If the HAL creation fails, this is used for cleanup
183     //!
184     virtual void Destroy();
185 };
186 
187 class MmdDeviceG12Tgllp : public MmdDevice
188 {
189 public:
190     using Mmd  = MediaVeboxDecompStateG12;
191 
192     MOS_STATUS Initialize(
193         PMOS_INTERFACE osInterface,
194         MhwInterfaces *mhwInterfaces);
195 
196     MhwInterfaces* CreateMhwInterface(
197         PMOS_INTERFACE osInterface);
198 };
199 
200 class McpyDeviceG12Tgllp : public McpyDevice
201 {
202 public :
203     using Mcpy = MediaCopyStateM12_0;
204 
205     MOS_STATUS Initialize(
206     PMOS_INTERFACE osInterface,
207     MhwInterfaces *mhwInterfaces);
208 
209     MhwInterfaces* CreateMhwInterface(
210         PMOS_INTERFACE osInterface);
211 };
212 
213 class Nv12ToP010DeviceG12Tgllp : public Nv12ToP010Device
214 {
215 public:
216 
217     MOS_STATUS Initialize(
218         PMOS_INTERFACE osInterface);
219 };
220 
221 class CodechalDecodeInterfacesG12Tgllp
222 {
223 public:
224 #ifdef _AVC_DECODE_SUPPORTED
225     using Avc = CodechalDecodeAvcG12;
226 #endif
227 #ifdef _HEVC_DECODE_SUPPORTED
228     using Hevc = CodechalDecodeHevcG12;
229 #endif
230 #ifdef _JPEG_DECODE_SUPPORTED
231     using Jpeg = CodechalDecodeJpegG12;
232 #endif
233 #ifdef _MPEG2_DECODE_SUPPORTED
234     using Mpeg2 = CodechalDecodeMpeg2G12;
235 #endif
236 #ifdef _VC1_DECODE_SUPPORTED
237     using Vc1 = CodechalDecodeVc1G12;
238 #endif
239 #ifdef _VP8_DECODE_SUPPORTED
240     using Vp8 = CodechalDecodeVp8G12;
241 #endif
242 #ifdef _VP9_DECODE_SUPPORTED
243     using Vp9 = CodechalDecodeVp9G12;
244 #endif
245 #ifdef _AV1_DECODE_SUPPORTED
246     using Av1 = DecodeAv1PipelineAdapterG12;
247 #endif
248 #ifdef _DECODE_PROCESSING_SUPPORTED
249     using FieldScaling = FieldScalingInterfaceG12;
250 #endif
251 };
252 
253 class CodechalEncodeInterfacesG12Tgllp
254 {
255 public:
256     using CscDs = CodechalEncodeCscDsG12;
257     using CscDsMdf = CodechalEncodeCscDsMdfG12;
258 #ifdef _VP9_ENCODE_VDENC_SUPPORTED
259     using Vp9 = CodechalVdencVp9StateG12;
260 #endif
261 #ifdef _JPEG_ENCODE_SUPPORTED
262     using Jpeg = CodechalEncodeJpegStateG12;
263 #endif
264 #ifdef _MPEG2_ENCODE_VME_SUPPORTED
265     using Mpeg2 = CodechalEncodeMpeg2G12;
266 #endif
267 #ifdef _HEVC_ENCODE_VME_SUPPORTED
268     using HevcEnc = CodechalEncHevcStateG12;
269     using HevcMbenc = CodecHalHevcMbencG12;
270 #endif
271 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED
272     using HevcVdenc = CodechalVdencHevcStateG12;
273 #endif
274 #ifdef _AVC_ENCODE_VME_SUPPORTED
275     using AvcEnc = CodechalEncodeAvcEncG12;
276 #endif
277 #ifdef _AVC_ENCODE_VDENC_SUPPORTED
278     using AvcVdenc = CodechalVdencAvcStateG12;
279 #endif
280 };
281 
282 
283 class CodechalInterfacesG12Tgllp : public CodechalDevice
284 {
285 public:
286     using Decode = CodechalDecodeInterfacesG12Tgllp;
287     using Encode =  CodechalEncodeInterfacesG12Tgllp;
288     using Hw = CodechalHwInterfaceG12;
289 
290     MOS_STATUS Initialize(
291         void *standardInfo,
292         void *settings,
293         MhwInterfaces *mhwInterfaces,
294         PMOS_INTERFACE osInterface) override;
295 };
296 
297 class CMHalInterfacesG12Tgllp : public CMHalDevice
298 {
299 protected:
300     using CMHal = CM_HAL_G12_X;
301     MOS_STATUS Initialize(
302         CM_HAL_STATE *pCmState);
303 };
304 
305 class VphalInterfacesG12Tgllp : public VphalDevice
306 {
307 public:
308     using VphalState = VphalStateG12Tgllp;
309 
310     MOS_STATUS Initialize(
311         PMOS_INTERFACE  osInterface,
312         bool            bInitVphalState,
313         MOS_STATUS      *eStatus,
314         bool            clearViewMode = false);
315 
316     MOS_STATUS CreateVpPlatformInterface(
317         PMOS_INTERFACE osInterface,
318         MOS_STATUS *   eStatus);
319 };
320 
321 class RenderHalInterfacesG12Tgllp : public RenderHalDevice
322 {
323 protected:
324     using XRenderHal = XRenderHal_Interface_G12_0;
325     MOS_STATUS Initialize();
326 };
327 
328 class DecodeHistogramDeviceG12Tgllp : public DecodeHistogramDevice
329 {
330 public:
331     using DecodeHistogramG12 = CodechalDecodeHistogramG12;
332 
333     MOS_STATUS Initialize(
334         CodechalHwInterface *hwInterface,
335         PMOS_INTERFACE osInterface);
336 };
337 
338 class MediaInterfacesHwInfoDeviceG12Tgllp : public MediaInterfacesHwInfoDevice
339 {
340 public:
341     MOS_STATUS Initialize(PLATFORM platform);
342 };
343 
344 #endif // __MEDIA_INTERFACES_G12_TGLLP_H__
345