Mesa (master): radv: replace all dup() with os_dupfd_cloexec()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 18 02:25:51 UTC 2020


Module: Mesa
Branch: master
Commit: 405bffefe15f867f77c34bd943b89629281b9cf6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=405bffefe15f867f77c34bd943b89629281b9cf6

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Fri Jun  5 10:22:04 2020 +0200

radv: replace all dup() with os_dupfd_cloexec()

Signed-off-by: Eric Engestrom <eric at engestrom.ch>
Reviewed-by: Kristian H. Kristensen <hoegsberg at google.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5369>

---

 src/amd/vulkan/radv_android.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_android.c b/src/amd/vulkan/radv_android.c
index a9f39ec9e02..78c0ab48ea7 100644
--- a/src/amd/vulkan/radv_android.c
+++ b/src/amd/vulkan/radv_android.c
@@ -35,6 +35,8 @@
 #endif
 #endif
 
+#include "util/os_file.h"
+
 #include "radv_private.h"
 #include "vk_util.h"
 
@@ -137,7 +139,7 @@ radv_image_from_gralloc(VkDevice device_h,
 	const VkImportMemoryFdInfoKHR import_info = {
 		.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR,
 		.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT,
-		.fd = dup(dma_buf),
+		.fd = os_dupfd_cloexec(dma_buf),
 	};
 
 	/* Find the first VRAM memory type, or GART for PRIME images. */
@@ -389,7 +391,7 @@ radv_AcquireImageANDROID(
 	VkResult semaphore_result = VK_SUCCESS, fence_result = VK_SUCCESS;
 
 	if (semaphore != VK_NULL_HANDLE) {
-		int semaphore_fd = nativeFenceFd >= 0 ? dup(nativeFenceFd) : nativeFenceFd;
+		int semaphore_fd = nativeFenceFd >= 0 ? os_dupfd_cloexec(nativeFenceFd) : nativeFenceFd;
 		semaphore_result = radv_ImportSemaphoreFdKHR(device,
 		                                             &(VkImportSemaphoreFdInfoKHR) {
 		                                                 .sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR,
@@ -400,7 +402,7 @@ radv_AcquireImageANDROID(
 	}
 
 	if (fence != VK_NULL_HANDLE) {
-		int fence_fd = nativeFenceFd >= 0 ? dup(nativeFenceFd) : nativeFenceFd;
+		int fence_fd = nativeFenceFd >= 0 ? os_dupfd_cloexec(nativeFenceFd) : nativeFenceFd;
 		fence_result = radv_ImportFenceFdKHR(device,
 		                                     &(VkImportFenceFdInfoKHR) {
 		                                         .sType = VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR,



More information about the mesa-commit mailing list