Commit Graph

3056 Commits

Author SHA1 Message Date
David Turner
0bf0c55ad2 scene: Move single-pixel buffer things to scene_buffer
Move single-pixel buffer status cache from wlr_scene_surface to
wlr_scene_buffer, it makes more sense there and means the optimisations
will still work if wlr_scene_buffer is used without wlr_scene_surface.
2025-04-11 14:01:35 +00:00
Kenny Levinsen
c450991c4b wlr_scene: Debounce dmabuf feedback on scanout
Direct scanout can be enabled and disabled on a frame-by-frame basis,
and so we could end up sending different feedback to a surface on every
other frame. Reacting to new feedback is expensive, as the client may
need to reallocate their swapchain.

Debounce the state change a number of frames, for now set to 30, to
avoid immediate reaction to scanout (or composition) that only lasts a
few frames.

A timer could be used instead, but it did not seem worth the complexity.
What just want to know that the state has been stable across a
reasonable number of samples, and a counter seems sufficient for that.
2025-04-10 12:44:03 +00:00
David Turner
792bee9657 scene: Optimize rendering of single-pixel buffers
The single-pixel buffer protocol is used to allow wayland clients to
easily draw solid-color rectangles by presenting a 1x1-pixel buffer and
scaling it to the desired size.  This patch improves how these buffers
are then handled in the scene-tree renderer.

We already ignore opaque black rectangles at the very bottom (and
anything under them) because we assume we'll be rendering on a black
background.  This patch detects black opaque single-pixel buffers and
handles them in the same way as black opaque rectangles.  It also
renders single-pixel buffers as rectangles rather than buffers because
this is probably more efficient in the underlying renderer.

In wlr_scene_surface we cache whether the attached buffer is a
single-pixel buffer.  This is done because the
wlr_single_pixel_buffer_v1 will be destroyed after texture upload, after
which it becomes much more annoying to check if the buffer is a
single-pixel buffer.
2025-04-07 13:28:51 +01:00
David Turner
5563d23b81 single-pixel-buffer: Add try_from_buffer() function
Add wlr_single_pixel_buffer_v1_try_from_buffer() and move `struct
wlr_single_pixel_buffer_v1` to wlr_buffer.h. This allows other code to
find out if a wlr_buffer is a single-pixel buffer and, if so, find out
what color it is.
2025-04-07 13:25:42 +01:00
Simon Ser
709fc8fd8e ext-data-control-v1: fix types in wl_list/wl_signal comments
These refer to the wlr protocol types.
2025-04-06 10:09:54 +00:00
Kirill Primak
84fc6aaf5a Drop region.h
This header has been deprecated a while ago.
2025-04-01 15:42:39 +03:00
Simon Ser
fa6cd856e3 color-management-v1: add setter for surface feedback 2025-03-30 16:31:44 +02:00
Simon Ser
95c85af87c color-management-v1: add support for mastering display metadata 2025-03-30 16:31:44 +02:00
Simon Ser
dcf38e3ea9 color-management-v1: add wlr_surface_get_image_description_v1_data() 2025-03-30 16:31:44 +02:00
Simon Ser
6d4737a7f6 color-management-v1: add struct wlr_image_description_v1 2025-03-30 16:31:27 +02:00
Simon Ser
0ab3c1d060 color-management-v1: new protocol
This implements the bare minimum to expose the protocol interfaces.

References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/14
2025-03-30 16:31:17 +02:00
Simon Ser
10b8880fc7 render/color: add wlr_color_transfer_function_get_default_luminance() 2025-03-30 16:21:26 +02:00
Simon Ser
50537e2e6f render/color: introduce enum wlr_color_transfer_function 2025-03-30 16:21:26 +02:00
Simon Ser
e11012a024 render/color: introduce wlr_color_primaries_from_named() 2025-03-30 16:21:26 +02:00
Simon Ser
7d076d0bc9 render/color: introduce wlr_color_named_primaries 2025-03-30 16:21:26 +02:00
Simon Ser
156201fe71 render/color: add wlr_color_primaries_to_xyz() 2025-03-30 16:21:26 +02:00
Simon Ser
d8ad4809fc render/color: include public header from private one 2025-03-30 16:21:26 +02:00
Simon Ser
420b60f203 util/matrix: add matrix_invert() 2025-03-30 16:21:26 +02:00
Kirill Primak
9dbf5b9f6b fullscreen-shell: remove
The protocol implementation has been marked as deprecated in the
previous release.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3846
2025-03-30 01:15:09 +03:00
Chris Ever
ba7ac3efe5
fix comment typo in wlr_text_input_v3.h
fixes #3951
2025-03-15 00:11:47 +08:00
Simon Ser
50edd3a42d Document config.h 2025-03-10 15:02:26 +00:00
liupeng
31f9d6bb97 screencopy-v1: drop output_enable listener 2025-03-10 15:33:46 +08:00
Guido Günther
e752e3ec06 xwm: Handle NET_WM_WINDOW_OPACITY
Lot of clients use it (e.g. both Qt and GTK) although it never made it
into the spec at

  https://specifications.freedesktop.org/wm-spec/latest-single/

