summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/libva/files/0001-upstream-ADLN.patch
blob: 806b1db6fff3f5131747c443e268117ee36f718f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
From 647893d233066b3ca79bccb48de4c26867fb9a88 Mon Sep 17 00:00:00 2001
From: aidan2020sh <dan.ai@intel.com>
Date: Fri, 24 Dec 2021 15:11:29 +0800
Subject: [PATCH 1/2] upstream ADLN

this patch is used to upstream new platform ADLN support

This patch was imported from iHD media-driver git server
(https://github.com/intel/media-driver/commit/348e98e90d240deecd3040f3846a27e9bb6c3ac1)

Upstream-status: Backport
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
---
 .../linux/gen12/ddi/media_libva_caps_g12.cpp  |   6 +
 .../linux/gen12/ddi/media_sku_wa_g12.cpp      |  47 ++++++++
 .../linux/gen12/ddi/media_sysinfo_g12.cpp     |  32 ++++++
 .../media_interfaces_g12_adln.cpp             | 106 ++++++++++++++++++
 .../media_interfaces_g12_adln.h               |  45 ++++++++
 .../media_srcs.cmake                          |  49 ++++++++
 media_driver/media_interface/media_srcs.cmake |   4 +
 7 files changed, 289 insertions(+)
 create mode 100644 media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.cpp
 create mode 100644 media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.h
 create mode 100644 media_driver/media_interface/media_interfaces_m12_adln/media_srcs.cmake

diff --git a/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp b/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp
index 1c47cb369..de6273089 100644
--- a/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp
+++ b/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp
@@ -2813,3 +2813,9 @@ static bool adlpRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CON
     RegisterCaps<MediaLibvaCapsG12>((uint32_t)IGFX_ALDERLAKE_P);
 #endif
 
+#ifdef IGFX_GEN12_ADLN_SUPPORTED
+static bool adlnRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>::
+    RegisterCaps<MediaLibvaCapsG12>((uint32_t)IGFX_ALDERLAKE_N);
+#endif
+
+
diff --git a/media_driver/linux/gen12/ddi/media_sku_wa_g12.cpp b/media_driver/linux/gen12/ddi/media_sku_wa_g12.cpp
index 88e03705e..8155d885d 100644
--- a/media_driver/linux/gen12/ddi/media_sku_wa_g12.cpp
+++ b/media_driver/linux/gen12/ddi/media_sku_wa_g12.cpp
@@ -587,6 +587,53 @@ static bool adlpDeviceRegister = DeviceInfoFactory<LinuxDeviceInit>::
 
 #endif
 
+#ifdef IGFX_GEN12_ADLN_SUPPORTED
+static bool InitAdlnMediaSku(struct GfxDeviceInfo *devInfo,
+    MediaFeatureTable *                            skuTable,
+    struct LinuxDriverInfo *                       drvInfo)
+{
+    if (!InitTglMediaSku(devInfo, skuTable, drvInfo))
+    {
+        return false;
+    }
+
+    if (devInfo->eGTType == GTTYPE_GT0_5)
+    {
+        MEDIA_WR_SKU(skuTable, FtrGT0_5, 1);
+    }
+
+    MEDIA_WR_SKU(skuTable, FtrAV1VLDLSTDecoding, 1);
+    MEDIA_WR_SKU(skuTable, FtrGucSubmission, 1);
+
+    return true;
+}
+
+static bool InitAdlnMediaWa(struct GfxDeviceInfo *devInfo,
+    MediaWaTable *                                waTable,
+    struct LinuxDriverInfo *                      drvInfo)
+{
+    if (!InitTglMediaWa(devInfo, waTable, drvInfo))
+    {
+        return false;
+    }
+
+    //ADL-N keeps below setting same as ADL-S/ADL-P
+    MEDIA_WR_WA(waTable, Wa_1409820462, 0);
+
+    return true;
+}
+
+static struct LinuxDeviceInit adlnDeviceInit =
+    {
+        .productFamily    = IGFX_ALDERLAKE_N,
+        .InitMediaFeature = InitAdlnMediaSku,
+        .InitMediaWa      = InitAdlnMediaWa,
+};
+
+static bool adlnDeviceRegister = DeviceInfoFactory<LinuxDeviceInit>::
+    RegisterDevice(IGFX_ALDERLAKE_N, &adlnDeviceInit);
+
+#endif
 
 static struct LinuxDeviceInit tgllpDeviceInit =
 {
diff --git a/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp b/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp
index b3c402191..f68fe6665 100644
--- a/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp
+++ b/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp
@@ -460,6 +460,38 @@ static bool adlpGt2Device4626 = DeviceInfoFactory<GfxDeviceInfo>::
 
 #endif
 
+#ifdef IGFX_GEN12_ADLN_SUPPORTED
+static struct GfxDeviceInfo adlnGt1Info = {
+    .platformType     = PLATFORM_MOBILE,
+    .productFamily    = IGFX_ALDERLAKE_N,
+    .displayFamily    = IGFX_GEN12_CORE,
+    .renderFamily     = IGFX_GEN12_CORE,
+    .eGTType          = GTTYPE_GT1,
+    .L3CacheSizeInKb  = 0,
+    .L3BankCount      = 8,
+    .EUCount          = 0,
+    .SliceCount       = 0,
+    .SubSliceCount    = 0,
+    .MaxEuPerSubSlice = 0,
+    .isLCIA           = 0,
+    .hasLLC           = 0,
+    .hasERAM          = 0,
+    .InitMediaSysInfo = InitTglMediaSysInfo,
+    .InitShadowSku    = InitTglShadowSku,
+    .InitShadowWa     = InitTglShadowWa,
+};
+
+static bool adlnGt1Device46D0 = DeviceInfoFactory<GfxDeviceInfo>::
+    RegisterDevice(0x46D0, &adlnGt1Info);
+
+static bool adlnGt1Device46D1 = DeviceInfoFactory<GfxDeviceInfo>::
+    RegisterDevice(0x46D1, &adlnGt1Info);
+
+static bool adlnGt1Device46D2 = DeviceInfoFactory<GfxDeviceInfo>::
+    RegisterDevice(0x46D2, &adlnGt1Info);
+#endif 
+
+
 static bool tgllpGt2Device9a40 = DeviceInfoFactory<GfxDeviceInfo>::
     RegisterDevice(0x9A40, &tgllpGt2Info);
 
diff --git a/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.cpp b/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.cpp
new file mode 100644
index 000000000..089c8a51c
--- /dev/null
+++ b/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.cpp
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2011-2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+//!
+//! \file     media_interfaces_g12_adln.cpp
+
+//! \brief    Helps with Gen12 ADL-N factory creation.
+//!
+
+#include "media_interfaces_g12_adln.h"
+
+extern template class MediaInterfacesFactory<MhwInterfaces>;
+extern template class MediaInterfacesFactory<MmdDevice>;
+extern template class MediaInterfacesFactory<MosUtilDevice>;
+extern template class MediaInterfacesFactory<CodechalDevice>;
+extern template class MediaInterfacesFactory<CMHalDevice>;
+extern template class MediaInterfacesFactory<VphalDevice>;
+extern template class MediaInterfacesFactory<RenderHalDevice>;
+extern template class MediaInterfacesFactory<Nv12ToP010Device>;
+extern template class MediaInterfacesFactory<DecodeHistogramDevice>;
+
+static bool adlnRegisteredVphal =
+MediaInterfacesFactory<VphalDevice>::
+RegisterHal<VphalInterfacesG12Tgllp>((uint32_t)IGFX_ALDERLAKE_N);
+
+static bool adlnRegisteredMhw =
+    MediaInterfacesFactory<MhwInterfaces>::
+    RegisterHal<MhwInterfacesG12Tgllp>((uint32_t)IGFX_ALDERLAKE_N);
+
+#ifdef _MMC_SUPPORTED
+static bool adlnRegisteredMmd =
+    MediaInterfacesFactory<MmdDevice>::
+    RegisterHal<MmdDeviceG12Tgllp>((uint32_t)IGFX_ALDERLAKE_N);
+#endif
+
+#define PLATFORM_INTEL_ADLN   24
+#define GENX_TGLLP            12
+
+static bool adlnRegisteredNv12ToP010 =
+    MediaInterfacesFactory<Nv12ToP010Device>::
+    RegisterHal<Nv12ToP010DeviceG12Tgllp>((uint32_t)IGFX_ALDERLAKE_N);
+
+static bool adlnRegisteredCodecHal =
+    MediaInterfacesFactory<CodechalDevice>::
+    RegisterHal<CodechalInterfacesG12Tgllp>((uint32_t)IGFX_ALDERLAKE_N);
+
+static bool adlnRegisteredCMHal =
+    MediaInterfacesFactory<CMHalDevice>::
+    RegisterHal<CMHalInterfacesG12Adln>((uint32_t)IGFX_ALDERLAKE_N);
+
+
+MOS_STATUS CMHalInterfacesG12Adln::Initialize(CM_HAL_STATE *pCmState)
+{
+    if (pCmState == nullptr)
+    {
+        MHW_ASSERTMESSAGE("pCmState is nullptr.")
+        return MOS_STATUS_INVALID_PARAMETER;
+    }
+
+    m_cmhalDevice = MOS_New(CMHal, pCmState);
+    if (m_cmhalDevice == nullptr)
+    {
+        MHW_ASSERTMESSAGE("Create CM Hal interfaces failed.")
+        return MOS_STATUS_NO_SPACE;
+    }
+
+    m_cmhalDevice->SetGenPlatformInfo(PLATFORM_INTEL_ADLN, PLATFORM_INTEL_GT1, "TGLLP");
+    uint32_t cisaIDs[] = { GENX_TGLLP };
+    m_cmhalDevice->AddSupportedCisaIDs(cisaIDs, sizeof(cisaIDs)/sizeof(uint32_t));
+    m_cmhalDevice->m_l3Plane = TGL_L3_PLANE;
+    m_cmhalDevice->m_l3ConfigCount = TGL_L3_CONFIG_NUM;
+    return MOS_STATUS_SUCCESS;
+}
+
+static bool adlnRegisteredMosUtil =
+    MediaInterfacesFactory<MosUtilDevice>::
+    RegisterHal<MosUtilDeviceG12Tgllp>((uint32_t)IGFX_ALDERLAKE_N);
+
+
+static bool adlnRegisteredRenderHal =
+    MediaInterfacesFactory<RenderHalDevice>::
+    RegisterHal<RenderHalInterfacesG12Tgllp>((uint32_t)IGFX_ALDERLAKE_N);
+
+static bool adlnRegisteredDecodeHistogram =
+    MediaInterfacesFactory<DecodeHistogramDevice>::
+    RegisterHal<DecodeHistogramDeviceG12Tgllp>((uint32_t)IGFX_ALDERLAKE_N);
+
diff --git a/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.h b/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.h
new file mode 100644
index 000000000..a1f9c0d40
--- /dev/null
+++ b/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.h
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2011-2022, Intel Corporation
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+//!
+//! \file     media_interfaces_gen12_adln.h
+//! \brief    All interfaces used for Gen12 ADL-N that require factory creation
+//!
+
+#ifndef __MEDIA_INTERFACES_G12_adln_H__
+#define __MEDIA_INTERFACES_G12_adln_H__
+
+
+#include "media_interfaces_g12_tgllp.h"
+#include "renderhal_g12_base.h"
+
+
+class CMHalInterfacesG12Adln : public CMHalDevice
+{
+protected:
+    using CMHal = CM_HAL_G12_X;
+    MOS_STATUS Initialize(
+        CM_HAL_STATE *pCmState);
+};
+
+#endif // __MEDIA_INTERFACES_G12_adln_H__
+
diff --git a/media_driver/media_interface/media_interfaces_m12_adln/media_srcs.cmake b/media_driver/media_interface/media_interfaces_m12_adln/media_srcs.cmake
new file mode 100644
index 000000000..834c2298a
--- /dev/null
+++ b/media_driver/media_interface/media_interfaces_m12_adln/media_srcs.cmake
@@ -0,0 +1,49 @@
+# Copyright (c) 2022, Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+
+set(TMP_SOURCES_
+    ${CMAKE_CURRENT_LIST_DIR}/media_interfaces_g12_adln.cpp
+)
+
+set(TMP_HEADERS_
+    ${CMAKE_CURRENT_LIST_DIR}/media_interfaces_g12_adln.h
+)
+
+set(SOURCES_
+    ${SOURCES_}
+    ${TMP_SOURCES_}
+)
+
+set(HEADERS_
+    ${HEADERS_}
+    ${TMP_HEADERS_}
+)
+
+set(COMMON_SOURCES_
+    ${COMMON_SOURCES_}
+    ${TMP_SOURCES_}
+)
+
+set(COMMON_HEADERS_
+    ${COMMON_HEADERS_}
+    ${TMP_HEADERS_}
+)
+
+media_add_curr_to_include_path()
diff --git a/media_driver/media_interface/media_srcs.cmake b/media_driver/media_interface/media_srcs.cmake
index e4cb114d8..dfa7aa3f1 100644
--- a/media_driver/media_interface/media_srcs.cmake
+++ b/media_driver/media_interface/media_srcs.cmake
@@ -75,6 +75,10 @@ if(GEN12_ADLP)
     media_include_subdirectory(media_interfaces_m12_adlp)
 endif()
 
+if(GEN12_ADLN)
+    media_include_subdirectory(media_interfaces_m12_adln)
+endif()
+
 if(XEHP_SDV)
     media_include_subdirectory(media_interfaces_xehp_sdv)
 endif()
-- 
2.34.1