ChanServ changed the topic of #wayland to: https://wayland.freedesktop.org | Discussion about the Wayland protocol and its implementations, plus libinput | register your nick to speak
<psychon>
it says "it is strongly recommended to make all X11 communications asynchronous"
<psychon>
that makes me wonder: how can I asynchronously "talk X11"? let's say I got a window id and what to get the window's size and coordinates - how would I do that?
<psychon>
s/what to/want to/
<emersion>
psychon: xcb without forcing roundtrips maybe?
<emersion>
psychon: this doc has been written a long time ago
<psychon>
yeah, well, xcb_get_geometry() sends the request and xcb_get_geometry_reply() blocks until the reply arrives
<psychon>
(the request is sent in line 133 and from there to line 175, only xcb_change_window_attributes() is also called, so this is definitely not async)
<psychon>
bummer :(
<emersion>
yes, we aren't good at this in wlroots
<emersion>
tbf, x11 doesn't make it very easy to reduce roundtrips
<emersion>
it would be a bit annoying to asymchronously handle the geometry reply -- would need to delay the xsurface creation a bit
<emersion>
maybe a first good step would be to group sending requests and receiving requests
<emersion>
so that requests get sent in batches
<emersion>
receiving replies*
<emersion>
… tbh maybe a lightweight add-on on top of xcb that adds a wayland-like callback-based API would help make things more async
<emersion>
^ not sure it's a good idea, just throwing ideas around
<emersion>
ah, and one other thing to note maybe: i'd say that roundtrips during "normal" operations are worse than roundtrips during init
<emersion>
xwm or surface init happen relatively rarely
<emersion>
otoh, roundtrip in logic like clipboard data transfers is pretty bad
<emersion>
"pretty bad" as in "blocks the compositor for substantial (?) amounts of time for no good reason"
<emersion>
i've already seen wlroots' xwm completely blocked on receiving a reply from the x11 server, fwiw
hardening has joined #wayland
<psychon>
a callback-based X11 API in C likely ends up being ugly since C has no closures... but I guess you already have that pain with wayland (although wayland is better designed for this)
<psychon>
dunno if you already know this, but there is xcb_poll_for_reply() and you can use that to implement something like this... like, having a queue of pending requests and polling the head for a reply
<psychon>
emersion: would you be interested in a PR that removes the string "_reply(" from wlroots/selection/* and replaces that with something callback-based (and likely more ugly than the existing code)?
<psychon>
never mind, my meson is too old for wlroots
<emersion>
xcb_poll_for_reply will still block right?
<emersion>
(i'm assuming its use-case is threads)
<emersion>
hm that's quite a few _reply instances to fix :S
rasterman has joined #wayland
<psychon>
nah, it either sets sets its void** reply argument to the reply, or its xcb_generic_error_t** argument to the reply, or returns 0 if neither a reply or error was not received yet
<psychon>
and it is documented not to block
<psychon>
it is just like xcb_wait_for_reply() (which is all that e.g. xcb_get_geometry_reply() actually does), but additionally can return "nope, no reply yet"
<psychon>
biggest downside with xcb_poll_for_reply() is that you get to mess with void* instead of having xcb_get_geometry_reply() cast the pointer to the correct type...
<psychon>
or put differently (and a bit simplified): xcb_wait_for_reply() / xcb_get_geometry_reply() calls xcb_poll_for_reply() and if that returns "no reply yet", it calls select() to wait for the connection to the X11 server to become readable
<psychon>
(and that begins again from the beginning)
<emersion>
i see
<psychon>
but even sending a request can block if xcb's output buffer is full and that can still lead to deadlocks (or better: every call to xcb_flush() also blocks)
<psychon>
ugly hack to get rid of that hang: replace the X11 fd with the result of pipe() and start an extra thread that forwards from the pipe to the server and implements an infinite buffer size ;-)
<MrCooper>
that would be consistent with the X server's unlimited client connection buffers :)
aleasto has quit [Quit: Konversation terminated!]
aleasto has joined #wayland
aleasto has quit [Ping timeout: 480 seconds]
flacks has quit [Quit: Quitter]
flacks has joined #wayland
rasterman has quit [Quit: Gettin' stinky!]
nerdopolis has joined #wayland
hardening_ has joined #wayland
hardening has quit [Ping timeout: 480 seconds]
zebrag has joined #wayland
greatwielder[m] has joined #wayland
greatwielder[m] has left #wayland [#wayland]
Lucretia has quit []
Lucretia has joined #wayland
xexaxo_ has quit [Read error: Connection reset by peer]
silver has quit [Remote host closed the connection]
silver has joined #wayland
xexaxo has joined #wayland
xexaxo_ has quit [Ping timeout: 480 seconds]
V has quit [Ping timeout: 480 seconds]
Guest451 has quit [Remote host closed the connection]
dcz has quit [Ping timeout: 480 seconds]
danvet has quit [Ping timeout: 480 seconds]
user has joined #wayland
user is now known as Guest497
antaxiom has joined #wayland
<antaxiom>
Hello
silver has quit [Quit: One for all, all for One (2 Corinthians 5)]
silver has joined #wayland
<antaxiom>
I've been trying to switch to a wayland compositor for a while, but I have been struggling with getting Xwayland to scale in an acceptable manner (eg. not blurred) for my HiDPi displays. Does anyone have any advice on the matter?