Commit Graph

955 Commits (68ce8f81cc767ee5e7adfb38a9fb2e3388e21633)

Author SHA1 Message Date
jackun abf146f73c
Set correct swapchain_stats etc references for hw updater 3 years ago
jackun 9b6a39dfe9
sed s/gnu_linux/linux/g 3 years ago
jackun 90e48f95ca
Use unversioned `fmt::format_error` 3 years ago
jackun 6584f23a6c
Use `ghc::filesystem` to iterate over /proc/self/map_files 3 years ago
jackun c452609718
Fix hw update thread waiting for initial update signal 3 years ago
jackun ced84ec526
Try to find `dlopen`/`dlsym` from libc.so too (musl libc, glibc 2.34+) 3 years ago
FlightlessMango 947f287a5e
Only create hw_info_thread once 3 years ago
jackun 729ccc83bd
Use spdlog's 'fmt' to format media player metadata
Usage:
  media_player_format={title};{artist};{album}

Semi-colon breaks to new line, might change.
3 years ago
FlightlessMango 3ac7772a55 Add universal param 3 years ago
jackun ac11beef9b
[dbus] Don't stop D-Bus thread or remove filter if not completely deiniting 3 years ago
jackun 31e879215a
[dbus] Also check if gamemode is enabled with D-Bus 3 years ago
jackun 7e3a56d356
[dbus] Raise TRAP if wrong primitive type but allow to continue 3 years ago
jackun d1617818cd
Fix OpenGL gpu_name 3 years ago
jackun a431c092eb
Separate libdrm and libdrm_amdgpu loader 3 years ago
jackun 822e325d11
Add get_basename, fix win32 build
std::string::substr likes to throw
3 years ago
jackun 9df9df0f4f
Fix some tangling printfs 3 years ago
jackun 94a7705554
Fix integer overflow on 32 bit, for `procmem` 3 years ago
jackun 5767426192
Nope, ERROR level has higher priority, doh 3 years ago
jackun c79e01830d
Clean up battery.{h,cpp} header includes 3 years ago
jackun 866fd8bc24
Add per process memory usage (`procmem` etc) 3 years ago
jackun 891abdf3b9
Skip setting up vulkan render if HUD is hidden 3 years ago
jackun b20d2492bc
Limit keybind check to about 10hz 3 years ago
jackun 355c521f12
Misc small clean ups and fixes 3 years ago
jackun a82e27d978
Use spdlog macros so logging can be completely disabled during compile-time 3 years ago
jackun 46c2183b5d
Use engine type enum in `engine_version()` 3 years ago
jackun 7d3b6b946d
Don't reinit stuff when re-creating swapchain
Partial revert of e13e98e03a
3 years ago
jackun 6c604f379c
Fix parse_pciids when trying to open pci.ids from alternate location 3 years ago
jackun 944202f273
Fix #ifdef scope in `overlay_DestroyInstance` 3 years ago
jackun d41ad84260
Poll amdgpu regs at 120ticks/s regardless of sampling period 3 years ago
jackun 2f807a4c0d
Add `spdlog` wrap and logging 3 years ago
jackun c093f9823e
Use libdrm_amdgpu for amdgpu sensor info, if available
Using plain `open` as `drmOpen` needs bus id check which needs interface 1.4 ioctl which gives EPERM cause only DRM_MASTER can call it :(

https://github.com/clbr/radeontop/issues/48#issuecomment-493792404
3 years ago
jackun 88d801bd7e
Move functions not directly related to vulkan from vulkan.cpp to overlay.cpp 3 years ago
jackun 8244d7f288
Fix vulkan driver's patch version 3 years ago
Joshua Martin 3b0b6fbc42
Add position options to place the overlay halfway down the screen (#561) 3 years ago
jackun b6dab97d08
[OpenGL] Some code clean-ups 3 years ago
jackun f8bb948de2
More quotation glyphs 3 years ago
Lukáš Horáček 213953089d
Detect ToGL 3 years ago
Lukáš Horáček f1eae93253
Use map_files instead of lsof for wined3d detection 3 years ago
jackun 750d2cddb5
Make engine type per instance 3 years ago
FlightlessMango e39513cfa4 still check PengineName if engine OpenGL 3 years ago
FlightlessMango 3f120b1fc5 don't set engine to vulkan if already set 3 years ago
Alessandro Toia 0bc6d33a24 Fix frame spikes when using battery parameter 3 years ago
Alessandro Toia 570bef468b Cosmetic changes to engine detection 3 years ago
FlightlessMango 5330573c8c don't rely on std in engine detection 3 years ago
FlightlessMango 94dda243a5 Battery: header include filesystem.h 3 years ago
FlightlessMango 226330c0d7 Battery: assume unknown status is charging 3 years ago
jackun 9da427d093
Include u2019 (RIGHT SINGLE QUOTATION MARK) glyph by default 3 years ago
jackun 0ee101e0ac
Fix MPRIS ticker, microseconds to nanoseconds 3 years ago
FlightlessMango a50bbbac22 add battery, fps_limit and resolution to legacy layout 3 years ago
jackun 37d8c75c78 Skip calculating IO stats for first sample
Or you get high read/write speeds averaged over process' whole lifetime.
3 years ago
flightlessmango 428ddf4e8a
Merge pull request #536 from flightlessmango/battery_test
Battery info and font awesome icons
3 years ago
FlightlessMango 2e5fc31711 use vulkan to determine if zink 3 years ago
FlightlessMango 92282bcec2 convert frametime from ns to us 3 years ago
Joshua Ashton 815097718e Use nanoseconds to calculate fps
No need to round this earlier on.

Removes an unnecessary implicit float -> double conversion in the calculation also
3 years ago
Joshua Ashton 1f0119bc91 Use raw clocks if available
Avoids NTP synchronization having impact on frametime pacing.
3 years ago
medusalix 560930214a Fix CPU power calculations 3 years ago
Alessandro Toia 5c48b4729c Change param to battery, add param for icon, hide power when plugged in 3 years ago
jackun a0a57038c1
Fix redefinition of 'open'
musl pulls in fcntl.h from somewhere
3 years ago
Alessandro Toia 105ad9c2be Check for batteries only once 3 years ago
Alessandro Toia 500a65dd52 Only display battery stats if a battery is present 3 years ago
Alessandro Toia a533883a39 Check if there are battieres before attempting to retrieve stats 3 years ago
Alessandro Toia 8960a54813 Change battery path list to array 3 years ago
Alessandro Toia 6833ee3593 Check if battery(s) are fully charged 3 years ago
Alessandro Toia 6c69f68f7f Iterate over n batteries to find energy consumption 3 years ago
Alessandro Toia e63a5bd472 Iterate over n batteries to find percent 3 years ago
Alessandro Toia 62db1495d6 Scale down icons if font is small 3 years ago
Alessandro Toia 5656001639 Add forkawesome from compressed Base85 TTF 3 years ago
Alessandro Toia 552a85aaaa Only update battery stats if a battery is present 3 years ago
Alessandro Toia c6074b0f4d Check if there are batteries before checking if they are charging 3 years ago
Alessandro Toia 8980ff46bc When plugged in change battery icon according to percent 3 years ago
Alessandro Toia 5adb4500c7 Install forkawesome font file 3 years ago
Alessandro Toia b89b9b8109 Add ForkAwesome Icons 3 years ago
Alessandro Toia 1ab25220c6 Add param to check battery power and percent 3 years ago
FlightlessMango a90c897feb Check battery info 3 years ago
Alessandro Toia d556e8e357 Improve Zink detection 3 years ago
Alessandro Toia 36ec9ef41a Add round_corners param 3 years ago
jackun 47865573a8
Add option to prepend libdir to library's path in vulkan manifest
"\$LIB" technically breaks json but on the other hand vulkan loader
currently doesn't handle "\\$LIB"
Help with issue #468
3 years ago
jackun 765024227c
[OpenGL] Framerate limit in eglSwapBuffers 3 years ago
Alessandro Toia ddfcb01c30 Add detection of Zink 3 years ago
jackun a724e5e294
Fix engine name not showing with `engine_version` without `fps` also enabled 3 years ago
jackun 34f964eab9
Use aligned buffer size with vkMapMemory too 3 years ago
Alessandro Toia 856c333e09 Fix wine param not properly detecting proton experimental 3 years ago
Alessandro Toia 272b035ca8 Fix wine param not detecting proton experimental 3 years ago
jackun 0f6ead57d7
[OpenGL] Bind framebuffer for all GL ES versions 3 years ago
jackun e62d6e3337
[OpenGL] Save/restore last GL_DRAW_FRAMEBUFFER if using `gl_bind_framebuffer` 3 years ago
jackun 714f3853f7
[OpenGL] Support apitrace in debug build
Try to load `glxtrace.so` instead of `libGL.so.1`.
Assumes `glxtrace.so` lives outside of usual library paths and is only preloaded.
3 years ago
jackun afa50a17c4
[OpenGL] Add gl_size_query, gl_bind_framebuffer, gl_dont_flip options for workarounds
`gl_size_query = viewport` - specify what to use for getting display size. Options are "viewport", "scissorbox" or disabled. Defaults to using glXQueryDrawable.
`gl_bind_framebuffer = 0` - (re)bind given framebuffer before MangoHud gets drawn. Helps with Crusader Kings 3.
`gl_dont_flip = 1` - don't swap origin if using GL_UPPER_LEFT. Helps with Ryujinx.
3 years ago
jackun 54d6a8e889
Unset LD_LIBRARY_PATH if using absolute paths in LD_PRELOAD
$LIB in LD_LIBRARY_PATH makes `ldconfig` unhappy.
3 years ago
jackun ea07d1e080
Remove ".exe" from wine executable's name
Fixes ad4e1ac35f
3 years ago
jackun ad4e1ac35f
Try to get wine executable's name from /proc/self/comm 3 years ago
jackun 4d4444e1c5
Allow overriding config file options with MANGOHUD_CONFIG if using legacy layout 3 years ago
jackun 4f3133c5da
Fix log file using `wine-preloader` etc instead of executable's filename 3 years ago
Lukáš Horáček 8f3ecb81df Divide IO stats by time difference since last update
This should prevent IO stats reaching high numbers when application stops responding resulting into MangoHud not updating.
3 years ago
jackun 30cdc912a8
Rework blending equation to preserve alpha in output buffer
bda12e5fdd
3 years ago
jackun 118c54072f
[OpenGL] Disable primitive restart 3 years ago
jackun 8e7564ab1a
[OpenGL] Disable stencil test 3 years ago
jackun bdd87f5eff
Use SetTexID instead 3 years ago
jackun 76b571bc11
[OpenGL] Fix glClipControl(GL_UPPER_LEFT) rendering 3 years ago
jackun 6c737dc734
Round up buffer allocation sizes to `nonCoherentAtomSize`.
For some Vega APUs. Or don't use VK_WHOLE_SIZE?
3 years ago
jackun f77a73ce8a
Fix scoped_lock clash with >= c++17 3 years ago
jackun 3e77dd6e0b
[OpenGL] Add eglSwapBuffers to hook list 3 years ago
jackun 6769ae96fa
[OpenGL] Explicitly include dlfcn.h 3 years ago
FlightlessMango 6286313478 MSVC building fixes 3 years ago
jackun 8b2255b35c
Fix crash on destroying NULL swapchain
Vulkan spec allows calling vkDestroySwapchainKHR with VK_NULL_HANDLE swapchain.

mesa MR#5616
3 years ago
FlightlessMango cc83f2878e Try to guess mesa version 3 years ago
FlightlessMango 76fb1ec3cb Remove lsof as dependency 3 years ago
FlightlessMango e13e98e03a Fixed debug output of gpu name 3 years ago
FlightlessMango f8fa73daf2 Get logged gpu name from pci_ids instead 3 years ago
FlightlessMango 66a07d77ba Use read_line for checking cpu sched 3 years ago
FlightlessMango 3261d12ad7 Add checking cpu scheduler 3 years ago
FlightlessMango 1a8689fbba Add gpu power to logs 3 years ago
jackun 41034b1089
[OpenGL] Return -1 instead for glXSwapBuffersMscOML if it is null 3 years ago
jackun 439ff716c2
[OpenGL] Some nullptr guards
Maybe helps issue #355
3 years ago
jackun 53cca5e723
Merge remote-tracking branch 'origin/master' into develop 3 years ago
FlightlessMango 48cf66630b Detect WineD3D 3 years ago
FlightlessMango d0c35b9587 Add detection of Damavand 3 years ago
FlightlessMango abe45c7485 Check log stream before writing 3 years ago
jackun ae410f01e7
Re-init cpu stats if core count changes; fix off-by one error
Helps with #438
3 years ago
jackun 6ad9791ceb
Deduplicate code for `find_*_input` functions 3 years ago
jackun 0fbbf00fe2
[OpenGL] Load libEGL.so.1 and use eglGetProcAddress to get EGL procs 3 years ago
flightlessmango 2fe9808f69
Merge pull request #433 from baryluk/programname
Improve code for program name extraction
3 years ago
Witold Baryluk 25f7201770
Disable lsof warnings explicitly
On most system lsof is compiled with warnings enabled.

This causes spam multiple times per one mangohud invocation (up to about 10 times even), like this:

```
lsof: WARNING: can't stat() tracefs file system /sys/kernel/debug/tracing
      Output information may be incomplete.
```

Disable warnings explicitly.
3 years ago
jackun 19ef4f3df0
[dbus] re-init active player so `media_player_name` changes take effect
Might be good to check if player name actually changed though.
4 years ago
Witold Baryluk c92f805c2d Prevent infinite recursion when using Mesa zink.
When using zink (`MESA_LOADER_DRIVER_OVERRIDE=zink`),
running any app (OpenGL or Vulkan), will trigger running
`glxinfo`. Unsetting of `LD_PRELOAD` is not sufficient,
because if using `zink`, it will load Vulkan, and load Vulkan
implicit layer for Mangohud, using `/usr/share/vulkan/implicit_layer.d/MangoHud.json`,
which will cause it to reenter this function in another process,
causing infinite recursion (until the Vulkan driver finally errors
out with too many VkDevices  / contexts created).
I have easily have seen recursion depths of 200+ until this happen,
and sometimes takes up to 2 minutes, with 2000 extra shell and `cut`
processes in the process tree.

Fix this by marking recursion entrance.

This makes glxmark start in less than 1 second, instead
about 60 seconds.

When at it us `glxinfo -B`, which is significantly faster
on zink, yet provides all information we need.
4 years ago
flightlessmango 185941a857 Fix some warnings 4 years ago
flightlessmango fc8eeaf0dc Lingering TableNextCell 4 years ago
flightlessmango e57be394d7
Merge pull request #428 from flgx16/swap
Add swap
4 years ago
jackun 4862d83b60
Make `add_blacklist` const&
Might be optimized by compiler already but who knows.
4 years ago
jackun 72f1ec094c
Don't continue parsing configs if process is blacklisted 4 years ago
FlightlessMango 90ce1c5778 ImGui wrap 4 years ago
FlightlessMango 0162fb913c Always try to update exec's 4 years ago
Alessandro Toia 2c99138374 Remove custom_text_center from legacy and trailing spaces 4 years ago
flightlessmango bd71d0b5fd Check for lsof before trying to use it 4 years ago
flightlessmango 1b44c57db5 Improved lsof for checking gamemode/vkbasalt 4 years ago
flightlessmango 214bb83d40 Moved update_exec() into a thread 4 years ago
flightlessmango 05cf9fc5d6 Add gamemode and vkbasalt function 4 years ago
Alessandro Toia 1d8f4b79c1 Formatting Fixes and remove unused variable 4 years ago
FlightlessMango c54f8bec5d Hud elements exec function 4 years ago
Alessandro Toia c4925ac83e Allow multiple instances of custom_text_center and custom_text 4 years ago
FlightlessMango 05c09e3fdf Only draw custom_text_center if it's not empty 4 years ago
Witold Baryluk 4f20da781d Improve code for program name extraction
This cleans up the code, as well fixes the bug of not setting
program_name if the MANGOHUD_CONFIG env is specified.

Instead of global variable, that could be not-initialized
use a function to get a program name in logging.

While at it, revamp code and separate things into own functions,
and return by value, and make them easier to use / share code.
4 years ago
Lukáš Horáček f11a49ae8b
Add swap 4 years ago
Alessandro Toia c16332eddf Less tr and grep to find driver version 4 years ago
Alessandro Toia 80004d3fe0 Chnage fps color based on fps value 4 years ago
Alessandro Toia 75d9e51445 Remove custom_header, add new params custom_text_center and custom_text 4 years ago
AlexxandreFS fa433cb798 fix: cut --output-delimiter 4 years ago
Alessandro Toia 439f1266ba Remove custom_header background and add newline after 4 years ago
Alessandro Toia 576f9887e0 Add custom_header to legacy_elements, make sure custom_header is always shown first 4 years ago
Alessandro Toia c479694735 Use SetCursorPosX() instead of SameLine() to center text 4 years ago
Alessandro Toia b77517501c Add new param custom_header 4 years ago
Witold Baryluk 6a1028b17e
Fix some MESA inherited references in overlay params
MANGOHUD_CONFIG as used.

MANGOHUD printf prefix.
4 years ago
FlightlessMango d54409b6b5 Don't need vulkan hooking in kiero 4 years ago
FlightlessMango af0658e137 Change win config location to mangohud folder 4 years ago
FlightlessMango 1a86d3b241 Set dx_version var 4 years ago
FlightlessMango 3bc0f32a3b Init all related renderTypes 4 years ago
FlightlessMango 079f700241 Make sure logger gets inited in win 4 years ago
Alessandro Toia a061ca060f __gnu_linux__ shouldn't be caps 4 years ago
Alessandro Toia 8e873fe547 Remove more "not" and "and" in if statments
Rename dbus_helpers.hpp to dbus_helpers.h
4 years ago
FlightlessMango 6ed47879e7 __gnu_linux__ shouldn't be caps 4 years ago
FlightlessMango f375d94188 libgen.h not needed on win32 4 years ago
FlightlessMango 45c7ea0841 Include intrin.h for _ReturnAddress win32 4 years ago
flightlessmango cfc0b74d1a
Merge pull request #418 from baryluk/patch-3
Perform updates of gpuInfo struct in more atomic way
4 years ago
FlightlessMango ce7de641cf Don't use "and" and "not" in if statements 4 years ago
FlightlessMango d1af7c97ac Removed lingering pthread.h 4 years ago
FlightlessMango eef6d8974a Only use popen/close on linux 4 years ago
FlightlessMango c20b06c851 Remove more ram related things for windows 4 years ago
Alessandro Toia 06f2c7dc1b Do not show fps_limit if unlimited 4 years ago
Witold Baryluk e712a26eff
Perform updates of gpuInfo struct in more atomic way
The issue is that value might be set to 0, or original miliC (i.e. 35000),
while the other thread is reading it from the memory.

Instead using single writes to the target location,
only with intended end value.

This is a not a full proper fix (like using mutex between overlay and the thread
doing hw info update), but should alleviate issue of logging sometimes
having value 0, or original value of miliC for temperature.
4 years ago
Alessandro Toia 4ada6d1036 Add show_fps_limit param 4 years ago
FlightlessMango c8d68be476 Add resolution param 4 years ago
Alessandro Toia ed0c7a344d Add new param 'core_load_change' to change colors of cpu core load depending on load % 4 years ago
Witold Baryluk 558b8eb093 Properly initialize file pointers to null
If in `init_cpu_power_data_k10temp` we fail to initialize all paths,
and fail initialization, then in the destructor, we will most likely
pass invalid value to the `fclose`.
4 years ago
Witold Baryluk 26262e24ff Improve initialization logic for cpu.cpp
Use smart pointers.

Get rid of gotos and labels.
4 years ago
Alessandro Toia 03bd71d145 Add missing add_blacklist for OpenGl apps 4 years ago
jackun e0f79d9435
Escape spaces in file names for `wordexp` v2 but just append to stringstream 4 years ago
FlightlessMango a4a5950ddf Make sure graphs have data without enabling elems 4 years ago
jackun 0309b6bbb9
Escape spaces in file names for `wordexp` 4 years ago
jackun fda43f5727
Use str_tokenize for multiple delimiters 4 years ago
FlightlessMango 27fee4f151 Prettying up hudelements::graphs 4 years ago
jackun 6a5cd38127
Meson option to have absolute paths in LD_PRELOAD 4 years ago
FlightlessMango 9af4ac546f No need to convert cpu_load 4 years ago
FlightlessMango 4505bba6bd Check if logger is active before autostarting 4 years ago
FlightlessMango 3827fe96d4 Add autostart_log param 4 years ago
jackun ee2933bff5
Resize fonts 4 years ago
Alessandro Toia 8cad40cfac Change order of cpu/gpu load colors and data 4 years ago
FlightlessMango f3987ec65c Move frame_timings ms text to above 4 years ago
FlightlessMango 9124f0f26a Let graphs take up full content region 4 years ago
Alessandro Toia d855dc6691 Also change delimiter for media_player_order to + 4 years ago
Alessandro Toia 6ee6663fb6 Change delimiter for cpu and gpu load change and color to + 4 years ago
Alessandro Toia e4fe24a051 Use "+" as a delimiter for param blacklist 4 years ago
Alessandro Toia 221c355f15 Check if item exits before adding to blacklist 4 years ago
Alessandro Toia ef05ab2f20 Parse blacklist with parse_str_tokenize 4 years ago
Alessandro Toia 7c80dc53ef Allow users to add a new item to the blacklist from config file 4 years ago
jackun 0474c93800
Change `change_on_load_temp`'s `current` param to unsigned 4 years ago
jackun 1e8487c991
Move color conversion to HudElements; move some overlay related functions back to overlay.cpp 4 years ago
FlightlessMango 44d5546ba5 Add param table_columns 4 years ago
flightlessmango ce6a87823b
Merge pull request #388 from flgx16/cpu_power
Add cpu_power
4 years ago
flightlessmango f91e4f9a33
Merge pull request #395 from gort818/no_ms
Add param to enable/disable fps milliseconds text
4 years ago
FlightlessMango 7e93453a77 Changed fps_limit's delimiter to + 4 years ago
Alessandro Toia 92146c5833 Add frametime param to enable/disable frametime data next to fps 4 years ago