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).
We don't want to iterate the subtree for trivial update scenarios. We only
care when a scene is reparented or disabled in which both cases provides
us with explicit damage
We were sending an output frame event as soon as we were done
rendering. As a result, the output would render in a busy loop when
a client was using the capture output for frame pacing purposes.
Instead, use the request_frame hook introduced in the previous
commit to throttle output frame events.
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/4036
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.
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.
Currently, the glslang check is run every time ninja is invoked,
even with an up-to-date build directory when GLSL shaders haven't
been modified. This is due to glslang not creating any output
file: the _check file never exists so ninja keeps trying to
generate it by running the command.
Unfortunately Meson doesn't support running commands with no
outputs [1]. Create an empty output file to fix this by setting
`capture: true`.
This doesn't work out-of-the-box, because glslang prints messages
to stdout, and provides no way to change this [2]. As a result,
shader errors are not surfaced back to the user - they end up in
the _check file. Workaround this with a thin wrapper which
redirects stdout to stderr when invoking glslang.
[1]: https://github.com/mesonbuild/meson/issues/11506
[2]: https://github.com/KhronosGroup/glslang/pull/4138
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.
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
The stop handler disables the output. However, the same source can
be captured multiple times in parallel. In that case, stop might
be called while another capture session is still ongoing.
Only disable the output if the last session is stopped.
Before this patch, when a surface became occluded on all outputs,
we'd reconfigure it with a base configuration (scale set to 1,
transform set to NORMAL, image description set to gamma 2.2/sRGB).
As a result, when quickly hiding a toplevel and showing it again,
the client would render to switch to the base configuration, then
render again to switch to the output configuration.
Avoi this needless back-and-forth by retaining the last sent
preferred configuration when a surface leaves all outputs.
Fixes use-after-free on exit of labwc running nested:
==50906== Invalid write of size 8
==50906== at 0x4A85403: wl_list_remove (wayland-util.c:57)
==50906== by 0x40BBAF9: destroy_wl_buffer (output.c:146)
==50906== by 0x40B9B4F: backend_destroy (backend.c:488)
==50906== by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906== by 0x40B78A6: multi_backend_destroy (backend.c:62)
==50906== by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906== by 0x4043DA0: server_finish (server.c:788)
==50906== by 0x403AA85: main (main.c:277)
==50906== Address 0xb4435e8 is 40 bytes inside a block of size 136 free'd
==50906== at 0x4A3E8EF: free (vg_replace_malloc.c:989)
==50906== by 0x409C954: buffer_destroy (shm.c:28)
==50906== by 0x40E96F4: buffer_consider_destroy (buffer.c:42)
==50906== by 0x40E9754: wlr_buffer_drop (buffer.c:52)
==50906== by 0x41498DA: slot_reset (swapchain.c:44)
==50906== by 0x4149933: wlr_swapchain_destroy (swapchain.c:53)
==50906== by 0x40CB1FA: wlr_output_finish (output.c:410)
==50906== by 0x40BE00B: output_destroy (output.c:957)
==50906== by 0x40CB2FC: wlr_output_destroy (output.c:436)
==50906== by 0x40B9AFC: backend_destroy (backend.c:481)
==50906== by 0x409E96F: wlr_backend_destroy (backend.c:68)
==50906== by 0x40B78A6: multi_backend_destroy (backend.c:62)
==50906== Block was alloc'd at
==50906== at 0x4A42C13: calloc (vg_replace_malloc.c:1675)
==50906== by 0x409CA84: allocator_create_buffer (shm.c:68)
==50906== by 0x409C7BA: wlr_allocator_create_buffer (allocator.c:186)
==50906== by 0x4149B80: wlr_swapchain_acquire (swapchain.c:102)
==50906== by 0x40C90DA: render_cursor_buffer (cursor.c:246)
==50906== by 0x40C93DC: output_cursor_attempt_hardware (cursor.c:303)
==50906== by 0x40C9A61: output_cursor_set_texture (cursor.c:420)
==50906== by 0x40C9738: wlr_output_cursor_set_buffer (cursor.c:352)
==50906== by 0x40F13A0: output_cursor_set_xcursor_image (wlr_cursor.c:507)
==50906== by 0x40F1B28: cursor_output_cursor_update (wlr_cursor.c:630)
==50906== by 0x40F1C2A: cursor_update_outputs (wlr_cursor.c:657)
==50906== by 0x40F1CF9: wlr_cursor_set_xcursor (wlr_cursor.c:674)
Fixes: 7963ba6a0d
("buffer: introduce wlr_buffer_finish()")
On BSD make, $> is an alias for $^. On both GNU and BSD make, $^
is supported. Specifying both resulted in duplicate object files
passed to the linker:
ld: error: duplicate symbol: main
>>> defined at tinywl.c:887
>>> tinywl.o:(main)
>>> defined at tinywl.c:887
>>> tinywl.o:(.text+0x0)
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Only use $^ and remove $>.
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.
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.
BT.1886 is different from other EOTFs in that the spec says that offset
b must be in electrical domain, so use the assumed display environment
from the specification as Lmin and Lmax then normalize bt.1886 to
produce optical luminance L in [0, 1]. See discussion at
https://gitlab.freedesktop.org/pq/color-and-hdr/-/merge_requests/63#note_3090016
If the client application is composed of multiple components and they
bind the manager global separately, choosing a single toplevel resource
with wl_resource_find_for_client() may result in a component only seeing
unknown toplevel handles from another component.
Maybe we should track which toplevel handle resource originate from
which manager resource so that a component never sees toplevel handles
resources from another component, but it's too annoying to implement.