until recently

  https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/97

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-03-06 14:18:20 +00:00
Kirill Primak
b13fe9b3a1 backend/wayland: use a separate event queue for busy loops
This avoids processing events which we're not interested in.
Specifically, this fixes a case where output_commit() could be
indirectly called from itself either from import_dmabuf() or while
waiting for a configure event when enabling the output.
2025-03-01 16:03:52 +00:00
David Turner
c9d6339b60 Fix includes of wlr_output.h
Remove unneeded includes of wlr_output.h from wlr_compositor.h and
wlr_cursor.h (unneeded now that we forward-declare struct wlr_surface)
and put the actually-required includes in the right places.
2025-02-21 13:44:42 +00:00
David Turner
1380a48b4d Declare struct wlr_surface in a less weird place
wlr_compositor.h contains references to `struct wlr_surface` in function
arguments before it actually defines it.  This generally works because
wlr_compositor.h includes wlr_output.h which contains a
forward-declaration for `struct wlr_surface` (despite not actually
referencing it).

This is all pretty weird, and gives very confusing errors if you manage
to end up with wlr_output.h including wlr_compositor.h (eg. via an
indirect route) so make it less weird.
2025-02-21 13:44:42 +00:00
Alexander Orzechowski
d305934ebe ext_data_control: Add protocol implementation 2025-01-31 18:39:17 +00:00
Simon Ser
639ca05d35 matrix: move to util/
wlr_matrix is not a standalone type like other headers in types/,
it's more of an internal utility. Move it to the appropriate place.
2025-01-27 17:48:18 +01:00
Alexander Orzechowski
c1eb053f5e render/drm_syncobj: Remove the ready signal from timeline_waiter
It's unused.
2025-01-26 18:02:14 -05:00
Alexander Orzechowski
82223e451a render/drm_syncobj: Add a callback when ready
The old approach of using a signal is fundamentally broken for a common
usecase: When the waiter is ready, it's common to immediately finish and
free any resources associated with it.
Because of the semantics of wl_signal_emit_mutable() this is UB.
wl_signal_emit_mutable() always excepts that the waiter hasn't been freed
until the signal has finished being emitted.

Instead of over engineering the solution, let's just add a callback required
by wlr_drm_syncobj_timeline_waiter_init(). In this callback, the implementation
is free to finish() or free() any resource it likes.
2025-01-26 18:02:05 -05:00
Simon Ser
211eb9d60e matrix: drop rotation
It's unused.
2025-01-26 17:56:04 +01:00
Simon Ser
7d1f535e49 matrix: drop wlr_matrix_transpose()
It's unused.
2025-01-26 17:52:39 +01:00
Simon Ser
9b55737cf5 Make wlr_matrix private API
36cc698bc5 ("matrix: deprecate") has deprecated wlr_matrix more
than one year ago. It's now time to drop it from our public API.
2025-01-26 17:46:50 +01:00
Guido Günther
fa97f7f1f0 buffer: Move wlr_buffer_is_opaque to public header
Fixes: 1ee3ed43 ("buffer: Make wlr_buffer_is_opaque public")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-01-26 00:17:40 +01:00
Guido Günther
1ee3ed4310 buffer: Make wlr_buffer_is_opaque public
It's useful for compositors.
2025-01-25 23:42:49 +01:00
Kirill Primak
b25f98d583 pointer-constraints: use wlr_surface_synced.commit hook
This fixes a problem where an outdated surface input region was used to
compute the effective confinement region.

Additionally, this commit fixes a bug in pointer_constraint_create()
which caused the initial region to not be applied immediately.

This is a breaking change: set_region is now emitted before the role
commit hook is called, and it's not emitted if the region hasn't
actually changed.
2025-01-17 16:30:34 +00:00
Kirill Primak
f95270bb5e pointer-constraints: rewrite doc comments 2025-01-17 16:30:34 +00:00
Kirill Primak
c3224d4160 compositor: add wlr_surface_synced commit hook 2025-01-17 16:30:34 +00:00
Kirill Primak
e3596abc9a pointer-constraints: fix deactivating oneshot constraint on destroy 2025-01-17 16:03:36 +00:00
Kirill Primak
b03b05d2b3 xdg-dialog: add missing wm destroy signal 2025-01-15 19:51:05 +03:00
Kirill Primak
bcf8e467db xdg-toplevel-icon-v1: add implementation 2025-01-14 18:46:43 +00:00
Simon Ser
6bb8bb1cb7 ext-image-capture-source-v1: add start/stop hooks
This allows the source to change its behavior when actively
captured.
2025-01-14 16:42:12 +01:00
Simon Ser
08e14deeca ext-image-capture-source-v1: add output source 2025-01-14 16:42:12 +01:00
Simon Ser
855b3fd607 ext-image-capture-source-v1: add wlr_ext_image_capture_source_v1_set_constraints_from_swapchain() 2025-01-14 16:35:52 +01:00
Simon Ser
c24efad6df ext-image-copy-capture-v1: add wlr_ext_image_copy_capture_frame_v1_copy_buffer() 2025-01-14 16:35:52 +01:00
Simon Ser
4e4155ccbe ext-image-copy-capture-v1: new protocol implementation
Co-authored-by: Andri Yngvason <andri@yngvason.is>
2025-01-14 16:35:50 +01:00
Simon Ser
6712e774d4 ext-image-capture-source-v1: add source pointer cursors 2025-01-14 16:34:11 +01:00
Simon Ser
dadcbf65e6 ext-image-capture-source-v1: add base interface 2025-01-14 16:34:11 +01:00
Kirill Primak
eb85831284 text-input: fix wlr_text_input_manager_v3.text_inputs comment 2025-01-11 21:48:20 +00:00
Kirill Primak
a231bf7f62 backend: drop wl_display refs from docs 2025-01-11 21:36:29 +00:00