device_select_layer: log selectable devices if MESA_VK_DEVICE_SELECT_DEBUG or DRI_PRIME_DEBUG are set
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>
This commit is contained in:

committed by
Mike Blumenkrantz

parent
208e1824f1
commit
c38bf95a06
@@ -337,10 +337,18 @@ Core Mesa environment variables
|
||||
them to use a submit thread from the beginning, regardless of whether or
|
||||
not they ever see a wait-before-signal condition.
|
||||
|
||||
.. envvar:: MESA_VK_DEVICE_SELECT_DEBUG
|
||||
|
||||
print debug info about device selection decision-making
|
||||
|
||||
.. envvar:: MESA_LOADER_DRIVER_OVERRIDE
|
||||
|
||||
chooses a different driver binary such as ``etnaviv`` or ``zink``.
|
||||
|
||||
.. envvar:: DRI_PRIME_DEBUG
|
||||
|
||||
print debug info about device selection decision-making
|
||||
|
||||
.. envvar:: DRI_PRIME
|
||||
|
||||
the default GPU is the one used by Wayland/Xorg or the one connected to a
|
||||
|
@@ -542,19 +542,21 @@ static VkResult device_select_EnumeratePhysicalDevices(VkInstance instance,
|
||||
free(extensions);
|
||||
}
|
||||
}
|
||||
if (selection && strcmp(selection, "list") == 0) {
|
||||
if (should_debug_device_selection() || (selection && strcmp(selection, "list") == 0)) {
|
||||
fprintf(stderr, "selectable devices:\n");
|
||||
for (unsigned i = 0; i < physical_device_count; ++i)
|
||||
print_gpu(info, i, physical_devices[i]);
|
||||
exit(0);
|
||||
} else {
|
||||
unsigned selected_index = get_default_device(info, selection, physical_device_count, physical_devices);
|
||||
selected_physical_device_count = physical_device_count;
|
||||
selected_physical_devices[0] = physical_devices[selected_index];
|
||||
for (unsigned i = 0; i < physical_device_count - 1; ++i) {
|
||||
unsigned this_idx = i < selected_index ? i : i + 1;
|
||||
selected_physical_devices[i + 1] = physical_devices[this_idx];
|
||||
}
|
||||
|
||||
if (selection && strcmp(selection, "list") == 0)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
unsigned selected_index = get_default_device(info, selection, physical_device_count, physical_devices);
|
||||
selected_physical_device_count = physical_device_count;
|
||||
selected_physical_devices[0] = physical_devices[selected_index];
|
||||
for (unsigned i = 0; i < physical_device_count - 1; ++i) {
|
||||
unsigned this_idx = i < selected_index ? i : i + 1;
|
||||
selected_physical_devices[i + 1] = physical_devices[this_idx];
|
||||
}
|
||||
|
||||
if (selected_physical_device_count == 0) {
|
||||
|
Reference in New Issue
Block a user