i965: Move hardware feature flags to brw_device_info.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_device_info.c
1 /*
2 * Copyright © 2013 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 #include <stdio.h>
25 #include <stdlib.h>
26 #include "brw_device_info.h"
27
28 static const struct brw_device_info brw_device_info_i965 = {
29 .gen = 4,
30 .has_negative_rhw_bug = true,
31 .needs_unlit_centroid_workaround = true,
32 .max_vs_threads = 16,
33 .max_gs_threads = 2,
34 .max_wm_threads = 8 * 4,
35 .urb = {
36 .size = 256,
37 },
38 };
39
40 static const struct brw_device_info brw_device_info_g4x = {
41 .gen = 4,
42 .has_pln = true,
43 .has_compr4 = true,
44 .needs_unlit_centroid_workaround = true,
45 .is_g4x = true,
46 .max_vs_threads = 32,
47 .max_gs_threads = 2,
48 .max_wm_threads = 10 * 5,
49 .urb = {
50 .size = 384,
51 },
52 };
53
54 static const struct brw_device_info brw_device_info_ilk = {
55 .gen = 5,
56 .has_pln = true,
57 .has_compr4 = true,
58 .has_surface_tile_offset = true,
59 .needs_unlit_centroid_workaround = true,
60 .max_vs_threads = 72,
61 .max_gs_threads = 32,
62 .max_wm_threads = 12 * 6,
63 .urb = {
64 .size = 1024,
65 },
66 };
67
68 static const struct brw_device_info brw_device_info_snb_gt1 = {
69 .gen = 6,
70 .gt = 2,
71 .has_hiz_and_separate_stencil = true,
72 .has_llc = true,
73 .has_pln = true,
74 .has_surface_tile_offset = true,
75 .needs_unlit_centroid_workaround = true,
76 .max_vs_threads = 24,
77 .max_gs_threads = 21, /* conservative; 24 if rendering disabled. */
78 .max_wm_threads = 40,
79 .urb = {
80 .size = 32,
81 .min_vs_entries = 24,
82 .max_vs_entries = 256,
83 .max_gs_entries = 256,
84 },
85 };
86
87 static const struct brw_device_info brw_device_info_snb_gt2 = {
88 .gen = 6,
89 .gt = 2,
90 .has_hiz_and_separate_stencil = true,
91 .has_llc = true,
92 .has_pln = true,
93 .has_surface_tile_offset = true,
94 .needs_unlit_centroid_workaround = true,
95 .max_vs_threads = 60,
96 .max_gs_threads = 60,
97 .max_wm_threads = 80,
98 .urb = {
99 .size = 64,
100 .min_vs_entries = 24,
101 .max_vs_entries = 256,
102 .max_gs_entries = 256,
103 },
104 };
105
106 #define GEN7_FEATURES \
107 .gen = 7, \
108 .has_hiz_and_separate_stencil = true, \
109 .must_use_separate_stencil = true, \
110 .has_llc = true, \
111 .has_pln = true, \
112 .has_surface_tile_offset = true, \
113 .needs_unlit_centroid_workaround = true
114
115 static const struct brw_device_info brw_device_info_ivb_gt1 = {
116 GEN7_FEATURES, .is_ivybridge = true, .gt = 1,
117 .max_vs_threads = 36,
118 .max_gs_threads = 36,
119 .max_wm_threads = 48,
120 .urb = {
121 .size = 128,
122 .min_vs_entries = 32,
123 .max_vs_entries = 512,
124 .max_gs_entries = 192,
125 },
126 };
127
128 static const struct brw_device_info brw_device_info_ivb_gt2 = {
129 GEN7_FEATURES, .is_ivybridge = true, .gt = 2,
130 .max_vs_threads = 128,
131 .max_gs_threads = 128,
132 .max_wm_threads = 172,
133 .urb = {
134 .size = 256,
135 .min_vs_entries = 32,
136 .max_vs_entries = 704,
137 .max_gs_entries = 320,
138 },
139 };
140
141 static const struct brw_device_info brw_device_info_byt = {
142 GEN7_FEATURES, .is_baytrail = true, .gt = 1,
143 .has_llc = false,
144 .max_vs_threads = 36,
145 .max_gs_threads = 36,
146 .max_wm_threads = 48,
147 .urb = {
148 .size = 128,
149 .min_vs_entries = 32,
150 .max_vs_entries = 512,
151 .max_gs_entries = 192,
152 },
153 };
154
155 static const struct brw_device_info brw_device_info_hsw_gt1 = {
156 GEN7_FEATURES, .is_haswell = true, .gt = 1,
157 .max_vs_threads = 70,
158 .max_gs_threads = 70,
159 .max_wm_threads = 102,
160 .urb = {
161 .size = 128,
162 .min_vs_entries = 32,
163 .max_vs_entries = 640,
164 .max_gs_entries = 256,
165 },
166 };
167
168 static const struct brw_device_info brw_device_info_hsw_gt2 = {
169 GEN7_FEATURES, .is_haswell = true, .gt = 2,
170 .max_vs_threads = 280,
171 .max_gs_threads = 256,
172 .max_wm_threads = 204,
173 .urb = {
174 .size = 256,
175 .min_vs_entries = 64,
176 .max_vs_entries = 1664,
177 .max_gs_entries = 640,
178 },
179 };
180
181 static const struct brw_device_info brw_device_info_hsw_gt3 = {
182 GEN7_FEATURES, .is_haswell = true, .gt = 3,
183 .max_vs_threads = 280,
184 .max_gs_threads = 256,
185 .max_wm_threads = 408,
186 .urb = {
187 .size = 512,
188 .min_vs_entries = 64,
189 .max_vs_entries = 1664,
190 .max_gs_entries = 640,
191 },
192 };
193
194 const struct brw_device_info *
195 brw_get_device_info(int devid)
196 {
197 switch (devid) {
198 #undef CHIPSET
199 #define CHIPSET(id, family, name) case id: return &brw_device_info_##family;
200 #include "pci_ids/i965_pci_ids.h"
201 default:
202 fprintf(stderr, "Unknown Intel device.");
203 abort();
204 }
205 }