Commit graph

1946 commits

Author SHA1 Message Date
Ian Douglas Scott
ddc23fcaa5 Set primary scanout output for dnd icon surface
It can still get unthrottled frame callbacks by not having any primary
scanout output, but presumably we want this. Alongside the code setting
it for cursor surfaces, and dragged windows.
2025-06-10 19:24:05 +02:00
Ian Douglas Scott
fde5b9aa91 Send frame callback for dnd icon surfaces
`org.gnome.gitlab.YaLTeR.Identity` is a good way to test animated dnd
surfaces.
2025-06-10 19:24:05 +02:00
Ian Douglas Scott
b823dd4247 kms/surface: Split off part of redraw into take_screencopy_frames 2025-06-10 16:01:04 +02:00
Ian Douglas Scott
e80e46e911 kms/surface: Update how errors in send_screencopy_result are handled
Previously, some errors in the screencopy code resulted in `redraw`
returning an error, while others make the screencopy frame fail, and
logged a warning.

Instead, make all errors here log a warning, and call `reset()` on the
session, but continue running `redraw()`.

Calling `frame.error` explictly isn't needed, since the same error will
be sent on drop otherwise.
2025-06-10 16:01:04 +02:00
Ian Douglas Scott
ca817e2579 kms/surface: Split off part of redraw into postprocess_elements 2025-06-10 16:01:04 +02:00
Ian Douglas Scott
39b1ac2955 kms/surface: Split off part of redraw into a send_screencopy_result
This should not change behavior in any way.
2025-06-10 16:01:04 +02:00
Victoria Brekenfeld
e94377f4de chore: Update smithay 2025-06-03 15:38:44 +02:00
Ian Douglas Scott
4fa3113c76 Update smithay
https://github.com/Smithay/smithay/pull/1748
2025-06-02 18:58:49 +02:00
Ian Douglas Scott
f86cd933d4 kms/surface: Call cleanup_texture_cache for each device at end of draw
Fixes an issue where a dual GPU system would keep allocating dGPU PBOs in
`cpu_copy()` every frame, but `cleanup()` was not being called, since the
surface thread for the builtin output was rendered on the
primary/integrated GPU, targeting the same GPU.

Even if a different monitor was compositing on the dGPU, That wouldn't
help since that thread has it's own `GpuManager` with it's own renderer
and cache.

Running cleanup at the end (or start) of each frame seems like a good
idea. Not sure if it would be best to avoid additional calls, or if
that's desirable/fine.
2025-06-02 18:58:49 +02:00
Ian Douglas Scott
619e994955 kms: Fix inconsistent selection of primary GPU
Instead of choosing a primary GPU the first time `device_added` is
called (and then not updating it on the next call, even if that should
be the primary GPU), set the primary GPU only after all devices have
been initially added, and on future changes.

Alternately, the `was_empty` test can just be removed, but it's probably
best not to select the primary GPU multiple times each time the
compositor starts on a multi-GPU system.

Fixes https://github.com/pop-os/cosmic-comp/issues/1437.
2025-06-02 12:22:13 +02:00
Victoria Brekenfeld
087ebaa2c7 xwayland: Delay selection notify until focused 2025-05-30 18:32:24 +02:00
Victoria Brekenfeld
b5e60fcde5 wayland/decorations: Fix xdg-decoration state always shadowing kde-decorations 2025-05-30 17:28:51 +02:00
Victoria Brekenfeld
c5708cd607 wayland/decorations: Fix early requests with kde-protocol 2025-05-28 14:38:30 +02:00
Victoria Brekenfeld
359c3ad899 kms: Various gpu removal fixes
- Remove gpu from `kms_state.api` as well
- Don't use `from_node_id` on device removal
- Free resources asap via `refresh_used_devices`
2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
3d3a566a3c kms: Always send frame callbacks 2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
a65e1d6b5f debug: More profiling annotations 2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
465813c1c5 shell: Using parking_lot's RwLock for fairness guarantees 2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
8194be30c6 kms: Allow updating the primary node
Add more sophisticated code to handle the primary node disappearing.

Also overhaul the selection logic to respect our allow/deny-list and
prefer devices with built-in connectors before using the boot gpu.

This will also allow triggering a primary node switch at runtime
for debugging purposes in the future.
2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
4c0c61e94b chore: Update smithay 2025-05-27 20:00:21 +02:00
Victoria Brekenfeld
913ed90b04 kms: Add allow/deny-listing of drm devices 2025-05-27 20:00:21 +02:00
Ian Douglas Scott
b5d5479b86 Update to zbus 5.x
Depends on https://github.com/pop-os/libcosmic/pull/682.
2025-05-23 19:24:52 +02:00
Ian Douglas Scott
7ee48e5444 Don't change focus on click of layer with KeyboardInteractivity::None
Previously, a click on a client like squeekboard would give keyboard
focus to the window behind it, if any.

If we are in the input region of the layer surface, we shouldn't give
keyboard focus to the surface behind it on click. And should just leave
the focus unchanged. Returning `None` here seems to be correct.
2025-05-21 12:16:39 -06:00
Ian Douglas Scott
194d5c8967 protocols/screencopy: Make frame/session send stopped/fail on drop
Previously, `Frame` was stored in KMS frame udata, but in some cases the
udata was dropped without a capture happening, and `Frame` did not
implement `Drop`, so `fail` was never sent.

Instead, rename `DropableFrame` to `Frame` and `Frame` to `FrameRef`, so
we can have a single instance of `Frame`, that will send `fail` on drop.
This guarantees either `.success` or `.fail` are send, as long as its
not leaked.

This seems to fix https://github.com/pop-os/cosmic-comp/issues/1305.
xdg-desktop-portal-cosmic prints an error, buy retries (as it should for
an `Unknown` error; though maybe there should be a retry limit) and the
session continues working.

(Not sure if it should be sending `failed`, or queing it with the next
frame so it can send `success` to the client, but this works and is
desirable as a failsafe anyway.)

`Session` and `CursorSession` are similiarly updated.

`.fail()`, `.success()`, and `.stop()` now consume
`Frame`/`Session`/`CursorSession`. So to stop a session, it is now
necessary to call `.remove_session()`, but then simply dropping with
send `.stop()`.

Factoring out some `Request::Capture` handling into a `capture_frame`
function seems to clean up error handling and such a bit.
2025-05-19 16:53:46 -07:00
pugaizai
9c7033df10 i18n(zh-CN): update translation 2025-05-19 21:52:09 +02:00
Antonio Félix
07e5c374b2 i18n(es): Add spanish translation 2025-05-19 21:51:31 +02:00
Ian Douglas Scott
b4db2498de Remove deprecated call to time's set_soundness function
No longer required.
2025-05-19 21:29:51 +02:00
Ian Douglas Scott
d3822d161a .github/workflows/build.yml: Pass +stable to cargo
Otherwise `rust-toolchain.yml` overrides the compiler we try to
install, and rustfmt isn't found.
2025-05-19 21:29:51 +02:00
Ian Douglas Scott
8dece70f7e Update smithay 2025-05-19 21:29:51 +02:00
Ian Douglas Scott
42c6a3729a Fix compiler warnings 2025-05-19 21:29:51 +02:00
Ian Douglas Scott
087715aa8f Update dependencies
Update `i18n-embed`, `ordered-float`, `sanitize-filename`, `thiserror`,
`reis`.
2025-05-19 21:29:51 +02:00
Ian Douglas Scott
77a639624c ssd: Set is_ssd(true) on header_bar, and don't set .start 2025-05-19 21:29:51 +02:00
Ian Douglas Scott
eda0cce43f Run cargo update 2025-05-19 21:29:51 +02:00
Ian Douglas Scott
3a6ff7eba8 Update toolchain to Rust 1.85
This matches the `rust-version` of libcosmic.
2025-05-19 21:29:51 +02:00
Ian Douglas Scott
e1a817bc06 kms/surface: Fix thread crash on error return of redraw
If `redraw()` returned early, before updating `self.state`, but after
calling `queue_frame`, `on_vblank` would later be called, and reach
`unreachable` since state isn't set to `WaitinfForVBlank`.

In particular, this was happening when the dmabuf from the image copy
frame failed to `bind`.

To avoid this, make sure to update `self.state` immediately after
calling `queue_frame`, before any early return from an error.
2025-05-19 19:58:36 +02:00
Jeremy Soller
a57f4a8466 Fix display vim bindings (j and k were swapped) 2025-05-09 08:47:03 -06:00
Victoria Brekenfeld
d8fd4b241b shell: Remove null-bytes from X11 title/app_id 2025-04-30 12:50:33 +02:00
Ian Douglas Scott
d7b37cfde5 Update smithay
Updates to use `GbmFramebufferExporter`.
2025-04-29 14:42:07 +02:00
Ian Douglas Scott
982af8ff10 Update smithay with ContextId changes
The new type bounds seem to be addressable using `AsGlowRenderer`.

Though things like this will need a different solution when we want to
support Pixman rendering.
2025-04-29 14:42:07 +02:00
Pratham Patel
ae1d9ae7ef Add Tor Browser as floating window exception
The Tor Browser launches with a specific dimension to avoid browser
fingerprinting[0]. Do not tile the Tor Browser for this reason.

[0]: https://tb-manual.torproject.org/anti-fingerprinting/#letterboxing
2025-04-29 14:40:05 +02:00
Victoria Brekenfeld
74c7a216f5 kms: Skip overlay tests on fullscreen 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
0be83fe930 iced: Optimize updates 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
7c222ae6d1 debug: Fix crashes and deadlocks 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
4e6713291d kms/timing: Faster cleanup 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
8aaaa12d5c kms: Fix VRR check having already missed the deadline 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
db25cc4b0b kms/timings: Base next_render_time on time to submit 2025-04-28 18:03:09 +02:00
Victoria Brekenfeld
d1e0e28d3c kms: Add tracy profiling 2025-04-28 18:03:09 +02:00
David Carvalho
5672e0399d i18n (pt-BR) - Update translations 2025-04-24 19:17:22 +02:00
Ian Douglas Scott
96e9bf3b81 Initial support for workspace pinning and moving
Adds support for cosmic-workspace-v2 pin, unpin, move_after, and
move_before requests.

Both features need some work with workspaces span displays mode, so that
will need more fixes later.

We also want to generate a unique id for pinned workspaces to send in
the ext-workspace-v1 protocol. But that isn't a strict requirement for
anything. So I haven't yet fully implemented that. We'll also want to
persist other things, like workspace naming when that's added.

Overall, though, with separate workspaces per display, this is working
pretty well.
2025-04-24 12:45:50 +02:00
Ian Douglas Scott
d1f4e7b12d protocols/workspace: Make move_workspace_to_group move existing handle
The older protocol didn't have a way to do this, but ext-workspace-v1
supports it. And it should be the correct way to do things.
2025-04-22 07:48:23 -07:00
Ian Douglas Scott
e944ee9b2f protocols/workspace: Store request queue in workspace manager udata
This is slightly simpler, if there's not some reason I'm missing to do
this as it was previously done. And in particular provides a cleaner
API (if we wanted to move this to Smithay; perhaps without the Cosmic
extension).

But it also should be more correct. Presumably if a client (unusually)
had multiple components with their own `ext_workspace_manager_v1`
instance, they should have their own queues, and
`ext_workspace_manager_v1::commit` should be independent.

Inevitably, there's a racy element to multiple components trying to
update the workspace state like this, but it should behave the same as
two clients with separate connections.

(This is different from `CompositorClientState`, since the commit queue
there is fundamentally tied to the client, and different components with
their own compositor instance way have related surfaces.)
2025-04-22 07:48:23 -07:00