Commit graph

11 commits

Author SHA1 Message Date
Matthew Waters
f58914b93b gl/wayland: use wayland's roundtrip_queue()
There's no need to roll our own anymore
2020-03-11 09:17:36 +00:00
Matthew Waters
5ae7998a8f gl/wayland: use a proxy wrapper for the wl_display
This allows us to remove races when setting the wl_queue on wayland
objects with wl_proxy_set_queue() as each created object is created with
the queue already set.

We can also move all our initilization code into the window as we
can retrieve all wayland objects from each window instance.  This
removes a possible race when integrating with external API's as we would
always attempt to immediately retrieve a small set of wayland objects.
That is no longer the case with the objects from each window instance.
2020-03-04 00:04:18 +00:00
Lucas Stach
7b8fc744f1 gl/wayland: fix wayland event source burning CPU
Commit c71dd72b "gl/wayland: fix glib mainloop integration" was overeager
in removing the poll result test from the check function. This caused
dispatch to be called even if no new events are available on the
Wayland connection, which in turn would wake up the glib mainloop,
causing effectively a tight loop without ever blocking on the poll.

Fixes #603
2019-07-26 08:48:05 +01:00
Lucas Stach
c71dd72b21 gl/wayland: fix glib mainloop integration
Implement the prepare and check functions according to the
documentation by returning TRUE when events should be dispatched
via the dispatch function.

As wl_display_read_events never blocks we can call it unconditionally
without looking at the poll status.

This simplifies the implementation and gets rid of a race where the
mainloop could get blocked due to nobody actually reading the events
from the wayland connection.
2019-03-11 13:54:16 +01:00
Matthew Waters
b25413fb1c gl/wayland: move roundtrip on show to window thread
This makes it thread safe and fixes a possible deadlock.

Keeping the roundtrip off the window thread will result in two different
threads call wl_display_dispatch_queue() for the same queue which
violates the assumption for _dispatch_queue()'s thread-safety
guarantees.

https://bugzilla.gnome.org/show_bug.cgi?id=788754
https://bugzilla.gnome.org/show_bug.cgi?id=792156
https://bugzilla.gnome.org/show_bug.cgi?id=758984
2018-01-04 15:39:36 +11:00
Matthew Waters
2763baf439 gl/wayland: use multi-threaded safe event wayland API
Multiple threads may be accessing the wayland fd at the same time which
requires the use of special wayland API to deal with to ensure nobody
will steal reads and cause a stall for anyone else.
2017-12-09 19:32:22 +00:00
Matthew Waters
8332b1abe8 gl/wayland: don't block the event loop after poll
Use the dispatch_pending set of functions which just run the currently
queued up events instead of potentially waiting for an event to occur.
2017-12-09 19:32:03 +00:00
Matthew Waters
8404981dfb gl/wayland: allow a NULL wl_event_queue
perform operations on the default wl_display event queue in that case
2017-12-09 19:32:03 +00:00
Matthew Waters
00cff1f9e4 gl/wayland: run each window on a separate queue
Based on patch by Julien Isorce <julien.isorce@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=709747
2017-12-09 19:32:03 +00:00
Matthew Waters
4e58ec83e0 gl/wayland: remove dead event source code 2017-12-09 19:32:02 +00:00
Matthew Waters
ccabf4545a [618/906] add wayland-egl window backend 2017-12-09 19:31:26 +00:00