<gitlab-bot>
wayland issue (Merge request) 582 in weston "Color management architecture: color transformations and a plugin" [Colour Management, Core Compositor, Opened]
Seirdy has quit [Quit: exiting 3.2-dev]
blue__penquin has quit [Remote host closed the connection]
Seirdy has joined #wayland
blue__penquin has joined #wayland
<hesperos66>
how do you guys usually handle external IPCs within compositors and maintain thread safety? I need to implement handling requests like focus view or marking views as dirty (from outside) by `weston_view_geometry_dirty` but it seems that in order to do that I'd have to have a pipe, create messaging system and within the message handler deserialise my custom payloads to eventually execute things like
<hesperos66>
`weston_view_geometry_dirty` - this seems like an awful amount of work and a problem that I imagine may have been already solved?
<daniels>
it hasn't really been solved, because you already have a synchronisation issue
<daniels>
e.g. if the client disconnects in the main thread, the weston_view pointer you have in your other thread may be invalid
<daniels>
so you'd need to add some kind of lifetime management (so you didn't have a race against destruction), as well as parallel management (so you didn't have a race against concurrent updates)
<daniels>
this is the case for basically all compositors
<hesperos66>
daniels: I do have an object lifetime management in place. In case of i.e. views, these are easily managable as you can create them as needed as a result of i.e. surfaceAdded callbacks with something like `weston_desktop_surface_create_view` - similarly with destruction on surfaceRemoved callbacks - that guarantees that all these operations will happen on the same thread as the one that event loop
<hesperos66>
uses. Not sure though how to handle "external" requests. I've got a DBus API that my compositor exposes that allows to focus/unfocus arbitrary client - not sure though how to make it thread safe as, as I explained, it seems that I'd have to do this message serialisation/deserialisation and posting via pipe to event loop to eventually call the "real" weston APIs to perform the action
<hesperos66>
looking at sway's IPC - it seems to be doing exactly that. I was hoping that this problem may have already been solved in i.e. wlroots?
pochu has joined #wayland
<emersion>
i'd really recommend against doing multi-threading
<emersion>
we're doing it in gamescope and it's such a pain
<emersion>
no, wlroots doesn't deal with multi-threading synchronization issues
<emersion>
and sway is single-threaded, and that's considered to be a feature, not a bug :P
<daniels>
hesperos66: it sounds like you don't actually need threads at all ... ?
<daniels>
hesperos66: I mean, the point is, when the client disconnects, the weston_view* will be destroyed and become invalid
<daniels>
this can happen as your other thread is processing a message to focus that view, at which point you'll access invalid memory and crash, because there is no locking or synchronisation between the two threads
<daniels>
but you don't need a thread to dispatch dbus events, you can integrate it as a wl_event_source
<daniels>
this is exactly what sway does for its external IPC as well
blue__penquin has quit [Remote host closed the connection]
blue__penquin has joined #wayland
<daniels>
get the FD for the DBusConnection and add that as an event source, then do a non-blocking dispatch of D-Bus events when that FD becomes ready
<daniels>
(and then you can handle your D-Bus events in the main thread, and your synchronisation issues magically vanish)
<pq>
hesperos66, no, your thing with views guarantees nothing.
<pq>
hesperos66, when a Wayland client disconnects, it will destroy the weston_surface, which will destroy *all* views of that surface *in the main thread*.
<pq>
hesperos66, trying to make libweston usable from multiple threads is not feasible.
<daniels>
(same with wlroots or any other framework)
<pq>
I just hope hesperos66 does not need to use any third party API that is inherently blocking.
blue__penquin has quit []
ecloud has quit [Ping timeout: 480 seconds]
ecloud has joined #wayland
ramcq has quit [Quit: WeeChat 2.3]
ramcq has joined #wayland
st3r4g has joined #wayland
dos has joined #wayland
ramcq has quit [Quit: WeeChat 2.3]
ramcq has joined #wayland
spstarr has joined #wayland
alterdiving has joined #wayland
alterdiving has quit []
twinsignal has joined #wayland
twinsignal has quit []
ekurzinger has joined #wayland
<ekurzinger>
Hello, is anyone aware of any Vulkan applications that can use the native Wayland WSI? The only thing I've been able to find is Khronos's vkcube.
<emersion>
anything using glfw or SDL should work too (iirc for SDL needs an env var)
hir0pro has joined #wayland
<jadahl>
ekurzinger: gtk4 has a vulkan renderer that might or might not work
predicativa has joined #wayland
ekurzinger has quit [Ping timeout: 480 seconds]
predicativa has quit [Remote host closed the connection]
pnowack has quit [Quit: pnowack]
cnsvc has joined #wayland
Narrat has joined #wayland
elwolf has quit [Remote host closed the connection]