From 8b0819fa416bd2056d781cd725ee9b3ad83c4ff0 Mon Sep 17 00:00:00 2001 From: Daniel Johnson Date: Sat, 6 Jan 2024 07:29:22 -0500 Subject: [PATCH] Add some handling so that if we do not understand /proc/driver/nvidia/version we just fall back to glxinfo instead. --- lutris/util/graphics/drivers.py | 11 +++++++++-- lutris/util/linux.py | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lutris/util/graphics/drivers.py b/lutris/util/graphics/drivers.py index eeffd2702..4688bf314 100644 --- a/lutris/util/graphics/drivers.py +++ b/lutris/util/graphics/drivers.py @@ -18,9 +18,9 @@ MIN_RECOMMENDED_NVIDIA_DRIVER = 515 @cache_single def get_nvidia_driver_info() -> Dict[str, Dict[str, str]]: """Return information about NVidia drivers""" + version_file_path = "/proc/driver/nvidia/version" def read_from_proc() -> Dict[str, Dict[str, str]]: - version_file_path = "/proc/driver/nvidia/version" try: if not os.path.exists(version_file_path): return {} @@ -76,7 +76,14 @@ def get_nvidia_driver_info() -> Dict[str, Dict[str, str]]: } } - return read_from_proc() or invoke_glxinfo() + try: + from_proc = read_from_proc() + if from_proc: + return from_proc + except Exception as ex: + logger.exception("Unable to read from '%s': %s", version_file_path, ex) + + return invoke_glxinfo() def get_nvidia_gpu_ids() -> List[str]: diff --git a/lutris/util/linux.py b/lutris/util/linux.py index 9cdf152ba..6b52206e2 100644 --- a/lutris/util/linux.py +++ b/lutris/util/linux.py @@ -230,6 +230,8 @@ class LinuxSystem: # pylint: disable=too-many-public-methods minimum_nvidia_version_supported = 515 driver_info = drivers.get_nvidia_driver_info() driver_version = driver_info["nvrm"]["version"] + if not driver_version: + return False major_version = int(driver_version.split(".")[0]) return major_version >= minimum_nvidia_version_supported except Exception as ex: