1 /*===================== begin_copyright_notice ==================================
2 
3 * Copyright (c) 2024, 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_bmg.h
26 //! \brief    All interfaces used for BMG that require factory creation
27 //!
28 
29 #ifndef __MEDIA_INTERFACES_XE2_HPM_H__
30 #define __MEDIA_INTERFACES_XE2_HPM_H__
31 
32 #include "media_interfaces_mhw_next.h"
33 #include "media_interfaces_codechal_next.h"
34 #include "media_interfaces_mcpy_next.h"
35 #include "media_interfaces_vphal.h"
36 #include "media_interfaces_renderhal.h"
37 #include "media_interfaces_hwinfo_device.h"
38 
39 #include "mhw_cp_interface.h"
40 #include "mhw_state_heap_xe2_hpg.h"
41 #include "mhw_vdbox_mfx_impl_xe2_hpm.h"
42 #include "mhw_vdbox_avp_impl_xe2_hpm.h"
43 #include "mhw_vdbox_huc_impl_xe2_hpm.h"
44 #include "mhw_vdbox_hcp_impl_xe2_hpm.h"
45 
46 #include "mhw_vdbox_vdenc_impl_xe2_hpm.h"
47 
48 #include "codec_hw_xe_lpm_plus_base.h"
49 
50 #ifdef _AVC_DECODE_SUPPORTED
51 #include "decode_avc_pipeline_adapter_xe2_hpm.h"
52 #endif
53 
54 #ifdef _HEVC_DECODE_SUPPORTED
55 #include "decode_hevc_pipeline_adapter_xe2_hpm.h"
56 #endif
57 
58 #ifdef _JPEG_DECODE_SUPPORTED
59 #include "decode_jpeg_pipeline_adapter_xe2_hpm.h"
60 #endif
61 
62 #ifdef _MPEG2_DECODE_SUPPORTED
63 #include "decode_mpeg2_pipeline_adapter_xe2_hpm.h"
64 #endif
65 
66 #ifdef _VP9_DECODE_SUPPORTED
67 #include "decode_vp9_pipeline_adapter_xe2_hpm.h"
68 #endif
69 
70 #ifdef _AV1_DECODE_SUPPORTED
71 #include "decode_av1_pipeline_adapter_xe2_hpm.h"
72 #endif
73 
74 #ifdef _VP8_DECODE_SUPPORTED
75 #include "decode_vp8_pipeline_adapter_xe2_hpm.h"
76 #endif
77 
78 #ifdef _JPEG_ENCODE_SUPPORTED
79 #include "encode_jpeg_pipeline_adapter.h"
80 #endif
81 
82 #ifdef _MEDIA_RESERVED
83 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED
84 #include "encode_hevc_vdenc_pipeline_adapter_xe2_hpm.h"
85 #endif
86 
87 #ifdef _AV1_ENCODE_VDENC_SUPPORTED
88 #include "encode_av1_vdenc_pipeline_adapter_xe2_hpm.h"
89 #endif
90 
91 #ifdef _AVC_ENCODE_VDENC_SUPPORTED
92 #include "encode_avc_vdenc_pipeline_adapter_xe2_hpm.h"
93 #endif
94 
95 
96 #ifdef _VP9_ENCODE_VDENC_SUPPORTED
97 #include "encode_vp9_vdenc_pipeline_adapter_xe2_hpm.h"
98 #endif
99 #endif
100 
101 #include "renderhal_xe2_hpg_next.h"
102 #include "decode_scalability_singlepipe_next.h"
103 #include "decode_scalability_multipipe_next.h"
104 
105 #include "media_copy_xe2_hpm_base.h"
106 
107 class MhwInterfacesBmg_Next : public MhwInterfacesNext
108 {
109 public:
110 
111     //TODO, Remove legacy mhw sub interfaces
112     using Cp        = MhwCpInterface;
113     using StateHeap = MHW_STATE_HEAP_INTERFACE_XE2_HPG;
114 
115     virtual MOS_STATUS Initialize(
116         CreateParams   params,
117         PMOS_INTERFACE osInterface);
118 
119     //!
120     //! \brief    Destroys all created MHW interfaces
121     //! \details  If the HAL creation fails, this is used for cleanup
122     //!
123     virtual void Destroy();
124 
125 MEDIA_CLASS_DEFINE_END(MhwInterfacesBmg_Next)
126 };
127 
128 class CodechalDecodeInterfacesXe2_Hpm
129 {
130 public:
131 #ifdef _AVC_DECODE_SUPPORTED
132     using Avc = DecodeAvcPipelineAdapterXe2_Hpm;
133 #endif
134 #ifdef _HEVC_DECODE_SUPPORTED
135     using Hevc = DecodeHevcPipelineAdapterXe2_Hpm;
136 #endif
137 #ifdef _JPEG_DECODE_SUPPORTED
138     using Jpeg = DecodeJpegPipelineAdapterXe2_Hpm;
139 #endif
140 #ifdef _MPEG2_DECODE_SUPPORTED
141     using Mpeg2 = DecodeMpeg2PipelineAdapterXe2_Hpm;
142 #endif
143 #ifdef _VP9_DECODE_SUPPORTED
144     using Vp9 = DecodeVp9PipelineAdapterXe2_Hpm;
145 #endif
146 #ifdef _AV1_DECODE_SUPPORTED
147     using Av1 = DecodeAv1PipelineAdapterXe2_Hpm;
148 #endif
149 #ifdef _VP8_DECODE_SUPPORTED
150     using Vp8 = DecodeVp8PipelineAdapterXe2_Hpm;
151 #endif
152     MEDIA_CLASS_DEFINE_END(CodechalDecodeInterfacesXe2_Hpm)
153 };
154 
155 class CodechalInterfacesXe2_Hpm : public CodechalDeviceNext
156 {
157 public:
158     using Decode = CodechalDecodeInterfacesXe2_Hpm;
159     using Hw     = CodechalHwInterfaceXe_Lpm_Plus_Base;
160 
161     MOS_STATUS Initialize(
162         void *         standardInfo,
163         void *         settings,
164         MhwInterfacesNext *mhwInterfaces,
165         PMOS_INTERFACE osInterface) override;
166 
167 MEDIA_CLASS_DEFINE_END(CodechalInterfacesXe2_Hpm)
168 };
169 
170 /*
171 #define DG2_L3_CONFIG_COUNT     6
172 // 4KB per Way for DG2, two Way per section
173 static const L3ConfigRegisterValues DG2_L3_PLANES[DG2_L3_CONFIG_COUNT] =
174 {                                    //  Rest  R/W  RO   UTC  CB  Sum (in KB)
175     {0x00000200, 0, 0, 0},           //  512   0    0    0    0   512
176     {0xC0000000, 0x40000000, 0, 0},  //  384   0    0    128  0   512
177     {0xF0000000, 0x00000080, 0, 0},  //  480   0    0    0    32  512
178     {0x80000000, 0x80000000, 0, 0},  //  256   0    0    256  0   512
179     {0x40000000, 0x00000080, 0, 0},  //  0     128  352  0    32  512
180     {0x80000000, 0x70000080, 0, 0},  //  256   0    0    224  32  512
181 };
182 */
183 
184 class VphalInterfacesXe2_Hpm : public VphalDevice
185 {
186 public:
187     MOS_STATUS Initialize(
188         PMOS_INTERFACE osInterface,
189         bool           bInitVphalState,
190         MOS_STATUS *   eStatus,
191         bool           clearViewMode = false);
192 
193     MOS_STATUS CreateVpPlatformInterface(
194         PMOS_INTERFACE           osInterface,
195         MOS_STATUS *             eStatus);
196 
197 private:
198     void InitPlatformKernelBinary(
199         vp::VpPlatformInterface  *&vpPlatformInterface);
200 
201 MEDIA_CLASS_DEFINE_END(VphalInterfacesXe2_Hpm)
202 };
203 
204 class RenderHalInterfacesXe2_Hpg : public RenderHalDevice
205 {
206 protected:
207     using XRenderHal = XRenderHal_Interface_Xe2_Hpg_Next;
208     MOS_STATUS Initialize();
209 
210 MEDIA_CLASS_DEFINE_END(RenderHalInterfacesXe2_Hpg)
211 };
212 
213 class MediaInterfacesHwInfoDeviceXe2_Hpm : public MediaInterfacesHwInfoDevice
214 {
215 public:
216     virtual MOS_STATUS Initialize(PLATFORM platform) override;
217 
218 MEDIA_CLASS_DEFINE_END(MediaInterfacesHwInfoDeviceXe2_Hpm)
219 };
220 
221 class McpyDeviceXe2_Hpm : public McpyDeviceNext
222 {
223 public:
224     using Mcpy = MediaCopyStateXe2_Hpm_Base;
225     MOS_STATUS Initialize(
226         PMOS_INTERFACE osInterface,
227         MhwInterfacesNext* mhwInterfaces);
228 
229     MEDIA_CLASS_DEFINE_END(McpyDeviceXe2_Hpm)
230 };
231 #endif  // __MEDIA_INTERFACES_XE2_HPM_H__
232