[Mesa-stable] [Mesa-dev] [PATCH v2 3/6] vulkan/wsi/wayland: Use per-display event queue
Daniel Stone
daniel at fooishbar.org
Mon May 15 20:43:23 UTC 2017
Hi Lionel,
On 12 May 2017 at 10:52, Lionel Landwerlin
<lionel.g.landwerlin at intel.com> wrote:
> On 05/05/17 17:47, Daniel Stone wrote:
>> @@ -535,7 +555,7 @@ wsi_wl_swapchain_acquire_next_image(struct
>> wsi_swapchain *wsi_chain,
>> {
>> struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain
>> *)wsi_chain;
>> - int ret = wl_display_dispatch_queue_pending(chain->display->display,
>> + int ret =
>> wl_display_dispatch_queue_pending(chain->display->wl_display,
>> chain->queue);
>
> I'm not a wayland expert, so this might be a dumb question.
> Why do you keep using chain->queue instead of chain->display->queue in a few
> places?
Thanks for looking at this!
display->queue is only for use during display initialisation; as we
only have one path to create the wsi_wl_display (and know objects will
not send events outside of that path), putting an object on
display->queue guarantees that it will fire in the thread actually
performing display initialisation.
OTOH, for each swapchain, we have no guarantee that two threads don't
try to enter vkAcquireNextImageKHR / vkQueuePresentKHR simultaneously,
on different swapchains. This is entirely legal, but if they share a
single display queue, there is a risk that each thread will starve the
other of events. Hence, each swapchain gains its own queue (swapchain
usage is required to be externally synchronised, so per-swapchain
guarantees we have no cross-thread issues), along with the per-display
queues.
Cheers,
Daniel
More information about the mesa-stable
mailing list