Repository navigation
Conversation
Author
|
By the way, I recently found a regression on FreeBSD with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This draft aims to adds native FreeBSD (and some general BSD) support to MangoHud without requiring Linux compatibility layers (
linprocfs/linsysfs).Summary of Changes
meson.build,src/meson.build,mangohud-next/legacy_gpu_wrapper/):freebsd,netbsd,openbsd, anddragonfly, wiringbackend_modules(<module>_<os>.cpp),notify_kqueue.cpp, andnet_getifaddrs.cpp.$LIBtoken expansion andmangohud-next(which depends onsd-bus/Wayland IPC) to Linux; provide a no-opwrapper_stub.cppforMangoHud_LegacyGPUWrapperon non-Linux hosts.-Wl,--undefined-versionon FreeBSD solldaccepts symbols inmangohud.versionthat are absent on BSD builds, and passdep_x11when checkingNVCtrl/NVCtrl.hso/usr/local/includeis searched.libdrm,libdrm_amdgpu, andlibkvmon FreeBSD.mangohud-next/client/real_dlsym.c):*ld-elf*.so*on FreeBSD and DragonFlyBSD, where realdlopen/dlsymsymbols reside inrtldrather thanlibc.src/*_freebsd.cpp,src/sysctl_utils.h):gpu_freebsd.cpp): Enumerate display devices via/dev/pci(PCIOCGETCONF) so GPUs without DRM render nodes (such as the proprietary NVIDIA driver versions 470xx and earlier, that unlike its Linux counterparts don't have it) are still detected.amdgpu_freebsd.cpp): Query GPU load, clocks, temperature, power, voltage, and VRAM/GTT usage directly throughlibdrm_amdgpu(amdgpu_query_sensor_info/amdgpu_query_heap_info).cpu_freebsd.cpp): Read per-core and aggregate tick counters viakern.cp_times/kern.cp_time, frequencies viadev.cpu.N.freq, temperatures viadev.cpu.N.temperature(coretemp/amdtemp), and package power via RAPL MSRs throughcpuctl(4)(/dev/cpuctl0).memory_freebsd.cpp): Read VM page statistics fromvm.stats.vm.*, swap usage viakvm_getswapinfo(), and per-process RSS/virtual size viaKERN_PROC_PID.file_utils_freebsd.cpp,iostats_freebsd.cpp): Resolve executable paths,comm,argv, and loaded libraries viaKERN_PROC_*sysctls anddl_iterate_phdr(), and estimate process I/O bytes fromki_rusage.ru_inblock/ru_oublockscaled by filesystemf_iosize.battery_freebsd.cpp): Queryhw.acpi.battery.*sysctls and/dev/acpi(ACPIIO_BATT_GET_BIX/ACPIIO_BATT_GET_BST) for multi-battery state and discharge wattage.notify_kqueue.cpp,net_getifaddrs.cpp,system_info_freebsd.cpp): Watch config file changes withkqueue(EVFILT_VNODE) and read interface byte counters fromAF_LINKgetifaddrs()entries.Purpose of this
Currently, porting and build MangoHud to FreeBSD requires a hell of patches because MangoHud assumes many Linux-specific features and paths, leaving MangoHUD stuck on version 0.6.9 in the FreeBSD ports tree for this very reason, and the port was broken for years. This series of PRs aims to address these issues; of course, certain edge cases might remain. This was tested on FreeBSD 15.1-RELEASE.
shoutout to @XaeroVincent for the patches, I took care of implementing them in a distilled way. Xaero's patches have been tested with both NVIDIA and AMD GPUs, so neither Xaero nor I can verify how they work on Intel integrated graphics. They should apply to a wide range of Mesa drivers and the proprietary NVIDIA drivers.
This is the final preparation phase for FreeBSD support that started in 2021 with #652, as with the rest, I'm open to any change for this.
Additional info
mangohud-nextto work on FreeBSD is out of scope for this PR, it depends on systemd-components and systemd is Linux-only, FreeBSD supports Wayland and Wayland on OpenBSD is currently experimental, hopefully that may be addressed in the future.TODO before marking ready for review