Compare commits

...

35 Commits

Author SHA1 Message Date
jackun 4a34502aeb
Add virtual dtor to CPUPowerData
ASan complains about allocated size mismatch in ctor/dtor.
Scott Meyers says: "Polymorphic base classes should declare virtual destructors. If a class has any virtual functions, it should have a virtual destructor."
16 hours ago
flightlessmango 4307450c02 params: control: change errors to debug 3 days ago
flightlessmango a4393e0e42 Shell: read: only get last line 3 days ago
flightlessmango 511b7a6f2a Shell: add debug for cmd and output 4 days ago
Leopard1907 391c52271c Update blacklist.cpp 4 days ago
Leopard1907 e6b7304ec5 [blacklist] Add Ubisoft store 4 days ago
João Batista b217d75917 meson.build - v0.7.2 6 days ago
flightlessmango 7b80f733b6 workflow: build-package: actually fix bad credentials 1 week ago
flightlessmango 038478a96a workflow: build-package: create release if it doesn't exist 1 week ago
flightlessmango f22d3221a3 workflow: build-package: add auth debug 1 week ago
flightlessmango d8ed2331c3 workflow: build-package fix typo 1 week ago
flightlessmango 6312c46663 workflow: build-package: attempt to fix release upload 1 week ago
flightlessmango 78a892e1af Revert "test: amdgpu: convert metrics to host endian"
This reverts commit faa3b1c22f.
1 week ago
flightlessmango 63eaf1489a Revert "amdgpu: rework convertion of endian"
This reverts commit dc7ec94549.
1 week ago
flightlessmango 4cbcec30b8 intel: don't use of intel_gpu_top
It's too much of a hassle to use intel_gpu_top, let's just wait
until these values are exposed in sysfs and until then we will just
have gpu load
2 weeks ago
flightlessmango dc7ec94549 amdgpu: rework convertion of endian
We convert to host endian as we fetch the values from gpu_metrics
2 weeks ago
flightlessmango faa3b1c22f test: amdgpu: convert metrics to host endian 2 weeks ago
flightlessmango 0caded833e intel: don't disable if intel_gpu_top fails
Before we only had intel_gpu_top to rely on, but now
we can also get gpu load from fd.
2 weeks ago
Alex Maese 872a564889 Set current_preset to first preset when use_existing_preset is false 2 weeks ago
Alex Maese 5c1fe0a5e6 Fix issue where presets weren't applied when MANGOHUD_CONFIG is set
When MANGOHUD_CONFIG was set but didn't contain either read_cfg or
preset values, the preset was never applied
2 weeks ago
Alex Maese 6ab4624cfb Use 'debug' log level when presets.conf doesn't exist 2 weeks ago
Bill Li f0407636d3 pkgbuild: update source for sdplog to 1.14.1 3 weeks ago
Alesh Slovak 5d744d328a add various additional stats to log summary 3 weeks ago
Gonçalo Negrier Duarte 4ee8a9aac4 meson: verify if system lib are present before fallback to submodules
* if meson dosen't found spdlog with use_system_spdlog enabled
  meson will print a warning and fallback to the submodule
  instead of giving an error
* System vulkan-headers can't be use since mangohud don't use latest SDK
  The code is commented out for future use
* All the other submodules will use system dependency when found

Signed-off-by: Gonçalo Negrier Duarte <gonegrier.duarte@gmail.com>
3 weeks ago
flightlessmango 31f2ca5e30 meson: spdlog: try to sort out proper fallback 3 weeks ago
Alessandro Toia 57cd928c63 spdlog-wrap: update to version 1.14.1 3 weeks ago
Arias800 32c6cf0ebd Add nvidia shield 2017 controller 3 weeks ago
flightlessmango ec1b9c017f meson: spdlog: check if system is disabled 3 weeks ago
flightlessmango 55712618fa presets: 4: disable gpu_fan for steamdeck 3 weeks ago
flightlessmango a0a31b4f64 x11: check that DISPLAY env exists 1 month ago
Etaash Mathamsetty 4cad060334 fix locking in device_info 1 month ago
Błażej Szczygieł 121cf54d9b hud elements: clear ordered_functions when legacy_layout is disabled
fixes #1236
1 month ago
Alessandro Toia 7497b1da3f device: Use LOGI MOUSE/KB instead of device_name 1 month ago
Etaash Mathamsetty 0e92ec4790 fix device_data race condition with mutex 1 month ago
Milos Tijanic 44eb25e10e nvml: only query params that will actually be used 1 month ago

