| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/info/igpuinfo.h`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "vendor.h"cxx . . $ `<file>/src/core/info/vendor.h`/ |
| 7 | #include <filesystem> |
| 8 | #include <memory> |
| 9 | #include <string> |
| 10 | #include <string_view> |
| 11 | #include <utility> |
| 12 | #include <vector> |
| 13 | |
| 14 | class IHWIDTranslatorcxx . . $ IHWIDTranslator#; |
| 15 | |
| 16 | class IGPUInfocxx . . $ IGPUInfo# |
| 17 | { |
| 18 | public: |
| 19 | struct Keyscxx . . $ IGPUInfo#Keys# |
| 20 | { |
| 21 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# vendorIDcxx . . $ IGPUInfo#Keys#vendorID.{"vendorid"}; |
| 22 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# deviceIDcxx . . $ std/basic_string_view#basic_string_view(837a1ee5a10cb792).{"deviceid"}; |
| 23 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# subvendorIDcxx . . $ std/basic_string_view#basic_string_view(837a1ee5a10cb792).{"svendorid"}; |
| 24 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# subdeviceIDcxx . . $ std/basic_string_view#basic_string_view(837a1ee5a10cb792).{"sdeviceid"}; |
| 25 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# vendorNamecxx . . $ std/basic_string_view#basic_string_view(837a1ee5a10cb792).{"vendor"}; |
| 26 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# deviceNamecxx . . $ std/basic_string_view#basic_string_view(837a1ee5a10cb792).{"device"}; |
| 27 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# subdeviceNamecxx . . $ IGPUInfo#Keys#subdeviceName.{"sdevice"}; |
| 28 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# pciSlotcxx . . $ IGPUInfo#Keys#pciSlot.{"pcislot"}; |
| 29 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# drivercxx . . $ IGPUInfo#Keys#driver.{"driver"}; |
| 30 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# revisioncxx . . $ IGPUInfo#Keys#revision.{"revision"}; |
| 31 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# memorycxx . . $ IGPUInfo#Keys#memory.{"memory"}; |
| 32 | static constexpr stdcxx . . $ std/::string_viewcxx . . $ std/string_view# uniqueIDcxx . . $ IGPUInfo#Keys#uniqueID.{"uniqueid"}; |
| 33 | }; |
| 34 | |
| 35 | struct Pathcxx . . $ IGPUInfo#Path# |
| 36 | { |
| 37 | Pathcxx . . $ IGPUInfo#Path#Path(df8cb93b336b884d).(stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# sys, stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# dev) noexcept |
| 38 | : syscxx . . $ std/filesystem/__cxx11/path#path(91601bf9ad65ca31).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(sys)) |
| 39 | , devcxx . . $ std/filesystem/__cxx11/path#path(91601bf9ad65ca31).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(dev)) |
| 40 | { |
| 41 | } |
| 42 | stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const syscxx . . $ IGPUInfo#Path#sys.; |
| 43 | stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const devcxx . . $ IGPUInfo#Path#dev.; |
| 44 | }; |
| 45 | |
| 46 | class IProvidercxx . . $ IGPUInfo#IProvider# |
| 47 | { |
| 48 | public: |
| 49 | virtual stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#>> |
| 50 | provideInfocxx . . $ IGPUInfo#IProvider#provideInfo(5b65f7e996e13d80).(Vendorcxx . . $ Vendor# vendor, int gpuIndex, IGPUInfocxx . . $ IGPUInfo#::Pathcxx . . $ IGPUInfo#Path# const &path, |
| 51 | IHWIDTranslatorcxx . . $ IHWIDTranslator# const &hwIDTranslator) const = 0; |
| 52 | |
| 53 | virtual stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> |
| 54 | provideCapabilitiescxx . . $ IGPUInfo#IProvider#provideCapabilities(da28437f5803dad2).(Vendorcxx . . $ Vendor# vendor, int gpuIndex, |
| 55 | IGPUInfocxx . . $ IGPUInfo#::Pathcxx . . $ IGPUInfo#Path# const &path) const = 0; |
| 56 | |
| 57 | virtual ~cxx . . $ IGPUInfo#IProvider#`~IProvider`(49f6e7a06ebc5aa8).IProvidercxx . . $ IGPUInfo#IProvider#() = default; |
| 58 | }; |
| 59 | |
| 60 | class IProviderRegistrycxx . . $ IGPUInfo#IProviderRegistry# |
| 61 | { |
| 62 | public: |
| 63 | virtual stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IGPUInfocxx . . $ IGPUInfo#::IProvidercxx . . $ IGPUInfo#IProvider#>> const & |
| 64 | gpuInfoProviderscxx . . $ IGPUInfo#IProviderRegistry#gpuInfoProviders(65c0b6f616266a45).() const = 0; |
| 65 | |
| 66 | virtual ~cxx . . $ IGPUInfo#IProviderRegistry#`~IProviderRegistry`(49f6e7a06ebc5aa8).IProviderRegistrycxx . . $ IGPUInfo#IProviderRegistry#() = default; |
| 67 | }; |
| 68 | |
| 69 | /// @returns gpu vendor id |
| 70 | virtual Vendorcxx . . $ Vendor# vendorcxx . . $ IGPUInfo#vendor(f3352d101b4b8e0).() const = 0; |
| 71 | |
| 72 | /// @returns gpu index |
| 73 | virtual int indexcxx . . $ IGPUInfo#index(455f465bc33b4cdf).() const = 0; |
| 74 | |
| 75 | /// @returns gpu Path |
| 76 | virtual IGPUInfocxx . . $ IGPUInfo#::Pathcxx . . $ IGPUInfo#Path# const &pathcxx . . $ IGPUInfo#path(f79b37054f6b84d7).() const = 0; |
| 77 | |
| 78 | /// @returns collection of keys for the stored gpu information |
| 79 | virtual stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> keyscxx . . $ IGPUInfo#keys(491c255a7e496038).() const = 0; |
| 80 | |
| 81 | /// @returns string with gpu info or empty string when no info |
| 82 | /// is mapped to the key |
| 83 | virtual stdcxx . . $ std/::stringcxx . . $ std/string# infocxx . . $ IGPUInfo#info(3654cd48a63d288).(stdcxx . . $ std/::string_viewcxx . . $ std/string_view# key) const = 0; |
| 84 | |
| 85 | /// @returns true when the capability is present |
| 86 | virtual bool hasCapabilitycxx . . $ IGPUInfo#hasCapability(aa6d140991badc75).(stdcxx . . $ std/::string_viewcxx . . $ std/string_view# name) const = 0; |
| 87 | |
| 88 | /// Initialize gpu info |
| 89 | /// @param infoProviders information providers |
| 90 | /// @param hwidTranslator hwid code translator |
| 91 | virtual void initializecxx . . $ IGPUInfo#initialize(c158fff4aa1693ae).( |
| 92 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IGPUInfocxx . . $ IGPUInfo#::IProvidercxx . . $ IGPUInfo#IProvider#>> const &infoProviders, |
| 93 | IHWIDTranslatorcxx . . $ IHWIDTranslator# const &hwidTranslator) = 0; |
| 94 | |
| 95 | virtual ~cxx . . $ IGPUInfo#`~IGPUInfo`(49f6e7a06ebc5aa8).IGPUInfocxx . . $ IGPUInfo#() = default; |
| 96 | }; |