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