xref: /aosp_15_r20/external/angle/src/gpu_info_util/SystemInfo_internal.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2013 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 // SystemInfo_internal.h: Functions used by the SystemInfo_* files and unittests
8 
9 #ifndef GPU_INFO_UTIL_SYSTEM_INFO_INTERNAL_H_
10 #define GPU_INFO_UTIL_SYSTEM_INFO_INTERNAL_H_
11 
12 #include "common/platform.h"
13 #include "gpu_info_util/SystemInfo.h"
14 
15 namespace angle
16 {
17 
18 // Defined in SystemInfo_libpci when GPU_INFO_USE_LIBPCI is defined.
19 bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices);
20 // Defined in SystemInfo_x11 when GPU_INFO_USE_X11 is defined.
21 bool GetNvidiaDriverVersionWithXNVCtrl(std::string *version);
22 
23 // Target specific helper functions that can be compiled on all targets
24 // Live in SystemInfo.cpp
25 bool ParseAMDBrahmaDriverVersion(const std::string &content, std::string *version);
26 bool ParseAMDCatalystDriverVersion(const std::string &content, std::string *version);
27 bool CMDeviceIDToDeviceAndVendorID(const std::string &id, uint32_t *vendorId, uint32_t *deviceId);
28 
29 #if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
30 bool GetSystemInfo_mac(SystemInfo *info);
31 #else
32 bool GetSystemInfo_ios(SystemInfo *info);
33 #endif
34 
35 #if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
36 // Helper to get the active GPU ID from a given Core Graphics display ID.
37 uint64_t GetGpuIDFromDisplayID(uint32_t displayID);
38 
39 #    if ANGLE_ENABLE_CGL
40 // Helper to get the active GPU ID from an OpenGL display mask.
41 uint64_t GetGpuIDFromOpenGLDisplayMask(uint32_t displayMask);
42 #    endif
43 
44 #endif
45 
46 #if defined(ANGLE_PLATFORM_MACOS) && ANGLE_ENABLE_METAL
47 // Get VendorID from metal device's registry ID
48 VendorID GetVendorIDFromMetalDeviceRegistryID(uint64_t registryID);
49 #endif
50 
51 
52 }  // namespace angle
53 
54 #endif  // GPU_INFO_UTIL_SYSTEM_INFO_INTERNAL_H_
55