<p dir="ltr">Rb.  Please cc stable</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Nov 15, 2016 1:20 PM, "Dave Airlie" <<a href="mailto:airlied@gmail.com">airlied@gmail.com</a>> wrote:<br type="attribution"><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>
This fixes the x11 and wayland backends to not assert:<br>
dEQP-VK.wsi.xcb.swapchain.get_<wbr>images.incomplete<br>
<br>
Signed-off-by: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
---<br>
 src/vulkan/wsi/wsi_common_<wbr>wayland.c | 16 +++++++++++-----<br>
 src/vulkan/wsi/wsi_common_x11.<wbr>c     | 16 +++++++++++-----<br>
 2 files changed, 22 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/vulkan/wsi/wsi_common_<wbr>wayland.c b/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
index 7691744..f6c218b 100644<br>
--- a/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
+++ b/src/vulkan/wsi/wsi_common_<wbr>wayland.c<br>
@@ -498,19 +498,25 @@ wsi_wl_swapchain_get_images(<wbr>struct wsi_swapchain *wsi_chain,<br>
                             uint32_t *pCount, VkImage *pSwapchainImages)<br>
 {<br>
    struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;<br>
+   uint32_t ret_count;<br>
+   VkResult result;<br>
<br>
    if (pSwapchainImages == NULL) {<br>
       *pCount = chain->image_count;<br>
       return VK_SUCCESS;<br>
    }<br>
<br>
-   assert(chain->image_count <= *pCount);<br>
-   for (uint32_t i = 0; i < chain->image_count; i++)<br>
-      pSwapchainImages[i] = chain->images[i].image;<br>
+   result = VK_SUCCESS;<br>
+   ret_count = chain->image_count;<br>
+   if (chain->image_count > *pCount) {<br>
+     ret_count = *pCount;<br>
+     result = VK_INCOMPLETE;<br>
+   }<br>
<br>
-   *pCount = chain->image_count;<br>
+   for (uint32_t i = 0; i < ret_count; i++)<br>
+      pSwapchainImages[i] = chain->images[i].image;<br>
<br>
-   return VK_SUCCESS;<br>
+   return result;<br>
 }<br>
<br>
 static VkResult<br>
diff --git a/src/vulkan/wsi/wsi_common_<wbr>x11.c b/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
index c758d2d..b69a621 100644<br>
--- a/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
+++ b/src/vulkan/wsi/wsi_common_<wbr>x11.c<br>
@@ -510,19 +510,25 @@ x11_get_images(struct wsi_swapchain *anv_chain,<br>
                uint32_t* pCount, VkImage *pSwapchainImages)<br>
 {<br>
    struct x11_swapchain *chain = (struct x11_swapchain *)anv_chain;<br>
+   uint32_t ret_count;<br>
+   VkResult result;<br>
<br>
    if (pSwapchainImages == NULL) {<br>
       *pCount = chain->image_count;<br>
       return VK_SUCCESS;<br>
    }<br>
<br>
-   assert(chain->image_count <= *pCount);<br>
-   for (uint32_t i = 0; i < chain->image_count; i++)<br>
-      pSwapchainImages[i] = chain->images[i].image;<br>
+   result = VK_SUCCESS;<br>
+   ret_count = chain->image_count;<br>
+   if (chain->image_count > *pCount) {<br>
+     ret_count = *pCount;<br>
+     result = VK_INCOMPLETE;<br>
+   }<br>
<br>
-   *pCount = chain->image_count;<br>
+   for (uint32_t i = 0; i < ret_count; i++)<br>
+      pSwapchainImages[i] = chain->images[i].image;<br>
<br>
-   return VK_SUCCESS;<br>
+   return result;<br>
 }<br>
<br>
 static VkResult<br>
--<br>
2.7.4<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>
</blockquote></div></div>