mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 18:32:10 +02:00
Compare commits
195 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 42b7d567a1 | |||
| 2790493cba | |||
| 8eabc49e12 | |||
| 3252812699 | |||
| 3fa308386f | |||
| 84ee7cef7c | |||
| 57f6aff2de | |||
| d745d7afef | |||
| 510a1f57f8 | |||
| a1c9b24755 | |||
| 75e6f48dfd | |||
| ed7b12e733 | |||
| 9c56839c97 | |||
| 6647980ce3 | |||
| 80f8b086ca | |||
| 8c2dd1aeac | |||
| ae3c6f1e63 | |||
| 7cc381339c | |||
| aa58a0999d | |||
| 4580f3fd54 | |||
| 6c0c4fa2cf | |||
| 526324be38 | |||
| efb0f335e1 | |||
| 9b23ce94ab | |||
| 47000f2aaf | |||
| cb3ca73f60 | |||
| fd0b35f21a | |||
| 0e7dda4043 | |||
| 5f7b9d2473 | |||
| f8cbe4c008 | |||
| 41df915f29 | |||
| ef440a015d | |||
| 180cbce3a2 | |||
| 64ec76f5a6 | |||
| 9860fb67d4 | |||
| 08cbba1d9d | |||
| 095149a4e9 | |||
| a561a96a5f | |||
| 073d6a9337 | |||
| 6851c9cc1a | |||
| 2862f466f3 | |||
| 5e3fdc6c33 | |||
| 03fe5803de | |||
| 6d36ec55c5 | |||
| f098cdbf69 | |||
| 07d3fe3044 | |||
| 636b6fc43d | |||
| ccfba6786c | |||
| 7c2c631807 | |||
| 6769410753 | |||
| 40b9af6c36 | |||
| e63dfdd8b1 | |||
| a6639d7211 | |||
| 3e251f602a | |||
| ec25ca9fc7 | |||
| 396d20f2da | |||
| 49181fd0bf | |||
| 5eb1dbe7bf | |||
| 690e988cab | |||
| fd41770d6e | |||
| fb26cb1394 | |||
| 4e4efa67e6 | |||
| 0dfb1b6bb1 | |||
| bcbca38b1e | |||
| 3f0ccf802c | |||
| 691cb4ac24 | |||
| 282939f548 | |||
| 6f35b2f382 | |||
| 6700f63091 | |||
| 5c37ebec70 | |||
| 28a419d252 | |||
| 95128ee95f | |||
| c94180b3d2 | |||
| 12ca1a0cf7 | |||
| 67564dfa2c | |||
| a1e79a9522 | |||
| e16f8ef349 | |||
| fd1a2072b3 | |||
| aa45e70910 | |||
| 5374feb24b | |||
| 12ac0ac7a9 | |||
| 3d78666ed3 | |||
| dd2cc116bd | |||
| ba2636dc1a | |||
| 69589f1ad5 | |||
| 39da11de8e | |||
| 8b7a4daeda | |||
| 82af7a5b52 | |||
| a2d99695fd | |||
| 3a2786a89f | |||
| a6cb30d6c8 | |||
| de6b1f9542 | |||
| 77431671bb | |||
| 4430b7145e | |||
| 898859cc7a | |||
| 43b96df112 | |||
| bb97893bd0 | |||
| 9b21ec6e1f | |||
| ffac354368 | |||
| a9aab51764 | |||
| 4d1fc9ceb1 | |||
| e897a98153 | |||
| 0a8056d835 | |||
| 9681e176b3 | |||
| 1f8be43881 | |||
| 30813551be | |||
| beb564f374 | |||
| 5c97c012a9 | |||
| 50da7cabd6 | |||
| a6528cdfd6 | |||
| 588201fe46 | |||
| 6184b5ee96 | |||
| 5e7baa9d0a | |||
| 79ae650c58 | |||
| 44107f289e | |||
| 75927a87b2 | |||
| 85da30ccf5 | |||
| f73c3b85c2 | |||
| 66bef2fc19 | |||
| 7c5eb021ee | |||
| f902e3b3d8 | |||
| 553124ab5b | |||
| 6c6d93370d | |||
| 55ae3a7dbd | |||
| 586874080f | |||
| d5b91a8983 | |||
| 72fee13112 | |||
| 20ae897f39 | |||
| 6f756d103f | |||
| c9dd858ce3 | |||
| 2e201eaaf7 | |||
| 7c54dcba69 | |||
| a107395707 | |||
| 8a9fe22855 | |||
| 7e04e23528 | |||
| 8d779f68f3 | |||
| 98ba08c1a0 | |||
| a1499b82f8 | |||
| c6c866d78a | |||
| 7a6999bd20 | |||
| 1084cf3523 | |||
| ed5f2a3968 | |||
| 17e1d4b72d | |||
| 912f6c4f3c | |||
| 77d71b5fef | |||
| 6938a73a8a | |||
| cee9df189d | |||
| 2a125e226b | |||
| 4a7e60ef57 | |||
| 0a6140346e | |||
| 01862ebc04 | |||
| 3185299214 | |||
| 5b6ebe4f11 | |||
| 6274ef591b | |||
| 7acdaebee4 | |||
| 6dcfb6b88f | |||
| 064972aecd | |||
| b9dbb66bd7 | |||
| a01792c06c | |||
| d707a67f89 | |||
| 5d8aa11d81 | |||
| a87463fc09 | |||
| d0a4a012c4 | |||
| 6a82d73fe9 | |||
| 7504484f21 | |||
| d497853af5 | |||
| c2f815f5ba | |||
| 4bd4ec2897 | |||
| fc685e9aa0 | |||
| 14d3bd89a7 | |||
| c3970154d6 | |||
| 66aee54401 | |||
| 979f7d19b1 | |||
| f238138711 | |||
| 6c88981b05 | |||
| c935527e6f | |||
| 04915945f5 | |||
| 153df44282 | |||
| 22012556f8 | |||
| d0b03c380b | |||
| de2cd79632 | |||
| cc40ef42f0 | |||
| ba45073e04 | |||
| a3c3f3829d | |||
| 79b7b15b46 | |||
| 111f7111b2 | |||
| 5147651bcb | |||
| ba60d9059f | |||
| 8f205b8c30 | |||
| e046787aec | |||
| 743eebaa6b | |||
| 609caad02f | |||
| a0c47204bb | |||
| 1c87693867 | |||
| 42b756e703 |
@@ -13,6 +13,7 @@ assignees: ''
|
||||
|
||||
* What happened:
|
||||
* What should happen:
|
||||
* Fastfetch version used: <!-- please use the latest version, if possible -->
|
||||
* Did it work in an older version: <!-- if yes, which version -->
|
||||
* Where did you get the binary: <!-- Github Release / Github Actions / Installed with a package manager (What package manager) / Built from source yourself -->
|
||||
* Does this issue still occurs in [the latest dev build](https://github.com/fastfetch-cli/fastfetch/actions/)?
|
||||
@@ -41,18 +42,19 @@ Output of `fastfetch --list-features`:
|
||||
//paste here
|
||||
```
|
||||
|
||||
## If fastfatch crashed
|
||||
## If fastfatch crashed or freezed
|
||||
|
||||
Paste the stacktrace here. You may get it with:
|
||||
|
||||
```
|
||||
$ gdb -q -ex 'set confirm off' -ex run -ex 'bt full' -ex quit --args /path/to/fastfetch
|
||||
```shell
|
||||
# You may need Ctrl+C to stop the process if it freezes
|
||||
gdb -q -ex 'set confirm off' -ex run -ex 'bt full' -ex quit --args /path/to/fastfetch
|
||||
```
|
||||
|
||||
If you are able to identify which module crashed, the strace can be helpful too
|
||||
|
||||
```
|
||||
$ strace /path/to/fastfetch --multithreading false --structure {MODULE} --pipe
|
||||
```shell
|
||||
strace /path/to/fastfetch --multithreading false -s {MODULE} --pipe
|
||||
```
|
||||
|
||||
If you cannot do the instructions above, please upload the core dump file:
|
||||
|
||||
@@ -7,10 +7,28 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Before requesting a new feature, please try `fastfetch -c all.jsonc` to see if it has been supported -->
|
||||
## Before requesting a new feature
|
||||
|
||||
# Current state:
|
||||
* A lot of features are not enabled by default. Please try `fastfetch --list-modules` and `fastfetch -c all.jsonc` to see if it has been supported
|
||||
* Fastfetch supports `Command` module, which can be used to grab output from a custom shell script. Please check if it fits your needs
|
||||
|
||||
# Wanted state:
|
||||
```jsonc
|
||||
// ~/.config/fastfetch/fastfetch.jsonc
|
||||
{
|
||||
"modules": [
|
||||
{
|
||||
"type": "command",
|
||||
"text": "/path/to/your/script",
|
||||
"key": "Feature Title"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
# Why the change is sensible:
|
||||
## Wanted features:
|
||||
|
||||
<!-- Your features here -->
|
||||
|
||||
## Motivation:
|
||||
|
||||
<!-- Your motivation here -->
|
||||
|
||||
@@ -7,6 +7,8 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Tip: A logo can be displayed by fastfetch without getting into fastfetch's official repo. For highly customized logo for personal use, it's recommended to keep it locally. Please refer to https://github.com/fastfetch-cli/fastfetch/wiki/Migrate-Neofetch-Logo-To-Fastfetch
|
||||
|
||||
# OS
|
||||
```
|
||||
Paste content of /etc/os-release here. If this file doesn't exist, describe a way to identify the distro.
|
||||
|
||||
+125
-57
@@ -19,58 +19,6 @@ jobs:
|
||||
- name: Run Spellchecker
|
||||
run: codespell
|
||||
|
||||
linux-buildtest:
|
||||
name: Linux build test
|
||||
permissions:
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
compiler: [
|
||||
{ cc: gcc, cxx: "g++" },
|
||||
{ cc: clang, cxx: "clang++" },
|
||||
{ cc: "musl-gcc", cxx: "musl-g++" }
|
||||
]
|
||||
enableFeatures: [ON, OFF]
|
||||
exclude:
|
||||
# The feature libraries are all build against glibc, so they can't be used with musl
|
||||
- compiler: { cc: "musl-gcc", cxx: "musl-g++" }
|
||||
enableFeatures: ON
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: uname -a
|
||||
run: uname -a
|
||||
|
||||
- name: install required packages
|
||||
run: sudo apt-get update && sudo apt-get install -y musl-dev musl-tools linux-headers-generic libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev librpm-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev libddcutil-dev libchafa-dev libdrm-dev directx-headers-dev
|
||||
|
||||
- name: configure project
|
||||
env:
|
||||
CC: ${{ matrix.compiler.cc }}
|
||||
CXX: ${{ matrix.compiler.cxx }}
|
||||
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_VULKAN=${{ matrix.enableFeatures }} -DENABLE_WAYLAND=${{ matrix.enableFeatures }} -DENABLE_XCB_RANDR=${{ matrix.enableFeatures }} -DENABLE_XCB=${{ matrix.enableFeatures }} -DENABLE_XRANDR=${{ matrix.enableFeatures }} -DENABLE_X11=${{ matrix.enableFeatures }} -DENABLE_GIO=${{ matrix.enableFeatures }} -DENABLE_DCONF=${{ matrix.enableFeatures }} -DENABLE_DBUS=${{ matrix.enableFeatures }} -DENABLE_XFCONF=${{ matrix.enableFeatures }} -DENABLE_SQLITE3=${{ matrix.enableFeatures }} -DENABLE_RPM=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK7=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK6=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} -DENABLE_ZLIB=${{ matrix.enableFeatures }} -DENABLE_EGL=${{ matrix.enableFeatures }} -DENABLE_GLX=${{ matrix.enableFeatures }} -DENABLE_OSMESA=${{ matrix.enableFeatures }} -DENABLE_OPENCL=${{ matrix.enableFeatures }} -DENABLE_LIBNM=${{ matrix.enableFeatures }} -DENABLE_PULSE=${{ matrix.enableFeatures }} -DENABLE_DIRECTX_HEADERS=${{ matrix.enableFeatures }} -DENABLE_DRM=${{ matrix.enableFeatures }} -DENABLE_DDCUTIL=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} .
|
||||
|
||||
- name: build project
|
||||
run: cmake --build . --verbose -j4
|
||||
|
||||
- name: run tests
|
||||
run: ctest
|
||||
|
||||
- name: run fastfetch --list-features
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: run fastfetch
|
||||
run: time ./fastfetch -c presets/ci.jsonc
|
||||
|
||||
- name: run fastfetch --format json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
|
||||
- name: run flashfetch
|
||||
run: time ./flashfetch
|
||||
|
||||
Linux-old-amd64:
|
||||
name: Linux-old-amd64
|
||||
runs-on: ubuntu-20.04
|
||||
@@ -230,6 +178,84 @@ jobs:
|
||||
name: fastfetch-linux-aarch64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
musl-amd64:
|
||||
name: Musl-amd64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: setup alpine linux
|
||||
uses: jirutka/setup-alpine@master
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
cat /etc/alpine-release
|
||||
uname -a
|
||||
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev gcc g++
|
||||
shell: alpine.sh --root {0}
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr -DIS_MUSL=ON -GNinja .
|
||||
cmake --build . --target package --verbose -j4
|
||||
shell: alpine.sh {0}
|
||||
|
||||
- name: run
|
||||
run: |
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest
|
||||
shell: alpine.sh {0}
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fastfetch-musl-amd64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
musl-aarch64:
|
||||
name: Musl-aarch64
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: setup alpine linux
|
||||
uses: jirutka/setup-alpine@master
|
||||
with:
|
||||
arch: aarch64
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
cat /etc/alpine-release
|
||||
uname -a
|
||||
apk add cmake samurai vulkan-loader-dev libxcb-dev wayland-dev libdrm-dev dconf-dev imagemagick-dev chafa-dev zlib-dev dbus-dev mesa-dev opencl-dev xfconf-dev sqlite-dev networkmanager-dev pulseaudio-dev ddcutil-dev gcc g++
|
||||
shell: alpine.sh --root {0}
|
||||
|
||||
- name: build
|
||||
run: |
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr -DIS_MUSL=ON -GNinja .
|
||||
cmake --build . --target package --verbose -j4
|
||||
shell: alpine.sh {0}
|
||||
|
||||
- name: run
|
||||
run: |
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest
|
||||
shell: alpine.sh {0}
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fastfetch-musl-aarch64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
macos-universal:
|
||||
name: macOS-universal
|
||||
runs-on: macos-latest
|
||||
@@ -245,8 +271,7 @@ jobs:
|
||||
|
||||
- name: install required packages
|
||||
run: |
|
||||
brew update
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install vulkan-loader vulkan-headers molten-vk imagemagick chafa
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --overwrite vulkan-loader vulkan-headers molten-vk imagemagick chafa
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
@@ -288,7 +313,7 @@ jobs:
|
||||
|
||||
freebsd-amd64:
|
||||
name: FreeBSD-amd64
|
||||
runs-on: macos-12
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
@@ -300,6 +325,9 @@ jobs:
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
operating_system: freebsd
|
||||
architecture: x86-64
|
||||
cpu_count: 3
|
||||
shell: bash
|
||||
version: '13.2'
|
||||
run: |
|
||||
uname -a
|
||||
@@ -320,6 +348,43 @@ jobs:
|
||||
name: fastfetch-freebsd-amd64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
freebsd-aarch64:
|
||||
name: FreeBSD-aarch64
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
security-events: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: run VM
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
operating_system: freebsd
|
||||
architecture: arm64
|
||||
cpu_count: 3
|
||||
shell: bash
|
||||
version: '13.2'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg update
|
||||
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd v4l_compat
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch
|
||||
time ./fastfetch --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fastfetch-freebsd-aarch64
|
||||
path: ./fastfetch-*.*
|
||||
|
||||
windows-amd64:
|
||||
name: Windows-amd64
|
||||
runs-on: windows-latest
|
||||
@@ -338,7 +403,7 @@ jobs:
|
||||
with:
|
||||
msystem: CLANG64
|
||||
update: true
|
||||
install: git mingw-w64-clang-x86_64-7zip mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-opencl-icd
|
||||
install: git mingw-w64-clang-x86_64-7zip mingw-w64-clang-x86_64-cmake mingw-w64-clang-x86_64-clang mingw-w64-clang-x86_64-vulkan-loader mingw-w64-clang-x86_64-vulkan-headers mingw-w64-clang-x86_64-opencl-icd
|
||||
|
||||
- name: print msys version
|
||||
run: uname -a
|
||||
@@ -400,7 +465,7 @@ jobs:
|
||||
with:
|
||||
msystem: CLANG32
|
||||
update: true
|
||||
install: git mingw-w64-clang-i686-7zip mingw-w64-clang-i686-cmake mingw-w64-clang-i686-clang mingw-w64-clang-i686-vulkan-loader mingw-w64-clang-i686-opencl-icd
|
||||
install: git mingw-w64-clang-i686-7zip mingw-w64-clang-i686-cmake mingw-w64-clang-i686-clang mingw-w64-clang-i686-vulkan-loader mingw-w64-clang-i686-vulkan-headers mingw-w64-clang-i686-opencl-icd
|
||||
|
||||
- name: print msys version
|
||||
run: uname -a
|
||||
@@ -456,8 +521,11 @@ jobs:
|
||||
needs:
|
||||
- linux-amd64
|
||||
- linux-aarch64
|
||||
- musl-amd64
|
||||
- musl-aarch64
|
||||
- macos-universal
|
||||
- freebsd-amd64
|
||||
- freebsd-aarch64
|
||||
- windows-amd64
|
||||
- windows-i686
|
||||
permissions:
|
||||
|
||||
+6
-6
@@ -1,9 +1,9 @@
|
||||
**/build/
|
||||
**/.vscode/
|
||||
**/.cache/
|
||||
**/.kdev4/
|
||||
**/.DS_Store
|
||||
/.vs
|
||||
build/
|
||||
.vs/
|
||||
.vscode/
|
||||
.cache/
|
||||
.kdev4/
|
||||
.DS_Store
|
||||
cscope.*
|
||||
tags
|
||||
fastfetch.kdev4
|
||||
|
||||
+149
@@ -1,3 +1,152 @@
|
||||
# 2.10.2
|
||||
|
||||
Bugfixes:
|
||||
* Fix a regression that detect x11 as wayland (#805, WM, Linux)
|
||||
|
||||
# 2.10.1
|
||||
|
||||
Bugfixes:
|
||||
* Fix build with `-DENABLE_DBUS=OFF` (Linux)
|
||||
|
||||
# 2.10.0
|
||||
|
||||
Changes:
|
||||
* We now always detect max frequency of GPUs for consistent, instead of current frequency
|
||||
|
||||
Features:
|
||||
* Improve display detection for wlroots based WMs. Fastfetch now correctly reports fractional scale factors in hyprland (Display, Linux)
|
||||
* Improve GPU detection on Linux (GPU, Linux)
|
||||
* Support GPU memory usage detection for AMD GPUs
|
||||
* Support GPU frequency detection for Intel GPUs
|
||||
* Improve performance of Gnome version detection (DE, Linux)
|
||||
* Improve performance of kitty version detection (Terminal, Linux)
|
||||
* Detect refresh rate when using `--ds-force-drm sysfs-only` (Display, Linux)
|
||||
* Add option `--ts-version` to disable terminal and shell version detection. Mainly for benchmarking purposes
|
||||
* Improve performance of detecting WSL version (Host, Linux)
|
||||
|
||||
Bugfixes:
|
||||
* Correctly detect `/bin/sh` as current shell if it's used as default shell (#798, Shell, Linux)
|
||||
* Work around an issue which CPU module reports incorrect CPU frequency that is too high (#800, CPU, Linux)
|
||||
* Don't print ANSI escape codes in `--pipe` mode
|
||||
|
||||
# 2.9.2
|
||||
|
||||
Changes:
|
||||
* To make use of the newly introduced `yyjson` flag `YYJSON_WRITE_NEWLINE_AT_END`, fastfetch now requires `yyjson` 0.9.0 or later
|
||||
|
||||
Features:
|
||||
* Always add a final new-line when generating JSON output
|
||||
* Detect partition create time, which can be used as OS installation time (Disk)
|
||||
* Print time string when generating JSON result instead of UNIX epoch time number, which is more human-readable
|
||||
|
||||
Bugfixes:
|
||||
* Fix a memory leak
|
||||
* Better portable mode detection of Windows Terminal (TerminalFont, Windows)
|
||||
* Fix parsing of option `--packages-disabled` (Packages)
|
||||
* Don't use command `time` as a shell (Shell)
|
||||
|
||||
Logos:
|
||||
* Add openSUSE MicroOS
|
||||
* Fix color of AOSC OS
|
||||
|
||||
# 2.9.1
|
||||
|
||||
Features:
|
||||
* Support weston-terminal (missed commit in v2.9.0) (TerminalFont, Linux)
|
||||
* Support hyprcursor detection (#776, Cursor, Linux)
|
||||
|
||||
Bugfixes:
|
||||
* Fix `fastfetch --gen-config` raises SIGSEGV when `~/.config/fastfetch` doesn't exist. Regression of `2.9.0` (#778)
|
||||
|
||||
# 2.9.0
|
||||
|
||||
Features:
|
||||
* Support Lxterminal version detection (Terminal, Linux)
|
||||
* Support weston-terminal version detection (Terminal, Linux)
|
||||
* Support `am` package manager detection (#771, Packages, Linux)
|
||||
* Support network prefix length detection for IPv6 (LocalIP)
|
||||
* Display all IPs when multiple IPs are assigned to the same interface (LocalIP)
|
||||
* Add option `--localip-show-prefix-len` to show network prefix length for both IPv4 and IPv6. Defaults to `true` (LocalIP)
|
||||
|
||||
Bugfixes:
|
||||
* Fix network prefix length detection when the value is greater than 24 (#773, LocalIP, Linux)
|
||||
* For xfce4-terminal, use system mono font if no config file is found (TerminalFont, Linux)
|
||||
|
||||
# 2.8.10
|
||||
|
||||
Bugfixes:
|
||||
* Don't display 0.00 GHz (CPU, FreeBSD)
|
||||
* Don't detect manufactor of Qualcomm as ARM (CPU, Android)
|
||||
* Ignore `chezmoi` (Terminal, Linux)
|
||||
* Trim trailing possible whitespaces (PublicIP)
|
||||
* Fix detection compatibility for KDE 6 (Font, Linux)
|
||||
* Always use Metal API to detect vmem size (GPU, macOS)
|
||||
|
||||
Features:
|
||||
* Improve stability; print more useful error message; avoid misuse (PublicIP / Weather)
|
||||
* Use MS-DOS device name as mountFrom result, instead of useless GUID volume name (Windows, Disk)
|
||||
* Some adjustments to Terminal detection (Terminal, Windows)
|
||||
* Don't pretty print CMD
|
||||
* Print conhost as Windows Console
|
||||
* Don't detect `wininit` as Terminal
|
||||
|
||||
Logo:
|
||||
* Fix color of Arco Linux
|
||||
|
||||
# 2.8.9
|
||||
|
||||
Bugfixes:
|
||||
* Don't detect `SessionLeader` as terminal, actually (Terminal, Linux)
|
||||
* Fix blurry chafa result when specifying both width and height (#757, Logo)
|
||||
|
||||
Features:
|
||||
* Support new MacBook Air (Host, macOS)
|
||||
* Distinguish min frequency and base frequency (CPU)
|
||||
|
||||
Logo:
|
||||
* Fix proxmox
|
||||
|
||||
# 2.8.8
|
||||
|
||||
Bugfixes:
|
||||
* Fix old fish version compatibility (#744)
|
||||
* Fix truncated texts in `--help format` (#745)
|
||||
* Fix old vulkan-header and libdrm library compatibility (#748, Linux)
|
||||
* Fix possible segfaults in `--help *-format` (#749)
|
||||
* Fix invalid resolution detection when using libdrm (Linux, Display)
|
||||
* Fix segfault when `/sys/devices/system/cpu/cpufreq/` doesn't exist (#750, CPU, Linux)
|
||||
* Don't detect `SessionLeader` as terminal (Terminal, Linux)
|
||||
* Fix detection of client IP (Users, Linux)
|
||||
|
||||
# 2.8.7
|
||||
|
||||
Bugfixes:
|
||||
* Fix max CPU frequency detection for some cases (CPU, Linux)
|
||||
* Fix some memory leaks
|
||||
* Fix ddcutil 2.1 compatibility (Brightness, Linux)
|
||||
* Workaround `permission denied` error when reading `/proc/uptime` (Uptime, Android)
|
||||
|
||||
Features:
|
||||
* Support zellij version detection (Linux, Terminal)
|
||||
|
||||
Logo:
|
||||
* Fix PostMarketOS
|
||||
|
||||
# 2.8.6
|
||||
|
||||
Changes:
|
||||
* Due to newly introduced configs, JSONC option `{ "temperatureUnit": "C" }` has been changed to `{ "temp": { "unit": "C" } }`
|
||||
|
||||
Bugfixes:
|
||||
* Fix incorrect GPU name detection for Intel iGPU on Linux (#736, GPU, Linux)
|
||||
|
||||
Features:
|
||||
* Support additional temperature formatting options (#737)
|
||||
* `{ "temp": { "ndigits": 1 } }`
|
||||
* `{ "temp": { "color": { "green": "green", "yellow": "yellow", "red": "red" } } }`
|
||||
* Support specifying custom `pci.ids` path for Linux (GPU, Linux)
|
||||
* Support warp-linux terminal version & terminal font detection (Terminal, Linux)
|
||||
|
||||
# 2.8.5
|
||||
|
||||
Bugfixes:
|
||||
|
||||
+41
-10
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||
|
||||
project(fastfetch
|
||||
VERSION 2.8.5
|
||||
VERSION 2.10.2
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
@@ -75,6 +75,11 @@ option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
|
||||
option(ENABLE_PROPRIETARY_GPU_DRIVER_API "Enable proprietary GPU driver API (NVML, IGCL and AGS)" ON)
|
||||
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
|
||||
option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
|
||||
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
|
||||
|
||||
if (LINUX)
|
||||
set(CUSTOM_PCI_IDS_PATH "" CACHE STRING "Custom path to file pci.ids, defaults to `/usr/share/hwdata/pci.ids`")
|
||||
endif()
|
||||
|
||||
####################
|
||||
# Compiler options #
|
||||
@@ -118,7 +123,7 @@ if(ENABLE_ASAN)
|
||||
set(FASTFETCH_FLAGS_DEBUG "${FASTFETCH_FLAGS_DEBUG} -fsanitize=address")
|
||||
endif()
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${FASTFETCH_FLAGS_DEBUG} -fstack-protector-all -fno-delete-null-pointer-checks")
|
||||
if(NOT WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
|
||||
endif()
|
||||
@@ -229,10 +234,9 @@ endif()
|
||||
|
||||
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
|
||||
fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)
|
||||
fastfetch_load_text(src/data/help.txt DATATEXT_HELP)
|
||||
fastfetch_load_text(src/data/help_footer.txt DATATEXT_HELP_FOOTER)
|
||||
fastfetch_load_text(src/data/help_color.txt DATATEXT_HELP_COLOR)
|
||||
fastfetch_load_text(src/data/help_format.txt DATATEXT_HELP_FORMAT)
|
||||
fastfetch_load_text(src/data/help_config.txt DATATEXT_HELP_CONFIG)
|
||||
|
||||
configure_file(src/fastfetch_config.h.in fastfetch_config.h @ONLY)
|
||||
configure_file(src/fastfetch_datatext.h.in fastfetch_datatext.h @ONLY)
|
||||
@@ -277,6 +281,7 @@ set(LIBFASTFETCH_SRC
|
||||
src/common/printing.c
|
||||
src/common/properties.c
|
||||
src/common/settings.c
|
||||
src/common/temps.c
|
||||
src/detection/chassis/chassis.c
|
||||
src/detection/cpu/cpu.c
|
||||
src/detection/cpuusage/cpuusage.c
|
||||
@@ -395,7 +400,10 @@ if(LINUX)
|
||||
src/detection/diskio/diskio_linux.c
|
||||
src/detection/displayserver/linux/displayserver_linux.c
|
||||
src/detection/displayserver/linux/drm.c
|
||||
src/detection/displayserver/linux/wayland.c
|
||||
src/detection/displayserver/linux/wayland/wayland.c
|
||||
src/detection/displayserver/linux/wayland/global-output.c
|
||||
src/detection/displayserver/linux/wayland/zwlr-output.c
|
||||
src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c
|
||||
src/detection/displayserver/linux/wmde.c
|
||||
src/detection/displayserver/linux/xcb.c
|
||||
src/detection/displayserver/linux/xlib.c
|
||||
@@ -513,7 +521,10 @@ elseif(BSD)
|
||||
src/detection/diskio/diskio_bsd.c
|
||||
src/detection/displayserver/linux/displayserver_linux.c
|
||||
src/detection/displayserver/linux/drm.c
|
||||
src/detection/displayserver/linux/wayland.c
|
||||
src/detection/displayserver/linux/wayland/wayland.c
|
||||
src/detection/displayserver/linux/wayland/global-output.c
|
||||
src/detection/displayserver/linux/wayland/zwlr-output.c
|
||||
src/detection/displayserver/linux/wayland/wlr-output-management-unstable-v1-protocol.c
|
||||
src/detection/displayserver/linux/wmde.c
|
||||
src/detection/displayserver/linux/xcb.c
|
||||
src/detection/displayserver/linux/xlib.c
|
||||
@@ -695,6 +706,9 @@ check_function_exists(wcwidth HAVE_WCWIDTH)
|
||||
if(NOT HAVE_WCWIDTH)
|
||||
list(APPEND LIBFASTFETCH_SRC src/3rdparty/mk_wcwidch/wcwidth.c)
|
||||
endif()
|
||||
if(LINUX)
|
||||
check_function_exists(statx HAVE_STATX)
|
||||
endif()
|
||||
|
||||
if(ENABLE_SYSTEM_YYJSON)
|
||||
find_package(yyjson)
|
||||
@@ -724,8 +738,8 @@ if(yyjson_FOUND)
|
||||
else()
|
||||
# Used for dlopen finding dylibs installed by homebrew
|
||||
# `/opt/homebrew/lib` is not on in dlopen search path by default
|
||||
if(APPLE AND DEFINED ENV{HOMEBREW_PREFIX})
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ENV{HOMEBREW_PREFIX}/lib")
|
||||
if(APPLE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,/opt/homebrew/lib -Wl,-rpath,/usr/local/lib")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -758,10 +772,19 @@ elseif(APPLE)
|
||||
target_compile_definitions(libfastfetch PUBLIC _DARWIN_C_SOURCE)
|
||||
endif()
|
||||
|
||||
if(HAVE_STATX)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_STATX)
|
||||
endif()
|
||||
|
||||
if(HAVE_WCWIDTH)
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_HAVE_WCWIDTH)
|
||||
endif()
|
||||
|
||||
if(NOT "${CUSTOM_PCI_IDS_PATH}" STREQUAL "")
|
||||
message(STATUS "Custom file path of pci.ids: ${CUSTOM_PCI_IDS_PATH}")
|
||||
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_PCI_IDS_PATH=${CUSTOM_PCI_IDS_PATH})
|
||||
endif()
|
||||
|
||||
function(ff_lib_enable VARNAME PKGCONFIG_NAMES CMAKE_NAME)
|
||||
if(NOT ENABLE_${VARNAME})
|
||||
return()
|
||||
@@ -1115,11 +1138,19 @@ else() # We don't use this in Windows
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(CMAKE_SYSTEM_PROCESSOR "amd64")
|
||||
endif()
|
||||
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
|
||||
if(IS_MUSL)
|
||||
string(TOLOWER "${CMAKE_PROJECT_NAME}-musl-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
|
||||
else()
|
||||
string(TOLOWER "${CMAKE_PROJECT_NAME}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}" CPACK_PACKAGE_FILE_NAME)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LINUX)
|
||||
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB;RPM")
|
||||
find_program(HAVE_DPKG "dpkg")
|
||||
find_program(HAVE_RPMBUILD "rpmbuild")
|
||||
if(HAVE_DPKG AND HAVE_RPMBUILD)
|
||||
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB;RPM")
|
||||
endif()
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION, "utils")
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
[INSERT CONTACT METHOD].
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
@@ -27,9 +27,11 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
|
||||
|
||||
### Linux
|
||||
|
||||
* Ubuntu: `ppa:zhangsongcui3371/fastfetch`
|
||||
* Debian / Ubuntu: Download `fastfetch-<version>-Linux.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and `dpkg -i fastfetch-<version>-Linux.deb`
|
||||
* Arch Linux: `sudo pacman -S fastfetch`. You can also find fastfetch [on the AUR](https://aur.archlinux.org/packages/fastfetch-git).
|
||||
Some distros packaged an outdated fastfetch version. Older version is not supported, please always ensure that the latest version is used.
|
||||
|
||||
* Ubuntu: [`ppa:zhangsongcui3371/fastfetch`](https://launchpad.net/~zhangsongcui3371/+archive/ubuntu/fastfetch) (for Ubuntu 22.04 or above)
|
||||
* Debian / Ubuntu: Download `fastfetch-<version>-Linux.deb` from [Github release page](https://github.com/fastfetch-cli/fastfetch/releases/latest) and `dpkg -i fastfetch-<version>-Linux.deb` (for Ubuntu 22.04 or above and Debian 12 or above).
|
||||
* Arch Linux: `sudo pacman -S fastfetch`
|
||||
* Fedora: `sudo dnf install fastfetch`
|
||||
* Gentoo: `sudo emerge --ask app-misc/fastfetch`
|
||||
* Alpine: `apk add --upgrade fastfetch`
|
||||
@@ -39,7 +41,9 @@ There are [screenshots on different platforms](https://github.com/fastfetch-cli/
|
||||
|
||||
Replace sudo with doas depending on what you use.
|
||||
|
||||
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging)
|
||||
[See also if fastfetch has been packaged for your favorite Linux distro](#Packaging).
|
||||
|
||||
If fastfetch is not packaged for your distro or an outdated version is packaged, [linuxbrew](https://brew.sh/) is a good alternate: `brew install fastfetch`
|
||||
|
||||
### macOS
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
if not type -q fastfetch
|
||||
return
|
||||
exit
|
||||
end
|
||||
|
||||
complete -c fastfetch -f
|
||||
|
||||
Vendored
+36
@@ -1,3 +1,39 @@
|
||||
fastfetch (2.9.2) jammy; urgency=medium
|
||||
|
||||
* Update to 2.9.2
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Tue, 16 Apr 2024 16:32:40 +0800
|
||||
|
||||
fastfetch (2.9.1) jammy; urgency=medium
|
||||
|
||||
* Update to 2.9.1
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Mon, 08 Apr 2024 09:34:30 +0800
|
||||
|
||||
fastfetch (2.8.10) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.10
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Mon, 25 Mar 2024 15:01:53 +0800
|
||||
|
||||
fastfetch (2.8.9) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.9
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Fri, 15 Mar 2024 10:49:42 +0800
|
||||
|
||||
fastfetch (2.8.8) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.8
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Fri, 08 Mar 2024 09:59:41 +0800
|
||||
|
||||
fastfetch (2.8.6) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.6
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Wed, 28 Feb 2024 10:01:40 +0800
|
||||
|
||||
fastfetch (2.8.4) jammy; urgency=medium
|
||||
|
||||
* Update to 2.8.4
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
fastfetch_2.8.4_source.buildinfo universe/utils optional
|
||||
fastfetch_2.9.2_source.buildinfo universe/utils optional
|
||||
|
||||
+222
-89
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema",
|
||||
"$schema": "https://json-schema.org/draft-07/schema",
|
||||
"$defs": {
|
||||
"colors": {
|
||||
"type": "string",
|
||||
@@ -30,6 +30,7 @@
|
||||
"percent": {
|
||||
"description": "Threshold of percentage colors",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"green": {
|
||||
"type": "integer",
|
||||
@@ -44,9 +45,37 @@
|
||||
"description": "Value greater than green and less then yellow will be shown in yellow.\nValue greater than yellow will be shown in red"
|
||||
}
|
||||
}
|
||||
},
|
||||
"temperature": {
|
||||
"description": "Detect and display temperature if supported",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"green": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"description": "Value (in celsius) less then green will be shown in green"
|
||||
},
|
||||
"yellow": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 100,
|
||||
"description": "Value (in celsius) greater than green and less then yellow will be shown in yellow.\nValue greater than yellow will be shown in red"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"title": "JSON config",
|
||||
"description": "JSON config file for fastfetch. Usually be `~/.config/fastfetch.jsonc`",
|
||||
"properties": {
|
||||
@@ -69,6 +98,7 @@
|
||||
{
|
||||
"description": "Fastfetch logo configurations",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Set the type of the logo given",
|
||||
@@ -96,6 +126,7 @@
|
||||
},
|
||||
"color": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Overwrite a color in the logo",
|
||||
"properties": {
|
||||
"1": {
|
||||
@@ -134,8 +165,7 @@
|
||||
"description": "Color 9",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"width": {
|
||||
"type": "integer",
|
||||
@@ -149,6 +179,7 @@
|
||||
},
|
||||
"padding": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set the padding of the logo",
|
||||
"properties": {
|
||||
"top": {
|
||||
@@ -166,8 +197,7 @@
|
||||
"description": "Set the right padding of the logo",
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"printRemaining": {
|
||||
"type": "boolean",
|
||||
@@ -191,6 +221,7 @@
|
||||
},
|
||||
"chafa": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Chafa configuration. See chafa document for details",
|
||||
"properties": {
|
||||
"fgOnly": {
|
||||
@@ -233,17 +264,16 @@
|
||||
"DIFFUSION"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"general": {
|
||||
"description": "Fastfetch general configurations",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"multithreading": {
|
||||
"type": "boolean",
|
||||
@@ -272,7 +302,7 @@
|
||||
"description": "Force display detection to use DRM. Linux only",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "bool",
|
||||
"type": "boolean",
|
||||
"const": false,
|
||||
"description": "Try `wayland`, then `x11`, then `drm`"
|
||||
},
|
||||
@@ -282,7 +312,7 @@
|
||||
"const": "sysfs-only"
|
||||
},
|
||||
{
|
||||
"type": "bool",
|
||||
"type": "boolean",
|
||||
"const": true,
|
||||
"description": "Try `libdrm` first, then `sysfs` if libdrm failed"
|
||||
}
|
||||
@@ -299,12 +329,12 @@
|
||||
"description": "Set the timeout (ms) when waiting for child processes, `-1` for no timeout",
|
||||
"default": 1000
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"display": {
|
||||
"description": "Configure how things to be displayed",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"stat": {
|
||||
"type": "boolean",
|
||||
@@ -345,6 +375,7 @@
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"keys": {
|
||||
"description": "Set the color of the keys",
|
||||
@@ -354,8 +385,7 @@
|
||||
"description": "Set the color of the title",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -390,6 +420,7 @@
|
||||
},
|
||||
"size": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how a size value should be displayed",
|
||||
"properties": {
|
||||
"maxPrefix": {
|
||||
@@ -407,14 +438,48 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"temperatureUnit": {
|
||||
"type": "string",
|
||||
"description": "Set the unit of the temperature",
|
||||
"enum": ["CELSIUS", "C", "FAHRENHEIT", "F", "KELVIN", "K"],
|
||||
"default": "C"
|
||||
"temp": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how temperature values should be displayed",
|
||||
"properties": {
|
||||
"unit": {
|
||||
"type": "string",
|
||||
"description": "Set the unit of the temperature",
|
||||
"enum": ["CELSIUS", "C", "FAHRENHEIT", "F", "KELVIN", "K"],
|
||||
"default": "C"
|
||||
},
|
||||
"ndigits": {
|
||||
"type": "integer",
|
||||
"description": "Set the number of digits to keep after the decimal point when formatting temperature values",
|
||||
"minimum": 0,
|
||||
"maximum": 9,
|
||||
"default": 1
|
||||
},
|
||||
"color": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set color used in different states of temperature values",
|
||||
"properties": {
|
||||
"green": {
|
||||
"description": "Color used in green state",
|
||||
"$ref": "#/$defs/colors"
|
||||
},
|
||||
"yellow": {
|
||||
"description": "Color used in yellow state",
|
||||
"$ref": "#/$defs/colors"
|
||||
},
|
||||
"red": {
|
||||
"description": "Color used in red state",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"bar": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set the bar configuration",
|
||||
"properties": {
|
||||
"charElapsed": {
|
||||
@@ -442,6 +507,7 @@
|
||||
},
|
||||
"percent": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set how a percentage value should be displayed",
|
||||
"properties": {
|
||||
"type": {
|
||||
@@ -460,6 +526,7 @@
|
||||
},
|
||||
"color": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Set color used in different states of percentage bars and numbers",
|
||||
"properties": {
|
||||
"green": {
|
||||
@@ -482,13 +549,18 @@
|
||||
"type": "boolean",
|
||||
"description": "Whether to disable the stdout application buffer",
|
||||
"default": false
|
||||
},
|
||||
"tsVersion": {
|
||||
"type": "boolean",
|
||||
"description": "Whether to detect and display the version of terminal and shell. Mainly for benchmarking",
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"library": {
|
||||
"description": "Set the path of a library to load",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"pci": {
|
||||
"type": "string",
|
||||
@@ -590,8 +662,7 @@
|
||||
"description": "Used for brightness detection of external displays (Linux)",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"modules": {
|
||||
"description": "Fastfetch modules to run",
|
||||
@@ -676,16 +747,20 @@
|
||||
"oneOf": [
|
||||
{
|
||||
"title": "Break",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "break",
|
||||
"description": "Print a empty line"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "module",
|
||||
"description": "No additional properties",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"anyOf": [
|
||||
@@ -823,11 +898,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Battery",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "battery",
|
||||
@@ -839,9 +915,7 @@
|
||||
"default": false
|
||||
},
|
||||
"temp": {
|
||||
"description": "Detect and display Battery temperature if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"percent": {
|
||||
"$ref": "#/$defs/percent"
|
||||
@@ -858,11 +932,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Bluetooth",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "List bluetooth devices",
|
||||
@@ -888,11 +963,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Brightness",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "brightness",
|
||||
@@ -912,6 +988,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Chassis",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "chassis",
|
||||
@@ -933,15 +1011,15 @@
|
||||
},
|
||||
{
|
||||
"title": "CPU",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print CPU name, frequency, etc",
|
||||
"const": "cpu"
|
||||
},
|
||||
"temp": {
|
||||
"description": "Detect and display CPU temperature if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"freqNdigits": {
|
||||
"description": "Set the number of digits to keep after the decimal point when printing CPU frequency",
|
||||
@@ -962,11 +1040,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "CPU Usage",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "cpuusage",
|
||||
@@ -984,6 +1063,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Colors",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print some colored blocks",
|
||||
@@ -1011,6 +1092,7 @@
|
||||
"block": {
|
||||
"description": "Set behavior of block printing",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"width": {
|
||||
"description": "Set the block width in spaces",
|
||||
@@ -1035,6 +1117,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Command",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Running custom shell scripts",
|
||||
@@ -1060,11 +1144,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Custom",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print a custom string, with or without key",
|
||||
@@ -1087,11 +1172,12 @@
|
||||
},
|
||||
"required": [
|
||||
"format"
|
||||
],
|
||||
"additionalProperties": false
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Display",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print resolutions, refresh rates, etc",
|
||||
@@ -1134,11 +1220,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Disk",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print partitions, space usage, disk type, etc",
|
||||
@@ -1193,11 +1280,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "DiskIO",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print physical disk I/O throughput",
|
||||
@@ -1224,11 +1312,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "DE",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "de",
|
||||
@@ -1255,6 +1344,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Gamepad",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "gamepad",
|
||||
@@ -1275,20 +1366,19 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "GPU",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print GPU names, graphic memory size, type, etc",
|
||||
"const": "gpu"
|
||||
},
|
||||
"temp": {
|
||||
"description": "Detect and display GPU temperature if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"driverSpecific": {
|
||||
"description": "Use driver specific method to detect more detailed GPU information (memory usage, core count, etc)",
|
||||
@@ -1321,11 +1411,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Local IP",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "List local IP addresses (v4 or v6), MAC addresses, etc",
|
||||
@@ -1351,6 +1442,11 @@
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"showPrefixLen": {
|
||||
"description": "Show network prefix length (/N)",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"compact": {
|
||||
"description": "Show all IPs in one line",
|
||||
"type": "boolean",
|
||||
@@ -1377,11 +1473,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Memory",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "memory",
|
||||
@@ -1402,11 +1499,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "NetIO",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print network I/O throughput",
|
||||
@@ -1438,11 +1536,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "OpenGL",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print highest OpenGL version supported by the GPU",
|
||||
@@ -1470,20 +1569,47 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Packages",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "packages",
|
||||
"description": "List installed package managers and count of installed packages"
|
||||
},
|
||||
"disabled": {
|
||||
"description": "A colon separated list of package managers to be disabled when detecting",
|
||||
"type": "string",
|
||||
"default": "winget"
|
||||
"description": "List of package managers to be disabled when detecting",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"am",
|
||||
"apk",
|
||||
"brew",
|
||||
"choco",
|
||||
"dpkg",
|
||||
"emerge",
|
||||
"eopkg",
|
||||
"flatpak",
|
||||
"macports",
|
||||
"nix",
|
||||
"opkg",
|
||||
"pacman",
|
||||
"paludis",
|
||||
"pkg",
|
||||
"pkgtool",
|
||||
"rpm",
|
||||
"scoop",
|
||||
"snap",
|
||||
"winget",
|
||||
"xbps"
|
||||
],
|
||||
"uniqueItems": true
|
||||
},
|
||||
"default": ["winget"]
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
@@ -1501,6 +1627,8 @@
|
||||
},
|
||||
{
|
||||
"title": "Physical Disk",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print physical disk information",
|
||||
@@ -1511,9 +1639,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"temp": {
|
||||
"description": "Detect and display SSD temperature if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
"$ref": "#/$defs/temperature"
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
@@ -1527,11 +1653,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Public IP",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print your public IP address, etc",
|
||||
@@ -1561,11 +1688,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Separator",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print a separator line",
|
||||
@@ -1576,11 +1704,12 @@
|
||||
"type": "string",
|
||||
"default": "-"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Sound",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print sound devices, volume, etc",
|
||||
@@ -1611,11 +1740,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Swap",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "swap",
|
||||
@@ -1636,11 +1766,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Title",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print title, which contains your user name, hostname",
|
||||
@@ -1653,6 +1784,8 @@
|
||||
},
|
||||
"color": {
|
||||
"description": "Set colors of the different part of title",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"user": {
|
||||
"description": "Set color of the user name (left part)",
|
||||
@@ -1666,8 +1799,7 @@
|
||||
"description": "Set color of the host name (right part)",
|
||||
"$ref": "#/$defs/colors"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
@@ -1681,11 +1813,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Weather",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"description": "Print weather information",
|
||||
@@ -1718,11 +1851,12 @@
|
||||
"format": {
|
||||
"$ref": "#/$defs/format"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "WM",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "wm",
|
||||
@@ -1752,6 +1886,5 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,17 +84,17 @@
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
"key": " PC",
|
||||
"key": " PC",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
|
||||
"logo": {
|
||||
"type": "none"
|
||||
},
|
||||
"display": {
|
||||
"separator": "-> "
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"type": "title",
|
||||
"format": " {6}{7}{8}"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "┌───────────────────────────── \u001b[1mSystem Information\u001b[0m ─────────────────────────────┐" // `\u001b` is `\033`, or `\e`
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"key": " OS ",
|
||||
"keyColor": "red",
|
||||
"type": "os"
|
||||
},
|
||||
{
|
||||
"key": " Machine ",
|
||||
"keyColor": "green",
|
||||
"type": "host"
|
||||
},
|
||||
{
|
||||
"key": " Kernel ",
|
||||
"keyColor": "magenta",
|
||||
"type": "kernel"
|
||||
},
|
||||
{
|
||||
"key": " Uptime ",
|
||||
"keyColor": "red",
|
||||
"type": "uptime"
|
||||
},
|
||||
{
|
||||
"key": " Resolution ",
|
||||
"keyColor": "yellow",
|
||||
"type": "display",
|
||||
"compactType": "original-with-refresh-rate"
|
||||
},
|
||||
{
|
||||
"key": " WM ",
|
||||
"keyColor": "blue",
|
||||
"type": "wm"
|
||||
},
|
||||
{
|
||||
"key": " DE ",
|
||||
"keyColor": "green",
|
||||
"type": "de"
|
||||
},
|
||||
{
|
||||
"key": " Shell ",
|
||||
"keyColor": "cyan",
|
||||
"type": "shell"
|
||||
},
|
||||
{
|
||||
"key": " Terminal ",
|
||||
"keyColor": "red",
|
||||
"type": "terminal"
|
||||
},
|
||||
{
|
||||
"key": " CPU ",
|
||||
"keyColor": "yellow",
|
||||
"type": "cpu"
|
||||
},
|
||||
{
|
||||
"key": " GPU ",
|
||||
"keyColor": "blue",
|
||||
"type": "gpu"
|
||||
},
|
||||
{
|
||||
"key": " Memory ",
|
||||
"keyColor": "magenta",
|
||||
"type": "memory"
|
||||
},
|
||||
{
|
||||
"key": " Local IP ",
|
||||
"keyColor": "red",
|
||||
"type": "localip",
|
||||
"compact": true
|
||||
},
|
||||
{
|
||||
"key": " Public IP ",
|
||||
"keyColor": "cyan",
|
||||
"type": "publicip"
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "custom",
|
||||
"format": "└──────────────────────────────────────────────────────────────────────────────┘" // `\u001b` is `\033`, or `\e`
|
||||
},
|
||||
"break",
|
||||
{
|
||||
"type": "colors",
|
||||
"paddingLeft": 34,
|
||||
"symbol": "circle"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -19,15 +19,15 @@
|
||||
},
|
||||
{
|
||||
"type": "host",
|
||||
"key": " "
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": " "
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": " "
|
||||
"key": " "
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
},
|
||||
{
|
||||
"type": "icons",
|
||||
"key": "I",
|
||||
"format": "{5}"
|
||||
"key": "I"
|
||||
},
|
||||
{
|
||||
"type": "font",
|
||||
|
||||
@@ -15,17 +15,17 @@
|
||||
"modules": [
|
||||
{
|
||||
"type": "host",
|
||||
"key": "╭─",
|
||||
"key": "╭─",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "├─",
|
||||
"key": "├─",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "├─",
|
||||
"key": "├─",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -77,17 +77,17 @@
|
||||
"break",
|
||||
{
|
||||
"type": "host",
|
||||
"key": " PC",
|
||||
"key": " PC",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "├",
|
||||
"key": "├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "├",
|
||||
"key": "├",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": ""
|
||||
"key": ""
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"uptime",
|
||||
{
|
||||
"type": "battery",
|
||||
"format": "{/4}{-}{/}{4}%{?5} [{5}]{?}"
|
||||
"format": "{/4}{-}{/}{4}{?5} [{5}]{?}"
|
||||
},
|
||||
"break",
|
||||
"packages",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 341 KiB |
Vendored
+257
@@ -1229,6 +1229,18 @@ typedef struct _ctl_lda_args_t ctl_lda_args_t;
|
||||
/// @brief Forward-declare ctl_dce_args_t
|
||||
typedef struct _ctl_dce_args_t ctl_dce_args_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Forward-declare ctl_wire_format_t
|
||||
typedef struct _ctl_wire_format_t ctl_wire_format_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Forward-declare ctl_get_set_wire_format_config_t
|
||||
typedef struct _ctl_get_set_wire_format_config_t ctl_get_set_wire_format_config_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Forward-declare ctl_display_settings_t
|
||||
typedef struct _ctl_display_settings_t ctl_display_settings_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Forward-declare ctl_engine_properties_t
|
||||
typedef struct _ctl_engine_properties_t ctl_engine_properties_t;
|
||||
@@ -2029,6 +2041,8 @@ typedef enum _ctl_std_display_feature_flag_t
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_VESA_COMPRESSION = CTL_BIT(4), ///< [out] Is display compression (VESA DSC) supported
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_HDR = CTL_BIT(5), ///< [out] Is HDR supported
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_HDMI_QMS = CTL_BIT(6), ///< [out] Is HDMI QMS supported
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_HDR10_PLUS_CERTIFIED = CTL_BIT(7), ///< [out] Is HDR10+ certified
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_VESA_HDR_CERTIFIED = CTL_BIT(8), ///< [out] Is VESA HDR certified - for future use
|
||||
CTL_STD_DISPLAY_FEATURE_FLAG_MAX = 0x80000000
|
||||
|
||||
} ctl_std_display_feature_flag_t;
|
||||
@@ -2042,6 +2056,7 @@ typedef enum _ctl_intel_display_feature_flag_t
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_DPST = CTL_BIT(0), ///< [out] Is DPST supported
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_LACE = CTL_BIT(1), ///< [out] Is LACE supported
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_DRRS = CTL_BIT(2), ///< [out] Is DRRS supported
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_ARC_ADAPTIVE_SYNC_CERTIFIED = CTL_BIT(3),///< [out] Is Intel Arc certified adaptive sync display
|
||||
CTL_INTEL_DISPLAY_FEATURE_FLAG_MAX = 0x80000000
|
||||
|
||||
} ctl_intel_display_feature_flag_t;
|
||||
@@ -4398,6 +4413,232 @@ ctlGetSetDynamicContrastEnhancement(
|
||||
ctl_dce_args_t* pDceArgs ///< [in,out] Dynamic Contrast Enhancement arguments
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Color model
|
||||
typedef enum _ctl_wire_format_color_model_t
|
||||
{
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_RGB = 0, ///< Color model RGB
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_420 = 1, ///< Color model YCBCR 420
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_422 = 2, ///< Color model YCBCR 422
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_YCBCR_444 = 3, ///< Color model YCBCR 444
|
||||
CTL_WIRE_FORMAT_COLOR_MODEL_MAX
|
||||
|
||||
} ctl_wire_format_color_model_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Operation type
|
||||
typedef enum _ctl_wire_format_operation_type_t
|
||||
{
|
||||
CTL_WIRE_FORMAT_OPERATION_TYPE_GET = 0, ///< Get request
|
||||
CTL_WIRE_FORMAT_OPERATION_TYPE_SET = 1, ///< Set request
|
||||
CTL_WIRE_FORMAT_OPERATION_TYPE_RESTORE_DEFAULT = 2, ///< Restore to default values
|
||||
CTL_WIRE_FORMAT_OPERATION_TYPE_MAX
|
||||
|
||||
} ctl_wire_format_operation_type_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Wire Format
|
||||
typedef struct _ctl_wire_format_t
|
||||
{
|
||||
uint32_t Size; ///< [in] size of this structure
|
||||
uint8_t Version; ///< [in] version of this structure
|
||||
ctl_wire_format_color_model_t ColorModel; ///< [in,out] Color model
|
||||
ctl_output_bpc_flags_t ColorDepth; ///< [in,out] Color Depth
|
||||
|
||||
} ctl_wire_format_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED
|
||||
/// @brief Maximum Wire Formats Supported
|
||||
#define CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED 4
|
||||
#endif // CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get Set Wire Format
|
||||
typedef struct _ctl_get_set_wire_format_config_t
|
||||
{
|
||||
uint32_t Size; ///< [in] size of this structure
|
||||
uint8_t Version; ///< [in] version of this structure
|
||||
ctl_wire_format_operation_type_t Operation; ///< [in] Get/Set Operation
|
||||
ctl_wire_format_t SupportedWireFormat[CTL_MAX_WIREFORMAT_COLOR_MODELS_SUPPORTED]; ///< [out] Array of WireFormats supported
|
||||
ctl_wire_format_t WireFormat; ///< [in,out] Current/Requested WireFormat based on Operation. During SET
|
||||
///< Operation, if multiple bpc is set, the MIN bpc will be applied
|
||||
|
||||
} ctl_get_set_wire_format_config_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get/Set Color Format and Color Depth
|
||||
///
|
||||
/// @details
|
||||
/// - Get and Set the Color Format and Color Depth of a target
|
||||
///
|
||||
/// @returns
|
||||
/// - CTL_RESULT_SUCCESS
|
||||
/// - CTL_RESULT_ERROR_UNINITIALIZED
|
||||
/// - CTL_RESULT_ERROR_DEVICE_LOST
|
||||
/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hDisplayOutput`
|
||||
/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER
|
||||
/// + `nullptr == pGetSetWireFormatSetting`
|
||||
/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid data passed as argument, WireFormat is not supported"
|
||||
/// - ::CTL_RESULT_ERROR_DISPLAY_NOT_ACTIVE - "Display not active"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle"
|
||||
CTL_APIEXPORT ctl_result_t CTL_APICALL
|
||||
ctlGetSetWireFormat(
|
||||
ctl_display_output_handle_t hDisplayOutput, ///< [in][release] Handle to display output
|
||||
ctl_get_set_wire_format_config_t* pGetSetWireFormatSetting ///< [in][release] Get/Set Wire Format settings to be fetched/applied
|
||||
);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Various display settings
|
||||
typedef uint32_t ctl_display_setting_flags_t;
|
||||
typedef enum _ctl_display_setting_flag_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_FLAG_LOW_LATENCY = CTL_BIT(0), ///< Low latency
|
||||
CTL_DISPLAY_SETTING_FLAG_SOURCE_TM = CTL_BIT(1),///< Source tone mapping
|
||||
CTL_DISPLAY_SETTING_FLAG_CONTENT_TYPE = CTL_BIT(2), ///< Content type
|
||||
CTL_DISPLAY_SETTING_FLAG_QUANTIZATION_RANGE = CTL_BIT(3), ///< Quantization range, full range or limited range
|
||||
CTL_DISPLAY_SETTING_FLAG_PICTURE_AR = CTL_BIT(4), ///< Picture aspect ratio
|
||||
CTL_DISPLAY_SETTING_FLAG_AUDIO = CTL_BIT(5), ///< Audio settings
|
||||
CTL_DISPLAY_SETTING_FLAG_MAX = 0x80000000
|
||||
|
||||
} ctl_display_setting_flag_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Low latency setting
|
||||
typedef enum _ctl_display_setting_low_latency_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_LOW_LATENCY_DEFAULT = 0, ///< Default
|
||||
CTL_DISPLAY_SETTING_LOW_LATENCY_DISABLED = 1, ///< Disabled
|
||||
CTL_DISPLAY_SETTING_LOW_LATENCY_ENABLED = 2, ///< Enabled
|
||||
CTL_DISPLAY_SETTING_LOW_LATENCY_MAX
|
||||
|
||||
} ctl_display_setting_low_latency_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Source tone mapping setting
|
||||
typedef enum _ctl_display_setting_sourcetm_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_SOURCETM_DEFAULT = 0, ///< Default
|
||||
CTL_DISPLAY_SETTING_SOURCETM_DISABLED = 1, ///< Disabled
|
||||
CTL_DISPLAY_SETTING_SOURCETM_ENABLED = 2, ///< Enabled
|
||||
CTL_DISPLAY_SETTING_SOURCETM_MAX
|
||||
|
||||
} ctl_display_setting_sourcetm_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Content type settings
|
||||
typedef enum _ctl_display_setting_content_type_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_DEFAULT = 0, ///< Default content type used by driver. Driver will use internal
|
||||
///< techniques to determine content type and indicate to panel
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_DISABLED = 1, ///< Content type indication is disabled
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_DESKTOP = 2, ///< Typical desktop with a mix of text and graphics
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_MEDIA = 3, ///< Video or media content
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_GAMING = 4, ///< Gaming content
|
||||
CTL_DISPLAY_SETTING_CONTENT_TYPE_MAX
|
||||
|
||||
} ctl_display_setting_content_type_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Quantization range
|
||||
typedef enum _ctl_display_setting_quantization_range_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_DEFAULT = 0, ///< Default based on video format
|
||||
CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_LIMITED_RANGE = 1, ///< Limited range
|
||||
CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_FULL_RANGE = 2, ///< Full range
|
||||
CTL_DISPLAY_SETTING_QUANTIZATION_RANGE_MAX
|
||||
|
||||
} ctl_display_setting_quantization_range_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Picture aspect ratio
|
||||
typedef uint32_t ctl_display_setting_picture_ar_flags_t;
|
||||
typedef enum _ctl_display_setting_picture_ar_flag_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DEFAULT = CTL_BIT(0), ///< Default picture aspect ratio
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_DISABLED = CTL_BIT(1), ///< Picture aspect ratio indication is explicitly disabled
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_4_3 = CTL_BIT(2),///< Aspect ratio of 4:3
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_16_9 = CTL_BIT(3), ///< Aspect ratio of 16:9
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_64_27 = CTL_BIT(4), ///< Aspect ratio of 64:27 or 21:9 anamorphic
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_AR_256_135 = CTL_BIT(5),///< Aspect ratio of 256:135
|
||||
CTL_DISPLAY_SETTING_PICTURE_AR_FLAG_MAX = 0x80000000
|
||||
|
||||
} ctl_display_setting_picture_ar_flag_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Audio settings
|
||||
typedef enum _ctl_display_setting_audio_t
|
||||
{
|
||||
CTL_DISPLAY_SETTING_AUDIO_DEFAULT = 0, ///< Default audio settings, always enumerated and enabled if display
|
||||
///< supports it
|
||||
CTL_DISPLAY_SETTING_AUDIO_DISABLED = 1, ///< Forcefully disable display audio end point enumeration to OS
|
||||
CTL_DISPLAY_SETTING_AUDIO_MAX
|
||||
|
||||
} ctl_display_setting_audio_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get/Set end display settings
|
||||
typedef struct _ctl_display_settings_t
|
||||
{
|
||||
uint32_t Size; ///< [in] size of this structure
|
||||
uint8_t Version; ///< [in] version of this structure
|
||||
bool Set; ///< [in] Flag to indicate Set or Get operation. Default option for all
|
||||
///< features are reserved for Set=true calls, which will reset the setting
|
||||
///< to driver defaults.
|
||||
ctl_display_setting_flags_t SupportedFlags; ///< [out] Display setting flags supported by the display.
|
||||
ctl_display_setting_flags_t ControllableFlags; ///< [out] Display setting flags which can be controlled by the caller.
|
||||
///< Features which doesn't have this flag set cannot be changed by caller.
|
||||
ctl_display_setting_flags_t ValidFlags; ///< [in,out] Display setting flags which caller can use to indicate the
|
||||
///< features it's interested in. This cannot have a bit set which is not
|
||||
///< supported by SupportedFlags and ControllableFlags.
|
||||
ctl_display_setting_low_latency_t LowLatency; ///< [in,out] Low latency state of panel. For HDR10+ Gaming this need to be
|
||||
///< in ENABLED state.
|
||||
ctl_display_setting_sourcetm_t SourceTM; ///< [in,out] Source tone mapping state known to panel. For HDR10+ Gaming
|
||||
///< this need to be in ENABLED state.
|
||||
ctl_display_setting_content_type_t ContentType; ///< [in,out] Source content type known to panel.
|
||||
ctl_display_setting_quantization_range_t QuantizationRange; ///< [in,out] Quantization range
|
||||
ctl_display_setting_picture_ar_flags_t SupportedPictureAR; ///< [out] Supported Picture aspect ratios
|
||||
ctl_display_setting_picture_ar_flag_t PictureAR;///< [in,out] Picture aspect ratio
|
||||
ctl_display_setting_audio_t AudioSettings; ///< [in,out] Audio settings
|
||||
uint32_t Reserved[25]; ///< [out] Reserved fields for future enumerations
|
||||
|
||||
} ctl_display_settings_t;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Get/Set Display settings
|
||||
///
|
||||
/// @details
|
||||
/// - To get/set end display settings like low latency, HDR10+ signaling
|
||||
/// etc. which are controlled via info-frames/secondary data packets
|
||||
///
|
||||
/// @returns
|
||||
/// - CTL_RESULT_SUCCESS
|
||||
/// - CTL_RESULT_ERROR_UNINITIALIZED
|
||||
/// - CTL_RESULT_ERROR_DEVICE_LOST
|
||||
/// - CTL_RESULT_ERROR_INVALID_NULL_HANDLE
|
||||
/// + `nullptr == hDisplayOutput`
|
||||
/// - CTL_RESULT_ERROR_INVALID_NULL_POINTER
|
||||
/// + `nullptr == pDisplaySettings`
|
||||
/// - ::CTL_RESULT_ERROR_UNSUPPORTED_VERSION - "Unsupported version"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_DISPLAY_OUTPUT_HANDLE - "Null OS display output handle"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_INTERFACE - "Null OS interface"
|
||||
/// - ::CTL_RESULT_ERROR_NULL_OS_ADAPATER_HANDLE - "Null OS adapter handle"
|
||||
/// - ::CTL_RESULT_ERROR_KMD_CALL - "Kernel mode driver call failure"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_NULL_HANDLE - "Invalid or Null handle passed"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_NULL_POINTER - "Invalid null pointer"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_OPERATION_TYPE - "Invalid operation type"
|
||||
/// - ::CTL_RESULT_ERROR_INVALID_ARGUMENT - "Invalid combination of parameters"
|
||||
CTL_APIEXPORT ctl_result_t CTL_APICALL
|
||||
ctlGetSetDisplaySettings(
|
||||
ctl_display_output_handle_t hDisplayOutput, ///< [in] Handle to display output
|
||||
ctl_display_settings_t* pDisplaySettings ///< [in,out] End display capabilities
|
||||
);
|
||||
|
||||
|
||||
#if !defined(__GNUC__)
|
||||
#pragma endregion // display
|
||||
@@ -7229,6 +7470,22 @@ typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDynamicContrastEnhancement_t)(
|
||||
);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Function-pointer for ctlGetSetWireFormat
|
||||
typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetWireFormat_t)(
|
||||
ctl_display_output_handle_t,
|
||||
ctl_get_set_wire_format_config_t*
|
||||
);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Function-pointer for ctlGetSetDisplaySettings
|
||||
typedef ctl_result_t (CTL_APICALL *ctl_pfnGetSetDisplaySettings_t)(
|
||||
ctl_display_output_handle_t,
|
||||
ctl_display_settings_t*
|
||||
);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief Function-pointer for ctlEnumEngineGroups
|
||||
typedef ctl_result_t (CTL_APICALL *ctl_pfnEnumEngineGroups_t)(
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"home": "https://github.com/intel/drivers.gpu.control-library",
|
||||
"license": "./LICENSE",
|
||||
"version": "e1776b7be2ceead1296204371447b27860d25a66",
|
||||
"version": "v184",
|
||||
"author": "Intel Corporation"
|
||||
}
|
||||
|
||||
Vendored
+740
-25
@@ -153,6 +153,27 @@ typedef struct nvmlDevice_st* nvmlDevice_t;
|
||||
*/
|
||||
#define NVML_DEVICE_PCI_BUS_ID_BUFFER_V2_SIZE 16
|
||||
|
||||
/**
|
||||
* PCI information about a GPU device.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int version; //!< The version number of this struct
|
||||
unsigned int domain; //!< The PCI domain on which the device's bus resides, 0 to 0xffffffff
|
||||
unsigned int bus; //!< The bus on which the device resides, 0 to 0xff
|
||||
unsigned int device; //!< The device's id on the bus, 0 to 31
|
||||
|
||||
unsigned int pciDeviceId; //!< The combined 16-bit device id and 16-bit vendor id
|
||||
unsigned int pciSubSystemId; //!< The 32-bit Sub System Device ID
|
||||
|
||||
unsigned int baseClass; //!< The 8-bit PCI base class code
|
||||
unsigned int subClass; //!< The 8-bit PCI sub class code
|
||||
|
||||
char busId[NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE]; //!< The tuple domain:bus:device.function PCI identifier (& NULL terminator)
|
||||
} nvmlPciInfoExt_v1_t;
|
||||
typedef nvmlPciInfoExt_v1_t nvmlPciInfoExt_t;
|
||||
#define nvmlPciInfoExt_v1 NVML_STRUCT_VERSION(PciInfoExt, 1)
|
||||
|
||||
/**
|
||||
* PCI information about a GPU device.
|
||||
*/
|
||||
@@ -482,11 +503,16 @@ typedef enum nvmlGpuP2PStatus_enum
|
||||
typedef enum nvmlGpuP2PCapsIndex_enum
|
||||
{
|
||||
NVML_P2P_CAPS_INDEX_READ = 0,
|
||||
NVML_P2P_CAPS_INDEX_WRITE,
|
||||
NVML_P2P_CAPS_INDEX_NVLINK,
|
||||
NVML_P2P_CAPS_INDEX_ATOMICS,
|
||||
NVML_P2P_CAPS_INDEX_PROP,
|
||||
NVML_P2P_CAPS_INDEX_UNKNOWN
|
||||
NVML_P2P_CAPS_INDEX_WRITE = 1,
|
||||
NVML_P2P_CAPS_INDEX_NVLINK = 2,
|
||||
NVML_P2P_CAPS_INDEX_ATOMICS = 3,
|
||||
NVML_P2P_CAPS_INDEX_PCI = 4,
|
||||
/*
|
||||
* DO NOT USE! NVML_P2P_CAPS_INDEX_PROP is deprecated.
|
||||
* Use NVML_P2P_CAPS_INDEX_PCI instead.
|
||||
*/
|
||||
NVML_P2P_CAPS_INDEX_PROP = NVML_P2P_CAPS_INDEX_PCI,
|
||||
NVML_P2P_CAPS_INDEX_UNKNOWN = 5,
|
||||
}nvmlGpuP2PCapsIndex_t;
|
||||
|
||||
/**
|
||||
@@ -526,6 +552,8 @@ typedef enum nvmlSamplingType_enum
|
||||
NVML_PROCESSOR_CLK_SAMPLES = 5, //!< To represent processor clock samples
|
||||
NVML_MEMORY_CLK_SAMPLES = 6, //!< To represent memory clock samples
|
||||
NVML_MODULE_POWER_SAMPLES = 7, //!< To represent module power samples for total module starting Grace Hopper
|
||||
NVML_JPG_UTILIZATION_SAMPLES = 8, //!< To represent percent of time during which NVJPG remains busy
|
||||
NVML_OFA_UTILIZATION_SAMPLES = 9, //!< To represent percent of time during which NVOFA remains busy
|
||||
|
||||
// Keep this last
|
||||
NVML_SAMPLINGTYPE_COUNT
|
||||
@@ -1005,6 +1033,7 @@ typedef enum nvmlReturn_enum
|
||||
NVML_ERROR_DEPRECATED = 26, //!< The requested functionality has been deprecated
|
||||
NVML_ERROR_NOT_READY = 27, //!< The system is not ready for the request
|
||||
NVML_ERROR_GPU_NOT_FOUND = 28, //!< No GPUs were found
|
||||
NVML_ERROR_INVALID_STATE = 29, //!< Resource not in correct state to perform requested operation
|
||||
NVML_ERROR_UNKNOWN = 999 //!< An internal driver error occurred
|
||||
} nvmlReturn_t;
|
||||
|
||||
@@ -1150,11 +1179,14 @@ typedef enum nvmlVgpuDriverCapability_enum
|
||||
*/
|
||||
typedef enum nvmlDeviceVgpuCapability_enum
|
||||
{
|
||||
NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU = 0, //!< Fractional vGPU profiles on this GPU can be used in multi-vGPU configurations
|
||||
NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES = 1, //!< Supports concurrent execution of timesliced vGPU profiles of differing types
|
||||
NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES = 2, //!< Supports concurrent execution of timesliced vGPU profiles of differing framebuffer sizes
|
||||
NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW = 3, //!< GPU device's read_device_buffer expected bandwidth capacity in megabytes per second
|
||||
NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW = 4, //!< GPU device's write_device_buffer expected bandwidth capacity in megabytes per second
|
||||
NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU = 0, //!< Query if the fractional vGPU profiles on this GPU can be used in multi-vGPU configurations
|
||||
NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES = 1, //!< Query if the GPU support concurrent execution of timesliced vGPU profiles of differing types
|
||||
NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES = 2, //!< Query if the GPU support concurrent execution of timesliced vGPU profiles of differing framebuffer sizes
|
||||
NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW = 3, //!< Query the GPU's read_device_buffer expected bandwidth capacity in megabytes per second
|
||||
NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW = 4, //!< Query the GPU's write_device_buffer expected bandwidth capacity in megabytes per second
|
||||
NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING = 5, //!< Query if vGPU profiles on the GPU supports migration data streaming
|
||||
NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU = 6, //!< Set/Get support for mini-quarter vGPU profiles
|
||||
NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU = 7, //!< Set/Get support for compute media engine vGPU profiles
|
||||
// Keep this last
|
||||
NVML_DEVICE_VGPU_CAP_COUNT
|
||||
} nvmlDeviceVgpuCapability_t;
|
||||
@@ -1181,6 +1213,8 @@ typedef enum nvmlDeviceVgpuCapability_enum
|
||||
|
||||
#define INVALID_GPU_INSTANCE_ID 0xFFFFFFFF
|
||||
|
||||
#define NVML_INVALID_VGPU_PLACEMENT_ID 0xFFFF
|
||||
|
||||
/*!
|
||||
* Macros for vGPU instance's virtualization capabilities bitfield.
|
||||
*/
|
||||
@@ -1207,6 +1241,41 @@ typedef unsigned int nvmlVgpuTypeId_t;
|
||||
|
||||
typedef unsigned int nvmlVgpuInstance_t;
|
||||
|
||||
/**
|
||||
* Structure to store the vGPU heterogeneous mode of device -- version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int version; //!< The version number of this struct
|
||||
unsigned int mode; //!< The vGPU heterogeneous mode
|
||||
} nvmlVgpuHeterogeneousMode_v1_t;
|
||||
typedef nvmlVgpuHeterogeneousMode_v1_t nvmlVgpuHeterogeneousMode_t;
|
||||
#define nvmlVgpuHeterogeneousMode_v1 NVML_STRUCT_VERSION(VgpuHeterogeneousMode, 1)
|
||||
|
||||
/**
|
||||
* Structure to store the placement ID of vGPU instance -- version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int version; //!< The version number of this struct
|
||||
unsigned int placementId; //!< Placement ID of the active vGPU instance
|
||||
} nvmlVgpuPlacementId_v1_t;
|
||||
typedef nvmlVgpuPlacementId_v1_t nvmlVgpuPlacementId_t;
|
||||
#define nvmlVgpuPlacementId_v1 NVML_STRUCT_VERSION(VgpuPlacementId, 1)
|
||||
|
||||
/**
|
||||
* Structure to store the list of vGPU placements -- version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int version; //!< The version number of this struct
|
||||
unsigned int placementSize; //!< The number of slots occupied by the vGPU type
|
||||
unsigned int count; //!< Count of placement IDs fetched
|
||||
unsigned int *placementIds; //!< Placement IDs for the vGPU type
|
||||
} nvmlVgpuPlacementList_v1_t;
|
||||
typedef nvmlVgpuPlacementList_v1_t nvmlVgpuPlacementList_t;
|
||||
#define nvmlVgpuPlacementList_v1 NVML_STRUCT_VERSION(VgpuPlacementList, 1)
|
||||
|
||||
/**
|
||||
* Structure to store Utilization Value and vgpuInstance
|
||||
*/
|
||||
@@ -1220,6 +1289,35 @@ typedef struct nvmlVgpuInstanceUtilizationSample_st
|
||||
nvmlValue_t decUtil; //!< Decoder Util Value
|
||||
} nvmlVgpuInstanceUtilizationSample_t;
|
||||
|
||||
/**
|
||||
* Structure to store Utilization Value and vgpuInstance Info -- Version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned long long timeStamp; //!< CPU Timestamp in microseconds
|
||||
nvmlVgpuInstance_t vgpuInstance; //!< vGPU Instance
|
||||
nvmlValue_t smUtil; //!< SM (3D/Compute) Util Value
|
||||
nvmlValue_t memUtil; //!< Frame Buffer Memory Util Value
|
||||
nvmlValue_t encUtil; //!< Encoder Util Value
|
||||
nvmlValue_t decUtil; //!< Decoder Util Value
|
||||
nvmlValue_t jpgUtil; //!< Jpeg Util Value
|
||||
nvmlValue_t ofaUtil; //!< Ofa Util Value
|
||||
} nvmlVgpuInstanceUtilizationInfo_v1_t;
|
||||
|
||||
/**
|
||||
* Structure to store recent utilization for vGPU instances running on a device -- version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int version; //!< The version number of this struct
|
||||
nvmlValueType_t sampleValType; //!< Hold the type of returned sample values
|
||||
unsigned int vgpuInstanceCount; //!< Hold the number of vGPU instances
|
||||
unsigned long long lastSeenTimeStamp; //!< Return only samples with timestamp greater than lastSeenTimeStamp
|
||||
nvmlVgpuInstanceUtilizationInfo_v1_t *vgpuUtilArray; //!< The array (allocated by caller) in which vGPU utilization are returned
|
||||
} nvmlVgpuInstancesUtilizationInfo_v1_t;
|
||||
typedef nvmlVgpuInstancesUtilizationInfo_v1_t nvmlVgpuInstancesUtilizationInfo_t;
|
||||
#define nvmlVgpuInstancesUtilizationInfo_v1 NVML_STRUCT_VERSION(VgpuInstancesUtilizationInfo, 1)
|
||||
|
||||
/**
|
||||
* Structure to store Utilization Value, vgpuInstance and subprocess information
|
||||
*/
|
||||
@@ -1235,6 +1333,36 @@ typedef struct nvmlVgpuProcessUtilizationSample_st
|
||||
unsigned int decUtil; //!< Decoder Util Value
|
||||
} nvmlVgpuProcessUtilizationSample_t;
|
||||
|
||||
/**
|
||||
* Structure to store Utilization Value, vgpuInstance and subprocess information for process running on vGPU instance -- version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
char processName[NVML_VGPU_NAME_BUFFER_SIZE]; //!< Name of process running within the vGPU VM
|
||||
unsigned long long timeStamp; //!< CPU Timestamp in microseconds
|
||||
nvmlVgpuInstance_t vgpuInstance; //!< vGPU Instance
|
||||
unsigned int pid; //!< PID of process running within the vGPU VM
|
||||
unsigned int smUtil; //!< SM (3D/Compute) Util Value
|
||||
unsigned int memUtil; //!< Frame Buffer Memory Util Value
|
||||
unsigned int encUtil; //!< Encoder Util Value
|
||||
unsigned int decUtil; //!< Decoder Util Value
|
||||
unsigned int jpgUtil; //!< Jpeg Util Value
|
||||
unsigned int ofaUtil; //!< Ofa Util Value
|
||||
} nvmlVgpuProcessUtilizationInfo_v1_t;
|
||||
|
||||
/**
|
||||
* Structure to store recent utilization, vgpuInstance and subprocess information for processes running on vGPU instances active on a device -- version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int version; //!< The version number of this struct
|
||||
unsigned int vgpuProcessCount; //!< Hold the number of processes running on vGPU instances
|
||||
unsigned long long lastSeenTimeStamp; //!< Return only samples with timestamp greater than lastSeenTimeStamp
|
||||
nvmlVgpuProcessUtilizationInfo_v1_t *vgpuProcUtilArray; //!< The array (allocated by caller) in which utilization of processes running on vGPU instances are returned
|
||||
} nvmlVgpuProcessesUtilizationInfo_v1_t;
|
||||
typedef nvmlVgpuProcessesUtilizationInfo_v1_t nvmlVgpuProcessesUtilizationInfo_t;
|
||||
#define nvmlVgpuProcessesUtilizationInfo_v1 NVML_STRUCT_VERSION(VgpuProcessesUtilizationInfo, 1)
|
||||
|
||||
/**
|
||||
* vGPU scheduler policies
|
||||
*/
|
||||
@@ -1392,6 +1520,34 @@ typedef struct nvmlProcessUtilizationSample_st
|
||||
unsigned int decUtil; //!< Decoder Util Value
|
||||
} nvmlProcessUtilizationSample_t;
|
||||
|
||||
/**
|
||||
* Structure to store utilization value and process Id -- version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned long long timeStamp; //!< CPU Timestamp in microseconds
|
||||
unsigned int pid; //!< PID of process
|
||||
unsigned int smUtil; //!< SM (3D/Compute) Util Value
|
||||
unsigned int memUtil; //!< Frame Buffer Memory Util Value
|
||||
unsigned int encUtil; //!< Encoder Util Value
|
||||
unsigned int decUtil; //!< Decoder Util Value
|
||||
unsigned int jpgUtil; //!< Jpeg Util Value
|
||||
unsigned int ofaUtil; //!< Ofa Util Value
|
||||
} nvmlProcessUtilizationInfo_v1_t;
|
||||
|
||||
/**
|
||||
* Structure to store utilization and process ID for each running process -- version 1
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int version; //!< The version number of this struct
|
||||
unsigned int processSamplesCount; //!< Caller-supplied array size, and returns number of processes running
|
||||
unsigned long long lastSeenTimeStamp; //!< Return only samples with timestamp greater than lastSeenTimeStamp
|
||||
nvmlProcessUtilizationInfo_v1_t *procUtilArray; //!< The array (allocated by caller) of the utilization of GPU SM, framebuffer, video encoder, video decoder, JPEG, and OFA
|
||||
} nvmlProcessesUtilizationInfo_v1_t;
|
||||
typedef nvmlProcessesUtilizationInfo_v1_t nvmlProcessesUtilizationInfo_t;
|
||||
#define nvmlProcessesUtilizationInfo_v1 NVML_STRUCT_VERSION(ProcessesUtilizationInfo, 1)
|
||||
|
||||
/**
|
||||
* Structure to store license expiry date and time values
|
||||
*/
|
||||
@@ -1429,6 +1585,29 @@ typedef struct nvmlGridLicensableFeatures_st
|
||||
nvmlGridLicensableFeature_t gridLicensableFeatures[NVML_GRID_LICENSE_FEATURE_MAX_COUNT]; //!< Array of vGPU software licensable features.
|
||||
} nvmlGridLicensableFeatures_t;
|
||||
|
||||
/**
|
||||
* Structure to store SRAM uncorrectable error counters
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned int version; //!< the API version number
|
||||
unsigned long long aggregateUncParity; //!< aggregate uncorrectable parity error count
|
||||
unsigned long long aggregateUncSecDed; //!< aggregate uncorrectable SEC-DED error count
|
||||
unsigned long long aggregateCor; //!< aggregate correctable error count
|
||||
unsigned long long volatileUncParity; //!< volatile uncorrectable parity error count
|
||||
unsigned long long volatileUncSecDed; //!< volatile uncorrectable SEC-DED error count
|
||||
unsigned long long volatileCor; //!< volatile correctable error count
|
||||
unsigned long long aggregateUncBucketL2; //!< aggregate uncorrectable error count for L2 cache bucket
|
||||
unsigned long long aggregateUncBucketSm; //!< aggregate uncorrectable error count for SM bucket
|
||||
unsigned long long aggregateUncBucketPcie; //!< aggregate uncorrectable error count for PCIE bucket
|
||||
unsigned long long aggregateUncBucketMcu; //!< aggregate uncorrectable error count for Microcontroller bucket
|
||||
unsigned long long aggregateUncBucketOther; //!< aggregate uncorrectable error count for Other bucket
|
||||
unsigned int bThresholdExceeded; //!< if the error threshold of field diag is exceeded
|
||||
} nvmlEccSramErrorStatus_v1_t;
|
||||
|
||||
typedef nvmlEccSramErrorStatus_v1_t nvmlEccSramErrorStatus_t;
|
||||
#define nvmlEccSramErrorStatus_v1 NVML_STRUCT_VERSION(EccSramErrorStatus, 1)
|
||||
|
||||
/**
|
||||
* GSP firmware
|
||||
*/
|
||||
@@ -1837,7 +2016,9 @@ typedef struct nvmlGpuDynamicPstatesInfo_st
|
||||
#define NVML_FI_DEV_TEMPERATURE_MEM_MAX_TLIMIT 195 //!< T.Limit temperature after which GPU may begin SW slowdown due to memory temperature
|
||||
#define NVML_FI_DEV_TEMPERATURE_GPU_MAX_TLIMIT 196 //!< T.Limit temperature after which GPU may be throttled below base clock
|
||||
|
||||
#define NVML_FI_MAX 197 //!< One greater than the largest field ID defined above
|
||||
#define NVML_FI_DEV_IS_MIG_MODE_INDEPENDENT_MIG_QUERY_CAPABLE 199 //!< MIG mode independent, MIG query capable device. 1=yes. 0=no.
|
||||
|
||||
#define NVML_FI_MAX 200 //!< One greater than the largest field ID defined above
|
||||
|
||||
/**
|
||||
* Information for a Field Value Sample
|
||||
@@ -2248,9 +2429,10 @@ typedef struct nvmlAccountingStats_st {
|
||||
*/
|
||||
typedef enum nvmlEncoderQueryType_enum
|
||||
{
|
||||
NVML_ENCODER_QUERY_H264 = 0, //!< H264 encoder
|
||||
NVML_ENCODER_QUERY_HEVC = 1, //!< HEVC encoder
|
||||
NVML_ENCODER_QUERY_AV1 = 2 //!< AV1 encoder
|
||||
NVML_ENCODER_QUERY_H264 = 0x00, //!< H264 encoder
|
||||
NVML_ENCODER_QUERY_HEVC = 0x01, //!< HEVC encoder
|
||||
NVML_ENCODER_QUERY_AV1 = 0x02, //!< AV1 encoder
|
||||
NVML_ENCODER_QUERY_UNKNOWN = 0xFF //!< Unknown encoder
|
||||
}nvmlEncoderType_t;
|
||||
|
||||
/**
|
||||
@@ -2399,6 +2581,26 @@ typedef struct nvmlConfComputeSystemState_st {
|
||||
unsigned int devToolsMode;
|
||||
} nvmlConfComputeSystemState_t;
|
||||
|
||||
/**
|
||||
* Confidential Compute Multigpu mode values
|
||||
*/
|
||||
#define NVML_CC_SYSTEM_MULTIGPU_NONE 0
|
||||
#define NVML_CC_SYSTEM_MULTIGPU_PROTECTED_PCIE 1
|
||||
|
||||
/**
|
||||
* Confidential Compute System settings
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version;
|
||||
unsigned int environment;
|
||||
unsigned int ccFeature;
|
||||
unsigned int devToolsMode;
|
||||
unsigned int multiGpuMode;
|
||||
} nvmlSystemConfComputeSettings_v1_t;
|
||||
|
||||
typedef nvmlSystemConfComputeSettings_v1_t nvmlSystemConfComputeSettings_t;
|
||||
#define nvmlSystemConfComputeSettings_v1 NVML_STRUCT_VERSION(SystemConfComputeSettings, 1)
|
||||
|
||||
/**
|
||||
* Protected memory size
|
||||
*/
|
||||
@@ -2436,6 +2638,8 @@ typedef struct nvmlConfComputeGpuCertificate_st {
|
||||
#define NVML_CC_GPU_CEC_ATTESTATION_REPORT_SIZE 0x1000
|
||||
#define NVML_CC_CEC_ATTESTATION_REPORT_NOT_PRESENT 0
|
||||
#define NVML_CC_CEC_ATTESTATION_REPORT_PRESENT 1
|
||||
#define NVML_CC_KEY_ROTATION_THRESHOLD_ATTACKER_ADVANTAGE_MIN 50
|
||||
#define NVML_CC_KEY_ROTATION_THRESHOLD_ATTACKER_ADVANTAGE_MAX 75
|
||||
|
||||
typedef struct nvmlConfComputeGpuAttestationReport_st {
|
||||
unsigned int isCecAttestationReportPresent;
|
||||
@@ -2446,6 +2650,24 @@ typedef struct nvmlConfComputeGpuAttestationReport_st {
|
||||
unsigned char cecAttestationReport[NVML_CC_GPU_CEC_ATTESTATION_REPORT_SIZE];
|
||||
} nvmlConfComputeGpuAttestationReport_t;
|
||||
|
||||
typedef struct nvmlConfComputeSetKeyRotationThresholdInfo_st {
|
||||
unsigned int version;
|
||||
unsigned long long maxAttackerAdvantage;
|
||||
} nvmlConfComputeSetKeyRotationThresholdInfo_v1_t;
|
||||
|
||||
typedef nvmlConfComputeSetKeyRotationThresholdInfo_v1_t nvmlConfComputeSetKeyRotationThresholdInfo_t;
|
||||
#define nvmlConfComputeSetKeyRotationThresholdInfo_v1 \
|
||||
NVML_STRUCT_VERSION(ConfComputeSetKeyRotationThresholdInfo, 1)
|
||||
|
||||
typedef struct nvmlConfComputeGetKeyRotationThresholdInfo_st {
|
||||
unsigned int version;
|
||||
unsigned long long attackerAdvantage;
|
||||
} nvmlConfComputeGetKeyRotationThresholdInfo_v1_t;
|
||||
|
||||
typedef nvmlConfComputeGetKeyRotationThresholdInfo_v1_t nvmlConfComputeGetKeyRotationThresholdInfo_t;
|
||||
#define nvmlConfComputeGetKeyRotationThresholdInfo_v1 \
|
||||
NVML_STRUCT_VERSION(ConfComputeGetKeyRotationThresholdInfo, 1)
|
||||
|
||||
/** @} */
|
||||
|
||||
#define NVML_GPU_FABRIC_UUID_LEN 16
|
||||
@@ -2464,6 +2686,55 @@ typedef struct {
|
||||
nvmlGpuFabricState_t state; //!< Current state of GPU registration process
|
||||
} nvmlGpuFabricInfo_t;
|
||||
|
||||
#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_NOT_SUPPORTED 0
|
||||
#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_TRUE 1
|
||||
#define NVML_GPU_FABRIC_HEALTH_MASK_DEGRADED_BW_FALSE 2
|
||||
|
||||
#define NVML_GPU_FABRIC_HEALTH_MASK_SHIFT_DEGRADED_BW 0
|
||||
#define NVML_GPU_FABRIC_HEALTH_MASK_WIDTH_DEGRADED_BW 0x11
|
||||
|
||||
/**
|
||||
* GPU Fabric Health Status Mask for various fields can be obtained
|
||||
* using the below macro.
|
||||
* Ex - NVML_GPU_FABRIC_HEALTH_GET(var, _DEGRADED_BW)
|
||||
*/
|
||||
#define NVML_GPU_FABRIC_HEALTH_GET(var, type) \
|
||||
(((var) >> NVML_GPU_FABRIC_HEALTH_MASK_SHIFT##type) & \
|
||||
(NVML_GPU_FABRIC_HEALTH_MASK_WIDTH##type))
|
||||
|
||||
/**
|
||||
* GPU Fabric Health Status Mask for various fields can be tested
|
||||
* using the below macro.
|
||||
* Ex - NVML_GPU_FABRIC_HEALTH_TEST(var, _DEGRADED_BW, _TRUE)
|
||||
*/
|
||||
#define NVML_GPU_FABRIC_HEALTH_TEST(var, type, val) \
|
||||
(NVML_GPU_FABRIC_HEALTH_GET(var, type) == \
|
||||
NVML_GPU_FABRIC_HEALTH_MASK##type##val)
|
||||
|
||||
/**
|
||||
* GPU Fabric information (v2).
|
||||
*
|
||||
* Version 2 adds the \ref nvmlGpuFabricInfo_v2_t.version field
|
||||
* to the start of the structure, and the \ref nvmlGpuFabricInfo_v2_t.healthMask
|
||||
* field to the end. This structure is not backwards-compatible with
|
||||
* \ref nvmlGpuFabricInfo_t.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int version; //!< Structure version identifier (set to \ref nvmlGpuFabricInfo_v2)
|
||||
unsigned char clusterUuid[NVML_GPU_FABRIC_UUID_LEN]; //!< Uuid of the cluster to which this GPU belongs
|
||||
nvmlReturn_t status; //!< Error status, if any. Must be checked only if state returns "complete".
|
||||
unsigned int cliqueId; //!< ID of the fabric clique to which this GPU belongs
|
||||
nvmlGpuFabricState_t state; //!< Current state of GPU registration process
|
||||
unsigned int healthMask; //!< GPU Fabric health Status Mask
|
||||
} nvmlGpuFabricInfo_v2_t;
|
||||
|
||||
typedef nvmlGpuFabricInfo_v2_t nvmlGpuFabricInfoV_t;
|
||||
|
||||
/**
|
||||
* Version identifier value for \ref nvmlGpuFabricInfo_v2_t.version.
|
||||
*/
|
||||
#define nvmlGpuFabricInfo_v2 NVML_STRUCT_VERSION(GpuFabricInfo, 2)
|
||||
|
||||
/**
|
||||
* Device Scope - This is useful to retrieve the telemetry at GPU and module (e.g. GPU + CPU) level
|
||||
*/
|
||||
@@ -3414,6 +3685,19 @@ nvmlReturn_t DECLDIR nvmlDeviceSetCpuAffinity(nvmlDevice_t device);
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceClearCpuAffinity(nvmlDevice_t device);
|
||||
|
||||
/**
|
||||
* Get the NUMA node of the given GPU device.
|
||||
* This only applies to platforms where the GPUs are NUMA nodes.
|
||||
*
|
||||
* @param[in] device The device handle
|
||||
* @param[out] node NUMA node ID of the device
|
||||
*
|
||||
* @returns
|
||||
* - \ref NVML_SUCCESS if the NUMA node is retrieved successfully
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if request is not supported on the current platform
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device \a node is invalid
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetNumaNodeId(nvmlDevice_t device, unsigned int *node);
|
||||
/**
|
||||
* Retrieve the common ancestor for two devices
|
||||
* For all products.
|
||||
@@ -3726,6 +4010,25 @@ nvmlReturn_t DECLDIR nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableS
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t *mode);
|
||||
|
||||
/**
|
||||
* Retrieves PCI attributes of this device.
|
||||
*
|
||||
* For all products.
|
||||
*
|
||||
* See \ref nvmlPciInfoExt_t for details on the available PCI info.
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param pci Reference in which to return the PCI info
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if \a pci has been populated
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a pci is NULL
|
||||
* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetPciInfoExt(nvmlDevice_t device, nvmlPciInfoExt_t *pci);
|
||||
|
||||
/**
|
||||
* Retrieves the PCI attributes of this device.
|
||||
*
|
||||
@@ -5423,7 +5726,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetMPSComputeRunningProcesses_v3(nvmlDevice_t dev
|
||||
*
|
||||
* To determine the size of the @ref plist->procArray array to allocate, call the function with
|
||||
* @ref plist->numProcArrayEntries set to zero and @ref plist->procArray set to NULL. The return
|
||||
* code will be either NVML_ERROR_INSUFFICIENT_SIZE (if there are valid processes of type
|
||||
* code will be either NVML_ERROR_INSUFFICIENT_SIZE (if there are valid processes of type
|
||||
* @ref plist->mode to report on, in which case the @ref plist->numProcArrayEntries field will
|
||||
* indicate the required number of entries in the array) or NVML_SUCCESS (if no processes of type
|
||||
* @ref plist->mode exist).
|
||||
@@ -5708,7 +6011,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetPcieSpeed(nvmlDevice_t device, unsigned int *p
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param adaptiveClockStatus The current adaptive clocking status, either
|
||||
* @ref NVML_ADAPTIVE_CLOCKING_INFO_STATUS_DISABLED
|
||||
* @ref NVML_ADAPTIVE_CLOCKING_INFO_STATUS_DISABLED
|
||||
* or @ref NVML_ADAPTIVE_CLOCKING_INFO_STATUS_ENABLED
|
||||
*
|
||||
* @return
|
||||
@@ -5735,7 +6038,10 @@ nvmlReturn_t DECLDIR nvmlDeviceGetAdaptiveClockInfoStatus(nvmlDevice_t device, u
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t *type);
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Deprecated: Will be deprecated in a future release. Use \ref nvmlDeviceGetGpuFabricInfoV instead
|
||||
*
|
||||
* Get fabric information associated with the device.
|
||||
*
|
||||
* %HOPPER_OR_NEWER%
|
||||
@@ -5746,6 +6052,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t *ty
|
||||
* This API reports the current state of the GPU in the NVLink fabric
|
||||
* along with other useful information.
|
||||
*
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param gpuFabricInfo Information about GPU fabric state
|
||||
*
|
||||
@@ -5755,6 +6062,30 @@ nvmlReturn_t DECLDIR nvmlDeviceGetBusType(nvmlDevice_t device, nvmlBusType_t *ty
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetGpuFabricInfo(nvmlDevice_t device, nvmlGpuFabricInfo_t *gpuFabricInfo);
|
||||
|
||||
/**
|
||||
* Versioned wrapper around \ref nvmlDeviceGetGpuFabricInfo that accepts a versioned
|
||||
* \ref nvmlGpuFabricInfo_v2_t or later output structure.
|
||||
*
|
||||
* @note The caller must set the \ref nvmlGpuFabricInfoV_t.version field to the
|
||||
* appropriate version prior to calling this function. For example:
|
||||
* \code
|
||||
* nvmlGpuFabricInfoV_t fabricInfo =
|
||||
* { .version = nvmlGpuFabricInfo_v2 };
|
||||
* nvmlReturn_t result = nvmlDeviceGetGpuFabricInfoV(device,&fabricInfo);
|
||||
* \endcode
|
||||
*
|
||||
* %HOPPER_OR_NEWER%
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param gpuFabricInfo Information about GPU fabric state
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS Upon success
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't support gpu fabric
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetGpuFabricInfoV(nvmlDevice_t device,
|
||||
nvmlGpuFabricInfoV_t *gpuFabricInfo);
|
||||
|
||||
/**
|
||||
* Get Conf Computing System capabilities.
|
||||
*
|
||||
@@ -5877,6 +6208,42 @@ nvmlReturn_t DECLDIR nvmlDeviceGetConfComputeGpuCertificate(nvmlDevice_t device,
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetConfComputeGpuAttestationReport(nvmlDevice_t device,
|
||||
nvmlConfComputeGpuAttestationReport_t *gpuAtstReport);
|
||||
/**
|
||||
* Get Conf Computing key rotation threshold detail.
|
||||
*
|
||||
* %HOPPER_OR_NEWER%
|
||||
* Supported on Linux, Windows TCC.
|
||||
*
|
||||
* @param pKeyRotationThrInfo Reference in which to return the key rotation threshold data
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if \a gpu key rotation threshold info has been populated
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a memory is NULL
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlSystemGetConfComputeKeyRotationThresholdInfo(
|
||||
nvmlConfComputeGetKeyRotationThresholdInfo_t *pKeyRotationThrInfo);
|
||||
|
||||
/**
|
||||
* Get Conf Computing System Settings.
|
||||
*
|
||||
* %HOPPER_OR_NEWER%
|
||||
* Supported on Linux, Windows TCC.
|
||||
*
|
||||
* @param settings System CC settings
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if the query is success
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a counters is NULL
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
|
||||
* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
|
||||
* - \ref NVML_ERROR_ARGUMENT_VERSION_MISMATCH if the provided version is invalid/unsupported
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlSystemGetConfComputeSettings(nvmlSystemConfComputeSettings_t *settings);
|
||||
|
||||
/**
|
||||
* Retrieve GSP firmware version.
|
||||
@@ -6241,6 +6608,52 @@ nvmlReturn_t DECLDIR nvmlDeviceGetClkMonStatus(nvmlDevice_t device, nvmlClkMonSt
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t *utilization,
|
||||
unsigned int *processSamplesCount, unsigned long long lastSeenTimeStamp);
|
||||
|
||||
/**
|
||||
* Retrieves the recent utilization and process ID for all running processes
|
||||
*
|
||||
* For Maxwell &tm; or newer fully supported devices.
|
||||
*
|
||||
* Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder, jpeg decoder, OFA (Optical Flow Accelerator)
|
||||
* for all running processes. Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer pointed at
|
||||
* by \a procesesUtilInfo->procUtilArray. One utilization sample structure is returned per process running, that had some non-zero utilization
|
||||
* during the last sample period. It includes the CPU timestamp at which the samples were recorded. Individual utilization values
|
||||
* are returned as "unsigned int" values.
|
||||
*
|
||||
* The caller should allocate a buffer of size processSamplesCount * sizeof(nvmlProcessUtilizationInfo_t). If the buffer is too small, the API will
|
||||
* return \a NVML_ERROR_INSUFFICIENT_SIZE, with the recommended minimal buffer size at \a procesesUtilInfo->processSamplesCount. The caller should
|
||||
* invoke the function again with the allocated buffer passed in \a procesesUtilInfo->procUtilArray, and \a procesesUtilInfo->processSamplesCount
|
||||
* set to the number no less than the recommended value by the previous API return.
|
||||
*
|
||||
* On successful return, the function updates \a procesesUtilInfo->processSamplesCount with the number of process utilization info structures
|
||||
* that were actually written. This may differ from a previously read value as instances are created or destroyed.
|
||||
*
|
||||
* \a procesesUtilInfo->lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0
|
||||
* to read utilization based on all the samples maintained by the driver's internal sample buffer. Set \a procesesUtilInfo->lastSeenTimeStamp
|
||||
* to a timeStamp retrieved from a previous query to read utilization since the previous query.
|
||||
*
|
||||
* \a procesesUtilInfo->version is the version number of the structure nvmlProcessesUtilizationInfo_t, the caller should set the correct version
|
||||
* number to retrieve the specific version of processes utilization information.
|
||||
*
|
||||
* @note On MIG-enabled GPUs, querying process utilization is not currently supported.
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param procesesUtilInfo Pointer to the caller-provided structure of nvmlProcessesUtilizationInfo_t.
|
||||
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if \a procesesUtilInfo->procUtilArray has been populated
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a procesesUtilInfo is NULL
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
|
||||
* - \ref NVML_ERROR_NOT_FOUND if sample entries are not found
|
||||
* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH if the version of \a procesesUtilInfo is invalid
|
||||
* - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a procesesUtilInfo->procUtilArray is NULL, or the buffer size of procesesUtilInfo->procUtilArray is too small.
|
||||
* The caller should check the minimul array size from the returned procesesUtilInfo->processSamplesCount, and call
|
||||
* the function again with a buffer no smaller than procesesUtilInfo->processSamplesCount * sizeof(nvmlProcessUtilizationInfo_t)
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetProcessesUtilizationInfo(nvmlDevice_t device, nvmlProcessesUtilizationInfo_t *procesesUtilInfo);
|
||||
|
||||
/** @} */
|
||||
|
||||
/***************************************************************************************************/
|
||||
@@ -6960,6 +7373,30 @@ nvmlReturn_t DECLDIR nvmlDeviceSetConfComputeUnprotectedMemSize(nvmlDevice_t dev
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlSystemSetConfComputeGpusReadyState(unsigned int isAcceptingWork);
|
||||
|
||||
/**
|
||||
* Set Conf Computing key rotation threshold.
|
||||
*
|
||||
* %HOPPER_OR_NEWER%
|
||||
* Supported on Linux, Windows TCC.
|
||||
*
|
||||
* This function is to set the confidential compute key rotation threshold parameters.
|
||||
* @ref pKeyRotationThrInfo->maxAttackerAdvantage should be in the range from
|
||||
* NVML_CC_KEY_ROTATION_THRESHOLD_ATTACKER_ADVANTAGE_MIN to NVML_CC_KEY_ROTATION_THRESHOLD_ATTACKER_ADVANTAGE_MAX.
|
||||
* Default value is 60.
|
||||
*
|
||||
* @param pKeyRotationThrInfo Reference to the key rotation threshold data
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if \a key rotation threashold max attacker advantage has been set
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a memory is NULL
|
||||
* - \ref NVML_ERROR_INVALID_STATE if confidential compute GPU ready state is enabled
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlSystemSetConfComputeKeyRotationThresholdInfo(
|
||||
nvmlConfComputeSetKeyRotationThresholdInfo_t *pKeyRotationThrInfo);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -7648,15 +8085,180 @@ nvmlReturn_t DECLDIR nvmlDeviceGetHostVgpuMode(nvmlDevice_t device, nvmlHostVgpu
|
||||
* @param virtualMode virtualization mode. One of NVML_GPU_VIRTUALIZATION_?
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if \a pVirtualMode is set
|
||||
* - \ref NVML_SUCCESS if \a virtualMode is set
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a pVirtualMode is NULL
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a virtualMode is NULL
|
||||
* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if setting of virtualization mode is not supported.
|
||||
* - \ref NVML_ERROR_NO_PERMISSION if setting of virtualization mode is not allowed for this client.
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode);
|
||||
|
||||
/**
|
||||
* Get the vGPU heterogeneous mode for the device.
|
||||
*
|
||||
* When in heterogeneous mode, a vGPU can concurrently host timesliced vGPUs with differing framebuffer sizes.
|
||||
*
|
||||
* On successful return, the function returns \a pHeterogeneousMode->mode with the current vGPU heterogeneous mode.
|
||||
* \a pHeterogeneousMode->version is the version number of the structure nvmlVgpuHeterogeneousMode_t, the caller should
|
||||
* set the correct version number to retrieve the vGPU heterogeneous mode.
|
||||
* \a pHeterogeneousMode->mode can either be \ref NVML_FEATURE_ENABLED or \ref NVML_FEATURE_DISABLED.
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param pHeterogeneousMode Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS Upon success
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a device is invalid or \a pHeterogeneousMode is NULL
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't support this feature
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH If the version of \a pHeterogeneousMode is invalid
|
||||
* - \ref NVML_ERROR_UNKNOWN On any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetVgpuHeterogeneousMode(nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t *pHeterogeneousMode);
|
||||
|
||||
/**
|
||||
* Enable or disable vGPU heterogeneous mode for the device.
|
||||
*
|
||||
* When in heterogeneous mode, a vGPU can concurrently host timesliced vGPUs with differing framebuffer sizes.
|
||||
*
|
||||
* API would return an appropriate error code upon unsuccessful activation. For example, the heterogeneous mode
|
||||
* set will fail with error \ref NVML_ERROR_IN_USE if any vGPU instance is active on the device. The caller of this API
|
||||
* is expected to shutdown the vGPU VMs and retry setting the \a mode.
|
||||
* On successful return, the function updates the vGPU heterogeneous mode with the user provided \a pHeterogeneousMode->mode.
|
||||
* \a pHeterogeneousMode->version is the version number of the structure nvmlVgpuHeterogeneousMode_t, the caller should
|
||||
* set the correct version number to set the vGPU heterogeneous mode.
|
||||
*
|
||||
* @param device Identifier of the target device
|
||||
* @param pHeterogeneousMode Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS Upon success
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a device or \a pHeterogeneousMode is NULL or \a pHeterogeneousMode->mode is invalid
|
||||
* - \ref NVML_ERROR_IN_USE If the \a device is in use
|
||||
* - \ref NVML_ERROR_NO_PERMISSION If user doesn't have permission to perform the operation
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If MIG is enabled or \a device doesn't support this feature
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH If the version of \a pHeterogeneousMode is invalid
|
||||
* - \ref NVML_ERROR_UNKNOWN On any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceSetVgpuHeterogeneousMode(nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t *pHeterogeneousMode);
|
||||
|
||||
/**
|
||||
* Query the placement ID of active vGPU instance.
|
||||
*
|
||||
* When in vGPU heterogeneous mode, this function returns a valid placement ID as \a pPlacement->placementId
|
||||
* else NVML_INVALID_VGPU_PLACEMENT_ID is returned.
|
||||
* \a pPlacement->version is the version number of the structure nvmlVgpuPlacementId_t, the caller should
|
||||
* set the correct version number to get placement id of the vGPU instance \a vgpuInstance.
|
||||
*
|
||||
* @param vgpuInstance Identifier of the target vGPU instance
|
||||
* @param pPlacement Pointer to vGPU placement ID structure \a nvmlVgpuPlacementId_t
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS If information is successfully retrieved
|
||||
* - \ref NVML_ERROR_NOT_FOUND If \a vgpuInstance does not match a valid active vGPU instance
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a vgpuInstance is invalid or \a pPlacement is NULL
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH If the version of \a pPlacement is invalid
|
||||
* - \ref NVML_ERROR_UNKNOWN On any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlVgpuInstanceGetPlacementId(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t *pPlacement);
|
||||
|
||||
/**
|
||||
* Query the supported vGPU placement ID of the vGPU type.
|
||||
*
|
||||
* An array of supported vGPU placement IDs for the vGPU type ID indicated by \a vgpuTypeId is returned in the
|
||||
* caller-supplied buffer of \a pPlacementList->placementIds. Memory needed for the placementIds array should be
|
||||
* allocated based on maximum instances of a vGPU type which can be queried via \ref nvmlVgpuTypeGetMaxInstances().
|
||||
*
|
||||
* This function will return supported placement IDs even if GPU is not in vGPU heterogeneous mode.
|
||||
*
|
||||
* @param device Identifier of the target device
|
||||
* @param vgpuTypeId Handle to vGPU type. The vGPU type ID
|
||||
* @param pPlacementList Pointer to the vGPU placement structure \a nvmlVgpuPlacementList_t
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS Upon success
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a device or \a vgpuTypeId is invalid or \a pPlacementList is NULL
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If \a device or \a vgpuTypeId isn't supported
|
||||
* - \ref NVML_ERROR_NO_PERMISSION If user doesn't have permission to perform the operation
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH If the version of \a pPlacementList is invalid
|
||||
* - \ref NVML_ERROR_UNKNOWN On any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetVgpuTypeSupportedPlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t *pPlacementList);
|
||||
|
||||
/**
|
||||
* Query the creatable vGPU placement ID of the vGPU type.
|
||||
*
|
||||
* An array of creatable vGPU placement IDs for the vGPU type ID indicated by \a vgpuTypeId is returned in the
|
||||
* caller-supplied buffer of \a pPlacementList->placementIds. Memory needed for the placementIds array should be
|
||||
* allocated based on maximum instances of a vGPU type which can be queried via \ref nvmlVgpuTypeGetMaxInstances().
|
||||
* The creatable vGPU placement IDs may differ over time, as there may be restrictions on what type of vGPU the
|
||||
* vGPU instance is running.
|
||||
*
|
||||
* The function will return \ref NVML_ERROR_NOT_SUPPORTED if the \a device is not in vGPU heterogeneous mode.
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param vgpuTypeId Handle to vGPU type. The vGPU type ID
|
||||
* @param pPlacementList Pointer to the list of vGPU placement structure \a nvmlVgpuPlacementList_t
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS Upon success
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a device or \a vgpuTypeId is invalid or \a pPlacementList is NULL
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If \a device or \a vgpuTypeId isn't supported
|
||||
* - \ref NVML_ERROR_NO_PERMISSION If user doesn't have permission to perform the operation
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH If the version of \a pPlacementList is invalid
|
||||
* - \ref NVML_ERROR_UNKNOWN On any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetVgpuTypeCreatablePlacements(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t *pPlacementList);
|
||||
|
||||
/**
|
||||
* Retrieve the static GSP heap size of the vGPU type in bytes
|
||||
*
|
||||
* @param vgpuTypeId Handle to vGPU type
|
||||
* @param gspHeapSize Reference to return the GSP heap size value
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS Successful completion
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a vgpuTypeId is invalid, or \a gspHeapSize is NULL
|
||||
* - \ref NVML_ERROR_UNKNOWN On any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlVgpuTypeGetGspHeapSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long *gspHeapSize);
|
||||
|
||||
/**
|
||||
* Retrieve the static framebuffer reservation of the vGPU type in bytes
|
||||
*
|
||||
* @param vgpuTypeId Handle to vGPU type
|
||||
* @param fbReservation Reference to return the framebuffer reservation
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS Successful completion
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a vgpuTypeId is invalid, or \a fbReservation is NULL
|
||||
* - \ref NVML_ERROR_UNKNOWN On any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlVgpuTypeGetFbReservation(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long *fbReservation);
|
||||
|
||||
/**
|
||||
* Set the desirable vGPU capability of a device
|
||||
*
|
||||
* Refer to the \a nvmlDeviceVgpuCapability_t structure for the specific capabilities that can be set.
|
||||
* See \ref nvmlEnableState_t for available state.
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param capability Specifies the \a nvmlDeviceVgpuCapability_t to be set
|
||||
* @param state The target capability mode
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS Successful completion
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a device is invalid, or \a capability is invalid, or \a state is invalid
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED The API is not supported in current state, or \a device not in vGPU mode
|
||||
* - \ref NVML_ERROR_UNKNOWN On any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceSetVgpuCapabilities(nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state);
|
||||
|
||||
/**
|
||||
* Retrieve the vGPU Software licensable features.
|
||||
*
|
||||
@@ -8774,6 +9376,52 @@ nvmlReturn_t DECLDIR nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned
|
||||
nvmlValueType_t *sampleValType, unsigned int *vgpuInstanceSamplesCount,
|
||||
nvmlVgpuInstanceUtilizationSample_t *utilizationSamples);
|
||||
|
||||
/**
|
||||
* Retrieves recent utilization for vGPU instances running on a physical GPU (device).
|
||||
*
|
||||
* For Kepler &tm; or newer fully supported devices.
|
||||
*
|
||||
* Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, video decoder, jpeg decoder, and OFA for vGPU
|
||||
* instances running on a device. Utilization values are returned as an array of utilization sample structures in the caller-supplied
|
||||
* buffer pointed at by \a vgpuUtilInfo->vgpuUtilArray. One utilization sample structure is returned per vGPU instance, and includes the
|
||||
* CPU timestamp at which the samples were recorded. Individual utilization values are returned as "unsigned int" values
|
||||
* in nvmlValue_t unions. The function sets the caller-supplied \a vgpuUtilInfo->sampleValType to NVML_VALUE_TYPE_UNSIGNED_INT to
|
||||
* indicate the returned value type.
|
||||
*
|
||||
* To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with
|
||||
* \a vgpuUtilInfo->vgpuUtilArray set to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU instance
|
||||
* count in \a vgpuUtilInfo->vgpuInstanceCount, or NVML_SUCCESS if the current vGPU instance count is zero. The caller should allocate
|
||||
* a buffer of size vgpuUtilInfo->vgpuInstanceCount * sizeof(nvmlVgpuInstanceUtilizationInfo_t). Invoke the function again with
|
||||
* the allocated buffer passed in \a vgpuUtilInfo->vgpuUtilArray, and \a vgpuUtilInfo->vgpuInstanceCount set to the number of entries the
|
||||
* buffer is sized for.
|
||||
*
|
||||
* On successful return, the function updates \a vgpuUtilInfo->vgpuInstanceCount with the number of vGPU utilization sample
|
||||
* structures that were actually written. This may differ from a previously read value as vGPU instances are created or
|
||||
* destroyed.
|
||||
*
|
||||
* \a vgpuUtilInfo->lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0
|
||||
* to read utilization based on all the samples maintained by the driver's internal sample buffer. Set \a vgpuUtilInfo->lastSeenTimeStamp
|
||||
* to a timeStamp retrieved from a previous query to read utilization since the previous query.
|
||||
*
|
||||
* @param device The identifier for the target device
|
||||
* @param vgpuUtilInfo Pointer to the caller-provided structure of nvmlVgpuInstancesUtilizationInfo_t
|
||||
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if utilization samples are successfully retrieved
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a vgpuUtilInfo is NULL, or \a vgpuUtilInfo->vgpuInstanceCount is 0
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device
|
||||
* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH if the version of \a vgpuUtilInfo is invalid
|
||||
* - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a vgpuUtilInfo->vgpuUtilArray is NULL, or the buffer size of vgpuUtilInfo->vgpuInstanceCount is too small.
|
||||
* The caller should check the current vGPU instance count from the returned vgpuUtilInfo->vgpuInstanceCount, and call
|
||||
* the function again with a buffer of size vgpuUtilInfo->vgpuInstanceCount * sizeof(nvmlVgpuInstanceUtilizationInfo_t)
|
||||
* - \ref NVML_ERROR_NOT_FOUND if sample entries are not found
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetVgpuInstancesUtilizationInfo(nvmlDevice_t device,
|
||||
nvmlVgpuInstancesUtilizationInfo_t *vgpuUtilInfo);
|
||||
|
||||
/**
|
||||
* Retrieves current utilization for processes running on vGPUs on a physical GPU (device).
|
||||
*
|
||||
@@ -8820,6 +9468,52 @@ nvmlReturn_t DECLDIR nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp,
|
||||
unsigned int *vgpuProcessSamplesCount,
|
||||
nvmlVgpuProcessUtilizationSample_t *utilizationSamples);
|
||||
|
||||
/**
|
||||
* Retrieves recent utilization for processes running on vGPU instances on a physical GPU (device).
|
||||
*
|
||||
* For Maxwell &tm; or newer fully supported devices.
|
||||
*
|
||||
* Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, video decoder, jpeg decoder, and OFA for processes running
|
||||
* on vGPU instances active on a device. Utilization values are returned as an array of utilization sample structures in the caller-supplied
|
||||
* buffer pointed at by \a vgpuProcUtilInfo->vgpuProcUtilArray. One utilization sample structure is returned per process running
|
||||
* on vGPU instances, that had some non-zero utilization during the last sample period. It includes the CPU timestamp at which
|
||||
* the samples were recorded. Individual utilization values are returned as "unsigned int" values.
|
||||
*
|
||||
* To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with
|
||||
* \a vgpuProcUtilInfo->vgpuProcUtilArray set to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current processes' count
|
||||
* running on vGPU instances in \a vgpuProcUtilInfo->vgpuProcessCount. The caller should allocate a buffer of size
|
||||
* vgpuProcUtilInfo->vgpuProcessCount * sizeof(nvmlVgpuProcessUtilizationSample_t). Invoke the function again with the allocated buffer passed
|
||||
* in \a vgpuProcUtilInfo->vgpuProcUtilArray, and \a vgpuProcUtilInfo->vgpuProcessCount set to the number of entries the buffer is sized for.
|
||||
*
|
||||
* On successful return, the function updates \a vgpuProcUtilInfo->vgpuProcessCount with the number of vGPU sub process utilization sample
|
||||
* structures that were actually written. This may differ from a previously read value depending on the number of processes that are active
|
||||
* in any given sample period.
|
||||
*
|
||||
* vgpuProcUtilInfo->lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0
|
||||
* to read utilization based on all the samples maintained by the driver's internal sample buffer. Set vgpuProcUtilInfo->lastSeenTimeStamp
|
||||
* to a timeStamp retrieved from a previous query to read utilization since the previous query.
|
||||
*
|
||||
* @param device The identifier for the target device
|
||||
* @param vgpuProcUtilInfo Pointer to the caller-provided structure of nvmlVgpuProcessesUtilizationInfo_t
|
||||
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if utilization samples are successfully retrieved
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a vgpuProcUtilInfo is null
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH if the version of \a vgpuProcUtilInfo is invalid
|
||||
* - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a vgpuProcUtilInfo->vgpuProcUtilArray is null, or supplied \a vgpuProcUtilInfo->vgpuProcessCount
|
||||
* is too small to return samples for all processes on vGPU instances currently executing on the device.
|
||||
* The caller should check the current processes count from the returned \a vgpuProcUtilInfo->vgpuProcessCount,
|
||||
* and call the function again with a buffer of size
|
||||
* vgpuProcUtilInfo->vgpuProcessCount * sizeof(nvmlVgpuProcessUtilizationSample_t)
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device
|
||||
* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
|
||||
* - \ref NVML_ERROR_NOT_FOUND if sample entries are not found
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetVgpuProcessesUtilizationInfo(nvmlDevice_t device, nvmlVgpuProcessesUtilizationInfo_t *vgpuProcUtilInfo);
|
||||
|
||||
/**
|
||||
* Queries the state of per process accounting mode on vGPU.
|
||||
*
|
||||
@@ -9304,7 +9998,7 @@ nvmlReturn_t DECLDIR nvmlDeviceSetMigMode(nvmlDevice_t device, unsigned int mode
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int *currentMode, unsigned int *pendingMode);
|
||||
|
||||
/**
|
||||
* Get GPU instance profile information.
|
||||
* Get GPU instance profile information
|
||||
*
|
||||
* Information provided by this API is immutable throughout the lifetime of a MIG mode.
|
||||
*
|
||||
@@ -9319,7 +10013,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetMigMode(nvmlDevice_t device, unsigned int *cur
|
||||
* - \ref NVML_SUCCESS Upon success
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a device, \a profile or \a info are invalid
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't have MIG mode enabled or \a profile isn't supported
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't support MIG or \a profile isn't supported
|
||||
* - \ref NVML_ERROR_NO_PERMISSION If user doesn't have permission to perform the operation
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetGpuInstanceProfileInfo(nvmlDevice_t device, unsigned int profile,
|
||||
@@ -9360,7 +10054,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, u
|
||||
* Get GPU instance placements.
|
||||
*
|
||||
* A placement represents the location of a GPU instance within a device. This API only returns all the possible
|
||||
* placements for the given profile.
|
||||
* placements for the given profile regardless of whether MIG is enabled or not.
|
||||
* A created GPU instance occupies memory slices described by its placement. Creation of new GPU instance will
|
||||
* fail if there is overlap with the already occupied memory slices.
|
||||
*
|
||||
@@ -9379,7 +10073,7 @@ nvmlReturn_t DECLDIR nvmlDeviceGetGpuInstanceProfileInfoV(nvmlDevice_t device, u
|
||||
* - \ref NVML_SUCCESS Upon success
|
||||
* - \ref NVML_ERROR_UNINITIALIZED If library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT If \a device, \a profileId or \a count are invalid
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't have MIG mode enabled or \a profileId isn't supported
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED If \a device doesn't support MIG or \a profileId isn't supported
|
||||
* - \ref NVML_ERROR_NO_PERMISSION If user doesn't have permission to perform the operation
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetGpuInstancePossiblePlacements_v2(nvmlDevice_t device, unsigned int profileId,
|
||||
@@ -10287,7 +10981,7 @@ nvmlReturn_t DECLDIR nvmlSystemGetNvlinkBwMode(unsigned int *nvlinkBwMode);
|
||||
* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*
|
||||
* @see NVML_FI_DEV_POWER_AVERAGE
|
||||
* @see NVML_FI_DEV_POWER_AVERAGE
|
||||
* @see NVML_FI_DEV_POWER_INSTANT
|
||||
* @see NVML_FI_DEV_POWER_MIN_LIMIT
|
||||
* @see NVML_FI_DEV_POWER_MAX_LIMIT
|
||||
@@ -10295,7 +10989,28 @@ nvmlReturn_t DECLDIR nvmlSystemGetNvlinkBwMode(unsigned int *nvlinkBwMode);
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceSetPowerManagementLimit_v2(nvmlDevice_t device, nvmlPowerValue_v2_t *powerValue);
|
||||
|
||||
|
||||
/**
|
||||
* Get SRAM ECC error status of this device.
|
||||
*
|
||||
* For Ampere &tm; or newer fully supported devices.
|
||||
* Requires root/admin permissions.
|
||||
*
|
||||
* See \ref nvmlEccSramErrorStatus_v1_t for more information on the struct.
|
||||
*
|
||||
* @param device The identifier of the target device
|
||||
* @param status Returns SRAM ECC error status
|
||||
*
|
||||
* @return
|
||||
* - \ref NVML_SUCCESS if \a limit has been set
|
||||
* - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
|
||||
* - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a counters is NULL
|
||||
* - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
|
||||
* - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
|
||||
* - \ref NVML_ERROR_VERSION_MISMATCH if the version of \a nvmlEccSramErrorStatus_t is invalid
|
||||
* - \ref NVML_ERROR_UNKNOWN on any unexpected error
|
||||
*/
|
||||
nvmlReturn_t DECLDIR nvmlDeviceGetSramEccErrorStatus(nvmlDevice_t device,
|
||||
nvmlEccSramErrorStatus_t *status);
|
||||
/**
|
||||
* NVML API versioning support
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"home": "https://github.com/NVIDIA/nvidia-settings/blob/main/src/nvml.h",
|
||||
"license": "Embed in source",
|
||||
"version": "545.23.06",
|
||||
"version": "550.54.14",
|
||||
"author": "NVIDIA Corporation"
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"home": "https://github.com/ibireme/yyjson",
|
||||
"license": "MIT ( embed in source )",
|
||||
"version": "0.8.0",
|
||||
"version": "0.9.0",
|
||||
"author": "ibireme"
|
||||
}
|
||||
|
||||
Vendored
+31
-5
@@ -1407,6 +1407,7 @@ bool yyjson_mut_doc_set_val_pool_size(yyjson_mut_doc *doc, size_t count) {
|
||||
void yyjson_mut_doc_free(yyjson_mut_doc *doc) {
|
||||
if (doc) {
|
||||
yyjson_alc alc = doc->alc;
|
||||
memset(&doc->alc, 0, sizeof(alc));
|
||||
unsafe_yyjson_str_pool_release(&doc->str_pool, &alc);
|
||||
unsafe_yyjson_val_pool_release(&doc->val_pool, &alc);
|
||||
alc.free(alc.ctx, doc);
|
||||
@@ -8309,13 +8310,15 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
bool cpy = (enc_table == enc_table_cpy);
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
const usize end_len = 2; /* '\n' and '\0' */
|
||||
|
||||
switch (unsafe_yyjson_get_type(val)) {
|
||||
case YYJSON_TYPE_RAW:
|
||||
str_len = unsafe_yyjson_get_len(val);
|
||||
str_ptr = (const u8 *)unsafe_yyjson_get_str(val);
|
||||
check_str_len(str_len);
|
||||
incr_len(str_len + 1);
|
||||
incr_len(str_len + end_len);
|
||||
cur = write_raw(cur, str_ptr, str_len);
|
||||
break;
|
||||
|
||||
@@ -8323,7 +8326,7 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
str_len = unsafe_yyjson_get_len(val);
|
||||
str_ptr = (const u8 *)unsafe_yyjson_get_str(val);
|
||||
check_str_len(str_len);
|
||||
incr_len(str_len * 6 + 4);
|
||||
incr_len(str_len * 6 + 2 + end_len);
|
||||
if (likely(cpy) && unsafe_yyjson_get_subtype(val)) {
|
||||
cur = write_string_noesc(cur, str_ptr, str_len);
|
||||
} else {
|
||||
@@ -8333,7 +8336,7 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
break;
|
||||
|
||||
case YYJSON_TYPE_NUM:
|
||||
incr_len(32);
|
||||
incr_len(32 + end_len);
|
||||
cur = write_number(cur, val, flg);
|
||||
if (unlikely(!cur)) goto fail_num;
|
||||
break;
|
||||
@@ -8349,13 +8352,13 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
break;
|
||||
|
||||
case YYJSON_TYPE_ARR:
|
||||
incr_len(4);
|
||||
incr_len(2 + end_len);
|
||||
byte_copy_2(cur, "[]");
|
||||
cur += 2;
|
||||
break;
|
||||
|
||||
case YYJSON_TYPE_OBJ:
|
||||
incr_len(4);
|
||||
incr_len(2 + end_len);
|
||||
byte_copy_2(cur, "{}");
|
||||
cur += 2;
|
||||
break;
|
||||
@@ -8364,6 +8367,7 @@ static_inline u8 *yyjson_write_single(yyjson_val *val,
|
||||
goto fail_type;
|
||||
}
|
||||
|
||||
if (newline) *cur++ = '\n';
|
||||
*cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
memset(err, 0, sizeof(yyjson_write_err));
|
||||
@@ -8436,6 +8440,7 @@ static_inline u8 *yyjson_write_minify(const yyjson_val *root,
|
||||
bool cpy = (enc_table == enc_table_cpy);
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
|
||||
alc_len = root->uni.ofs / sizeof(yyjson_val);
|
||||
alc_len = alc_len * YYJSON_WRITER_ESTIMATED_MINIFY_RATIO + 64;
|
||||
@@ -8542,6 +8547,11 @@ ctn_end:
|
||||
}
|
||||
|
||||
doc_end:
|
||||
if (newline) {
|
||||
incr_len(2);
|
||||
*(cur - 1) = '\n';
|
||||
cur++;
|
||||
}
|
||||
*--cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
memset(err, 0, sizeof(yyjson_write_err));
|
||||
@@ -8615,6 +8625,7 @@ static_inline u8 *yyjson_write_pretty(const yyjson_val *root,
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
usize spaces = has_write_flag(PRETTY_TWO_SPACES) ? 2 : 4;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
|
||||
alc_len = root->uni.ofs / sizeof(yyjson_val);
|
||||
alc_len = alc_len * YYJSON_WRITER_ESTIMATED_PRETTY_RATIO + 64;
|
||||
@@ -8745,6 +8756,10 @@ ctn_end:
|
||||
}
|
||||
|
||||
doc_end:
|
||||
if (newline) {
|
||||
incr_len(2);
|
||||
*cur++ = '\n';
|
||||
}
|
||||
*cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
memset(err, 0, sizeof(yyjson_write_err));
|
||||
@@ -8977,6 +8992,7 @@ static_inline u8 *yyjson_mut_write_minify(const yyjson_mut_val *root,
|
||||
bool cpy = (enc_table == enc_table_cpy);
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
|
||||
alc_len = estimated_val_num * YYJSON_WRITER_ESTIMATED_MINIFY_RATIO + 64;
|
||||
alc_len = size_align_up(alc_len, sizeof(yyjson_mut_write_ctx));
|
||||
@@ -9087,6 +9103,11 @@ ctn_end:
|
||||
}
|
||||
|
||||
doc_end:
|
||||
if (newline) {
|
||||
incr_len(2);
|
||||
*(cur - 1) = '\n';
|
||||
cur++;
|
||||
}
|
||||
*--cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
err->code = YYJSON_WRITE_SUCCESS;
|
||||
@@ -9162,6 +9183,7 @@ static_inline u8 *yyjson_mut_write_pretty(const yyjson_mut_val *root,
|
||||
bool esc = has_write_flag(ESCAPE_UNICODE) != 0;
|
||||
bool inv = has_write_flag(ALLOW_INVALID_UNICODE) != 0;
|
||||
usize spaces = has_write_flag(PRETTY_TWO_SPACES) ? 2 : 4;
|
||||
bool newline = has_write_flag(NEWLINE_AT_END) != 0;
|
||||
|
||||
alc_len = estimated_val_num * YYJSON_WRITER_ESTIMATED_PRETTY_RATIO + 64;
|
||||
alc_len = size_align_up(alc_len, sizeof(yyjson_mut_write_ctx));
|
||||
@@ -9296,6 +9318,10 @@ ctn_end:
|
||||
}
|
||||
|
||||
doc_end:
|
||||
if (newline) {
|
||||
incr_len(2);
|
||||
*cur++ = '\n';
|
||||
}
|
||||
*cur = '\0';
|
||||
*dat_len = (usize)(cur - hdr);
|
||||
err->code = YYJSON_WRITE_SUCCESS;
|
||||
|
||||
Vendored
+35
-21
@@ -527,16 +527,16 @@ extern "C" {
|
||||
#define YYJSON_VERSION_MAJOR 0
|
||||
|
||||
/** The minor version of yyjson. */
|
||||
#define YYJSON_VERSION_MINOR 8
|
||||
#define YYJSON_VERSION_MINOR 9
|
||||
|
||||
/** The patch version of yyjson. */
|
||||
#define YYJSON_VERSION_PATCH 0
|
||||
|
||||
/** The version of yyjson in hex: `(major << 16) | (minor << 8) | (patch)`. */
|
||||
#define YYJSON_VERSION_HEX 0x000800
|
||||
#define YYJSON_VERSION_HEX 0x000900
|
||||
|
||||
/** The version string of yyjson. */
|
||||
#define YYJSON_VERSION_STRING "0.8.0"
|
||||
#define YYJSON_VERSION_STRING "0.9.0"
|
||||
|
||||
/** The version of yyjson in hex, same as `YYJSON_VERSION_HEX`. */
|
||||
yyjson_api uint32_t yyjson_version(void);
|
||||
@@ -738,7 +738,7 @@ typedef uint32_t yyjson_read_flag;
|
||||
- Report error if double number is infinity.
|
||||
- Report error if string contains invalid UTF-8 character or BOM.
|
||||
- Report error on trailing commas, comments, inf and nan literals. */
|
||||
static const yyjson_read_flag YYJSON_READ_NOFLAG = 0 << 0;
|
||||
static const yyjson_read_flag YYJSON_READ_NOFLAG = 0;
|
||||
|
||||
/** Read the input data in-situ.
|
||||
This option allows the reader to modify and use input data to store string
|
||||
@@ -1067,7 +1067,7 @@ typedef uint32_t yyjson_write_flag;
|
||||
- Report error on inf or nan number.
|
||||
- Report error on invalid UTF-8 string.
|
||||
- Do not escape unicode or slash. */
|
||||
static const yyjson_write_flag YYJSON_WRITE_NOFLAG = 0 << 0;
|
||||
static const yyjson_write_flag YYJSON_WRITE_NOFLAG = 0;
|
||||
|
||||
/** Write JSON pretty with 4 space indent. */
|
||||
static const yyjson_write_flag YYJSON_WRITE_PRETTY = 1 << 0;
|
||||
@@ -1096,6 +1096,10 @@ static const yyjson_write_flag YYJSON_WRITE_ALLOW_INVALID_UNICODE = 1 << 5;
|
||||
This flag will override `YYJSON_WRITE_PRETTY` flag. */
|
||||
static const yyjson_write_flag YYJSON_WRITE_PRETTY_TWO_SPACES = 1 << 6;
|
||||
|
||||
/** Adds a newline character `\n` at the end of the JSON.
|
||||
This can be helpful for text editors or NDJSON. */
|
||||
static const yyjson_write_flag YYJSON_WRITE_NEWLINE_AT_END = 1 << 7;
|
||||
|
||||
|
||||
|
||||
/** Result code for JSON writer */
|
||||
@@ -3695,7 +3699,7 @@ yyjson_api_inline bool yyjson_mut_obj_add_strcpy(yyjson_mut_doc *doc,
|
||||
The `len` should be the length of the `val`, in bytes.
|
||||
This function allows duplicated key in one object.
|
||||
|
||||
@warning The key/value strings are not copied, you should keep these strings
|
||||
@warning The key strings are not copied, you should keep these strings
|
||||
unmodified for the lifetime of this JSON document. */
|
||||
yyjson_api_inline bool yyjson_mut_obj_add_strncpy(yyjson_mut_doc *doc,
|
||||
yyjson_mut_val *obj,
|
||||
@@ -4829,6 +4833,7 @@ yyjson_api_inline size_t yyjson_doc_get_val_count(yyjson_doc *doc) {
|
||||
yyjson_api_inline void yyjson_doc_free(yyjson_doc *doc) {
|
||||
if (doc) {
|
||||
yyjson_alc alc = doc->alc;
|
||||
memset(&doc->alc, 0, sizeof(alc));
|
||||
if (doc->str_pool) alc.free(alc.ctx, doc->str_pool);
|
||||
alc.free(alc.ctx, doc);
|
||||
}
|
||||
@@ -5668,6 +5673,7 @@ yyjson_api_inline yyjson_mut_val *yyjson_mut_bool(yyjson_mut_doc *doc,
|
||||
if (yyjson_likely(doc)) {
|
||||
yyjson_mut_val *val = unsafe_yyjson_mut_val(doc, 1);
|
||||
if (yyjson_likely(val)) {
|
||||
_val = !!_val;
|
||||
val->tag = YYJSON_TYPE_BOOL | (uint8_t)((uint8_t)_val << 3);
|
||||
return val;
|
||||
}
|
||||
@@ -5920,7 +5926,8 @@ yyjson_api_inline yyjson_mut_val *yyjson_mut_arr(yyjson_mut_doc *doc) {
|
||||
yyjson_api_inline yyjson_mut_val *yyjson_mut_arr_with_bool(
|
||||
yyjson_mut_doc *doc, const bool *vals, size_t count) {
|
||||
yyjson_mut_arr_with_func({
|
||||
val->tag = YYJSON_TYPE_BOOL | (uint8_t)((uint8_t)vals[i] << 3);
|
||||
bool _val = !!vals[i];
|
||||
val->tag = YYJSON_TYPE_BOOL | (uint8_t)((uint8_t)_val << 3);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6872,6 +6879,7 @@ yyjson_api_inline bool yyjson_mut_obj_add_bool(yyjson_mut_doc *doc,
|
||||
const char *_key,
|
||||
bool _val) {
|
||||
yyjson_mut_obj_add_func({
|
||||
_val = !!_val;
|
||||
val->tag = YYJSON_TYPE_BOOL | (uint8_t)((uint8_t)(_val) << 3);
|
||||
});
|
||||
}
|
||||
@@ -7730,33 +7738,39 @@ yyjson_api_inline bool yyjson_ptr_get_bool(
|
||||
}
|
||||
|
||||
/**
|
||||
Set provided `value` if the JSON Pointer (RFC 6901) exists and is type uint.
|
||||
Returns true if value at `ptr` exists and is the correct type, otherwise false.
|
||||
Set provided `value` if the JSON Pointer (RFC 6901) exists and is an integer
|
||||
that fits in `uint64_t`. Returns true if successful, otherwise false.
|
||||
*/
|
||||
yyjson_api_inline bool yyjson_ptr_get_uint(
|
||||
yyjson_val *root, const char *ptr, uint64_t *value) {
|
||||
yyjson_val *val = yyjson_ptr_get(root, ptr);
|
||||
if (value && yyjson_is_uint(val)) {
|
||||
*value = unsafe_yyjson_get_uint(val);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
if (value && val) {
|
||||
uint64_t ret = val->uni.u64;
|
||||
if (unsafe_yyjson_is_uint(val) ||
|
||||
(unsafe_yyjson_is_sint(val) && !(ret >> 63))) {
|
||||
*value = ret;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
Set provided `value` if the JSON Pointer (RFC 6901) exists and is type sint.
|
||||
Returns true if value at `ptr` exists and is the correct type, otherwise false.
|
||||
Set provided `value` if the JSON Pointer (RFC 6901) exists and is an integer
|
||||
that fits in `int64_t`. Returns true if successful, otherwise false.
|
||||
*/
|
||||
yyjson_api_inline bool yyjson_ptr_get_sint(
|
||||
yyjson_val *root, const char *ptr, int64_t *value) {
|
||||
yyjson_val *val = yyjson_ptr_get(root, ptr);
|
||||
if (value && yyjson_is_sint(val)) {
|
||||
*value = unsafe_yyjson_get_sint(val);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
if (value && val) {
|
||||
int64_t ret = val->uni.i64;
|
||||
if (unsafe_yyjson_is_sint(val) ||
|
||||
(unsafe_yyjson_is_uint(val) && ret >= 0)) {
|
||||
*value = ret;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@ void ffPrepareCommandOption(FFdata* data)
|
||||
FFOptionsModules* const options = &instance.config.modules;
|
||||
//If we don't have a custom structure, use the default one
|
||||
if(data->structure.length == 0)
|
||||
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE);
|
||||
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE); // Cannot use `ffStrbufSetStatic` here because we will modify the string
|
||||
|
||||
if(ffStrbufContainIgnCaseS(&data->structure, FF_CPUUSAGE_MODULE_NAME))
|
||||
ffPrepareCPUUsage();
|
||||
@@ -118,7 +118,7 @@ static void parseStructureCommand(
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintErrorString(line, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "<no implementation provided>");
|
||||
ffPrintError(line, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "<no implementation provided>");
|
||||
}
|
||||
|
||||
void ffPrintCommandOption(FFdata* data, yyjson_mut_doc* jsonDoc)
|
||||
@@ -168,7 +168,7 @@ void ffMigrateCommandOptionToJsonc(FFdata* data, yyjson_mut_doc* jsonDoc)
|
||||
{
|
||||
//If we don't have a custom structure, use the default one
|
||||
if(data->structure.length == 0)
|
||||
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE);
|
||||
ffStrbufAppendS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE); // Cannot use `ffStrbufSetStatic` here because we will modify the string
|
||||
|
||||
//Parse the structure and call the modules
|
||||
uint32_t startIndex = 0;
|
||||
|
||||
+6
-4
@@ -181,22 +181,24 @@ DBusMessage* ffDBusGetProperty(FFDBusData* dbus, const char* busName, const char
|
||||
return reply;
|
||||
}
|
||||
|
||||
void ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result)
|
||||
bool ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result)
|
||||
{
|
||||
DBusMessage* reply = ffDBusGetProperty(dbus, busName, objectPath, interface, property);
|
||||
if(reply == NULL)
|
||||
return;
|
||||
return false;
|
||||
|
||||
DBusMessageIter rootIterator;
|
||||
if(!dbus->lib->ffdbus_message_iter_init(reply, &rootIterator))
|
||||
{
|
||||
dbus->lib->ffdbus_message_unref(reply);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
ffDBusGetValue(dbus, &rootIterator, result);
|
||||
bool ret = ffDBusGetValue(dbus, &rootIterator, result);
|
||||
|
||||
dbus->lib->ffdbus_message_unref(reply);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif //FF_HAVE_DBUS
|
||||
|
||||
+1
-1
@@ -48,6 +48,6 @@ bool ffDBusGetBool(FFDBusData* dbus, DBusMessageIter* iter, bool* result);
|
||||
bool ffDBusGetByte(FFDBusData* dbus, DBusMessageIter* iter, uint8_t* result);
|
||||
DBusMessage* ffDBusGetMethodReply(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* method);
|
||||
DBusMessage* ffDBusGetProperty(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property);
|
||||
void ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result);
|
||||
bool ffDBusGetPropertyString(FFDBusData* dbus, const char* busName, const char* objectPath, const char* interface, const char* property, FFstrbuf* result);
|
||||
|
||||
#endif // FF_HAVE_DBUS
|
||||
|
||||
+20
-44
@@ -2,6 +2,7 @@
|
||||
#include "common/font.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
void ffFontInit(FFfont* font)
|
||||
{
|
||||
@@ -66,59 +67,33 @@ void ffFontInitQt(FFfont* font, const char* data)
|
||||
//See https://doc.qt.io/qt-5/qfont.html#toString
|
||||
|
||||
//Family
|
||||
while(*data != ',' && *data != '\0')
|
||||
{
|
||||
ffStrbufAppendC(&font->name, *data);
|
||||
++data;
|
||||
}
|
||||
if(*data != '\0')
|
||||
++data;
|
||||
data = ffStrbufAppendSUntilC(&font->name, data, ',');
|
||||
ffStrbufTrim(&font->name, ' ');
|
||||
if (!data) goto exit;
|
||||
data++;
|
||||
|
||||
//Size
|
||||
while(*data != ',' && *data != '\0')
|
||||
{
|
||||
ffStrbufAppendC(&font->size, *data);
|
||||
++data;
|
||||
}
|
||||
if(*data != '\0')
|
||||
++data;
|
||||
data = ffStrbufAppendSUntilC(&font->size, data, ',');
|
||||
ffStrbufTrim(&font->size, ' ');
|
||||
if (!data) goto exit;
|
||||
data++;
|
||||
|
||||
#define FF_FONT_QT_SKIP_VALUE \
|
||||
while(*data != ',' && *data != '\0') \
|
||||
++data; \
|
||||
if(*data != '\0') \
|
||||
++data;
|
||||
|
||||
FF_FONT_QT_SKIP_VALUE //Pixel size
|
||||
FF_FONT_QT_SKIP_VALUE //Style hint
|
||||
FF_FONT_QT_SKIP_VALUE //Font weight
|
||||
FF_FONT_QT_SKIP_VALUE //Font style
|
||||
FF_FONT_QT_SKIP_VALUE //Underline
|
||||
FF_FONT_QT_SKIP_VALUE //Strike out
|
||||
FF_FONT_QT_SKIP_VALUE //Fixed pitch
|
||||
FF_FONT_QT_SKIP_VALUE //Always 0
|
||||
|
||||
#undef FF_FONT_QT_SKIP_VALUE
|
||||
|
||||
while(*data != '\0')
|
||||
//Style
|
||||
data = strrchr(data, ',');
|
||||
if (!data) goto exit;
|
||||
data++;
|
||||
if (isalpha(*data))
|
||||
{
|
||||
while(*data == ' ')
|
||||
++data;
|
||||
|
||||
if(*data == '\0')
|
||||
break;
|
||||
|
||||
FFstrbuf* style = ffListAdd(&font->styles);
|
||||
ffStrbufInit(style);
|
||||
while(*data != ' ' && *data != '\0')
|
||||
do
|
||||
{
|
||||
ffStrbufAppendC(style, *data);
|
||||
++data;
|
||||
}
|
||||
FFstrbuf* style = ffListAdd(&font->styles);
|
||||
ffStrbufInit(style);
|
||||
data = ffStrbufAppendSUntilC(style, data, ' ');
|
||||
if (data) data++;
|
||||
} while (data);
|
||||
}
|
||||
|
||||
exit:
|
||||
fontInitPretty(font);
|
||||
}
|
||||
|
||||
@@ -211,6 +186,7 @@ void ffFontInitValues(FFfont* font, const char* name, const char* size)
|
||||
ffFontInit(font);
|
||||
|
||||
ffStrbufAppendS(&font->name, name);
|
||||
ffStrbufTrim(&font->name, '"');
|
||||
ffStrbufAppendS(&font->size, size);
|
||||
|
||||
fontInitPretty(font);
|
||||
|
||||
@@ -24,3 +24,7 @@ typedef struct FFformatarg
|
||||
|
||||
void ffFormatAppendFormatArg(FFstrbuf* buffer, const FFformatarg* formatarg);
|
||||
void ffParseFormatString(FFstrbuf* buffer, const FFstrbuf* formatstr, uint32_t numArgs, const FFformatarg* arguments);
|
||||
#define FF_PARSE_FORMAT_STRING_CHECKED(buffer, formatstr, numArgs, arguments) do {\
|
||||
static_assert(sizeof(arguments) / sizeof(*(arguments)) == (numArgs), "Invalid number of format arguments");\
|
||||
ffParseFormatString((buffer), (formatstr), (numArgs), (arguments));\
|
||||
} while (0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "io.h"
|
||||
#include "fastfetch.h"
|
||||
#include "util/stringUtils.h"
|
||||
#include "util/unused.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <termios.h>
|
||||
@@ -133,6 +133,9 @@ bool ffPathExpandEnv(FF_MAYBE_UNUSED const char* in, FF_MAYBE_UNUSED FFstrbuf* o
|
||||
|
||||
const char* ffGetTerminalResponse(const char* request, const char* format, ...)
|
||||
{
|
||||
if (instance.config.display.pipe)
|
||||
return "Not supported in --pipe mode";
|
||||
|
||||
struct termios oldTerm, newTerm;
|
||||
if(tcgetattr(STDIN_FILENO, &oldTerm) == -1)
|
||||
return "tcgetattr(STDIN_FILENO, &oldTerm) failed";
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "io.h"
|
||||
#include "fastfetch.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <windows.h>
|
||||
@@ -174,6 +175,9 @@ void ffListFilesRecursively(const char* path, bool pretty)
|
||||
|
||||
const char* ffGetTerminalResponse(const char* request, const char* format, ...)
|
||||
{
|
||||
if (instance.config.display.pipe)
|
||||
return "Not supported in --pipe mode";
|
||||
|
||||
HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
DWORD prev_mode;
|
||||
GetConsoleMode(hInput, &prev_mode);
|
||||
|
||||
@@ -235,6 +235,6 @@ void ffPrintJsonConfig(bool prepare, yyjson_mut_doc* jsonDoc)
|
||||
yyjson_mut_doc_set_root(jsonDoc, obj);
|
||||
}
|
||||
else
|
||||
ffPrintErrorString("JsonConfig", 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "%s", error);
|
||||
ffPrintError("JsonConfig", 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "%s", error);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-10
@@ -20,15 +20,9 @@ typedef struct FFNetworkingState {
|
||||
FFThreadType thread;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint32_t timeout;
|
||||
} FFNetworkingState;
|
||||
|
||||
bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
|
||||
bool ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, uint32_t timeout);
|
||||
|
||||
static inline bool ffNetworkingGetHttp(const char* host, const char* path, uint32_t timeout, const char* headers, FFstrbuf* buffer)
|
||||
{
|
||||
FFNetworkingState state;
|
||||
if(ffNetworkingSendHttpRequest(&state, host, path, headers))
|
||||
return ffNetworkingRecvHttpResponse(&state, buffer, timeout);
|
||||
return false;
|
||||
}
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers);
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer);
|
||||
|
||||
@@ -5,30 +5,50 @@
|
||||
#include <sys/time.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h> // For FreeBSD
|
||||
#include <netinet/tcp.h>
|
||||
|
||||
static void connectAndSend(FFNetworkingState* state)
|
||||
static const char* connectAndSend(FFNetworkingState* state)
|
||||
{
|
||||
struct addrinfo hints = {
|
||||
.ai_family = AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
};
|
||||
|
||||
const char* ret = NULL;
|
||||
struct addrinfo* addr;
|
||||
|
||||
if(getaddrinfo(state->host.chars, "80", &hints, &addr) != 0)
|
||||
if(getaddrinfo(state->host.chars, "80", &(struct addrinfo) {
|
||||
.ai_family = AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
}, &addr) != 0)
|
||||
{
|
||||
ret = "getaddrinfo() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||
if(state->sockfd == -1)
|
||||
{
|
||||
freeaddrinfo(addr);
|
||||
ret = "socket() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (state->timeout > 0)
|
||||
{
|
||||
FF_MAYBE_UNUSED uint32_t sec = state->timeout / 1000;
|
||||
if (sec == 0) sec = 1;
|
||||
|
||||
#ifdef TCP_CONNECTIONTIMEOUT
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_CONNECTIONTIMEOUT, &sec, sizeof(sec));
|
||||
#elif defined(TCP_KEEPINIT)
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_KEEPINIT, &sec, sizeof(sec));
|
||||
#elif defined(TCP_USER_TIMEOUT)
|
||||
setsockopt(state->sockfd, IPPROTO_TCP, TCP_USER_TIMEOUT, &state->timeout, sizeof(state->timeout));
|
||||
#endif
|
||||
}
|
||||
|
||||
if(connect(state->sockfd, addr->ai_addr, addr->ai_addrlen) == -1)
|
||||
{
|
||||
close(state->sockfd);
|
||||
freeaddrinfo(addr);
|
||||
ret = "connect() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -37,6 +57,7 @@ static void connectAndSend(FFNetworkingState* state)
|
||||
if(send(state->sockfd, state->command.chars, state->command.length, 0) < 0)
|
||||
{
|
||||
close(state->sockfd);
|
||||
ret = "send() failed";
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -48,11 +69,13 @@ error:
|
||||
exit:
|
||||
ffStrbufDestroy(&state->host);
|
||||
ffStrbufDestroy(&state->command);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
FF_THREAD_ENTRY_DECL_WRAPPER(connectAndSend, FFNetworkingState*);
|
||||
|
||||
bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
ffStrbufInitS(&state->host, host);
|
||||
|
||||
@@ -66,22 +89,30 @@ bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, con
|
||||
ffStrbufAppendS(&state->command, "\r\n");
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
if (instance.config.general.multithreading)
|
||||
{
|
||||
state->thread = ffThreadCreate(connectAndSendThreadMain, state);
|
||||
return !!state->thread;
|
||||
#else
|
||||
connectAndSend(state);
|
||||
return state->sockfd != -1;
|
||||
return state->thread ? NULL : "ffThreadCreate(connectAndSend) failed";
|
||||
}
|
||||
#endif
|
||||
|
||||
return connectAndSend(state);
|
||||
}
|
||||
|
||||
bool ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, uint32_t timeout)
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
|
||||
{
|
||||
uint32_t timeout = state->timeout;
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
if (instance.config.general.multithreading)
|
||||
{
|
||||
if (!ffThreadJoin(state->thread, timeout))
|
||||
return false;
|
||||
return "ffThreadJoin() failed or timeout";
|
||||
}
|
||||
#endif
|
||||
|
||||
if(state->sockfd == -1)
|
||||
return false;
|
||||
return "ffNetworkingSendHttpRequest() failed";
|
||||
|
||||
if(timeout > 0)
|
||||
{
|
||||
@@ -91,14 +122,15 @@ bool ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, ui
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, &timev, sizeof(timev));
|
||||
}
|
||||
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), 0);
|
||||
|
||||
if(received > 0)
|
||||
{
|
||||
uint32_t recvStart;
|
||||
do {
|
||||
recvStart = buffer->length;
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, ffStrbufGetFree(buffer), 0);
|
||||
if (received <= 0) break;
|
||||
buffer->length += (uint32_t) received;
|
||||
buffer->chars[buffer->length] = '\0';
|
||||
}
|
||||
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);
|
||||
|
||||
close(state->sockfd);
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n");
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
|
||||
}
|
||||
|
||||
@@ -33,21 +33,20 @@ static const char* initWsaData(WSADATA* wsaData)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
const char* ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, const char* path, const char* headers)
|
||||
{
|
||||
static WSADATA wsaData;
|
||||
if (wsaData.wVersion == 0)
|
||||
{
|
||||
if (initWsaData(&wsaData) != NULL)
|
||||
const char* error = initWsaData(&wsaData);
|
||||
if (error != NULL)
|
||||
{
|
||||
wsaData.wVersion = (WORD) -1;
|
||||
return false;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else if (wsaData.wVersion == (WORD) -1)
|
||||
return false;
|
||||
|
||||
memset(state, 0, sizeof(*state));
|
||||
return "initWsaData() failed before";
|
||||
|
||||
struct addrinfo* addr;
|
||||
|
||||
@@ -55,26 +54,27 @@ bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, con
|
||||
.ai_family = AF_INET,
|
||||
.ai_socktype = SOCK_STREAM,
|
||||
}, &addr) != 0)
|
||||
return false;
|
||||
return "getaddrinfo() failed";
|
||||
|
||||
state->sockfd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
|
||||
if(state->sockfd == INVALID_SOCKET)
|
||||
{
|
||||
freeaddrinfo(addr);
|
||||
return false;
|
||||
return "socket() failed";
|
||||
}
|
||||
|
||||
{
|
||||
//ConnectEx requires the socket to be initially bound
|
||||
struct sockaddr_in addr = {
|
||||
if(bind(state->sockfd, (SOCKADDR *) &(struct sockaddr_in) {
|
||||
.sin_family = AF_INET,
|
||||
.sin_addr.s_addr = INADDR_ANY,
|
||||
.sin_port = 0,
|
||||
};
|
||||
if(bind(state->sockfd, (SOCKADDR *)&addr, sizeof(addr)) != 0)
|
||||
}, sizeof(struct sockaddr_in)) != 0)
|
||||
{
|
||||
printf("bind %d\n", WSAGetLastError());
|
||||
return false;
|
||||
closesocket(state->sockfd);
|
||||
freeaddrinfo(addr);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "bind() failed";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,35 +93,52 @@ bool ffNetworkingSendHttpRequest(FFNetworkingState* state, const char* host, con
|
||||
if(!result && WSAGetLastError() != WSA_IO_PENDING)
|
||||
{
|
||||
closesocket(state->sockfd);
|
||||
return false;
|
||||
freeaddrinfo(addr);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "ConnectEx() failed";
|
||||
}
|
||||
|
||||
return true;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer, uint32_t timeout)
|
||||
const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buffer)
|
||||
{
|
||||
if (state->sockfd == INVALID_SOCKET)
|
||||
return "ffNetworkingSendHttpRequest() failed";
|
||||
|
||||
uint32_t timeout = state->timeout;
|
||||
if (timeout > 0)
|
||||
{
|
||||
if (WaitForSingleObject((HANDLE) state->sockfd, timeout) != WAIT_OBJECT_0)
|
||||
{
|
||||
CancelIo((HANDLE) state->sockfd);
|
||||
closesocket(state->sockfd);
|
||||
return "WaitForSingleObject(state->sockfd) failed or timeout";
|
||||
}
|
||||
}
|
||||
|
||||
DWORD transfer, flags;
|
||||
if (!WSAGetOverlappedResult(state->sockfd, &state->overlapped, &transfer, TRUE, &flags))
|
||||
{
|
||||
closesocket(state->sockfd);
|
||||
return false;
|
||||
return "WSAGetOverlappedResult() failed";
|
||||
}
|
||||
|
||||
if(timeout > 0)
|
||||
{
|
||||
//https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof(timeout));
|
||||
setsockopt(state->sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*) &timeout, sizeof(timeout));
|
||||
}
|
||||
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int)ffStrbufGetFree(buffer), 0);
|
||||
|
||||
if(received > 0)
|
||||
{
|
||||
buffer->length += (uint32_t) received;
|
||||
uint32_t recvStart;
|
||||
do {
|
||||
recvStart = buffer->length;
|
||||
ssize_t received = recv(state->sockfd, buffer->chars + buffer->length, (int) ffStrbufGetFree(buffer), 0);
|
||||
if (received <= 0) break;
|
||||
buffer->length = recvStart + (uint32_t) received;
|
||||
buffer->chars[buffer->length] = '\0';
|
||||
}
|
||||
} while (ffStrbufGetFree(buffer) > 0 && strstr(buffer->chars + recvStart, "\r\n\r\n") == NULL);
|
||||
|
||||
closesocket(state->sockfd);
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n");
|
||||
return ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n") ? NULL : "Invalid response";
|
||||
}
|
||||
|
||||
+5
-21
@@ -96,39 +96,23 @@ void ffParseSize(uint64_t bytes, FFstrbuf* result)
|
||||
}
|
||||
}
|
||||
|
||||
void ffParseTemperature(double celsius, FFstrbuf* buffer)
|
||||
{
|
||||
switch (instance.config.display.temperatureUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
ffStrbufAppendF(buffer, "%.1f°C", celsius);
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_FAHRENHEIT:
|
||||
ffStrbufAppendF(buffer, "%.1f°F", celsius * 1.8 + 32);
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_KELVIN:
|
||||
ffStrbufAppendF(buffer, "%.1f K", celsius + 273.15);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, const FFstrbuf* gtk4)
|
||||
{
|
||||
if(gtk2->length > 0 && gtk3->length > 0 && gtk4->length > 0)
|
||||
{
|
||||
if((ffStrbufIgnCaseComp(gtk2, gtk3) == 0) && (ffStrbufIgnCaseComp(gtk2, gtk4) == 0))
|
||||
if((ffStrbufIgnCaseEqual(gtk2, gtk3)) && (ffStrbufIgnCaseEqual(gtk2, gtk4)))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk4);
|
||||
ffStrbufAppendS(buffer, " [GTK2/3/4]");
|
||||
}
|
||||
else if(ffStrbufIgnCaseComp(gtk2, gtk3) == 0)
|
||||
else if(ffStrbufIgnCaseEqual(gtk2, gtk3))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk3);
|
||||
ffStrbufAppendS(buffer, " [GTK2/3], ");
|
||||
ffStrbufAppend(buffer, gtk4);
|
||||
ffStrbufAppendS(buffer, " [GTK4]");
|
||||
}
|
||||
else if(ffStrbufIgnCaseComp(gtk3, gtk4) == 0)
|
||||
else if(ffStrbufIgnCaseEqual(gtk3, gtk4))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk2);
|
||||
ffStrbufAppendS(buffer, " [GTK2], ");
|
||||
@@ -147,7 +131,7 @@ void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, co
|
||||
}
|
||||
else if(gtk2->length > 0 && gtk3->length > 0)
|
||||
{
|
||||
if(ffStrbufIgnCaseComp(gtk2, gtk3) == 0)
|
||||
if(ffStrbufIgnCaseEqual(gtk2, gtk3))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk3);
|
||||
ffStrbufAppendS(buffer, " [GTK2/3]");
|
||||
@@ -162,7 +146,7 @@ void ffParseGTK(FFstrbuf* buffer, const FFstrbuf* gtk2, const FFstrbuf* gtk3, co
|
||||
}
|
||||
else if(gtk3->length > 0 && gtk4->length > 0)
|
||||
{
|
||||
if(ffStrbufIgnCaseComp(gtk3, gtk4) == 0)
|
||||
if(ffStrbufIgnCaseEqual(gtk3, gtk4))
|
||||
{
|
||||
ffStrbufAppend(buffer, gtk4);
|
||||
ffStrbufAppendS(buffer, " [GTK3/4]");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "fastfetch.h"
|
||||
#include "util/FFstrbuf.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -11,6 +11,12 @@ typedef struct FFVersion
|
||||
uint32_t patch;
|
||||
} FFVersion;
|
||||
|
||||
typedef struct FFColorRangeConfig
|
||||
{
|
||||
uint8_t green;
|
||||
uint8_t yellow;
|
||||
} FFColorRangeConfig;
|
||||
|
||||
#define FF_VERSION_INIT ((FFVersion) {0})
|
||||
|
||||
void ffParseSemver(FFstrbuf* buffer, const FFstrbuf* major, const FFstrbuf* minor, const FFstrbuf* patch);
|
||||
@@ -20,4 +26,3 @@ void ffVersionToPretty(const FFVersion* version, FFstrbuf* pretty);
|
||||
int8_t ffVersionCompare(const FFVersion* version1, const FFVersion* version2);
|
||||
|
||||
void ffParseSize(uint64_t bytes, FFstrbuf* result);
|
||||
void ffParseTemperature(double celsius, FFstrbuf* buffer);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentConfig config)
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config)
|
||||
{
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
assert(green <= 100 && yellow <= 100);
|
||||
@@ -75,7 +75,7 @@ void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentConfig config
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
}
|
||||
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config, bool parentheses)
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses)
|
||||
{
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
assert(green <= 100 && yellow <= 100);
|
||||
@@ -89,9 +89,9 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config
|
||||
|
||||
if (colored && !options->pipe)
|
||||
{
|
||||
const char* colorGreen = instance.config.display.percentColorGreen.chars;
|
||||
const char* colorYellow = instance.config.display.percentColorYellow.chars;
|
||||
const char* colorRed = instance.config.display.percentColorRed.chars;
|
||||
const char* colorGreen = options->percentColorGreen.chars;
|
||||
const char* colorYellow = options->percentColorYellow.chars;
|
||||
const char* colorRed = options->percentColorRed.chars;
|
||||
|
||||
if(percent != percent)
|
||||
ffStrbufAppendS(buffer, "\e[" FF_COLOR_FG_LIGHT_BLACK "m");
|
||||
@@ -126,7 +126,7 @@ void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config
|
||||
ffStrbufAppendC(buffer, ')');
|
||||
}
|
||||
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentConfig* config)
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config)
|
||||
{
|
||||
if (!ffStrStartsWithIgnCase(subkey, "percent-"))
|
||||
return false;
|
||||
@@ -160,7 +160,7 @@ bool ffPercentParseCommandOptions(const char* key, const char* subkey, const cha
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentConfig* config)
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config)
|
||||
{
|
||||
if (!ffStrEqualsIgnCase(key, "percent"))
|
||||
return false;
|
||||
@@ -198,7 +198,7 @@ bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentConfi
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentConfig defaultConfig, FFPercentConfig config)
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config)
|
||||
{
|
||||
if (config.green == defaultConfig.green && config.yellow == defaultConfig.yellow)
|
||||
return;
|
||||
|
||||
+6
-11
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/FFstrbuf.h"
|
||||
#include "common/parsing.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -10,12 +11,6 @@ enum
|
||||
FF_PERCENTAGE_TYPE_NUM_COLOR_BIT = 1 << 3,
|
||||
};
|
||||
|
||||
typedef struct FFPercentConfig
|
||||
{
|
||||
uint8_t green;
|
||||
uint8_t yellow;
|
||||
} FFPercentConfig;
|
||||
|
||||
// if (green <= yellow)
|
||||
// [0, green]: print green
|
||||
// (green, yellow]: print yellow
|
||||
@@ -26,12 +21,12 @@ typedef struct FFPercentConfig
|
||||
// [yellow, green): print yellow
|
||||
// [0, yellow): print red
|
||||
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFPercentConfig config);
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFPercentConfig config, bool parentheses);
|
||||
void ffPercentAppendBar(FFstrbuf* buffer, double percent, FFColorRangeConfig config);
|
||||
void ffPercentAppendNum(FFstrbuf* buffer, double percent, FFColorRangeConfig config, bool parentheses);
|
||||
|
||||
typedef struct yyjson_val yyjson_val;
|
||||
typedef struct yyjson_mut_doc yyjson_mut_doc;
|
||||
typedef struct yyjson_mut_val yyjson_mut_val;
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFPercentConfig* config);
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFPercentConfig* config);
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFPercentConfig defaultConfig, FFPercentConfig config);
|
||||
bool ffPercentParseCommandOptions(const char* key, const char* subkey, const char* value, FFColorRangeConfig* config);
|
||||
bool ffPercentParseJsonObject(const char* key, yyjson_val* value, FFColorRangeConfig* config);
|
||||
void ffPercentGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FFColorRangeConfig defaultConfig, FFColorRangeConfig config);
|
||||
|
||||
+4
-12
@@ -37,9 +37,9 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
ffParseFormatString(&key, &moduleArgs->key, 1, (FFformatarg[]){
|
||||
FF_PARSE_FORMAT_STRING_CHECKED(&key, &moduleArgs->key, 1, ((FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_UINT8, &moduleIndex}
|
||||
});
|
||||
}));
|
||||
ffStrbufWriteTo(&key, stdout);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModu
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintFormatString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments)
|
||||
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
if (moduleArgs)
|
||||
@@ -93,7 +93,7 @@ static void printError(const char* moduleName, uint8_t moduleIndex, const FFModu
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
void ffPrintErrorString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
|
||||
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...)
|
||||
{
|
||||
va_list arguments;
|
||||
va_start(arguments, message);
|
||||
@@ -101,14 +101,6 @@ void ffPrintErrorString(const char* moduleName, uint8_t moduleIndex, const FFMod
|
||||
va_end(arguments);
|
||||
}
|
||||
|
||||
void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, const char* message, ...)
|
||||
{
|
||||
va_list arguments;
|
||||
va_start(arguments, message);
|
||||
printError(moduleName, moduleIndex, moduleArgs, FF_PRINT_TYPE_DEFAULT, message, arguments);
|
||||
va_end(arguments);
|
||||
}
|
||||
|
||||
void ffPrintColor(const FFstrbuf* colorValue)
|
||||
{
|
||||
//If the color is not set, this would reset in \033[m, which resets everything.
|
||||
|
||||
+10
-7
@@ -12,14 +12,17 @@ typedef enum FFPrintType {
|
||||
} FFPrintType;
|
||||
|
||||
void ffPrintLogoAndKey(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType);
|
||||
void ffPrintFormatString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
|
||||
static inline void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, uint32_t numArgs, const FFformatarg* arguments)
|
||||
{
|
||||
ffPrintFormatString(moduleName, moduleIndex, moduleArgs, FF_PRINT_TYPE_DEFAULT, numArgs, arguments);
|
||||
}
|
||||
FF_C_PRINTF(5, 6) void ffPrintErrorString(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
|
||||
FF_C_PRINTF(4, 5) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, const char* message, ...);
|
||||
void ffPrintFormat(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, uint32_t numArgs, const FFformatarg* arguments);
|
||||
#define FF_PRINT_FORMAT_CHECKED(moduleName, moduleIndex, moduleArgs, printType, numArgs, arguments) do {\
|
||||
static_assert(sizeof(arguments) / sizeof(*(arguments)) == (numArgs), "Invalid number of format arguments");\
|
||||
ffPrintFormat((moduleName), (moduleIndex), (moduleArgs), (printType), (numArgs), (arguments));\
|
||||
} while (0)
|
||||
FF_C_PRINTF(5, 6) void ffPrintError(const char* moduleName, uint8_t moduleIndex, const FFModuleArgs* moduleArgs, FFPrintType printType, const char* message, ...);
|
||||
void ffPrintColor(const FFstrbuf* colorValue);
|
||||
void ffPrintCharTimes(char c, uint32_t times);
|
||||
|
||||
void ffPrintModuleFormatHelp(const char* name, const char* def, uint32_t numArgs, const char* args[]);
|
||||
#define FF_PRINT_MODULE_FORMAT_HELP_CHECKED(moduleName, def, numArgs, args) do {\
|
||||
static_assert(sizeof(args) / sizeof(*(args)) == (numArgs), "Invalid number of format arguments");\
|
||||
ffPrintModuleFormatHelp((moduleName), (def), (numArgs), (args));\
|
||||
} while (0)
|
||||
|
||||
@@ -154,16 +154,13 @@ bool ffParsePropFileListValues(const FFlist* list, const char* relativeFile, uin
|
||||
{
|
||||
bool foundAFile = false;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);
|
||||
|
||||
FF_LIST_FOR_EACH(FFstrbuf, dirPrefix, *list)
|
||||
{
|
||||
//We need to copy the dir each time, because it used by multiple threads, so we can't directly write to it.
|
||||
ffStrbufSet(&baseDir, dirPrefix);
|
||||
ffStrbufAppendS(&baseDir, relativeFile);
|
||||
|
||||
if(ffParsePropFileValues(baseDir.chars, numQueries, queries))
|
||||
const uint32_t dirPrefixLength = dirPrefix->length;
|
||||
ffStrbufAppendS(dirPrefix, relativeFile);
|
||||
if(ffParsePropFileValues(dirPrefix->chars, numQueries, queries))
|
||||
foundAFile = true;
|
||||
ffStrbufSubstrBefore(dirPrefix, dirPrefixLength);
|
||||
|
||||
bool allSet = true;
|
||||
for(uint32_t k = 0; k < numQueries; k++)
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
#include "fastfetch.h"
|
||||
#include "common/temps.h"
|
||||
#include "util/textModifier.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config)
|
||||
{
|
||||
if (celsius != celsius) // ignores NaN
|
||||
return;
|
||||
|
||||
const FFOptionsDisplay* options = &instance.config.display;
|
||||
const char* colorGreen = options->tempColorGreen.chars;
|
||||
const char* colorYellow = options->tempColorYellow.chars;
|
||||
const char* colorRed = options->tempColorRed.chars;
|
||||
|
||||
uint8_t green = config.green, yellow = config.yellow;
|
||||
|
||||
if (!options->pipe)
|
||||
{
|
||||
if(green <= yellow)
|
||||
{
|
||||
if (celsius > yellow)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorRed);
|
||||
else if (celsius > green)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
|
||||
else
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorGreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (celsius < yellow)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorRed);
|
||||
else if (celsius < green)
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorYellow);
|
||||
else
|
||||
ffStrbufAppendF(buffer, "\e[%sm", colorGreen);
|
||||
}
|
||||
}
|
||||
|
||||
switch (options->temperatureUnit)
|
||||
{
|
||||
case FF_TEMPERATURE_UNIT_CELSIUS:
|
||||
ffStrbufAppendF(buffer, "%.*f°C", options->tempNdigits, celsius);
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_FAHRENHEIT:
|
||||
ffStrbufAppendF(buffer, "%.*f°F", options->tempNdigits, celsius * 1.8 + 32);
|
||||
break;
|
||||
case FF_TEMPERATURE_UNIT_KELVIN:
|
||||
ffStrbufAppendF(buffer, "%.*f K", options->tempNdigits, celsius + 273.15);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!options->pipe)
|
||||
ffStrbufAppendS(buffer, FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
}
|
||||
|
||||
bool ffTempsParseCommandOptions(const char* key, const char* subkey, const char* value, bool* useTemp, FFColorRangeConfig* config)
|
||||
{
|
||||
if (!ffStrStartsWithIgnCase(subkey, "temp"))
|
||||
return false;
|
||||
|
||||
if (subkey[strlen("temp")] == '\0')
|
||||
{
|
||||
*useTemp = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (subkey[strlen("temp")] != '-')
|
||||
return false;
|
||||
|
||||
subkey += strlen("temp-");
|
||||
|
||||
if (ffStrEqualsIgnCase(subkey, "green"))
|
||||
{
|
||||
uint32_t num = ffOptionParseUInt32(key, value);
|
||||
if (num > 100)
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s must be between 0 and 100\n", key);
|
||||
exit(480);
|
||||
}
|
||||
config->green = (uint8_t) num;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subkey, "yellow"))
|
||||
{
|
||||
uint32_t num = ffOptionParseUInt32(key, value);
|
||||
if (num > 100)
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s must be between 0 and 100\n", key);
|
||||
exit(480);
|
||||
}
|
||||
config->yellow = (uint8_t) num;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ffTempsParseJsonObject(const char* key, yyjson_val* value, bool* useTemp, FFColorRangeConfig* config)
|
||||
{
|
||||
if (!ffStrEqualsIgnCase(key, "temp"))
|
||||
return false;
|
||||
|
||||
if (yyjson_is_bool(value))
|
||||
{
|
||||
*useTemp = yyjson_get_bool(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (yyjson_is_null(value))
|
||||
{
|
||||
*useTemp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!yyjson_is_obj(value))
|
||||
{
|
||||
fprintf(stderr, "Error: usage: %s must be an object or a boolean\n", key);
|
||||
exit(480);
|
||||
}
|
||||
|
||||
*useTemp = true;
|
||||
|
||||
yyjson_val* greenVal = yyjson_obj_get(value, "green");
|
||||
if (greenVal)
|
||||
{
|
||||
int num = yyjson_get_int(greenVal);
|
||||
if (num < 0 || num > 100)
|
||||
{
|
||||
fputs("Error: usage: temp.green must be between 0 and 100\n", stderr);
|
||||
exit(480);
|
||||
}
|
||||
config->green = (uint8_t) num;
|
||||
}
|
||||
|
||||
yyjson_val* yellowVal = yyjson_obj_get(value, "yellow");
|
||||
if (yellowVal)
|
||||
{
|
||||
int num = yyjson_get_int(yellowVal);
|
||||
if (num < 0 || num > 100)
|
||||
{
|
||||
fputs("Error: usage: temp.yellow must be between 0 and 100\n", stderr);
|
||||
exit(480);
|
||||
}
|
||||
config->yellow = (uint8_t) num;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffTempsGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FF_MAYBE_UNUSED bool defaultTemp, FFColorRangeConfig defaultConfig, bool temp, FFColorRangeConfig config)
|
||||
{
|
||||
assert(defaultTemp == false); // assume defaultTemp is always false
|
||||
|
||||
if (!temp)
|
||||
return;
|
||||
|
||||
if (config.green != defaultConfig.green || config.yellow != defaultConfig.yellow)
|
||||
{
|
||||
yyjson_mut_val* temp = yyjson_mut_obj_add_obj(doc, module, "temp");
|
||||
if (config.green != defaultConfig.green)
|
||||
yyjson_mut_obj_add_uint(doc, temp, "green", config.green);
|
||||
if (config.yellow != defaultConfig.yellow)
|
||||
yyjson_mut_obj_add_uint(doc, temp, "yellow", config.yellow);
|
||||
}
|
||||
else
|
||||
{
|
||||
yyjson_mut_obj_add_bool(doc, module, "temp", true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/parsing.h"
|
||||
|
||||
void ffTempsAppendNum(double celsius, FFstrbuf* buffer, FFColorRangeConfig config);
|
||||
bool ffTempsParseCommandOptions(const char* key, const char* subkey, const char* value, bool* useTemp, FFColorRangeConfig* config);
|
||||
bool ffTempsParseJsonObject(const char* key, yyjson_val* value, bool* useTemp, FFColorRangeConfig* config);
|
||||
void ffTempsGenerateJsonConfig(yyjson_mut_doc* doc, yyjson_mut_val* module, FF_MAYBE_UNUSED bool defaultTemp, FFColorRangeConfig defaultConfig, bool temp, FFColorRangeConfig config);
|
||||
+36
-2
@@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <synchapi.h>
|
||||
#include <profileapi.h>
|
||||
#include <sysinfoapi.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
static inline uint64_t ffTimeGetTick() //In msec
|
||||
@@ -45,3 +45,37 @@ static inline void ffTimeSleep(uint32_t msec)
|
||||
nanosleep(&(struct timespec){ msec / 1000, (long) (msec % 1000) * 1000000 }, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
#endif
|
||||
|
||||
// Not thread-safe
|
||||
static inline const char* ffTimeToFullStr(uint64_t msec)
|
||||
{
|
||||
if (msec == 0) return "";
|
||||
time_t tsec = (time_t) (msec / 1000);
|
||||
const struct tm* tm = localtime(&tsec);
|
||||
|
||||
static char buf[32];
|
||||
strftime(buf, __builtin_strlen("0000-00-00T00:00:00") + 1, "%FT%T", tm);
|
||||
snprintf(buf + __builtin_strlen("0000-00-00T00:00:00"), __builtin_strlen(".000") + 1, ".%03u", (unsigned) (msec % 1000));
|
||||
strftime(buf + __builtin_strlen("0000-00-00T00:00:00.000"), __builtin_strlen("+0000") + 1, "%z", tm);
|
||||
return buf;
|
||||
}
|
||||
|
||||
// Not thread-safe
|
||||
static inline const char* ffTimeToShortStr(uint64_t msec)
|
||||
{
|
||||
if (msec == 0) return "";
|
||||
time_t tsec = (time_t) (msec / 1000);
|
||||
|
||||
static char buf[32];
|
||||
strftime(buf, sizeof(buf), "%F %T", localtime(&tsec));
|
||||
return buf;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
+78
-1
@@ -656,7 +656,7 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temperature-unit",
|
||||
"long": "temp-unit",
|
||||
"desc": "Set the unit of the temperature",
|
||||
"arg": {
|
||||
"type": "enum",
|
||||
@@ -667,6 +667,51 @@
|
||||
},
|
||||
"default": "C"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-ndigits",
|
||||
"desc": "Set the number of digits to keep after the decimal point when printing temperature",
|
||||
"arg": {
|
||||
"type": "num",
|
||||
"default": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-color-green",
|
||||
"desc": "Set color used in green state of temperature values",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color",
|
||||
"default": "green"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-color-yellow",
|
||||
"desc": "Set color used in yellow state of temperature values",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color",
|
||||
"default": "light_yellow"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "temp-color-red",
|
||||
"desc": "Set color used in red state of temperature values",
|
||||
"remark": "See `-h color` for the list of available colors",
|
||||
"arg": {
|
||||
"type": "color",
|
||||
"default": "light_red"
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "ts-version",
|
||||
"desc": "Whether to detect and display the version of terminal and shell",
|
||||
"remark": "Mainly for benchmarking",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"Library path": [
|
||||
@@ -1226,6 +1271,15 @@
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "localip-show-prefix-len",
|
||||
"desc": "Show network prefix length (/N) in local ip module",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "localip-name-prefix",
|
||||
"desc": "Show interfaces with given interface name prefix only",
|
||||
@@ -1497,6 +1551,29 @@
|
||||
"type": "num"
|
||||
},
|
||||
"pseudo": true
|
||||
},
|
||||
{
|
||||
"long": "<module>-temp-green",
|
||||
"desc": [
|
||||
"Threshold of temperature colors",
|
||||
"Value less then temp-green will be shown in green"
|
||||
],
|
||||
"arg": {
|
||||
"type": "num"
|
||||
},
|
||||
"pseudo": true
|
||||
},
|
||||
{
|
||||
"long": "<module>-temp-yellow",
|
||||
"desc": [
|
||||
"Threshold of temperature colors",
|
||||
"Value greater than temp-green and less then yellow will be shown in yellow",
|
||||
"Value greater than temp-yellow will be shown in red"
|
||||
],
|
||||
"arg": {
|
||||
"type": "num"
|
||||
},
|
||||
"pseudo": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
Usage: fastfetch -c <file>
|
||||
|
||||
Loads a config file. A config file contains one flag per line. Empty lines or lines starting with # are ignored.
|
||||
If the file is relative it looks in the following order:
|
||||
- relative to the current working directory
|
||||
- relative to ~/.local/share/fastfetch/presets/
|
||||
- relative to /usr/share/fastfetch/presets/
|
||||
Fastfetch provides some default presets. List them with "fastfetch --list-presets".
|
||||
@@ -1,15 +1,15 @@
|
||||
A format string is a string that contains placeholders for values.
|
||||
These placeholders begin with a '{', containing the index of the value, and end with a '}'.
|
||||
For example the format string "Values: {1} ({2})", with the values "First" and "My second val", will produce
|
||||
For example the format string "Values: {1} ({2})", with the values "First" and "My second val", will produce "Values: First (My second val)".
|
||||
The format string can contain placeholders in any order and have multiple occurrences.
|
||||
To include spaces when setting from the command line, surround the whole string with double quotes (").
|
||||
|
||||
If the value index is missing, meaning the placeholder is "{}", an internal counter sets the value index.
|
||||
This means that the format string "Values: {1} ({2})" is equivalent to "Values: {} ({})".
|
||||
Note that this counter only counts empty placeholders, so the format string "{2} {} {}" will contain the second v
|
||||
Note that this counter only counts empty placeholders, so the format string "{2} {} {}" will contain the second value, then the first, and then the second again.
|
||||
|
||||
To make formatting easier, a double open curly brace ("{{") will be printed as a single open curly brace and not
|
||||
If a value index is misformatted or wants a non-existing value, it will be printed as is, with the curly braces aro
|
||||
To make formatting easier, a double open curly brace ("{{") will be printed as a single open curly brace and not counted as the beginning of a placeholder.
|
||||
If a value index is misformatted or wants a non-existing value, it will be printed as is, with the curly braces around it.
|
||||
If the last placeholder isn't closed, it will be treated like it was at the end of the format string.
|
||||
|
||||
To only print something if a variable is set, use "{?<index>} ... {?}".
|
||||
@@ -17,7 +17,7 @@ For example, to only print a second value if it is set, use "{?2} Second value:
|
||||
If a "{?}" is found without an opener, it is printed as is.
|
||||
|
||||
To only print something if a variable is not set, do the same as with if, just replace every '?' with a '!'.
|
||||
For example to print a fallback for a second value if it is not set, use "{?2}{2}{?}{/2}Second value fallback{/}"
|
||||
For example to print a fallback for a second value if it is not set, use "{?2}{2}{?}{/2}Second value fallback{/}".
|
||||
|
||||
To stop formatting at any point in the format string, use "{-}".
|
||||
|
||||
@@ -25,7 +25,7 @@ To print something with color, start a placeholder with a '#' and then the linux
|
||||
"\033[" at the start, and an 'm' at the end is automatically added, so don't do that.
|
||||
A "{#}" is equivalent to a "{#0}" and resets everything to normal.
|
||||
For example to print something pink and underline, use "{#4;35}...{#}".
|
||||
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Sele
|
||||
Information about what the numbers mean can be found here: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters.
|
||||
Which escape codes are supported and how they look is defined by your terminal.
|
||||
|
||||
If a format string evaluates to an empty value, the whole line in the output will be discarded.
|
||||
|
||||
@@ -114,7 +114,7 @@ static const char* detectWithDdcci(FFBrightnessOptions* options, FFlist* result)
|
||||
{
|
||||
FF_SUPPRESS_IO();
|
||||
// Ref: https://github.com/rockowitz/ddcutil/issues/344
|
||||
if (ffddca_init("--disable-watch-displays", -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0)
|
||||
if (ffddca_init(NULL, -1 /*DDCA_SYSLOG_NOT_SET*/, 1 /*DDCA_INIT_OPTIONS_DISABLE_CONFIG_FILE*/) < 0)
|
||||
return "ddca_init() failed";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -18,3 +18,24 @@ const char* ffDetectCPU(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
ffStrbufTrimRight(&cpu->name, ' '); //If we removed the @ in previous step there was most likely a space before it
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffCPUAppleCodeToName(uint32_t code)
|
||||
{
|
||||
// https://github.com/AsahiLinux/docs/wiki/Codenames
|
||||
switch (code)
|
||||
{
|
||||
case 8103: return "Apple M1";
|
||||
case 6000: return "Apple M1 Pro";
|
||||
case 6001: return "Apple M1 Max";
|
||||
case 6002: return "Apple M1 Ultra";
|
||||
case 8112: return "Apple M2";
|
||||
case 6020: return "Apple M2 Pro";
|
||||
case 6021: return "Apple M2 Max";
|
||||
case 6022: return "Apple M2 Ultra";
|
||||
case 8122: return "Apple M3";
|
||||
case 6030: return "Apple M3 Pro";
|
||||
case 6031:
|
||||
case 6034: return "Apple M3 Max";
|
||||
default: return "Apple Silicon";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,13 @@ typedef struct FFCPUResult
|
||||
uint16_t coresLogical;
|
||||
uint16_t coresOnline;
|
||||
|
||||
double frequencyMin; // GHz
|
||||
double frequencyBase; // GHz
|
||||
double frequencyMax; // GHz
|
||||
double frequencyMin; // GHz
|
||||
|
||||
double temperature;
|
||||
} FFCPUResult;
|
||||
|
||||
const char* ffCPUDetectByCpuid(FFCPUResult* cpu);
|
||||
const char* ffDetectCPU(const FFCPUOptions* options, FFCPUResult* cpu);
|
||||
const char* ffCPUAppleCodeToName(uint32_t code);
|
||||
|
||||
@@ -60,14 +60,13 @@ static const char* detectFrequency(FFCPUResult* cpu)
|
||||
ffCfDictGetData(properties, CFSTR("voltage-states5-sram"), pCoreLength - 8, 4, (uint8_t*) &aMax, NULL);
|
||||
cpu->frequencyMax = aMax / (1000.0 * 1000 * 1000);
|
||||
}
|
||||
else
|
||||
cpu->frequencyMax = 0.0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
static const char* detectFrequency(FFCPUResult* cpu)
|
||||
{
|
||||
cpu->frequencyBase = ffSysctlGetInt64("hw.cpufrequency", 0) / 1000.0 / 1000.0 / 1000.0;
|
||||
cpu->frequencyMin = ffSysctlGetInt64("hw.cpufrequency_min", 0) / 1000.0 / 1000.0 / 1000.0;
|
||||
cpu->frequencyMax = ffSysctlGetInt64("hw.cpufrequency_max", 0);
|
||||
if(cpu->frequencyMax > 0.0)
|
||||
|
||||
@@ -11,8 +11,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresLogical = cpu->coresPhysical;
|
||||
cpu->coresOnline = cpu->coresPhysical;
|
||||
|
||||
cpu->frequencyMin = ffSysctlGetInt("hw.clockrate", 0) / 1000.0;
|
||||
cpu->frequencyMax = cpu->frequencyMin;
|
||||
int clockRate = ffSysctlGetInt("hw.clockrate", 0);
|
||||
cpu->frequencyBase = clockRate <= 0 ? 0.0/0.0 : clockRate / 1000.0;
|
||||
cpu->temperature = FF_CPU_TEMP_UNSET;
|
||||
|
||||
if (options->temp)
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
static void detectAndroid(FFCPUResult* cpu)
|
||||
{
|
||||
if (cpu->name.length == 0)
|
||||
{
|
||||
ffSettingsGetAndroidProperty("ro.soc.model", &cpu->name);
|
||||
ffStrbufClear(&cpu->vendor); // We usually detect the vendor of CPU core as ARM, but instead we want the vendor of SOC
|
||||
}
|
||||
if (cpu->vendor.length == 0)
|
||||
{
|
||||
if (!ffSettingsGetAndroidProperty("ro.soc.manufacturer", &cpu->vendor))
|
||||
@@ -85,30 +88,70 @@ static const char* parseCpuInfo(FFCPUResult* cpu, FFstrbuf* physicalCoresBuffer,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static double getGHz(const char* file)
|
||||
static double getFrequency(FFstrbuf* basePath, const char* cpuinfoFileName, const char* scalingFileName, FFstrbuf* buffer)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate();
|
||||
if(ffAppendFileBuffer(file, &content))
|
||||
uint32_t baseLen = basePath->length;
|
||||
ffStrbufAppendS(basePath, cpuinfoFileName);
|
||||
bool ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return ffStrbufToDouble(buffer) / 1e6;
|
||||
|
||||
if (scalingFileName)
|
||||
{
|
||||
double herz = ffStrbufToDouble(&content);
|
||||
|
||||
//ffStrbufToDouble failed
|
||||
if(herz != herz)
|
||||
return 0;
|
||||
|
||||
herz /= 1000.0; //to MHz
|
||||
return herz / 1000.0; //to GHz
|
||||
ffStrbufAppendS(basePath, scalingFileName);
|
||||
ok = ffReadFileBuffer(basePath->chars, buffer);
|
||||
ffStrbufSubstrBefore(basePath, baseLen);
|
||||
if (ok)
|
||||
return ffStrbufToDouble(buffer) / 1e6;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return 0.0/0.0;
|
||||
}
|
||||
|
||||
static double getFrequency(const char* info, const char* scaling)
|
||||
static bool detectFrequency(FFCPUResult* cpu)
|
||||
{
|
||||
double frequency = getGHz(info);
|
||||
if(frequency > 0.0)
|
||||
return frequency;
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/sys/devices/system/cpu/cpufreq/");
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir(path.chars);
|
||||
if (!dir) return false;
|
||||
|
||||
return getGHz(scaling);
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
uint32_t baseLen = path.length;
|
||||
|
||||
struct dirent* entry;
|
||||
while((entry = readdir(dir)) != NULL)
|
||||
{
|
||||
if (ffStrStartsWith(entry->d_name, "policy") && isdigit(entry->d_name[strlen("policy")]))
|
||||
{
|
||||
ffStrbufAppendS(&path, entry->d_name);
|
||||
double fbase = getFrequency(&path, "/base_frequency", NULL, &buffer);
|
||||
if (fbase == fbase)
|
||||
{
|
||||
if (cpu->frequencyBase == cpu->frequencyBase)
|
||||
cpu->frequencyBase = cpu->frequencyBase > fbase ? cpu->frequencyBase : fbase;
|
||||
else
|
||||
cpu->frequencyBase = fbase;
|
||||
}
|
||||
double fmax = getFrequency(&path, "/cpuinfo_max_freq", "/scaling_max_freq", &buffer);
|
||||
if (fmax == fmax)
|
||||
{
|
||||
if (cpu->frequencyMax == cpu->frequencyMax)
|
||||
cpu->frequencyMax = cpu->frequencyMax > fmax ? cpu->frequencyMax : fmax;
|
||||
else
|
||||
cpu->frequencyMax = fmax;
|
||||
}
|
||||
double fmin = getFrequency(&path, "/cpuinfo_min_freq", "/scaling_min_freq", &buffer);
|
||||
if (fmin == fmin)
|
||||
{
|
||||
if (cpu->frequencyMin == cpu->frequencyMin)
|
||||
cpu->frequencyMin = cpu->frequencyMin < fmin ? cpu->frequencyMin : fmin;
|
||||
else
|
||||
cpu->frequencyMin = fmin;
|
||||
}
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static double detectCPUTemp(void)
|
||||
@@ -167,23 +210,8 @@ void detectAsahi(FFCPUResult* cpu)
|
||||
char* modelName = memchr(content, '\0', (size_t) length) + 1;
|
||||
if (modelName - content < length && ffStrStartsWith(modelName, "apple,t"))
|
||||
{
|
||||
// https://github.com/AsahiLinux/docs/wiki/Codenames
|
||||
switch (strtoul(modelName + strlen("apple,t"), NULL, 10))
|
||||
{
|
||||
case 8103: ffStrbufSetStatic(&cpu->name, "Apple M1"); break;
|
||||
case 6000: ffStrbufSetStatic(&cpu->name, "Apple M1 Pro"); break;
|
||||
case 6001: ffStrbufSetStatic(&cpu->name, "Apple M1 Max"); break;
|
||||
case 6002: ffStrbufSetStatic(&cpu->name, "Apple M1 Ultra"); break;
|
||||
case 8112: ffStrbufSetStatic(&cpu->name, "Apple M2"); break;
|
||||
case 6020: ffStrbufSetStatic(&cpu->name, "Apple M2 Pro"); break;
|
||||
case 6021: ffStrbufSetStatic(&cpu->name, "Apple M2 Max"); break;
|
||||
case 6022: ffStrbufSetStatic(&cpu->name, "Apple M2 Ultra"); break;
|
||||
case 8122: ffStrbufSetStatic(&cpu->name, "Apple M3"); break;
|
||||
case 6030: ffStrbufSetStatic(&cpu->name, "Apple M3 Pro"); break;
|
||||
case 6031:
|
||||
case 6034: ffStrbufSetStatic(&cpu->name, "Apple M3 Max"); break;
|
||||
default: ffStrbufSetStatic(&cpu->name, "Apple Silicon"); break;
|
||||
}
|
||||
uint32_t deviceId = (uint32_t) strtoul(modelName + strlen("apple,t"), NULL, 10);
|
||||
ffStrbufSetStatic(&cpu->name, ffCPUAppleCodeToName(deviceId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,16 +232,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresOnline = (uint16_t) get_nprocs();
|
||||
cpu->coresPhysical = (uint16_t) ffStrbufToUInt(&physicalCoresBuffer, cpu->coresLogical);
|
||||
|
||||
#define BP "/sys/devices/system/cpu/cpufreq/policy0/"
|
||||
if(ffPathExists(BP, FF_PATHTYPE_DIRECTORY))
|
||||
{
|
||||
cpu->frequencyMin = getFrequency(BP"cpuinfo_min_freq", BP"scaling_min_freq");
|
||||
cpu->frequencyMax = getFrequency(BP"cpuinfo_max_freq", BP"scaling_max_freq");
|
||||
}
|
||||
else
|
||||
{
|
||||
cpu->frequencyMin = cpu->frequencyMax = ffStrbufToDouble(&cpuMHz) / 1000;
|
||||
}
|
||||
if (!detectFrequency(cpu) || cpu->frequencyBase != cpu->frequencyBase)
|
||||
cpu->frequencyBase = ffStrbufToDouble(&cpuMHz) / 1000;
|
||||
|
||||
if(cpuUarch.length > 0)
|
||||
{
|
||||
|
||||
@@ -64,50 +64,52 @@ static const char* detectMaxSpeedBySmbios(FFCPUResult* cpu)
|
||||
return "No active CPU is found in SMBIOS data";
|
||||
}
|
||||
|
||||
double speed;
|
||||
if (data->MaxSpeed > 0 && data->MaxSpeed < 30000) // VMware reports weird values
|
||||
speed = data->MaxSpeed / 1000.0;
|
||||
else
|
||||
speed = data->CurrentSpeed / 1000.0;
|
||||
double speed = data->MaxSpeed / 1000.0;
|
||||
// Sometimes SMBIOS reports invalid value. We assume that max speed is small than 2x of base
|
||||
if (speed < cpu->frequencyBase || speed > cpu->frequencyBase * 2)
|
||||
return "Possible invalid CPU max speed in SMBIOS data. See #800";
|
||||
|
||||
if (cpu->frequencyMax < speed)
|
||||
cpu->frequencyMax = speed;
|
||||
cpu->frequencyMax = speed;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* detectByOS(FFCPUResult* cpu)
|
||||
static const char* detectNCores(FFCPUResult* cpu)
|
||||
{
|
||||
DWORD length = 0;
|
||||
GetLogicalProcessorInformationEx(RelationAll, NULL, &length);
|
||||
if (length == 0)
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, NULL, &length) failed";
|
||||
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
|
||||
pProcessorInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)malloc(length);
|
||||
|
||||
if (!pProcessorInfo || !GetLogicalProcessorInformationEx(RelationAll, pProcessorInfo, &length))
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, pProcessorInfo, &length) failed";
|
||||
|
||||
for(
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* ptr = pProcessorInfo;
|
||||
(uint8_t*)ptr < ((uint8_t*)pProcessorInfo) + length;
|
||||
ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((uint8_t*)ptr) + ptr->Size)
|
||||
)
|
||||
{
|
||||
DWORD length = 0;
|
||||
GetLogicalProcessorInformationEx(RelationAll, NULL, &length);
|
||||
if (length == 0)
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, NULL, &length) failed";
|
||||
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
|
||||
pProcessorInfo = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)malloc(length);
|
||||
|
||||
if (pProcessorInfo && GetLogicalProcessorInformationEx(RelationAll, pProcessorInfo, &length))
|
||||
if(ptr->Relationship == RelationProcessorCore)
|
||||
++cpu->coresPhysical;
|
||||
else if(ptr->Relationship == RelationGroup)
|
||||
{
|
||||
for(
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* ptr = pProcessorInfo;
|
||||
(uint8_t*)ptr < ((uint8_t*)pProcessorInfo) + length;
|
||||
ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((uint8_t*)ptr) + ptr->Size)
|
||||
)
|
||||
for (uint32_t index = 0; index < ptr->Group.ActiveGroupCount; ++index)
|
||||
{
|
||||
if(ptr->Relationship == RelationProcessorCore)
|
||||
++cpu->coresPhysical;
|
||||
else if(ptr->Relationship == RelationGroup)
|
||||
{
|
||||
cpu->coresOnline += ptr->Group.GroupInfo->ActiveProcessorCount;
|
||||
cpu->coresLogical += ptr->Group.GroupInfo->MaximumProcessorCount;
|
||||
}
|
||||
cpu->coresOnline += ptr->Group.GroupInfo[index].ActiveProcessorCount;
|
||||
cpu->coresLogical += ptr->Group.GroupInfo[index].MaximumProcessorCount;
|
||||
}
|
||||
}
|
||||
else
|
||||
return "GetLogicalProcessorInformationEx(RelationAll, pProcessorInfo, &length) failed";
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* detectByRegistry(FFCPUResult* cpu)
|
||||
{
|
||||
FF_HKEY_AUTO_DESTROY hKey = NULL;
|
||||
if(!ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", &hKey, NULL))
|
||||
return "ffRegOpenKeyForRead(HKEY_LOCAL_MACHINE, L\"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0\", &hKey, NULL) failed";
|
||||
@@ -115,24 +117,34 @@ static const char* detectByOS(FFCPUResult* cpu)
|
||||
{
|
||||
uint32_t mhz;
|
||||
if(ffRegReadUint(hKey, L"~MHz", &mhz, NULL))
|
||||
cpu->frequencyMin = cpu->frequencyMax = mhz / 1000.0;
|
||||
cpu->frequencyBase = mhz / 1000.0;
|
||||
}
|
||||
|
||||
ffRegReadStrbuf(hKey, L"ProcessorNameString", &cpu->name, NULL);
|
||||
ffRegReadStrbuf(hKey, L"VendorIdentifier", &cpu->vendor, NULL);
|
||||
|
||||
if (cpu->coresLogical == 0)
|
||||
{
|
||||
DWORD cores;
|
||||
if (RegQueryInfoKeyW(HKEY_LOCAL_MACHINE, L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor", NULL, NULL, &cores, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
|
||||
cpu->coresOnline = cpu->coresPhysical = cpu->coresLogical = (uint16_t) cores;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
{
|
||||
const char* error = detectByOS(cpu);
|
||||
detectNCores(cpu);
|
||||
|
||||
const char* error = detectByRegistry(cpu);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
detectMaxSpeedBySmbios(cpu);
|
||||
|
||||
if(options->temp)
|
||||
ffDetectSmbiosTemp(&cpu->temperature, NULL);
|
||||
|
||||
detectMaxSpeedBySmbios(cpu);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -68,18 +68,33 @@ static bool detectCursorFromEnv(FFCursorResult* result)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool detectCursorHyprcursor(FFCursorResult* result)
|
||||
{
|
||||
const char* hyprcursor_theme = getenv("HYPRCURSOR_THEME");
|
||||
|
||||
if(!ffStrSet(hyprcursor_theme))
|
||||
return false;
|
||||
|
||||
ffStrbufAppendS(&result->theme, hyprcursor_theme);
|
||||
ffStrbufAppendS(&result->size, getenv("HYPRCURSOR_SIZE"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffDetectCursor(FFCursorResult* result)
|
||||
{
|
||||
const FFDisplayServerResult* wmde = ffConnectDisplayServer();
|
||||
|
||||
if(ffStrbufCompS(&wmde->wmPrettyName, FF_WM_PRETTY_WSLG) == 0)
|
||||
if(ffStrbufEqualS(&wmde->wmPrettyName, FF_WM_PRETTY_WSLG))
|
||||
ffStrbufAppendS(&result->error, "WSLg uses native windows cursor");
|
||||
else if(ffStrbufIgnCaseCompS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY) == 0)
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->wmProtocolName, FF_WM_PROTOCOL_TTY))
|
||||
ffStrbufAppendS(&result->error, "Cursor isn't supported in TTY");
|
||||
else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA) == 0)
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA))
|
||||
detectCursorFromConfigFile("kcminputrc", "cursorTheme =", "Breeze", "cursorSize =", "24", result);
|
||||
else if(ffStrbufStartsWithIgnCaseS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT))
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT))
|
||||
detectCursorFromConfigFile("lxqt/session.conf", "cursor_theme =", "Adwaita", "cursor_size =", "24", result);
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->wmPrettyName, FF_WM_PRETTY_HYPRLAND) && detectCursorHyprcursor(result))
|
||||
return;
|
||||
else if(
|
||||
!detectCursorGTK(result) &&
|
||||
!detectCursorFromEnv(result) &&
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "de.h"
|
||||
|
||||
#include "common/dbus.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/library.h"
|
||||
#include "common/parsing.h"
|
||||
@@ -12,19 +13,20 @@
|
||||
|
||||
static void getKDE(FFstrbuf* result, FFDEOptions* options)
|
||||
{
|
||||
ffParsePropFileValues("/usr/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
|
||||
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) {
|
||||
{"X-KDE-PluginInfo-Version =", result}
|
||||
});
|
||||
if(result->length == 0)
|
||||
{
|
||||
ffParsePropFileValues(FASTFETCH_TARGET_DIR_USR "/share/xsessions/plasmax11.desktop", 1, (FFpropquery[]) {
|
||||
{"X-KDE-PluginInfo-Version =", result}
|
||||
});
|
||||
}
|
||||
if(result->length == 0)
|
||||
ffParsePropFileData("xsessions/plasma.desktop", "X-KDE-PluginInfo-Version =", result);
|
||||
if(result->length == 0)
|
||||
ffParsePropFileData("xsessions/plasma5.desktop", "X-KDE-PluginInfo-Version =", result);
|
||||
if(result->length == 0)
|
||||
{
|
||||
ffParsePropFileValues("/usr/share/wayland-sessions/plasma.desktop", 1, (FFpropquery[]) {
|
||||
{"X-KDE-PluginInfo-Version =", result}
|
||||
});
|
||||
}
|
||||
|
||||
if(result->length == 0)
|
||||
ffParsePropFileData("wayland-sessions/plasmawayland.desktop", "X-KDE-PluginInfo-Version =", result);
|
||||
if(result->length == 0)
|
||||
@@ -41,11 +43,25 @@ static void getKDE(FFstrbuf* result, FFDEOptions* options)
|
||||
}
|
||||
}
|
||||
|
||||
static const char* getGnomeByDbus(FF_MAYBE_UNUSED FFstrbuf* result)
|
||||
{
|
||||
#ifdef FF_HAVE_DBUS
|
||||
FFDBusData dbus;
|
||||
if (ffDBusLoadData(DBUS_BUS_SESSION, &dbus) != NULL)
|
||||
return "ffDBusLoadData() failed";
|
||||
|
||||
ffDBusGetPropertyString(&dbus, "org.gnome.Shell", "/org/gnome/Shell", "org.gnome.Shell", "ShellVersion", result);
|
||||
return NULL;
|
||||
#else // FF_HAVE_DBUS
|
||||
return "ffDBusLoadData() failed: dbus support not compiled in";
|
||||
#endif // FF_HAVE_DBUS
|
||||
}
|
||||
|
||||
static void getGnome(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
|
||||
{
|
||||
ffParsePropFileData("gnome-shell/org.gnome.Extensions", "version :", result);
|
||||
getGnomeByDbus(result);
|
||||
|
||||
if (result->length == 0)
|
||||
if (result->length == 0 && options->slowVersionDetection)
|
||||
{
|
||||
if (ffProcessAppendStdOut(result, (char* const[]){
|
||||
"gnome-shell",
|
||||
|
||||
@@ -17,6 +17,8 @@ typedef struct FFDisk
|
||||
|
||||
uint32_t filesUsed;
|
||||
uint32_t filesTotal;
|
||||
|
||||
uint64_t createTime;
|
||||
} FFDisk;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <libgeom.h>
|
||||
@@ -130,6 +131,10 @@ const char* ffDetectDisksImpl(FFlist* disks)
|
||||
|
||||
if(fs->f_flags & MNT_RDONLY)
|
||||
disk->type |= FF_DISK_VOLUME_TYPE_READONLY_BIT;
|
||||
|
||||
struct stat st;
|
||||
if(stat(fs->f_mntonname, &st) == 0)
|
||||
disk->createTime = (uint64_t)((st.st_birthtimespec.tv_sec * 1000) + (st.st_birthtimespec.tv_nsec / 1000000));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <mntent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <mntent.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
@@ -31,7 +31,7 @@ static bool isPhysicalDevice(const struct mntent* device)
|
||||
|
||||
//DrvFs is a filesystem plugin to WSL that was designed to support interop between WSL and the Windows filesystem.
|
||||
if(ffStrEquals(device->mnt_type, "9p"))
|
||||
return true;
|
||||
return ffStrContains(device->mnt_opts, "aname=drvfs");
|
||||
|
||||
//ZFS pool
|
||||
if(ffStrEquals(device->mnt_type, "zfs"))
|
||||
@@ -241,6 +241,13 @@ static void detectStats(FFDisk* disk)
|
||||
|
||||
if(fs.f_flag & ST_RDONLY)
|
||||
disk->type |= FF_DISK_VOLUME_TYPE_READONLY_BIT;
|
||||
|
||||
disk->createTime = 0;
|
||||
#ifdef FF_HAVE_STATX
|
||||
struct statx stx;
|
||||
if (statx(0, disk->mountpoint.chars, 0, STATX_BTIME, &stx) == 0 && (stx.stx_mask & STATX_BTIME))
|
||||
disk->createTime = (uint64_t)((stx.stx_btime.tv_sec * 1000) + (stx.stx_btime.tv_nsec / 1000000));
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* ffDetectDisksImpl(FFlist* disks)
|
||||
|
||||
@@ -15,7 +15,7 @@ const char* ffDetectDisksImpl(FFlist* disks)
|
||||
|
||||
for(uint32_t i = 0; i < length; i++)
|
||||
{
|
||||
const wchar_t* mountpoint = buf + i;
|
||||
wchar_t* mountpoint = buf + i;
|
||||
|
||||
UINT driveType = GetDriveTypeW(mountpoint);
|
||||
if(driveType == DRIVE_NO_ROOT_DIR)
|
||||
@@ -25,13 +25,6 @@ const char* ffDetectDisksImpl(FFlist* disks)
|
||||
}
|
||||
|
||||
FFDisk* disk = ffListAdd(disks);
|
||||
ffStrbufInitWS(&disk->mountpoint, mountpoint);
|
||||
|
||||
wchar_t volumeName[64];
|
||||
if(GetVolumeNameForVolumeMountPointW(mountpoint, volumeName, sizeof(volumeName) / sizeof(*volumeName)))
|
||||
ffStrbufInitWS(&disk->mountFrom, volumeName);
|
||||
else
|
||||
ffStrbufInit(&disk->mountFrom);
|
||||
|
||||
if(!GetDiskFreeSpaceExW(
|
||||
mountpoint,
|
||||
@@ -78,6 +71,23 @@ const char* ffDetectDisksImpl(FFlist* disks)
|
||||
disk->type |= FF_DISK_VOLUME_TYPE_READONLY_BIT;
|
||||
}
|
||||
|
||||
WIN32_FILE_ATTRIBUTE_DATA data;
|
||||
if(GetFileAttributesExW(mountpoint, GetFileExInfoStandard, &data) && data.ftCreationTime.dwHighDateTime > 0)
|
||||
disk->createTime = (*(uint64_t*) &data.ftCreationTime - 116444736000000000ull) / 10000ull;
|
||||
else
|
||||
disk->createTime = 0;
|
||||
|
||||
ffStrbufInitWS(&disk->mountpoint, mountpoint);
|
||||
if (mountpoint[2] == L'\\' && mountpoint[3] == L'\0')
|
||||
{
|
||||
wchar_t volumeName[MAX_PATH + 1];
|
||||
mountpoint[2] = L'\0';
|
||||
if(QueryDosDeviceW(mountpoint, volumeName, sizeof(volumeName) / sizeof(*volumeName)))
|
||||
ffStrbufInitWS(&disk->mountFrom, volumeName);
|
||||
else
|
||||
ffStrbufInit(&disk->mountFrom);
|
||||
}
|
||||
|
||||
//Unsupported
|
||||
disk->filesUsed = 0;
|
||||
disk->filesTotal = 0;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define FF_WM_PRETTY_XFWM4 "Xfwm4"
|
||||
#define FF_WM_PRETTY_OPENBOX "Openbox"
|
||||
#define FF_WM_PRETTY_I3 "i3"
|
||||
#define FF_WM_PRETTY_HYPRLAND "Hyprland"
|
||||
#define FF_WM_PRETTY_WAYFIRE "Wayfire"
|
||||
#define FF_WM_PRETTY_SWAY "Sway"
|
||||
#define FF_WM_PRETTY_BSPWM "bspwm"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "displayserver_linux.h"
|
||||
#include "common/io/io.h"
|
||||
#include "util/edidHelper.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include "common/settings.h"
|
||||
@@ -57,3 +60,43 @@ void ffConnectDisplayServerImpl(FFDisplayServerResult* ds)
|
||||
//This fills in missing information about WM / DE by using env vars and iterating processes
|
||||
ffdsDetectWMDE(ds);
|
||||
}
|
||||
|
||||
bool ffdsMatchDrmConnector(const char* connName, FFstrbuf* edidName)
|
||||
{
|
||||
// https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-event-name
|
||||
// The doc says that "do not assume that the name is a reflection of an underlying DRM connector, X11 connection, etc."
|
||||
// However I can't find a better method to get the edid data
|
||||
const char* drmDirPath = "/sys/class/drm/";
|
||||
|
||||
DIR* dirp = opendir(drmDirPath);
|
||||
if(dirp == NULL)
|
||||
return false;
|
||||
|
||||
struct dirent* entry;
|
||||
while((entry = readdir(dirp)) != NULL)
|
||||
{
|
||||
const char* plainName = entry->d_name;
|
||||
if (ffStrStartsWith(plainName, "card"))
|
||||
{
|
||||
const char* tmp = strchr(plainName + strlen("card"), '-');
|
||||
if (tmp) plainName = tmp + 1;
|
||||
}
|
||||
if (ffStrEquals(plainName, connName))
|
||||
{
|
||||
ffStrbufAppendF(edidName, "%s%s/edid", drmDirPath, entry->d_name);
|
||||
|
||||
uint8_t edidData[128];
|
||||
if(ffReadFileData(edidName->chars, sizeof(edidData), edidData) == sizeof(edidData))
|
||||
{
|
||||
ffStrbufClear(edidName);
|
||||
ffEdidGetName(edidData, edidName);
|
||||
closedir(dirp);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
ffStrbufClear(edidName);
|
||||
closedir(dirp);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
|
||||
bool ffdsMatchDrmConnector(const char* connName, FFstrbuf* edidName);
|
||||
|
||||
const char* ffdsConnectWlroots(FFDisplayServerResult* result);
|
||||
void ffdsConnectWayland(FFDisplayServerResult* result);
|
||||
|
||||
void ffdsConnectXcbRandr(FFDisplayServerResult* result);
|
||||
|
||||
@@ -36,31 +36,28 @@ static const char* drmParseSysfs(FFDisplayServerResult* result)
|
||||
continue;
|
||||
}
|
||||
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirWithDnameLength);
|
||||
ffStrbufAppendS(&drmDir, "/modes");
|
||||
|
||||
char modes[32];
|
||||
if (ffReadFileData(drmDir.chars, sizeof(modes), modes) < 3)
|
||||
{
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned width = 0, height = 0;
|
||||
double refreshRate = 0;
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
|
||||
int scanned = sscanf(modes, "%ux%u", &width, &height);
|
||||
if(scanned == 2 && width > 0 && height > 0)
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirWithDnameLength);
|
||||
ffStrbufAppendS(&drmDir, "/edid");
|
||||
|
||||
uint8_t edidData[128];
|
||||
if(ffReadFileData(drmDir.chars, sizeof(edidData), edidData) == sizeof(edidData))
|
||||
{
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||
ffStrbufAppendS(&drmDir, entry->d_name);
|
||||
ffStrbufAppendS(&drmDir, "/edid");
|
||||
ffEdidGetName(edidData, &name);
|
||||
ffEdidGetPreferredResolutionAndRefreshRate(edidData, &width, &height, &refreshRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirWithDnameLength);
|
||||
ffStrbufAppendS(&drmDir, "/modes");
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY name = ffStrbufCreate();
|
||||
uint8_t edidData[128];
|
||||
if(ffReadFileData(drmDir.chars, sizeof(edidData), edidData) == sizeof(edidData))
|
||||
ffEdidGetName(edidData, &name);
|
||||
else
|
||||
char modes[32];
|
||||
if (ffReadFileData(drmDir.chars, sizeof(modes), modes) >= 3)
|
||||
{
|
||||
sscanf(modes, "%ux%u", &width, &height);
|
||||
const char* plainName = entry->d_name;
|
||||
if (ffStrStartsWith(plainName, "card"))
|
||||
{
|
||||
@@ -69,20 +66,20 @@ static const char* drmParseSysfs(FFDisplayServerResult* result)
|
||||
}
|
||||
ffStrbufAppendS(&name, plainName);
|
||||
}
|
||||
|
||||
ffdsAppendDisplay(
|
||||
result,
|
||||
width, height,
|
||||
0,
|
||||
0, 0,
|
||||
0,
|
||||
&name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
ffdsAppendDisplay(
|
||||
result,
|
||||
width, height,
|
||||
refreshRate,
|
||||
0, 0,
|
||||
0,
|
||||
&name,
|
||||
FF_DISPLAY_TYPE_UNKNOWN,
|
||||
false,
|
||||
0
|
||||
);
|
||||
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||
}
|
||||
|
||||
@@ -143,7 +140,7 @@ static inline const char* drmType2Name(uint32_t connector_type)
|
||||
return "DPI";
|
||||
case DRM_MODE_CONNECTOR_WRITEBACK:
|
||||
return "Writeback";
|
||||
case DRM_MODE_CONNECTOR_SPI:
|
||||
case 19 /*DRM_MODE_CONNECTOR_SPI*/:
|
||||
return "SPI";
|
||||
case 20 /*DRM_MODE_CONNECTOR_USB*/:
|
||||
return "USB";
|
||||
@@ -250,8 +247,8 @@ static const char* drmConnectLibdrm(FFDisplayServerResult* result)
|
||||
drmModeCrtc* crtc = ffdrmModeGetCrtc(fd, encoder->crtc_id);
|
||||
if (crtc)
|
||||
{
|
||||
width = crtc->mode.vdisplay;
|
||||
height = crtc->mode.hdisplay;
|
||||
width = crtc->mode.hdisplay;
|
||||
height = crtc->mode.vdisplay;
|
||||
refreshRate = crtc->mode.vrefresh;
|
||||
if (refreshRate == 0)
|
||||
{
|
||||
|
||||
@@ -1,352 +0,0 @@
|
||||
#include "displayserver_linux.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef FF_HAVE_WAYLAND
|
||||
#include "common/library.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/thread.h"
|
||||
#include "util/edidHelper.h"
|
||||
#include <wayland-client.h>
|
||||
#include <sys/socket.h>
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
|
||||
typedef struct WaylandData
|
||||
{
|
||||
FFDisplayServerResult* result;
|
||||
FF_LIBRARY_SYMBOL(wl_proxy_marshal_constructor_versioned)
|
||||
FF_LIBRARY_SYMBOL(wl_proxy_add_listener)
|
||||
FF_LIBRARY_SYMBOL(wl_proxy_destroy)
|
||||
FF_LIBRARY_SYMBOL(wl_display_roundtrip)
|
||||
struct wl_display* display;
|
||||
const struct wl_interface* ffwl_output_interface;
|
||||
} WaylandData;
|
||||
|
||||
typedef struct WaylandDisplay
|
||||
{
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t refreshRate;
|
||||
int32_t scale;
|
||||
enum wl_output_transform transform;
|
||||
FFDisplayType type;
|
||||
FFstrbuf name;
|
||||
FFstrbuf description;
|
||||
FFstrbuf vendorAndModelId;
|
||||
FFstrbuf edidName;
|
||||
} WaylandDisplay;
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
static void waylandDetectWM(int fd, FFDisplayServerResult* result)
|
||||
{
|
||||
struct ucred ucred;
|
||||
socklen_t len = sizeof(struct ucred);
|
||||
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1)
|
||||
return;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY procPath = ffStrbufCreate();
|
||||
ffStrbufAppendF(&procPath, "/proc/%d/cmdline", ucred.pid); //We check the cmdline for the process name, because it is not trimmed.
|
||||
ffReadFileBuffer(procPath.chars, &result->wmProcessName);
|
||||
ffStrbufTrimRightSpace(&result->wmProcessName);
|
||||
ffStrbufSubstrBeforeFirstC(&result->wmProcessName, '\0'); //Trim the arguments
|
||||
ffStrbufSubstrAfterLastC(&result->wmProcessName, '/'); //Trim the path
|
||||
}
|
||||
#else
|
||||
static void waylandDetectWM(int fd, FFDisplayServerResult* result)
|
||||
{
|
||||
FF_UNUSED(fd, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void stubListener(void* data, ...)
|
||||
{
|
||||
(void) data;
|
||||
}
|
||||
|
||||
static void waylandOutputModeListener(void* data, FF_MAYBE_UNUSED struct wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refreshRate)
|
||||
{
|
||||
if(!(flags & WL_OUTPUT_MODE_CURRENT))
|
||||
return;
|
||||
|
||||
WaylandDisplay* display = data;
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
display->refreshRate = refreshRate;
|
||||
}
|
||||
|
||||
static void waylandOutputScaleListener(void* data, FF_MAYBE_UNUSED struct wl_output* output, int32_t scale)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
display->scale = scale;
|
||||
}
|
||||
|
||||
static void waylandOutputGeometryListener(void *data,
|
||||
FF_MAYBE_UNUSED struct wl_output *output,
|
||||
FF_MAYBE_UNUSED int32_t x,
|
||||
FF_MAYBE_UNUSED int32_t y,
|
||||
FF_MAYBE_UNUSED int32_t physical_width,
|
||||
FF_MAYBE_UNUSED int32_t physical_height,
|
||||
FF_MAYBE_UNUSED int32_t subpixel,
|
||||
const char *make,
|
||||
const char *model,
|
||||
int32_t transform)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
display->transform = (enum wl_output_transform) transform;
|
||||
if (make && !ffStrEqualsIgnCase(make, "unknown") && model && !ffStrEqualsIgnCase(model, "unknown"))
|
||||
{
|
||||
ffStrbufAppendS(&display->vendorAndModelId, make);
|
||||
ffStrbufAppendS(&display->vendorAndModelId, model);
|
||||
}
|
||||
}
|
||||
|
||||
static bool matchDrmConnector(const char* wlName, FFstrbuf* edidName)
|
||||
{
|
||||
// https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_output-event-name
|
||||
// The doc says that "do not assume that the name is a reflection of an underlying DRM connector, X11 connection, etc."
|
||||
// However I can't find a better method to get the edid data
|
||||
const char* drmDirPath = "/sys/class/drm/";
|
||||
|
||||
DIR* dirp = opendir(drmDirPath);
|
||||
if(dirp == NULL)
|
||||
return false;
|
||||
|
||||
struct dirent* entry;
|
||||
while((entry = readdir(dirp)) != NULL)
|
||||
{
|
||||
const char* plainName = entry->d_name;
|
||||
if (ffStrStartsWith(plainName, "card"))
|
||||
{
|
||||
const char* tmp = strchr(plainName + strlen("card"), '-');
|
||||
if (tmp) plainName = tmp + 1;
|
||||
}
|
||||
if (ffStrEquals(plainName, wlName))
|
||||
{
|
||||
ffStrbufAppendF(edidName, "%s%s/edid", drmDirPath, entry->d_name);
|
||||
|
||||
uint8_t edidData[128];
|
||||
if(ffReadFileData(edidName->chars, sizeof(edidData), edidData) == sizeof(edidData))
|
||||
{
|
||||
ffStrbufClear(edidName);
|
||||
ffEdidGetName(edidData, edidName);
|
||||
closedir(dirp);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
ffStrbufClear(edidName);
|
||||
closedir(dirp);
|
||||
return false;
|
||||
}
|
||||
|
||||
static void waylandOutputNameListener(void *data, FF_MAYBE_UNUSED struct wl_output *output, const char *name)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
if(ffStrStartsWith(name, "eDP-"))
|
||||
display->type = FF_DISPLAY_TYPE_BUILTIN;
|
||||
else if(ffStrStartsWith(name, "HDMI-"))
|
||||
display->type = FF_DISPLAY_TYPE_EXTERNAL;
|
||||
matchDrmConnector(name, &display->edidName);
|
||||
ffStrbufAppendS(&display->name, name);
|
||||
}
|
||||
|
||||
static void waylandOutputDescriptionListener(void* data, FF_MAYBE_UNUSED struct wl_output* wl_output, const char* description)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
while (*description == ' ') ++description;
|
||||
if (!ffStrEquals(description, "Unknown Display"))
|
||||
ffStrbufAppendS(&display->description, description);
|
||||
}
|
||||
|
||||
static void waylandOutputHandler(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
|
||||
{
|
||||
struct wl_proxy* output = wldata->ffwl_proxy_marshal_constructor_versioned((struct wl_proxy*) registry, WL_REGISTRY_BIND, wldata->ffwl_output_interface, version, name, wldata->ffwl_output_interface->name, version, NULL);
|
||||
if(output == NULL)
|
||||
return;
|
||||
|
||||
WaylandDisplay display = {
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.refreshRate = 0,
|
||||
.scale = 1,
|
||||
.transform = WL_OUTPUT_TRANSFORM_NORMAL,
|
||||
.type = FF_DISPLAY_TYPE_UNKNOWN,
|
||||
};
|
||||
ffStrbufInit(&display.name);
|
||||
ffStrbufInit(&display.description);
|
||||
ffStrbufInit(&display.vendorAndModelId);
|
||||
ffStrbufInit(&display.edidName);
|
||||
|
||||
// Dirty hack for #477
|
||||
// The order of these callbacks MUST follow `struct wl_output_listener`
|
||||
void* outputListener[] = {
|
||||
waylandOutputGeometryListener, // geometry
|
||||
waylandOutputModeListener, // mode
|
||||
stubListener, // done
|
||||
waylandOutputScaleListener, // scale
|
||||
waylandOutputNameListener, // name
|
||||
waylandOutputDescriptionListener, // description
|
||||
};
|
||||
static_assert(
|
||||
sizeof(outputListener) >= sizeof(struct wl_output_listener),
|
||||
"sizeof(outputListener) is too small. Please report it to fastfetch github issue"
|
||||
);
|
||||
|
||||
wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &outputListener, &display);
|
||||
wldata->ffwl_display_roundtrip(wldata->display);
|
||||
wldata->ffwl_proxy_destroy(output);
|
||||
|
||||
if(display.width <= 0 || display.height <= 0)
|
||||
return;
|
||||
|
||||
switch(display.transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270: {
|
||||
int32_t temp = display.width;
|
||||
display.width = display.height;
|
||||
display.height = temp;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t rotation;
|
||||
switch(display.transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
rotation = 90;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
rotation = 270;
|
||||
break;
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
ffdsAppendDisplay(wldata->result,
|
||||
(uint32_t) display.width,
|
||||
(uint32_t) display.height,
|
||||
display.refreshRate / 1000.0,
|
||||
(uint32_t) (display.width / display.scale),
|
||||
(uint32_t) (display.height / display.scale),
|
||||
rotation,
|
||||
display.edidName.length
|
||||
? &display.edidName
|
||||
: display.description.length
|
||||
? &display.description
|
||||
: display.vendorAndModelId.length
|
||||
? &display.vendorAndModelId : &display.name,
|
||||
display.type,
|
||||
false,
|
||||
0
|
||||
);
|
||||
|
||||
ffStrbufDestroy(&display.description);
|
||||
ffStrbufDestroy(&display.vendorAndModelId);
|
||||
ffStrbufDestroy(&display.name);
|
||||
ffStrbufDestroy(&display.edidName);
|
||||
}
|
||||
|
||||
static void waylandGlobalAddListener(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
|
||||
{
|
||||
WaylandData* wldata = data;
|
||||
|
||||
if(ffStrEquals(interface, wldata->ffwl_output_interface->name))
|
||||
waylandOutputHandler(wldata, registry, name, version);
|
||||
}
|
||||
|
||||
bool detectWayland(FFDisplayServerResult* result)
|
||||
{
|
||||
FF_LIBRARY_LOAD(wayland, &instance.config.library.libWayland, false, "libwayland-client" FF_LIBRARY_EXTENSION, 1)
|
||||
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_display_connect, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_display_get_fd, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_display_dispatch, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_proxy_marshal_constructor, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_display_disconnect, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_registry_interface, false)
|
||||
|
||||
WaylandData data;
|
||||
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_proxy_marshal_constructor_versioned, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_proxy_add_listener, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_proxy_destroy, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_display_roundtrip, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_output_interface, false)
|
||||
|
||||
data.display = ffwl_display_connect(NULL);
|
||||
if(data.display == NULL)
|
||||
return false;
|
||||
|
||||
waylandDetectWM(ffwl_display_get_fd(data.display), result);
|
||||
|
||||
struct wl_proxy* registry = ffwl_proxy_marshal_constructor((struct wl_proxy*) data.display, WL_DISPLAY_GET_REGISTRY, ffwl_registry_interface, NULL);
|
||||
if(registry == NULL)
|
||||
{
|
||||
ffwl_display_disconnect(data.display);
|
||||
return false;
|
||||
}
|
||||
|
||||
data.result = result;
|
||||
|
||||
struct wl_registry_listener registry_listener = {
|
||||
.global = waylandGlobalAddListener,
|
||||
.global_remove = (void*) stubListener
|
||||
};
|
||||
|
||||
data.ffwl_proxy_add_listener(registry, (void(**)(void)) ®istry_listener, &data);
|
||||
ffwl_display_dispatch(data.display);
|
||||
data.ffwl_display_roundtrip(data.display);
|
||||
|
||||
data.ffwl_proxy_destroy(registry);
|
||||
ffwl_display_disconnect(data.display);
|
||||
|
||||
//We successfully connected to wayland and detected the display.
|
||||
//So we can set set the session type to wayland.
|
||||
//This is used as an indicator that we are running wayland by the x11 backends.
|
||||
ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ffdsConnectWayland(FFDisplayServerResult* result)
|
||||
{
|
||||
//Wayland requires this to be set
|
||||
if(getenv("XDG_RUNTIME_DIR") == NULL)
|
||||
return;
|
||||
|
||||
#ifdef FF_HAVE_WAYLAND
|
||||
if(detectWayland(result))
|
||||
return;
|
||||
#endif
|
||||
|
||||
const char* xdgSessionType = getenv("XDG_SESSION_TYPE");
|
||||
|
||||
//If XDG_SESSION_TYPE is set, and doesn't contain "wayland", we are probably not running in a wayland session.
|
||||
if(xdgSessionType != NULL && strcasecmp(xdgSessionType, "wayland") != 0)
|
||||
return;
|
||||
|
||||
//If XDG_SESSION_TYPE is not set, check if WAYLAND_DISPLAY or WAYLAND_SOCKET is set.
|
||||
//If not, there is no indicator for a wayland session
|
||||
if(xdgSessionType == NULL && getenv("WAYLAND_DISPLAY") == NULL && getenv("WAYLAND_SOCKET") == NULL)
|
||||
return;
|
||||
|
||||
//We are probably running a wayland compositor at this point,
|
||||
//but fastfetch was compiled without the required library, or loading the library failed.
|
||||
ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND);
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
#ifdef FF_HAVE_WAYLAND
|
||||
|
||||
#include "wayland.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
static void waylandOutputModeListener(void* data, FF_MAYBE_UNUSED struct wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refreshRate)
|
||||
{
|
||||
if(!(flags & WL_OUTPUT_MODE_CURRENT))
|
||||
return;
|
||||
|
||||
WaylandDisplay* display = data;
|
||||
display->width = width;
|
||||
display->height = height;
|
||||
display->refreshRate = refreshRate;
|
||||
}
|
||||
|
||||
static void waylandOutputScaleListener(void* data, FF_MAYBE_UNUSED struct wl_output* output, int32_t scale)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
display->scale = scale;
|
||||
}
|
||||
|
||||
static void waylandOutputGeometryListener(void *data,
|
||||
FF_MAYBE_UNUSED struct wl_output *output,
|
||||
FF_MAYBE_UNUSED int32_t x,
|
||||
FF_MAYBE_UNUSED int32_t y,
|
||||
FF_MAYBE_UNUSED int32_t physical_width,
|
||||
FF_MAYBE_UNUSED int32_t physical_height,
|
||||
FF_MAYBE_UNUSED int32_t subpixel,
|
||||
FF_MAYBE_UNUSED const char *make,
|
||||
FF_MAYBE_UNUSED const char *model,
|
||||
int32_t transform)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
display->transform = (enum wl_output_transform) transform;
|
||||
}
|
||||
|
||||
void ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
|
||||
{
|
||||
struct wl_proxy* output = wldata->ffwl_proxy_marshal_constructor_versioned((struct wl_proxy*) registry, WL_REGISTRY_BIND, wldata->ffwl_output_interface, version, name, wldata->ffwl_output_interface->name, version, NULL);
|
||||
if(output == NULL)
|
||||
return;
|
||||
|
||||
WaylandDisplay display = {
|
||||
.parent = wldata,
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.refreshRate = 0,
|
||||
.scale = 1,
|
||||
.transform = WL_OUTPUT_TRANSFORM_NORMAL,
|
||||
.type = FF_DISPLAY_TYPE_UNKNOWN,
|
||||
.name = ffStrbufCreate(),
|
||||
.description = ffStrbufCreate(),
|
||||
.edidName = ffStrbufCreate(),
|
||||
};
|
||||
|
||||
// Dirty hack for #477
|
||||
// The order of these callbacks MUST follow `struct wl_output_listener`
|
||||
void* outputListener[] = {
|
||||
waylandOutputGeometryListener, // geometry
|
||||
waylandOutputModeListener, // mode
|
||||
stubListener, // done
|
||||
waylandOutputScaleListener, // scale
|
||||
ffWaylandOutputNameListener, // name
|
||||
ffWaylandOutputDescriptionListener, // description
|
||||
};
|
||||
static_assert(
|
||||
sizeof(outputListener) >= sizeof(struct wl_output_listener),
|
||||
"sizeof(outputListener) is too small. Please report it to fastfetch github issue"
|
||||
);
|
||||
|
||||
wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &outputListener, &display);
|
||||
wldata->ffwl_display_roundtrip(wldata->display);
|
||||
wldata->ffwl_proxy_destroy(output);
|
||||
|
||||
if(display.width <= 0 || display.height <= 0)
|
||||
return;
|
||||
|
||||
uint32_t rotation;
|
||||
switch(display.transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
rotation = 90;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
rotation = 270;
|
||||
break;
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rotation)
|
||||
{
|
||||
case 90:
|
||||
case 270: {
|
||||
int32_t temp = display.width;
|
||||
display.width = display.height;
|
||||
display.height = temp;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ffdsAppendDisplay(wldata->result,
|
||||
(uint32_t) display.width,
|
||||
(uint32_t) display.height,
|
||||
display.refreshRate / 1000.0,
|
||||
(uint32_t) (display.width / display.scale),
|
||||
(uint32_t) (display.height / display.scale),
|
||||
rotation,
|
||||
display.edidName.length
|
||||
? &display.edidName
|
||||
: display.description.length
|
||||
? &display.description
|
||||
: &display.name,
|
||||
display.type,
|
||||
false,
|
||||
0
|
||||
);
|
||||
|
||||
ffStrbufDestroy(&display.description);
|
||||
ffStrbufDestroy(&display.name);
|
||||
ffStrbufDestroy(&display.edidName);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,149 @@
|
||||
#include "../displayserver_linux.h"
|
||||
#include "common/io/io.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef FF_HAVE_WAYLAND
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "wayland.h"
|
||||
#include "wlr-output-management-unstable-v1-client-protocol.h"
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
static void waylandDetectWM(int fd, FFDisplayServerResult* result)
|
||||
{
|
||||
struct ucred ucred;
|
||||
socklen_t len = sizeof(struct ucred);
|
||||
if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1)
|
||||
return;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY procPath = ffStrbufCreate();
|
||||
ffStrbufAppendF(&procPath, "/proc/%d/cmdline", ucred.pid); //We check the cmdline for the process name, because it is not trimmed.
|
||||
ffReadFileBuffer(procPath.chars, &result->wmProcessName);
|
||||
ffStrbufTrimRightSpace(&result->wmProcessName);
|
||||
ffStrbufSubstrBeforeFirstC(&result->wmProcessName, '\0'); //Trim the arguments
|
||||
ffStrbufSubstrAfterLastC(&result->wmProcessName, '/'); //Trim the path
|
||||
}
|
||||
#else
|
||||
static void waylandDetectWM(int fd, FFDisplayServerResult* result)
|
||||
{
|
||||
FF_UNUSED(fd, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void waylandGlobalAddListener(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
|
||||
{
|
||||
WaylandData* wldata = data;
|
||||
|
||||
if((wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_NONE || wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_GLOBAL) && ffStrEquals(interface, wldata->ffwl_output_interface->name))
|
||||
{
|
||||
wldata->protocolType = FF_WAYLAND_PROTOCOL_TYPE_GLOBAL;
|
||||
ffWaylandHandleGlobalOutput(wldata, registry, name, version);
|
||||
}
|
||||
else if((wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_NONE || wldata->protocolType == FF_WAYLAND_PROTOCOL_TYPE_ZWLR) && ffStrEquals(interface, zwlr_output_manager_v1_interface.name))
|
||||
{
|
||||
wldata->protocolType = FF_WAYLAND_PROTOCOL_TYPE_ZWLR;
|
||||
ffWaylandHandleZwlrOutput(wldata, registry, name, version);
|
||||
}
|
||||
}
|
||||
|
||||
bool detectWayland(FFDisplayServerResult* result)
|
||||
{
|
||||
FF_LIBRARY_LOAD(wayland, &instance.config.library.libWayland, false, "libwayland-client" FF_LIBRARY_EXTENSION, 1)
|
||||
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_display_connect, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_display_get_fd, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_proxy_marshal_constructor, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_display_disconnect, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(wayland, wl_registry_interface, false)
|
||||
|
||||
WaylandData data = {};
|
||||
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_proxy_marshal_constructor_versioned, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_proxy_add_listener, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_proxy_destroy, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_display_roundtrip, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR(wayland, data, wl_output_interface, false)
|
||||
|
||||
data.display = ffwl_display_connect(NULL);
|
||||
if(data.display == NULL)
|
||||
return false;
|
||||
|
||||
waylandDetectWM(ffwl_display_get_fd(data.display), result);
|
||||
|
||||
struct wl_proxy* registry = ffwl_proxy_marshal_constructor((struct wl_proxy*) data.display, WL_DISPLAY_GET_REGISTRY, ffwl_registry_interface, NULL);
|
||||
if(registry == NULL)
|
||||
{
|
||||
ffwl_display_disconnect(data.display);
|
||||
return false;
|
||||
}
|
||||
|
||||
data.result = result;
|
||||
|
||||
struct wl_registry_listener registry_listener = {
|
||||
.global = waylandGlobalAddListener,
|
||||
.global_remove = (void*) stubListener
|
||||
};
|
||||
|
||||
data.ffwl_proxy_add_listener(registry, (void(**)(void)) ®istry_listener, &data);
|
||||
data.ffwl_display_roundtrip(data.display);
|
||||
|
||||
data.ffwl_proxy_destroy(registry);
|
||||
ffwl_display_disconnect(data.display);
|
||||
|
||||
//We successfully connected to wayland and detected the display.
|
||||
//So we can set set the session type to wayland.
|
||||
//This is used as an indicator that we are running wayland by the x11 backends.
|
||||
ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND);
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffWaylandOutputNameListener(void* data, FF_MAYBE_UNUSED void* output, const char *name)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
if(ffStrStartsWith(name, "eDP-"))
|
||||
display->type = FF_DISPLAY_TYPE_BUILTIN;
|
||||
else if(ffStrStartsWith(name, "HDMI-"))
|
||||
display->type = FF_DISPLAY_TYPE_EXTERNAL;
|
||||
ffdsMatchDrmConnector(name, &display->edidName);
|
||||
ffStrbufAppendS(&display->name, name);
|
||||
}
|
||||
|
||||
void ffWaylandOutputDescriptionListener(void* data, FF_MAYBE_UNUSED void* output, const char* description)
|
||||
{
|
||||
WaylandDisplay* display = data;
|
||||
while (*description == ' ') ++description;
|
||||
if (!ffStrEquals(description, "Unknown Display") && !ffStrContains(description, "(null)"))
|
||||
ffStrbufAppendS(&display->description, description);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ffdsConnectWayland(FFDisplayServerResult* result)
|
||||
{
|
||||
//Wayland requires this to be set
|
||||
if(getenv("XDG_RUNTIME_DIR") == NULL)
|
||||
return;
|
||||
|
||||
#ifdef FF_HAVE_WAYLAND
|
||||
if(detectWayland(result))
|
||||
return;
|
||||
#endif
|
||||
|
||||
const char* xdgSessionType = getenv("XDG_SESSION_TYPE");
|
||||
|
||||
//If XDG_SESSION_TYPE is set, and doesn't contain "wayland", we are probably not running in a wayland session.
|
||||
if(xdgSessionType != NULL && !ffStrEqualsIgnCase(xdgSessionType, "wayland"))
|
||||
return;
|
||||
|
||||
//If XDG_SESSION_TYPE is not set, check if WAYLAND_DISPLAY or WAYLAND_SOCKET is set.
|
||||
//If not, there is no indicator for a wayland session
|
||||
if(xdgSessionType == NULL && getenv("WAYLAND_DISPLAY") == NULL && getenv("WAYLAND_SOCKET") == NULL)
|
||||
return;
|
||||
|
||||
//We are probably running a wayland compositor at this point,
|
||||
//but fastfetch was compiled without the required library, or loading the library failed.
|
||||
ffStrbufSetS(&result->wmProtocolName, FF_WM_PROTOCOL_WAYLAND);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef FF_HAVE_WAYLAND
|
||||
|
||||
#include "common/library.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <wayland-client.h>
|
||||
|
||||
#include "../displayserver_linux.h"
|
||||
|
||||
typedef enum WaylandProtocolType
|
||||
{
|
||||
FF_WAYLAND_PROTOCOL_TYPE_NONE,
|
||||
FF_WAYLAND_PROTOCOL_TYPE_GLOBAL,
|
||||
FF_WAYLAND_PROTOCOL_TYPE_ZWLR,
|
||||
} WaylandProtocolType;
|
||||
|
||||
typedef struct WaylandData
|
||||
{
|
||||
FFDisplayServerResult* result;
|
||||
FF_LIBRARY_SYMBOL(wl_proxy_marshal_constructor_versioned)
|
||||
FF_LIBRARY_SYMBOL(wl_proxy_add_listener)
|
||||
FF_LIBRARY_SYMBOL(wl_proxy_destroy)
|
||||
FF_LIBRARY_SYMBOL(wl_display_roundtrip)
|
||||
struct wl_display* display;
|
||||
const struct wl_interface* ffwl_output_interface;
|
||||
WaylandProtocolType protocolType;
|
||||
} WaylandData;
|
||||
|
||||
typedef struct WaylandDisplay
|
||||
{
|
||||
WaylandData* parent;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t refreshRate;
|
||||
double scale;
|
||||
enum wl_output_transform transform;
|
||||
FFDisplayType type;
|
||||
FFstrbuf name;
|
||||
FFstrbuf description;
|
||||
FFstrbuf edidName;
|
||||
void* internal;
|
||||
} WaylandDisplay;
|
||||
|
||||
inline static void stubListener(void* data, ...)
|
||||
{
|
||||
(void) data;
|
||||
}
|
||||
|
||||
void ffWaylandOutputNameListener(void* data, FF_MAYBE_UNUSED void* output, const char *name);
|
||||
void ffWaylandOutputDescriptionListener(void* data, FF_MAYBE_UNUSED void* output, const char* description);
|
||||
|
||||
void ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version);
|
||||
void ffWaylandHandleZwlrOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version);
|
||||
|
||||
#endif
|
||||
+1298
File diff suppressed because it is too large
Load Diff
+160
@@ -0,0 +1,160 @@
|
||||
#ifdef FF_HAVE_WAYLAND
|
||||
|
||||
/* Generated by wayland-scanner 1.22.0 */
|
||||
|
||||
/*
|
||||
* Copyright © 2019 Purism SPC
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this
|
||||
* software and its documentation for any purpose is hereby granted
|
||||
* without fee, provided that the above copyright notice appear in
|
||||
* all copies and that both that copyright notice and this permission
|
||||
* notice appear in supporting documentation, and that the name of
|
||||
* the copyright holders not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
* THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <wayland-util.h>
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
|
||||
#endif
|
||||
|
||||
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
|
||||
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define WL_PRIVATE
|
||||
#endif
|
||||
|
||||
extern const struct wl_interface zwlr_output_configuration_head_v1_interface;
|
||||
extern const struct wl_interface zwlr_output_configuration_v1_interface;
|
||||
extern const struct wl_interface zwlr_output_head_v1_interface;
|
||||
extern const struct wl_interface zwlr_output_mode_v1_interface;
|
||||
|
||||
static const struct wl_interface *wlr_output_management_unstable_v1_types[] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&zwlr_output_configuration_v1_interface,
|
||||
NULL,
|
||||
&zwlr_output_head_v1_interface,
|
||||
&zwlr_output_mode_v1_interface,
|
||||
&zwlr_output_mode_v1_interface,
|
||||
&zwlr_output_configuration_head_v1_interface,
|
||||
&zwlr_output_head_v1_interface,
|
||||
&zwlr_output_head_v1_interface,
|
||||
&zwlr_output_mode_v1_interface,
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_manager_v1_requests[] = {
|
||||
{ "create_configuration", "nu", wlr_output_management_unstable_v1_types + 3 },
|
||||
{ "stop", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_manager_v1_events[] = {
|
||||
{ "head", "n", wlr_output_management_unstable_v1_types + 5 },
|
||||
{ "done", "u", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "finished", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwlr_output_manager_v1_interface = {
|
||||
"zwlr_output_manager_v1", 4,
|
||||
2, zwlr_output_manager_v1_requests,
|
||||
3, zwlr_output_manager_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_head_v1_requests[] = {
|
||||
{ "release", "3", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_head_v1_events[] = {
|
||||
{ "name", "s", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "description", "s", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "physical_size", "ii", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "mode", "n", wlr_output_management_unstable_v1_types + 6 },
|
||||
{ "enabled", "i", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "current_mode", "o", wlr_output_management_unstable_v1_types + 7 },
|
||||
{ "position", "ii", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "transform", "i", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "scale", "f", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "finished", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "make", "2s", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "model", "2s", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "serial_number", "2s", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "adaptive_sync", "4u", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwlr_output_head_v1_interface = {
|
||||
"zwlr_output_head_v1", 4,
|
||||
1, zwlr_output_head_v1_requests,
|
||||
14, zwlr_output_head_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_mode_v1_requests[] = {
|
||||
{ "release", "3", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_mode_v1_events[] = {
|
||||
{ "size", "ii", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "refresh", "i", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "preferred", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "finished", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwlr_output_mode_v1_interface = {
|
||||
"zwlr_output_mode_v1", 3,
|
||||
1, zwlr_output_mode_v1_requests,
|
||||
4, zwlr_output_mode_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_configuration_v1_requests[] = {
|
||||
{ "enable_head", "no", wlr_output_management_unstable_v1_types + 8 },
|
||||
{ "disable_head", "o", wlr_output_management_unstable_v1_types + 10 },
|
||||
{ "apply", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "test", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "destroy", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_configuration_v1_events[] = {
|
||||
{ "succeeded", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "failed", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "cancelled", "", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwlr_output_configuration_v1_interface = {
|
||||
"zwlr_output_configuration_v1", 4,
|
||||
5, zwlr_output_configuration_v1_requests,
|
||||
3, zwlr_output_configuration_v1_events,
|
||||
};
|
||||
|
||||
static const struct wl_message zwlr_output_configuration_head_v1_requests[] = {
|
||||
{ "set_mode", "o", wlr_output_management_unstable_v1_types + 11 },
|
||||
{ "set_custom_mode", "iii", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "set_position", "ii", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "set_transform", "i", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "set_scale", "f", wlr_output_management_unstable_v1_types + 0 },
|
||||
{ "set_adaptive_sync", "4u", wlr_output_management_unstable_v1_types + 0 },
|
||||
};
|
||||
|
||||
WL_PRIVATE const struct wl_interface zwlr_output_configuration_head_v1_interface = {
|
||||
"zwlr_output_configuration_head_v1", 4,
|
||||
6, zwlr_output_configuration_head_v1_requests,
|
||||
0, NULL,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,193 @@
|
||||
#ifdef FF_HAVE_WAYLAND
|
||||
|
||||
#include "wayland.h"
|
||||
#include "wlr-output-management-unstable-v1-client-protocol.h"
|
||||
|
||||
static void waylandZwlrTransformListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_head_v1 *zwlr_output_head_v1, int32_t transform)
|
||||
{
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
wldata->transform = transform;
|
||||
}
|
||||
|
||||
static void waylandZwlrScaleListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_head_v1 *zwlr_output_head_v1, wl_fixed_t scale)
|
||||
{
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
wldata->scale = wl_fixed_to_double(scale);
|
||||
}
|
||||
|
||||
typedef struct WaylandZwlrMode
|
||||
{
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t refreshRate;
|
||||
struct zwlr_output_mode_v1* pMode;
|
||||
} WaylandZwlrMode;
|
||||
|
||||
static void waylandZwlrSizeListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_mode_v1 *zwlr_output_mode_v1, int32_t width, int32_t height)
|
||||
{
|
||||
WaylandZwlrMode* mode = (WaylandZwlrMode*) data;
|
||||
mode->width = width;
|
||||
mode->height = height;
|
||||
}
|
||||
|
||||
static void waylandZwlrRefreshListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_mode_v1 *zwlr_output_mode_v1, int32_t rate)
|
||||
{
|
||||
WaylandZwlrMode* mode = (WaylandZwlrMode*) data;
|
||||
mode->refreshRate = rate;
|
||||
}
|
||||
|
||||
static const struct zwlr_output_mode_v1_listener modeListener = {
|
||||
.size = waylandZwlrSizeListener,
|
||||
.refresh = waylandZwlrRefreshListener,
|
||||
.preferred = (void*) stubListener,
|
||||
.finished = (void*) stubListener,
|
||||
};
|
||||
|
||||
static void waylandZwlrModeListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_head_v1 *zwlr_output_head_v1, struct zwlr_output_mode_v1 *mode)
|
||||
{
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
WaylandZwlrMode* newMode = ffListAdd((FFlist*) wldata->internal);
|
||||
newMode->pMode = mode;
|
||||
|
||||
// Strangely, the listener is called only in this function, but not in `waylandZwlrCurrentModeListener`
|
||||
wldata->parent->ffwl_proxy_add_listener((struct wl_proxy *) mode, (void (**)(void)) &modeListener, newMode);
|
||||
}
|
||||
|
||||
static void waylandZwlrCurrentModeListener(void* data, FF_MAYBE_UNUSED struct zwlr_output_head_v1 *zwlr_output_head_v1, struct zwlr_output_mode_v1 *mode)
|
||||
{
|
||||
// waylandZwlrModeListener is always run before this
|
||||
WaylandDisplay* wldata = (WaylandDisplay*) data;
|
||||
WaylandZwlrMode* current = NULL;
|
||||
FF_LIST_FOR_EACH(WaylandZwlrMode, m, *(FFlist*) wldata->internal)
|
||||
{
|
||||
if (m->pMode == mode)
|
||||
{
|
||||
current = m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
wldata->width = current->width;
|
||||
wldata->height = current->height;
|
||||
wldata->refreshRate = current->refreshRate;
|
||||
}
|
||||
|
||||
static void waylandHandleZwlrHead(void *data, FF_MAYBE_UNUSED struct zwlr_output_manager_v1 *zwlr_output_manager_v1, struct zwlr_output_head_v1 *head)
|
||||
{
|
||||
WaylandData* wldata = data;
|
||||
|
||||
const struct zwlr_output_head_v1_listener headListener = {
|
||||
.name = (void*) ffWaylandOutputNameListener,
|
||||
.description = (void*) ffWaylandOutputDescriptionListener,
|
||||
.physical_size = (void*) stubListener,
|
||||
.mode = waylandZwlrModeListener,
|
||||
.enabled = (void*) stubListener,
|
||||
.current_mode = waylandZwlrCurrentModeListener,
|
||||
.position = (void*) stubListener,
|
||||
.transform = waylandZwlrTransformListener,
|
||||
.scale = waylandZwlrScaleListener,
|
||||
.finished = (void*) stubListener,
|
||||
.make = (void*) stubListener,
|
||||
.model = (void*) stubListener,
|
||||
.serial_number = (void*) stubListener,
|
||||
.adaptive_sync = (void*) stubListener,
|
||||
};
|
||||
|
||||
FF_LIST_AUTO_DESTROY modes = ffListCreate(sizeof(WaylandZwlrMode));
|
||||
WaylandDisplay display = {
|
||||
.parent = wldata,
|
||||
.width = 0,
|
||||
.height = 0,
|
||||
.refreshRate = 0,
|
||||
.scale = 1,
|
||||
.transform = WL_OUTPUT_TRANSFORM_NORMAL,
|
||||
.type = FF_DISPLAY_TYPE_UNKNOWN,
|
||||
.name = ffStrbufCreate(),
|
||||
.description = ffStrbufCreate(),
|
||||
.edidName = ffStrbufCreate(),
|
||||
.internal = &modes,
|
||||
};
|
||||
|
||||
wldata->ffwl_proxy_add_listener((struct wl_proxy*) head, (void(**)(void)) &headListener, &display);
|
||||
wldata->ffwl_display_roundtrip(wldata->display);
|
||||
|
||||
if(display.width <= 0 || display.height <= 0)
|
||||
return;
|
||||
|
||||
uint32_t rotation;
|
||||
switch(display.transform)
|
||||
{
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
|
||||
case WL_OUTPUT_TRANSFORM_90:
|
||||
rotation = 90;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_180:
|
||||
case WL_OUTPUT_TRANSFORM_180:
|
||||
rotation = 180;
|
||||
break;
|
||||
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
|
||||
case WL_OUTPUT_TRANSFORM_270:
|
||||
rotation = 270;
|
||||
break;
|
||||
default:
|
||||
rotation = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rotation)
|
||||
{
|
||||
case 90:
|
||||
case 270: {
|
||||
int32_t temp = display.width;
|
||||
display.width = display.height;
|
||||
display.height = temp;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ffdsAppendDisplay(wldata->result,
|
||||
(uint32_t) display.width,
|
||||
(uint32_t) display.height,
|
||||
display.refreshRate / 1000.0,
|
||||
(uint32_t) (display.width / display.scale + 0.5),
|
||||
(uint32_t) (display.height / display.scale + 0.5),
|
||||
rotation,
|
||||
display.edidName.length
|
||||
? &display.edidName
|
||||
: display.description.length
|
||||
? &display.description
|
||||
: &display.name,
|
||||
display.type,
|
||||
false,
|
||||
0
|
||||
);
|
||||
|
||||
ffStrbufDestroy(&display.description);
|
||||
ffStrbufDestroy(&display.name);
|
||||
ffStrbufDestroy(&display.edidName);
|
||||
|
||||
// These must be released manually
|
||||
FF_LIST_FOR_EACH(WaylandZwlrMode, m, modes)
|
||||
wldata->ffwl_proxy_destroy((void*) m->pMode);
|
||||
wldata->ffwl_proxy_destroy((void*) head);
|
||||
}
|
||||
|
||||
void ffWaylandHandleZwlrOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
|
||||
{
|
||||
struct wl_proxy* output = wldata->ffwl_proxy_marshal_constructor_versioned((struct wl_proxy*) registry, WL_REGISTRY_BIND, &zwlr_output_manager_v1_interface, version, name, zwlr_output_manager_v1_interface.name, version, NULL);
|
||||
if(output == NULL)
|
||||
return;
|
||||
|
||||
const struct zwlr_output_manager_v1_listener outputListener = {
|
||||
.head = waylandHandleZwlrHead,
|
||||
.done = (void*) stubListener,
|
||||
.finished = (void*) stubListener,
|
||||
};
|
||||
|
||||
wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &outputListener, wldata);
|
||||
wldata->ffwl_display_roundtrip(wldata->display);
|
||||
wldata->ffwl_proxy_destroy(output);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -52,6 +52,9 @@ static const char* parseEnv(void)
|
||||
if(getenv("TDE_FULL_SESSION") != NULL)
|
||||
return "Trinity";
|
||||
|
||||
if(getenv("HYPRLAND_CMD") != NULL)
|
||||
return "Hyprland";
|
||||
|
||||
#ifdef __linux__
|
||||
if(
|
||||
getenv("WAYLAND_DISPLAY") != NULL &&
|
||||
@@ -116,6 +119,8 @@ static void applyPrettyNameIfWM(FFDisplayServerResult* result, const char* name)
|
||||
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_ICEWM);
|
||||
else if(ffStrEqualsIgnCase(name, "dtwm"))
|
||||
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_DTWM);
|
||||
else if(ffStrEqualsIgnCase(name, "hyprland"))
|
||||
ffStrbufSetS(&result->wmPrettyName, FF_WM_PRETTY_HYPRLAND);
|
||||
}
|
||||
|
||||
static void applyNameIfWM(FFDisplayServerResult* result, const char* processName)
|
||||
|
||||
@@ -44,5 +44,5 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus);
|
||||
const char* ffGetGPUVendorString(unsigned vendorId);
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu);
|
||||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu);
|
||||
#endif
|
||||
|
||||
@@ -63,10 +63,6 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
ffStrbufInit(&gpu->driver); // Ok for both Apple and Intel
|
||||
ffCfDictGetString(properties, CFSTR("CFBundleIdentifier"), &gpu->driver);
|
||||
|
||||
int vram; // Supported on Intel
|
||||
if(!ffCfDictGetInt(properties, CFSTR("VRAM,totalMB"), &vram))
|
||||
gpu->dedicated.total = (uint64_t) vram * 1024 * 1024;
|
||||
|
||||
if(ffCfDictGetInt(properties, CFSTR("gpu-core-count"), &gpu->coreCount)) // For Apple
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ static bool loadPciIds(FFstrbuf* pciids)
|
||||
ffReadFileBuffer(_PATH_LOCALBASE "/share/pciids/pci.ids", pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
ffReadFileBuffer("/usr/share/pciids/pci.ids", pciids);
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/share/pciids/pci.ids", pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
return false;
|
||||
@@ -74,7 +74,7 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
if (pciids.length == 0)
|
||||
loadPciIds(&pciids);
|
||||
ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, pc->pc_subvendor, pc->pc_subdevice, gpu);
|
||||
ffGPUParsePciIds(&pciids, pc->pc_subclass, pc->pc_vendor, pc->pc_device, gpu);
|
||||
}
|
||||
|
||||
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
|
||||
|
||||
@@ -14,7 +14,7 @@ struct FFIgclData {
|
||||
FF_LIBRARY_SYMBOL(ctlEnumMemoryModules)
|
||||
FF_LIBRARY_SYMBOL(ctlMemoryGetState)
|
||||
FF_LIBRARY_SYMBOL(ctlEnumFrequencyDomains)
|
||||
FF_LIBRARY_SYMBOL(ctlFrequencyGetState)
|
||||
FF_LIBRARY_SYMBOL(ctlFrequencyGetProperties)
|
||||
|
||||
bool inited;
|
||||
ctl_api_handle_t apiHandle;
|
||||
@@ -44,7 +44,7 @@ const char* ffDetectIntelGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverRe
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlEnumMemoryModules)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlMemoryGetState)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlEnumFrequencyDomains)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlFrequencyGetState)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libigcl, igclData, ctlFrequencyGetProperties)
|
||||
|
||||
if (ffctlInit(&(ctl_init_args_t) {
|
||||
.AppVersion = CTL_MAKE_VERSION(CTL_IMPL_MAJOR_VERSION, CTL_IMPL_MINOR_VERSION),
|
||||
@@ -177,22 +177,21 @@ const char* ffDetectIntelGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverRe
|
||||
|
||||
if (result.frequency)
|
||||
{
|
||||
ctl_freq_handle_t freqs[16];
|
||||
uint32_t freqCount = sizeof(freqs) / sizeof(freqs[0]);
|
||||
if (igclData.ffctlEnumFrequencyDomains(device, &freqCount, freqs) == CTL_RESULT_SUCCESS && freqCount > 0)
|
||||
ctl_freq_handle_t domains[16];
|
||||
uint32_t domainCount = sizeof(domains) / sizeof(domains[0]);
|
||||
if (igclData.ffctlEnumFrequencyDomains(device, &domainCount, domains) == CTL_RESULT_SUCCESS && domainCount > 0)
|
||||
{
|
||||
double sumValue = 0;
|
||||
uint32_t availableCount = 0;
|
||||
for (uint32_t iFreq = 0; iFreq < freqCount; iFreq++)
|
||||
double maxValue = 0;
|
||||
ctl_freq_properties_t props = { .Size = sizeof(props), .Version = 0 };
|
||||
for (uint32_t iDomain = 0; iDomain < domainCount; iDomain++)
|
||||
{
|
||||
ctl_freq_state_t state = { .Size = sizeof(state), .Version = 0 };
|
||||
if (igclData.ffctlFrequencyGetState(freqs[iFreq], &state) == CTL_RESULT_SUCCESS)
|
||||
if (igclData.ffctlFrequencyGetProperties(domains[iDomain], &props) == CTL_RESULT_SUCCESS)
|
||||
{
|
||||
sumValue += state.actual;
|
||||
availableCount++;
|
||||
if (props.type == CTL_FREQ_DOMAIN_GPU && props.max > maxValue)
|
||||
maxValue = props.max;
|
||||
}
|
||||
}
|
||||
*result.frequency = (sumValue / availableCount) / 1000.;
|
||||
*result.frequency = maxValue / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+237
-87
@@ -1,6 +1,7 @@
|
||||
#include "detection/gpu/gpu.h"
|
||||
#include "detection/vulkan/vulkan.h"
|
||||
#include "detection/temps/temps_linux.h"
|
||||
#include "detection/cpu/cpu.h"
|
||||
#include "common/io/io.h"
|
||||
#include "common/properties.h"
|
||||
#include "util/stringUtils.h"
|
||||
@@ -9,6 +10,9 @@
|
||||
#include "detection/gpu/gpu_driver_specific.h"
|
||||
#endif
|
||||
|
||||
#define FF_STR_INDIR(x) #x
|
||||
#define FF_STR(x) FF_STR_INDIR(x)
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
FF_MAYBE_UNUSED static void pciDetectTemp(FFGPUResult* gpu, uint32_t deviceClass)
|
||||
@@ -17,8 +21,9 @@ FF_MAYBE_UNUSED static void pciDetectTemp(FFGPUResult* gpu, uint32_t deviceClass
|
||||
|
||||
FF_LIST_FOR_EACH(FFTempValue, tempValue, *tempsResult)
|
||||
{
|
||||
// https://www.kernel.org/doc/html/v5.10/gpu/amdgpu.html#hwmon-interfaces
|
||||
// FIXME: this code doesn't take multiGPUs into count
|
||||
//The kernel exposes the device class multiplied by 256 for some reason
|
||||
// The kernel exposes the device class multiplied by 256 for some reason
|
||||
if(tempValue->deviceClass == deviceClass * 256)
|
||||
{
|
||||
gpu->temperature = tempValue->value;
|
||||
@@ -51,26 +56,246 @@ static void pciDetectDriver(FFGPUResult* gpu, FFstrbuf* pciDir, FFstrbuf* buffer
|
||||
}
|
||||
}
|
||||
|
||||
static void pciDetectVmem(FFGPUResult* gpu, FFstrbuf* pciDir, FFstrbuf* buffer)
|
||||
{
|
||||
// Works for AMD GPUs
|
||||
// https://www.kernel.org/doc/html/v5.10/gpu/amdgpu.html#mem-info-vis-vram-total
|
||||
ffStrbufAppendS(pciDir, "/mem_info_vis_vram_total");
|
||||
uint64_t size = 0;
|
||||
if (ffReadFileBuffer(pciDir->chars, buffer) && (size = ffStrbufToUInt(buffer, 0)))
|
||||
{
|
||||
gpu->type = size > 1024UL * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
|
||||
if (gpu->type == FF_GPU_TYPE_DISCRETE)
|
||||
gpu->dedicated.total = size;
|
||||
else
|
||||
gpu->shared.total = size;
|
||||
|
||||
ffStrbufSubstrBefore(pciDir, pciDir->length - (uint32_t) strlen("/mem_info_vis_vram_total"));
|
||||
ffStrbufAppendS(pciDir, "/mem_info_vram_used");
|
||||
if (ffReadFileBuffer(pciDir->chars, buffer) && (size = ffStrbufToUInt(buffer, 0)))
|
||||
{
|
||||
if (gpu->type == FF_GPU_TYPE_DISCRETE)
|
||||
gpu->dedicated.used = size;
|
||||
else
|
||||
gpu->shared.used = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void pciDetectVfreq(FFGPUResult* gpu, FFstrbuf* pciDir, FFstrbuf* buffer)
|
||||
{
|
||||
if (!ffStrbufEndsWithS(pciDir, "/device")) // Must be in `/sys/class/drm/cardN/device`
|
||||
return;
|
||||
|
||||
// Works for Intel GPUs
|
||||
// https://patchwork.kernel.org/project/intel-gfx/patch/1422039866-11572-3-git-send-email-ville.syrjala@linux.intel.com/
|
||||
ffStrbufSetNS(buffer, pciDir->length - (uint32_t) strlen("device"), pciDir->chars);
|
||||
ffStrbufAppendS(buffer, "gt_max_freq_mhz");
|
||||
char str[16];
|
||||
ssize_t len = ffReadFileData(buffer->chars, sizeof(str) - 1, str);
|
||||
if (len > 1)
|
||||
{
|
||||
str[len] = '\0';
|
||||
gpu->frequency = (double) strtoul(str, NULL, 10) / 1000.0;
|
||||
}
|
||||
}
|
||||
|
||||
static bool loadPciIds(FFstrbuf* pciids)
|
||||
{
|
||||
ffReadFileBuffer("/usr/share/hwdata/pci.ids", pciids);
|
||||
#ifdef FF_CUSTOM_PCI_IDS_PATH
|
||||
ffReadFileBuffer(FF_STR(FF_CUSTOM_PCI_IDS_PATH), pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
#endif
|
||||
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/share/hwdata/pci.ids", pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
ffReadFileBuffer("/usr/share/misc/pci.ids", pciids); // debian?
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/share/misc/pci.ids", pciids); // debian?
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
ffReadFileBuffer("/usr/local/share/hwdata/pci.ids", pciids);
|
||||
ffReadFileBuffer(FASTFETCH_TARGET_DIR_USR "/local/share/hwdata/pci.ids", pciids);
|
||||
if (pciids->length > 0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf* buffer, FFstrbuf* drmDir)
|
||||
{
|
||||
const uint32_t drmDirPathLength = drmDir->length;
|
||||
uint32_t vendorId, deviceId, subVendorId, subDeviceId;
|
||||
uint8_t classId, subclassId;
|
||||
if (sscanf(buffer->chars + strlen("pci:"), "v%8" SCNx32 "d%8" SCNx32 "sv%8" SCNx32 "sd%8" SCNx32 "bc%2" SCNx8 "sc%2" SCNx8, &vendorId, &deviceId, &subVendorId, &subDeviceId, &classId, &subclassId) != 6)
|
||||
return "Invalid modalias string";
|
||||
|
||||
if (classId != 0x03 /*PCI_BASE_CLASS_DISPLAY*/)
|
||||
return "Not a GPU device";
|
||||
|
||||
char pciPath[PATH_MAX];
|
||||
ssize_t pathLength = readlink(drmDir->chars, pciPath, sizeof(pciPath) - 1);
|
||||
if (pathLength <= 0)
|
||||
return "Unable to get PCI device path";
|
||||
pciPath[pathLength] = '\0';
|
||||
const char* pPciPath = strrchr(pciPath, '/');
|
||||
if (pPciPath)
|
||||
pPciPath++;
|
||||
else
|
||||
pPciPath = pciPath;
|
||||
|
||||
uint32_t pciDomain, pciBus, pciDevice, pciFunc;
|
||||
if (sscanf(pPciPath, "%" SCNx32 ":%" SCNx32 ":%" SCNx32 ".%" SCNx32, &pciDomain, &pciBus, &pciDevice, &pciFunc) != 4)
|
||||
return "Invalid PCI device path";
|
||||
|
||||
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
|
||||
ffStrbufInitStatic(&gpu->vendor, ffGetGPUVendorString((uint16_t) vendorId));
|
||||
ffStrbufInit(&gpu->name);
|
||||
ffStrbufInit(&gpu->driver);
|
||||
ffStrbufInit(&gpu->platformApi);
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
gpu->type = FF_GPU_TYPE_UNKNOWN;
|
||||
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
|
||||
gpu->deviceId = ((uint64_t) pciDomain << 6) | ((uint64_t) pciBus << 4) | (deviceId << 2) | pciFunc;
|
||||
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
|
||||
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
|
||||
{
|
||||
ffStrbufAppendS(drmDir, "/revision");
|
||||
if (ffReadFileBuffer(drmDir->chars, buffer))
|
||||
{
|
||||
char* pend;
|
||||
uint64_t revision = strtoul(buffer->chars, &pend, 16);
|
||||
if (pend != buffer->chars)
|
||||
{
|
||||
char query[32];
|
||||
snprintf(query, sizeof(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
|
||||
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
|
||||
}
|
||||
}
|
||||
ffStrbufSubstrBefore(drmDir, drmDirPathLength);
|
||||
}
|
||||
|
||||
if (gpu->name.length == 0)
|
||||
{
|
||||
static FFstrbuf pciids;
|
||||
if (pciids.chars == NULL)
|
||||
{
|
||||
ffStrbufInit(&pciids);
|
||||
loadPciIds(&pciids);
|
||||
}
|
||||
if (pciids.length)
|
||||
ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, gpu);
|
||||
}
|
||||
|
||||
pciDetectVmem(gpu, drmDir, buffer);
|
||||
ffStrbufSubstrBefore(drmDir, drmDirPathLength);
|
||||
|
||||
pciDetectVfreq(gpu, drmDir, buffer);
|
||||
ffStrbufSubstrBefore(drmDir, drmDirPathLength);
|
||||
|
||||
pciDetectDriver(gpu, drmDir, buffer);
|
||||
ffStrbufSubstrBefore(drmDir, drmDirPathLength);
|
||||
|
||||
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->driverSpecific))
|
||||
{
|
||||
ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) {
|
||||
.type = FF_GPU_DRIVER_CONDITION_TYPE_BUS_ID,
|
||||
.pciBusId = {
|
||||
.domain = pciDomain,
|
||||
.bus = pciBus,
|
||||
.device = pciDevice,
|
||||
.func = pciFunc,
|
||||
},
|
||||
}, (FFGpuDriverResult) {
|
||||
.temp = options->temp ? &gpu->temperature : NULL,
|
||||
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
||||
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
||||
.type = &gpu->type,
|
||||
.frequency = &gpu->frequency,
|
||||
}, "libnvidia-ml.so");
|
||||
|
||||
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
|
||||
gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
|
||||
}
|
||||
#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API
|
||||
|
||||
#ifdef __linux__
|
||||
if(options->temp && gpu->temperature != gpu->temperature)
|
||||
pciDetectTemp(gpu, ((uint32_t) classId << 8) + subclassId);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FF_MAYBE_UNUSED static const char* detectAsahi(FFlist* gpus, FFstrbuf* buffer, FFstrbuf* drmDir)
|
||||
{
|
||||
uint32_t index = ffStrbufFirstIndexS(buffer, "apple,agx-t");
|
||||
if (index == buffer->length) return "display-subsystem?";
|
||||
index += strlen("apple,agx-t");
|
||||
|
||||
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
|
||||
gpu->deviceId = strtoul(buffer->chars + index, NULL, 10);
|
||||
ffStrbufInitStatic(&gpu->name, ffCPUAppleCodeToName((uint32_t) gpu->deviceId));
|
||||
ffStrbufInitStatic(&gpu->vendor, FF_GPU_VENDOR_NAME_APPLE);
|
||||
ffStrbufInit(&gpu->driver);
|
||||
ffStrbufInit(&gpu->platformApi);
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
gpu->type = FF_GPU_TYPE_INTEGRATED;
|
||||
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
|
||||
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
|
||||
|
||||
pciDetectDriver(gpu, drmDir, buffer);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char* drmDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY drmDir = ffStrbufCreateA(64);
|
||||
ffStrbufAppendS(&drmDir, "/sys/class/drm/");
|
||||
const uint32_t drmDirLength = drmDir.length;
|
||||
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir(drmDir.chars);
|
||||
if(dir == NULL)
|
||||
return "Failed to open `/sys/class/drm/`";
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
|
||||
struct dirent* entry;
|
||||
while ((entry = readdir(dir)) != NULL)
|
||||
{
|
||||
if (!ffStrStartsWith(entry->d_name, "card") ||
|
||||
strchr(entry->d_name + 4, '-') != NULL)
|
||||
continue;
|
||||
|
||||
ffStrbufAppendS(&drmDir, entry->d_name);
|
||||
|
||||
ffStrbufAppendS(&drmDir, "/device/modalias");
|
||||
if (!ffReadFileBuffer(drmDir.chars, &buffer))
|
||||
continue;
|
||||
ffStrbufSubstrBefore(&drmDir, drmDir.length - (uint32_t) strlen("/modalias"));
|
||||
|
||||
if (ffStrbufStartsWithS(&buffer, "pci:"))
|
||||
detectPci(options, gpus, &buffer, &drmDir);
|
||||
#ifdef __aarch64__
|
||||
else if (ffStrbufStartsWithS(&buffer, "of:"))
|
||||
detectAsahi(gpus, &buffer, &drmDir);
|
||||
#endif
|
||||
|
||||
ffStrbufSubstrBefore(&drmDir, drmDirLength);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
//https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci
|
||||
const char* pciDirPath = "/sys/bus/pci/devices/";
|
||||
|
||||
DIR* dirp = opendir(pciDirPath);
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDirPath);
|
||||
if(dirp == NULL)
|
||||
return "Failed to open `/sys/bus/pci/devices/`";
|
||||
|
||||
@@ -80,7 +305,6 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
|
||||
const uint32_t pciBaseDirLength = pciDir.length;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY pciids = ffStrbufCreate();
|
||||
|
||||
struct dirent* entry;
|
||||
while((entry = readdir(dirp)) != NULL)
|
||||
@@ -90,93 +314,16 @@ static const char* pciDetectGPUs(const FFGPUOptions* options, FFlist* gpus)
|
||||
|
||||
ffStrbufSubstrBefore(&pciDir, pciBaseDirLength);
|
||||
ffStrbufAppendS(&pciDir, entry->d_name);
|
||||
|
||||
const uint32_t pciDevDirLength = pciDir.length;
|
||||
|
||||
ffStrbufAppendS(&pciDir, "/modalias");
|
||||
if (!ffReadFileBuffer(pciDir.chars, &buffer))
|
||||
continue;
|
||||
ffStrbufSubstrBefore(&pciDir, pciDevDirLength);
|
||||
assert(ffStrbufStartsWithS(&buffer, "pci:"));
|
||||
|
||||
uint32_t vendorId, deviceId, subVendorId, subDeviceId;
|
||||
uint8_t classId, subclassId;
|
||||
if (sscanf(buffer.chars, "pci:v%8" SCNx32 "d%8" SCNx32 "sv%8" SCNx32 "sd%8" SCNx32 "bc%2" SCNx8 "sc%2" SCNx8, &vendorId, &deviceId, &subVendorId, &subDeviceId, &classId, &subclassId) != 6)
|
||||
continue;
|
||||
|
||||
if (classId != 0x03 /*PCI_BASE_CLASS_DISPLAY*/)
|
||||
continue;
|
||||
|
||||
uint32_t pciDomain, pciBus, pciDevice, pciFunc;
|
||||
if (sscanf(entry->d_name, "%" SCNx32 ":%" SCNx32 ":%" SCNx32 ".%" SCNx32, &pciDomain, &pciBus, &pciDevice, &pciFunc) != 4)
|
||||
continue;
|
||||
|
||||
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
|
||||
ffStrbufInitStatic(&gpu->vendor, ffGetGPUVendorString((uint16_t) vendorId));
|
||||
ffStrbufInit(&gpu->name);
|
||||
ffStrbufInit(&gpu->driver);
|
||||
ffStrbufInit(&gpu->platformApi);
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
gpu->type = FF_GPU_TYPE_UNKNOWN;
|
||||
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
|
||||
gpu->deviceId = ((uint64_t) pciDomain << 6) | ((uint64_t) pciBus << 4) | (deviceId << 2) | pciFunc;
|
||||
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
|
||||
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD)
|
||||
{
|
||||
ffStrbufAppendS(&pciDir, "/revision");
|
||||
if (ffReadFileBuffer(pciDir.chars, &buffer))
|
||||
{
|
||||
char* pend;
|
||||
uint64_t revision = strtoul(buffer.chars, &pend, 16);
|
||||
if (pend != buffer.chars)
|
||||
{
|
||||
char query[32];
|
||||
snprintf(query, sizeof(query), "%X,\t%X,", (unsigned) deviceId, (unsigned) revision);
|
||||
ffParsePropFileData("libdrm/amdgpu.ids", query, &gpu->name);
|
||||
}
|
||||
}
|
||||
ffStrbufSubstrBefore(&pciDir, pciDevDirLength);
|
||||
}
|
||||
|
||||
if (gpu->name.length == 0)
|
||||
{
|
||||
if (!pciids.length)
|
||||
loadPciIds(&pciids);
|
||||
ffGPUParsePciIds(&pciids, subclassId, (uint16_t) vendorId, (uint16_t) deviceId, (uint16_t) subVendorId, (uint16_t) subDeviceId, gpu);
|
||||
}
|
||||
|
||||
pciDetectDriver(gpu, &pciDir, &buffer);
|
||||
ffStrbufSubstrBefore(&pciDir, pciDevDirLength);
|
||||
|
||||
#ifdef FF_USE_PROPRIETARY_GPU_DRIVER_API
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_NVIDIA && (options->temp || options->driverSpecific))
|
||||
{
|
||||
ffDetectNvidiaGpuInfo(&(FFGpuDriverCondition) {
|
||||
.type = FF_GPU_DRIVER_CONDITION_TYPE_BUS_ID,
|
||||
.pciBusId = {
|
||||
.domain = pciDomain,
|
||||
.bus = pciBus,
|
||||
.device = pciDevice,
|
||||
.func = pciFunc,
|
||||
},
|
||||
}, (FFGpuDriverResult) {
|
||||
.temp = options->temp ? &gpu->temperature : NULL,
|
||||
.memory = options->driverSpecific ? &gpu->dedicated : NULL,
|
||||
.coreCount = options->driverSpecific ? (uint32_t*) &gpu->coreCount : NULL,
|
||||
.type = &gpu->type,
|
||||
.frequency = &gpu->frequency,
|
||||
}, "libnvidia-ml.so");
|
||||
|
||||
if (gpu->dedicated.total != FF_GPU_VMEM_SIZE_UNSET)
|
||||
gpu->type = gpu->dedicated.total > (uint64_t)1024 * 1024 * 1024 ? FF_GPU_TYPE_DISCRETE : FF_GPU_TYPE_INTEGRATED;
|
||||
}
|
||||
#endif // FF_USE_PROPRIETARY_GPU_DRIVER_API
|
||||
|
||||
#ifdef __linux__
|
||||
if(options->temp && gpu->temperature != gpu->temperature)
|
||||
pciDetectTemp(gpu, ((uint32_t) classId << 8) + subclassId);
|
||||
#endif
|
||||
detectPci(options, gpus, &buffer, &pciDir);
|
||||
ffStrbufSubstrBefore(&pciDir, pciBaseDirLength);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -186,9 +333,12 @@ const char* ffDetectGPUImpl(const FFGPUOptions* options, FFlist* gpus)
|
||||
{
|
||||
#ifdef FF_HAVE_DIRECTX_HEADERS
|
||||
const char* ffGPUDetectByDirectX(const FFGPUOptions* options, FFlist* gpus);
|
||||
if (!ffGPUDetectByDirectX(options, gpus))
|
||||
if (ffGPUDetectByDirectX(options, gpus) == NULL)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
if (drmDetectGPUs(options, gpus) == NULL && gpus->length > 0)
|
||||
return NULL;
|
||||
|
||||
return pciDetectGPUs(options, gpus);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ struct FFNvmlData {
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetTemperature)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetMemoryInfo_v2)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetNumGpuCores)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetClockInfo)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetMaxClockInfo)
|
||||
FF_LIBRARY_SYMBOL(nvmlDeviceGetBrand)
|
||||
|
||||
bool inited;
|
||||
@@ -32,7 +32,7 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetTemperature)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetMemoryInfo_v2)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetNumGpuCores)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetClockInfo)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetMaxClockInfo)
|
||||
FF_LIBRARY_LOAD_SYMBOL_VAR_MESSAGE(libnvml, nvmlData, nvmlDeviceGetBrand)
|
||||
|
||||
if (ffnvmlInit_v2() != NVML_SUCCESS)
|
||||
@@ -122,7 +122,7 @@ const char* ffDetectNvidiaGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverR
|
||||
if (result.frequency)
|
||||
{
|
||||
uint32_t clockMHz;
|
||||
if (nvmlData.ffnvmlDeviceGetClockInfo(device, NVML_CLOCK_GRAPHICS, &clockMHz) == NVML_SUCCESS)
|
||||
if (nvmlData.ffnvmlDeviceGetMaxClockInfo(device, NVML_CLOCK_GRAPHICS, &clockMHz) == NVML_SUCCESS)
|
||||
*result.frequency = clockMHz / 1000.;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "gpu.h"
|
||||
|
||||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, uint16_t subVendor, uint16_t subDevice, FFGPUResult* gpu)
|
||||
void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint16_t device, FFGPUResult* gpu)
|
||||
{
|
||||
if (content->length)
|
||||
{
|
||||
@@ -40,13 +40,6 @@ void ffGPUParsePciIds(FFstrbuf* content, uint8_t subclass, uint16_t vendor, uint
|
||||
if (start)
|
||||
{
|
||||
start += len;
|
||||
|
||||
// Search for subvendor and subdevice
|
||||
len = (uint32_t) snprintf(buffer, sizeof(buffer), "\n\t\t%04x %04x ", subVendor, subDevice);
|
||||
char* subStart = memmem(start, (size_t) (end - start), buffer, len);
|
||||
if (subStart)
|
||||
start = subStart + len;
|
||||
|
||||
end = memchr(start, '\n', (uint32_t) (end - start));
|
||||
if (!end)
|
||||
end = content->chars + content->length;
|
||||
|
||||
@@ -151,9 +151,9 @@ const FFQtResult* ffDetectQt(void)
|
||||
|
||||
const FFDisplayServerResult* wmde = ffConnectDisplayServer();
|
||||
|
||||
if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA) == 0)
|
||||
if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_PLASMA))
|
||||
detectPlasma(&result);
|
||||
else if(ffStrbufIgnCaseCompS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT) == 0)
|
||||
else if(ffStrbufIgnCaseEqualS(&wmde->dePrettyName, FF_DE_PRETTY_LXQT))
|
||||
detectLXQt(&result);
|
||||
|
||||
return &result;
|
||||
|
||||
@@ -111,6 +111,8 @@ static const char* getProductNameWithHwModel(const FFstrbuf* hwModel)
|
||||
else if(ffStrbufStartsWithS(hwModel, "Mac"))
|
||||
{
|
||||
const char* version = hwModel->chars + strlen("Mac");
|
||||
if(ffStrEquals(version, "15,13")) return "MacBook Air (15-inch, M3, 2024)";
|
||||
if(ffStrEquals(version, "15,2")) return "MacBook Air (13-inch, M3, 2024)";
|
||||
if(ffStrEquals(version, "15,3")) return "MacBook Pro (14-inch, Nov 2023, Two Thunderbolt / USB 4 ports)";
|
||||
if(ffStrEquals(version, "15,4")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports)";
|
||||
if(ffStrEquals(version, "15,5")) return "iMac (24-inch, 2023, Two Thunderbolt / USB 4 ports, Two USB 3 ports)";
|
||||
|
||||
@@ -78,20 +78,12 @@ const char* ffDetectHost(FFHostResult* host)
|
||||
ffStrbufAppendF(&host->name, " - %s", wslDistroName);
|
||||
ffStrbufAppendS(&host->family, "WSL");
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY wslVer = ffStrbufCreate(); //Wide characters
|
||||
if(!ffProcessAppendStdOut(&wslVer, (char* const[]){
|
||||
"wsl.exe",
|
||||
"--version",
|
||||
NULL
|
||||
}) && wslVer.length > 0)
|
||||
{
|
||||
ffStrbufSubstrBeforeFirstC(&wslVer, '\r'); //CRLF
|
||||
ffStrbufSubstrAfterLastC(&wslVer, ' ');
|
||||
for(uint32_t i = 0; i < wslVer.length; ++i) {
|
||||
if(wslVer.chars[i]) //don't append \0
|
||||
ffStrbufAppendC(&host->version, wslVer.chars[i]);
|
||||
}
|
||||
}
|
||||
ffProcessAppendStdOut(&host->version, (char* const[]){
|
||||
"wslinfo",
|
||||
"--wsl-version",
|
||||
"-n",
|
||||
NULL,
|
||||
}); // supported in 2.2.3 and later
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ static const char* getSddmVersion(FFstrbuf* version)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(zlib, gzrewind)
|
||||
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(zlib, gzclose)
|
||||
|
||||
gzFile file = ffgzopen("/usr/share/man/man1/sddm.1.gz", "rb");
|
||||
gzFile file = ffgzopen(FASTFETCH_TARGET_DIR_USR "/share/man/man1/sddm.1.gz", "rb");
|
||||
if (file == Z_NULL)
|
||||
return "ffgzopen(\"/usr/share/man/man1/sddm.1.gz\", \"rb\") failed";
|
||||
|
||||
|
||||
@@ -40,10 +40,12 @@ static void addNewIp(FFlist* list, const char* name, const char* addr, int type,
|
||||
switch (type)
|
||||
{
|
||||
case AF_INET:
|
||||
ffStrbufSetS(&ip->ipv4, addr);
|
||||
if (ip->ipv4.length) ffStrbufAppendC(&ip->ipv4, ',');
|
||||
ffStrbufAppendS(&ip->ipv4, addr);
|
||||
break;
|
||||
case AF_INET6:
|
||||
ffStrbufSetS(&ip->ipv6, addr);
|
||||
if (ip->ipv6.length) ffStrbufAppendC(&ip->ipv6, ',');
|
||||
ffStrbufAppendS(&ip->ipv6, addr);
|
||||
break;
|
||||
case -1:
|
||||
ffStrbufSetS(&ip->mac, addr);
|
||||
@@ -83,12 +85,15 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
char addressBuffer[INET_ADDRSTRLEN + 4];
|
||||
inet_ntop(AF_INET, &ipv4->sin_addr, addressBuffer, INET_ADDRSTRLEN);
|
||||
|
||||
struct sockaddr_in* netmask = (struct sockaddr_in*) ifa->ifa_netmask;
|
||||
int cidr = __builtin_popcount(inet_netof(netmask->sin_addr));
|
||||
if (cidr != 0)
|
||||
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
|
||||
{
|
||||
size_t len = strlen(addressBuffer);
|
||||
snprintf(addressBuffer + len, 4, "/%d", cidr);
|
||||
struct sockaddr_in* netmask = (struct sockaddr_in*) ifa->ifa_netmask;
|
||||
int cidr = __builtin_popcount(netmask->sin_addr.s_addr);
|
||||
if (cidr != 0)
|
||||
{
|
||||
size_t len = strlen(addressBuffer);
|
||||
snprintf(addressBuffer + len, 4, "/%d", cidr);
|
||||
}
|
||||
}
|
||||
|
||||
addNewIp(results, ifa->ifa_name, addressBuffer, AF_INET, isDefaultRoute);
|
||||
@@ -99,8 +104,23 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
continue;
|
||||
|
||||
struct sockaddr_in6* ipv6 = (struct sockaddr_in6 *)ifa->ifa_addr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN];
|
||||
char addressBuffer[INET6_ADDRSTRLEN + 4];
|
||||
inet_ntop(AF_INET6, &ipv6->sin6_addr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
|
||||
if (options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT)
|
||||
{
|
||||
struct sockaddr_in6* netmask = (struct sockaddr_in6*) ifa->ifa_netmask;
|
||||
int cidr = 0;
|
||||
static_assert(sizeof(netmask->sin6_addr) % sizeof(uint64_t) == 0, "");
|
||||
for (uint32_t i = 0; i < sizeof(netmask->sin6_addr) / sizeof(uint64_t); ++i)
|
||||
cidr += __builtin_popcountll(((uint64_t*) &netmask->sin6_addr)[i]);
|
||||
if (cidr != 0)
|
||||
{
|
||||
size_t len = strlen(addressBuffer);
|
||||
snprintf(addressBuffer + len, 4, "/%d", cidr);
|
||||
}
|
||||
}
|
||||
|
||||
addNewIp(results, ifa->ifa_name, addressBuffer, AF_INET6, isDefaultRoute);
|
||||
}
|
||||
#if defined(__FreeBSD__) || defined(__APPLE__)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "util/windows/unicode.h"
|
||||
#include "localip.h"
|
||||
|
||||
static void addNewIp(FFlist* list, const char* name, const char* value, int type, bool newIp, bool defaultRoute)
|
||||
static void addNewIp(FFlist* list, const char* name, const char* addr, int type, bool newIp, bool defaultRoute)
|
||||
{
|
||||
FFLocalIpResult* ip = NULL;
|
||||
|
||||
@@ -27,13 +27,15 @@ static void addNewIp(FFlist* list, const char* name, const char* value, int type
|
||||
switch (type)
|
||||
{
|
||||
case AF_INET:
|
||||
ffStrbufSetS(&ip->ipv4, value);
|
||||
if (ip->ipv4.length) ffStrbufAppendC(&ip->ipv4, ',');
|
||||
ffStrbufAppendS(&ip->ipv4, addr);
|
||||
break;
|
||||
case AF_INET6:
|
||||
ffStrbufSetS(&ip->ipv6, value);
|
||||
if (ip->ipv6.length) ffStrbufAppendC(&ip->ipv6, ',');
|
||||
ffStrbufAppendS(&ip->ipv6, addr);
|
||||
break;
|
||||
case -1:
|
||||
ffStrbufSetS(&ip->mac, value);
|
||||
ffStrbufSetS(&ip->mac, addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -108,7 +110,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
char addressBuffer[INET_ADDRSTRLEN + 4];
|
||||
inet_ntop(AF_INET, &ipv4->sin_addr, addressBuffer, INET_ADDRSTRLEN);
|
||||
|
||||
if (ifa->OnLinkPrefixLength)
|
||||
if ((options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT) && ifa->OnLinkPrefixLength)
|
||||
{
|
||||
size_t len = strlen(addressBuffer);
|
||||
snprintf(addressBuffer + len, 4, "/%u", (unsigned) ifa->OnLinkPrefixLength);
|
||||
@@ -120,8 +122,15 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results)
|
||||
else if (ifa->Address.lpSockaddr->sa_family == AF_INET6)
|
||||
{
|
||||
SOCKADDR_IN6* ipv6 = (SOCKADDR_IN6*) ifa->Address.lpSockaddr;
|
||||
char addressBuffer[INET6_ADDRSTRLEN];
|
||||
char addressBuffer[INET6_ADDRSTRLEN + 4];
|
||||
inet_ntop(AF_INET6, &ipv6->sin6_addr, addressBuffer, INET6_ADDRSTRLEN);
|
||||
|
||||
if ((options->showType & FF_LOCALIP_TYPE_PREFIX_LEN_BIT) && ifa->OnLinkPrefixLength)
|
||||
{
|
||||
size_t len = strlen(addressBuffer);
|
||||
snprintf(addressBuffer + len, 4, "/%u", (unsigned) ifa->OnLinkPrefixLength);
|
||||
}
|
||||
|
||||
addNewIp(results, name, addressBuffer, AF_INET6, newIp, isDefaultRoute);
|
||||
newIp = false;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
typedef struct FFPackagesResult
|
||||
{
|
||||
uint32_t am;
|
||||
uint32_t apk;
|
||||
uint32_t brew;
|
||||
uint32_t brewCask;
|
||||
|
||||
@@ -45,14 +45,14 @@ static void getBrewPackages(FFPackagesResult* result)
|
||||
if(ffStrSet(prefix))
|
||||
return countBrewPackages(prefix, result);
|
||||
|
||||
countBrewPackages(FASTFETCH_TARGET_DIR_ROOT"/opt/homebrew", result);
|
||||
countBrewPackages(FASTFETCH_TARGET_DIR_ROOT"/usr/local", result);
|
||||
countBrewPackages(FASTFETCH_TARGET_DIR_ROOT "/opt/homebrew", result);
|
||||
countBrewPackages(FASTFETCH_TARGET_DIR_USR "/local", result);
|
||||
}
|
||||
|
||||
static uint32_t countMacPortsPackages(const char* dirname)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateS(dirname);
|
||||
ffStrbufAppendS(&baseDir, "/var/macports/software");
|
||||
ffStrbufAppendS(&baseDir, FASTFETCH_TARGET_DIR_ROOT "/var/macports/software");
|
||||
|
||||
return getNumElements(baseDir.chars, DT_DIR);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ static uint32_t getMacPortsPackages()
|
||||
if(ffStrSet(prefix))
|
||||
return countMacPortsPackages(prefix);
|
||||
|
||||
return countMacPortsPackages(FASTFETCH_TARGET_DIR_ROOT"/opt/local");
|
||||
return countMacPortsPackages(FASTFETCH_TARGET_DIR_ROOT "/opt/local");
|
||||
}
|
||||
|
||||
static uint32_t getNixPackagesImpl(char* path)
|
||||
@@ -81,7 +81,7 @@ static uint32_t getNixPackagesImpl(char* path)
|
||||
ffStrbufAppendS(&command, "); do if [ -d $x ]; then echo $x ; fi ; done | cut -d- -f2- | egrep '([0-9]{1,}\\.)+[0-9]{1,}' | egrep -v '\\-doc$|\\-man$|\\-info$|\\-dev$|\\-bin$|^nixos-system-nixos-' | uniq | wc -l");
|
||||
|
||||
ffProcessAppendStdOut(&output, (char* const[]) {
|
||||
"/bin/sh",
|
||||
FASTFETCH_TARGET_DIR_ROOT "/bin/sh",
|
||||
"-c",
|
||||
command.chars,
|
||||
NULL
|
||||
|
||||
@@ -253,6 +253,43 @@ static uint32_t getRpmFromLibrpm(void)
|
||||
|
||||
#endif //FF_HAVE_RPM
|
||||
|
||||
static uint32_t getAM(FFstrbuf* baseDir)
|
||||
{
|
||||
// #771
|
||||
uint32_t baseDirLength = baseDir->length;
|
||||
|
||||
ffStrbufAppendS(baseDir, "/opt");
|
||||
uint32_t optDirLength = baseDir->length;
|
||||
|
||||
uint32_t result = 0;
|
||||
|
||||
ffStrbufAppendS(baseDir, "/am/APP-MANAGER");
|
||||
if (ffPathExists(baseDir->chars, FF_PATHTYPE_FILE))
|
||||
{
|
||||
++result; // `am` itself is counted as a package too
|
||||
ffStrbufSubstrBefore(baseDir, optDirLength);
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(baseDir->chars);
|
||||
if(dirp)
|
||||
{
|
||||
struct dirent *entry;
|
||||
while ((entry = readdir(dirp)) != NULL)
|
||||
{
|
||||
if (entry->d_name[0] == '.') continue;
|
||||
if (entry->d_type == DT_DIR)
|
||||
{
|
||||
ffStrbufAppendF(baseDir, "/%s/AM-updater", entry->d_name);
|
||||
if (ffPathExists(baseDir->chars, FF_PATHTYPE_FILE))
|
||||
++result;
|
||||
ffStrbufSubstrBefore(baseDir, optDirLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ffStrbufSubstrBefore(baseDir, baseDirLength);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts, FFPackagesOptions* options)
|
||||
{
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_APK_BIT)) packageCounts->apk += getNumStrings(baseDir, "/lib/apk/db/installed", "C:Q");
|
||||
@@ -277,6 +314,7 @@ static void getPackageCounts(FFstrbuf* baseDir, FFPackagesResult* packageCounts,
|
||||
}
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_PALUDIS_BIT)) packageCounts->paludis += countFilesRecursive(baseDir, "/var/db/paludis/repositories", "environment.bz2");
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_OPKG_BIT)) packageCounts->opkg += getNumStrings(baseDir, "/usr/lib/opkg/status", "Package:"); // openwrt
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_AM_BIT)) packageCounts->am = getAM(baseDir);
|
||||
}
|
||||
|
||||
static void getPackageCountsRegular(FFstrbuf* baseDir, FFPackagesResult* packageCounts, FFPackagesOptions* options)
|
||||
|
||||
@@ -1,23 +1,35 @@
|
||||
#include "publicip.h"
|
||||
#include "common/networking.h"
|
||||
|
||||
#define FF_UNITIALIZED ((const char*)(uintptr_t) -1)
|
||||
static FFNetworkingState state;
|
||||
static int status = -1;
|
||||
static const char* status = FF_UNITIALIZED;
|
||||
|
||||
void ffPreparePublicIp(FFPublicIpOptions* options)
|
||||
{
|
||||
if (status != -1)
|
||||
if (status != FF_UNITIALIZED)
|
||||
{
|
||||
fputs("Error: this module can only be used once due to internal limitations\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
state.timeout = options->timeout;
|
||||
|
||||
if (options->url.length == 0)
|
||||
status = ffNetworkingSendHttpRequest(&state, "ipinfo.io", "/json", NULL);
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY host = ffStrbufCreateCopy(&options->url);
|
||||
ffStrbufSubstrAfterFirstS(&host, "://");
|
||||
uint32_t hostStartIndex = ffStrbufFirstIndexS(&host, "://");
|
||||
if (hostStartIndex < host.length)
|
||||
{
|
||||
if (hostStartIndex != 4 || !ffStrbufStartsWithIgnCaseS(&host, "http"))
|
||||
{
|
||||
fputs("Error: only http: protocol is supported. Use `Command` module with `curl` if needed\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
ffStrbufSubstrAfter(&host, hostStartIndex + (strlen("://") - 1));
|
||||
}
|
||||
uint32_t pathStartIndex = ffStrbufFirstIndexC(&host, '/');
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
|
||||
@@ -41,18 +53,21 @@ static inline void wrapYyjsonFree(yyjson_doc** doc)
|
||||
|
||||
const char* ffDetectPublicIp(FFPublicIpOptions* options, FFPublicIpResult* result)
|
||||
{
|
||||
if (status == -1)
|
||||
if (status == FF_UNITIALIZED)
|
||||
ffPreparePublicIp(options);
|
||||
|
||||
if (status == 0)
|
||||
return "Failed to connect to an IP detection server";
|
||||
if (status != NULL)
|
||||
return status;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY response = ffStrbufCreateA(4096);
|
||||
bool success = ffNetworkingRecvHttpResponse(&state, &response, options->timeout);
|
||||
if (success) ffStrbufSubstrAfterFirstS(&response, "\r\n\r\n");
|
||||
const char* error = ffNetworkingRecvHttpResponse(&state, &response);
|
||||
if (error == NULL)
|
||||
ffStrbufSubstrAfterFirstS(&response, "\r\n\r\n");
|
||||
else
|
||||
return error;
|
||||
|
||||
if (!success || response.length == 0)
|
||||
return "Failed to receive the server response";
|
||||
if (response.length == 0)
|
||||
return "Empty server response received";
|
||||
|
||||
if (options->url.length == 0)
|
||||
{
|
||||
@@ -69,5 +84,6 @@ const char* ffDetectPublicIp(FFPublicIpOptions* options, FFPublicIpResult* resul
|
||||
|
||||
ffStrbufDestroy(&result->ip);
|
||||
ffStrbufInitMove(&result->ip, &response);
|
||||
ffStrbufTrimRightSpace(&result->ip);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ static const char* detectFromWTImpl(FFstrbuf* content, FFstrbuf* name, double* s
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
static void detectFromWindowsTeriminal(const FFstrbuf* terminalExe, FFTerminalFontResult* terminalFont)
|
||||
static void detectFromWindowsTerminal(const FFstrbuf* terminalExe, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
//https://learn.microsoft.com/en-us/windows/terminal/install#settings-json-file
|
||||
FF_STRBUF_AUTO_DESTROY json = ffStrbufCreate();
|
||||
@@ -174,7 +174,7 @@ static void detectFromWindowsTeriminal(const FFstrbuf* terminalExe, FFTerminalFo
|
||||
char* pathEnd = jsonPath + strlen(jsonPath);
|
||||
strncpy(pathEnd, ".portable", sizeof(jsonPath) - (size_t) (pathEnd - jsonPath) - 1);
|
||||
|
||||
if(ffPathExists(jsonPath, FF_PATHTYPE_FILE))
|
||||
if(ffPathExists(jsonPath, FF_PATHTYPE_ANY))
|
||||
{
|
||||
strncpy(pathEnd, "settings\\settings.json", sizeof(jsonPath) - (size_t) (pathEnd - jsonPath) - 1);
|
||||
if(!ffAppendFileBuffer(jsonPath, &json))
|
||||
@@ -432,7 +432,7 @@ static bool detectTerminalFontCommon(const FFTerminalResult* terminal, FFTermina
|
||||
//Used by both Linux (WSL) and Windows
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "Windows Terminal") ||
|
||||
ffStrbufIgnCaseEqualS(&terminal->processName, "WindowsTerminal.exe"))
|
||||
detectFromWindowsTeriminal(&terminal->exe, terminalFont);
|
||||
detectFromWindowsTerminal(&terminal->exe, terminalFont);
|
||||
#endif
|
||||
|
||||
else
|
||||
|
||||
@@ -145,13 +145,7 @@ static void detectXFCETerminal(FFTerminalFontResult* terminalFont)
|
||||
});
|
||||
}
|
||||
|
||||
if (!configFound)
|
||||
{
|
||||
ffStrbufSetStatic(&terminalFont->error, "Couldn't find xfce4/xfconf/xfce-perchannel-xml/xfce4-terminal.xml or xfce4/terminal/terminalrc");
|
||||
return;
|
||||
}
|
||||
|
||||
if(useSysFont.length == 0 || ffStrbufIgnCaseCompS(&useSysFont, "false") == 0)
|
||||
if(configFound && (useSysFont.length == 0 || ffStrbufIgnCaseCompS(&useSysFont, "false") == 0))
|
||||
{
|
||||
if(fontName.length == 0)
|
||||
ffStrbufAppendF(&terminalFont->error, "Couldn't find FontName in %s", path);
|
||||
@@ -303,6 +297,47 @@ static void detectSt(FFTerminalFontResult* terminalFont, uint32_t pid)
|
||||
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
|
||||
}
|
||||
|
||||
static void detectWarp(FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);
|
||||
|
||||
FF_LIST_FOR_EACH(FFstrbuf, dirPrefix, instance.state.platform.configDirs)
|
||||
{
|
||||
//We need to copy the dir each time, because it used by multiple threads, so we can't directly write to it.
|
||||
ffStrbufSet(&baseDir, dirPrefix);
|
||||
ffStrbufAppendS(&baseDir, "warp-terminal/user_preferences.json");
|
||||
|
||||
yyjson_doc* doc = yyjson_read_file(baseDir.chars, YYJSON_READ_INSITU | YYJSON_READ_ALLOW_TRAILING_COMMAS | YYJSON_READ_ALLOW_COMMENTS, NULL, NULL);
|
||||
if (!doc) continue;
|
||||
|
||||
yyjson_val* prefs = yyjson_obj_get(yyjson_doc_get_root(doc), "prefs");
|
||||
if (yyjson_is_obj(prefs))
|
||||
{
|
||||
const char* fontName = yyjson_get_str(yyjson_obj_get(prefs, "FontName"));
|
||||
if (!fontName) fontName = "Hack";
|
||||
const char* fontSize = yyjson_get_str(yyjson_obj_get(prefs, "FontSize"));
|
||||
if (!fontSize) fontSize = "13";
|
||||
|
||||
ffFontInitValues(&terminalFont->font, fontName, fontSize);
|
||||
}
|
||||
yyjson_doc_free(doc);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void detectWestonTerminal(FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY font = ffStrbufCreate();
|
||||
FF_STRBUF_AUTO_DESTROY size = ffStrbufCreate();
|
||||
ffParsePropFileConfigValues("weston.ini", 2, (FFpropquery[]) {
|
||||
{"font=", &font},
|
||||
{"font-size=", &size},
|
||||
});
|
||||
if (!font.length) ffStrbufSetStatic(&font, "DejaVu Sans Mono");
|
||||
if (!size.length) ffStrbufSetStatic(&size, "14");
|
||||
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
|
||||
}
|
||||
|
||||
void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
|
||||
{
|
||||
if(ffStrbufIgnCaseEqualS(&terminal->processName, "konsole"))
|
||||
@@ -331,4 +366,8 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
|
||||
detectXterm(terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "st"))
|
||||
detectSt(terminalFont, terminal->pid);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "warp"))
|
||||
detectWarp(terminalFont);
|
||||
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "weston-terminal"))
|
||||
detectWestonTerminal(terminalFont);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <paths.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -223,6 +226,8 @@ static bool getShellVersionGeneric(FFstrbuf* exe, const char* exeName, FFstrbuf*
|
||||
|
||||
bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
|
||||
{
|
||||
if (!instance.config.display.tsVersion) return false;
|
||||
|
||||
if(strcasecmp(exeName, "bash") == 0 || strcasecmp(exeName, "sh") == 0)
|
||||
return getShellVersionBash(exe, version);
|
||||
if(strcasecmp(exeName, "zsh") == 0)
|
||||
@@ -400,6 +405,29 @@ FF_MAYBE_UNUSED static bool getTerminalVersionSt(FF_MAYBE_UNUSED FFstrbuf* exe,
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
FF_MAYBE_UNUSED static bool getTerminalVersionLxterminal(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if(!getExeVersionRaw(exe, version)) return false;
|
||||
// lxterminal 0.3.2
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
FF_MAYBE_UNUSED static bool getTerminalVersionWeston(FF_MAYBE_UNUSED FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
// weston-terminal doesn't report a version, use weston version instead
|
||||
if(ffProcessAppendStdOut(version, (char* const[]){
|
||||
"weston",
|
||||
"--version",
|
||||
NULL
|
||||
})) return false;
|
||||
|
||||
//weston 8.0.0
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
static bool getTerminalVersionContour(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
const char* env = getenv("TERMINAL_VERSION_STRING");
|
||||
@@ -410,7 +438,7 @@ static bool getTerminalVersionContour(FFstrbuf* exe, FFstrbuf* version)
|
||||
}
|
||||
if(!getExeVersionRaw(exe, version)) return false;
|
||||
// Contour Terminal Emulator 0.3.12.262
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
ffStrbufSubstrAfterLastC(version, ' ');
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
@@ -423,6 +451,65 @@ static bool getTerminalVersionScreen(FFstrbuf* exe, FFstrbuf* version)
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
static bool getTerminalVersionTmux(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if (ffProcessAppendStdOut(version, (char* const[]) {
|
||||
exe->chars,
|
||||
"-V",
|
||||
NULL
|
||||
}) != NULL)
|
||||
return false;
|
||||
|
||||
// tmux 3.4
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
static bool getTerminalVersionZellij(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if(!getExeVersionRaw(exe, version)) return false;
|
||||
|
||||
// zellij 0.39.2
|
||||
ffStrbufSubstrAfterFirstC(version, ' ');
|
||||
return version->length > 0;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
static bool getTerminalVersionKitty(FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
// kitty is written in python. `kitty --version` can be expensive
|
||||
char buffer[1024] = {};
|
||||
if (
|
||||
#ifdef __linux__
|
||||
ffReadFileData(FASTFETCH_TARGET_DIR_USR "/lib64/kitty/kitty/constants.py", sizeof(buffer) - 1, buffer) ||
|
||||
ffReadFileData(FASTFETCH_TARGET_DIR_USR "/lib/kitty/kitty/constants.py", sizeof(buffer) - 1, buffer)
|
||||
#else
|
||||
ffReadFileData(_PATH_LOCALBASE "/share/kitty/kitty/constants.py", sizeof(buffer) - 1, buffer)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// Starts from version 0.17.0
|
||||
// https://github.com/kovidgoyal/kitty/blob/master/kitty/constants.py#L25
|
||||
const char* p = memmem(buffer, sizeof(buffer) - 1, "version: Version = Version(", strlen("version: Version = Version("));
|
||||
if (p)
|
||||
{
|
||||
p += strlen("version: Version = Version(");
|
||||
int major, minor, patch;
|
||||
if (sscanf(p, "%d,%d,%d", &major, &minor, &patch) == 3)
|
||||
{
|
||||
ffStrbufSetF(version, "%d.%d.%d", major, minor, patch);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//kitty 0.21.2 created by Kovid Goyal
|
||||
return getExeVersionGeneral(exe, version);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
static bool getTerminalVersionWindowsTerminal(FFstrbuf* exe, FFstrbuf* version)
|
||||
@@ -454,6 +541,8 @@ static bool getTerminalVersionConEmu(FFstrbuf* exe, FFstrbuf* version)
|
||||
|
||||
bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe, FFstrbuf* version)
|
||||
{
|
||||
if (!instance.config.display.tsVersion) return false;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
|
||||
if(ffStrbufEqualS(processName, "com.termux"))
|
||||
@@ -502,6 +591,12 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
if(ffStrbufIgnCaseEqualS(processName, "st"))
|
||||
return getTerminalVersionSt(exe, version);
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(processName, "lxterminal"))
|
||||
return getTerminalVersionLxterminal(exe, version);
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(processName, "weston-terminal"))
|
||||
return getTerminalVersionWeston(exe, version);
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(processName, "urxvt") ||
|
||||
ffStrbufIgnCaseEqualS(processName, "urxvtd") ||
|
||||
ffStrbufIgnCaseEqualS(processName, "rxvt") ||
|
||||
@@ -524,7 +619,7 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
#ifndef _WIN32
|
||||
|
||||
if(ffStrbufIgnCaseEqualS(processName, "kitty"))
|
||||
return getExeVersionGeneral(exe, version); //kitty 0.21.2 created by Kovid Goyal
|
||||
return getTerminalVersionKitty(exe, version);
|
||||
|
||||
if (ffStrbufIgnCaseEqualS(processName, "Tabby") && getExeVersionRaw(exe, version))
|
||||
return true;
|
||||
@@ -540,6 +635,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "screen"))
|
||||
return getTerminalVersionScreen(exe, version);
|
||||
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "zellij"))
|
||||
return getTerminalVersionZellij(exe, version);
|
||||
|
||||
const char* termProgramVersion = getenv("TERM_PROGRAM_VERSION");
|
||||
if(termProgramVersion)
|
||||
{
|
||||
@@ -548,7 +646,13 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
{
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, termProgram) || // processName ends with `.exe` on Windows
|
||||
(ffStrEquals(termProgram, "vscode") && ffStrbufStartsWithIgnCaseS(processName, "code")) ||
|
||||
(ffStrEquals(termProgram, "iTerm.app") && ffStrbufStartsWithIgnCaseS(processName, "iTermServer-"))
|
||||
|
||||
#ifdef __APPLE__
|
||||
(ffStrEquals(termProgram, "iTerm.app") && ffStrbufStartsWithIgnCaseS(processName, "iTermServer-")) ||
|
||||
#elif defined(__linux__)
|
||||
(ffStrEquals(termProgram, "WarpTerminal") && ffStrbufEqualS(processName, "warp")) ||
|
||||
#endif
|
||||
false
|
||||
) {
|
||||
ffStrbufSetS(version, termProgramVersion);
|
||||
return true;
|
||||
@@ -572,6 +676,9 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
|
||||
}
|
||||
}
|
||||
|
||||
if(ffStrbufStartsWithIgnCaseS(processName, "tmux"))
|
||||
return getTerminalVersionTmux(exe, version);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
return getFileVersion(exe->chars, version);
|
||||
|
||||
@@ -23,6 +23,7 @@ typedef struct FFTerminalResult
|
||||
const char* exeName; //pointer to a char in exe
|
||||
FFstrbuf exePath; //Full real path to executable file
|
||||
FFstrbuf version;
|
||||
FFstrbuf tty;
|
||||
uint32_t pid;
|
||||
uint32_t ppid;
|
||||
} FFTerminalResult;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user