diff --git a/.pick_status.json b/.pick_status.json index 0a0864c1eed0a..ace7e911fcd06 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -6464,7 +6464,7 @@ "description": "device_select_layer: pick a default device before applying DRI_PRIME", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "afa1fba198f44b904efe6dddb323679c105dcfdf", "notes": null diff --git a/src/vulkan/device-select-layer/device_select_layer.c b/src/vulkan/device-select-layer/device_select_layer.c index cb187c240f431..868d2ea8d15f6 100644 --- a/src/vulkan/device-select-layer/device_select_layer.c +++ b/src/vulkan/device-select-layer/device_select_layer.c @@ -452,8 +452,17 @@ static uint32_t get_default_device(const struct instance_info *info, else default_idx = device_select_find_boot_vga_vid_did(pci_infos, physical_device_count); } - if (default_idx == -1 && cpu_count) + /* If no GPU has been selected so far, select the first non-CPU device. If none are available, + * pick the first CPU device. + */ + if (default_idx == -1) { default_idx = device_select_find_non_cpu(pci_infos, physical_device_count); + if (default_idx != -1) { + /* device_select_find_non_cpu picked a default, do nothing */ + } else if (cpu_count) { + default_idx = 0; + } + } /* DRI_PRIME=1 handling - pick any other device than default. */ if (default_idx != -1 && dri_prime_is_one && physical_device_count > (cpu_count + 1)) { default_idx = find_non_cpu_skip(pci_infos, physical_device_count, default_idx);