1 //
2 // Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // driver_utils.h : provides more information about current driver.
8 
9 #ifndef LIBANGLE_RENDERER_DRIVER_UTILS_H_
10 #define LIBANGLE_RENDERER_DRIVER_UTILS_H_
11 
12 #include "libANGLE/angletypes.h"
13 
14 namespace rx
15 {
16 
17 enum VendorID : uint32_t
18 {
19     VENDOR_ID_UNKNOWN = 0x0,
20     VENDOR_ID_AMD     = 0x1002,
21     VENDOR_ID_INTEL   = 0x8086,
22     VENDOR_ID_NVIDIA  = 0x10DE,
23     // This is Qualcomm PCI Vendor ID.
24     // Android doesn't have a PCI bus, but all we need is a unique id.
25     VENDOR_ID_QUALCOMM = 0x5143,
26 };
27 
IsAMD(uint32_t vendor_id)28 inline bool IsAMD(uint32_t vendor_id)
29 {
30     return vendor_id == VENDOR_ID_AMD;
31 }
32 
IsIntel(uint32_t vendor_id)33 inline bool IsIntel(uint32_t vendor_id)
34 {
35     return vendor_id == VENDOR_ID_INTEL;
36 }
37 
IsNvidia(uint32_t vendor_id)38 inline bool IsNvidia(uint32_t vendor_id)
39 {
40     return vendor_id == VENDOR_ID_NVIDIA;
41 }
42 
IsQualcomm(uint32_t vendor_id)43 inline bool IsQualcomm(uint32_t vendor_id)
44 {
45     return vendor_id == VENDOR_ID_QUALCOMM;
46 }
47 
48 // Intel
49 class IntelDriverVersion
50 {
51   public:
52     // Currently, We only provide the constructor with one parameter. It mainly used in Intel
53     // version number on windows. If you want to use this class on other platforms, it's easy to
54     // be extended.
55     IntelDriverVersion(uint16_t lastPart);
56     bool operator==(const IntelDriverVersion &);
57     bool operator!=(const IntelDriverVersion &);
58     bool operator<(const IntelDriverVersion &);
59     bool operator>=(const IntelDriverVersion &);
60 
61   private:
62     uint16_t mVersionPart;
63 };
64 
65 bool IsHaswell(uint32_t DeviceId);
66 bool IsBroadwell(uint32_t DeviceId);
67 bool IsCherryView(uint32_t DeviceId);
68 bool IsSkylake(uint32_t DeviceId);
69 bool IsBroxton(uint32_t DeviceId);
70 bool IsKabylake(uint32_t DeviceId);
71 
72 }  // namespace rx
73 #endif  // LIBANGLE_RENDERER_DRIVER_UTILS_H_
74