| 1 |
/*===================== begin_copyright_notice ================================== |
| 2 |
|
| 3 |
# Copyright (c) 2022, 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 |
|
| 26 |
//! |
| 27 |
//! \file media_interfaces_dg2.h |
| 28 |
//! \brief All interfaces used for DG2 that require factory creation |
| 29 |
//! |
| 30 |
|
| 31 |
#ifndef __MEDIA_INTERFACES_XE_HPM_H__ |
| 32 |
#define __MEDIA_INTERFACES_XE_HPM_H__ |
| 33 |
|
| 34 |
#include "media_interfaces_mhw.h" |
| 35 |
#include "media_interfaces_mhw_next.h" |
| 36 |
#include "media_interfaces_codechal.h" |
| 37 |
#include "media_interfaces_codechal_next.h" |
| 38 |
#include "media_interfaces_mmd.h" |
| 39 |
#include "media_interfaces_mcpy.h" |
| 40 |
#include "media_interfaces_cmhal.h" |
| 41 |
#include "media_interfaces_vphal.h" |
| 42 |
#include "media_interfaces_renderhal.h" |
| 43 |
#include "media_interfaces_nv12top010.h" |
| 44 |
#include "media_interfaces_decode_histogram.h" |
| 45 |
#include "media_interfaces_hwinfo_device.h" |
| 46 |
|
| 47 |
#include "mhw_cp_interface.h" |
| 48 |
#include "mhw_mi_xe_xpm_base.h" |
| 49 |
#include "mhw_render_xe_hpg.h" |
| 50 |
#include "mhw_sfc_xe_xpm.h" |
| 51 |
#include "mhw_state_heap_xe_xpm.h" |
| 52 |
#include "mhw_vebox_xe_hpm.h" |
| 53 |
#include "mhw_vdbox_mfx_xe_xpm.h" |
| 54 |
#include "mhw_vdbox_hcp_xe_hpm.h" |
| 55 |
#include "mhw_vdbox_avp_xe_hpm.h" |
| 56 |
#include "mhw_vdbox_huc_xe_hpm.h" |
| 57 |
#include "mhw_vdbox_avp_g12_X.h" |
| 58 |
#ifdef _MEDIA_RESERVED |
| 59 |
#include "mhw_vdbox_vdenc_xe_hpm_ext.h" |
| 60 |
#else |
| 61 |
#include "mhw_vdbox_vdenc_xe_hpm.h" |
| 62 |
#endif |
| 63 |
#include "vphal_render_vebox_memdecomp_xe_xpm.h" |
| 64 |
#include "media_copy_xe_hpm.h" |
| 65 |
#include "mhw_blt_xe_hp_base.h" |
| 66 |
|
| 67 |
#include "codechal_hw_xe_hpm.h" |
| 68 |
#include "codechal_hw_next_xe_hpm.h" |
| 69 |
|
| 70 |
#ifdef _AVC_DECODE_SUPPORTED |
| 71 |
#include "decode_avc_pipeline_adapter_m12.h" |
| 72 |
#endif |
| 73 |
|
| 74 |
#ifdef _HEVC_DECODE_SUPPORTED |
| 75 |
#include "decode_hevc_pipeline_adapter_m12.h" |
| 76 |
#endif |
| 77 |
|
| 78 |
#ifdef _JPEG_DECODE_SUPPORTED |
| 79 |
#include "decode_jpeg_pipeline_adapter_m12.h" |
| 80 |
#endif |
| 81 |
|
| 82 |
#ifdef _MPEG2_DECODE_SUPPORTED |
| 83 |
#include "decode_mpeg2_pipeline_adapter_m12.h" |
| 84 |
#endif |
| 85 |
|
| 86 |
#ifdef _VC1_DECODE_SUPPORTED |
| 87 |
#include "codechal_decode_vc1_xe_hpm.h" |
| 88 |
#endif |
| 89 |
|
| 90 |
#ifdef _VP8_DECODE_SUPPORTED |
| 91 |
#include "codechal_decode_vp8_g12.h" |
| 92 |
#endif |
| 93 |
|
| 94 |
#ifdef _VP9_DECODE_SUPPORTED |
| 95 |
#include "decode_vp9_pipeline_adapter_m12.h" |
| 96 |
#endif |
| 97 |
|
| 98 |
#ifdef _AV1_DECODE_SUPPORTED |
| 99 |
#include "decode_av1_pipeline_adapter_g12.h" |
| 100 |
#endif |
| 101 |
|
| 102 |
#ifdef _HEVC_ENCODE_VDENC_SUPPORTED |
| 103 |
#include "encode_hevc_vdenc_pipeline_adapter_xe_hpm.h" |
| 104 |
#endif |
| 105 |
|
| 106 |
#ifdef _AV1_ENCODE_VDENC_SUPPORTED |
| 107 |
#include "encode_av1_vdenc_pipeline_adapter_xe_hpm.h" |
| 108 |
#endif |
| 109 |
|
| 110 |
#ifdef _AVC_ENCODE_VDENC_SUPPORTED |
| 111 |
#include "codechal_vdenc_avc_xe_hpm.h" |
| 112 |
#endif |
| 113 |
|
| 114 |
#ifdef _VP9_ENCODE_VDENC_SUPPORTED |
| 115 |
#include "codechal_vdenc_vp9_g12.h" |
| 116 |
#include "codechal_vdenc_vp9_xe_hpm.h" |
| 117 |
#endif |
| 118 |
|
| 119 |
#ifdef _JPEG_ENCODE_SUPPORTED |
| 120 |
#include "codechal_encode_jpeg_g12.h" |
| 121 |
#endif |
| 122 |
|
| 123 |
#ifdef _MEDIA_RESERVED |
| 124 |
#ifdef _AVC_ENCODE_VDENC_SUPPORTED |
| 125 |
#include "codechal_vdenc_avc_xe_hpm_ext.h" |
| 126 |
#endif |
| 127 |
|
| 128 |
#ifdef _VP9_ENCODE_VDENC_SUPPORTED |
| 129 |
#ifdef _MEDIA_RESERVED |
| 130 |
#include "encode_vp9_vdenc_pipeline_adapter_xe_hpm.h" |
| 131 |
#endif |
| 132 |
#endif |
| 133 |
|
| 134 |
|
| 135 |
#include "cm_hal_xe_xpm.h" |
| 136 |
|
| 137 |
#endif // _MEDIA_RESERVED |
| 138 |
|
| 139 |
#include "vphal_xe_xpm.h" |
| 140 |
#include "vphal_xe_hpm.h" |
| 141 |
#include "renderhal_xe_hpg.h" |
| 142 |
|
| 143 |
#include "codechal_decode_histogram.h" |
| 144 |
#include "codechal_decode_histogram_g12.h" |
| 145 |
#include "decode_scalability_singlepipe.h" |
| 146 |
#include "decode_scalability_multipipe.h" |
| 147 |
|
| 148 |
class MhwInterfacesDg2_Next : public MhwInterfacesNext |
| 149 |
{ |
| 150 |
public: |
| 151 |
// Need to remove legacy mhw sub interfaces |
| 152 |
using Mi = MhwMiInterfaceXe_Xpm_Base; |
| 153 |
using Cp = MhwCpInterface; |
| 154 |
using Render = MhwRenderInterfaceXe_Hpg; |
| 155 |
using Sfc = MhwSfcInterfaceXe_Xpm; |
| 156 |
using StateHeap = MHW_STATE_HEAP_INTERFACE_XE_XPM; |
| 157 |
using Mfx = MhwVdboxMfxInterfaceXe_Xpm; |
| 158 |
using Hcp = MhwVdboxHcpInterfaceXe_Hpm; |
| 159 |
using Huc = MhwVdboxHucInterfaceXe_Hpm; |
| 160 |
#ifdef _MEDIA_RESERVED |
| 161 |
using Vdenc = MhwVdboxVdencInterfaceXe_HpmExt; |
| 162 |
#else |
| 163 |
using Vdenc = MhwVdboxVdencInterfaceXe_Hpm; |
| 164 |
#endif |
| 165 |
using Vebox = MhwVeboxInterfaceXe_Hpm; |
| 166 |
using Blt = MhwBltInterfaceXe_Hp_Base; |
| 167 |
|
| 168 |
virtual MOS_STATUS Initialize( |
| 169 |
CreateParams params, |
| 170 |
PMOS_INTERFACE osInterface); |
| 171 |
|
| 172 |
//! |
| 173 |
//! \brief Destroys all created MHW interfaces |
| 174 |
//! \details If the HAL creation fails, this is used for cleanup |
| 175 |
//! |
| 176 |
virtual void Destroy(); |
| 177 |
|
| 178 |
std::shared_ptr<MhwMiInterface> m_miInterface = nullptr; |
| 179 |
|
| 180 |
MhwRenderInterface *m_renderInterface = nullptr; |
| 181 |
}; |
| 182 |
|
| 183 |
class MhwInterfacesDg2 : public MhwInterfaces |
| 184 |
{ |
| 185 |
public: |
| 186 |
using Mi = MhwMiInterfaceXe_Xpm_Base; |
| 187 |
using Cp = MhwCpInterface; |
| 188 |
using Render = MhwRenderInterfaceXe_Hpg; |
| 189 |
using Sfc = MhwSfcInterfaceXe_Xpm; |
| 190 |
using StateHeap = MHW_STATE_HEAP_INTERFACE_XE_XPM; |
| 191 |
using Mfx = MhwVdboxMfxInterfaceXe_Xpm; |
| 192 |
using Hcp = MhwVdboxHcpInterfaceXe_Hpm; |
| 193 |
using Avp = MhwVdboxAvpInterfaceXe_Hpm; |
| 194 |
using Huc = MhwVdboxHucInterfaceXe_Hpm; |
| 195 |
#ifdef _MEDIA_RESERVED |
| 196 |
using Vdenc = MhwVdboxVdencInterfaceXe_HpmExt; |
| 197 |
#else |
| 198 |
using Vdenc = MhwVdboxVdencInterfaceXe_Hpm; |
| 199 |
#endif |
| 200 |
using Vebox = MhwVeboxInterfaceXe_Hpm; |
| 201 |
using Blt = MhwBltInterfaceXe_Hp_Base; |
| 202 |
|
| 203 |
virtual MOS_STATUS Initialize( |
| 204 |
CreateParams params, |
| 205 |
PMOS_INTERFACE osInterface); |
| 206 |
|
| 207 |
}; |
| 208 |
|
| 209 |
class MmdDeviceXe_Hpm : public MmdDevice |
| 210 |
{ |
| 211 |
public: |
| 212 |
using Mmd = MediaVeboxDecompStateXe_Xpm; |
| 213 |
|
| 214 |
MOS_STATUS Initialize( |
| 215 |
PMOS_INTERFACE osInterface, |
| 216 |
MhwInterfaces *mhwInterfaces); |
| 217 |
|
| 218 |
MhwInterfaces* CreateMhwInterface( |
| 219 |
PMOS_INTERFACE osInterface); |
| 220 |
}; |
| 221 |
|
| 222 |
class McpyDeviceXe_Hpm : public McpyDevice |
| 223 |
{ |
| 224 |
public: |
| 225 |
using Mcpy = MediaCopyState_Xe_Hpm; |
| 226 |
|
| 227 |
MOS_STATUS Initialize( |
| 228 |
PMOS_INTERFACE osInterface); |
| 229 |
protected: |
| 230 |
MhwInterfaces* CreateMhwInterface( |
| 231 |
PMOS_INTERFACE osInterface); |
| 232 |
}; |
| 233 |
|
| 234 |
class Nv12ToP010DeviceXe_Hpm : public Nv12ToP010Device |
| 235 |
{ |
| 236 |
public: |
| 237 |
|
| 238 |
MOS_STATUS Initialize( |
| 239 |
PMOS_INTERFACE osInterface); |
| 240 |
}; |
| 241 |
|
| 242 |
class CodechalDecodeInterfacesXe_Hpm |
| 243 |
{ |
| 244 |
public: |
| 245 |
#ifdef _AVC_DECODE_SUPPORTED |
| 246 |
using Avc = DecodeAvcPipelineAdapterM12; |
| 247 |
#endif |
| 248 |
#ifdef _HEVC_DECODE_SUPPORTED |
| 249 |
using Hevc = DecodeHevcPipelineAdapterM12; |
| 250 |
#endif |
| 251 |
#ifdef _JPEG_DECODE_SUPPORTED |
| 252 |
using Jpeg = DecodeJpegPipelineAdapterM12; |
| 253 |
#endif |
| 254 |
#ifdef _MPEG2_DECODE_SUPPORTED |
| 255 |
using Mpeg2 = DecodeMpeg2PipelineAdapterM12; |
| 256 |
#endif |
| 257 |
#ifdef _VC1_DECODE_SUPPORTED |
| 258 |
using Vc1 = CodechalDecodeVc1Xe_Hpm; |
| 259 |
#endif |
| 260 |
#ifdef _VP8_DECODE_SUPPORTED |
| 261 |
using Vp8 = CodechalDecodeVp8G12; |
| 262 |
#endif |
| 263 |
#ifdef _VP9_DECODE_SUPPORTED |
| 264 |
using Vp9 = DecodeVp9PipelineAdapterG12; |
| 265 |
#endif |
| 266 |
#ifdef _AV1_DECODE_SUPPORTED |
| 267 |
using Av1 = DecodeAv1PipelineAdapterG12; |
| 268 |
#endif |
| 269 |
}; |
| 270 |
|
| 271 |
class CodechalEncodeInterfacesXe_Hpm |
| 272 |
{ |
| 273 |
public: |
| 274 |
#ifdef _MEDIA_RESERVED |
| 275 |
#ifdef _VP9_ENCODE_VDENC_SUPPORTED |
| 276 |
using Vp9 = CodechalVdencVp9StateXe_Xpm; |
| 277 |
#endif |
| 278 |
#ifdef _AVC_ENCODE_VDENC_SUPPORTED |
| 279 |
using AvcVdenc = CodechalVdencAvcStateXe_HpmExt; |
| 280 |
#endif |
| 281 |
#else |
| 282 |
#ifdef _VP9_ENCODE_VDENC_SUPPORTED |
| 283 |
using Vp9 = CodechalVdencVp9StateXe_Xpm; |
| 284 |
#endif |
| 285 |
#ifdef _AVC_ENCODE_VDENC_SUPPORTED |
| 286 |
using AvcVdenc = CodechalVdencAvcStateXe_Hpm; |
| 287 |
#endif |
| 288 |
#endif |
| 289 |
|
| 290 |
#ifdef _JPEG_ENCODE_SUPPORTED |
| 291 |
using Jpeg = CodechalEncodeJpegStateG12; |
| 292 |
#endif |
| 293 |
#ifdef _HEVC_ENCODE_VDENC_SUPPORTED |
| 294 |
using HevcVdenc = EncodeHevcVdencPipelineAdapterXe_Hpm; |
| 295 |
#endif |
| 296 |
#ifdef _AV1_ENCODE_VDENC_SUPPORTED |
| 297 |
using Av1Vdenc = EncodeAv1VdencPipelineAdapterXe_Hpm; |
| 298 |
#endif |
| 299 |
}; |
| 300 |
|
| 301 |
class CodechalInterfacesXe_Hpm : public CodechalDevice |
| 302 |
{ |
| 303 |
public: |
| 304 |
using Decode = CodechalDecodeInterfacesXe_Hpm; |
| 305 |
using Encode = CodechalEncodeInterfacesXe_Hpm; |
| 306 |
using Hw = CodechalHwInterfaceXe_Hpm; |
| 307 |
|
| 308 |
virtual MOS_STATUS Initialize( |
| 309 |
void *standardInfo, |
| 310 |
void *settings, |
| 311 |
MhwInterfaces *mhwInterfaces, |
| 312 |
PMOS_INTERFACE osInterface) override; |
| 313 |
|
| 314 |
protected: |
| 315 |
virtual MOS_STATUS CreateCodecHalInterface(MhwInterfaces *mhwInterfaces, |
| 316 |
CodechalHwInterface *&pHwInterface, |
| 317 |
CodechalDebugInterface *&pDebugInterface, |
| 318 |
PMOS_INTERFACE osInterface, |
| 319 |
CODECHAL_FUNCTION CodecFunction, |
| 320 |
bool disableScalability); |
| 321 |
|
| 322 |
virtual MOS_STATUS CreateCodecHalInterface(MhwInterfaces *mhwInterfaces, |
| 323 |
MhwInterfacesNext *&pMhwInterfacesNext, |
| 324 |
CodechalHwInterfaceNext *&pHwInterface, |
| 325 |
CodechalDebugInterface *&pDebugInterface, |
| 326 |
PMOS_INTERFACE osInterface, |
| 327 |
CODECHAL_FUNCTION CodecFunction, |
| 328 |
bool disableScalability); |
| 329 |
}; |
| 330 |
class CodechalInterfacesNextXe_Hpm : public CodechalDeviceNext |
| 331 |
{ |
| 332 |
public: |
| 333 |
using Decode = CodechalDecodeInterfacesXe_Hpm; |
| 334 |
using Encode = CodechalEncodeInterfacesXe_Hpm; |
| 335 |
using Hw = CodechalHwInterfaceNextXe_Hpm; |
| 336 |
|
| 337 |
virtual MOS_STATUS Initialize( |
| 338 |
void *standardInfo, |
| 339 |
void *settings, |
| 340 |
MhwInterfacesNext *mhwInterfaces, |
| 341 |
PMOS_INTERFACE osInterface) override; |
| 342 |
}; |
| 343 |
|
| 344 |
#define DG2_L3_CONFIG_COUNT 6 |
| 345 |
// 4KB per Way for DG2, two Way per section |
| 346 |
static const L3ConfigRegisterValues DG2_L3_PLANES[DG2_L3_CONFIG_COUNT] = |
| 347 |
{ // Rest R/W RO UTC CB Sum (in KB) |
| 348 |
{0x00000200, 0, 0, 0}, // 512 0 0 0 0 512 |
| 349 |
{0xC0000000, 0x40000000, 0, 0}, // 384 0 0 128 0 512 |
| 350 |
{0xF0000000, 0x00000080, 0, 0}, // 480 0 0 0 32 512 |
| 351 |
{0x80000000, 0x80000000, 0, 0}, // 256 0 0 256 0 512 |
| 352 |
{0x40000000, 0x00000080, 0, 0}, // 0 128 352 0 32 512 |
| 353 |
{0x80000000, 0x70000080, 0, 0}, // 256 0 0 224 32 512 |
| 354 |
}; |
| 355 |
|
| 356 |
#ifdef _MEDIA_RESERVED |
| 357 |
class CMHalInterfacesXe_Hpm : public CMHalDevice |
| 358 |
{ |
| 359 |
protected: |
| 360 |
using CMHal = CmHalXe_Xpm; |
| 361 |
MOS_STATUS Initialize( |
| 362 |
CM_HAL_STATE *pCmState); |
| 363 |
}; |
| 364 |
#endif |
| 365 |
|
| 366 |
class VphalInterfacesXe_Hpm : public VphalDevice |
| 367 |
{ |
| 368 |
public: |
| 369 |
using VphalState = VphalStateXe_Hpm; |
| 370 |
|
| 371 |
MOS_STATUS Initialize( |
| 372 |
PMOS_INTERFACE osInterface, |
| 373 |
bool bInitVphalState, |
| 374 |
MOS_STATUS *eStatus, |
| 375 |
bool clearViewMode = false); |
| 376 |
|
| 377 |
MOS_STATUS CreateVpPlatformInterface( |
| 378 |
PMOS_INTERFACE osInterface, |
| 379 |
MOS_STATUS * eStatus); |
| 380 |
|
| 381 |
private: |
| 382 |
void InitPlatformKernelBinary( |
| 383 |
vp::VpPlatformInterface *&vpPlatformInterface); |
| 384 |
}; |
| 385 |
|
| 386 |
class RenderHalInterfacesXe_Hpg : public RenderHalDevice |
| 387 |
{ |
| 388 |
protected: |
| 389 |
using XRenderHal = XRenderHal_Interface_Xe_Hpg; |
| 390 |
MOS_STATUS Initialize(); |
| 391 |
}; |
| 392 |
|
| 393 |
class DecodeHistogramDeviceXe_Hpm : public DecodeHistogramDevice |
| 394 |
{ |
| 395 |
public: |
| 396 |
using DecodeHistogramG12 = CodechalDecodeHistogramG12; |
| 397 |
|
| 398 |
MOS_STATUS Initialize( |
| 399 |
CodechalHwInterface *hwInterface, |
| 400 |
PMOS_INTERFACE osInterface); |
| 401 |
}; |
| 402 |
|
| 403 |
class MediaInterfacesHwInfoDeviceDg2 : public MediaInterfacesHwInfoDevice |
| 404 |
{ |
| 405 |
public: |
| 406 |
virtual MOS_STATUS RefreshRevId(PLATFORM &platform, MEDIA_WA_TABLE *waTable) override; |
| 407 |
virtual MOS_STATUS Initialize(PLATFORM platform) override; |
| 408 |
}; |
| 409 |
|
| 410 |
#endif // __MEDIA_INTERFACES_XE_HPM_H__ |