device_select_layer: apply DRI_PRIME even if default device is > 1 to match opengl...
authorLuna Nova <git@lunnova.dev>
Mon, 16 Jan 2023 00:09:04 +0000 (16:09 -0800)
committerMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 4 May 2023 00:55:51 +0000 (20:55 -0400)
This fixes DRI_PRIME=1 doing nothing if the GPU order is [dGPU, dGPU,
iGPU, cpu] (or more GPUs than that) and the iGPU is the default GPU.

Fixes: afa1fba1 ("vulkan/device_select: don't pick a cpu driver as the default")

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19101>

src/vulkan/device-select-layer/device_select_layer.c

index 29ce29e..24ac438 100644 (file)
@@ -457,8 +457,7 @@ static uint32_t get_default_device(const struct instance_info *info,
       default_idx = device_select_find_non_cpu(pci_infos, physical_device_count);
    /* DRI_PRIME=1 handling - pick any other device than default. */
    if (default_idx != -1 && dri_prime_is_one && physical_device_count > (cpu_count + 1)) {
-      if (default_idx == 0 || default_idx == 1)
-         default_idx = find_non_cpu_skip(pci_infos, physical_device_count, default_idx);
+      default_idx = find_non_cpu_skip(pci_infos, physical_device_count, default_idx);
    }
    free(pci_infos);
    return default_idx == -1 ? 0 : default_idx;