b358433ce2342974a33a1d78175a2fda8db357fe
[mesa.git] / src / gallium / drivers / ilo / genhw / genhw.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
25 #ifndef GENHW_H
26 #define GENHW_H
27
28 #include "pipe/p_compiler.h"
29 #include "util/u_debug.h"
30
31 #include "intel_reg.h"
32 #include "brw_defines.h"
33
34 #include "gen_regs.xml.h"
35 #include "gen_mi.xml.h"
36 #include "gen_blitter.xml.h"
37 #include "gen_render_surface.xml.h"
38 #include "gen_render_dynamic.xml.h"
39 #include "gen_render_3d.xml.h"
40 #include "gen_eu_isa.xml.h"
41 #include "gen_eu_message.xml.h"
42
43 #define GEN_MI_CMD(op) (GEN6_MI_TYPE_MI | GEN6_MI_OPCODE_ ## op)
44
45 #define GEN_BLITTER_CMD(op) \
46 (GEN6_BLITTER_TYPE_BLITTER | GEN6_BLITTER_OPCODE_ ## op)
47
48 #define GEN_RENDER_CMD(subtype, op) \
49 (GEN6_RENDER_TYPE_RENDER | \
50 GEN6_RENDER_SUBTYPE_ ## subtype | \
51 GEN6_RENDER_OPCODE_ ## op)
52
53 static inline bool
54 gen_is_snb(int devid)
55 {
56 return (devid == 0x0102 || /* GT1 desktop */
57 devid == 0x0112 || /* GT2 desktop */
58 devid == 0x0122 || /* GT2_PLUS desktop */
59 devid == 0x0106 || /* GT1 mobile */
60 devid == 0x0116 || /* GT2 mobile */
61 devid == 0x0126 || /* GT2_PLUS mobile */
62 devid == 0x010a); /* GT1 server */
63 }
64
65 static inline int
66 gen_get_snb_gt(int devid)
67 {
68 assert(gen_is_snb(devid));
69 return (devid & 0x30) ? 2 : 1;
70 }
71
72 static inline bool
73 gen_is_ivb(int devid)
74 {
75 return (devid == 0x0152 || /* GT1 desktop */
76 devid == 0x0162 || /* GT2 desktop */
77 devid == 0x0156 || /* GT1 mobile */
78 devid == 0x0166 || /* GT2 mobile */
79 devid == 0x015a || /* GT1 server */
80 devid == 0x016a); /* GT2 server */
81 }
82
83 static inline int
84 gen_get_ivb_gt(int devid)
85 {
86 assert(gen_is_ivb(devid));
87 return (devid & 0x30) >> 4;
88 }
89
90 static inline bool
91 gen_is_hsw(int devid)
92 {
93 return (devid == 0x0402 || /* GT1 desktop */
94 devid == 0x0412 || /* GT2 desktop */
95 devid == 0x0422 || /* GT3 desktop */
96 devid == 0x0406 || /* GT1 mobile */
97 devid == 0x0416 || /* GT2 mobile */
98 devid == 0x0426 || /* GT2 mobile */
99 devid == 0x040a || /* GT1 server */
100 devid == 0x041a || /* GT2 server */
101 devid == 0x042a || /* GT3 server */
102 devid == 0x040b || /* GT1 reserved */
103 devid == 0x041b || /* GT2 reserved */
104 devid == 0x042b || /* GT3 reserved */
105 devid == 0x040e || /* GT1 reserved */
106 devid == 0x041e || /* GT2 reserved */
107 devid == 0x042e || /* GT3 reserved */
108 devid == 0x0c02 || /* SDV */
109 devid == 0x0c12 ||
110 devid == 0x0c22 ||
111 devid == 0x0c06 ||
112 devid == 0x0c16 ||
113 devid == 0x0c26 ||
114 devid == 0x0c0a ||
115 devid == 0x0c1a ||
116 devid == 0x0c2a ||
117 devid == 0x0c0b ||
118 devid == 0x0c1b ||
119 devid == 0x0c2b ||
120 devid == 0x0c0e ||
121 devid == 0x0c1e ||
122 devid == 0x0c2e ||
123 devid == 0x0a02 || /* ULT */
124 devid == 0x0a12 ||
125 devid == 0x0a22 ||
126 devid == 0x0a06 ||
127 devid == 0x0a16 ||
128 devid == 0x0a26 ||
129 devid == 0x0a0a ||
130 devid == 0x0a1a ||
131 devid == 0x0a2a ||
132 devid == 0x0a0b ||
133 devid == 0x0a1b ||
134 devid == 0x0a2b ||
135 devid == 0x0a0e ||
136 devid == 0x0a1e ||
137 devid == 0x0a2e ||
138 devid == 0x0d02 || /* CRW */
139 devid == 0x0d12 ||
140 devid == 0x0d22 ||
141 devid == 0x0d06 ||
142 devid == 0x0d16 ||
143 devid == 0x0d26 ||
144 devid == 0x0d0a ||
145 devid == 0x0d1a ||
146 devid == 0x0d2a ||
147 devid == 0x0d0b ||
148 devid == 0x0d1b ||
149 devid == 0x0d2b ||
150 devid == 0x0d0e ||
151 devid == 0x0d1e ||
152 devid == 0x0d2e);
153 }
154
155 static inline int
156 gen_get_hsw_gt(int devid)
157 {
158 assert(gen_is_hsw(devid));
159 return ((devid & 0x30) >> 4) + 1;
160 }
161
162 static inline bool
163 gen_is_vlv(int devid)
164 {
165 return (devid == 0x0f30 ||
166 devid == 0x0f31 ||
167 devid == 0x0f32 ||
168 devid == 0x0f33 ||
169 devid == 0x0157 ||
170 devid == 0x0155);
171 }
172
173 static inline bool
174 gen_is_atom(int devid)
175 {
176 return gen_is_vlv(devid);
177 }
178
179 static inline bool
180 gen_is_desktop(int devid)
181 {
182 assert(!gen_is_atom(devid));
183 return ((devid & 0xf) == 0x2);
184 }
185
186 static inline bool
187 gen_is_mobile(int devid)
188 {
189 assert(!gen_is_atom(devid));
190 return ((devid & 0xf) == 0x6);
191 }
192
193 static inline bool
194 gen_is_server(int devid)
195 {
196 assert(!gen_is_atom(devid));
197 return ((devid & 0xf) == 0xa);
198 }
199
200 #endif /* GENHW_H */