Commit Graph

1379 Commits

Author SHA1 Message Date
Simon Ser 90e12fb978 pointer-constraints-v1: use wlr_surface_synced 2023-12-25 11:47:15 +01:00
Simon Ser a6122c3ec5 layer-shell-v1: use wlr_surface_synced 2023-12-25 11:47:15 +01:00
Simon Ser 0e3d2222c2 xdg-decoration: use wlr_surface_synced for toplevel 2023-12-25 11:47:15 +01:00
Simon Ser 96aec06b0a subcompositor: use wlr_surface_synced 2023-12-25 11:47:15 +01:00
Simon Ser 4b3553409a xdg-shell: use wlr_surface_synced for popups 2023-12-25 11:47:15 +01:00
Simon Ser 9201431c29 xdg-shell: use wlr_surface_synced for toplevel 2023-12-25 11:47:15 +01:00
Simon Ser 69d9a4e2cb xdg-shell: use wlr_surface_synced for wlr_xdg_surface 2023-12-25 11:47:15 +01:00
Simon Ser 7e1ae5548c compositor: add wlr_surface_role.client_commit 2023-12-25 11:47:15 +01:00
Simon Ser d847516765 compositor: add wlr_surface_synced
A lot of protocols extend the wl_surface state. Such protocols need
to synchronize their extended state with wl_surface.commit and
cached states. Add a new utility for this purpose.
2023-12-25 11:47:15 +01:00
Simon Ser 34d5af4172 compositor: add wlr_surface_state_has_buffer() 2023-12-25 11:47:15 +01:00
Simon Ser 43734f7c62 compositor: fix wlr_surface_has_buffer() doc comment
The function does not check whether the upload succeeded: it does
not check the wlr_client_buffer.
2023-12-25 11:47:14 +01:00
Simon Ser 66b6c349e7 compositor: remove unnecessary wlr_surface.has_buffer
No need to store this bit, we can infer it from buffer_width and
buffer_height.
2023-12-25 11:43:41 +01:00
Simon Ser 85f44f3684 pointer-constraints-v1: add cursor_hint.enabled
This allows compositors to check whether the cursor hint is set.
2023-12-25 10:36:26 +00:00
Simon Ser 6a2ff0dffe compositor: drop surface precommit event
This is unused.
2023-12-04 19:32:44 +01:00
Alexander Orzechowski 06d301bf1a wlr_scene: Track output damage separately
The damage ring is only supposed to keep track of damage within
the swapchain
2023-12-03 05:29:05 +00:00
Alexander Orzechowski 3ed1268f64 render: Nuke old read pixels API
Sadly, the new API is not backwards compatible with the old API. Since
we have already switched all users in wlroots to the new API compositors
are already practically mandated to implement the new API. Let's get rid
of the old one since there is no point.
2023-11-30 20:01:12 -05:00
Simon Ser a165261f7f output: replace wlr_render_timer arg with wlr_buffer_pass_options
This scales better when more render pass options are added.
2023-11-30 19:48:01 +01:00
Simon Ser c31ca04264 output: drop stale references to wlr_output_attach_render()
It turns out we forgot about the function declaration in the header.
Also some docs were still referring to that function.

Move the wlr_output_attach_render() docs to
wlr_output_begin_render_pass().
2023-11-30 16:52:11 +01:00
Alexander Orzechowski 7702a19739 output: Drop back_buffer 2023-11-29 16:00:24 -05:00
Alexander Orzechowski fc6000251c output: Drop wlr_output_attach_render 2023-11-29 16:00:23 -05:00
Simon Ser 2093564616 damage_ring: add wlr_damage_ring_rotate_buffer()
This adds an alternate way to use wlr_damage_ring without the
concept of buffer age. Buffer age is a concept inherited from EGL
but there is no real reason why we should continue to use that in
wlroots. Instead, use wlr_buffer pointers.

Eventually, we should be able to remove the buffer age based
functions.
2023-11-29 14:45:10 -05:00
Kirill Primak 87346b3393 Revert "subcompositor: emit new_subsurface immediately"
new_subsurface emitted immediately isn't actually that useful. Revert the change
and document that this event is special.

