[Mesa-dev] [PATCH] radv: get rid of another api bypass in the wsi code.

Dave Airlie airlied at gmail.com
Wed Nov 15 23:11:34 UTC 2017


From: Dave Airlie <airlied at redhat.com>

This just uses the vulkan api to get the fd from the memory.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/amd/vulkan/radv_wsi.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index e4f7fa7..3cf0cbd 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -277,7 +277,7 @@ radv_wsi_image_create(VkDevice device_h,
 	VkImage client_image_h = VK_NULL_HANDLE;
 	struct radeon_surf *surface;
 	struct radv_image *image;
-	struct radv_device_memory *memory;
+	VkDeviceMemory memory_h;
 	int fd;
 	RADV_FROM_HANDLE(radv_device, device, device_h);
 
@@ -297,7 +297,7 @@ radv_wsi_image_create(VkDevice device_h,
 	if (result != VK_SUCCESS)
 		goto fail;
 	image = radv_image_from_handle(client_image_h);
-	memory = radv_device_memory_from_handle(private->client_memory_h);
+	memory_h = private->client_memory_h;
 
 	if (different_gpu) {
 		result = radv_wsi_image_create_common(device_h,
@@ -309,7 +309,7 @@ radv_wsi_image_create(VkDevice device_h,
 		if (result != VK_SUCCESS)
 			goto fail;
 		image = radv_image_from_handle(private->wsi_image_h);
-		memory = radv_device_memory_from_handle(private->wsi_memory_h);
+		memory_h = private->wsi_memory_h;
 
 		for (uint32_t q = 0; q < RADV_MAX_QUEUE_FAMILIES; q++) {
 			result = wsi_create_blit_cmd_buffer(&wsi_cbs, device_h,
@@ -325,10 +325,12 @@ radv_wsi_image_create(VkDevice device_h,
 		}
 	}
 
-	if (!radv_get_memory_fd(device, memory, &fd)) {
-		result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+	VkMemoryGetFdInfoKHR getfdinfo;
+	getfdinfo.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR;
+	getfdinfo.memory = memory_h;
+	result = radv_GetMemoryFdKHR(device_h, &getfdinfo, &fd);
+	if (result != VK_SUCCESS)
 		goto fail;
-	}
 
 	surface = &image->surface;
 
-- 
2.9.5



More information about the mesa-dev mailing list