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