intel_device_info.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. #ifndef _INTEL_DEVICE_INFO_H_
  25. #define _INTEL_DEVICE_INFO_H_
  26. #include "intel_display.h"
  27. struct drm_printer;
  28. struct drm_i915_private;
  29. /* Keep in gen based order, and chronological order within a gen */
  30. enum intel_platform {
  31. INTEL_PLATFORM_UNINITIALIZED = 0,
  32. /* gen2 */
  33. INTEL_I830,
  34. INTEL_I845G,
  35. INTEL_I85X,
  36. INTEL_I865G,
  37. /* gen3 */
  38. INTEL_I915G,
  39. INTEL_I915GM,
  40. INTEL_I945G,
  41. INTEL_I945GM,
  42. INTEL_G33,
  43. INTEL_PINEVIEW,
  44. /* gen4 */
  45. INTEL_I965G,
  46. INTEL_I965GM,
  47. INTEL_G45,
  48. INTEL_GM45,
  49. /* gen5 */
  50. INTEL_IRONLAKE,
  51. /* gen6 */
  52. INTEL_SANDYBRIDGE,
  53. /* gen7 */
  54. INTEL_IVYBRIDGE,
  55. INTEL_VALLEYVIEW,
  56. INTEL_HASWELL,
  57. /* gen8 */
  58. INTEL_BROADWELL,
  59. INTEL_CHERRYVIEW,
  60. /* gen9 */
  61. INTEL_SKYLAKE,
  62. INTEL_BROXTON,
  63. INTEL_KABYLAKE,
  64. INTEL_GEMINILAKE,
  65. INTEL_COFFEELAKE,
  66. /* gen10 */
  67. INTEL_CANNONLAKE,
  68. /* gen11 */
  69. INTEL_ICELAKE,
  70. INTEL_MAX_PLATFORMS
  71. };
  72. #define DEV_INFO_FOR_EACH_FLAG(func) \
  73. func(is_mobile); \
  74. func(is_lp); \
  75. func(is_alpha_support); \
  76. /* Keep has_* in alphabetical order */ \
  77. func(has_64bit_reloc); \
  78. func(has_aliasing_ppgtt); \
  79. func(has_csr); \
  80. func(has_ddi); \
  81. func(has_dp_mst); \
  82. func(has_reset_engine); \
  83. func(has_fbc); \
  84. func(has_fpga_dbg); \
  85. func(has_full_ppgtt); \
  86. func(has_full_48bit_ppgtt); \
  87. func(has_gmch_display); \
  88. func(has_guc); \
  89. func(has_guc_ct); \
  90. func(has_hotplug); \
  91. func(has_l3_dpf); \
  92. func(has_llc); \
  93. func(has_logical_ring_contexts); \
  94. func(has_logical_ring_elsq); \
  95. func(has_logical_ring_preemption); \
  96. func(has_overlay); \
  97. func(has_pooled_eu); \
  98. func(has_psr); \
  99. func(has_rc6); \
  100. func(has_rc6p); \
  101. func(has_resource_streamer); \
  102. func(has_runtime_pm); \
  103. func(has_snoop); \
  104. func(unfenced_needs_alignment); \
  105. func(cursor_needs_physical); \
  106. func(hws_needs_physical); \
  107. func(overlay_needs_physical); \
  108. func(supports_tv); \
  109. func(has_ipc);
  110. #define GEN_MAX_SLICES (6) /* CNL upper bound */
  111. #define GEN_MAX_SUBSLICES (8) /* ICL upper bound */
  112. struct sseu_dev_info {
  113. u8 slice_mask;
  114. u8 subslice_mask[GEN_MAX_SUBSLICES];
  115. u16 eu_total;
  116. u8 eu_per_subslice;
  117. u8 min_eu_in_pool;
  118. /* For each slice, which subslice(s) has(have) 7 EUs (bitfield)? */
  119. u8 subslice_7eu[3];
  120. u8 has_slice_pg:1;
  121. u8 has_subslice_pg:1;
  122. u8 has_eu_pg:1;
  123. /* Topology fields */
  124. u8 max_slices;
  125. u8 max_subslices;
  126. u8 max_eus_per_subslice;
  127. /* We don't have more than 8 eus per subslice at the moment and as we
  128. * store eus enabled using bits, no need to multiply by eus per
  129. * subslice.
  130. */
  131. u8 eu_mask[GEN_MAX_SLICES * GEN_MAX_SUBSLICES];
  132. };
  133. typedef u8 intel_ring_mask_t;
  134. struct intel_device_info {
  135. u16 device_id;
  136. u16 gen_mask;
  137. u8 gen;
  138. u8 gt; /* GT number, 0 if undefined */
  139. u8 num_rings;
  140. intel_ring_mask_t ring_mask; /* Rings supported by the HW */
  141. enum intel_platform platform;
  142. u32 platform_mask;
  143. unsigned int page_sizes; /* page sizes supported by the HW */
  144. u32 display_mmio_offset;
  145. u8 num_pipes;
  146. u8 num_sprites[I915_MAX_PIPES];
  147. u8 num_scalers[I915_MAX_PIPES];
  148. #define DEFINE_FLAG(name) u8 name:1
  149. DEV_INFO_FOR_EACH_FLAG(DEFINE_FLAG);
  150. #undef DEFINE_FLAG
  151. u16 ddb_size; /* in blocks */
  152. /* Register offsets for the various display pipes and transcoders */
  153. int pipe_offsets[I915_MAX_TRANSCODERS];
  154. int trans_offsets[I915_MAX_TRANSCODERS];
  155. int palette_offsets[I915_MAX_PIPES];
  156. int cursor_offsets[I915_MAX_PIPES];
  157. /* Slice/subslice/EU info */
  158. struct sseu_dev_info sseu;
  159. u32 cs_timestamp_frequency_khz;
  160. struct color_luts {
  161. u16 degamma_lut_size;
  162. u16 gamma_lut_size;
  163. } color;
  164. };
  165. struct intel_driver_caps {
  166. unsigned int scheduler;
  167. };
  168. static inline unsigned int sseu_subslice_total(const struct sseu_dev_info *sseu)
  169. {
  170. unsigned int i, total = 0;
  171. for (i = 0; i < ARRAY_SIZE(sseu->subslice_mask); i++)
  172. total += hweight8(sseu->subslice_mask[i]);
  173. return total;
  174. }
  175. static inline int sseu_eu_idx(const struct sseu_dev_info *sseu,
  176. int slice, int subslice)
  177. {
  178. int subslice_stride = DIV_ROUND_UP(sseu->max_eus_per_subslice,
  179. BITS_PER_BYTE);
  180. int slice_stride = sseu->max_subslices * subslice_stride;
  181. return slice * slice_stride + subslice * subslice_stride;
  182. }
  183. static inline u16 sseu_get_eus(const struct sseu_dev_info *sseu,
  184. int slice, int subslice)
  185. {
  186. int i, offset = sseu_eu_idx(sseu, slice, subslice);
  187. u16 eu_mask = 0;
  188. for (i = 0;
  189. i < DIV_ROUND_UP(sseu->max_eus_per_subslice, BITS_PER_BYTE); i++) {
  190. eu_mask |= ((u16) sseu->eu_mask[offset + i]) <<
  191. (i * BITS_PER_BYTE);
  192. }
  193. return eu_mask;
  194. }
  195. static inline void sseu_set_eus(struct sseu_dev_info *sseu,
  196. int slice, int subslice, u16 eu_mask)
  197. {
  198. int i, offset = sseu_eu_idx(sseu, slice, subslice);
  199. for (i = 0;
  200. i < DIV_ROUND_UP(sseu->max_eus_per_subslice, BITS_PER_BYTE); i++) {
  201. sseu->eu_mask[offset + i] =
  202. (eu_mask >> (BITS_PER_BYTE * i)) & 0xff;
  203. }
  204. }
  205. const char *intel_platform_name(enum intel_platform platform);
  206. void intel_device_info_runtime_init(struct intel_device_info *info);
  207. void intel_device_info_dump(const struct intel_device_info *info,
  208. struct drm_printer *p);
  209. void intel_device_info_dump_flags(const struct intel_device_info *info,
  210. struct drm_printer *p);
  211. void intel_device_info_dump_runtime(const struct intel_device_info *info,
  212. struct drm_printer *p);
  213. void intel_device_info_dump_topology(const struct sseu_dev_info *sseu,
  214. struct drm_printer *p);
  215. void intel_device_info_init_mmio(struct drm_i915_private *dev_priv);
  216. void intel_driver_caps_print(const struct intel_driver_caps *caps,
  217. struct drm_printer *p);
  218. #endif