@ -13,11 +13,13 @@ jobs:
run: |
set -x
sudo dpkg --add-architecture i386
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages focal main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt -y install gcc-multilib g++-multilib ninja-build python3-setuptools \
python3-wheel mesa-common-dev libxnvctrl-dev libdbus-1-dev \
python3-numpy python3-matplotlib unzip hub libxkbcommon-dev libwayland-dev wget unzip \
libxkbcommon-dev:i386 libwayland-dev:i386
libxkbcommon-dev:i386 libwayland-dev:i386 gh
sudo pip3 --no-input install 'meson>=0.60' mako
wget https://github.com/KhronosGroup/glslang/releases/download/SDK-candidate-26-Jul-2020/glslang-master-linux-Release.zip
unzip glslang-master-linux-Release.zip bin/glslangValidator
@ -35,32 +37,25 @@ jobs:
else
echo "##[set-output name=short-sha;]$(git rev-parse --short "$GITHUB_SHA")"
fi
echo "##[set-output name=artifact-metadata;]${ARTIFACT_NAME}"
id: git-vars
- name: Build release package
echo "##[set-output name=artifact-metadata;]$ARTIFACT_NAME"
- name: Build and package
run: |
./build-source.sh
./build.sh build -Dwerror=true package release
- name: Upload release
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
- name: Upload assets to release
if: github.event.action == 'published'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
assets=()
for asset in ./MangoHud-*-Source*.tar.*; do
assets+=("-a" "$asset")
done
for asset in ./build/MangoHud-*.tar.*; do
assets+=("-a" "$asset")
done
tag_name="${GITHUB_REF##*/}"
hub release edit "${assets[@]}" -m "" "$tag_name"
#hub release create "${assets[@]}" -m "$tag_name" "$tag_name"
for pkg in ./build/*.tar.*; do
gh release upload "$tag_name" "$pkg" --clobber
done
- name: Upload artifact
uses: actions/upload-artifact@v3
continue-on-error: true
with:
name: MangoHud-${{steps.git-vars.outputs.artifact-metadata}}
path: ${{runner.workspace}}/MangoHud/build/MangoHud-*tar.gz
retention-days: 30
retention-days: 30

@ -1,6 +1,6 @@
project('MangoHud',
['c', 'cpp'],
version : 'v0.7.1',
version : 'v0.7.2',
license : 'MIT',
meson_version: '>=0.60.0',
default_options : ['buildtype=release', 'c_std=c99', 'cpp_std=c++14', 'warning_level=2']
@ -166,9 +166,18 @@ else
dep_rt = null_dep
endif
vkh_sp = subproject('vulkan-headers')
vk_api_xml = vkh_sp.get_variable('vulkan_api_xml')
dep_vulkan = vkh_sp.get_variable('vulkan_headers_dep')
# Commented code can be used if mangohud start using latest SDK Vulkan-Headers
# Allowing user to build mangohud using system Vulkan-Headers
#if not dependency('VulkanHeaders').found()
vkh_sp = subproject('vulkan-headers')
vk_api_xml = vkh_sp.get_variable('vulkan_api_xml')
dep_vulkan = vkh_sp.get_variable('vulkan_headers_dep')
#else
# dep_vulkan = dependency('VulkanHeaders', required: true)
# vk_api_xml = files('/usr/share/vulkan/registry/vk.xml')
#endif
vk_enum_to_str = custom_target(
'vk_enum_to_str',
@ -213,36 +222,36 @@ if get_option('mangoapp')
'glfw=enabled',
]
endif
dearimgui_sp = subproject('imgui', default_options: imgui_options)
dearimgui_dep = dearimgui_sp.get_variable('imgui_dep')
dearimgui_dep = dependency('imgui', fallback: ['imgui'], required: true, default_options: imgui_options)
if is_unixy
implot_sp = subproject('implot', default_options: ['default_library=static'])
implot_dep = implot_sp.get_variable('implot_dep')
implot_dep = dependency('implot', fallback: ['implot'], required: true, default_options: ['default_library=static'])
else
implot_dep = null_dep
implot_lib = static_library('nulllib', [])
endif
spdlog_dep = cpp.find_library('spdlog', required: get_option('use_system_spdlog'))
if not spdlog_dep.found()
spdlog_sp = subproject('spdlog', default_options: [
'default_library=static',
'compile_library=true',
'werror=false',
'tests=disabled',
'external_fmt=disabled',
'std_format=disabled'
])
spdlog_dep = spdlog_sp.get_variable('spdlog_dep')
else
spdlog_dep = dependency('spdlog', required: true)
spdlog_options = [
'default_library=static',
'compile_library=true',
'werror=false',
'tests=disabled',
'external_fmt=disabled',
'std_format=disabled'
]
spdlog_dep = dependency('spdlog', required: false)
if get_option('use_system_spdlog').disabled() or not spdlog_dep.found()
if get_option('use_system_spdlog').enabled()
warning('spdlog depedency not found follwing back to submodule')
endif
spdlog_sp = subproject('spdlog', default_options: spdlog_options)
spdlog_dep = spdlog_sp.get_variable('spdlog_dep')
endif
if ['windows', 'mingw'].contains(host_machine.system())
minhook_sp = subproject('minhook')
minhook_dep = minhook_sp.get_variable('minhook_dep')
minhook_dep = dependency('minhook', fallback: ['minhook', 'minhook_dep'], required: true)
windows_deps = [
minhook_dep,
]
@ -278,6 +287,7 @@ if get_option('tests').enabled()
dep_vulkan,
cmocka_dep,
spdlog_dep,
implot_dep,
dearimgui_dep
],
include_directories: inc_common)

@ -1,7 +1,7 @@
# Maintainer: Simon Hallsten <flightlessmangoyt@gmail.com>
pkgname=('mangohud' 'lib32-mangohud')
pkgver=0.7.2.rc1
pkgver=0.7.2.rc3.r13.g5d744d3
pkgrel=1
pkgdesc="Vulkan and OpenGL overlay to display performance information"
arch=('x86_64')
@ -15,8 +15,8 @@ source=(
"mangohud-minhook"::"git+https://github.com/flightlessmango/minhook.git"
"imgui-1.89.9.tar.gz::https://github.com/ocornut/imgui/archive/refs/tags/v1.89.9.tar.gz"
"imgui_1.89.9-1_patch.zip::https://wrapdb.mesonbuild.com/v2/imgui_1.89.9-1/get_patch"
"spdlog-1.13.0.tar.gz::https://github.com/gabime/spdlog/archive/refs/tags/v1.13.0.tar.gz"
"spdlog_1.13.0-1_patch.zip::https://wrapdb.mesonbuild.com/v2/spdlog_1.13.0-1/get_patch"
"spdlog-1.14.1.tar.gz::https://github.com/gabime/spdlog/archive/refs/tags/v1.14.1.tar.gz"
"spdlog_1.14.1-1_patch.zip::https://wrapdb.mesonbuild.com/v2/spdlog_1.14.1-1/get_patch"
"nlohmann_json-3.10.5.zip::https://github.com/nlohmann/json/releases/download/v3.10.5/include.zip"
"vulkan-headers-1.2.158.tar.gz::https://github.com/KhronosGroup/Vulkan-Headers/archive/v1.2.158.tar.gz"
"vulkan-headers-1.2.158-2-wrap.zip::https://wrapdb.mesonbuild.com/v2/vulkan-headers_1.2.158-2/get_patch"
@ -29,8 +29,8 @@ sha256sums=(
'SKIP'
'1acc27a778b71d859878121a3f7b287cd81c29d720893d2b2bf74455bf9d52d6'
'9b21290c597d76bf8d4eeb3f9ffa024b11d9ea6c61e91d648ccc90b42843d584'
'534f2ee1a4dcbeb22249856edfb2be76a1cf4f708a20b0ac2ed090ee24cfdbc9'
'556b539cf582a46673ede4202ac037b891328dd5ea76862ffe05b060fc4f4775'
'1586508029a7d0670dfcb2d97575dcdc242d3868a259742b69f100801ab4e16b'
'ae878e732330ea1048f90d7e117c40c0cd2a6fb8ae5492c7955818ce3aaade6c'
'b94997df68856753b72f0d7a3703b7d484d4745c567f3584ef97c96c25a5798e'
"53361271cfe274df8782e1e47bdc9e61b7af432ba30acbfe31723f9df2c257f3"
"860358cf5e73f458cd1e88f8c38116d123ab421d5ce2e4129ec38eaedd820e17"
@ -53,7 +53,7 @@ prepare() {
# meson subprojects
ln -sv "$srcdir/imgui-1.89.9" subprojects
ln -sv "$srcdir/spdlog-1.13.0" subprojects
ln -sv "$srcdir/spdlog-1.14.1" subprojects
mkdir subprojects/nlohmann_json-3.10.5
ln -sv "$srcdir/include" subprojects/nlohmann_json-3.10.5/
ln -sv "$srcdir/single_include" subprojects/nlohmann_json-3.10.5/

@ -56,7 +56,8 @@ static std::vector<std::string> blacklist {
"rundll32.exe",
"Launcher", //Paradox Interactive Launcher
"steamwebhelper.exe",
"EpicWebHelper.exe"
"EpicWebHelper.exe",
"UplayWebCore.exe"
};

@ -56,6 +56,7 @@ enum {
};
struct CPUPowerData {
virtual ~CPUPowerData() = default;
int source;
};

@ -6,6 +6,7 @@
namespace fs = ghc::filesystem;
using namespace std;
std::mutex device_lock;
std::vector<device_batt> device_data;
std::vector<std::string> list;
bool device_found = false;
@ -18,6 +19,7 @@ int ds5_count = 0;
int switch_count = 0;
int bitdo_count = 0;
int logi_count = 0; //Logitech devices, mice & keyboards etc.
int shield_count = 0;
std::string xbox_paths [2]{"gip","xpadneo"};
@ -28,6 +30,7 @@ static bool operator<(const device_batt& a, const device_batt& b)
void device_update(const struct overlay_params& params){
std::unique_lock<std::mutex> l(device_lock);
fs::path path("/sys/class/power_supply");
list.clear();
xbox_count = 0;
@ -35,6 +38,7 @@ void device_update(const struct overlay_params& params){
ds5_count = 0;
switch_count = 0;
bitdo_count = 0;
shield_count = 0;
for (auto &p : fs::directory_iterator(path)) {
string fileName = p.path().filename();
//Gamepads
@ -71,7 +75,14 @@ void device_update(const struct overlay_params& params){
device_found = true;
bitdo_count += 1;
}
}
//CHECK NVIDIA SHIELD DEVICES
if (fileName.find("thunderstrike") != std::string::npos) {
list.push_back(p.path());
device_found = true;
shield_count += 1;
}
}
// Mice and Keyboards
//CHECK LOGITECH DEVICES
if (std::find(params.device_battery.begin(), params.device_battery.end(), "mouse") != params.device_battery.end()) {
@ -86,6 +97,7 @@ void device_update(const struct overlay_params& params){
void device_info () {
std::unique_lock<std::mutex> l(device_lock);
device_count = 0;
device_data.clear();
//gamepad counters
@ -94,6 +106,7 @@ void device_info () {
int ds5_counter = 0;
int switch_counter = 0;
int bitdo_counter = 0;
int shield_counter = 0;
for (auto &path : list ) {
//Set devices paths
@ -152,14 +165,25 @@ void device_info () {
device_data[device_count].name = "8BITDO PAD-" + to_string(bitdo_counter + 1);
bitdo_counter++;
}
//Shield devices
if (path.find("thunderstrike") != std::string::npos) {
if (shield_count == 1)
device_data[device_count].name = "SHIELD PAD";
else
device_data[device_count].name = "SHIELD PAD-" + to_string(shield_counter + 1);
shield_counter++;
}
}
// MICE AND KEYBOARDS
//Logitech Devices
if (check_mouse == true) {
if (path.find("hidpp_battery") != std::string::npos) {
if (std::getline(device_name, line)) {
device_data[device_count].name = line;
}
// Find a good way truncate name or retreive device type before using this
// if (std::getline(device_name, line)) {
// device_data[device_count].name = line;
// }
device_data[device_count].name = "LOGI MOUSE/KB";
}
}

@ -14,6 +14,7 @@ struct device_batt {
};
extern std::vector<device_batt> device_data;
extern std::mutex device_lock;
extern bool device_found;
extern int device_count;

@ -1144,6 +1144,7 @@ void HudElements::gamescope_frame_timing(){
void HudElements::device_battery()
{
#ifdef __linux__
std::unique_lock<std::mutex> l(device_lock);
if (!HUDElements.params->device_battery.empty()) {
if (device_found) {
for (int i = 0; i < device_count; i++) {

@ -62,8 +62,6 @@ void Intel::intel_gpu_thread(){
if (exitcode == 1)
SPDLOG_INFO("Missing permissions for '{}'", "intel_gpu_top");
SPDLOG_INFO("Disabling gpu_stats");
HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_gpu_stats] = false;
}
}
@ -101,7 +99,6 @@ FILE* Intel::find_fd() {
if (found_driver){
if(strstr(line, "drm-engine-render")){
sscanf(line, "drm-engine-render: %" SCNu64 " ns", &val);
if (val > 0)
return file;
}
}

@ -32,7 +32,7 @@ class Intel {
runtime = true;
fdinfo = find_fd();
thread = std::thread(&Intel::intel_gpu_thread, this);
// thread = std::thread(&Intel::intel_gpu_thread, this);
}
void update() {
@ -42,10 +42,10 @@ class Intel {
gpu_info = gpu_info_intel;
}
~Intel(){
stop = true;
thread.join();
}
// ~Intel(){
// stop = true;
// thread.join();
// }
};
extern std::unique_ptr<Intel> intel;

@ -1,6 +1,7 @@
#include <sstream>
#include <iomanip>
#include <array>
#include <algorithm>
#include <spdlog/spdlog.h>
#include "logging.h"
#include "overlay.h"
@ -71,12 +72,24 @@ static void writeSummary(string filename){
SPDLOG_DEBUG("Writing summary log file [{}]", filename);
std::ofstream out(filename, ios::out | ios::app);
if (out){
out << "0.1% Min FPS," << "1% Min FPS," << "97% Percentile FPS," << "Average FPS," << "GPU Load," << "CPU Load" << "\n";
out << "0.1% Min FPS," << "1% Min FPS," << "97% Percentile FPS," << "Average FPS," << "GPU Load," << "CPU Load," << "Average Frame Time," << "Average GPU Temp," << "Average CPU Temp," << "Average VRAM Used," << "Average RAM Used," << "Average Swap Used," << "Peak GPU Load," << "Peak CPU Load," << "Peak GPU Temp," << "Peak CPU Temp," << "Peak VRAM Used," << "Peak RAM Used," << "Peak Swap Used" << "\n";
std::vector<logData> sorted = logArray;
std::sort(sorted.begin(), sorted.end(), compareByFps);
float total = 0.0f;
float total_cpu = 0.0f;
float total_gpu = 0.0f;
float total_cpu = 0.0f;
int total_gpu_temp = 0.0f;
int total_cpu_temp = 0.0f;
float total_vram = 0.0f;
float total_ram = 0.0f;
float total_swap = 0.0f;
int peak_gpu = 0.0f;
float peak_cpu = 0.0f;
int peak_gpu_temp = 0.0f;
int peak_cpu_temp = 0.0f;
float peak_vram = 0.0f;
float peak_ram = 0.0f;
float peak_swap = 0.0f;
float result;
float percents[2] = {0.001, 0.01};
for (auto percent : percents){
@ -91,21 +104,66 @@ static void writeSummary(string filename){
// 97th percentile
result = sorted.empty() ? 0.0f : 1000 / sorted[floor(0.97 * (sorted.size() - 1))].frametime;
out << fixed << setprecision(1) << result << ",";
// avg
// avg + peak
total = 0;
for (auto input : sorted){
total = total + input.frametime;
total_cpu = total_cpu + input.cpu_load;
total_gpu = total_gpu + input.gpu_load;
total_cpu = total_cpu + input.cpu_load;
total_gpu_temp = total_gpu_temp + input.gpu_temp;
total_cpu_temp = total_cpu_temp + input.cpu_temp;
total_vram = total_vram + input.gpu_vram_used;
total_ram = total_ram + input.ram_used;
total_swap = total_swap + input.swap_used;
peak_gpu = std::max(peak_gpu, input.gpu_load);
peak_cpu = std::max(peak_cpu, input.cpu_load);
peak_gpu_temp = std::max(peak_gpu_temp, input.gpu_temp);
peak_cpu_temp = std::max(peak_cpu_temp, input.cpu_temp);
peak_vram = std::max(peak_vram, input.gpu_vram_used);
peak_ram = std::max(peak_ram, input.ram_used);
peak_swap = std::max(peak_swap, input.swap_used);
}
// Average FPS
result = 1000 / (total / sorted.size());
out << fixed << setprecision(1) << result << ",";
// GPU
// GPU Load (Average)
result = total_gpu / sorted.size();
out << result << ",";
// CPU
// CPU Load (Average)
result = total_cpu / sorted.size();
out << result;
out << result << ",";
// Average Frame Time
result = total / sorted.size();
out << result << ",";
// Average GPU Temp
result = total_gpu_temp / sorted.size();
out << result << ",";
// Average CPU Temp
result = total_cpu_temp / sorted.size();
out << result << ",";
// Average VRAM Used
result = total_vram / sorted.size();
out << result << ",";
// Average RAM Used
result = total_ram / sorted.size();
out << result << ",";
// Average Swap Used
result = total_swap / sorted.size();
out << result << ",";
// Peak GPU Load
out << peak_gpu << ",";
// Peak CPU Load
out << peak_cpu << ",";
// Peak GPU Temp
out << peak_gpu_temp << ",";
// Peak CPU Temp
out << peak_cpu_temp << ",";
// Peak VRAM Used
out << peak_vram << ",";
// Peak RAM Used
out << peak_ram << ",";
// Peak Swap Used
out << peak_swap;
} else {
SPDLOG_ERROR("Failed to write log file");
}

@ -5,6 +5,7 @@
#include "overlay.h"
#include "overlay_params.h"
#include "nvctrl.h"
#include "logging.h"
nvmlReturn_t result;
nvmlDevice_t nvidiaDevice;
@ -52,16 +53,22 @@ bool getNVMLInfo(const struct overlay_params& params){
nvmlReturn_t response;
auto& nvml = get_libnvml_loader();
response = nvml.nvmlDeviceGetUtilizationRates(nvidiaDevice, &nvidiaUtilization);
nvml.nvmlDeviceGetTemperature(nvidiaDevice, NVML_TEMPERATURE_GPU, &nvidiaTemp);
nvml.nvmlDeviceGetMemoryInfo(nvidiaDevice, &nvidiaMemory);
nvml.nvmlDeviceGetClockInfo(nvidiaDevice, NVML_CLOCK_GRAPHICS, &nvidiaCoreClock);
nvml.nvmlDeviceGetClockInfo(nvidiaDevice, NVML_CLOCK_MEM, &nvidiaMemClock);
nvml.nvmlDeviceGetPowerUsage(nvidiaDevice, &nvidiaPowerUsage);
if (params.enabled[OVERLAY_PARAM_ENABLED_gpu_temp] || logger->is_active())
nvml.nvmlDeviceGetTemperature(nvidiaDevice, NVML_TEMPERATURE_GPU, &nvidiaTemp);
if (params.enabled[OVERLAY_PARAM_ENABLED_vram] || logger->is_active())
nvml.nvmlDeviceGetMemoryInfo(nvidiaDevice, &nvidiaMemory);
if (params.enabled[OVERLAY_PARAM_ENABLED_gpu_core_clock] || logger->is_active())
nvml.nvmlDeviceGetClockInfo(nvidiaDevice, NVML_CLOCK_GRAPHICS, &nvidiaCoreClock);
if (params.enabled[OVERLAY_PARAM_ENABLED_gpu_mem_clock] || logger->is_active())
nvml.nvmlDeviceGetClockInfo(nvidiaDevice, NVML_CLOCK_MEM, &nvidiaMemClock);
if (params.enabled[OVERLAY_PARAM_ENABLED_gpu_power] || logger->is_active())
nvml.nvmlDeviceGetPowerUsage(nvidiaDevice, &nvidiaPowerUsage);
deviceID = nvidiaPciInfo.pciDeviceId >> 16;
if (params.enabled[OVERLAY_PARAM_ENABLED_throttling_status])
nvml.nvmlDeviceGetCurrentClocksThrottleReasons(nvidiaDevice, &nvml_throttle_reasons);
nvml.nvmlDeviceGetFanSpeed(nvidiaDevice, &nvidiaFanSpeed);
if (params.enabled[OVERLAY_PARAM_ENABLED_gpu_fan] || logger->is_active())
nvml.nvmlDeviceGetFanSpeed(nvidiaDevice, &nvidiaFanSpeed);
if (response == NVML_ERROR_NOT_SUPPORTED) {
if (nvmlSuccess)

@ -111,8 +111,8 @@ parse_control(const char *str)
int ret = os_socket_listen_abstract(path.c_str(), 1);
if (ret < 0) {
SPDLOG_ERROR("Couldn't create socket pipe at '{}'", path);
SPDLOG_ERROR("ERROR: '{}'", strerror(errno));
SPDLOG_DEBUG("Couldn't create socket pipe at '{}'", path);
SPDLOG_DEBUG("ERROR: '{}'", strerror(errno));
return ret;
}
@ -665,11 +665,11 @@ parse_overlay_env(struct overlay_params *params,
add_to_options(params, key, value);
initialize_preset(params);
}
presets(current_preset, params);
break;
}
}
presets(current_preset, params);
env = env_start;
while ((num = parse_string(env, key, value)) != 0) {
@ -794,6 +794,9 @@ parse_overlay_config(struct overlay_params *params,
.preset = use_existing_preset ? params->preset : default_preset
};
set_param_defaults(params);
if (!use_existing_preset) {
current_preset = params->preset[0];
}
#ifdef HAVE_X11
params->toggle_hud = { XK_Shift_R, XK_F12 };
@ -976,6 +979,7 @@ parse_overlay_config(struct overlay_params *params,
if (params->enabled[OVERLAY_PARAM_ENABLED_legacy_layout]) {
HUDElements.legacy_elements();
} else {
HUDElements.ordered_functions.clear();
for (auto& option : HUDElements.options) {
HUDElements.sort_elements(option);
}
@ -1025,7 +1029,7 @@ bool parse_preset_config(int preset, struct overlay_params *params){
stream.imbue(std::locale::classic());
if (!stream.good()) {
SPDLOG_ERROR("Failed to read presets file: '{}'", preset_path);
SPDLOG_DEBUG("Failed to read presets file: '{}'. Falling back to default presets", preset_path);
return false;
}
@ -1145,6 +1149,9 @@ void presets(int preset, struct overlay_params *params, bool inherit) {
add_to_options(params, "frame_timing_detailed", "1");
add_to_options(params, "network", "1");
add_to_options(params, "present_mode", "0");
if ( deviceID == 0x1435 || deviceID == 0x163f )
add_to_options(params, "gpu_fan", "0");
break;
}

@ -35,8 +35,11 @@ bool init_x11() {
}
failed = !display;
if (failed)
if (failed && displayid)
SPDLOG_ERROR("XOpenDisplay failed to open display '{}'", displayid);
if (!displayid)
SPDLOG_DEBUG("DISPLAY env is not set");
return !!display;
}

@ -3,38 +3,29 @@
#include <iostream>
#include <sys/wait.h>
#include <spdlog/spdlog.h>
#include "string_utils.h"
#include <array>
std::string Shell::readOutput() {
std::string output;
char buffer[256];
ssize_t bytesRead;
bool dataAvailable = false;
std::this_thread::sleep_for(std::chrono::milliseconds(50));
// Wait for up to 500 milliseconds for output to become available
for (int i = 0; i < 10; ++i) {
bytesRead = read(from_shell[0], buffer, sizeof(buffer) - 1);
if (bytesRead > 0) {
buffer[bytesRead] = '\0';
output += buffer;
dataAvailable = true;
break; // Break as soon as we get some data
} else {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
std::array<char, 128> buffer;
std::string result;
ssize_t count;
while ((count = ::read(from_shell[0], buffer.data(), buffer.size())) > 0) {
result.append(buffer.data(), count);
}
// If we detected data, keep reading until no more is available
while (dataAvailable) {
bytesRead = read(from_shell[0], buffer, sizeof(buffer) - 1);
if (bytesRead > 0) {
buffer[bytesRead] = '\0';
output += buffer;
} else {
break; // No more data available
}
// Split the result into lines and return the last line
std::istringstream stream(result);
std::string line;
std::string last_line;
while (std::getline(stream, line)) {
last_line = line;
}
return output;
SPDLOG_DEBUG("Shell: recieved output: {}", last_line);
return last_line;
}
Shell::Shell() {
@ -84,9 +75,12 @@ std::string Shell::exec(std::string cmd) {
return readOutput();
}
void Shell::writeCommand(const std::string& command) {
void Shell::writeCommand(std::string command) {
if (write(to_shell[1], command.c_str(), command.length()) == -1)
SPDLOG_ERROR("Failed to write to shell");
trim(command);
SPDLOG_DEBUG("Shell: wrote command: {}", command);
}
Shell::~Shell() {

@ -22,7 +22,7 @@ private:
}
#endif
void writeCommand(const std::string& command);
void writeCommand(std::string command);
std::string readOutput();
public:

@ -1,13 +1,13 @@
[wrap-file]
directory = spdlog-1.13.0
source_url = https://github.com/gabime/spdlog/archive/refs/tags/v1.13.0.tar.gz
source_filename = spdlog-1.13.0.tar.gz
source_hash = 534f2ee1a4dcbeb22249856edfb2be76a1cf4f708a20b0ac2ed090ee24cfdbc9
patch_filename = spdlog_1.13.0-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.13.0-1/get_patch
patch_hash = 556b539cf582a46673ede4202ac037b891328dd5ea76862ffe05b060fc4f4775
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.13.0-1/spdlog-1.13.0.tar.gz
wrapdb_version = 1.13.0-1
directory = spdlog-1.14.1
source_url = https://github.com/gabime/spdlog/archive/refs/tags/v1.14.1.tar.gz
source_filename = spdlog-1.14.1.tar.gz
source_hash = 1586508029a7d0670dfcb2d97575dcdc242d3868a259742b69f100801ab4e16b
patch_filename = spdlog_1.14.1-1_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/spdlog_1.14.1-1/get_patch
patch_hash = ae878e732330ea1048f90d7e117c40c0cd2a6fb8ae5492c7955818ce3aaade6c
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/spdlog_1.14.1-1/spdlog-1.14.1.tar.gz
wrapdb_version = 1.14.1-1
[provide]
spdlog = spdlog_dep

Loading…
Cancel
Save