Repository: lutris/lutris

Issue:
If PRIME Offload is enabled do not default to iGPU Vulkan ICD files
Genius idea I know. And hey maybe it won't scare away all the Laptop users coming from Windblows who have no clue why their games are running like garbage.


Discussion:
Let me explain the situation real quick.

![Screenshot from 2022-08-04 13-43-39](https://user-images.githubusercontent.com/280336/182949044-f3e4edd5-32a5-43c3-963e-2ae376d27e86.png)


Well, actually, I do.

But last I tested it, the hybrid mode thing worked perfectly with Lutris.

Resolving patch:
diff --git a/lutris/sysoptions.py b/lutris/sysoptions.py
--- a/lutris/sysoptions.py
+++ b/lutris/sysoptions.py
@@ -7,7 +7,7 @@
 
 from lutris import runners
 from lutris.util import linux, system
-from lutris.util.display import DISPLAY_MANAGER, SCREEN_SAVER_INHIBITOR, USE_DRI_PRIME
+from lutris.util.display import DISPLAY_MANAGER, SCREEN_SAVER_INHIBITOR, USE_DRI_PRIME, has_graphic_adapter_description
 
 VULKAN_DATA_DIRS = [
     "/usr/local/etc/vulkan",  # standard site-local location
@@ -106,17 +106,30 @@ def get_vk_icd_choices():
     amdvlk_files = ":".join(amdvlk)
     amdvlkpro_files = ":".join(amdvlkpro)
 
+    intel_name = _("Auto: Intel Open Source (MESA: ANV)")
+    amdradv_name = _("Auto: AMD RADV Open Source (MESA: RADV)")
+    nvidia_name = _("Auto: Nvidia Proprietary")
+
     glxinfocmd = get_gpu_vendor_cmd(bool(nvidia_files))
     with subprocess.Popen(glxinfocmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) as glxvendorget:
         glxvendor = glxvendorget.communicate()[0].decode("utf-8")
     default_gpu = glxvendor
 
     if "Intel" in default_gpu:
-        choices = [(_("Auto: Intel Open Source (MESA: ANV)"), intel_files)]
+        choices = [(intel_name, intel_files)]
     elif "AMD" in default_gpu:
-        choices = [(_("Auto: AMD RADV Open Source (MESA: RADV)"), amdradv_files)]
+        choices = [(amdradv_name, amdradv_files)]
     elif "NVIDIA" in default_gpu:
-        choices = [(_("Auto: Nvidia Proprietary"), nvidia_files)]
+        choices = [(nvidia_name, nvidia_files)]
+    elif USE_DRI_PRIME:
+        # We have multiple video chipsets, pick something that is instlaled if possible;
+        # we prefer NVIDIA and AMD over Intel, because don't we all?
+        if bool(nvidia_files) and has_graphic_adapter_description("NVIDIA"):
+            choices = [(nvidia_name, nvidia_files)]
+        elif bool(amdradv_files) and has_graphic_adapter_description("AMD"):
+            choices = [(amdradv_name, amdradv_files)]
+        elif bool(intel_files) and has_graphic_adapter_description("Intel"):
+            choices = [(intel_name, intel_files)]
 
     if intel_files:
         choices.append(("Intel Open Source (MESA: ANV)", intel_files))
diff --git a/lutris/util/display.py b/lutris/util/display.py
--- a/lutris/util/display.py
+++ b/lutris/util/display.py
@@ -55,6 +55,14 @@ def restore_gamma():
         logger.warning("you do not have permission to call xgamma")
 
 
+def has_graphic_adapter_description(match_text):
+    """Returns True if a graphics adapter is found with 'match_text' in its description."""
+    for adapter in _get_graphics_adapters():
+        if match_text in adapter[1]:
+            return True
+    return False
+
+
 def _get_graphics_adapters():
     """Return the list of graphics cards available on a system
 


Test patch: