<div dir="ltr">On second thought... I'm not sure how this is possible without an app bug or genuine out-of-memory (not likely).  We never query any X11 objects other than visuals and those shouldn't be changing out from under us.  The only way I can see this happening without out-of-memory is if the app has a race and close the connection on us.  If that happens, it's an app bug.<br><br>I'd probably be ok with handling the out-of-memory case by silently failing.  However, I don't think a warning printf is really appropriate in that case.  If an app is actually hitting this, they have a bug.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 22, 2016 at 1:00 PM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>I think it's right to return false if wsi_conn is NULL, but I believe there is also an application error here.<br><br>From the Vulkan 1.0.37 spec valid usage for vkGetPhysicalDeviceSurfaceSupp<wbr>ortKHR,<br><div class="m_-5904894508614066676gmail-itemizedlist"><ul class="m_-5904894508614066676gmail-itemizedlist" style="list-style-type:disc"><li class="m_-5904894508614066676gmail-listitem">
<em class="m_-5904894508614066676gmail-parameter"><code>connection</code></em> <span class="m_-5904894508614066676gmail-normative">must</span> point to a valid X11 <span class="m_-5904894508614066676gmail-strong"><strong><code class="m_-5904894508614066676gmail-code">xcb_connection_t</code></strong></span>.
</li><li class="m_-5904894508614066676gmail-listitem">
<em class="m_-5904894508614066676gmail-parameter"><code>window</code></em> <span class="m_-5904894508614066676gmail-normative">must</span> be a valid X11 <span class="m_-5904894508614066676gmail-strong"><strong><code class="m_-5904894508614066676gmail-code">xcb_window_t</code></strong></span>.
</li></ul><p>Also,</p><p>"Some Vulkan functions <span class="m_-5904894508614066676gmail-normative">may</span> send protocol over the specified xcb connection
when using a swapchain or presentable images created from a VkSurface
referring to an xcb window.
Applications <span class="m_-5904894508614066676gmail-normative">must</span> therefore ensure the xcb connection is available to
Vulkan for the duration of any functions that manipulate such swapchains or
their presentable images, and any functions that build or queue command
buffers that operate on such presentable images."</p><p>This seems to imply to me that it's the application's responsibility to ensure that the XCB connection and window it passes in are valid and remain valid for the duration of the call.</p><p>On the flip side, this is X11 and it's inherently racy.  It's possible for some other client to delete our window out from under us so we should probably handle that.  However, it's not our job to handle races inside the same process.<br></p></div>In short, I'm happy to take a patch that does<br><br></div>if (!wsi_conn)<br></div>   return false;<br><br></div>because it handles the out-of-memory and crazy X races case, but you should also fix your app.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 19, 2016 at 7:59 PM, Arda Coskunses <span dir="ltr"><<a href="mailto:acoskunses@gmail.com" target="_blank">acoskunses@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Without this check driver crash when application window<br>
closed unexpectedly.<br>
---<br>
 src/vulkan/wsi/wsi_common_<wbr>x11.c | 5 +++++<br>
 1 file changed, 5 insertions(+)<br>
<br>
diff --git a/src/vulkan/wsi/wsi_common_x1<wbr>1.c b/src/vulkan/wsi/wsi_common_x1<wbr>1.c<br>
index 25ba0c1..afb7809 100644<br>
--- a/src/vulkan/wsi/wsi_common_x1<wbr>1.c<br>
+++ b/src/vulkan/wsi/wsi_common_x1<wbr>1.c<br>
@@ -261,6 +261,11 @@ VkBool32 wsi_get_physical_device_xcb_pr<wbr>esentation_support(<br>
    struct wsi_x11_connection *wsi_conn =<br>
       wsi_x11_get_connection(wsi_de<wbr>vice, alloc, connection);<br>
<br>
+   if (!wsi_conn) {<br>
+      fprintf(stderr, "vulkan: wsi connection lost\n");<br>
+      return false;<br>
+   }<br>
+<br>
    if (!wsi_conn->has_dri3) {<br>
       fprintf(stderr, "vulkan: No DRI3 support\n");<br>
       return false;<br>
<span class="m_-5904894508614066676HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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></div></blockquote></div><br></div>