radv: close the local fd slightly later when enumerating physical devices

So that it can be used to print GPU info.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41802>
This commit is contained in:
Samuel Pitoiset 2026-05-26 13:00:36 +02:00 committed by Marge Bot
parent 8c9995e7fa
commit 9ab3828d5e

View file

@ -2521,11 +2521,6 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
if (drm_device) {
result = radv_amdgpu_winsys_create(fd, instance->debug_flags, instance->perftest_flags, is_virtio, &pdev->ws);
/* Close the fd immediately because libdrm dups it internally. */
close(fd);
fd = -1;
if (result != VK_SUCCESS) {
result = vk_errorf(instance, result, "failed to initialize winsys");
goto fail_base;
@ -2745,7 +2740,7 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
radv_get_physical_device_properties(pdev);
if ((instance->debug_flags & RADV_DEBUG_INFO))
ac_print_gpu_info(stdout, &pdev->info, pdev->ws->get_fd(pdev->ws));
ac_print_gpu_info(stdout, &pdev->info, fd);
radv_init_physical_device_decoder(pdev);
radv_init_physical_device_encoder(pdev);
@ -2781,6 +2776,9 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
*pdev_out = pdev;
close(fd);
fd = -1;
return VK_SUCCESS;
fail_perfcounters: