Commit graph

74 commits

Author SHA1 Message Date
Vukašin Vojinović
0847247c33 chore: clippy 2025-10-22 23:55:11 +02:00
Victoria Brekenfeld
cd1117080c kms: Don't join on DrmSurface drop 2025-09-11 00:20:14 +02:00
Victoria Brekenfeld
a0f8c4ed99 kms/surface: Cleanup unused software-rendering code 2025-09-08 13:07:40 +02:00
Victoria Brekenfeld
6eb5ca1f94 kms: Close drm fds via session 2025-09-08 13:07:40 +02:00
Ian Douglas Scott
3f74a22cca kms/surface: Fix transform used for blits
Use the same logic used `submit_buffer`. This fixes corruption in OBS
when trying to capture a rotated output.
2025-09-02 17:12:37 +02:00
Ashley Wulber
bb8e066d6d feat(config): load cosmic-randr output Lists 2025-08-26 11:30:56 -04:00
Ashley Wulber
416b66b776 refactor(output config): move to config crate
this allows the greeter to easily sync to the user config
2025-08-26 11:30:56 -04:00
Ian Douglas Scott
10c05bc1d4 kms/surface: Don't send screencopysuccess() until sync point is reached 2025-08-21 17:09:49 +02:00
Ian Douglas Scott
28e9024681 kms/surface: Define a PendingImageCopyData, instead of using tuple
Adding anything else to this tuple is awkward; defining a simple struct
makes this cleaner.

This also adds a `sync` property, which will come in handy later.
Containing simply the same-named argument that was passed to
`submit_buffer`.
2025-08-21 17:09:49 +02:00
Ian Douglas Scott
f0e0084608 Update smithay, and adjust to use sync points from blit calls 2025-08-21 17:09:49 +02:00
Victoria Brekenfeld
680542e4e2 kms/surface: Don't attempt to use overlay planes during animations 2025-08-07 19:40:23 +02:00
Victoria Brekenfeld
66712009fb kms/surface: Only skip cursor updates if the application renders consistently 2025-08-07 19:40:23 +02:00
Victoria Brekenfeld
a2dda33abe kms: Add min_vrr refresh rate safety margin 2025-08-07 19:40:23 +02:00
Victoria Brekenfeld
7948a97334 kms/surface: Remove old feedback on node-removal 2025-08-04 17:11:22 +02:00
Victoria Brekenfeld
a409770df7 kms: Correctly handle the source node not being initialized 2025-07-31 19:12:10 +02:00
Victoria Brekenfeld
6492629f90 kms: Change awkward new trait to InnerDevice 2025-07-25 17:51:01 +02:00
Victoria Brekenfeld
e34a289c01 kms: lock during screen conf changes 2025-07-25 17:51:01 +02:00
Ian Douglas Scott
8ef6c161a0 screencopy: Fix damage tracking bug with shm screencopy of output
Similar to the change in https://github.com/pop-os/cosmic-comp/pull/780,
but also updates it to be a little clearer than just an uncommented `age
= 0` line.

Ideally we want some robust system to re-use the offscreen buffer (but
not allocate more buffers indefinitely if the client doesn't capture
with the same `wl_buffer`).
2025-07-03 23:36:13 +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
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
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
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
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
Ian Douglas Scott
d7b37cfde5 Update smithay
Updates to use `GbmFramebufferExporter`.
2025-04-29 14:42:07 +02:00
Victoria Brekenfeld
74c7a216f5 kms: Skip overlay tests on fullscreen 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
Victoria Brekenfeld
7a8577592d kms: Support screencopy cursor modes with active filters 2025-03-24 19:10:52 +01:00
Victoria Brekenfeld
7929e25966 kms: Support screen filters 2025-03-24 19:10:52 +01:00
Victoria Brekenfeld
18335c6758 kms: Refactor out postprocessing helpers 2025-03-24 19:10:52 +01:00
Victoria Brekenfeld
95b27637ae chore: smithay update 2025-03-12 16:50:58 +01:00
Ian Douglas Scott
a3714b036e Improve mirroring size/scale comparison
To determine if `mirroring_state` is needed, we want to compare the
untransformed dimensions of the source output to the target outputs
mode. The fact the mode comparision previously compared refresh rate
(since it compared the whole `Mode`) seems unintended.

We also re-create the `MirroringState` when the source output
dimensions changes.
2025-02-04 20:01:24 +01:00
Ian Douglas Scott
9963887ac5 Fix mirroring with scale on target output
The actual render will pass a scale other than 1.0 here, so this needs
to do the same.
2025-02-04 20:01:24 +01:00
Ian Douglas Scott
3f5c64f50f Use HashMap entry API in a cleaner way
Careful use of the right `VacantEntry` and `OccupiedEntry` methods makes
this possible without hacks or lifetime errors.
2025-02-04 20:01:24 +01:00
Ian Douglas Scott
32f9ff3cac Use untransformed texture in MirroringState::new_with_renderer
Apply inverse of output transform to mode to get render size, and apply
no transform during rendering. The transform of the output being
mirrored from shouldn't affect the final render.

Fixes issues when source output for mirroring has a transform, and also
fixes issues in https://github.com/pop-os/cosmic-comp/pull/1058
when this code is used for postprocessing, where this resulted in the
same transform being applied twice.
2025-02-04 20:01:24 +01:00
Ian Douglas Scott
b685512127 Migrate away from Rectangle::from_loc_and_size
Deprecated in `smithay` by https://github.com/Smithay/smithay/pull/1621.
2025-01-07 12:50:35 +01:00
Victoria Brekenfeld
db13eea91c shell: Allow active workspace to be None 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
6be5009b37 kms: Allow diverging primary plane formats under certain conditions 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
b5cd62fd7a kms: skip cursor updates for fullscreen content above the minimum refresh rate 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
546966bf15 drm_lease: Disable overlay planes when active 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
8b87d6524e kms: Use new DrmOutput api 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
f12f4db0e1 chore: Update smithay 2025-01-06 20:23:05 +01:00
Victoria Brekenfeld
9b4127555e kms/surface: Fix racy output disable 2024-12-12 14:29:50 +01:00