[enhancement] need fd (file descriptor) and dispatch function

Bug #1397375 reported by desrt on 2014-11-28
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Won't Fix
Wishlist
Chris Halse Rogers
mir (Ubuntu)
Wishlist
Unassigned

Bug Description

A long-standing request only ever made in person (I think) so let's write it down:

We need a way to get a pollable object out of the mir client library and a dispatch function to call so that we can integrate mir into the mainloop of the toolkit that is trying to use it.

The thread-based delivery mechanism is inconvenient for most toolkits.

The fd would ideally be the mir socket itself, but it could also be an eventfd that gets signalled from another thread. In the name of efficiency we should try to cut out the extra threads entirely, though.

The dispatch function would dispatch events to the registered delegate, directly from the thread in which it was called.

Alternatively (or perhaps additionally), we could also use a function to manually dequeue events.

Related branches

Daniel van Vugt (vanvugt) wrote :

This is part of bug 1194384. We can keep it separate though, so as to remember the additional requirement for an fd here.

Changed in mir:
importance: Undecided → Wishlist
status: New → Triaged
tags: added: enhancement
Daniel van Vugt (vanvugt) wrote :

P.S. One of the prototypes I linked to bug 1194384 does indeed take the manual dequeue approach. I think I shelved it because of visibly increased input lag, but that might no longer be an issue since input lag has been fixed elsewhere now.

Changed in mir:
status: Triaged → In Progress
assignee: nobody → Chris Halse Rogers (raof)
Changed in mir:
milestone: none → 0.10.0
Changed in mir:
milestone: 0.10.0 → 0.11.0
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:mir at revision None, scheduled for release in mir, milestone 0.11.0

Changed in mir:
status: In Progress → Fix Committed
desrt (desrt) wrote :

Reopened as per discussion with Chris during the hackfest: it is not acceptable for _sync() calls to deadlock, nor is it acceptable to recursively dispatch unrelated events during _sync() calls.

Changed in mir:
status: Fix Committed → New
Changed in mir:
milestone: 0.11.0 → 0.12.0
milestone: 0.12.0 → 0.11.0
status: New → Fix Committed
milestone: 0.11.0 → 0.12.0
status: Fix Committed → In Progress

Also, the part that landed is the first of 3 other preliminary branches
that need to land *before* this feature is exposed to clients :)

Kevin DuBois (kdub) on 2015-02-24
Changed in mir:
milestone: 0.12.0 → 0.13.0
summary: - need fd (file descriptor) and dispatch function
+ [enhancement] need fd (file descriptor) and dispatch function
Changed in mir (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Changed in mir:
milestone: 0.13.0 → 0.14.0
Changed in mir:
milestone: 0.14.0 → 0.15.0
Daniel van Vugt (vanvugt) wrote :

On hold for a long time. May as well show it as such.

Changed in mir:
milestone: 0.15.0 → none
status: In Progress → Triaged

The work around I have for this is to create your own event queue, the working example i have now:
https://github.com/glfw/glfw/blob/master/src/mir_window.c

The only difference to move to mir events 2.0 is to instead of memcpy the struct of the sizeof(MirEvent) is to use mir_event_ref to get a copy of the reference of the event. Then just use a mutex when using the queue.

Works quite well atm.

Daniel van Vugt (vanvugt) wrote :

I did the same a year or two back. Latest version is here: lp:~vanvugt/mir/event-queue
I stopped after realising it was entirely separate to Mir's internals. So didn't strictly need to be in Mir itself, and could be done by the toolkit.

Michał Sawicz (saviq) wrote :

Syncing task from Mir.

 status wontfix

I think we've decided that the Wayland support is where we'll direct
new development, so I don't expect more feature development on
libmirclient.

Changed in mir:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers