[Mesa-dev] [PATCH] vulkan/wsi: Avoid waiting indefinitely for present completion in x11_manage_fifo_queues().

Henri Verbeet hverbeet at gmail.com
Tue Oct 24 15:14:53 UTC 2017


On 24 October 2017 at 16:11, Fredrik Höglund <fredrik at kde.org> wrote:
>> @@ -934,9 +938,18 @@ x11_manage_fifo_queues(void *state)
>>
>>        while (chain->last_present_msc < target_msc) {
>>           xcb_generic_event_t *event =
>> -            xcb_wait_for_special_event(chain->conn, chain->special_event);
>> -         if (!event)
>> -            goto fail;
>> +            xcb_poll_for_special_event(chain->conn, chain->special_event);
>> +         if (!event) {
>> +            int ret = poll(&pfds, 1, 100);
>
> There is a race condition here where another thread can read the event
> from the file descriptor in the time between the calls to
> xcb_poll_for_special_event() and poll().
>
Is that a scenario we care about? Unless I'm misunderstanding
something, the same kind of thing could happen between
x11_present_to_x11() and xcb_wait_for_special_event().


More information about the mesa-dev mailing list