<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 6, 2017 at 2:02 PM, Louis-Francis Ratté-Boulianne <span dir="ltr"><<a href="mailto:lfrb@collabora.com" target="_blank">lfrb@collabora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
<br>
The only use for this boolean was to decide whether or not it should<br>
export a dmabuf FD. Simplify things a bit by giving that directly.<br></blockquote><div><br></div><div>I'm not sure how I feel about this. To be honest, I don't really know how the radv prime stuff works so I don't know why we even have these parameters in the WSI interface. My feeling is that we probably just want to simplify the interface somehow.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Signed-off-by: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
---<br>
src/amd/vulkan/radv_wsi.c | 6 ++++--<br>
src/intel/vulkan/anv_wsi.c | 21 +++++++++++++--------<br>
src/vulkan/wsi/wsi_common.h | 2 +-<br>
src/vulkan/wsi/wsi_common_<wbr>wayland.c | 2 +-<br>
src/vulkan/wsi/wsi_common_x11.<wbr>c | 4 ++--<br>
5 files changed, 21 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c<br>
index 2562d38e23..b24cf28d42 100644<br>
--- a/src/amd/vulkan/radv_wsi.c<br>
+++ b/src/amd/vulkan/radv_wsi.c<br>
@@ -142,7 +142,7 @@ static VkResult<br>
radv_wsi_image_create(VkDevice device_h,<br>
const VkSwapchainCreateInfoKHR *pCreateInfo,<br>
const VkAllocationCallbacks* pAllocator,<br>
- bool needs_linear_copy,<br>
+ bool should_export,<br>
bool linear,<br>
struct wsi_image_base *wsi_image)<br>
{<br>
@@ -209,11 +209,13 @@ radv_wsi_image_create(VkDevice device_h,<br>
* return the fd for the image in the no copy mode,<br>
* or the fd for the linear image if a copy is required.<br>
*/<br>
- if (!needs_linear_copy || (needs_linear_copy && linear)) {<br>
+ if (should_export) {<br>
RADV_FROM_HANDLE(radv_device_<wbr>memory, memory, memory_h);<br>
if (!radv_get_memory_fd(device, memory, &fd))<br>
goto fail_alloc_memory;<br>
wsi_image->fd = fd;<br>
+ } else {<br>
+ wsi_image->fd = -1;<br>
}<br>
<br>
surface = &image->surface;<br>
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c<br>
index d520d8e3f4..916c62cad9 100644<br>
--- a/src/intel/vulkan/anv_wsi.c<br>
+++ b/src/intel/vulkan/anv_wsi.c<br>
@@ -172,7 +172,7 @@ static VkResult<br>
anv_wsi_image_create(VkDevice device_h,<br>
const VkSwapchainCreateInfoKHR *pCreateInfo,<br>
const VkAllocationCallbacks* pAllocator,<br>
- bool different_gpu,<br>
+ bool should_export,<br>
bool linear,<br>
struct wsi_image_base *wsi_image)<br>
{<br>
@@ -250,13 +250,18 @@ anv_wsi_image_create(VkDevice device_h,<br>
goto fail_alloc_memory;<br>
}<br>
<br>
- int fd = anv_gem_handle_to_fd(device, memory->bo->gem_handle);<br>
- if (fd == -1) {<br>
- /* FINISHME: Choose a better error. */<br>
- result = vk_errorf(device->instance, device,<br>
- VK_ERROR_OUT_OF_DEVICE_MEMORY,<br>
- "handle_to_fd failed: %m");<br>
- goto fail_alloc_memory;<br>
+ int fd;<br>
+ if (should_export) {<br>
+ fd = anv_gem_handle_to_fd(device, memory->bo->gem_handle);<br>
+ if (fd == -1) {<br>
+ /* FINISHME: Choose a better error. */<br>
+ result = vk_errorf(device->instance, device,<br>
+ VK_ERROR_OUT_OF_DEVICE_MEMORY,<br>
+ "handle_to_fd failed: %m");<br>
+ goto fail_alloc_memory;<br>
+ }<br>
+ } else {<br>
+ fd = -1;<br>
}<br>
<br>
wsi_image->image = image_h;<br>
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h<br>
index 2a9092479d..1103703b0e 100644<br>
--- a/src/vulkan/wsi/wsi_common.h<br>
+++ b/src/vulkan/wsi/wsi_common.h<br>
@@ -44,7 +44,7 @@ struct wsi_image_fns {<br>
VkResult (*create_wsi_image)(VkDevice device_h,<br>
const VkSwapchainCreateInfoKHR *pCreateInfo,<br>
const VkAllocationCallbacks *pAllocator,<br>
- bool needs_linear_copy,<br>
+ bool should_export,<br>
bool linear,<br>
struct wsi_image_base *image_p);<br>
void (*free_wsi_image)(VkDevice device,<br>
diff --git a/src/vulkan/wsi/wsi_common_<wbr>wayland.c b/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
index 495e7068b4..36cc4d0821 100644<br>
--- a/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
+++ b/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
@@ -730,7 +730,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,<br>
result = chain->base.image_fns->create_<wbr>wsi_image(vk_device,<br>
pCreateInfo,<br>
pAllocator,<br>
- false,<br>
+ true,<br>
false,<br>
&image->base);<br>
if (result != VK_SUCCESS)<br>
diff --git a/src/vulkan/wsi/wsi_common_<wbr>x11.c b/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
index 94578b438b..78fd406aa1 100644<br>
--- a/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
+++ b/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
@@ -963,7 +963,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,<br>
result = chain->base.image_fns->create_<wbr>wsi_image(device_h,<br>
pCreateInfo,<br>
pAllocator,<br>
- chain->base.needs_linear_copy,<br>
+ !chain->base.needs_linear_<wbr>copy,<br>
false,<br>
&image->base);<br>
if (result != VK_SUCCESS)<br>
@@ -973,7 +973,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,<br>
result = chain->base.image_fns->create_<wbr>wsi_image(device_h,<br>
pCreateInfo,<br>
pAllocator,<br>
- chain->base.needs_linear_copy,<br>
+ true,<br>
true,<br>
&image->linear_base);<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.13.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>