Coverage Report

Created: 2025-07-11 06:48

/src/vulkan-loader/loader/loader_linux.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *
3
 * Copyright (c) 2021-2022 The Khronos Group Inc.
4
 * Copyright (c) 2021-2022 Valve Corporation
5
 * Copyright (c) 2021-2022 LunarG, Inc.
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.
9
 * You may obtain a copy of the License at
10
 *
11
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 *
19
 * Author: Mark Young <marky@lunarg.com>
20
 *
21
 */
22
23
// Non-windows and non-apple only header file, guard it so that accidental
24
// inclusion doesn't cause unknown header include errors
25
#if defined(LOADER_ENABLE_LINUX_SORT)
26
27
#include <stdio.h>
28
#include <stdlib.h>
29
30
#include "loader_linux.h"
31
32
#include "allocation.h"
33
#include "loader_environment.h"
34
#include "loader.h"
35
#include "log.h"
36
#include "stack_allocation.h"
37
38
// Determine a priority based on device type with the higher value being higher priority.
39
0
uint32_t determine_priority_type_value(VkPhysicalDeviceType type) {
40
0
    switch (type) {
41
0
        case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
42
0
            return 10;
43
0
        case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
44
0
            return 5;
45
0
        case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
46
0
            return 3;
47
0
        case VK_PHYSICAL_DEVICE_TYPE_OTHER:
48
0
            return 2;
49
0
        case VK_PHYSICAL_DEVICE_TYPE_CPU:
50
0
            return 1;
51
0
        case VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM:  // Not really an enum, but throws warning if it's not here
52
0
            break;
53
0
    }
54
0
    return 0;
55
0
}
56
57
// Compare the two device types.
58
// This behaves similar to a qsort compare.
59
0
int32_t device_type_compare(VkPhysicalDeviceType a, VkPhysicalDeviceType b) {
60
0
    uint32_t a_value = determine_priority_type_value(a);
61
0
    uint32_t b_value = determine_priority_type_value(b);
62
0
    if (a_value > b_value) {
63
0
        return -1;
64
0
    } else if (b_value > a_value) {
65
0
        return 1;
66
0
    }
67
0
    return 0;
68
0
}
69
70
// Used to compare two devices and determine which one should have priority.  The criteria is
71
// simple:
72
//   1) Default device ALWAYS wins
73
//   2) Sort by type
74
//   3) Sort by PCI bus ID
75
//   4) Ties broken by device_ID XOR vendor_ID comparison
76
0
int32_t compare_devices(const void *a, const void *b) {
77
0
    struct LinuxSortedDeviceInfo *left = (struct LinuxSortedDeviceInfo *)a;
78
0
    struct LinuxSortedDeviceInfo *right = (struct LinuxSortedDeviceInfo *)b;
79
80
    // Default device always gets priority
81
0
    if (left->default_device) {
82
0
        return -1;
83
0
    } else if (right->default_device) {
84
0
        return 1;
85
0
    }
86
87
    // Order by device type next
88
0
    int32_t dev_type_comp = device_type_compare(left->device_type, right->device_type);
89
0
    if (0 != dev_type_comp) {
90
0
        return dev_type_comp;
91
0
    }
92
93
    // Sort by PCI info (prioritize devices that have info over those that don't)
94
0
    if (left->has_pci_bus_info && !right->has_pci_bus_info) {
95
0
        return -1;
96
0
    } else if (!left->has_pci_bus_info && right->has_pci_bus_info) {
97
0
        return 1;
98
0
    } else if (left->has_pci_bus_info && right->has_pci_bus_info) {
99
        // Sort low to high PCI domain
100
0
        if (left->pci_domain < right->pci_domain) {
101
0
            return -1;
102
0
        } else if (left->pci_domain > right->pci_domain) {
103
0
            return 1;
104
0
        }
105
        // Sort low to high PCI bus
106
0
        if (left->pci_bus < right->pci_bus) {
107
0
            return -1;
108
0
        } else if (left->pci_bus > right->pci_bus) {
109
0
            return 1;
110
0
        }
111
        // Sort low to high PCI device
112
0
        if (left->pci_device < right->pci_device) {
113
0
            return -1;
114
0
        } else if (left->pci_device > right->pci_device) {
115
0
            return 1;
116
0
        }
117
        // Sort low to high PCI function
118
0
        if (left->pci_function < right->pci_function) {
119
0
            return -1;
120
0
        } else if (left->pci_function > right->pci_function) {
121
0
            return 1;
122
0
        }
123
0
    }
124
125
    // Somehow we have a tie above, so XOR vendorID and deviceID and compare
126
0
    uint32_t left_xord_dev_vend = left->device_id ^ left->vendor_id;
127
0
    uint32_t right_xord_dev_vend = right->device_id ^ right->vendor_id;
128
0
    if (left_xord_dev_vend < right_xord_dev_vend) {
129
0
        return -1;
130
0
    } else if (right_xord_dev_vend < left_xord_dev_vend) {
131
0
        return 1;
132
0
    }
133
0
    return 0;
134
0
}
135
136
// Used to compare two device groups and determine which one should have priority.
137
// NOTE: This assumes that devices in each group have already been sorted.
138
// The group sort criteria is simple:
139
//   1) Group with the default device ALWAYS wins
140
//   2) Group with the best device type for device 0 wins
141
//   3) Group with best PCI bus ID for device 0 wins
142
//   4) Ties broken by group device 0 device_ID XOR vendor_ID comparison
143
0
int32_t compare_device_groups(const void *a, const void *b) {
144
0
    struct loader_physical_device_group_term *grp_a = (struct loader_physical_device_group_term *)a;
145
0
    struct loader_physical_device_group_term *grp_b = (struct loader_physical_device_group_term *)b;
146
147
    // Use the first GPU's info from each group to sort the groups by
148
0
    struct LinuxSortedDeviceInfo *left = &grp_a->internal_device_info[0];
149
0
    struct LinuxSortedDeviceInfo *right = &grp_b->internal_device_info[0];
150
151
    // Default device always gets priority
152
0
    if (left->default_device) {
153
0
        return -1;
154
0
    } else if (right->default_device) {
155
0
        return 1;
156
0
    }
157
158
    // Order by device type next
159
0
    int32_t dev_type_comp = device_type_compare(left->device_type, right->device_type);
160
0
    if (0 != dev_type_comp) {
161
0
        return dev_type_comp;
162
0
    }
163
164
    // Sort by PCI info (prioritize devices that have info over those that don't)
165
0
    if (left->has_pci_bus_info && !right->has_pci_bus_info) {
166
0
        return -1;
167
0
    } else if (!left->has_pci_bus_info && right->has_pci_bus_info) {
168
0
        return 1;
169
0
    } else if (left->has_pci_bus_info && right->has_pci_bus_info) {
170
        // Sort low to high PCI domain
171
0
        if (left->pci_domain < right->pci_domain) {
172
0
            return -1;
173
0
        } else if (left->pci_domain > right->pci_domain) {
174
0
            return 1;
175
0
        }
176
        // Sort low to high PCI bus
177
0
        if (left->pci_bus < right->pci_bus) {
178
0
            return -1;
179
0
        } else if (left->pci_bus > right->pci_bus) {
180
0
            return 1;
181
0
        }
182
        // Sort low to high PCI device
183
0
        if (left->pci_device < right->pci_device) {
184
0
            return -1;
185
0
        } else if (left->pci_device > right->pci_device) {
186
0
            return 1;
187
0
        }
188
        // Sort low to high PCI function
189
0
        if (left->pci_function < right->pci_function) {
190
0
            return -1;
191
0
        } else if (left->pci_function > right->pci_function) {
192
0
            return 1;
193
0
        }
194
0
    }
195
196
    // Somehow we have a tie above, so XOR vendorID and deviceID and compare
197
0
    uint32_t left_xord_dev_vend = left->device_id ^ left->vendor_id;
198
0
    uint32_t right_xord_dev_vend = right->device_id ^ right->vendor_id;
199
0
    if (left_xord_dev_vend < right_xord_dev_vend) {
200
0
        return -1;
201
0
    } else if (right_xord_dev_vend < left_xord_dev_vend) {
202
0
        return 1;
203
0
    }
204
0
    return 0;
205
0
}
206
207
// Search for the default device using the loader environment variable.
208
void linux_env_var_default_device(struct loader_instance *inst, uint32_t device_count,
209
0
                                  struct LinuxSortedDeviceInfo *sorted_device_info) {
210
0
    char *selection = loader_getenv("VK_LOADER_DEVICE_SELECT", inst);
211
0
    if (NULL != selection) {
212
0
        loader_log(inst, VULKAN_LOADER_DEBUG_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
213
0
                   "linux_env_var_default_device:  Found \'VK_LOADER_DEVICE_SELECT\' set to %s", selection);
214
215
        // The environment variable exists, so grab the vendor ID and device ID of the
216
        // selected default device
217
0
        unsigned vendor_id, device_id;
218
0
        int32_t matched = sscanf(selection, "%x:%x", &vendor_id, &device_id);
219
0
        if (matched == 2) {
220
0
            for (int32_t i = 0; i < (int32_t)device_count; ++i) {
221
0
                if (sorted_device_info[i].vendor_id == vendor_id && sorted_device_info[i].device_id == device_id) {
222
0
                    loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
223
0
                               "linux_env_var_default_device:  Found default at index %u \'%s\'", i,
224
0
                               sorted_device_info[i].device_name);
225
0
                    sorted_device_info[i].default_device = true;
226
0
                    break;
227
0
                }
228
0
            }
229
0
        }
230
231
0
        loader_free_getenv(selection, inst);
232
0
    }