This reverts commit 504b9491f0.
2023-11-25 11:47:11 +00:00
Simon Ser 36cc698bc5 matrix: deprecate
Compositors should no longer need matrix operations to render:
the old rendering API has been removed, and the new API doesn't
take matrices as input.
2023-11-25 08:37:55 +01:00
Kirill Primak 7661ab2bf1 compositor: deprecate wlr/types/wlr_region.h
The only function in that header is now also declared in
wlr/types/wlr_compositor.h.
2023-11-24 15:09:31 +03:00
Alexander Orzechowski 26158d0718 output: Drop transform matrix 2023-11-23 16:32:58 -05:00
Kirill Primak e841366068 layer-shell: emit new_surface event at the proper time 2023-11-23 13:02:10 +00:00
Kirill Primak c85838892d xdg-{shell,decoration}: improve events
This commit changes the behavior of `new_*` signals to better match
their names (see https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3608).
wlr_xdg_shell.events.new_surface is now emitted when an xdg_surface is
created, and wlr_xdg_shell.events.new_{toplevel,popup} events are
introduced to get notified when an xdg_{toplevel,popup} is created.
Same applies to
`wlr_xdg_decoration_manager_v1.events.new_toplevel_decoration`. As a
result, wlr_xdg_surface.added and wlr_xdg_toplevel_decoration_v1.added
are removed, as we no longer need to track whether the corresponding
event was emitted.

Additionally, this commit changes the behavior of
wlr_xdg_surface.events.destroy: it is now emitted when the xdg_surface
is destroyed, as the name suggests.
wlr_xdg_{toplevel,popup}.events.destroy events are added to get
notified when an xdg_{toplevel,popup} is destroyed.
2023-11-23 12:52:20 +00:00
Simon Ser d61ec694b3 output: take wl_event_loop in wlr_output_init()
We don't need the whole wl_display here anymore. The wl_event_loop
is enough.
2023-11-23 11:39:25 +00:00
Simon Ser 5717e27c06 output: take wl_display in wlr_output_create_global()
Currently wlr_output holds a wl_display, but it will go away soon.
Instead of relying on that field in wlr_output_create_global(),
make the dependency explicit by taking a wl_display as argument.
2023-11-23 11:39:25 +00:00
Simon Ser 6a7463bb8e output-layout: take wl_display in constructor
The output layout creates and destroys wl_output globals. We will
soon need the wl_display to do so.
2023-11-23 11:39:25 +00:00
Simon Ser 9e702e9cfe util/transform: move over wl_output_transform helpers
These aren't really tied to wlr_output.
2023-11-23 11:03:57 +01:00
Kirill Primak 5dd614b9ad input-inhibitor: drop
wlr_input_inhibitor.h has been marked as deprecated in 0.17.0.
2023-11-21 20:10:18 +03:00
Simon Ser fe6a432299 linux-dmabuf-v1: skip import check on split render/display SoCs
Unfortunately we have no way to get back the proper render node in
that case. This will be fixed with [1]: with that Mesa patch, the
wlr_renderer will return the proper render node and the existing
logic will work fine.

[1]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24825

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3757
2023-11-20 19:54:16 +01:00
Kirill Primak 86b2cac921 Add missing type declarations in headers 2023-11-14 18:44:53 +00:00
Alexander Orzechowski 3d3cca9164 wlr_scene: Introduce wlr_scene_subsurface_tree_set_clip 2023-11-14 17:27:08 +00:00
Alexander Orzechowski d1ddd4ca3a wlr_scene_surface: Introduce scene_surface_set_clip 2023-11-14 17:27:08 +00:00
Alexander Orzechowski 33b437d574 wlr_scene: Amend scene_buffer.point_accepts_input to take coordinate pointers
The pointers mean that we can mutate them. This will be useful later
so we can hide details from the compositor when we clip subsurface trees.
2023-11-14 17:27:08 +00:00
Simon Ser 319e4125ab xdg-shell: add wlr_xdg_{toplevel,popup}_try_from_wlr_surface()
Convenience helpers for compositors. Saves them the trouble of
manually checking the role (and if they forget to do so, prevents
an invalid cast).
2023-11-13 10:31:00 +01:00
Simon Ser 1c24b1182b backend: drop wlr_backend_get_presentation_clock()
We can just assume CLOCK_MONOTONIC everywhere.

