| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/info/amd/gpuinfopmoverdrive.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "gpuinfopmoverdrive.h"cxx . . $ `<file>/src/core/info/amd/gpuinfopmoverdrive.h`/ |
| 5 | |
| 6 | #include "common/fileutils.h"cxx . . $ `<file>/src/common/fileutils.h`/ |
| 7 | #include "core/components/amdutils.h"cxx . . $ `<file>/src/core/components/amdutils.h`/ |
| 8 | #include "core/info/infoproviderregistry.h"cxx . . $ `<file>/src/core/info/infoproviderregistry.h`/ |
| 9 | #include <algorithm> |
| 10 | #include <utility> |
| 11 | |
| 12 | namespace AMDcxx . . $ AMD/ { |
| 13 | |
| 14 | class GPUInfoPMOverdriveDataSourcecxx . . $ AMD/GPUInfoPMOverdriveDataSource# |
| 15 | : public IDataSourcecxx . . $ IDataSource#<stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#>, stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const> |
| 16 | { |
| 17 | public: |
| 18 | stdcxx . . $ std/::stringcxx . . $ std/string# sourcecxx . . $ AMD/GPUInfoPMOverdriveDataSource#source(219584694fe2b248).() const override |
| 19 | { |
| 20 | return "pp_od_clk_voltage"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).; |
| 21 | } |
| 22 | |
| 23 | bool readcxx . . $ AMD/GPUInfoPMOverdriveDataSource#read(b14c1b4ec0a23c2b).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> &data, |
| 24 | stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path) override |
| 25 | { |
| 26 | auto const filePath = path /cxx . . $ std/filesystem/__cxx11/`operator/`(578e0438ad5f0e7e). sourcecxx . . $ std/filesystem/__cxx11/path#path(2f6c7066048c5333).(); |
| 27 | if (Utilscxx . . $ Utils/::Filecxx . . $ Utils/File/::isSysFSEntryValidcxx . . $ Utils/File/isSysFSEntryValid(c53a6ef3278968b1).(filePath)) { |
| 28 | auto lines = Utilscxx . . $ Utils/::Filecxx . . $ Utils/File/::readFileLinescxx . . $ Utils/File/readFileLines(951e54d16e2206f).(filePath); |
| 29 | if (!lines.emptycxx . . $ std/vector#empty(3482b152b9333168).()) { |
| 30 | data =cxx . . $ std/vector#`operator=`(e6b68e61becad66f). lines; |
| 31 | return true; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | return false; |
| 36 | } |
| 37 | }; |
| 38 | } // namespace AMD |
| 39 | |
| 40 | AMDcxx . . $ AMD/::GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#GPUInfoPMOverdrive(50458470b84e8b0c).( |
| 41 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IDataSourcecxx . . $ IDataSource#<stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#>, stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const>> |
| 42 | &&dataSource) noexcept |
| 43 | : dataSource_cxx . . $ AMD/GPUInfoPMOverdrive#dataSource_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(dataSource)) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::paircxx . . $ std/pair#<stdcxx . . $ std/::stringcxx . . $ std/string#, stdcxx . . $ std/::stringcxx . . $ std/string#>> |
| 48 | AMDcxx . . $ AMD/::GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::provideInfocxx . . $ AMD/GPUInfoPMOverdrive#provideInfo(5b65f7e996e13d80).(Vendorcxx . . $ Vendor#, int, IGPUInfocxx . . $ IGPUInfo#::Pathcxx . . $ IGPUInfo#Path# const &, |
| 49 | IHWIDTranslatorcxx . . $ IHWIDTranslator# const &) const |
| 50 | { |
| 51 | return {cxx . . $ std/vector#vector(49f6e7a06ebc5aa8).}; |
| 52 | } |
| 53 | |
| 54 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> |
| 55 | AMDcxx . . $ AMD/::GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::provideCapabilitiescxx . . $ AMD/GPUInfoPMOverdrive#provideCapabilities(da28437f5803dad2).(Vendorcxx . . $ Vendor# vendor, int, |
| 56 | IGPUInfocxx . . $ IGPUInfo#::Pathcxx . . $ IGPUInfo#Path# const &path) const |
| 57 | { |
| 58 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> capcxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 59 | |
| 60 | if (vendor == Vendorcxx . . $ Vendor#::AMDcxx . . $ Vendor#AMD.) { |
| 61 | |
| 62 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> datacxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 63 | if (dataSource_cxx . . $ AMD/GPUInfoPMOverdrive#dataSource_.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).readcxx . . $ IDataSource#read(ad81cd1bcc32f58b).(data, path.syscxx . . $ IGPUInfo#Path#sys.)) { |
| 64 | |
| 65 | if (Utilscxx . . $ Utils/::AMDcxx . . $ Utils/AMD/::hasOverdriveClkVoltControlcxx . . $ Utils/AMD/hasOverdriveClkVoltControl(93f8d79ff69eedd8).(data)) |
| 66 | cap.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::ClkVoltcxx . . $ AMD/GPUInfoPMOverdrive#ClkVolt.); |
| 67 | else if (Utilscxx . . $ Utils/::AMDcxx . . $ Utils/AMD/::hasOverdriveClkControlcxx . . $ Utils/AMD/hasOverdriveClkControl(93f8d79ff69eedd8).(data)) |
| 68 | cap.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::Clkcxx . . $ AMD/GPUInfoPMOverdrive#Clk.); |
| 69 | |
| 70 | if (Utilscxx . . $ Utils/::AMDcxx . . $ Utils/AMD/::hasOverdriveClkOffsetControlcxx . . $ Utils/AMD/hasOverdriveClkOffsetControl(93f8d79ff69eedd8).(data)) |
| 71 | cap.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::ClkOffsetcxx . . $ AMD/GPUInfoPMOverdrive#ClkOffset.); |
| 72 | |
| 73 | if (Utilscxx . . $ Utils/::AMDcxx . . $ Utils/AMD/::hasOverdriveVoltCurveControlcxx . . $ Utils/AMD/hasOverdriveVoltCurveControl(93f8d79ff69eedd8).(data)) |
| 74 | cap.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::VoltCurvecxx . . $ AMD/GPUInfoPMOverdrive#VoltCurve.); |
| 75 | |
| 76 | if (Utilscxx . . $ Utils/::AMDcxx . . $ Utils/AMD/::hasOverdriveVoltOffsetControlcxx . . $ Utils/AMD/hasOverdriveVoltOffsetControl(93f8d79ff69eedd8).(data)) |
| 77 | cap.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).(GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::VoltOffsetcxx . . $ AMD/GPUInfoPMOverdrive#VoltOffset.); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | return capcxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 82 | } |
| 83 | |
| 84 | bool AMDcxx . . $ AMD/::GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#::registered_cxx . . $ AMD/GPUInfoPMOverdrive#registered_. = |
| 85 | InfoProviderRegistrycxx . . $ InfoProviderRegistry#::addcxx . . $ InfoProviderRegistry#add(2c04d579dc484cde).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<AMDcxx . . $ AMD/::GPUInfoPMOverdrivecxx . . $ AMD/GPUInfoPMOverdrive#>( |
| 86 | stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<AMDcxx . . $ AMD/::GPUInfoPMOverdriveDataSourcecxx . . $ AMD/GPUInfoPMOverdriveDataSource#>())); |