233
0
}
234
235
// This function allocates an array in sorted_devices which must be freed by the caller if not null
236
VkResult linux_read_sorted_physical_devices(struct loader_instance *inst, uint32_t icd_count,
237
                                            struct loader_icd_physical_devices *icd_devices, uint32_t phys_dev_count,
238
0
                                            struct loader_physical_device_term **sorted_device_term) {
239
0
    VkResult res = VK_SUCCESS;
240
0
    bool app_is_vulkan_1_1 = loader_check_version_meets_required(LOADER_VERSION_1_1_0, inst->app_api_version);
241
242
0
    struct LinuxSortedDeviceInfo *sorted_device_info = loader_instance_heap_calloc(
243
0
        inst, phys_dev_count * sizeof(struct LinuxSortedDeviceInfo), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
244
0
    if (NULL == sorted_device_info) {
245
0
        res = VK_ERROR_OUT_OF_HOST_MEMORY;
246
0
        goto out;
247
0
    }
248
249
0
    loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "linux_read_sorted_physical_devices:");
250
0
    loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "     Original order:");
251
252
    // Grab all the necessary info we can about each device
253
0
    uint32_t index = 0;
254
0
    for (uint32_t icd_idx = 0; icd_idx < icd_count; ++icd_idx) {
255
0
        for (uint32_t phys_dev = 0; phys_dev < icd_devices[icd_idx].device_count; ++phys_dev) {
256
0
            struct loader_icd_term *icd_term = icd_devices[icd_idx].icd_term;
257
0
            VkPhysicalDeviceProperties dev_props = {};
258
259
0
            sorted_device_info[index].physical_device = icd_devices[icd_idx].physical_devices[phys_dev];
260
0
            sorted_device_info[index].icd_term = icd_term;
261
0
            sorted_device_info[index].has_pci_bus_info = false;
262
263
0
            icd_term->dispatch.GetPhysicalDeviceProperties(sorted_device_info[index].physical_device, &dev_props);
264
0
            sorted_device_info[index].device_type = dev_props.deviceType;
265
0
            strncpy(sorted_device_info[index].device_name, dev_props.deviceName, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE);
266
0
            sorted_device_info[index].vendor_id = dev_props.vendorID;
267
0
            sorted_device_info[index].device_id = dev_props.deviceID;
268
269
0
            bool device_is_1_1_capable =
270
0
                loader_check_version_meets_required(LOADER_VERSION_1_1_0, loader_make_version(dev_props.apiVersion));
271
0
            if (!sorted_device_info[index].has_pci_bus_info) {
272
0
                uint32_t ext_count = 0;
273
0
                icd_term->dispatch.EnumerateDeviceExtensionProperties(sorted_device_info[index].physical_device, NULL, &ext_count,
274
0
                                                                      NULL);
275
0
                if (ext_count > 0) {
276
0
                    VkExtensionProperties *ext_props =
277
0
                        (VkExtensionProperties *)loader_stack_alloc(sizeof(VkExtensionProperties) * ext_count);
278
0
                    if (NULL == ext_props) {
279
0
                        res = VK_ERROR_OUT_OF_HOST_MEMORY;
280
0
                        goto out;
281
0
                    }
282
0
                    icd_term->dispatch.EnumerateDeviceExtensionProperties(sorted_device_info[index].physical_device, NULL,
283
0
                                                                          &ext_count, ext_props);
284
0
                    for (uint32_t ext = 0; ext < ext_count; ++ext) {
285
0
                        if (!strcmp(ext_props[ext].extensionName, VK_EXT_PCI_BUS_INFO_EXTENSION_NAME)) {
286
0
                            sorted_device_info[index].has_pci_bus_info = true;
287
0
                            break;
288
0
                        }
289
0
                    }
290
0
                }
291
0
            }
292
293
0
            if (sorted_device_info[index].has_pci_bus_info) {
294
0
                VkPhysicalDevicePCIBusInfoPropertiesEXT pci_props = (VkPhysicalDevicePCIBusInfoPropertiesEXT){
295
0
                    .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT};
296
0
                VkPhysicalDeviceProperties2 dev_props2 =
297
0
                    (VkPhysicalDeviceProperties2){.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = &pci_props};
298
299
0
                PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = NULL;
300
0
                if (app_is_vulkan_1_1 && device_is_1_1_capable) {
301
0
                    GetPhysDevProps2 = icd_term->dispatch.GetPhysicalDeviceProperties2;
302
0
                } else {
303
0
                    GetPhysDevProps2 = (PFN_vkGetPhysicalDeviceProperties2)icd_term->dispatch.GetPhysicalDeviceProperties2KHR;
304
0
                }
305
0
                if (NULL != GetPhysDevProps2) {
306
0
                    GetPhysDevProps2(sorted_device_info[index].physical_device, &dev_props2);
307
0
                    sorted_device_info[index].pci_domain = pci_props.pciDomain;
308
0
                    sorted_device_info[index].pci_bus = pci_props.pciBus;
309
0
                    sorted_device_info[index].pci_device = pci_props.pciDevice;
310
0
                    sorted_device_info[index].pci_function = pci_props.pciFunction;
311
0
                } else {
312
0
                    sorted_device_info[index].has_pci_bus_info = false;
313
0
                }
314
0
            }
315
0
            loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "           [%u] %s", index,
316
0
                       sorted_device_info[index].device_name);
317
0
            index++;
318
0
        }
