Commit graph

2264 commits

Author SHA1 Message Date
Kenny Levinsen
651f85cb81 Merge branch 'predictive-frame-scheduling' into 'master'
Draft: wlr_frame_scheduler: Add predictive frame scheduler

See merge request wlroots/wlroots!5332
2026-04-09 11:07:53 +00:00
Dylan Donnell
8a9e3a84b5 ext_background_effect_v1: add implementation 2026-04-09 10:43:46 +00:00
Kenny Levinsen
df562a8e70 wlr_frame_scheduler: Add predictive frame scheduler
The predictive frame scheduler builds upon the presentation scheduler,
adding a delay based on the measured CPU and GPU time required to
prepare a frame to place the frame event as close as safely possible to
the commit deadline.
2026-04-06 23:44:57 +02:00
Kenny Levinsen
411a3e6a6e scene: Deprecate wlr_scene_output_needs_frame
Previously, needs_frame was only set specifically when a non-damaging
update was required, and would only be cleared when the backend
committed the frame.

Under the new frame scheduler, needs_frame is always set when a frame is
scheduled, with effectively a single scheduling path for all change
sources, and needs_frame must have been true for a frame to be emitted.

Drop wlr_scene_output_needs_frame to make it clear that such a check is
no longer meaningful.
2026-04-06 23:25:55 +02:00
Kenny Levinsen
d560a30adc scene: Add wlr_scene_output_set_frame_scheduler
This allows the compositor to replace frame schedulers for a given scene
output at runtime.
2026-04-06 23:22:44 +02:00
Simon Ser
d99ee40a1d output: drop wlr_output.needs_frame
The frame scheduler is responsible for de-duplicating needs_frame
events.
2026-04-06 23:19:40 +02:00
Rose Hudson
0967873a20 output: remove old frame scheduling 2026-04-06 23:19:40 +02:00
Rose Hudson
b2550a88ff scene: switch to new frame scheduling 2026-04-06 23:19:40 +02:00
Rose Hudson
ee100e2586 Add interval frame scheduler
Headless present events aren't suitable for the present scheduler. This
new scheduler is a good place for headless' existing frame logic to go,
so move it into there.

With this decoupling, there's nothing tying the scheduler to the
headless backend, hence the generic name.
2026-04-06 23:19:40 +02:00
Rose Hudson
ad145dce86 Add wl_surface.frame based frame scheduler 2026-04-06 23:19:40 +02:00
Rose Hudson
98cbf09f8a Add frame scheduler interface 2026-04-06 23:19:40 +02:00
Simon Ser
a1ed6fca52 render/drm_syncobj: fix flags docs for wlr_drm_syncobj_timeline_waiter_init()
wlr_drm_syncobj_timeline_check() is a bit different because zero
will error out if the point has not materialized yet.

Kernel docs for struct drm_syncobj_eventfd:
https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#c.drm_syncobj_eventfd
2026-03-27 18:02:46 +00:00
Félix Poisot
f295d0322a render: explicit sync for wlr_texture_read_pixels() 2026-03-26 12:44:09 +00:00
Félix Poisot
fd870f6d27 linux_drm_syncobj_v1: fix handling of empty first commit
As reported in
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4979#note_3385626,
bfd6e619fc did not correctly handle clients
that don't immediately follow their call to
`wp_linux_drm_syncobj_manager_v1.get_surface` with a commit attaching
a buffer

Fixes: bfd6e619fc
2026-03-20 15:36:16 +00:00
Félix Poisot
bfd6e619fc linux_drm_syncobj_v1: add release point accumulation
This changes the behavior of wlr_linux_drm_syncobj_surface_v1 to
automatically signal release of previous commits as they are replaced.

Users must call wlr_linux_drm_syncobj_v1_state_add_release_point or
wlr_linux_drm_syncobj_v1_state_signal_release_with_buffer to delay the
signal as appropriate.
2026-03-17 18:14:35 +00:00
Félix Poisot
1f3d351abb scene: add buffer release point to 'sample' event 2026-03-17 18:14:35 +00:00
Félix Poisot
0af9b9d003 render/drm_syncobj: add wlr_drm_syncobj_timeline_signal() 2026-03-17 18:13:10 +00:00
David Turner
58c158dba6 output: Add color-representation to output state
Add color_representation to wlr_output_state, holding color
representation metadata about the primary buffer.  This can be set
using wlr_output_state_set_primary_color_representation() and a
new enum value WLR_OUTPUT_STATE_COLOR_REPRESENTATION in
wlr_output_state.committed indicates when this data is present.

