| 1 | /* |
| 2 | * Copyright (c) 2011-2023, 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 | //! \file media_interfaces_g12_rkl.cpp |
| 23 | //! \brief Helps with Gen12 RKL factory creation. |
| 24 | //! |
| 25 | |
| 26 | #include "media_interfaces_g12_rkl.h" |
| 27 | |
| 28 | extern template class MediaFactory<uint32_t, MhwInterfaces>; |
| 29 | extern template class MediaFactory<uint32_t, MmdDevice>; |
| 30 | extern template class MediaFactory<uint32_t, CodechalDevice>; |
| 31 | extern template class MediaFactory<uint32_t, CMHalDevice>; |
| 32 | extern template class MediaFactory<uint32_t, VphalDevice>; |
| 33 | extern template class MediaFactory<uint32_t, RenderHalDevice>; |
| 34 | extern template class MediaFactory<uint32_t, Nv12ToP010Device>; |
| 35 | extern template class MediaFactory<uint32_t, DecodeHistogramDevice>; |
| 36 | |
| 37 | static bool rklRegisteredVphal = |
| 38 | MediaFactory<uint32_t, VphalDevice>:: |
| 39 | Register<VphalInterfacesG12Tgllp>((uint32_t)IGFX_ROCKETLAKE); |
| 40 | |
| 41 | static bool rklRegisteredMhw = |
| 42 | MediaFactory<uint32_t, MhwInterfaces>:: |
| 43 | Register<MhwInterfacesG12Tgllp>((uint32_t)IGFX_ROCKETLAKE); |
| 44 | |
| 45 | #define PLATFORM_INTEL_RKL 19 |
| 46 | #define GENX_TGLLP 12 |
| 47 | |
| 48 | static bool rklRegisteredMmd = |
| 49 | MediaFactory<uint32_t, MmdDevice>:: |
| 50 | Register<MmdDeviceG12Tgllp>((uint32_t)IGFX_ROCKETLAKE); |
| 51 | |
| 52 | static bool RegisteredNv12ToP010 = |
| 53 | MediaFactory<uint32_t, Nv12ToP010Device>:: |
| 54 | Register<Nv12ToP010DeviceG12Tgllp>((uint32_t)IGFX_ROCKETLAKE); |
| 55 | |
| 56 | static bool rklRegisteredCodecHal = |
| 57 | MediaFactory<uint32_t, CodechalDevice>:: |
| 58 | Register<CodechalInterfacesG12Tgllp>((uint32_t)IGFX_ROCKETLAKE); |
| 59 | |
| 60 | static bool rklRegisteredCMHal = |
| 61 | MediaFactory<uint32_t, CMHalDevice>:: |
| 62 | Register<CMHalInterfacesG12Rkl>((uint32_t)IGFX_ROCKETLAKE); |
| 63 | |
| 64 | static bool rklRegisteredRenderHal = |
| 65 | MediaFactory<uint32_t, RenderHalDevice>:: |
| 66 | Register<RenderHalInterfacesG12Tgllp>((uint32_t)IGFX_ROCKETLAKE); |
| 67 | |
| 68 | static bool rklRegisteredDecodeHistogram = |
| 69 | MediaFactory<uint32_t, DecodeHistogramDevice>:: |
| 70 | Register<DecodeHistogramDeviceG12Tgllp>((uint32_t)IGFX_ROCKETLAKE); |
| 71 | |
| 72 | static bool rklRegisteredHwInfo = |
| 73 | MediaFactory<uint32_t, MediaInterfacesHwInfoDevice>:: |
| 74 | Register<MediaInterfacesHwInfoDeviceG12Tgllp>((uint32_t)IGFX_ROCKETLAKE); |
| 75 | |
| 76 | MOS_STATUS CMHalInterfacesG12Rkl::Initialize(CM_HAL_STATE *pCmState) |
| 77 | { |
| 78 | if (pCmState == nullptr) |
| 79 | { |
| 80 | MHW_ASSERTMESSAGE("pCmState is nullptr.") |
| 81 | return MOS_STATUS_INVALID_PARAMETER; |
| 82 | } |
| 83 | |
| 84 | m_cmhalDevice = MOS_New(CMHal, pCmState); |
| 85 | if (m_cmhalDevice == nullptr) |
| 86 | { |
| 87 | MHW_ASSERTMESSAGE("Create CM Hal interfaces failed.") |
| 88 | return MOS_STATUS_NO_SPACE; |
| 89 | } |
| 90 | |
| 91 | m_cmhalDevice->SetGenPlatformInfo(PLATFORM_INTEL_RKL, PLATFORM_INTEL_GT2, "TGLLP"); |
| 92 | uint32_t cisaIDs[] = {GENX_TGLLP}; |
| 93 | m_cmhalDevice->AddSupportedCisaIDs(cisaIDs, sizeof(cisaIDs) / sizeof(uint32_t)); |
| 94 | m_cmhalDevice->m_l3Plane = TGL_L3_PLANE; |
| 95 | m_cmhalDevice->m_l3ConfigCount = TGL_L3_CONFIG_NUM; |
| 96 | return MOS_STATUS_SUCCESS; |
| 97 | } |