1 /*
2 * Copyright © 2015 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 BRW_GFX_VER_ENUM_H
25 #define BRW_GFX_VER_ENUM_H
26
27 #include "util/macros.h"
28 #include "dev/intel_device_info.h"
29
30 enum gfx_ver {
31 GFX4 = (1 << 0),
32 GFX45 = (1 << 1),
33 GFX5 = (1 << 2),
34 GFX6 = (1 << 3),
35 GFX7 = (1 << 4),
36 GFX75 = (1 << 5),
37 GFX8 = (1 << 6),
38 GFX9 = (1 << 7),
39 GFX10 = (1 << 8),
40 GFX11 = (1 << 9),
41 GFX12 = (1 << 10),
42 GFX125 = (1 << 11),
43 GFX_ALL = ~0
44 };
45
46 #define GFX_LT(ver) ((ver) - 1)
47 #define GFX_GE(ver) (~GFX_LT(ver))
48 #define GFX_LE(ver) (GFX_LT(ver) | (ver))
49
50 static inline enum gfx_ver
gfx_ver_from_devinfo(const struct intel_device_info * devinfo)51 gfx_ver_from_devinfo(const struct intel_device_info *devinfo)
52 {
53 switch (devinfo->verx10) {
54 case 40: return GFX4;
55 case 45: return GFX45;
56 case 50: return GFX5;
57 case 60: return GFX6;
58 case 70: return GFX7;
59 case 75: return GFX75;
60 case 80: return GFX8;
61 case 90: return GFX9;
62 case 110: return GFX11;
63 case 120: return GFX12;
64 case 125: return GFX125;
65 default:
66 unreachable("not reached");
67 }
68 }
69
70 #endif
71