From 17dc00185724d07a92abb19904c773ea95ea38c8 Mon Sep 17 00:00:00 2001 From: HADEON <52324046+h8d13@users.noreply.github.com> Date: Sun, 21 Dec 2025 02:22:59 +0100 Subject: [PATCH] Cache property of graphics_devices (#4007) * On horrible hardware this makes it so that the "Graphics drivers" section loads directly. By initializing it with launch instead of on the fly. * Init after logs * This cache the property of graphics drivers properly. Instead of trying to hack early init. --- archinstall/lib/hardware.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/archinstall/lib/hardware.py b/archinstall/lib/hardware.py index e1278dfa..3e675f32 100644 --- a/archinstall/lib/hardware.py +++ b/archinstall/lib/hardware.py @@ -193,6 +193,18 @@ class _SysInfo: return modules + @cached_property + def graphics_devices(self) -> dict[str, str]: + """ + Returns detected graphics devices (cached) + """ + cards: dict[str, str] = {} + for line in SysCommand('lspci'): + if b' VGA ' in line or b' 3D ' in line: + _, identifier = line.split(b': ', 1) + cards[identifier.strip().decode('UTF-8')] = str(line) + return cards + _sys_info = _SysInfo() @@ -209,24 +221,19 @@ class SysInfo: @staticmethod def _graphics_devices() -> dict[str, str]: - cards: dict[str, str] = {} - for line in SysCommand('lspci'): - if b' VGA ' in line or b' 3D ' in line: - _, identifier = line.split(b': ', 1) - cards[identifier.strip().decode('UTF-8')] = str(line) - return cards + return _sys_info.graphics_devices @staticmethod def has_nvidia_graphics() -> bool: - return any('nvidia' in x.lower() for x in SysInfo._graphics_devices()) + return any('nvidia' in x.lower() for x in _sys_info.graphics_devices) @staticmethod def has_amd_graphics() -> bool: - return any('amd' in x.lower() for x in SysInfo._graphics_devices()) + return any('amd' in x.lower() for x in _sys_info.graphics_devices) @staticmethod def has_intel_graphics() -> bool: - return any('intel' in x.lower() for x in SysInfo._graphics_devices()) + return any('intel' in x.lower() for x in _sys_info.graphics_devices) @staticmethod def cpu_vendor() -> CpuVendor | None: