00:33riteo: all right, status update: I think that it's just sway/wlroots downscaling stuff fractionally differently than the compositor's cursor
00:33riteo: foot doesn't have this problem on my HEAD build exactly because it uses the pointer manager protocol
00:34riteo: damn, I should really recover my freedesktop gitlab account
00:40kchibisov: riteo: I think this bug in sway is rather old, and it's probably just a sway issue.
00:41kchibisov: it always had issues with cursor scaling.
01:31rayrapetyan: is there any documented or undocumented way to simulate mouse movements and key presses without creating a virtual input device (/dev/input) in wayland? Something similar to XTestFakeKeyEvent.
01:34Max1: rayrapetyan https://gitlab.freedesktop.org/libinput/libei might be helpful if your compositor implements the server side
01:51rayrapetyan: Thanks Max1!
02:38wlb: wayland-protocols Merge request !264 opened by Matthias Klumpp (mak) staging: Add xdg-placement protocol for window positioning in "workspaces" (second version) https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/264
02:46wlb: wayland-protocols Merge request !249 closed (Draft: Add xdg-alignment protocol for window-placement control)
09:12Company: just been reading through the drm-syncobj MR and wondered:
09:12Company: What happens if I attach a new buffer but don't set new acquire/release points?
09:16Company: pq, swick[m]: I cam across https://front-end.social/@leaverou/111491942156530717 today, things in css land seem to be heating up about that - no idea if you're aware of that
09:37MrCooper: Company: I'm arguing we shouldn't allow attaching a buffer to an explicit sync surface without acquire & release points
09:38MrCooper: if we do allow it, it means no synchronization
09:38Company: I've been wondering that about all those recent wayland protocols anyway
09:39Company: each of those protocols add 1 or 2 things that influence how all the other things work
09:39Company: and then in the end it gets real confusing if one of those protocols isn't selected
09:39Company: the buffer placement stuff with viewport and fractional-scaling and whatnot has similar confusion
09:41MrCooper: this isn't quite the same though, explicit sync has to be enabled for the surface in the first place, or the sync points can't be set anyway
09:41Company: yeah
09:42Company: but once it is enabled, you shouldn't use it without
09:42emersion: i still think the release point should be optional
09:42MrCooper: yep, I'm arguing that should be a protocol error
09:42Company: like, I'm not sure if enabling explicit sync and then using wl_buffer.release is a good idea
09:42Company: or not setting sync points
09:43emersion: maybe the buffer is already ready
09:43emersion: for acquire
09:43MrCooper: emersion: the client is free not to wait for it to signal
09:43emersion: but why the artificial restriction?
09:43MrCooper: because it's required in the common case
09:43emersion: why force clients to allocate and manage an extra useless timeline?
09:44emersion: especially if it's not more work for the compositor
09:44MrCooper: the protocol should be designed for the common case, not for special cases
09:44emersion: it's not a special case
09:45MrCooper: seriously?
09:45Company: emersion: what does it mean if there's no release point?
09:45Company: emersion: that the client says "I'm gonna reuse the buffer right now while it's still attached"?
09:45emersion: it means the client uses the regular release events
09:45emersion: no
09:46Company: oh hm
09:46MrCooper: it means no synchronization takes place on release
09:46Company: yeah, that's what I think is a bad idea
09:46Company: when you start to mix and match, you end up with too many combinations nobody thought about
09:47emersion: the combination needs to work either way
09:47emersion: release isn't going away from core wl
09:47emersion: and i think most clients won't care about the fenced release anyways
09:47Company: you could say "once an explicit sync is created, buffers attached to here are not going to emit release events"
09:47emersion: they have a swapchain, they want to know when it's safe to re-use
09:48MrCooper: emersion: you're saying most clients won't care about corruption artifacts?
09:48emersion: that is not the case
09:49MrCooper: what do you think the release points are for then?
09:50MrCooper: if the client starts drawing the next frame before the compositor has finished reading from the buffer, you get artifacts
09:52emersion: it seems there is a misunderstanding here
09:54Company: emersion wants to use wl_buffer.release() instead of the release point
09:54Company: right?
09:54emersion: the compositor sends core release when it's finished operating on the buffer
09:55emersion: (doing other things now, brb)
09:59Company: MrCooper: I was reading through your comment on https://gitlab.com/qemu-project/qemu/-/issues/1973 and was wondering how you'd design such an API
10:00MrCooper: the release event doesn't mean the GPU has finished reading from the buffer, that's what the release point is for (or implicit sync handles it magically)
10:00Company: Would you treat buffers as pre-created object like in Wayland and essentially establish a pool?
10:00Company: Or would you just send dmabuf fds?
10:01MrCooper: haven't really thought about that
10:01Company: I've been very interested in how those things are handled across graphics APIs recently
10:02Company: because I'm wondering if GTK should have a bufferpool abstraction
10:02MrCooper: my point is mainly that there needs to be explicit ownership transfer
10:02Company: yeah, that one is obvious
10:02Company: you need acquire/release
10:06Company: the Vulkan and Wayland model do buffer pooling - Vulkan does it internally inside the swapchain, Wayland makes the client create/destroy wl_buffers as needed and also allows mixing and matching those buffers between surfaces
10:08Company: GStreamer has explicit GstBufferPool objects
10:10Company: which kinda work like Vulkan swapchains, if you look at Vulkan as the consumer and not Wayland (and the application as producer)
10:12Company: I didn't look too dep into pipewire, but I think pipewire has some pool-like concepts for producers (ie the screencast portal), but not for consumers
10:14Company: and GPUs have been using timeline semaphores recently to do the acquire/release thing
10:14Company: and now it's coming to Wayland
10:15Company: but I have no idea how far this should go - like, should GTK, GStreamer, pipewire, etc all switch to that? Why/Why not?
11:04staceee: hello o/ what should I marshal send to the compositor if an argument is null? example here: get_layer_shell *output
11:04staceee: I tried u32 0
11:35staceee: an empty array of course!
11:35MrCooper: Company: to me the Wayland (& X Present) model seems the most flexible, I guess I'm biased though :)
11:36Company: we're all biased
11:36MrCooper: Company: you mean why should GTK, GStreamer, pipewire etc. switch to explicit sync? The biggest incentive right now is probably to avoid glitches with the nvidia driver (without doing synchronous CPU waits)
11:38Company: so you're saying we let the VM allocate buffers, register them with the host (and allow the host to reject them), and then the buffers can be set as the current contents
11:38Company: and the host releases them when done
11:38MrCooper: yeah
11:39Company: that's slightly different from Vulkan and GL
11:39Company: because Vulkan and GL do not let the client manage the unused buffers
11:40Company: Vulkan and GL also do the allocation and just let the client set a min/max amount of buffers
11:41Company: MrCooper: as for the timelines, I wasn't as much thinking about explicit vs implicit sync (to me that's just a question of how attach/release is implemented), but about using timeline syncobjs in particular
11:42Company: or drm_syncobjs or whatever that fd thing is called
11:44MrCooper: that's required for some Vulkan use cases involving presentation before submitting the corresponding GPU work; might not be strictly required for other APIs, but if you do explicit sync anyway, might want to keep the option available
11:44Company: how do drm_syncobjs relate to dmabuf sync files?
11:45Company: are they different things?
11:45MrCooper: explicit sync which requires the GPU work to be flushed first doesn't buy any fundamental benefit over implicit sync
11:46MrCooper: yep, different primitives
11:47MrCooper: in a nutshell, a sync file represents a single concrete fence, a timeline syncobj a sequence of (possibly future) fences
11:48Company: so there will be a question about attaching drm_syncobjs to dmabufs
11:48Company: in some form
11:49Company: because if Boxes gets a buffer from the VM, we want it to come with a syncobj
11:49Company: so that we can pass it right through to the compositor
11:50MrCooper: specifically acquire and release points on the timeline, yeah
11:50Company: yeah, I guess that's a separate thing and not really part of the dmabuf
11:51MrCooper: not really
11:51MrCooper: the acquire & release points are what define the transfers of GPU ownership
11:53Company: I'm thinking about ownership transfers between VM, Boxes/GTK and host compositor here
11:53MrCooper: the consumer's GPU work must not read from the buffer before the acquire point has signaled, and the producer's GPU work must not write to it again before the release point has signaled
11:54Company: though technically it's application in VM, VM compositor, CM kernel, Boxes, host compositor and host kernel
11:54Company: *VM kernel
11:55Company: if you run a maximized app in a maximized Boxes VM, that should give you direct scanout on the host - but you need to pass the acquire/release steps through all those subsystems
11:56Company: ideally you want to pass through the acquire/release points everywhere
11:56Company: but that requires you to have previously setup the syncobj fd
11:58Company: and attach it to some object - on Wayland that's the wp_linux_drm_syncobj_surface_v1 but that needs an equivalent in the qemu API
11:59MrCooper: yep
11:59MrCooper:→ lunch, bbl
11:59Company: GTK's graphics offload doesn't have that either
12:01MrCooper: technically it's not required with Wayland, it's just that nvidia doesn't handle implicit sync, so you get glitches with that combination
12:02Company: the biggest thing with GTK's API is that we have a wrapper object around the buffer that we keep alive while the buffer is in use
12:03Company: which means we use wl_buffer.release() to confirm that we're done with the buffer and only would pass that info onwards
12:05Company: because our buffer objects are read-only (unlike wl_buffer), so that API works different
12:57pq: Company, I had't seen that, thanks. That gamut clipping things reminds me of the gamut parameters in HDR static metadata; no(?) computer monitors make use of them, so games can put garbage there.
14:15emersion: MrCooper: so my understanding was that implicit sync was disabled when the protocol is used, so core release would be sent when the release point is signalled
14:16emersion: and so the release point would just be an optimisation
14:17emersion: but yeah, reading the protocol again nothing is really said about core release
14:18emersion: so we'd have to pick an option (undefined, never sent, sent on release point signalling) and specify that
14:34jadahl: can't core release be left to what it is, i.e. when the compositor itself is done with it, just that it doesn't mean anything about the DMA buf resource backing it, i.e. unreliable when explicit sync is needed
14:36emersion: so a compositor sending release immediately would be correct?
14:36emersion: same as undefined from my PoV
14:40MrCooper: to me it's always been clear that it's as jadahl describes, explicit sync is for the same thing as implicit sync, it doesn't directly affect the release event
14:41MrCooper: which means the release point is required for correct explicit synchronization in the common use case
14:42emersion: wl_buffer.release relies on implicit sync for DMA-BUFs, the extension explicitly disables implicit sync, so wl_buffer.release is impacted either way
14:44MrCooper: wl_buffer.release relies on separate GPU synchronization, which can be implicit or explicit
14:46MrCooper: note that a client using the syncobj protocol doesn't have to listen to release events at all, it can just wait for the release points to signal
14:47emersion: my point is that wl_buffer.release is meaningless when used with explicit sync, if it's not sent on point release
14:47emersion: meaningless as in, the compositor can send it anytime, it doesn't change anything for the client
14:48MrCooper: that is true and basically the same with implicit sync, the only constraint being it cannot be sent before flushing the last GPU work reading from it
14:49emersion: that's very different from implicit sync
14:49MrCooper: for similar reasons, a compositor which sends out the release event before a fence has materialized for all release points would be kind of mean
14:50emersion: why?
14:50MrCooper: emersion: I'm afraid you're making some assumptions which aren't universally shared, nor written down AFAIK
14:50emersion: i'm afraid nothing is written down at this point, your assumptions aren't either
14:50MrCooper: emersion: because it could result in the client submitting GPU work which then has to wait indefinitely for a release point to signal
14:51jadahl: I think what makes most sense is to define 'release' as either undefined or "when the compositor is done" (a.k.a. what it does now), so that compositors don't need to special case .release when the explicit sync extension is in use
14:51emersion: "when the compositor is done" is meaningless
14:51emersion: maybe the compositor passes on the unmaterialised syncobj from a parent compositor
14:51jadahl: pretty meaningless, true, but I'd like to avoid having to special case it
14:52MrCooper: I propose "not before a fence has materialized for all release points"
14:52emersion: no
14:52MrCooper: yes, I do
14:53emersion: wait-before-signal is a major reason why we're using drm_syncobj here
14:53emersion: you're just removing half of the protocol's reason for existing here
14:53MrCooper: this doesn't prevent wait-before-signal
14:53emersion: this is the worst of both worlds
14:54emersion: compositors now need to CPU-wait to send wl_buffer.release, but clients can't really use that in any meaningful way
14:54MrCooper: if we can't require that, clients have to wait for fences to materialize, and the release event is useless with explicit sync
14:56emersion: why would clients need to wait for fences to materialize?
14:56emersion: as opposed to either waiting for the fence to complete, or just using the syncobj as-is
15:07wlb: weston Merge request !1410 opened by Loïc Molinari (molinari) gl-renderer: Async output capture support https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1410
15:21wlb: weston/main: Arnaud Vrac * gl-renderer: do not use glTexImage3D directly https://gitlab.freedesktop.org/wayland/weston/commit/9c637d70ebea libweston/renderer-gl/ gl-renderer-internal.h gl-renderer.c gl-shader-config-color-transformation.c
15:21wlb: weston Merge request !1395 merged \o/ (gl-renderer: do not use glTexImage3D directly https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1395)
15:44riteo: kchibisov: I see, thanks for letting me know. So wlroots is probably fine?
15:44kchibisov: riteo: yeah, pretty much.
15:44riteo: great
15:45kchibisov: I remember sway has like a dozen issues around cursor scaling, and some more around fractional scaling.
15:46kchibisov: So if you use fractional scaler, and you never see an event comming for the surface you've created a manager in WAYLAND_DEBUG logs, it's not your issue.
15:46kchibisov: Assuming you actually did `set_cursor` call, since you still must commit cursor to actually get event.
15:49zamundaaa[m]: MrCooper: I don't think the release event being useless with explicit sync is a problem. Why would you need it?
15:50zamundaaa[m]: If a client wants to know when the buffer is available to use on the CPU side, it can just wait on the release point being signalled, instead of waiting for the release event
15:52zamundaaa[m]: Which also avoids the release event's race condition with the case where a buffer is used on multiple surfaces
16:51MrCooper: emersion zamundaaa[m]: waiting for the fence to complete first means less CPU & GPU concurrency than possible; using the syncobj as-is means the GPU work may be delayed longer than necessary (if there's another buffer available which doesn't have outstanding GPU work or at least has a fence for it)
16:53zamundaaa[m]: Sure, there's tradeoffs. Tradeoffs that the client can make just fine without retroactively changing what the release event means
16:53MrCooper: the client can avoid both by waiting for a fence to materialize, but then the release event is useless
16:53zamundaaa[m]: Yes. Where's the problem?
16:54MrCooper: it's a performance trap for clients which needs to be clearly documented at least
16:55MrCooper: unless you want to see Phoronix benchmarks showing that explicit sync is slower than implicit ;)
16:55zamundaaa[m]: It would be exactly the same if the client uses the release event. Documenting that the time at which the buffer gets released is up to the compositor implementation and not predictable would certainly be good though
16:56zamundaaa[m]: Oh, I see what you mean now
16:56MrCooper: zamundaaa[m]: if the release event was specified to be sent only once there are fences for all release points, the client could rely on that instead of waiting for fences to materialize itself
16:57emersion: i don't understand
16:58emersion: clients can easily wait for the fence to materialize if that's good for their use-case
16:58emersion: with the timeline point
16:58zamundaaa[m]: emersion: When the client receives the release event, it can safely use the buffer for submitting graphics work, with the release point being used as a semaphore before the GPU can actually start accessing the buffer
16:58emersion: no need to force compositors to do weird stuff with wl_buffer.release
16:58MrCooper: I agree it's not hard for clients to do the right thing, they just need to know to avoid the trap
16:58zamundaaa[m]: Without running into the risk that the compositor will still hold the buffer for a few more frames
17:00MrCooper: *traps
17:00zamundaaa[m]: Iow, if a compositor would release the buffer a long time before it signals the release point, the client would get stalled unnecessarily. Fixing that doesn't necessarily require a hard definition of when the release event must be sent, but the protocol should mention that the compositor needs to take care with this
17:02zamundaaa[m]: Otoh, it's the exact same situation as we have now. If the compositor releases a buffer just after submitting a lot of graphics work in advance, implicit sync might slow down the client
17:03MrCooper: I don't see what purpose the release event would serve though (other than being something that could make things go wrong), if the client has to wait for fences to materialize anyway
17:05MrCooper: zamundaaa[m]: true, so explicit sync gives the client the means to do better than implicit in this respect, by preferring buffers with no outstanding GPU work
17:06zamundaaa[m]: yeah
17:07MrCooper: I guess in principle that could be done with implicit sync by polling a dma-buf fd
18:49riteo: kchibisov: btw the cursor was indeed mapped but I asked the request _before_ setting its surface as such
18:49riteo: anyways that's a non-problem as I don't plan to reload the cursor theme "fractionally", instead letting the compositor downscale it for me from a higher scale one.
18:50kchibisov: Then you don't even need fsr if you want to do so.
18:50riteo: indeed
18:50riteo: I thought I had to do some weird thing to let it scale properly but it's just a bug as you said
18:51kchibisov: sway can't downscale cursor with fractional scaling eithir.
18:51kchibisov: unless it was fixed, but last time I checked it was still an issue.
18:51riteo: it looks like the issue's still there with HEAD
18:52kchibisov: https://github.com/swaywm/sway/issues/5202
18:53kchibisov: there's also https://github.com/swaywm/sway/issues/5203
18:53riteo: mh I see
18:53riteo: I wouldn't mind giving a help if needed
18:54riteo: I've never worked with this stuff though, so I don't know if that'd be excessively hard
18:54riteo: anyways, thanks for the clarification!
18:55kchibisov: You can ask in #wlroots on irc.libera.chat, but right now sway is pretty bad target to test fractional scaling.
18:56kchibisov: https://github.com/swaywm/sway/issues/7463 like this thing is a bigger problem.
19:00riteo: mhh, I understand
19:00riteo: I thought that this was wlroot's responsibility, why's sway managing it?
19:00kchibisov: I was told that it's sway bug.
19:01emersion: there's a lot of legacy in sway
19:01emersion: hopefully scene-graph conversion will help
19:02riteo: I already tried that PR (funnily, I already had it but I switched back to be sure)
19:02riteo: doesn't fix the weird cursor size inconsistency
19:02riteo: sadly
19:02kchibisov: The only way to deal with legacy is to `rm -rf` it.
19:02riteo: indeed
19:03kchibisov: sadly noone has resources to do such things.
19:03riteo: oh look at that, the MR linked by emersion indeed confirms that the cursor doesn't send frac scale events: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4065
19:04kchibisov: yeah, but it has nothing to do with 2 issues about cursor I've linked.
19:04riteo: yeah
19:04riteo: but at least I didn't mess up with manually attempting to frac scale it (the original issue I talked about here)
19:05emersion: i don't think sway should use ceil
19:05kchibisov: no-one should use ceil.
19:05emersion: but that's what you suggest in the issue?
19:05kchibisov: in which one?
19:05emersion: first linked
19:06riteo: the issue's different than what you think I mean
19:06kchibisov: emersion: could you link where I'm talking about ceil.
19:06kchibisov: I don't have `ceil` matched with firefox search.
19:06riteo: the thing is that sway's "built in" cursor is different than a similar n-scaled one where n is a buffer scale > 1
19:06emersion: https://github.com/swaywm/sway/issues/4927#issuecomment-612043427
19:07kchibisov: emersion: client doesn't know about FSR.
19:07riteo: then that's a buffer scale
19:07kchibisov: you're sending clients the scale which is ceil(fsr).
19:08kchibisov: So sway should use the same scale it sended to clients to look consistent.
19:08emersion: "FSR" is super confusing lol
19:08emersion: i was thinking you were talking about AMD FSR the whole time
19:08kchibisov: I mean, in 2020 we only had integer scale.
19:08kchibisov: So sway using 1.3333 means that clients get scale 2.
19:08kchibisov: So they use that to _size_ the cursor.
19:08riteo: yeah, but that's a buffer scale
19:08riteo: the compositor should scale it down further, no?
19:08emersion: kchibisov: yeah, hence i think it's not relevant anymore
19:09kchibisov: yes, but not fractional scaling clients will do things around the same.
19:09riteo: emersion: there's still a scaling difference though
19:09riteo: looks to be a few pixels off, so perhaps it's some rounding thing
19:09emersion: kchibisov: it's an impossible situation to fix: fix one, break the other
19:09kchibisov: You don't need to use ceil, you should ensure that the end size of the cursor wil be consisnent.
19:10emersion: there is no way to do this, since some clients will use ceil()'ed scale, and some not
19:10kchibisov: I mean, you have a target size of X * Y.
19:11emersion: sure. and "old" clients use ceil(X) * Y
19:11kchibisov: So good clients will match it, the ones using `ceil` will have downscaling, and ones using one will upscale.
19:11kchibisov: fsr will have it _exact_.
19:11kchibisov: fractional scaling clients*
19:11emersion: yeah
19:11riteo: but shouldn't the compositor down/up-scale any integer scaled buffer?
19:12kchibisov: it's impossible to solve without scaling, but nothing stops you from doing so.
19:12emersion: fractional-scale clients will match, wl_surface.preferred_buffer_scale clients won't
19:12kchibisov: The linked issues was about different visual sizes, not bluriness in particular.
19:12emersion: i'm not sure i'm following, kchibisov
19:12emersion: yes
19:12emersion: i don't think there is a way to fix it for all clients
19:13riteo: why's that? The mouse cursor surfaces are all integer ("buffer") scaled AFAICT
19:13kchibisov: because client can set larger cursor intentionally?
19:13emersion: hm, maybe that's the missing piece:
19:14emersion: libwayland-cursor will not return a cursor whose scale matches the input size necessarily
19:14emersion: it'll return a theme with size >= the one passed in
19:14riteo: ok
19:14riteo: I'm aware of that
19:14kchibisov: Like I don't see issue of 1. ratio to scale 2x to fractional scale and then downscale by that amount.
19:15riteo: but, if a "dumb" window gets scaled up/down to accomodate fracscale, why not do the same thing for a cursor?
19:15kchibisov: Or, you mean that sizes will break, because request to libcursor is different.
19:15riteo: since it's not fractional, however big that is, we can just up/down scale it accordingly, no?
19:15emersion: that should be the case…
19:15riteo: sway's cursor is sligtly smaller/blurrier while application cursors are not
19:15kchibisov: yeah, the issue is sway internal cursor is bugged.
19:16kchibisov: cliets look fine-ish.
19:16riteo: and I confirmed that a cursor smaller than 24 doesn't exist in my theme, so it's not the xcursor behaviour doesn't justify this weird quirk
19:16riteo: (oops I malformed a the phrase, sorry)
19:16riteo: (again)
19:16kchibisov: Well, the only way is to use cursor-shape.
19:16kchibisov: but sway should at least always render its cursor crisp.
19:16riteo: indeed, with cursor-shape clients look fine, like foot
19:17riteo: emersion: don't hesitate to ask if you are having trouble staying on the same page with us
19:17riteo: (or if you are already and _we_ are misundeerstanding something)
19:17emersion: yeah, sorry, i'm lost here, and ENOTIME
19:17riteo: oh
19:17riteo: if you don't have time nw
19:18riteo: we can discuss about it later
19:18kchibisov: emersion: both issues I've linked were about sway builtin cursor.
19:18emersion: ty for taking the time to try to discuss
19:18kchibisov: I do understand now that you can't really scale to the same sizes, because the way cursors are picked.
19:18riteo: emersion: nw :)
19:19kchibisov: So to solve issues I've linked sway should just render its cursor at the scale it uses.
19:19kchibisov: When using fractional scaling, if it's the case already, you can close issues.
19:20kchibisov: But it clearly wasn't the case even a year ago.
19:20riteo: kchibisov: I think it's probably just some weird edge case with frac scale. I don't know wlroots/sway well so I can't really say anything more specific than that
19:20kchibisov: riteo: the issues I've linked has nothing to do with the protocol itself.
19:21kchibisov: because it's when the cursor over sway's decorations, like borders, titlebars.
19:21riteo: I haven't talked about the protocol
19:21kchibisov: I mean, I know that it's a fractional scaling issue.
19:21riteo: like, literally what wlroots or sway do to scale "dumbly scaled" surfaces
19:21riteo: you know, the "fallback" serverside frac scale thing
19:22Nefsen402: sway doesn't do that. It supports fractional scale and viewporter protocols
19:23kchibisov: doens't do anymore?
19:23riteo: yeah, but what if a client doesn't create fractional surfaces and only buffer scales them?
19:23riteo: IIRC it downscales them to the fractional scale as a last resort
19:23Nefsen402: no compositor is able to deal with that properly
19:23kchibisov: be aware that sway used fractional scaling way before protocols/viewporter.
19:23riteo: mh
19:24riteo: it's a bit weird though that for some reason the downscaled server cursor is different than the downscaled client cursor
19:24riteo: might be because of buffer scale differences perhaps
19:24kchibisov: riteo: server shouldn't downscale anything.
19:24riteo: wait, why?
19:24kchibisov: it's literally picking the cursor out of the theme and passes to render, it's just what the bug was about, since sway started scaling, etc.
19:25riteo: sorry, I'm getting a bit confused
19:25kchibisov: I mean, compositor doesn't have a concept of scaling in itself.
19:25kchibisov: unless toolkit defined it.
19:25emersion: the server may need to downscale, because the XCursor size doesn't match the configured size
19:25riteo: I'm noticing a difference in the cursor when setting the global scale to, for example, 1.5
19:26kchibisov: yeah, it can downscale, but generally, server side created elements can't be blurry unless you did that on purpose.
19:26riteo: now, if I add a, for example, cursor with a _buffer_ scale of 2, the resulting cursor is definitely differently scaled
19:26riteo: they're both clearly downscaled, just in a different way for some reason
19:26riteo: oh wait sorry, upscaled
19:27riteo: as emersion noted the XCursor theme can offer only certain sizes, so it's not guaranteed that you get a cursor with the exact size you ask
19:27kchibisov: I'm not even sure that you know what you got.
19:27emersion: you do
19:27riteo: you can know
19:27kchibisov: The target size?
19:28kchibisov: Cursor could be lower than that.
19:28emersion: hm, maybe not from a client
19:28riteo: just query the cursor size, the wayland-cursor library's structs are "open"
19:28riteo: you can get the cursor image and look for its width/height members
19:28kchibisov: you know, all cursor sizes are dividable by 2, yet we have crashes due to buffer scale missmatch.
19:29kchibisov: riteo: you can, but you don't know whether it's 24 theme or 16 theme.
19:29riteo: mh? You _can_ query the resulting image
19:29riteo: so you can ask for, dunno, 26 and check what you actually got
19:29kchibisov: it's not 24x24.
19:29kchibisov: you can have 1x1 cursor in 24x24 theme.
19:29riteo: yes
19:29riteo: but my current theme _doesn't_
19:30riteo: and I can (and _did_) query for what the library could get
19:30riteo: I found out about this while experimenting around this issue
19:31kchibisov: is it just `size` field in libxcursor?
19:31kchibisov: yeah, seems like nominal is passed around.
19:31riteo: I'm talking about the `wl_cursor_image` struct
19:31riteo: what's returned by wayland-cursor
19:31riteo: it has width, height, delay and hotspot coordinates
19:31kchibisov: my clients don't use that thing.
19:32riteo: ¯\_(ツ)_/¯
19:32riteo: (oops, used the /shrug command and it's way more smiley than I remembered)
19:32riteo: (didn't mean to sound rude or anything)
19:33riteo: I don't really know anything about using that library directly, sorry
19:33kchibisov: I don't even use that library directly,
19:33kchibisov: I just parse themes myself.
19:33riteo: oh cool
19:35kchibisov: but yeah, libXCursor seems like communicates whether it picked what you requested or not.
19:36riteo: indeed
19:36kchibisov: Anyway, nothing of that justifies blurry server side cursor.
19:36riteo: maybe it does some magic with the way it loads the theme? I'll take a look into wlroots, I can't really find a lot in sway
19:37kchibisov: I mean, it was discussed, and last time I checked it had a bit weird conversions.
19:37kchibisov: And the way it picked a theme.
19:37emersion: right now, it's supposed to pick a theme >= config*scale
19:37emersion: if > that size, scale it down to exactly match the config
19:38kchibisov: yeah, and in the past it did something like that, but upscaled it.
19:38kchibisov: so cursor was very big compared to anything else.
19:38emersion: that shouldn't be the case anymore
19:38kchibisov: If you can run sway with 1.5 scale and the cursor over borders will be crisp you can close my issue.
19:39kchibisov: I don't have sway around, so it'll take me _time_ to build/figure out.
19:39riteo: I don't think the issue is it even being crisp
19:39kchibisov: before it was just massive blurry cursor.
19:39riteo: oh it's not massive at all
19:40emersion: it matches nautilus for me
19:40kchibisov: like it was 48x48 and not scaled.
19:40emersion: at 1.75 scale
19:40riteo: it's small and blurry, but that's to be expected
19:40riteo: but it's now indeed small
19:40riteo: the issue I'm having is how it scales the client's buffer scaled cursor surfaces
19:40kchibisov: emersion: then you can close the issue, if it's around the same size.
19:40riteo: I think we're talking about different issues
19:41kchibisov: if it works accross `swaymsg scale 2 -> 1.75` and results in the same looking cursor as with 1.75 scale, you can close other one as well.
19:41emersion: kchibisov: i consolidated a lot of the cursor code inside wlroots in this release cycle
19:43emersion: yep, all of these work fine now
19:43kchibisov: Then close both issues.
19:43emersion: there is still a small difference in size, but that's because nautilus uses integer scale and sway doesn't
19:44emersion: but yeah the scale changes are handled in wlr_cursor now
19:45riteo: emersion: would it be possible to fix the difference in size?
19:45riteo: just asking to see if it's known or not so that I don't waste anybody's (including mine) timme
19:46riteo: *time
19:46kchibisov: riteo: only with shape protocol.
19:46emersion: i don't think it's possible to fix the difference in size between clients using fractional-scale and clients using integer scale
19:46emersion: (latter being same as compositor-side cursors rn)
19:47emersion: (same size, that is)
19:47riteo: emersion: clients with int-scale and sway's cursors are differently sizes
19:47riteo: lightly though
19:48emersion: yup
19:48kchibisov: you can't fix it because of how cursor themes work.
19:48emersion: you could fix it maybe on the client side
19:48riteo: emersion: so it should be possible to fix at least that issue (int client -> compositor)?
19:49emersion: if you go through the trouble of upscaling the cursor to the proper 2x size before sending them to the compositor
19:49emersion: but libwayland-cursor can't do that
19:49kchibisov: emersion: you should at least know what you got though?
19:49kchibisov: I don't think it's exposed anywhere except libXcursor.
19:49emersion: kchibisov: libwayland-client is pretty opaque… only gives you a buffer and that's it
19:49riteo: emersion: oooooh now I think I get it
19:50emersion: -cursor*
19:50emersion: maybe clients could use viewporter?
19:50kchibisov: Yeah, we do around the same in wayland-rs.
19:50emersion: just throwing ideas around
19:50kchibisov: viewporter is a good way to protect against buffer missmatches.
19:50emersion: at some point, just use cursor-shape tbh
19:50emersion: yeah
19:51emersion: we can't do this in libwayland-cursor directly sadly
19:51riteo: no wait I'm seriously failing to understand why a 2sized buffer with, eg, a 24x2 =48 sized buffer couldn't get properly forcibly "upscaled" to 1.5x by the compositor
19:51riteo: or is that already happening and it's not the same thing that the compositor does on its own cursor
19:51kchibisov: themes are weird.
19:51emersion: riteo: the problem is likely that sway uses a 32 xcursor theme and the client uses a 48 xcursor theme
19:52kchibisov: Buffers of the cursors between theme sizes couldn't change linearly.
19:52emersion: or something
19:52riteo: emersion: my setup uses 24
19:52riteo: as the default theme size
19:52emersion: but that size is multiplied
19:52kchibisov: yes, but once you start scaling you pick multiplied.
19:52emersion: by 1.5 in sway, and 2 in the client
19:52riteo: oh
19:52riteo: so sway does indeed do something differently, doesn't it?
19:52kchibisov: And 32 and 48 could have buffers which you can't scale by 48 / 32.
19:52riteo: does it scale the buffer's contents manually?
19:52emersion: yes, because it knows the fractional scale
19:53riteo: oh I see
19:53kchibisov: just use shape protocol, and custom cursors are not an issue.
19:53riteo: yeah I think we're going to do that with Godot once it becomes a bit more widespread
19:54kchibisov: I mean, you should have fallback path.
19:54riteo: indeed
19:54riteo: we're prioritizing other stuff rn as it's still very WIP
19:54riteo: there are also some API incompatibilities between godot and wayland that we'll have to tackle somehow, but that's another story
19:54riteo: still, by 4.3 we'll have something merged in
19:55kchibisov: I know that bevy has fractional scale/shape stuff :p
19:55kchibisov: never looked how it ends up looking for them though.
19:56riteo: oh we have frac scale too
19:56q234rty: well, I just built my cursor theme with support for 24*1.75=42 xcursor size :)
19:56riteo: that's why I stumbled on this issue :P
19:56riteo: q234rty: you're playing 4D chess lmao
19:57riteo: btw last day I was talking with orowith2os[m] about the idea of a simplified vector format for cursor themes
19:57riteo: (also some interesting pointer wrapping/warping stuff but I still have to recover my gitlab account :( )
19:58q234rty: well, it was super simple for the cursor theme I have used, as it's build script allows building any size
19:59q234rty: linking my issue here as I believe its relevant: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3643
20:00riteo: indeed
20:00riteo: that's exactly what I noticed