319
0
    }
320
321
    // Select default device if set in the environment variable
322
0
    linux_env_var_default_device(inst, phys_dev_count, sorted_device_info);
323
324
    // Sort devices by PCI info
325
0
    qsort(sorted_device_info, phys_dev_count, sizeof(struct LinuxSortedDeviceInfo), compare_devices);
326
327
    // If we have a selected index, add that first.
328
0
    loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "     Sorted order:");
329
330
    // Add all others after (they've already been sorted)
331
0
    for (uint32_t dev = 0; dev < phys_dev_count; ++dev) {
332
0
        sorted_device_term[dev]->this_icd_term = sorted_device_info[dev].icd_term;
333
0
        sorted_device_term[dev]->phys_dev = sorted_device_info[dev].physical_device;
334
0
        loader_set_dispatch((void *)sorted_device_term[dev], inst->disp);
335
0
        loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "           [%u] %s  %s", dev,
336
0
                   sorted_device_info[dev].device_name, (sorted_device_info[dev].default_device ? "[default]" : ""));
337
0
    }
338
339
0
out:
340
0
    loader_instance_heap_free(inst, sorted_device_info);
341
342
0
    return res;
343
0
}
344
345
// This function sorts an array of physical device groups
346
VkResult linux_sort_physical_device_groups(struct loader_instance *inst, uint32_t group_count,
347
0
                                           struct loader_physical_device_group_term *sorted_group_term) {
348
0
    VkResult res = VK_SUCCESS;
349
0
    bool app_is_vulkan_1_1 = loader_check_version_meets_required(LOADER_VERSION_1_1_0, inst->app_api_version);
350
351
0
    loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "linux_sort_physical_device_groups:  Original order:");