Also add color-representation to wlr_output, and discard
color-representation in wlr_output_state if it matches what's already
been committed to the output.
2026-03-17 16:32:30 +00:00
Isaac Freund
1fa8bb8f7a
virtual-keyboard: handle seat destroy
We must make the virtual keyboard inert when the seat is destroyed.
2026-03-17 09:53:32 +01:00
Isaac Freund
ec746d3e3e virtual-keyboard: add wlr_virtual_keyboard_v1_from_resource()
I want to use the zwp_virtual_keyboard_v1 object in a custom river
protocol and need to be able to obtain the corresponding wlroots struct.
2026-03-17 08:45:12 +00:00
Alexander Orzechowski
7f87c7fe90 wlr_scene: Nuke buffer output_enter / output_leave
outputs_update should be used instead.
2026-03-13 13:19:06 -04:00
Isaac Freund
39e918edc8
scene: avoid redundant wl_surface.enter/leave events
Currently we send wl_surface.enter/leave when a surface is hidden
and shown again on the same output. In practice, this happens very
often since compositors like river and sway enable and disable
the scene nodes of surfaces as part of their atomic transaction
strategy involving rendering saved buffers while waiting for
clients to submit new buffers of the desired size.

The new strategy documented in the new comments avoids sending
redundant events in this case.
2026-03-13 17:59:13 +01:00
Kenny Levinsen
ff7d093800 util/box: Add wlr_box_intersects
wlr_box_intersection generates a new box based on the intersection of
two boxes. Often we simply want to know *if* two boxes intersected,
which we can answer much cheaper.

Add wlr_box_intersects, in similar vein as wlr_box_contains_box but
returning true for any overlap.
2026-03-09 22:09:40 +00:00
YaoBing Xiao
14b3c96c1e treewide: make type-check helpers take const pointers 2026-03-06 16:04:21 +08:00
Diego Viola
6d9aa17572 treewide: fix typos
Signed-off-by: Diego Viola <diego.viola@gmail.com>
2026-02-28 04:26:47 -03:00
Aleksei Bavshin
3676ab4df0
backend/libinput: add support for LIBINPUT_SWITCH_KEYPAD_SLIDE 2026-02-08 11:01:06 -08:00
rewine
98196bbd89
wlr_cursor: add comments for signal parameters 2026-02-03 21:24:32 +08:00
tokyo4j
82d5ffb09e ext-workspace-v1: add implementation
Co-authored-by: Consolatis <40171-Consolatis@users.noreply.gitlab.freedesktop.org>
2026-01-31 01:44:23 +09:00
Félix Poisot
5a40da7e15 render: don't infer luminance multipliers from color TF
Make scene pass them explicitly instead. Ref #3995
2026-01-23 19:41:14 +00:00
Félix Poisot
bb882e97f1 color_management_v1: use 64bit image description identities
ref https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/385
2026-01-23 18:50:09 +00:00
Jens Peters
3eb07b1fdb backend/libinput: expose libinput_tablet_tool
Exposing libinput_tablet_tool from libinput allows compositors
to set tool specific configuration options like pressure range
and eraser button behavior.

See 'libinput_tablet_tool_*()' functions which require a
'libinput_tablet_tool' handle:
https://wayland.freedesktop.org/libinput/doc/1.30.0/api/group__config.html
(libinput 1.30.0, latest at the time of writing).
2026-01-19 20:45:39 +01:00
Isaac Freund
f735439543
xwayland: add set_size_hints signal
Currently there is no way for the compositor to be notified when an
Xwayland client sets/modifies its size hints.
2026-01-15 11:49:49 +01:00
Peter Kaplan
49576469ec image_capture_source: wlr_output_try_from_ext_image_capture_source_v1() 2026-01-07 09:18:25 +01:00
Peter Kaplan
3b9f599cbe wlr_ext_image_copy_capture_v1: new_session event
And a destroy event in wlr_ext_image_copy_capture_session_v1.
2026-01-07 09:18:25 +01:00
Simon Ser
f93865ed1f ext_image_copy_capture_v1: replace schedule_frame with request_frame
schedule_frame is only called when the client has submitted damage
and a new frame should be rendered immediately. schedule_frame is
not called when the capture client is waiting for the next frame
but hasn't submitted damage.

Sources implementing a rendering loop based on the capture rate
need to know when a capture client is ready to accept a new frame.
Such sources want to trigger a redraw if and only if (1) they are
dirty (their contents have changed) and (2) the capture client is
ready to accept a new frame.

Replace schedule_frame with request_frame, triggered each time a
client sends a capture request. A flag indicates whether the capture
client has submitted damage.
2026-01-05 15:03:18 -05:00
Simon Ser
84d603acc0 xwayland: take wlr_buffer in wlr_xwayland_set_cursor() 2026-01-05 10:10:32 -05:00
Simon Ser
d7f7b68f49 xcursor: introduce wlr_xcursor_image_get_buffer()
This makes it so callers no longer need to juggle with raw pixel
pointers anymore, and only need a single wlr_buffer-based codepath.

Additionally, cursors can be unloaded without risking use-after-free.
2026-01-05 10:10:32 -05:00
Simon Ser
2c64b30a67 scene: add knob to turn off Xwayland surface restacking
This is useful in these cases:

- The same surface is added to two different scene-graphs. wlroots
  can't figure out on its own which scene-graph should drive the
  Xwayland stacking.
- A compositor uses multiple Xwayland servers (e.g. one per app).
  wlroots will try to restack surfaces from different Xwayland
  instances and this will not go well.
2026-01-04 16:02:52 +00:00
Simon Ser
b094f8aeb3 scene/surface: don't cache frame pacing output
Storing the frame pacing output in a per-scene and per-surface
struct doesn't play well with multiple scenes. outputs_update is
only triggered for outputs the scene knows about, but operates on
all outputs the surface has entered regardless of the scene. Thus
leaving an output on one scene will not refresh the frame pacing
output on other scenes, and these other scenes will operate with
a stale frame pacing output. The surface will not receive any more
wl_surface.frame done events.

This also avoids keeping a dangling pointer around when the frame
pacing output is destroyed but the output isn't added in the scene.

References: https://github.com/swaywm/sway/issues/8885
2026-01-04 14:40:18 +01:00
Simon Ser
9b4d9eabb1 color_management_v1: add helpers to get supported TFs/primaries
This avoids hardcoding lists of TFs/primaries in compositors.

I've considered adding wlr_color_manager_v1_create_with_renderer()
instead, but I'm worried that some aspects of the options struct
don't really depend on the renderer, but on the compositor. Such
things are features and render intents.

I've considered returning a const array, but this would tie our
hands if we want to make the renderer advertise the set of
TFs/primaries it supports, instead of having a single flag gating
all of them.
2025-12-15 11:07:26 -05:00
tokyo4j
ba931024a5 Add wlr_version_get_{major,minor,micro}()
Can be used to detect wlroots version at runtime rather than
compile-time.
2025-12-13 11:06:28 +00:00
Ilia Bozhinov
0e9c6ddefa seat: add wlr_seat_touch_notify_clear_focus
This is needed for cases where the touch operation goes over a region
where no surfaces are present. In this case, we'd want to notify the
touch grabs (for example DnD grabs) that no focus is currently focused.
2025-12-11 21:10:59 +00:00
Félix Poisot
a962d58727 render/color: make wlr_color_primaries_from_named public 2025-12-05 19:14:49 +00:00
Félix Poisot
811765ffa0 output: don't rebuild cursor color transform for each update 2025-11-24 23:26:14 +00:00
Félix Poisot
7101a69804 scene: don't rebuild color transforms each frame 2025-11-24 23:26:14 +00:00
Félix Poisot
3d3d5fb1b7 render: remove buffer primaries from pass options
colorspace conversion is now carried explicitely by setting a
wlr_color_transform_matrix in the color transform
2025-11-24 23:26:14 +00:00
Simon Ser
2995f31102 render/color: introduce wlr_color_transform_matrix
This is useful to perform color space conversions.
2025-11-24 23:26:14 +00:00
Félix Poisot
17f3f28865 render/color: add wlr_color_primaries_transform_absolute_colorimetric 2025-11-24 23:26:14 +00:00
Simon Ser
fa7b66bcf4 color_representation_v1: add helper to create global from renderer 2025-11-13 10:35:56 -05:00
Simon Ser
2fbc0b5ac1 scene: add support for color encoding and range 2025-11-13 10:35:56 -05:00