Re: [Mesa-dev] [PATCH v11 07/15] vulkan/wsi/x11: Expand set of swapchain statuses

2018-02-21 Thread Daniel Stone
On 21 February 2018 at 14:05, Daniel Stone  wrote:
> @@ -781,7 +781,7 @@ x11_acquire_next_image_from_queue(struct x11_swapchain 
> *chain,
> uint32_t image_index;
> VkResult result = wsi_queue_pull(>acquire_queue,
>  _index, timeout);
> -   if (result != VK_SUCCESS) {
> +   if (result < 0) {
>return result;
> } else if (chain->status != VK_SUCCESS) {
>return chain->status;
> [...]
> @@ -885,15 +885,15 @@ x11_manage_fifo_queues(void *state)
> */
>uint32_t image_index;
>result = wsi_queue_pull(>present_queue, _index, 
> INT64_MAX);
> -  if (result != VK_SUCCESS) {
> +  if (result < 0) {
>   goto fail;

A different version of the compiler points out that this should be
'result < 0 || result != VK_TIMEOUT' instead.

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


[Mesa-dev] [PATCH v11 07/15] vulkan/wsi/x11: Expand set of swapchain statuses

2018-02-21 Thread Daniel Stone
Instead of direct comparisons to VK_SUCCESS, test for negative numbers
meaning an error status, and positive numbers indicating non-error
statuses.

Signed-off-by: Daniel Stone 
---
 src/vulkan/wsi/wsi_common_x11.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 2cc7a67c63f..308b20c9f02 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -767,7 +767,7 @@ x11_acquire_next_image_poll_x11(struct x11_swapchain *chain,
 
   VkResult result = x11_handle_dri3_present_event(chain, (void *)event);
   free(event);
-  if (result != VK_SUCCESS)
+  if (result < 0)
  return result;
}
 }
@@ -781,7 +781,7 @@ x11_acquire_next_image_from_queue(struct x11_swapchain 
*chain,
uint32_t image_index;
VkResult result = wsi_queue_pull(>acquire_queue,
 _index, timeout);
-   if (result != VK_SUCCESS) {
+   if (result < 0) {
   return result;
} else if (chain->status != VK_SUCCESS) {
   return chain->status;
@@ -876,7 +876,7 @@ x11_manage_fifo_queues(void *state)
 
assert(chain->base.present_mode == VK_PRESENT_MODE_FIFO_KHR);
 
-   while (chain->status == VK_SUCCESS) {
+   while (chain->status >= 0) {
   /* It should be safe to unconditionally block here.  Later in the loop
* we blocks until the previous present has landed on-screen.  At that
* point, we should have received IDLE_NOTIFY on all images presented
@@ -885,15 +885,15 @@ x11_manage_fifo_queues(void *state)
*/
   uint32_t image_index;
   result = wsi_queue_pull(>present_queue, _index, INT64_MAX);
-  if (result != VK_SUCCESS) {
+  if (result < 0) {
  goto fail;
-  } else if (chain->status != VK_SUCCESS) {
+  } else if (chain->status < 0) {
  return NULL;
   }
 
   uint64_t target_msc = chain->last_present_msc + 1;
   result = x11_present_to_x11(chain, image_index, target_msc);
-  if (result != VK_SUCCESS)
+  if (result < 0)
  goto fail;
 
   while (chain->last_present_msc < target_msc) {
@@ -904,7 +904,7 @@ x11_manage_fifo_queues(void *state)
 
  result = x11_handle_dri3_present_event(chain, (void *)event);
  free(event);
- if (result != VK_SUCCESS)
+ if (result < 0)
 goto fail;
   }
}
@@ -932,7 +932,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain 
*chain,
   result = wsi_create_native_image(>base, pCreateInfo,
0, NULL, NULL, >base);
}
-   if (result != VK_SUCCESS)
+   if (result < 0)
   return result;
 
image->pixmap = xcb_generate_id(chain->conn);
-- 
2.14.3

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