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

2017-11-16 Thread Samuel Pitoiset

This patch doesn't apply with current master.

On 11/16/2017 12:11 AM, Dave Airlie wrote:

From: Dave Airlie 

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

Signed-off-by: Dave Airlie 
---
  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(_cbs, device_h,
@@ -325,10 +325,12 @@ radv_wsi_image_create(VkDevice device_h,
}
}
  
-	if (!radv_get_memory_fd(device, memory, )) {

-   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, , );
+   if (result != VK_SUCCESS)
goto fail;
-   }
  
  	surface = >surface;
  


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2017-11-15 Thread Dave Airlie
From: Dave Airlie 

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

Signed-off-by: Dave Airlie 
---
 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(_cbs, device_h,
@@ -325,10 +325,12 @@ radv_wsi_image_create(VkDevice device_h,
}
}
 
-   if (!radv_get_memory_fd(device, memory, )) {
-   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, , );
+   if (result != VK_SUCCESS)
goto fail;
-   }
 
surface = >surface;
 
-- 
2.9.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev