Re: [Mesa-dev] [PATCH] vulkan/wsi/wayland: Respect non-blocking AcquireNextImage

2018-11-05 Thread Chad Versace
On Tue 30 Oct 2018, Daniel Stone wrote:
> If the client has requested that AcquireNextImage not block at all, with
> a timeout of 0, then don't make any non-blocking calls.
> 
> This will still potentially block infinitely given a non-infinte
> timeout, but the fix for that is much more involved.
> 
> Signed-off-by: Daniel Stone 
> Cc: mesa-sta...@lists.freedesktop.org
> Cc: Chad Versace 
> Cc: Jason Ekstrand 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108540

Reviewed-by: Chad Versace 

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


Re: [Mesa-dev] [PATCH] vulkan/wsi/wayland: Respect non-blocking AcquireNextImage

2018-10-30 Thread Jason Ekstrand
Acked-by: Jason Ekstrand 

On Tue, Oct 30, 2018 at 7:56 AM Daniel Stone  wrote:

> If the client has requested that AcquireNextImage not block at all, with
> a timeout of 0, then don't make any non-blocking calls.
>
> This will still potentially block infinitely given a non-infinte
> timeout, but the fix for that is much more involved.
>
> Signed-off-by: Daniel Stone 
> Cc: mesa-sta...@lists.freedesktop.org
> Cc: Chad Versace 
> Cc: Jason Ekstrand 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108540
> ---
>  src/vulkan/wsi/wsi_common_wayland.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/vulkan/wsi/wsi_common_wayland.c
> b/src/vulkan/wsi/wsi_common_wayland.c
> index e9cc22ec603..981243d8b14 100644
> --- a/src/vulkan/wsi/wsi_common_wayland.c
> +++ b/src/vulkan/wsi/wsi_common_wayland.c
> @@ -699,9 +699,14 @@ wsi_wl_swapchain_acquire_next_image(struct
> wsi_swapchain *wsi_chain,
>   }
>}
>
> -  /* This time we do a blocking dispatch because we can't go
> -   * anywhere until we get an event.
> +  /* We now have to do a blocking dispatch, because all our images
> +   * are in use and we cannot return one until the server does.
> However,
> +   * if the client has requested non-blocking ANI, then we tell it up
> front
> +   * that we have nothing to return.
> */
> +  if (info->timeout == 0)
> + return VK_NOT_READY;
> +
>int ret = wl_display_roundtrip_queue(chain->display->wl_display,
> chain->display->queue);
>if (ret < 0)
> --
> 2.19.1
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] vulkan/wsi/wayland: Respect non-blocking AcquireNextImage

2018-10-30 Thread Eric Engestrom
On Tuesday, 2018-10-30 12:56:53 +, Daniel Stone wrote:
> If the client has requested that AcquireNextImage not block at all, with
> a timeout of 0, then don't make any non-blocking calls.

Indeed; per spec:
> If timeout is zero, then vkAcquireNextImageKHR does not wait, and will
> either successfully acquire an image, or fail and return VK_NOT_READY
> if no image is available.

Reviewed-by: Eric Engestrom 

> 
> This will still potentially block infinitely given a non-infinte
> timeout, but the fix for that is much more involved.

Maybe we should add a comment/debug message about this?

8<
diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index 86b3acec94e8b98b3dbf..d9852f464f9af2a32ab9 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -681,6 +681,16 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain 
*wsi_chain,
 {
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
 
+#ifdef DEBUG
+   /*
+* TODO: We need to implement this
+*/
+   if (info->timeout != 0 && info->timeout != UINT64_MAX)
+   {
+  fprintf(stderr, "timeout not supported; ignoring");
+   }
+#endif
+
int ret = wl_display_dispatch_queue_pending(chain->display->wl_display,
chain->display->queue);
/* XXX: I'm not sure if out-of-date is the right error here.  If
>8

> 
> Signed-off-by: Daniel Stone 
> Cc: mesa-sta...@lists.freedesktop.org
> Cc: Chad Versace 
> Cc: Jason Ekstrand 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108540
> ---
>  src/vulkan/wsi/wsi_common_wayland.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
> b/src/vulkan/wsi/wsi_common_wayland.c
> index e9cc22ec603..981243d8b14 100644
> --- a/src/vulkan/wsi/wsi_common_wayland.c
> +++ b/src/vulkan/wsi/wsi_common_wayland.c
> @@ -699,9 +699,14 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain 
> *wsi_chain,
>   }
>}
>  
> -  /* This time we do a blocking dispatch because we can't go
> -   * anywhere until we get an event.
> +  /* We now have to do a blocking dispatch, because all our images
> +   * are in use and we cannot return one until the server does. However,
> +   * if the client has requested non-blocking ANI, then we tell it up 
> front
> +   * that we have nothing to return.
> */
> +  if (info->timeout == 0)
> + return VK_NOT_READY;
> +
>int ret = wl_display_roundtrip_queue(chain->display->wl_display,
> chain->display->queue);
>if (ret < 0)
> -- 
> 2.19.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] vulkan/wsi/wayland: Respect non-blocking AcquireNextImage

2018-10-30 Thread Daniel Stone
If the client has requested that AcquireNextImage not block at all, with
a timeout of 0, then don't make any non-blocking calls.

This will still potentially block infinitely given a non-infinte
timeout, but the fix for that is much more involved.

Signed-off-by: Daniel Stone 
Cc: mesa-sta...@lists.freedesktop.org
Cc: Chad Versace 
Cc: Jason Ekstrand 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108540
---
 src/vulkan/wsi/wsi_common_wayland.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c 
b/src/vulkan/wsi/wsi_common_wayland.c
index e9cc22ec603..981243d8b14 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -699,9 +699,14 @@ wsi_wl_swapchain_acquire_next_image(struct wsi_swapchain 
*wsi_chain,
  }
   }
 
-  /* This time we do a blocking dispatch because we can't go
-   * anywhere until we get an event.
+  /* We now have to do a blocking dispatch, because all our images
+   * are in use and we cannot return one until the server does. However,
+   * if the client has requested non-blocking ANI, then we tell it up front
+   * that we have nothing to return.
*/
+  if (info->timeout == 0)
+ return VK_NOT_READY;
+
   int ret = wl_display_roundtrip_queue(chain->display->wl_display,
chain->display->queue);
   if (ret < 0)
-- 
2.19.1

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