Simplifies the backend API, and fixes clock mismatches when multiple
backends are used together with different clocks.
2023-10-30 18:39:39 +01:00
Kirill Primak d253d70786 xdg-shell: use wlr_surface.unmap_commit 2023-10-26 19:06:40 +03:00
Kirill Primak d8515b3446 layer-shell: track surface init state 2023-10-26 14:57:10 +00:00
Kirill Primak 4d2e310122 compositor: add wlr_surface.unmap_commit
This flag can be used to figure out whether a particular commit has
unmapped the surface. Private state for now in case we find a better
way to track this.
2023-10-26 14:57:10 +00:00
eri bfc42e0f62
linux_dmabuf_v1: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:42 +02:00
eri c46d3da976
drm: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:38 +02:00
eri 8ccbe45143
buffer: convert to try_from
References: wlroots/wlroots#884
2023-10-19 18:19:27 +02:00
Simon Ser ccb153f024 security-context-v1: add commit event 2023-10-10 10:34:01 +02:00
Simon Ser c58deb7a7d security-context-v1: new protocol implementation
Co-authored-by: Puck Meerburg <puck@puckipedia.com>
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/68
2023-10-10 10:34:01 +02:00
Kirill Primak 078540e086 xdg-shell: fix wlr_xdg_popup_destroy() docs 2023-10-09 19:29:28 +00:00
Kenny Levinsen 2cf78f4c5b output: allow_artifacts -> allow_reconfiguration
The name "allow_artifacts" and associated description is very vague, and
theoretically allow for tearing behavior. Clarify that we only intend to
mean artifacts related to output configuration (e.g., modesets).

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3740
2023-10-09 08:31:35 +00:00
Alexander Orzechowski e1e911d425 scene_output_layout: Don't destroy output when output layout is destroyed
There were a couple of problems with this:
1. The behavior is unexpected. Typically objects in wlroots won't
also destroy objects that they depend on. For instance, wlr_scene_output
will not destroy the wlr_output when it's destroyed. It shouldn't be any
different for scene layouts.
2. This fixes a crash where because wlr_output_layout and wlr_scene_output
are both addons to wlr_output, we might get into a situation where
wl_list_for_each_safe might malfunction. See [1]

This means that the compositor needs to manually destroy the output
when they destroy the layout, hence ~breaking. Compositors can just
call `wlr_scene_output_destroy()` if they want to destroy both at the
same time.

[1] https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4358#note_2106260

This reverts commit 1a731596c5.

