diff options
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 8 | ||||
-rw-r--r-- | src/amd/vulkan/radv_private.h | 1 | ||||
-rw-r--r-- | src/amd/vulkan/radv_wsi.c | 3 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index cf9cf437b3d..056043a9169 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -225,6 +225,7 @@ radv_physical_device_init(struct radv_physical_device *device, VkResult result; drmVersionPtr version; int fd; + int master_fd = -1; fd = open(path, O_RDWR | O_CLOEXEC); if (fd < 0) { @@ -247,6 +248,8 @@ radv_physical_device_init(struct radv_physical_device *device, if (strcmp(version->name, "amdgpu")) { drmFreeVersion(version); + if (master_fd != -1) + close(master_fd); close(fd); if (instance->debug_flags & RADV_DEBUG_STARTUP) @@ -271,6 +274,7 @@ radv_physical_device_init(struct radv_physical_device *device, goto fail; } + device->master_fd = master_fd; device->local_fd = fd; device->ws->query_info(device->ws, &device->rad_info); @@ -349,6 +353,8 @@ radv_physical_device_init(struct radv_physical_device *device, fail: close(fd); + if (master_fd != -1) + close(master_fd); return result; } @@ -359,6 +365,8 @@ radv_physical_device_finish(struct radv_physical_device *device) device->ws->destroy(device->ws); disk_cache_destroy(device->disk_cache); close(device->local_fd); + if (device->master_fd != -1) + close(device->master_fd); } static void * diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index cc336499c73..a76d771e4a5 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -285,6 +285,7 @@ struct radv_physical_device { uint8_t cache_uuid[VK_UUID_SIZE]; int local_fd; + int master_fd; struct wsi_device wsi_device; bool has_rbplus; /* if RB+ register exist */ diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c index 927650480a6..2840b666727 100644 --- a/src/amd/vulkan/radv_wsi.c +++ b/src/amd/vulkan/radv_wsi.c @@ -41,7 +41,8 @@ radv_init_wsi(struct radv_physical_device *physical_device) return wsi_device_init(&physical_device->wsi_device, radv_physical_device_to_handle(physical_device), radv_wsi_proc_addr, - &physical_device->instance->alloc); + &physical_device->instance->alloc, + physical_device->master_fd); } void |