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
29 #include "gen_device_info.h"
30 #include "compiler/shader_enums.h"
31 #include "util/macros.h"
34 * Get the PCI ID for the device name.
36 * Returns -1 if the device is not known.
39 gen_device_name_to_pci_device_id(const char *name
)
63 for (unsigned i
= 0; i
< ARRAY_SIZE(name_map
); i
++) {
64 if (!strcmp(name_map
[i
].name
, name
))
65 return name_map
[i
].pci_id
;
72 * Get the overridden PCI ID for the device. This is set with the
73 * INTEL_DEVID_OVERRIDE environment variable.
75 * Returns -1 if the override is not set.
78 gen_get_pci_device_id_override(void)
80 if (geteuid() == getuid()) {
81 const char *devid_override
= getenv("INTEL_DEVID_OVERRIDE");
83 const int id
= gen_device_name_to_pci_device_id(devid_override
);
84 return id
>= 0 ? id
: strtol(devid_override
, NULL
, 0);
91 static const struct gen_device_info gen_device_info_i965
= {
93 .has_negative_rhw_bug
= true,
95 .num_subslices
= { 1, },
96 .num_thread_per_eu
= 4,
99 .max_wm_threads
= 8 * 4,
103 .timestamp_frequency
= 12500000,
106 static const struct gen_device_info gen_device_info_g4x
= {
110 .has_surface_tile_offset
= true,
113 .num_subslices
= { 1, },
114 .num_thread_per_eu
= 5,
115 .max_vs_threads
= 32,
117 .max_wm_threads
= 10 * 5,
121 .timestamp_frequency
= 12500000,
124 static const struct gen_device_info gen_device_info_ilk
= {
128 .has_surface_tile_offset
= true,
130 .num_subslices
= { 1, },
131 .num_thread_per_eu
= 6,
132 .max_vs_threads
= 72,
133 .max_gs_threads
= 32,
134 .max_wm_threads
= 12 * 6,
138 .timestamp_frequency
= 12500000,
141 static const struct gen_device_info gen_device_info_snb_gt1
= {
144 .has_hiz_and_separate_stencil
= true,
147 .has_surface_tile_offset
= true,
148 .needs_unlit_centroid_workaround
= true,
150 .num_subslices
= { 1, },
151 .num_thread_per_eu
= 6, /* Not confirmed */
152 .max_vs_threads
= 24,
153 .max_gs_threads
= 21, /* conservative; 24 if rendering disabled. */
154 .max_wm_threads
= 40,
158 [MESA_SHADER_VERTEX
] = 24,
161 [MESA_SHADER_VERTEX
] = 256,
162 [MESA_SHADER_GEOMETRY
] = 256,
165 .timestamp_frequency
= 12500000,
168 static const struct gen_device_info gen_device_info_snb_gt2
= {
171 .has_hiz_and_separate_stencil
= true,
174 .has_surface_tile_offset
= true,
175 .needs_unlit_centroid_workaround
= true,
177 .num_subslices
= { 1, },
178 .num_thread_per_eu
= 6, /* Not confirmed */
179 .max_vs_threads
= 60,
180 .max_gs_threads
= 60,
181 .max_wm_threads
= 80,
185 [MESA_SHADER_VERTEX
] = 24,
188 [MESA_SHADER_VERTEX
] = 256,
189 [MESA_SHADER_GEOMETRY
] = 256,
192 .timestamp_frequency
= 12500000,
195 #define GEN7_FEATURES \
197 .has_hiz_and_separate_stencil = true, \
198 .must_use_separate_stencil = true, \
201 .has_64bit_types = true, \
202 .has_surface_tile_offset = true, \
203 .timestamp_frequency = 12500000
205 static const struct gen_device_info gen_device_info_ivb_gt1
= {
206 GEN7_FEATURES
, .is_ivybridge
= true, .gt
= 1,
208 .num_subslices
= { 1, },
209 .num_thread_per_eu
= 6,
211 .max_vs_threads
= 36,
212 .max_tcs_threads
= 36,
213 .max_tes_threads
= 36,
214 .max_gs_threads
= 36,
215 .max_wm_threads
= 48,
216 .max_cs_threads
= 36,
220 [MESA_SHADER_VERTEX
] = 32,
221 [MESA_SHADER_TESS_EVAL
] = 10,
224 [MESA_SHADER_VERTEX
] = 512,
225 [MESA_SHADER_TESS_CTRL
] = 32,
226 [MESA_SHADER_TESS_EVAL
] = 288,
227 [MESA_SHADER_GEOMETRY
] = 192,
232 static const struct gen_device_info gen_device_info_ivb_gt2
= {
233 GEN7_FEATURES
, .is_ivybridge
= true, .gt
= 2,
235 .num_subslices
= { 1, },
236 .num_thread_per_eu
= 8, /* Not sure why this isn't a multiple of
237 * @max_wm_threads ... */
239 .max_vs_threads
= 128,
240 .max_tcs_threads
= 128,
241 .max_tes_threads
= 128,
242 .max_gs_threads
= 128,
243 .max_wm_threads
= 172,
244 .max_cs_threads
= 64,
248 [MESA_SHADER_VERTEX
] = 32,
249 [MESA_SHADER_TESS_EVAL
] = 10,
252 [MESA_SHADER_VERTEX
] = 704,
253 [MESA_SHADER_TESS_CTRL
] = 64,
254 [MESA_SHADER_TESS_EVAL
] = 448,
255 [MESA_SHADER_GEOMETRY
] = 320,
260 static const struct gen_device_info gen_device_info_byt
= {
261 GEN7_FEATURES
, .is_baytrail
= true, .gt
= 1,
263 .num_subslices
= { 1, },
264 .num_thread_per_eu
= 8,
267 .max_vs_threads
= 36,
268 .max_tcs_threads
= 36,
269 .max_tes_threads
= 36,
270 .max_gs_threads
= 36,
271 .max_wm_threads
= 48,
272 .max_cs_threads
= 32,
276 [MESA_SHADER_VERTEX
] = 32,
277 [MESA_SHADER_TESS_EVAL
] = 10,
280 [MESA_SHADER_VERTEX
] = 512,
281 [MESA_SHADER_TESS_CTRL
] = 32,
282 [MESA_SHADER_TESS_EVAL
] = 288,
283 [MESA_SHADER_GEOMETRY
] = 192,
288 #define HSW_FEATURES \
290 .is_haswell = true, \
291 .supports_simd16_3src = true, \
292 .has_resource_streamer = true
294 static const struct gen_device_info gen_device_info_hsw_gt1
= {
295 HSW_FEATURES
, .gt
= 1,
297 .num_subslices
= { 1, },
298 .num_thread_per_eu
= 7,
300 .max_vs_threads
= 70,
301 .max_tcs_threads
= 70,
302 .max_tes_threads
= 70,
303 .max_gs_threads
= 70,
304 .max_wm_threads
= 102,
305 .max_cs_threads
= 70,
309 [MESA_SHADER_VERTEX
] = 32,
310 [MESA_SHADER_TESS_EVAL
] = 10,
313 [MESA_SHADER_VERTEX
] = 640,
314 [MESA_SHADER_TESS_CTRL
] = 64,
315 [MESA_SHADER_TESS_EVAL
] = 384,
316 [MESA_SHADER_GEOMETRY
] = 256,
321 static const struct gen_device_info gen_device_info_hsw_gt2
= {
322 HSW_FEATURES
, .gt
= 2,
324 .num_subslices
= { 2, },
325 .num_thread_per_eu
= 7,
327 .max_vs_threads
= 280,
328 .max_tcs_threads
= 256,
329 .max_tes_threads
= 280,
330 .max_gs_threads
= 256,
331 .max_wm_threads
= 204,
332 .max_cs_threads
= 70,
336 [MESA_SHADER_VERTEX
] = 64,
337 [MESA_SHADER_TESS_EVAL
] = 10,
340 [MESA_SHADER_VERTEX
] = 1664,
341 [MESA_SHADER_TESS_CTRL
] = 128,
342 [MESA_SHADER_TESS_EVAL
] = 960,
343 [MESA_SHADER_GEOMETRY
] = 640,
348 static const struct gen_device_info gen_device_info_hsw_gt3
= {
349 HSW_FEATURES
, .gt
= 3,
351 .num_subslices
= { 2, },
352 .num_thread_per_eu
= 7,
354 .max_vs_threads
= 280,
355 .max_tcs_threads
= 256,
356 .max_tes_threads
= 280,
357 .max_gs_threads
= 256,
358 .max_wm_threads
= 408,
359 .max_cs_threads
= 70,
363 [MESA_SHADER_VERTEX
] = 64,
364 [MESA_SHADER_TESS_EVAL
] = 10,
367 [MESA_SHADER_VERTEX
] = 1664,
368 [MESA_SHADER_TESS_CTRL
] = 128,
369 [MESA_SHADER_TESS_EVAL
] = 960,
370 [MESA_SHADER_GEOMETRY
] = 640,
375 /* It's unclear how well supported sampling from the hiz buffer is on GEN8,
376 * so keep things conservative for now and set has_sample_with_hiz = false.
378 #define GEN8_FEATURES \
380 .has_hiz_and_separate_stencil = true, \
381 .has_resource_streamer = true, \
382 .must_use_separate_stencil = true, \
384 .has_sample_with_hiz = false, \
386 .has_integer_dword_mul = true, \
387 .has_64bit_types = true, \
388 .supports_simd16_3src = true, \
389 .has_surface_tile_offset = true, \
390 .max_vs_threads = 504, \
391 .max_tcs_threads = 504, \
392 .max_tes_threads = 504, \
393 .max_gs_threads = 504, \
394 .max_wm_threads = 384, \
395 .timestamp_frequency = 12500000
397 static const struct gen_device_info gen_device_info_bdw_gt1
= {
398 GEN8_FEATURES
, .gt
= 1,
399 .is_broadwell
= true,
401 .num_subslices
= { 2, },
402 .num_thread_per_eu
= 7,
404 .max_cs_threads
= 42,
408 [MESA_SHADER_VERTEX
] = 64,
409 [MESA_SHADER_TESS_EVAL
] = 34,
412 [MESA_SHADER_VERTEX
] = 2560,
413 [MESA_SHADER_TESS_CTRL
] = 504,
414 [MESA_SHADER_TESS_EVAL
] = 1536,
415 [MESA_SHADER_GEOMETRY
] = 960,
420 static const struct gen_device_info gen_device_info_bdw_gt2
= {
421 GEN8_FEATURES
, .gt
= 2,
422 .is_broadwell
= true,
424 .num_subslices
= { 3, },
425 .num_thread_per_eu
= 7,
427 .max_cs_threads
= 56,
431 [MESA_SHADER_VERTEX
] = 64,
432 [MESA_SHADER_TESS_EVAL
] = 34,
435 [MESA_SHADER_VERTEX
] = 2560,
436 [MESA_SHADER_TESS_CTRL
] = 504,
437 [MESA_SHADER_TESS_EVAL
] = 1536,
438 [MESA_SHADER_GEOMETRY
] = 960,
443 static const struct gen_device_info gen_device_info_bdw_gt3
= {
444 GEN8_FEATURES
, .gt
= 3,
445 .is_broadwell
= true,
447 .num_subslices
= { 3, 3, },
448 .num_thread_per_eu
= 7,
450 .max_cs_threads
= 56,
454 [MESA_SHADER_VERTEX
] = 64,
455 [MESA_SHADER_TESS_EVAL
] = 34,
458 [MESA_SHADER_VERTEX
] = 2560,
459 [MESA_SHADER_TESS_CTRL
] = 504,
460 [MESA_SHADER_TESS_EVAL
] = 1536,
461 [MESA_SHADER_GEOMETRY
] = 960,
466 static const struct gen_device_info gen_device_info_chv
= {
467 GEN8_FEATURES
, .is_cherryview
= 1, .gt
= 1,
469 .has_integer_dword_mul
= false,
471 .num_subslices
= { 2, },
472 .num_thread_per_eu
= 7,
474 .max_vs_threads
= 80,
475 .max_tcs_threads
= 80,
476 .max_tes_threads
= 80,
477 .max_gs_threads
= 80,
478 .max_wm_threads
= 128,
479 .max_cs_threads
= 6 * 7,
483 [MESA_SHADER_VERTEX
] = 34,
484 [MESA_SHADER_TESS_EVAL
] = 34,
487 [MESA_SHADER_VERTEX
] = 640,
488 [MESA_SHADER_TESS_CTRL
] = 80,
489 [MESA_SHADER_TESS_EVAL
] = 384,
490 [MESA_SHADER_GEOMETRY
] = 256,
495 #define GEN9_HW_INFO \
497 .max_vs_threads = 336, \
498 .max_gs_threads = 336, \
499 .max_tcs_threads = 336, \
500 .max_tes_threads = 336, \
501 .max_cs_threads = 56, \
502 .timestamp_frequency = 12000000, \
506 [MESA_SHADER_VERTEX] = 64, \
507 [MESA_SHADER_TESS_EVAL] = 34, \
510 [MESA_SHADER_VERTEX] = 1856, \
511 [MESA_SHADER_TESS_CTRL] = 672, \
512 [MESA_SHADER_TESS_EVAL] = 1120, \
513 [MESA_SHADER_GEOMETRY] = 640, \
517 #define GEN9_LP_FEATURES \
520 .has_integer_dword_mul = false, \
523 .has_sample_with_hiz = true, \
525 .num_thread_per_eu = 6, \
526 .max_vs_threads = 112, \
527 .max_tcs_threads = 112, \
528 .max_tes_threads = 112, \
529 .max_gs_threads = 112, \
530 .max_cs_threads = 6 * 6, \
531 .timestamp_frequency = 19200000, \
535 [MESA_SHADER_VERTEX] = 34, \
536 [MESA_SHADER_TESS_EVAL] = 34, \
539 [MESA_SHADER_VERTEX] = 704, \
540 [MESA_SHADER_TESS_CTRL] = 256, \
541 [MESA_SHADER_TESS_EVAL] = 416, \
542 [MESA_SHADER_GEOMETRY] = 256, \
546 #define GEN9_LP_FEATURES_3X6 \
548 .num_subslices = { 3, }
550 #define GEN9_LP_FEATURES_2X6 \
552 .num_subslices = { 2, }, \
553 .max_vs_threads = 56, \
554 .max_tcs_threads = 56, \
555 .max_tes_threads = 56, \
556 .max_gs_threads = 56, \
557 .max_cs_threads = 6 * 6, \
561 [MESA_SHADER_VERTEX] = 34, \
562 [MESA_SHADER_TESS_EVAL] = 34, \
565 [MESA_SHADER_VERTEX] = 352, \
566 [MESA_SHADER_TESS_CTRL] = 128, \
567 [MESA_SHADER_TESS_EVAL] = 208, \
568 [MESA_SHADER_GEOMETRY] = 128, \
572 #define GEN9_FEATURES \
575 .has_sample_with_hiz = true, \
576 .num_thread_per_eu = 7
578 static const struct gen_device_info gen_device_info_skl_gt1
= {
579 GEN9_FEATURES
, .gt
= 1,
582 .num_subslices
= { 2, },
587 static const struct gen_device_info gen_device_info_skl_gt2
= {
588 GEN9_FEATURES
, .gt
= 2,
591 .num_subslices
= { 3, },
595 static const struct gen_device_info gen_device_info_skl_gt3
= {
596 GEN9_FEATURES
, .gt
= 3,
599 .num_subslices
= { 3, 3, },
603 static const struct gen_device_info gen_device_info_skl_gt4
= {
604 GEN9_FEATURES
, .gt
= 4,
607 .num_subslices
= { 3, 3, 3, },
609 /* From the "L3 Allocation and Programming" documentation:
611 * "URB is limited to 1008KB due to programming restrictions. This is not a
612 * restriction of the L3 implementation, but of the FF and other clients.
613 * Therefore, in a GT4 implementation it is possible for the programmed
614 * allocation of the L3 data array to provide 3*384KB=1152KB for URB, but
615 * only 1008KB of this will be used."
617 .urb
.size
= 1008 / 3,
620 static const struct gen_device_info gen_device_info_bxt
= {
621 GEN9_LP_FEATURES_3X6
,
626 static const struct gen_device_info gen_device_info_bxt_2x6
= {
627 GEN9_LP_FEATURES_2X6
,
632 * Note: for all KBL SKUs, the PRM says SKL for GS entries, not SKL+.
633 * There's no KBL entry. Using the default SKL (GEN9) GS entries value.
636 static const struct gen_device_info gen_device_info_kbl_gt1
= {
641 .max_cs_threads
= 7 * 6,
644 .num_subslices
= { 2, },
648 static const struct gen_device_info gen_device_info_kbl_gt1_5
= {
653 .max_cs_threads
= 7 * 6,
655 .num_subslices
= { 3, },
659 static const struct gen_device_info gen_device_info_kbl_gt2
= {
665 .num_subslices
= { 3, },
669 static const struct gen_device_info gen_device_info_kbl_gt3
= {
675 .num_subslices
= { 3, 3, },
679 static const struct gen_device_info gen_device_info_kbl_gt4
= {
685 * From the "L3 Allocation and Programming" documentation:
687 * "URB is limited to 1008KB due to programming restrictions. This
688 * is not a restriction of the L3 implementation, but of the FF and
689 * other clients. Therefore, in a GT4 implementation it is
690 * possible for the programmed allocation of the L3 data array to
691 * provide 3*384KB=1152KB for URB, but only 1008KB of this
694 .urb
.size
= 1008 / 3,
696 .num_subslices
= { 3, 3, 3, },
700 static const struct gen_device_info gen_device_info_glk
= {
701 GEN9_LP_FEATURES_3X6
,
702 .is_geminilake
= true,
706 /*TODO: Initialize l3_banks when we know the number. */
707 static const struct gen_device_info gen_device_info_glk_2x6
= {
708 GEN9_LP_FEATURES_2X6
,
709 .is_geminilake
= true,
712 static const struct gen_device_info gen_device_info_cfl_gt1
= {
714 .is_coffeelake
= true,
718 .num_subslices
= { 2, },
721 static const struct gen_device_info gen_device_info_cfl_gt2
= {
723 .is_coffeelake
= true,
727 .num_subslices
= { 3, },
731 static const struct gen_device_info gen_device_info_cfl_gt3
= {
733 .is_coffeelake
= true,
737 .num_subslices
= { 3, 3, },
741 #define GEN10_HW_INFO \
743 .num_thread_per_eu = 7, \
744 .max_vs_threads = 728, \
745 .max_gs_threads = 432, \
746 .max_tcs_threads = 432, \
747 .max_tes_threads = 624, \
748 .max_cs_threads = 56, \
749 .timestamp_frequency = 19200000, \
753 [MESA_SHADER_VERTEX] = 64, \
754 [MESA_SHADER_TESS_EVAL] = 34, \
757 [MESA_SHADER_VERTEX] = 3936, \
758 [MESA_SHADER_TESS_CTRL] = 896, \
759 [MESA_SHADER_TESS_EVAL] = 2064, \
760 [MESA_SHADER_GEOMETRY] = 832, \
764 #define subslices(args...) { args, }
766 #define GEN10_FEATURES(_gt, _slices, _subslices, _l3) \
769 .has_sample_with_hiz = true, \
771 .num_slices = _slices, \
772 .num_subslices = _subslices, \
775 static const struct gen_device_info gen_device_info_cnl_2x8
= {
777 GEN10_FEATURES(1, 1, subslices(2), 2),
778 .is_cannonlake
= true,
781 static const struct gen_device_info gen_device_info_cnl_3x8
= {
783 GEN10_FEATURES(1, 1, subslices(3), 3),
784 .is_cannonlake
= true,
787 static const struct gen_device_info gen_device_info_cnl_4x8
= {
789 GEN10_FEATURES(1, 2, subslices(2, 2), 6),
790 .is_cannonlake
= true,
793 static const struct gen_device_info gen_device_info_cnl_5x8
= {
795 GEN10_FEATURES(2, 2, subslices(3, 2), 6),
796 .is_cannonlake
= true,
799 #define GEN11_HW_INFO \
802 .max_vs_threads = 364, \
803 .max_gs_threads = 224, \
804 .max_tcs_threads = 224, \
805 .max_tes_threads = 364, \
806 .max_cs_threads = 56, \
810 [MESA_SHADER_VERTEX] = 64, \
811 [MESA_SHADER_TESS_EVAL] = 34, \
814 [MESA_SHADER_VERTEX] = 2384, \
815 [MESA_SHADER_TESS_CTRL] = 1032, \
816 [MESA_SHADER_TESS_EVAL] = 2384, \
817 [MESA_SHADER_GEOMETRY] = 1032, \
821 #define GEN11_FEATURES(_gt, _slices, _subslices, _l3) \
824 .has_64bit_types = false, \
825 .has_integer_dword_mul = false, \
826 .has_sample_with_hiz = false, \
827 .gt = _gt, .num_slices = _slices, .l3_banks = _l3, \
828 .num_subslices = _subslices
830 static const struct gen_device_info gen_device_info_icl_8x8
= {
831 GEN11_FEATURES(2, 1, subslices(8), 8),
834 static const struct gen_device_info gen_device_info_icl_6x8
= {
835 GEN11_FEATURES(1, 1, subslices(6), 6),
838 static const struct gen_device_info gen_device_info_icl_4x8
= {
839 GEN11_FEATURES(1, 1, subslices(4), 6),
842 static const struct gen_device_info gen_device_info_icl_1x8
= {
843 GEN11_FEATURES(1, 1, subslices(1), 6),
847 gen_get_device_info(int devid
, struct gen_device_info
*devinfo
)
851 #define CHIPSET(id, family, name) \
852 case id: *devinfo = gen_device_info_##family; break;
853 #include "pci_ids/i965_pci_ids.h"
855 fprintf(stderr
, "i965_dri.so does not support the 0x%x PCI ID.\n", devid
);
859 /* From the Skylake PRM, 3DSTATE_PS::Scratch Space Base Pointer:
861 * "Scratch Space per slice is computed based on 4 sub-slices. SW must
862 * allocate scratch space enough so that each slice has 4 slices allowed."
864 * The equivalent internal documentation says that this programming note
865 * applies to all Gen9+ platforms.
867 * The hardware typically calculates the scratch space pointer by taking
868 * the base address, and adding per-thread-scratch-space * thread ID.
869 * Extra padding can be necessary depending how the thread IDs are
870 * calculated for a particular shader stage.
873 switch(devinfo
->gen
) {
876 devinfo
->max_wm_threads
= 64 /* threads-per-PSD */
877 * devinfo
->num_slices
878 * 4; /* effective subslices per slice */
881 devinfo
->max_wm_threads
= 128 /* threads-per-PSD */
882 * devinfo
->num_slices
883 * 8; /* subslices per slice */
889 assert(devinfo
->num_slices
<= ARRAY_SIZE(devinfo
->num_subslices
));
895 gen_get_device_name(int devid
)
899 #define CHIPSET(id, family, name) case id: return name;
900 #include "pci_ids/i965_pci_ids.h"