Co-authored-by: Kirill Primak <vyivel@eclair.cafe>
2023-10-07 13:31:20 -04:00
Alexander Orzechowski 5fb0007e02 output_event_commit: Remove committed and buffer
The newly introduced state struct can be used to retrieve this.
2023-10-06 10:06:01 +00:00
Alexander Orzechowski 03e240a7f2 wlr_output: Add applied state to commit event 2023-10-06 10:06:01 +00:00
Kirill Primak 86c30b8715 seat: remove wlr_seat_validate_grab_serial()
It makes little sense to have a catch-all grab vaildation function,
considering that e.g. tablet tool implicit grabs are possible as well.
Besides, the function has always returned true anyway.
2023-10-06 08:51:47 +00:00
Simon Zeni a289f812d6 drop KDE idle protocol support 2023-10-04 12:19:30 -04:00
Simon Ser ddfec31b4c xdg-shell: document wlr_xdg_surface's initialized & initial_commit 2023-10-04 14:50:48 +00:00
Kirill Primak a09d649439 docs: replace the less commonly used "::" with "." 2023-10-02 22:10:16 +03:00
Kirill Primak 0fdbdc36c0 xdg-surface: fix init state flow
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3677
2023-10-02 18:37:09 +00:00
vaxerski c2aa7fd965 backend/drm: Add async page flip support to legacy
Atomic doesn't support such flags yet.
2023-09-28 16:53:08 +00:00
vaxerski 5dec1c8bcb staging/tearing-control: Add protocol support 2023-09-28 16:53:08 +00:00
John Lindgren 1a731596c5 wlr_scene: clarify wlr_scene_output ownership semantics
wlr_scene_output_layout_add_output() was made public by f5917f0247
("scene_output_layout: make output adding explicit") but the ownership
semantics are not obvious and should be clarified.
2023-09-22 21:18:16 -04:00
Kirill Primak 4565b07484 Unify signal data docs
`// struct <name>` appears roughly 4 times as often as
`// struct <name> *`. Switch to the former variant everywhere.
2023-08-23 19:43:26 +00:00
Simon Ser e5fc8cd4c7 output: trigger frame/present events on all commits on enabled output
Up until now, frame/present events were only triggered when the
user submitted a buffer. Change the wlr_output API so that these
events are triggered when any commit is applied on an enabled
output.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3708
2023-08-23 15:42:22 +00:00
Rose Hudson f5917f0247 scene_output_layout: make output adding explicit
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3709
2023-08-22 11:53:28 +02:00
Rose Hudson 91f813ffb7 output_layout: return wlr_output_layout_output when adding output
This will be used for the scene-graph integration.
2023-08-22 11:53:25 +02:00
Simon Ser 72787db98a compositor: drop wlr_surface_destroy_role_object()
This function is now unnecessary.
2023-08-21 18:56:09 +02:00
Kirill Primak bd5c4f4a4a xdg-shell: rework roles 2023-08-21 16:30:29 +00:00
Simon Ser 9b8cd1f5d6 buffer: make wlr_client_buffer functions private
We want to eventually remove this. Let's make sure compositors
don't start using either of these functions.
2023-08-21 15:45:10 +00:00
Leonardo Hernández Hernández bdc34401ba
xdg-decoration: store an xdg_toplevel instead of xdg_surface
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3685
2023-08-19 11:10:36 -06:00
Kirill Primak 42a5b6f62a compositor: add "mapped" flag doc 2023-07-26 20:39:03 +00:00
rewine 2f859f5bec
wlr_output: add comments for signal parameters 2023-07-26 13:55:34 +08:00
Leonardo Hernández Hernández e8d545a977
xdg-shell: add support for v6
This adds the suspended toplevel state
2023-07-23 20:30:43 -06:00
Simon Ser 04e4e06986 cursor-shape-v1: new protocol implementation
References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/194
2023-07-24 01:00:19 +00:00
rewine f3cf830e9a wlr_idle_inhibit_manager_v1: add comments for signal parameters 2023-07-21 02:35:48 +00:00
Kirill Primak 7791ffe058 data-device: remove undefined grab interface decls 2023-07-17 16:24:05 +00:00
Kirill Primak c6603288fb xdg-shell: update stale docs 2023-07-17 19:12:02 +03:00
Simon Ser 000081db19 cursor, output: apply viewport to cursor
Instead of passing the scale, pass the source and destination
boxes.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3676
2023-07-17 14:55:22 +00:00
John Lindgren 657ca2205f wlr_gamma_control: add missing forward declarations
Fixes an error seen in labwc CI builds with -Werror:

    ../subprojects/wlroots/include/wlr/types/wlr_gamma_control_v1.h:44:16:
    error: ‘struct wlr_output_state’ declared inside parameter list
    will not be visible outside of this definition or declaration [-Werror]
       44 |         struct wlr_output_state *output_state);
          |                ^~~~~~~~~~~~~~~~
2023-07-17 10:10:06 -04:00
Simon Ser 67447d6cb4 presentation-time: add separate helper for zero-copy
The backend is not able to tell whether a surface is being
presented via direct scan-out or not. The backend will set
ZERO_COPY if the buffer submitted via the output commit was
presented in a zero-copy fashion, but will no know whether the
buffer comes from the compositor or the client.
2023-07-14 15:20:35 +02:00
Simon Ser fe84bfc8d9 scene: add wlr_scene_output_sample_event
This contains the output and a bool indicating direct scan-out.
2023-07-14 15:16:12 +02:00
Simon Ser 88942d43fd scene: rename output_present event to output_sample
Using "present" is confusing here: the event is emitted when the
buffer is being sampled to be displayed on an output, not when it's
being presented on-screen.

Rename to match the presentation-time terminology.
2023-07-14 15:06:13 +02:00
Rose Hudson 214df8eda0 scene_output: optionally record and report timings 2023-07-10 09:57:02 +00:00
Simon Ser 6f8287128b output: drop wlr_output_cursor_set_image()
This function takes a pointer to memory with a hardcoded format
and many parameters to describe the pixel buffer.
wlr_output_cursor_set_buffer() can be used instead.
2023-07-03 09:46:54 +02:00
Simon Ser 0fc532f8de cursor: remove wlr_cursor_set_image()
Superseded by wlr_cursor_set_buffer().
2023-07-02 22:42:37 +00:00
Simon Ser 18bafbfc57 xcursor-manager: drop wlr_xcursor_manager_set_cursor_image() 2023-07-02 22:42:37 +00:00
Simon Ser 71c87ff4b8 cursor: add wlr_cursor_set_buffer()
A saner replacement for wlr_cursor_set_image():

- Takes a wlr_buffer instead of numerous parameters and a hardcoded
  format.
- The scale is not used to filter outputs.
- A ref to the buffer is kept to apply it to new outputs.
2023-07-02 22:42:37 +00:00
Simon Ser 13f096b0ac output-layer: add wlr_output_layer_state.damage
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3593
2023-06-30 04:31:50 +00:00
Alexander Orzechowski c68c9f1685 wlr_scene_buffer: Publicize some state
The sway scene port relies on this to create a copy of the buffer for
saved surface purposes.
2023-06-27 17:25:06 -04:00
Simon Ser be05097968 output: add wlr_output_state_init()
This changes the semantics of wlr_output_state. Instead of having
fields with uninitialized memory when missing from the committed
bitflag, all fields are always initialized (and maybe NULL/empty),
just like we do in wlr_surface_state. This reduces the chances of
footguns when reading a field, and removes the need to check for
the committed bitfield everywhere.

A new wlr_output_state_init() function takes care of initializing
the Pixman region.
2023-06-23 18:07:26 +00:00
Simon Ser 8a5b5e6f28 compositor: listen to role_resource destroy signal
Call wlr_surface_destroy_role_object() when the role_resource is
destroyed.
2023-06-23 14:33:26 +02:00
Simon Ser 89cb484220 compositor: replace role_data with role_resource
This increases type safety, makes it more obvious that role_data
must represent the role object, and will allow for automatic
cleanup when the resource is destroyed.
2023-06-23 14:23:27 +02:00
Kirill Primak fc9b58e84d compositor: don't call role unmap hook without an object 2023-06-23 11:54:05 +00:00
Kirill Primak 0f67580aab compositor: introduce wlr_surface_set_role_object() 2023-06-23 11:54:05 +00:00
Alexander Orzechowski 4b7c526578 output: Introduce wlr_output_state_copy() 2023-06-22 11:56:20 +02:00
Alexander Orzechowski 2ac31fc630 wlr_scene: Introduce wlr_scene_buffer_set_filter_mode 2023-06-20 09:04:35 +00:00
Simon Ser 220402b717 cursor: add wlr_cursor_unset_image()
It's pretty awkward to call wlr_cursor_set_image() with 6 zeroes.
Hide that awkwardness in wlroots.
2023-06-15 18:40:33 +02:00
Simon Ser da04b066ea cursor: add wlr_cursor_set_xcursor()
This keeps track of the last set XCursor. If it hasn't changed,
skip the texture upload.

In the future, support for animated XCursors can be added.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3436
2023-06-15 18:28:43 +02:00
Alexander Orzechowski 7ce9459715 output: add documentation for wlr_output_state 2023-06-15 12:57:36 +00:00
Kirill Primak 753f3cc4fa compositor: add wlr_surface_role.no_object
This commit allows to make a role as not represented by an object,
which fixes calling role commit handlers for roles like cursor
surfaces.

Fixes: 099b9de752
2023-06-14 14:06:28 +00:00
Simon Ser 670915eeea output: add wlr_output_state_set_layers() 2023-06-13 12:02:49 +00:00
Kirill Primak 96f1fdd113 seat: remove a TODO comment about simulating keyboard events 2023-06-12 20:54:53 +03:00