xref: /aosp_15_r20/external/intel-media-driver/media_softlet/linux/common/os/linux_system_info.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2017-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 #ifndef __LINUX_MEDIA_SYS_INFO_H__
23 #define __LINUX_MEDIA_SYS_INFO_H__
24 
25 #include <stdint.h>
26 #include <stdbool.h>
27 #include <memory>
28 #include "linux_shadow_skuwa.h"
29 
30 namespace MediaUserSetting {
31     class MediaUserSetting;
32     class Value;
33 };
34 
35 using MediaUserSettingSharedPtr = std::shared_ptr<MediaUserSetting::MediaUserSetting>;
36 
37 #ifndef ENABLE_KERNELS
38 #define SET_STATUS_BY_FULL_OPEN_SOURCE(sts_not_full_open_source, sts_if_full_open_source)   0
39 #elif defined(_FULL_OPEN_SOURCE)
40 #define SET_STATUS_BY_FULL_OPEN_SOURCE(sts_not_full_open_source, sts_if_full_open_source)   (sts_if_full_open_source)
41 #else
42 #define SET_STATUS_BY_FULL_OPEN_SOURCE(sts_not_full_open_source, sts_if_full_open_source)   (sts_not_full_open_source)
43 #endif
44 
45 struct LinuxDriverInfo
46 {
47     uint32_t euCount;
48     uint32_t subSliceCount;
49     uint32_t sliceCount; //Derived from subsliceCount
50     uint32_t devId;
51     uint32_t devRev;  //Revision ID of Graphics device
52     uint32_t hasBsd   : 1;
53     uint32_t hasBsd2  : 1;
54     uint32_t hasVebox : 1;
55     uint32_t hasBltRing : 1;
56     uint32_t hasHuc   : 1;
57     uint32_t hasProtectedHuc : 1;
58     uint32_t hasPpgtt : 1;
59     uint32_t hasPreemption : 1;
60     uint32_t isServer : 1;
61 };
62 
63 struct LinuxCodecInfo
64 {
65     uint32_t avcDecoding    : 1;
66     uint32_t mpeg2Decoding  : 1;
67     uint32_t vp8Decoding    : 1;
68     uint32_t vc1Decoding    : 1;
69     uint32_t jpegDecoding   : 1;
70     uint32_t avcEncoding    : 1;
71     uint32_t mpeg2Encoding  : 1;
72     uint32_t hevcDecoding   : 1;
73     uint32_t hevcEncoding   : 1;
74     uint32_t jpegEncoding   : 1;
75     uint32_t avcVdenc       : 1;
76     uint32_t vp9Decoding    : 1;
77     uint32_t hevc10Decoding : 1;
78     uint32_t vp9b10Decoding : 1;
79     uint32_t hevc10Encoding : 1;
80     uint32_t hevc12Encoding : 1;
81     uint32_t vp8Encoding    : 1;
82     uint32_t hevcVdenc      : 1;
83     uint32_t vp9Vdenc       : 1;
84     uint32_t adv0Decoding   : 1;
85     uint32_t adv1Decoding   : 1;
86 };
87 
88 struct GfxDeviceInfo
89 {
90     uint32_t  platformType;
91     uint32_t  productFamily;
92     uint32_t  displayFamily;
93     uint32_t  renderFamily;
94     uint32_t  mediaFamily;
95     uint32_t  eGTType;
96     uint32_t  L3CacheSizeInKb;
97     uint32_t  L3BankCount;
98     uint32_t  EUCount;
99     uint32_t  SliceCount;
100     uint32_t  SubSliceCount;
101     uint32_t  MaxEuPerSubSlice;
102     uint32_t  isLCIA : 1;
103     uint32_t  hasLLC  : 1;
104     uint32_t  hasERAM : 1;
105     bool (*InitMediaSysInfo)(struct GfxDeviceInfo *, MEDIA_GT_SYSTEM_INFO *);
106     bool (*InitShadowSku)(struct GfxDeviceInfo *, SHADOW_MEDIA_FEATURE_TABLE *, struct LinuxDriverInfo *);
107     bool (*InitShadowWa)(struct GfxDeviceInfo *, SHADOW_MEDIA_WA_TABLE *, struct LinuxDriverInfo *);
108 };
109 
110 class MediaFeatureTable;
111 class MediaWaTable;
112 
113 struct LinuxDeviceInit
114 {
115     uint32_t productFamily;
116     bool (*InitMediaFeature)(struct GfxDeviceInfo *, MediaFeatureTable *, struct LinuxDriverInfo *, MediaUserSettingSharedPtr userSettingPtr);
117     bool (*InitMediaWa)(struct GfxDeviceInfo *, MediaWaTable *, struct LinuxDriverInfo *);
118 };
119 
120 #define MEDIA_EXT_FLAG  0x10000000
121 
122 #endif //__LINUX_MEDIA_SYS_INFO_H__
123