[Wayland] Integrate wl_display_dispatch_queue_pending() with compositor thread event loop
Categories
(Core :: Widget: Gtk, enhancement)
Tracking
()
People
(Reporter: stransky, Assigned: kennylevinsen)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
Reporter | ||
Comment 1•7 years ago
|
||
Reporter | ||
Comment 2•7 years ago
|
||
Assignee | ||
Comment 3•6 years ago
|
||
Would there be anything wrong with simply dedicating a thread per display to wl_display_dispatch_queue?
Firing it from the compositor, which is to the best of my understanding only running on Vsync, would be troublesome with regards firing composition on frame callbacks (e.g. through a surface-specific vsync source).
Assignee | ||
Comment 4•6 years ago
|
||
Naïve implementation using a dedicated thread per additional queue, and the relevant wl_proxy magic to get it to work. It appears to work just fine during my quick testing.
This implementation gives us both better response time and lower CPU utilization than the existing busy-loop with sleep approach. A fancier implementation could easily share a thread for all additional queues, polling the display fd's and dispatching as necessary.
One could also use a poll thread to monitor the fd's and dispatch Runnable's with wl_display_dispatch_queue_pending to the owning thread, but this solution is both simpler and cheaper, so if it works, I see no reason to complicate matters.
Note that we need to update the description for EVENT_LOOP_DELAY, which is now only used by WindowSurfaceWayland.
Assignee | ||
Comment 6•6 years ago
|
||
Instead of dispatching the wl_display queues in a non-blocking manner at fixed
intervals, we now instead dispatch display queues blocking on a dedicated
thread.
This ensures that we do not waste cycles checking an empty queue, as well as
granting us immediate response anything put in the queue.
Assignee | ||
Comment 7•6 years ago
|
||
Sorry, I had apparently failed to add the bugzilla ID to the phabricator review with the most recent patch.
I thought I did, but oh well. I guess that's an argument for using moz-phab over arc.
Updated•6 years ago
|
Assignee | ||
Comment 8•6 years ago
|
||
The attempt at using a dedicated thread caused too many issues. They could of course be solved, but would involve a relatively large amount of work.
Instead, I had an idea: Simply push dispatch_queue_pending tasks from the same spot we service the main queue (nsAppShell::ProcessNextNativeEvent). I believe that will be the least complicated solution, although the nsWaylandDisplay lifetime has to be modified slightly so that we don't try to dispatch to dead compositor/render threads on shutdown.
Patch will be posted soon.
Assignee | ||
Comment 9•6 years ago
|
||
Send tasks to dispatch our other wayland event queues from their respective threads whenever we service the GTK main event loop.
Assignee | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Comment 10•6 years ago
|
||
Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/autoland/rev/c02b1c12158f
Post wl_display_dispatch_queue_pending tasks from ProcessNextNativeEvent. r=stransky
![]() |
||
Comment 11•6 years ago
|
||
bugherder |
Updated•6 years ago
|
Updated•6 years ago
|
Description
•