| 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 | //! |
| 23 | //! \file media_interfaces_g12_dg1.cpp |
| 24 | //! \brief Helps with DG1 factory creation. |
| 25 | //! |
| 26 | |
| 27 | #include "media_interfaces_g12_dg1.h" |
| 28 | |
| 29 | extern template class MediaFactory<uint32_t, MhwInterfaces>; |
| 30 | extern template class MediaFactory<uint32_t, MmdDevice>; |
| 31 | extern template class MediaFactory<uint32_t, McpyDevice>; |
| 32 | extern template class MediaFactory<uint32_t, CodechalDevice>; |
| 33 | extern template class MediaFactory<uint32_t, CMHalDevice>; |
| 34 | extern template class MediaFactory<uint32_t, VphalDevice>; |
| 35 | extern template class MediaFactory<uint32_t, RenderHalDevice>; |
| 36 | extern template class MediaFactory<uint32_t, Nv12ToP010Device>; |
| 37 | extern template class MediaFactory<uint32_t, DecodeHistogramDevice>; |
| 38 | |
| 39 | static bool dg1RegisteredVphal = |
| 40 | MediaFactory<uint32_t, VphalDevice>:: |
| 41 | Register<VphalInterfacesG12Tgllp>((uint32_t)IGFX_DG1); |
| 42 | |
| 43 | static bool dg1RegisteredMhw = |
| 44 | MediaFactory<uint32_t, MhwInterfaces>:: |
| 45 | Register<MhwInterfacesG12Tgllp>((uint32_t)IGFX_DG1); |
| 46 | |
| 47 | static bool dg1RegisteredMmd = |
| 48 | MediaFactory<uint32_t, MmdDevice>:: |
| 49 | Register<MmdDeviceG12Tgllp>((uint32_t)IGFX_DG1); |
| 50 | |
| 51 | static bool dg1RegisteredMcpy = |
| 52 | MediaFactory<uint32_t, McpyDevice>:: |
| 53 | Register<McpyDeviceG12Tgllp>((uint32_t)IGFX_DG1); |
| 54 | |
| 55 | static bool dg1RegisteredNv12ToP010 = |
| 56 | MediaFactory<uint32_t, Nv12ToP010Device>:: |
| 57 | Register<Nv12ToP010DeviceG12Tgllp>((uint32_t)IGFX_DG1); |
| 58 | |
| 59 | static bool dg1RegisteredCodecHal = |
| 60 | MediaFactory<uint32_t, CodechalDevice>:: |
| 61 | Register<CodechalInterfacesG12Tgllp>((uint32_t)IGFX_DG1); |
| 62 | |
| 63 | static bool dg1RegisteredCMHal = |
| 64 | MediaFactory<uint32_t, CMHalDevice>:: |
| 65 | Register<CMHalInterfacesG12Dg1>((uint32_t)IGFX_DG1); |
| 66 | |
| 67 | static bool dg1RegisteredDecodeHistogram = |
| 68 | MediaFactory<uint32_t, DecodeHistogramDevice>:: |
| 69 | Register<DecodeHistogramDeviceG12Tgllp>((uint32_t)IGFX_DG1); |
| 70 | |
| 71 | static bool dg1RegisteredRenderHal = |
| 72 | MediaFactory<uint32_t, RenderHalDevice>:: |
| 73 | Register<RenderHalInterfacesG12Dg1>((uint32_t)IGFX_DG1); |
| 74 | |
| 75 | static bool dg1RegisteredHwInfo = |
| 76 | MediaFactory<uint32_t, MediaInterfacesHwInfoDevice>:: |
| 77 | Register<MediaInterfacesHwInfoDeviceG12Tgllp>((uint32_t)IGFX_DG1); |
| 78 | |
| 79 | MOS_STATUS RenderHalInterfacesG12Dg1::Initialize() |
| 80 | { |
| 81 | m_renderhalDevice = MOS_New(XRenderHal); |
| 82 | if (m_renderhalDevice == nullptr) |
| 83 | { |
| 84 | MHW_ASSERTMESSAGE("Create Render Hal interfaces failed.") |
| 85 | return MOS_STATUS_NO_SPACE; |
| 86 | } |
| 87 | return MOS_STATUS_SUCCESS; |
| 88 | } |
| 89 | |
| 90 | |
| 91 | #define PLATFORM_INTEL_DG1 20 |
| 92 | #define GENX_TGLLP 12 |
| 93 | |
| 94 | MOS_STATUS CMHalInterfacesG12Dg1::Initialize(CM_HAL_STATE* cmState) |
| 95 | { |
| 96 | if (cmState == nullptr) |
| 97 | { |
| 98 | MHW_ASSERTMESSAGE("cmState is nullptr.") |
| 99 | return MOS_STATUS_INVALID_PARAMETER; |
| 100 | } |
| 101 | |
| 102 | m_cmhalDevice = MOS_New(CMHal, cmState); |
| 103 | if (m_cmhalDevice == nullptr) |
| 104 | { |
| 105 | MHW_ASSERTMESSAGE("Create CM Hal interfaces failed.") |
| 106 | return MOS_STATUS_NO_SPACE; |
| 107 | } |
| 108 | |
| 109 | m_cmhalDevice->SetGenPlatformInfo(PLATFORM_INTEL_DG1, PLATFORM_INTEL_GT2, "TGLLP"); |
| 110 | uint32_t cisaIDs[] = { GENX_TGLLP }; |
| 111 | m_cmhalDevice->AddSupportedCisaIDs(cisaIDs, sizeof(cisaIDs) / sizeof(uint32_t)); |
| 112 | m_cmhalDevice->m_l3Plane = DG1_L3_PLANE; |
| 113 | m_cmhalDevice->m_l3ConfigCount = DG1_L3_CONFIG_NUM; |
| 114 | return MOS_STATUS_SUCCESS; |
| 115 | } |