Debian Codegraph @

media_driver/media_interface/media_interfaces_m9_cfl/media_interfaces_g9_cfl.cpp

raw
1 /*
2 * Copyright (c) 2017-2018, 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_g9_cfl.cpp
24 //! \brief Helps with CFL factory creation.
25 //!
26
27 #include "media_interfaces_g9_kbl.h"
28 #include "media_interfaces_g9_cfl.h"
29
30 extern template class MediaFactory<uint32_t, MhwInterfaces>;
31 extern template class MediaFactory<uint32_t, MmdDevice>;
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 cflRegisteredVphal =
40 MediaFactory<uint32_t, VphalDevice>::
41 Register<VphalInterfacesG9Kbl>((uint32_t)IGFX_COFFEELAKE);
42
43 static bool cflRegisteredMhw =
44 MediaFactory<uint32_t, MhwInterfaces>::
45 Register<MhwInterfacesG9Kbl>((uint32_t)IGFX_COFFEELAKE);
46
47 #if defined(ENABLE_KERNELS) && !defined(_FULL_OPEN_SOURCE)
48 static bool cflRegisteredMmd =
49 MediaFactory<uint32_t, MmdDevice>::
50 Register<MmdDeviceG9Kbl>((uint32_t)IGFX_COFFEELAKE);
51 #endif
52
53 static bool cflRegisteredNv12ToP010 =
54 MediaFactory<uint32_t, Nv12ToP010Device>::
55 Register<Nv12ToP010DeviceG9Kbl>((uint32_t)IGFX_COFFEELAKE);
56
57 static bool cflRegisteredCodecHal =
58 MediaFactory<uint32_t, CodechalDevice>::
59 Register<CodechalInterfacesG9Kbl>((uint32_t)IGFX_COFFEELAKE);
60
61 static bool cflRegisteredCMHal =
62 MediaFactory<uint32_t, CMHalDevice>::
63 Register<CMHalInterfacesG9Cfl>((uint32_t)IGFX_COFFEELAKE);
64
65 #define PLATFORM_INTEL_CFL 17
66 #define GENX_SKL 5
67
68 MOS_STATUS CMHalInterfacesG9Cfl::Initialize(CM_HAL_STATE *pCmState)
69 {
70 m_cmhalDevice = MOS_New(CMHal, pCmState);
71 if (m_cmhalDevice == nullptr)
72 {
73 MHW_ASSERTMESSAGE("Create CM Hal interfaces failed.")
74 return MOS_STATUS_NO_SPACE;
75 }
76
77 int gengt = PLATFORM_INTEL_GT2;
78 if( MEDIA_IS_SKU(pCmState->skuTable, FtrGT1 ))
79 {
80 gengt = PLATFORM_INTEL_GT1;
81 }
82 else if (MEDIA_IS_SKU(pCmState->skuTable, FtrGT1_5))
83 {
84 gengt = PLATFORM_INTEL_GT1_5;
85 }
86 else if( MEDIA_IS_SKU(pCmState->skuTable, FtrGT2 ))
87 {
88 gengt = PLATFORM_INTEL_GT2;
89 }
90 else if( MEDIA_IS_SKU(pCmState->skuTable, FtrGT3 ))
91 {
92 gengt = PLATFORM_INTEL_GT3;
93 }
94 else if( MEDIA_IS_SKU(pCmState->skuTable, FtrGT4 ))
95 {
96 gengt = PLATFORM_INTEL_GT4;
97 }
98
99 m_cmhalDevice->SetGenPlatformInfo(PLATFORM_INTEL_CFL, gengt, "SKL");
100 uint32_t cisaID = GENX_SKL;
101 m_cmhalDevice->AddSupportedCisaIDs(&cisaID);
102
103 CM_HAL_G9_X *pGen9Device = static_cast<CM_HAL_G9_X *>(m_cmhalDevice);
104 const char *CmSteppingInfo_CFL[] = {nullptr};
105 pGen9Device->OverwriteSteppingTable(CmSteppingInfo_CFL, sizeof(CmSteppingInfo_CFL)/sizeof(const char *));
106 return MOS_STATUS_SUCCESS;
107 }
108
109 static bool cflRegisteredRenderHal =
110 MediaFactory<uint32_t, RenderHalDevice>::
111 Register<RenderHalInterfacesG9Kbl>((uint32_t)IGFX_COFFEELAKE);
112
113 static bool cflRegisteredDecodeHistogram =
114 MediaFactory<uint32_t, DecodeHistogramDevice>::
115 Register<DecodeHistogramDeviceG9Cfl>((uint32_t)IGFX_COFFEELAKE);
116
117 MOS_STATUS DecodeHistogramDeviceG9Cfl::Initialize(
118 CodechalHwInterface *hwInterface,
119 PMOS_INTERFACE osInterface)
120 {
121 m_decodeHistogramDevice = MOS_New(DecodeHistogramVebox, hwInterface, osInterface);
122
123 if (m_decodeHistogramDevice == nullptr)
124 {
125 MHW_ASSERTMESSAGE("Create vebox decode histogram interfaces failed.")
126 return MOS_STATUS_NO_SPACE;
127 }
128
129 return MOS_STATUS_SUCCESS;
130 }
131
132 #define IP_VERSION_M9_0 0x0900
133 static bool cflRegisteredHwInfo =
134 MediaFactory<uint32_t, MediaInterfacesHwInfoDevice>::Register<MediaInterfacesHwInfoDeviceG9Cfl>((uint32_t)IGFX_COFFEELAKE);
135
136 MOS_STATUS MediaInterfacesHwInfoDeviceG9Cfl::Initialize(PLATFORM platform)
137 {
138 m_hwInfo.SetDeviceInfo(IP_VERSION_M9_0, platform.usRevId);
139 return MOS_STATUS_SUCCESS;
140 }