<div dir="ltr">Feel free to shove an alloc in wsi_device. Might make some of this a bit simpler. I guess we usually shove one in wsi_implementation so it's not a big deal.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 16, 2016 at 9:24 PM, Dave Airlie <span dir="ltr"><<a href="mailto:airlied@gmail.com" target="_blank">airlied@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
<br>
---<br>
src/intel/vulkan/anv_wsi.c | 6 +++---<br>
src/intel/vulkan/anv_wsi.h | 6 ++++--<br>
src/intel/vulkan/anv_wsi_x11.c | 22 ++++++++++++----------<br>
3 files changed, 19 insertions(+), 15 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c<br>
index 56ed3ec..767fa79 100644<br>
--- a/src/intel/vulkan/anv_wsi.c<br>
+++ b/src/intel/vulkan/anv_wsi.c<br>
@@ -31,7 +31,7 @@ anv_init_wsi(struct anv_physical_device *physical_device)<br>
memset(physical_device->wsi_<wbr>device.wsi, 0, sizeof(physical_device->wsi_<wbr>device.wsi));<br>
<br>
#ifdef VK_USE_PLATFORM_XCB_KHR<br>
- result = anv_x11_init_wsi(physical_<wbr>device);<br>
+ result = anv_x11_init_wsi(&physical_<wbr>device->wsi_device, &physical_device->instance-><wbr>alloc);<br>
if (result != VK_SUCCESS)<br>
return result;<br>
#endif<br>
@@ -40,7 +40,7 @@ anv_init_wsi(struct anv_physical_device *physical_device)<br>
result = anv_wl_init_wsi(physical_<wbr>device);<br>
if (result != VK_SUCCESS) {<br>
#ifdef VK_USE_PLATFORM_XCB_KHR<br>
- anv_x11_finish_wsi(physical_<wbr>device);<br>
+ anv_x11_finish_wsi(&physical_<wbr>device->wsi_device, &physical_device->instance-><wbr>alloc);<br>
#endif<br>
return result;<br>
}<br>
@@ -56,7 +56,7 @@ anv_finish_wsi(struct anv_physical_device *physical_device)<br>
anv_wl_finish_wsi(physical_<wbr>device);<br>
#endif<br>
#ifdef VK_USE_PLATFORM_XCB_KHR<br>
- anv_x11_finish_wsi(physical_<wbr>device);<br>
+ anv_x11_finish_wsi(&physical_<wbr>device->wsi_device, &physical_device->instance-><wbr>alloc);<br>
#endif<br>
}<br>
<br>
diff --git a/src/intel/vulkan/anv_wsi.h b/src/intel/vulkan/anv_wsi.h<br>
index 2bb8ee3..e1c8d02 100644<br>
--- a/src/intel/vulkan/anv_wsi.h<br>
+++ b/src/intel/vulkan/anv_wsi.h<br>
@@ -70,8 +70,10 @@ struct anv_swapchain {<br>
ANV_DEFINE_NONDISP_HANDLE_<wbr>CASTS(_VkIcdSurfaceBase, VkSurfaceKHR)<br>
ANV_DEFINE_NONDISP_HANDLE_<wbr>CASTS(anv_swapchain, VkSwapchainKHR)<br>
<br>
-VkResult anv_x11_init_wsi(struct anv_physical_device *physical_device);<br>
-void anv_x11_finish_wsi(struct anv_physical_device *physical_device);<br>
+VkResult anv_x11_init_wsi(struct anv_wsi_device *wsi_device,<br>
+ const VkAllocationCallbacks *alloc);<br>
+void anv_x11_finish_wsi(struct anv_wsi_device *wsi_device,<br>
+ const VkAllocationCallbacks *alloc);<br>
VkResult anv_wl_init_wsi(struct anv_physical_device *physical_device);<br>
void anv_wl_finish_wsi(struct anv_physical_device *physical_device);<br>
<br>
diff --git a/src/intel/vulkan/anv_wsi_<wbr>x11.c b/src/intel/vulkan/anv_wsi_<wbr>x11.c<br>
index 595c922..ccaabea 100644<br>
--- a/src/intel/vulkan/anv_wsi_<wbr>x11.c<br>
+++ b/src/intel/vulkan/anv_wsi_<wbr>x11.c<br>
@@ -897,12 +897,13 @@ fail_register:<br>
}<br>
<br>
VkResult<br>
-anv_x11_init_wsi(struct anv_physical_device *device)<br>
+anv_x11_init_wsi(struct anv_wsi_device *wsi_device,<br>
+ const VkAllocationCallbacks *alloc)<br>
{<br>
struct wsi_x11 *wsi;<br>
VkResult result;<br>
<br>
- wsi = vk_alloc(&device->instance-><wbr>alloc, sizeof(*wsi), 8,<br>
+ wsi = vk_alloc(alloc, sizeof(*wsi), 8,<br>
VK_SYSTEM_ALLOCATION_SCOPE_<wbr>INSTANCE);<br>
if (!wsi) {<br>
result = vk_error(VK_ERROR_OUT_OF_HOST_<wbr>MEMORY);<br>
@@ -934,33 +935,34 @@ anv_x11_init_wsi(struct anv_physical_device *device)<br>
wsi->base.get_present_modes = x11_surface_get_present_modes;<br>
wsi->base.create_swapchain = x11_surface_create_swapchain;<br>
<br>
- device->wsi_device.wsi[VK_ICD_<wbr>WSI_PLATFORM_XCB] = &wsi->base;<br>
- device->wsi_device.wsi[VK_ICD_<wbr>WSI_PLATFORM_XLIB] = &wsi->base;<br>
+ wsi_device->wsi[VK_ICD_WSI_<wbr>PLATFORM_XCB] = &wsi->base;<br>
+ wsi_device->wsi[VK_ICD_WSI_<wbr>PLATFORM_XLIB] = &wsi->base;<br>
<br>
return VK_SUCCESS;<br>
<br>
fail_mutex:<br>
pthread_mutex_destroy(&wsi-><wbr>mutex);<br>
fail_alloc:<br>
- vk_free(&device->instance-><wbr>alloc, wsi);<br>
+ vk_free(alloc, wsi);<br>
fail:<br>
- device->wsi_device.wsi[VK_ICD_<wbr>WSI_PLATFORM_XCB] = NULL;<br>
- device->wsi_device.wsi[VK_ICD_<wbr>WSI_PLATFORM_XLIB] = NULL;<br>
+ wsi_device->wsi[VK_ICD_WSI_<wbr>PLATFORM_XCB] = NULL;<br>
+ wsi_device->wsi[VK_ICD_WSI_<wbr>PLATFORM_XLIB] = NULL;<br>
<br>
return result;<br>
}<br>
<br>
void<br>
-anv_x11_finish_wsi(struct anv_physical_device *device)<br>
+anv_x11_finish_wsi(struct anv_wsi_device *wsi_device,<br>
+ const VkAllocationCallbacks *alloc)<br>
{<br>
struct wsi_x11 *wsi =<br>
- (struct wsi_x11 *)device->wsi_device.wsi[VK_<wbr>ICD_WSI_PLATFORM_XCB];<br>
+ (struct wsi_x11 *)wsi_device->wsi[VK_ICD_WSI_<wbr>PLATFORM_XCB];<br>
<br>
if (wsi) {<br>
_mesa_hash_table_destroy(wsi-><wbr>connections, NULL);<br>
<br>
pthread_mutex_destroy(&wsi-><wbr>mutex);<br>
<br>
- vk_free(&device->instance-><wbr>alloc, wsi);<br>
+ vk_free(alloc, wsi);<br>
}<br>
}<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<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>