2 * Copyright © 2013 Intel Corporation
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:
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
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
30 #include "gen_device_info.h"
31 #include "compiler/shader_enums.h"
32 #include "util/bitscan.h"
33 #include "util/macros.h"
35 #include "drm-uapi/i915_drm.h"
38 * Get the PCI ID for the device name.
40 * Returns -1 if the device is not known.
43 gen_device_name_to_pci_device_id(const char *name
)
70 for (unsigned i
= 0; i
< ARRAY_SIZE(name_map
); i
++) {
71 if (!strcmp(name_map
[i
].name
, name
))
72 return name_map
[i
].pci_id
;
79 * Get the overridden PCI ID for the device. This is set with the
80 * INTEL_DEVID_OVERRIDE environment variable.
82 * Returns -1 if the override is not set.
85 gen_get_pci_device_id_override(void)
87 if (geteuid() == getuid()) {
88 const char *devid_override
= getenv("INTEL_DEVID_OVERRIDE");
90 const int id
= gen_device_name_to_pci_device_id(devid_override
);
91 return id
>= 0 ? id
: strtol(devid_override
, NULL
, 0);
98 static const struct gen_device_info gen_device_info_i965
= {
100 .has_negative_rhw_bug
= true,
102 .num_subslices
= { 1, },
103 .num_eu_per_subslice
= 8,
104 .num_thread_per_eu
= 4,
105 .max_vs_threads
= 16,
107 .max_wm_threads
= 8 * 4,
111 .timestamp_frequency
= 12500000,
115 static const struct gen_device_info gen_device_info_g4x
= {
119 .has_surface_tile_offset
= true,
122 .num_subslices
= { 1, },
123 .num_eu_per_subslice
= 10,
124 .num_thread_per_eu
= 5,
125 .max_vs_threads
= 32,
127 .max_wm_threads
= 10 * 5,
131 .timestamp_frequency
= 12500000,
135 static const struct gen_device_info gen_device_info_ilk
= {
139 .has_surface_tile_offset
= true,
141 .num_subslices
= { 1, },
142 .num_eu_per_subslice
= 12,
143 .num_thread_per_eu
= 6,
144 .max_vs_threads
= 72,
145 .max_gs_threads
= 32,
146 .max_wm_threads
= 12 * 6,
150 .timestamp_frequency
= 12500000,
154 static const struct gen_device_info gen_device_info_snb_gt1
= {
157 .has_hiz_and_separate_stencil
= true,
160 .has_surface_tile_offset
= true,
161 .needs_unlit_centroid_workaround
= true,
163 .num_subslices
= { 1, },
164 .num_eu_per_subslice
= 6,
165 .num_thread_per_eu
= 6, /* Not confirmed */
166 .max_vs_threads
= 24,
167 .max_gs_threads
= 21, /* conservative; 24 if rendering disabled. */
168 .max_wm_threads
= 40,
172 [MESA_SHADER_VERTEX
] = 24,
175 [MESA_SHADER_VERTEX
] = 256,
176 [MESA_SHADER_GEOMETRY
] = 256,
179 .timestamp_frequency
= 12500000,
183 static const struct gen_device_info gen_device_info_snb_gt2
= {
186 .has_hiz_and_separate_stencil
= true,
189 .has_surface_tile_offset
= true,
190 .needs_unlit_centroid_workaround
= true,
192 .num_subslices
= { 1, },
193 .num_eu_per_subslice
= 12,
194 .num_thread_per_eu
= 6, /* Not confirmed */
195 .max_vs_threads
= 60,
196 .max_gs_threads
= 60,
197 .max_wm_threads
= 80,
201 [MESA_SHADER_VERTEX
] = 24,
204 [MESA_SHADER_VERTEX
] = 256,
205 [MESA_SHADER_GEOMETRY
] = 256,
208 .timestamp_frequency
= 12500000,
212 #define GEN7_FEATURES \
214 .has_hiz_and_separate_stencil = true, \
215 .must_use_separate_stencil = true, \
218 .has_64bit_types = true, \
219 .has_surface_tile_offset = true, \
220 .timestamp_frequency = 12500000
222 static const struct gen_device_info gen_device_info_ivb_gt1
= {
223 GEN7_FEATURES
, .is_ivybridge
= true, .gt
= 1,
225 .num_subslices
= { 1, },
226 .num_eu_per_subslice
= 6,
227 .num_thread_per_eu
= 6,
229 .max_vs_threads
= 36,
230 .max_tcs_threads
= 36,
231 .max_tes_threads
= 36,
232 .max_gs_threads
= 36,
233 .max_wm_threads
= 48,
234 .max_cs_threads
= 36,
238 [MESA_SHADER_VERTEX
] = 32,
239 [MESA_SHADER_TESS_EVAL
] = 10,
242 [MESA_SHADER_VERTEX
] = 512,
243 [MESA_SHADER_TESS_CTRL
] = 32,
244 [MESA_SHADER_TESS_EVAL
] = 288,
245 [MESA_SHADER_GEOMETRY
] = 192,
251 static const struct gen_device_info gen_device_info_ivb_gt2
= {
252 GEN7_FEATURES
, .is_ivybridge
= true, .gt
= 2,
254 .num_subslices
= { 1, },
255 .num_eu_per_subslice
= 12,
256 .num_thread_per_eu
= 8, /* Not sure why this isn't a multiple of
257 * @max_wm_threads ... */
259 .max_vs_threads
= 128,
260 .max_tcs_threads
= 128,
261 .max_tes_threads
= 128,
262 .max_gs_threads
= 128,
263 .max_wm_threads
= 172,
264 .max_cs_threads
= 64,
268 [MESA_SHADER_VERTEX
] = 32,
269 [MESA_SHADER_TESS_EVAL
] = 10,
272 [MESA_SHADER_VERTEX
] = 704,
273 [MESA_SHADER_TESS_CTRL
] = 64,
274 [MESA_SHADER_TESS_EVAL
] = 448,
275 [MESA_SHADER_GEOMETRY
] = 320,
281 static const struct gen_device_info gen_device_info_byt
= {
282 GEN7_FEATURES
, .is_baytrail
= true, .gt
= 1,
284 .num_subslices
= { 1, },
285 .num_eu_per_subslice
= 4,
286 .num_thread_per_eu
= 8,
289 .max_vs_threads
= 36,
290 .max_tcs_threads
= 36,
291 .max_tes_threads
= 36,
292 .max_gs_threads
= 36,
293 .max_wm_threads
= 48,
294 .max_cs_threads
= 32,
298 [MESA_SHADER_VERTEX
] = 32,
299 [MESA_SHADER_TESS_EVAL
] = 10,
302 [MESA_SHADER_VERTEX
] = 512,
303 [MESA_SHADER_TESS_CTRL
] = 32,
304 [MESA_SHADER_TESS_EVAL
] = 288,
305 [MESA_SHADER_GEOMETRY
] = 192,
311 #define HSW_FEATURES \
313 .is_haswell = true, \
314 .supports_simd16_3src = true, \
315 .has_resource_streamer = true
317 static const struct gen_device_info gen_device_info_hsw_gt1
= {
318 HSW_FEATURES
, .gt
= 1,
320 .num_subslices
= { 1, },
321 .num_eu_per_subslice
= 10,
322 .num_thread_per_eu
= 7,
324 .max_vs_threads
= 70,
325 .max_tcs_threads
= 70,
326 .max_tes_threads
= 70,
327 .max_gs_threads
= 70,
328 .max_wm_threads
= 102,
329 .max_cs_threads
= 70,
333 [MESA_SHADER_VERTEX
] = 32,
334 [MESA_SHADER_TESS_EVAL
] = 10,
337 [MESA_SHADER_VERTEX
] = 640,
338 [MESA_SHADER_TESS_CTRL
] = 64,
339 [MESA_SHADER_TESS_EVAL
] = 384,
340 [MESA_SHADER_GEOMETRY
] = 256,
346 static const struct gen_device_info gen_device_info_hsw_gt2
= {
347 HSW_FEATURES
, .gt
= 2,
349 .num_subslices
= { 2, },
350 .num_eu_per_subslice
= 10,
351 .num_thread_per_eu
= 7,
353 .max_vs_threads
= 280,
354 .max_tcs_threads
= 256,
355 .max_tes_threads
= 280,
356 .max_gs_threads
= 256,
357 .max_wm_threads
= 204,
358 .max_cs_threads
= 70,
362 [MESA_SHADER_VERTEX
] = 64,
363 [MESA_SHADER_TESS_EVAL
] = 10,
366 [MESA_SHADER_VERTEX
] = 1664,
367 [MESA_SHADER_TESS_CTRL
] = 128,
368 [MESA_SHADER_TESS_EVAL
] = 960,
369 [MESA_SHADER_GEOMETRY
] = 640,
375 static const struct gen_device_info gen_device_info_hsw_gt3
= {
376 HSW_FEATURES
, .gt
= 3,
378 .num_subslices
= { 2, },
379 .num_eu_per_subslice
= 10,
380 .num_thread_per_eu
= 7,
382 .max_vs_threads
= 280,
383 .max_tcs_threads
= 256,
384 .max_tes_threads
= 280,
385 .max_gs_threads
= 256,
386 .max_wm_threads
= 408,
387 .max_cs_threads
= 70,
391 [MESA_SHADER_VERTEX
] = 64,
392 [MESA_SHADER_TESS_EVAL
] = 10,
395 [MESA_SHADER_VERTEX
] = 1664,
396 [MESA_SHADER_TESS_CTRL
] = 128,
397 [MESA_SHADER_TESS_EVAL
] = 960,
398 [MESA_SHADER_GEOMETRY
] = 640,
404 /* It's unclear how well supported sampling from the hiz buffer is on GEN8,
405 * so keep things conservative for now and set has_sample_with_hiz = false.
407 #define GEN8_FEATURES \
409 .has_hiz_and_separate_stencil = true, \
410 .has_resource_streamer = true, \
411 .must_use_separate_stencil = true, \
413 .has_sample_with_hiz = false, \
415 .has_integer_dword_mul = true, \
416 .has_64bit_types = true, \
417 .supports_simd16_3src = true, \
418 .has_surface_tile_offset = true, \
419 .num_thread_per_eu = 7, \
420 .max_vs_threads = 504, \
421 .max_tcs_threads = 504, \
422 .max_tes_threads = 504, \
423 .max_gs_threads = 504, \
424 .max_wm_threads = 384, \
425 .timestamp_frequency = 12500000
427 static const struct gen_device_info gen_device_info_bdw_gt1
= {
428 GEN8_FEATURES
, .gt
= 1,
429 .is_broadwell
= true,
431 .num_subslices
= { 2, },
432 .num_eu_per_subslice
= 8,
434 .max_cs_threads
= 42,
438 [MESA_SHADER_VERTEX
] = 64,
439 [MESA_SHADER_TESS_EVAL
] = 34,
442 [MESA_SHADER_VERTEX
] = 2560,
443 [MESA_SHADER_TESS_CTRL
] = 504,
444 [MESA_SHADER_TESS_EVAL
] = 1536,
445 [MESA_SHADER_GEOMETRY
] = 960,
451 static const struct gen_device_info gen_device_info_bdw_gt2
= {
452 GEN8_FEATURES
, .gt
= 2,
453 .is_broadwell
= true,
455 .num_subslices
= { 3, },
456 .num_eu_per_subslice
= 8,
458 .max_cs_threads
= 56,
462 [MESA_SHADER_VERTEX
] = 64,
463 [MESA_SHADER_TESS_EVAL
] = 34,
466 [MESA_SHADER_VERTEX
] = 2560,
467 [MESA_SHADER_TESS_CTRL
] = 504,
468 [MESA_SHADER_TESS_EVAL
] = 1536,
469 [MESA_SHADER_GEOMETRY
] = 960,
475 static const struct gen_device_info gen_device_info_bdw_gt3
= {
476 GEN8_FEATURES
, .gt
= 3,
477 .is_broadwell
= true,
479 .num_subslices
= { 3, 3, },
480 .num_eu_per_subslice
= 8,
482 .max_cs_threads
= 56,
486 [MESA_SHADER_VERTEX
] = 64,
487 [MESA_SHADER_TESS_EVAL
] = 34,
490 [MESA_SHADER_VERTEX
] = 2560,
491 [MESA_SHADER_TESS_CTRL
] = 504,
492 [MESA_SHADER_TESS_EVAL
] = 1536,
493 [MESA_SHADER_GEOMETRY
] = 960,
499 static const struct gen_device_info gen_device_info_chv
= {
500 GEN8_FEATURES
, .is_cherryview
= 1, .gt
= 1,
502 .has_integer_dword_mul
= false,
504 .num_subslices
= { 2, },
505 .num_eu_per_subslice
= 8,
507 .max_vs_threads
= 80,
508 .max_tcs_threads
= 80,
509 .max_tes_threads
= 80,
510 .max_gs_threads
= 80,
511 .max_wm_threads
= 128,
512 .max_cs_threads
= 6 * 7,
516 [MESA_SHADER_VERTEX
] = 34,
517 [MESA_SHADER_TESS_EVAL
] = 34,
520 [MESA_SHADER_VERTEX
] = 640,
521 [MESA_SHADER_TESS_CTRL
] = 80,
522 [MESA_SHADER_TESS_EVAL
] = 384,
523 [MESA_SHADER_GEOMETRY
] = 256,
529 #define GEN9_HW_INFO \
531 .max_vs_threads = 336, \
532 .max_gs_threads = 336, \
533 .max_tcs_threads = 336, \
534 .max_tes_threads = 336, \
535 .max_cs_threads = 56, \
536 .timestamp_frequency = 12000000, \
540 [MESA_SHADER_VERTEX] = 64, \
541 [MESA_SHADER_TESS_EVAL] = 34, \
544 [MESA_SHADER_VERTEX] = 1856, \
545 [MESA_SHADER_TESS_CTRL] = 672, \
546 [MESA_SHADER_TESS_EVAL] = 1120, \
547 [MESA_SHADER_GEOMETRY] = 640, \
551 #define GEN9_LP_FEATURES \
554 .has_integer_dword_mul = false, \
557 .has_sample_with_hiz = true, \
559 .num_thread_per_eu = 6, \
560 .max_vs_threads = 112, \
561 .max_tcs_threads = 112, \
562 .max_tes_threads = 112, \
563 .max_gs_threads = 112, \
564 .max_cs_threads = 6 * 6, \
565 .timestamp_frequency = 19200000, \
569 [MESA_SHADER_VERTEX] = 34, \
570 [MESA_SHADER_TESS_EVAL] = 34, \
573 [MESA_SHADER_VERTEX] = 704, \
574 [MESA_SHADER_TESS_CTRL] = 256, \
575 [MESA_SHADER_TESS_EVAL] = 416, \
576 [MESA_SHADER_GEOMETRY] = 256, \
580 #define GEN9_LP_FEATURES_3X6 \
582 .num_subslices = { 3, }, \
583 .num_eu_per_subslice = 6
585 #define GEN9_LP_FEATURES_2X6 \
587 .num_subslices = { 2, }, \
588 .num_eu_per_subslice = 6, \
589 .max_vs_threads = 56, \
590 .max_tcs_threads = 56, \
591 .max_tes_threads = 56, \
592 .max_gs_threads = 56, \
593 .max_cs_threads = 6 * 6, \
597 [MESA_SHADER_VERTEX] = 34, \
598 [MESA_SHADER_TESS_EVAL] = 34, \
601 [MESA_SHADER_VERTEX] = 352, \
602 [MESA_SHADER_TESS_CTRL] = 128, \
603 [MESA_SHADER_TESS_EVAL] = 208, \
604 [MESA_SHADER_GEOMETRY] = 128, \
608 #define GEN9_FEATURES \
611 .has_sample_with_hiz = true
613 static const struct gen_device_info gen_device_info_skl_gt1
= {
614 GEN9_FEATURES
, .gt
= 1,
617 .num_subslices
= { 2, },
618 .num_eu_per_subslice
= 6,
621 /* GT1 seems to have a bug in the top of the pipe (VF/VS?) fixed functions
622 * leading to some vertices to go missing if we use too much URB.
624 .urb
.max_entries
[MESA_SHADER_VERTEX
] = 928,
628 static const struct gen_device_info gen_device_info_skl_gt2
= {
629 GEN9_FEATURES
, .gt
= 2,
632 .num_subslices
= { 3, },
633 .num_eu_per_subslice
= 8,
638 static const struct gen_device_info gen_device_info_skl_gt3
= {
639 GEN9_FEATURES
, .gt
= 3,
642 .num_subslices
= { 3, 3, },
643 .num_eu_per_subslice
= 8,
648 static const struct gen_device_info gen_device_info_skl_gt4
= {
649 GEN9_FEATURES
, .gt
= 4,
652 .num_subslices
= { 3, 3, 3, },
653 .num_eu_per_subslice
= 8,
655 /* From the "L3 Allocation and Programming" documentation:
657 * "URB is limited to 1008KB due to programming restrictions. This is not a
658 * restriction of the L3 implementation, but of the FF and other clients.
659 * Therefore, in a GT4 implementation it is possible for the programmed
660 * allocation of the L3 data array to provide 3*384KB=1152KB for URB, but
661 * only 1008KB of this will be used."
663 .urb
.size
= 1008 / 3,
667 static const struct gen_device_info gen_device_info_bxt
= {
668 GEN9_LP_FEATURES_3X6
,
674 static const struct gen_device_info gen_device_info_bxt_2x6
= {
675 GEN9_LP_FEATURES_2X6
,
681 * Note: for all KBL SKUs, the PRM says SKL for GS entries, not SKL+.
682 * There's no KBL entry. Using the default SKL (GEN9) GS entries value.
685 static const struct gen_device_info gen_device_info_kbl_gt1
= {
690 .max_cs_threads
= 7 * 6,
693 .num_subslices
= { 2, },
694 .num_eu_per_subslice
= 6,
696 /* GT1 seems to have a bug in the top of the pipe (VF/VS?) fixed functions
697 * leading to some vertices to go missing if we use too much URB.
699 .urb
.max_entries
[MESA_SHADER_VERTEX
] = 928,
703 static const struct gen_device_info gen_device_info_kbl_gt1_5
= {
708 .max_cs_threads
= 7 * 6,
710 .num_subslices
= { 3, },
711 .num_eu_per_subslice
= 6,
716 static const struct gen_device_info gen_device_info_kbl_gt2
= {
722 .num_subslices
= { 3, },
723 .num_eu_per_subslice
= 8,
728 static const struct gen_device_info gen_device_info_kbl_gt3
= {
734 .num_subslices
= { 3, 3, },
735 .num_eu_per_subslice
= 8,
740 static const struct gen_device_info gen_device_info_kbl_gt4
= {
746 * From the "L3 Allocation and Programming" documentation:
748 * "URB is limited to 1008KB due to programming restrictions. This
749 * is not a restriction of the L3 implementation, but of the FF and
750 * other clients. Therefore, in a GT4 implementation it is
751 * possible for the programmed allocation of the L3 data array to
752 * provide 3*384KB=1152KB for URB, but only 1008KB of this
755 .urb
.size
= 1008 / 3,
757 .num_subslices
= { 3, 3, 3, },
758 .num_eu_per_subslice
= 8,
763 static const struct gen_device_info gen_device_info_glk
= {
764 GEN9_LP_FEATURES_3X6
,
765 .is_geminilake
= true,
770 static const struct gen_device_info gen_device_info_glk_2x6
= {
771 GEN9_LP_FEATURES_2X6
,
772 .is_geminilake
= true,
777 static const struct gen_device_info gen_device_info_cfl_gt1
= {
779 .is_coffeelake
= true,
783 .num_subslices
= { 2, },
784 .num_eu_per_subslice
= 6,
787 /* GT1 seems to have a bug in the top of the pipe (VF/VS?) fixed functions
788 * leading to some vertices to go missing if we use too much URB.
790 .urb
.max_entries
[MESA_SHADER_VERTEX
] = 928,
793 static const struct gen_device_info gen_device_info_cfl_gt2
= {
795 .is_coffeelake
= true,
799 .num_subslices
= { 3, },
800 .num_eu_per_subslice
= 8,
805 static const struct gen_device_info gen_device_info_cfl_gt3
= {
807 .is_coffeelake
= true,
811 .num_subslices
= { 3, 3, },
812 .num_eu_per_subslice
= 8,
817 #define GEN10_HW_INFO \
819 .num_thread_per_eu = 7, \
820 .max_vs_threads = 728, \
821 .max_gs_threads = 432, \
822 .max_tcs_threads = 432, \
823 .max_tes_threads = 624, \
824 .max_cs_threads = 56, \
825 .timestamp_frequency = 19200000, \
829 [MESA_SHADER_VERTEX] = 64, \
830 [MESA_SHADER_TESS_EVAL] = 34, \
833 [MESA_SHADER_VERTEX] = 3936, \
834 [MESA_SHADER_TESS_CTRL] = 896, \
835 [MESA_SHADER_TESS_EVAL] = 2064, \
836 [MESA_SHADER_GEOMETRY] = 832, \
840 #define subslices(args...) { args, }
842 #define GEN10_FEATURES(_gt, _slices, _subslices, _l3) \
845 .has_sample_with_hiz = true, \
847 .num_slices = _slices, \
848 .num_subslices = _subslices, \
849 .num_eu_per_subslice = 8, \
852 static const struct gen_device_info gen_device_info_cnl_2x8
= {
854 GEN10_FEATURES(1, 1, subslices(2), 2),
855 .is_cannonlake
= true,
859 static const struct gen_device_info gen_device_info_cnl_3x8
= {
861 GEN10_FEATURES(1, 1, subslices(3), 3),
862 .is_cannonlake
= true,
866 static const struct gen_device_info gen_device_info_cnl_4x8
= {
868 GEN10_FEATURES(1, 2, subslices(2, 2), 6),
869 .is_cannonlake
= true,
873 static const struct gen_device_info gen_device_info_cnl_5x8
= {
875 GEN10_FEATURES(2, 2, subslices(3, 2), 6),
876 .is_cannonlake
= true,
880 #define GEN11_HW_INFO \
883 .max_vs_threads = 364, \
884 .max_gs_threads = 224, \
885 .max_tcs_threads = 224, \
886 .max_tes_threads = 364, \
889 #define GEN11_FEATURES(_gt, _slices, _subslices, _l3) \
892 .has_64bit_types = false, \
893 .has_integer_dword_mul = false, \
894 .has_sample_with_hiz = false, \
895 .gt = _gt, .num_slices = _slices, .l3_banks = _l3, \
896 .num_subslices = _subslices, \
897 .num_eu_per_subslice = 8
899 #define GEN11_URB_MIN_MAX_ENTRIES \
901 [MESA_SHADER_VERTEX] = 64, \
902 [MESA_SHADER_TESS_EVAL] = 34, \
905 [MESA_SHADER_VERTEX] = 2384, \
906 [MESA_SHADER_TESS_CTRL] = 1032, \
907 [MESA_SHADER_TESS_EVAL] = 2384, \
908 [MESA_SHADER_GEOMETRY] = 1032, \
911 static const struct gen_device_info gen_device_info_icl_8x8
= {
912 GEN11_FEATURES(2, 1, subslices(8), 8),
915 GEN11_URB_MIN_MAX_ENTRIES
,
920 static const struct gen_device_info gen_device_info_icl_6x8
= {
921 GEN11_FEATURES(1, 1, subslices(6), 6),
924 GEN11_URB_MIN_MAX_ENTRIES
,
929 static const struct gen_device_info gen_device_info_icl_4x8
= {
930 GEN11_FEATURES(1, 1, subslices(4), 6),
933 GEN11_URB_MIN_MAX_ENTRIES
,
938 static const struct gen_device_info gen_device_info_icl_1x8
= {
939 GEN11_FEATURES(1, 1, subslices(1), 6),
942 GEN11_URB_MIN_MAX_ENTRIES
,
947 static const struct gen_device_info gen_device_info_ehl_4x8
= {
948 GEN11_FEATURES(1, 1, subslices(4), 4),
952 [MESA_SHADER_VERTEX
] = 64,
953 [MESA_SHADER_TESS_EVAL
] = 34,
956 [MESA_SHADER_VERTEX
] = 2384,
957 [MESA_SHADER_TESS_CTRL
] = 1032,
958 [MESA_SHADER_TESS_EVAL
] = 2384,
959 [MESA_SHADER_GEOMETRY
] = 1032,
962 .disable_ccs_repack
= true,
966 /* FIXME: Verfiy below entries when more information is available for this SKU.
968 static const struct gen_device_info gen_device_info_ehl_4x4
= {
969 GEN11_FEATURES(1, 1, subslices(4), 4),
973 [MESA_SHADER_VERTEX
] = 64,
974 [MESA_SHADER_TESS_EVAL
] = 34,
977 [MESA_SHADER_VERTEX
] = 2384,
978 [MESA_SHADER_TESS_CTRL
] = 1032,
979 [MESA_SHADER_TESS_EVAL
] = 2384,
980 [MESA_SHADER_GEOMETRY
] = 1032,
983 .disable_ccs_repack
= true,
984 .num_eu_per_subslice
= 4,
988 /* FIXME: Verfiy below entries when more information is available for this SKU.
990 static const struct gen_device_info gen_device_info_ehl_2x4
= {
991 GEN11_FEATURES(1, 1, subslices(2), 4),
995 [MESA_SHADER_VERTEX
] = 64,
996 [MESA_SHADER_TESS_EVAL
] = 34,
999 [MESA_SHADER_VERTEX
] = 2384,
1000 [MESA_SHADER_TESS_CTRL
] = 1032,
1001 [MESA_SHADER_TESS_EVAL
] = 2384,
1002 [MESA_SHADER_GEOMETRY
] = 1032,
1005 .disable_ccs_repack
= true,
1006 .num_eu_per_subslice
=4,
1011 gen_device_info_set_eu_mask(struct gen_device_info
*devinfo
,
1016 unsigned subslice_offset
= slice
* devinfo
->eu_slice_stride
+
1017 subslice
* devinfo
->eu_subslice_stride
;
1019 for (unsigned b_eu
= 0; b_eu
< devinfo
->eu_subslice_stride
; b_eu
++) {
1020 devinfo
->eu_masks
[subslice_offset
+ b_eu
] =
1021 (((1U << devinfo
->num_eu_per_subslice
) - 1) >> (b_eu
* 8)) & 0xff;
1025 /* Generate slice/subslice/eu masks from number of
1026 * slices/subslices/eu_per_subslices in the per generation/gt gen_device_info
1029 * These can be overridden with values reported by the kernel either from
1030 * getparam SLICE_MASK/SUBSLICE_MASK values or from the kernel version 4.17+
1031 * through the i915 query uapi.
1034 fill_masks(struct gen_device_info
*devinfo
)
1036 devinfo
->slice_masks
= (1U << devinfo
->num_slices
) - 1;
1038 /* Subslice masks */
1039 unsigned max_subslices
= 0;
1040 for (int s
= 0; s
< devinfo
->num_slices
; s
++)
1041 max_subslices
= MAX2(devinfo
->num_subslices
[s
], max_subslices
);
1042 devinfo
->subslice_slice_stride
= DIV_ROUND_UP(max_subslices
, 8);
1044 for (int s
= 0; s
< devinfo
->num_slices
; s
++) {
1045 devinfo
->subslice_masks
[s
* devinfo
->subslice_slice_stride
] =
1046 (1U << devinfo
->num_subslices
[s
]) - 1;
1050 devinfo
->eu_subslice_stride
= DIV_ROUND_UP(devinfo
->num_eu_per_subslice
, 8);
1051 devinfo
->eu_slice_stride
= max_subslices
* devinfo
->eu_subslice_stride
;
1053 for (int s
= 0; s
< devinfo
->num_slices
; s
++) {
1054 for (int ss
= 0; ss
< devinfo
->num_subslices
[s
]; ss
++) {
1055 gen_device_info_set_eu_mask(devinfo
, s
, ss
,
1056 (1U << devinfo
->num_eu_per_subslice
) - 1);
1062 gen_device_info_update_from_masks(struct gen_device_info
*devinfo
,
1063 uint32_t slice_mask
,
1064 uint32_t subslice_mask
,
1067 struct drm_i915_query_topology_info
*topology
;
1069 assert((slice_mask
& 0xff) == slice_mask
);
1071 size_t data_length
= 100;
1073 topology
= calloc(1, sizeof(*topology
) + data_length
);
1077 topology
->max_slices
= util_last_bit(slice_mask
);
1078 topology
->max_subslices
= util_last_bit(subslice_mask
);
1080 topology
->subslice_offset
= DIV_ROUND_UP(topology
->max_slices
, 8);
1081 topology
->subslice_stride
= DIV_ROUND_UP(topology
->max_subslices
, 8);
1083 uint32_t n_subslices
= __builtin_popcount(slice_mask
) *
1084 __builtin_popcount(subslice_mask
);
1085 uint32_t num_eu_per_subslice
= DIV_ROUND_UP(n_eus
, n_subslices
);
1086 uint32_t eu_mask
= (1U << num_eu_per_subslice
) - 1;
1088 topology
->eu_offset
= topology
->subslice_offset
+
1089 DIV_ROUND_UP(topology
->max_subslices
, 8);
1090 topology
->eu_stride
= DIV_ROUND_UP(num_eu_per_subslice
, 8);
1092 /* Set slice mask in topology */
1093 for (int b
= 0; b
< topology
->subslice_offset
; b
++)
1094 topology
->data
[b
] = (slice_mask
>> (b
* 8)) & 0xff;
1096 for (int s
= 0; s
< topology
->max_slices
; s
++) {
1098 /* Set subslice mask in topology */
1099 for (int b
= 0; b
< topology
->subslice_stride
; b
++) {
1100 int subslice_offset
= topology
->subslice_offset
+
1101 s
* topology
->subslice_stride
+ b
;
1103 topology
->data
[subslice_offset
] = (subslice_mask
>> (b
* 8)) & 0xff;
1106 /* Set eu mask in topology */
1107 for (int ss
= 0; ss
< topology
->max_subslices
; ss
++) {
1108 for (int b
= 0; b
< topology
->eu_stride
; b
++) {
1109 int eu_offset
= topology
->eu_offset
+
1110 (s
* topology
->max_subslices
+ ss
) * topology
->eu_stride
+ b
;
1112 topology
->data
[eu_offset
] = (eu_mask
>> (b
* 8)) & 0xff;
1117 gen_device_info_update_from_topology(devinfo
, topology
);
1124 reset_masks(struct gen_device_info
*devinfo
)
1126 devinfo
->subslice_slice_stride
= 0;
1127 devinfo
->eu_subslice_stride
= 0;
1128 devinfo
->eu_slice_stride
= 0;
1130 devinfo
->num_slices
= 0;
1131 devinfo
->num_eu_per_subslice
= 0;
1132 memset(devinfo
->num_subslices
, 0, sizeof(devinfo
->num_subslices
));
1134 memset(&devinfo
->slice_masks
, 0, sizeof(devinfo
->slice_masks
));
1135 memset(devinfo
->subslice_masks
, 0, sizeof(devinfo
->subslice_masks
));
1136 memset(devinfo
->eu_masks
, 0, sizeof(devinfo
->eu_masks
));
1140 gen_device_info_update_from_topology(struct gen_device_info
*devinfo
,
1141 const struct drm_i915_query_topology_info
*topology
)
1143 reset_masks(devinfo
);
1145 devinfo
->subslice_slice_stride
= topology
->subslice_stride
;
1147 devinfo
->eu_subslice_stride
= DIV_ROUND_UP(topology
->max_eus_per_subslice
, 8);
1148 devinfo
->eu_slice_stride
= topology
->max_subslices
* devinfo
->eu_subslice_stride
;
1150 assert(sizeof(devinfo
->slice_masks
) >= DIV_ROUND_UP(topology
->max_slices
, 8));
1151 memcpy(&devinfo
->slice_masks
, topology
->data
, DIV_ROUND_UP(topology
->max_slices
, 8));
1152 devinfo
->num_slices
= __builtin_popcount(devinfo
->slice_masks
);
1154 uint32_t subslice_mask_len
=
1155 topology
->max_slices
* topology
->subslice_stride
;
1156 assert(sizeof(devinfo
->subslice_masks
) >= subslice_mask_len
);
1157 memcpy(devinfo
->subslice_masks
, &topology
->data
[topology
->subslice_offset
],
1160 uint32_t n_subslices
= 0;
1161 for (int s
= 0; s
< topology
->max_slices
; s
++) {
1162 if ((devinfo
->slice_masks
& (1UL << s
)) == 0)
1165 for (int b
= 0; b
< devinfo
->subslice_slice_stride
; b
++) {
1166 devinfo
->num_subslices
[s
] +=
1167 __builtin_popcount(devinfo
->subslice_masks
[b
]);
1169 n_subslices
+= devinfo
->num_subslices
[s
];
1171 assert(n_subslices
> 0);
1173 uint32_t eu_mask_len
=
1174 topology
->eu_stride
* topology
->max_subslices
* topology
->max_slices
;
1175 assert(sizeof(devinfo
->eu_masks
) >= eu_mask_len
);
1176 memcpy(devinfo
->eu_masks
, &topology
->data
[topology
->eu_offset
], eu_mask_len
);
1179 for (int b
= 0; b
< eu_mask_len
; b
++)
1180 n_eus
+= __builtin_popcount(devinfo
->eu_masks
[b
]);
1182 devinfo
->num_eu_per_subslice
= DIV_ROUND_UP(n_eus
, n_subslices
);
1186 gen_get_device_info(int devid
, struct gen_device_info
*devinfo
)
1190 #define CHIPSET(id, family, name) \
1191 case id: *devinfo = gen_device_info_##family; break;
1192 #include "pci_ids/i965_pci_ids.h"
1194 fprintf(stderr
, "Driver does not support the 0x%x PCI ID.\n", devid
);
1198 fill_masks(devinfo
);
1200 /* From the Skylake PRM, 3DSTATE_PS::Scratch Space Base Pointer:
1202 * "Scratch Space per slice is computed based on 4 sub-slices. SW must
1203 * allocate scratch space enough so that each slice has 4 slices allowed."
1205 * The equivalent internal documentation says that this programming note
1206 * applies to all Gen9+ platforms.
1208 * The hardware typically calculates the scratch space pointer by taking
1209 * the base address, and adding per-thread-scratch-space * thread ID.
1210 * Extra padding can be necessary depending how the thread IDs are
1211 * calculated for a particular shader stage.
1214 switch(devinfo
->gen
) {
1217 devinfo
->max_wm_threads
= 64 /* threads-per-PSD */
1218 * devinfo
->num_slices
1219 * 4; /* effective subslices per slice */
1222 devinfo
->max_wm_threads
= 128 /* threads-per-PSD */
1223 * devinfo
->num_slices
1224 * 8; /* subslices per slice */
1230 assert(devinfo
->num_slices
<= ARRAY_SIZE(devinfo
->num_subslices
));
1236 gen_get_device_name(int devid
)
1240 #define CHIPSET(id, family, name) case id: return name;
1241 #include "pci_ids/i965_pci_ids.h"