352
353
0
    for (uint32_t group = 0; group < group_count; ++group) {
354
0
        loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "           Group %u", group);
355
356
0
        struct loader_icd_term *icd_term = sorted_group_term[group].this_icd_term;
357
0
        for (uint32_t gpu = 0; gpu < sorted_group_term[group].group_props.physicalDeviceCount; ++gpu) {
358
0
            VkPhysicalDeviceProperties dev_props = {};
359
360
0
            sorted_group_term[group].internal_device_info[gpu].physical_device =
361
0
                sorted_group_term[group].group_props.physicalDevices[gpu];
362
0
            sorted_group_term[group].internal_device_info[gpu].has_pci_bus_info = false;
363
364
0
            icd_term->dispatch.GetPhysicalDeviceProperties(sorted_group_term[group].internal_device_info[gpu].physical_device,
365
0
                                                           &dev_props);
366
0
            sorted_group_term[group].internal_device_info[gpu].device_type = dev_props.deviceType;
367
0
            strncpy(sorted_group_term[group].internal_device_info[gpu].device_name, dev_props.deviceName,
368
0
                    VK_MAX_PHYSICAL_DEVICE_NAME_SIZE);
369
0
            sorted_group_term[group].internal_device_info[gpu].vendor_id = dev_props.vendorID;
370
0
            sorted_group_term[group].internal_device_info[gpu].device_id = dev_props.deviceID;
371
372
0
            bool device_is_1_1_capable =
373
0
                loader_check_version_meets_required(LOADER_VERSION_1_1_0, loader_make_version(dev_props.apiVersion));
374
0
            if (!sorted_group_term[group].internal_device_info[gpu].has_pci_bus_info) {
375
0
                uint32_t ext_count;
376
0
                icd_term->dispatch.EnumerateDeviceExtensionProperties(
377
0
                    sorted_group_term[group].internal_device_info[gpu].physical_device, NULL, &ext_count, NULL);
378
0
                if (ext_count > 0) {
379
0
                    VkExtensionProperties *ext_props =
380
0
                        (VkExtensionProperties *)loader_stack_alloc(sizeof(VkExtensionProperties) * ext_count);
381
0
                    if (NULL == ext_props) {
382
0
                        return VK_ERROR_OUT_OF_HOST_MEMORY;
383
0
                    }
384
0
                    icd_term->dispatch.EnumerateDeviceExtensionProperties(
385
0
                        sorted_group_term[group].internal_device_info[gpu].physical_device, NULL, &ext_count, ext_props);
386
0
                    for (uint32_t ext = 0; ext < ext_count; ++ext) {
387
0
                        if (!strcmp(ext_props[ext].extensionName, VK_EXT_PCI_BUS_INFO_EXTENSION_NAME)) {
388
0
                            sorted_group_term[group].internal_device_info[gpu].has_pci_bus_info = true;
389
0
                            break;
390
0
                        }
391
0
                    }
392
0
                }
393
0
            }
394
395
0
            if (sorted_group_term[group].internal_device_info[gpu].has_pci_bus_info) {
396
0
                VkPhysicalDevicePCIBusInfoPropertiesEXT pci_props = (VkPhysicalDevicePCIBusInfoPropertiesEXT){
397
0
                    .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT};
398
0
                VkPhysicalDeviceProperties2 dev_props2 =
399
0
                    (VkPhysicalDeviceProperties2){.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, .pNext = &pci_props};
400
401
0
                PFN_vkGetPhysicalDeviceProperties2 GetPhysDevProps2 = NULL;
402
0
                if (app_is_vulkan_1_1 && device_is_1_1_capable) {
403
0
                    GetPhysDevProps2 = icd_term->dispatch.GetPhysicalDeviceProperties2;
404
0
                } else {
405
0
                    GetPhysDevProps2 = (PFN_vkGetPhysicalDeviceProperties2)icd_term->dispatch.GetPhysicalDeviceProperties2KHR;
406
0
                }
407
0
                if (NULL != GetPhysDevProps2) {
408
0
                    GetPhysDevProps2(sorted_group_term[group].internal_device_info[gpu].physical_device, &dev_props2);
409
0
                    sorted_group_term[group].internal_device_info[gpu].pci_domain = pci_props.pciDomain;
410
0
                    sorted_group_term[group].internal_device_info[gpu].pci_bus = pci_props.pciBus;
411
0
                    sorted_group_term[group].internal_device_info[gpu].pci_device = pci_props.pciDevice;
412
0
                    sorted_group_term[group].internal_device_info[gpu].pci_function = pci_props.pciFunction;
413
0
                } else {
414
0
                    sorted_group_term[group].internal_device_info[gpu].has_pci_bus_info = false;
415
0
                }
416
0
            }
417
0
            loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "               [%u] %s", gpu,
418
0
                       sorted_group_term[group].internal_device_info[gpu].device_name);
