1 /* 2 * Copyright © 2014-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 (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 * 23 */ 24 25 #ifndef _INTEL_DEVICE_INFO_H_ 26 #define _INTEL_DEVICE_INFO_H_ 27 28 #include <uapi/drm/i915_drm.h> 29 30 #include "intel_display.h" 31 32 struct drm_printer; 33 struct drm_i915_private; 34 35 /* Keep in gen based order, and chronological order within a gen */ 36 enum intel_platform { 37 INTEL_PLATFORM_UNINITIALIZED = 0, 38 /* gen2 */ 39 INTEL_I830, 40 INTEL_I845G, 41 INTEL_I85X, 42 INTEL_I865G, 43 /* gen3 */ 44 INTEL_I915G, 45 INTEL_I915GM, 46 INTEL_I945G, 47 INTEL_I945GM, 48 INTEL_G33, 49 INTEL_PINEVIEW, 50 /* gen4 */ 51 INTEL_I965G, 52 INTEL_I965GM, 53 INTEL_G45, 54 INTEL_GM45, 55 /* gen5 */ 56 INTEL_IRONLAKE, 57 /* gen6 */ 58 INTEL_SANDYBRIDGE, 59 /* gen7 */ 60 INTEL_IVYBRIDGE, 61 INTEL_VALLEYVIEW, 62 INTEL_HASWELL, 63 /* gen8 */ 64 INTEL_BROADWELL, 65 INTEL_CHERRYVIEW, 66 /* gen9 */ 67 INTEL_SKYLAKE, 68 INTEL_BROXTON, 69 INTEL_KABYLAKE, 70 INTEL_GEMINILAKE, 71 INTEL_COFFEELAKE, 72 /* gen10 */ 73 INTEL_CANNONLAKE, 74 /* gen11 */ 75 INTEL_ICELAKE, 76 INTEL_MAX_PLATFORMS 77 }; 78 79 enum intel_ppgtt { 80 INTEL_PPGTT_NONE = I915_GEM_PPGTT_NONE, 81 INTEL_PPGTT_ALIASING = I915_GEM_PPGTT_ALIASING, 82 INTEL_PPGTT_FULL = I915_GEM_PPGTT_FULL, 83 INTEL_PPGTT_FULL_4LVL, 84 }; 85 86 #define DEV_INFO_FOR_EACH_FLAG(func) \ 87 func(is_mobile); \ 88 func(is_lp); \ 89 func(is_alpha_support); \ 90 /* Keep has_* in alphabetical order */ \ 91 func(has_64bit_reloc); \ 92 func(has_reset_engine); \ 93 func(has_fpga_dbg); \ 94 func(has_guc); \ 95 func(has_guc_ct); \ 96 func(has_l3_dpf); \ 97 func(has_llc); \ 98 func(has_logical_ring_contexts); \ 99 func(has_logical_ring_elsq); \ 100 func(has_logical_ring_preemption); \ 101 func(has_pooled_eu); \ 102 func(has_rc6); \ 103 func(has_rc6p); \ 104 func(has_runtime_pm); \ 105 func(has_snoop); \ 106 func(has_coherent_ggtt); \ 107 func(unfenced_needs_alignment); \ 108 func(hws_needs_physical); 109 110 #define DEV_INFO_DISPLAY_FOR_EACH_FLAG(func) \ 111 /* Keep in alphabetical order */ \ 112 func(cursor_needs_physical); \ 113 func(has_csr); \ 114 func(has_ddi); \ 115 func(has_dp_mst); \ 116 func(has_fbc); \ 117 func(has_gmch_display); \ 118 func(has_hotplug); \ 119 func(has_ipc); \ 120 func(has_overlay); \ 121 func(has_psr); \ 122 func(overlay_needs_physical); \ 123 func(supports_tv); 124 125 #define GEN_MAX_SLICES (6) /* CNL upper bound */ 126 #define GEN_MAX_SUBSLICES (8) /* ICL upper bound */ 127 128 struct sseu_dev_info { 129 u8 slice_mask; 130 u8 subslice_mask[GEN_MAX_SLICES]; 131 u16 eu_total; 132 u8 eu_per_subslice; 133 u8 min_eu_in_pool; 134 /* For each slice, which subslice(s) has(have) 7 EUs (bitfield)? */ 135 u8 subslice_7eu[3]; 136 u8 has_slice_pg:1; 137 u8 has_subslice_pg:1; 138 u8 has_eu_pg:1; 139 140 /* Topology fields */ 141 u8 max_slices; 142 u8 max_subslices; 143 u8 max_eus_per_subslice; 144 145 /* We don't have more than 8 eus per subslice at the moment and as we 146 * store eus enabled using bits, no need to multiply by eus per 147 * subslice. 148 */ 149 u8 eu_mask[GEN_MAX_SLICES * GEN_MAX_SUBSLICES]; 150 }; 151 152 typedef u8 intel_ring_mask_t; 153 154 struct intel_device_info { 155 u16 device_id; 156 u16 gen_mask; 157 158 u8 gen; 159 u8 gt; /* GT number, 0 if undefined */ 160 u8 num_rings; 161 intel_ring_mask_t ring_mask; /* Rings supported by the HW */ 162 163 enum intel_platform platform; 164 u32 platform_mask; 165 166 enum intel_ppgtt ppgtt; 167 unsigned int page_sizes; /* page sizes supported by the HW */ 168 169 u32 display_mmio_offset; 170 171 u8 num_pipes; 172 u8 num_sprites[I915_MAX_PIPES]; 173 u8 num_scalers[I915_MAX_PIPES]; 174 175 #define DEFINE_FLAG(name) u8 name:1 176 DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG); 177 #undef DEFINE_FLAG 178 179 struct { 180 #define DEFINE_FLAG(name) u8 name:1 181 DEV_INFO_DISPLAY_FOR_EACH_FLAG(DEFINE_FLAG); 182 #undef DEFINE_FLAG 183 } display; 184 185 u16 ddb_size; /* in blocks */ 186 187 /* Register offsets for the various display pipes and transcoders */ 188 int pipe_offsets[I915_MAX_TRANSCODERS]; 189 int trans_offsets[I915_MAX_TRANSCODERS]; 190 int cursor_offsets[I915_MAX_PIPES]; 191 192 /* Slice/subslice/EU info */ 193 struct sseu_dev_info sseu; 194 195 u32 cs_timestamp_frequency_khz; 196 197 /* Enabled (not fused off) media engine bitmasks. */ 198 u8 vdbox_enable; 199 u8 vebox_enable; 200 201 struct color_luts { 202 u16 degamma_lut_size; 203 u16 gamma_lut_size; 204 } color; 205 }; 206 207 struct intel_driver_caps { 208 unsigned int scheduler; 209 bool has_logical_contexts:1; 210 }; 211 212 static inline unsigned int sseu_subslice_total(const struct sseu_dev_info *sseu) 213 { 214 unsigned int i, total = 0; 215 216 for (i = 0; i < ARRAY_SIZE(sseu->subslice_mask); i++) 217 total += hweight8(sseu->subslice_mask[i]); 218 219 return total; 220 } 221 222 static inline int sseu_eu_idx(const struct sseu_dev_info *sseu, 223 int slice, int subslice) 224 { 225 int subslice_stride = DIV_ROUND_UP(sseu->max_eus_per_subslice, 226 BITS_PER_BYTE); 227 int slice_stride = sseu->max_subslices * subslice_stride; 228 229 return slice * slice_stride + subslice * subslice_stride; 230 } 231 232 static inline u16 sseu_get_eus(const struct sseu_dev_info *sseu, 233 int slice, int subslice) 234 { 235 int i, offset = sseu_eu_idx(sseu, slice, subslice); 236 u16 eu_mask = 0; 237 238 for (i = 0; 239 i < DIV_ROUND_UP(sseu->max_eus_per_subslice, BITS_PER_BYTE); i++) { 240 eu_mask |= ((u16) sseu->eu_mask[offset + i]) << 241 (i * BITS_PER_BYTE); 242 } 243 244 return eu_mask; 245 } 246 247 static inline void sseu_set_eus(struct sseu_dev_info *sseu, 248 int slice, int subslice, u16 eu_mask) 249 { 250 int i, offset = sseu_eu_idx(sseu, slice, subslice); 251 252 for (i = 0; 253 i < DIV_ROUND_UP(sseu->max_eus_per_subslice, BITS_PER_BYTE); i++) { 254 sseu->eu_mask[offset + i] = 255 (eu_mask >> (BITS_PER_BYTE * i)) & 0xff; 256 } 257 } 258 259 const char *intel_platform_name(enum intel_platform platform); 260 261 void intel_device_info_runtime_init(struct intel_device_info *info); 262 void intel_device_info_dump(const struct intel_device_info *info, 263 struct drm_printer *p); 264 void intel_device_info_dump_flags(const struct intel_device_info *info, 265 struct drm_printer *p); 266 void intel_device_info_dump_runtime(const struct intel_device_info *info, 267 struct drm_printer *p); 268 void intel_device_info_dump_topology(const struct sseu_dev_info *sseu, 269 struct drm_printer *p); 270 271 void intel_device_info_init_mmio(struct drm_i915_private *dev_priv); 272 273 void intel_driver_caps_print(const struct intel_driver_caps *caps, 274 struct drm_printer *p); 275 276 #endif 277