From 75e7667d3f7de7e9f7b8f79ca8aeb49dde34d2d5 Mon Sep 17 00:00:00 2001 From: Kristoffer Haugland Date: Thu, 25 Jun 2026 21:50:48 +0200 Subject: [PATCH 1/2] Add btop-xe package for Intel xe GPUs --- pkgbuilds/btop-xe/.omarchy/package.json | 3 +++ pkgbuilds/btop-xe/PKGBUILD | 26 +++++++++++++++++++++++++ pkgbuilds/btop-xe/btop-xe.install | 7 +++++++ 3 files changed, 36 insertions(+) create mode 100644 pkgbuilds/btop-xe/.omarchy/package.json create mode 100644 pkgbuilds/btop-xe/PKGBUILD create mode 100644 pkgbuilds/btop-xe/btop-xe.install diff --git a/pkgbuilds/btop-xe/.omarchy/package.json b/pkgbuilds/btop-xe/.omarchy/package.json new file mode 100644 index 00000000..2a9719d3 --- /dev/null +++ b/pkgbuilds/btop-xe/.omarchy/package.json @@ -0,0 +1,3 @@ +{ + "source": "local" +} diff --git a/pkgbuilds/btop-xe/PKGBUILD b/pkgbuilds/btop-xe/PKGBUILD new file mode 100644 index 00000000..51266eb3 --- /dev/null +++ b/pkgbuilds/btop-xe/PKGBUILD @@ -0,0 +1,26 @@ +pkgname=btop-xe +pkgver=1.4.7.xe.76530c8 +pkgrel=1 +pkgdesc='btop with Intel Xe GPU support' +arch=('x86_64') +url='https://github.com/aristocratos/btop' +license=('Apache-2.0') +depends=('glibc' 'hicolor-icon-theme' 'libgcc' 'libstdc++' 'libcap') +makedepends=('git' 'gcc' 'make' 'libdrm' 'libpciaccess') +optdepends=('rocm-smi-lib: AMD GPU support') +provides=('btop') +conflicts=('btop') +install=btop-xe.install +options=('!debug') +source=("btop::git+https://github.com/deveworld/btop.git#commit=76530c80dd6184ccb72d7048c2589afdc4bdee52") +sha256sums=('SKIP') + +build() { + cd btop + make STATIC= GPU_SUPPORT=true RSMI_STATIC= STRIP=true +} + +package() { + cd btop + make PREFIX=/usr DESTDIR="$pkgdir" install +} diff --git a/pkgbuilds/btop-xe/btop-xe.install b/pkgbuilds/btop-xe/btop-xe.install new file mode 100644 index 00000000..f9d5c48c --- /dev/null +++ b/pkgbuilds/btop-xe/btop-xe.install @@ -0,0 +1,7 @@ +post_install() { + setcap 'cap_perfmon=+ep cap_dac_read_search=+ep' /usr/bin/btop 2>/dev/null || true +} + +post_upgrade() { + post_install +} From 446a553b1d8bdfa62da37c71e404a9dfcb4f4d23 Mon Sep 17 00:00:00 2001 From: Kristoffer Haugland Date: Thu, 25 Jun 2026 23:43:44 +0200 Subject: [PATCH 2/2] Prefer gtidle for btop Xe utilization --- pkgbuilds/btop-xe/PKGBUILD | 17 ++++++++-- .../prefer-gtidle-for-xe-utilization.patch | 32 +++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 pkgbuilds/btop-xe/prefer-gtidle-for-xe-utilization.patch diff --git a/pkgbuilds/btop-xe/PKGBUILD b/pkgbuilds/btop-xe/PKGBUILD index 51266eb3..c668b035 100644 --- a/pkgbuilds/btop-xe/PKGBUILD +++ b/pkgbuilds/btop-xe/PKGBUILD @@ -1,6 +1,6 @@ pkgname=btop-xe pkgver=1.4.7.xe.76530c8 -pkgrel=1 +pkgrel=2 pkgdesc='btop with Intel Xe GPU support' arch=('x86_64') url='https://github.com/aristocratos/btop' @@ -12,8 +12,19 @@ provides=('btop') conflicts=('btop') install=btop-xe.install options=('!debug') -source=("btop::git+https://github.com/deveworld/btop.git#commit=76530c80dd6184ccb72d7048c2589afdc4bdee52") -sha256sums=('SKIP') +source=( + "btop::git+https://github.com/deveworld/btop.git#commit=76530c80dd6184ccb72d7048c2589afdc4bdee52" + "prefer-gtidle-for-xe-utilization.patch" +) +sha256sums=( + 'SKIP' + '53e0b555589a3333c0e40430988c62221becbeba02ed8c69ca69d452c9439371' +) + +prepare() { + cd btop + patch -Np1 -i "$srcdir/prefer-gtidle-for-xe-utilization.patch" +} build() { cd btop diff --git a/pkgbuilds/btop-xe/prefer-gtidle-for-xe-utilization.patch b/pkgbuilds/btop-xe/prefer-gtidle-for-xe-utilization.patch new file mode 100644 index 00000000..75430a4a --- /dev/null +++ b/pkgbuilds/btop-xe/prefer-gtidle-for-xe-utilization.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kristoffer Haugland +Date: Thu, 25 Jun 2026 23:48:00 +0200 +Subject: [PATCH] Prefer Xe gtidle before fdinfo utilization + +The fdinfo collector walks /proc/*/fd and /proc/*/fdinfo on each sample. +That is much more expensive than sysfs gtidle counters on process-heavy +desktops. Prefer gtidle when the kernel exposes it, and keep fdinfo as a +fallback for systems without gtidle. +--- + src/linux/btop_collect.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp +index 57a2f2d..e816404 100644 +--- a/src/linux/btop_collect.cpp ++++ b/src/linux/btop_collect.cpp +@@ -2487,8 +2487,10 @@ namespace Gpu { + st.mem_total = mem_total; + } + +- // Test fdinfo availability +- if (not st.pci_slot.empty()) { ++ // Prefer gtidle when the kernel exposes it. fdinfo scans /proc every ++ // sample and is much more expensive on process-heavy desktops. ++ // Systems without gtidle still use fdinfo when available. ++ if (not st.pci_slot.empty() and st.gt_idle.empty()) { + FdinfoCycles test_cycles = collect_fdinfo_cycles(st.pci_slot); + st.fdinfo_probe_enabled = true; + st.fdinfo_next_probe_ns = 0; +-- +2.50.0