419
0
        }
420
421
        // Select default device if set in the environment variable
422
0
        linux_env_var_default_device(inst, sorted_group_term[group].group_props.physicalDeviceCount,
423
0
                                     sorted_group_term[group].internal_device_info);
424
425
        // Sort GPUs in each group
426
0
        qsort(sorted_group_term[group].internal_device_info, sorted_group_term[group].group_props.physicalDeviceCount,
427
0
              sizeof(struct LinuxSortedDeviceInfo), compare_devices);
428
429
        // Match the externally used physical device list with the sorted physical device list for this group.
430
0
        for (uint32_t dev = 0; dev < sorted_group_term[group].group_props.physicalDeviceCount; ++dev) {
431
0
            sorted_group_term[group].group_props.physicalDevices[dev] =
432
0
                sorted_group_term[group].internal_device_info[dev].physical_device;
433
0
        }
434
0
    }
435
436
    // Sort device groups by PCI info
437
0
    qsort(sorted_group_term, group_count, sizeof(struct loader_physical_device_group_term), compare_device_groups);
438
439
0
    loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "linux_sort_physical_device_groups:  Sorted order:");
440
0
    for (uint32_t group = 0; group < group_count; ++group) {
441
0
        loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "           Group %u", group);
442
0
        for (uint32_t gpu = 0; gpu < sorted_group_term[group].group_props.physicalDeviceCount; ++gpu) {
443
0
            loader_log(inst, VULKAN_LOADER_INFO_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "               [%u] %s %p %s", gpu,
444
0
                       sorted_group_term[group].internal_device_info[gpu].device_name,
445
0
                       sorted_group_term[group].internal_device_info[gpu].physical_device,
446
0
                       (sorted_group_term[group].internal_device_info[gpu].default_device ? "[default]" : ""));
447
0
        }
448
0
    }
449
450
0
    return res;
451
0
}
452
453
#endif  // LOADER_ENABLE_LINUX_SORT