Commit graph

2013 commits

Author SHA1 Message Date
John Lindgren
1facdeabe5 wlr_drm_lease_v1: Fix use-after-free in backend_destroy()
valgrind said (on exit from labwc):

    Invalid write of size 8
       at 0x487DEAF: wl_list_remove (wayland-util.c:56)
       by 0x487DF80: wl_signal_emit_mutable (wayland-server.c:2182)
       by 0x48CD6B7: backend_destroy.part.0.lto_priv.0 (backend.c:41)
       by 0x48DC19D: multi_backend_destroy (backend.c:58)
       by 0x4880286: UnknownInlinedFun (wayland-server.c:2315)
       by 0x4880286: wl_display_destroy (wayland-server.c:1170)
       by 0x112491: UnknownInlinedFun (server.c:485)
       by 0x112491: main (main.c:110)
     Address 0x1f9d0210 is 112 bytes inside a block of size 136 free'd
       at 0x484426F: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x487DF6D: wl_signal_emit_mutable (wayland-server.c:2179)
       by 0x48CD6B7: backend_destroy.part.0.lto_priv.0 (backend.c:41)
       by 0x48DC19D: multi_backend_destroy (backend.c:58)
       by 0x4880286: UnknownInlinedFun (wayland-server.c:2315)
       by 0x4880286: wl_display_destroy (wayland-server.c:1170)
       by 0x112491: UnknownInlinedFun (server.c:485)
       by 0x112491: main (main.c:110)
     Block was alloc'd at
       at 0x4846A73: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x4918D4E: drm_lease_device_v1_create (wlr_drm_lease_v1.c:639)
       by 0x48D3B00: wlr_multi_for_each_backend (backend.c:249)
       by 0x49191D2: wlr_drm_lease_v1_manager_create (wlr_drm_lease_v1.c:706)
       by 0x111EE9: UnknownInlinedFun (server.c:384)
       by 0x111EE9: main (main.c:92)
2022-09-15 21:24:05 -04:00
Simon Ser
7d9c595f19 output/cursor: downgrade error messages
When the output doesn't support hardware cursors, these errors
will be printed. However, these errors are expected and we have a
proper fallback.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3457
2022-09-15 09:33:30 +02:00
Simon Ser
b5a474189e output/render: log human-readable format 2022-09-14 12:13:17 +02:00
Kirill Primak
42ae1e75aa subcompositor: consider mapping after adding
ec8b49c93f calls subsurface_consider_map()
too early. Instead, call it after emitting new_subsurface signal to let
compositors receive a map event.
2022-09-12 18:44:36 +00:00
Kirill Primak
3abedaf211 subcompositor: move+rename subsurface_parent_commit() 2022-09-12 18:44:36 +00:00
Kirill Primak
4cc3abb966 xdg-foreign-v2: s/unmap/destroy
Same as the previous commit.
2022-09-11 09:20:08 +03:00
Kirill Primak
ba7bbab3ab xdg-foreign-v1: s/unmap/destroy
dac040f87f mistakenly renamed
xdg_surface_destroy listener, which was listening to *unmap* events, to
xdg_surface_unmap. The actual fix, however, is to listen to destroy
events. This fixes various crashes.
2022-09-11 09:20:08 +03:00
Simon Ser
d8ef9a95de xdg-foreign-v2: return wlr_xdg_toplevel in verify_is_toplevel()
This makes it clearer that the wlr_xdg_toplevel cannot be NULL.
2022-09-11 09:20:08 +03:00
Simon Ser
053bb42a6d xdg-foreign-v1: return wlr_xdg_toplevel in verify_is_toplevel()
This makes it clearer that the wlr_xdg_toplevel cannot be NULL.
2022-09-11 09:20:08 +03:00
Consolatis
0cff058f38 wlr_virtual_pointer_v1: fix discrete scrolling
It seems it was forgotten to adjust when implementing
	!3461 High-resolution scroll wheel support
2022-09-08 05:33:28 +02:00
Alexander Orzechowski
2e06ff5688 wlr_scene: Clarify surface commit frame events 2022-09-05 08:24:50 +00:00
Alexander Orzechowski
35d94d779c wlr_scene: Consider screen position when culling background 2022-09-03 18:42:17 -04:00
Kirill Primak
26e1812ab3 output-layout: improve wlr_output_layout_output_in_direction()
Now the function checks if the reference output belongs to the layout,
and returns NULL if it doesn't.
2022-08-30 19:26:23 +03:00
Kirill Primak
2ea80eb115 output-layout: avoid uninitialized wlr_box fields 2022-08-30 19:26:23 +03:00
Kirill Primak
4462f5dcb3 cursor: avoid uninitialized wlr_box fields 2022-08-30 19:26:20 +03:00
Alexander Orzechowski
138d21464d wlr_compositor: Don't leak region32 when calculating opaque region 2022-08-30 03:03:21 -04:00
Alexander Orzechowski
78cf39b6bd wlr_scene: Don't leak a region32 when texture failed to upload 2022-08-29 16:19:30 +00:00
Alexander Orzechowski
fe9e193ab5 wlr_scene: More sanity checking
The render list should neither contain scene trees or null buffers.
2022-08-29 16:19:30 +00:00
Kirill Primak
7333a4602a util/set: overhaul 2022-08-29 13:48:42 +00:00
Kirill Primak
20c208d46a util/array: unclutter 2022-08-29 13:48:42 +00:00
Isaac Freund
d94d1bf0ea
output: clean up after modifierless test failure
If the first test in output_ensure_buffer() fails with modifiers we
replace the swapchain with a modifierless swapchain and try again.
However if that fails as well the output is currently stuck without
modifiers until the next modeset.

To fix this, destroy the modifierless swapchain if the test using it
fails. The next output_attach_back_buffer() call will create a swapchain
that allows modifiers when needed.
2022-08-28 16:04:22 +02:00
Alexander Orzechowski
fa7d2cb8d6 wlr_scene: Only consider visible parts of the node when culling background
Originally, I thought that we could safely subtract opaque regions
from the background even if the black rect optimization was kicking in.
This is wrong because a scene node that isn't fully occluded will still
appear in the render list even if its partially under a black rect. We
need to make sure that while culling the background, we only consider
opaque regions that are also visible. This will fix the black rect
optimization with the background.
2022-08-26 19:07:52 -04:00
yiqiang
6a11256cd0 scene/wlr_scene:fix judgment of invisible node 2022-08-26 22:19:22 +00:00
Alexander Orzechowski
525506559a wlr_compositor: Use wlr_fbox_equal 2022-08-25 19:00:13 -04:00
Isaac Freund
d452a729cb
wlr-output-management: fix broken asserts
These asserts were broken in 4c1afb12 as new implementations were added
without updating the wl_resource_instance_of() calls.
2022-08-25 00:51:32 +02:00
Isaac Freund
4c1afb126b wlr-output-management: Implement version 3 release requests
Head/mode resources older than version 3 and lacking a release request
are intentionally leaked as this is the only way to fix the race.

Implements: https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/merge_requests/114
2022-08-24 14:10:23 +00:00
Alexander Orzechowski
d3cb6b73a2 wlr_scene: Initialize region32 before trying to use it 2022-08-22 14:46:41 -04:00
Alexander Orzechowski
8bd7170fd9 Use env helpers 2022-08-22 10:18:52 -04:00
Alexander Orzechowski
e7477c7114 wlr_scene: Improve awkward code style 2022-08-22 10:18:00 -04:00
Alexander Orzechowski
9bba4284e4 wlr_scene: Cull background
We don't need to worry about the black rect optimization here (that
always assumes that there will be a black background) because the
background is culled based on the render list. That means if a black rect
is removed, the visibility will reach all the way to the bottom forcing
the renderer to clear the area not breaking the assumption.
2022-08-22 10:17:59 -04:00
Alexander Orzechowski
6d1b8b376d wlr_scene: Only enable black rect optimization if culling is enabled
If culling is not enabled, there is no longer any guarantee that the
elements behind the rect won't be rendered. We must render the black rect
in all circumstances to cover up anything rendered.

This fixes the WLR_SCENE_DISABLE_VISIBILTY option.
2022-08-19 16:18:46 -04:00
Alexander Orzechowski
4d4f823263 wlr_scene: Simplify calculate_visibilty option 2022-08-19 16:18:11 -04:00
Kenny Levinsen
7c575922c0 wlr_scene: Convert render_list to wl_array
This simplifies some of the growth logic, but uses array_realloc to shrink the
array if needed.
2022-08-19 19:38:33 +02:00
Mark Bolhuis
9ab819684d types/wlr_xdg_output_v1: Fix wl_output.done bug.
If the client binds to version 3 of zxdg_output_v1 and version 1 of
wl_output no wl_output.done or zxdg_output_v1.done event is
emitted [1].

Also no wl_output.done event is emitted when version 2 or lower of
zxdg_output_v1 is bound to.

Add a version check to output_manager_handle_get_xdg_output so that no
wl_output.done event is emitted when using version 1 of wl_output and
version 2 or lower of zxdg_output_v1.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/81
2022-08-19 14:22:23 +00:00
Alexander Orzechowski
ef4baea0e2 Use wl_signal_emit_mutable 2022-08-18 07:16:16 -04:00
yiqiang
3621c14b82 wlr_scene: fix color value when filtering black boxes
Signed-off-by: yiqiang <yiqiang@kylinos.cn>
2022-08-16 10:52:03 +08:00
Alexander Orzechowski
bea4bd43e3 wlr_scene: Use wlr_box_equal 2022-08-15 07:37:09 -04:00
Alexander Orzechowski
bcf7a79357 wlr_scene: Use wlr_fbox_equals 2022-08-15 06:14:59 -04:00
Alexander Orzechowski
919e67da7d wlr_scene: Account for occlusion by other scene nodes when calculating visibility 2022-08-14 02:38:51 -04:00
Alexander Orzechowski
ce57485e6a wlr_scene: Calculate output intersections based on node visibility
This has a few benefits one of them crucial for proper operation:
 - The primary output will be based on the largest area that is actually
 visible to the user. Presentation and frame done events are based on
 this state. This is important to do since we cull frame done events.
 If we happen to be in a situation where a surface sits mostly on output
 A and some on output B but is completely obstructed by for instance a
 fullscreen surface on output A we will erroneously send frame_done
 events based on output A. If we base things as they are in reality
 (visibility) the primary output will instead be output B and things will
 work properly.
 - The primary output will be NULL if the surface is completely hidden.
 Due to quirks with wayland, on a surface commit, frame done events are
 required to be sent. Therefore, a new frame will be submitted for rendering
 on the primary output. We can improve adaptive sync on completely hidden
 but enabled surfaces if we null out the primary output in this state.
 - The client will be more likely to choose better metadata to use
 for rendering to an output's optimal rendering characteristics.
2022-08-14 02:38:51 -04:00
Alexander Orzechowski
342830e99c wlr_scene/surface: Hook through opaque metadata 2022-08-14 02:38:50 -04:00
Alexander Orzechowski
18417026be wlr_scene: Introduce buffer opaque region metadata 2022-08-14 02:38:50 -04:00
Alexander Orzechowski
0a9a941ba3 wlr_scene: Rewrite direct scan out logic to rely on visibility
Also make the regular rendering logic use the introduced
render list.
2022-08-14 02:38:50 -04:00
Alexander Orzechowski
14f4cfffba wlr_scene: Don't render non visible parts of textures/rects
We can also get rid of the intersection checks in the rendering functions
because we are guaranteed to already be in the node do to the prior
intersection checking of the node visibility.
2022-08-14 02:38:50 -04:00
Alexander Orzechowski
d16d341381 wlr_scene: Only send frame done events for visible buffers 2022-08-14 02:38:50 -04:00
Alexander Orzechowski
6d62300324 wlr_scene_set_buffer_with_damage: Only damage the visible parts of the node 2022-08-14 02:38:50 -04:00
Alexander Orzechowski
c6246272fd wlr_scene: Rework damage handling
Simplify damage handling by using our cached visibility state.
Damaging can happen in one step because since we can use the old visibility
state which represent what portions of the screen the scene node was. This
way we can damage everything in one step after the fact.
2022-08-14 02:38:50 -04:00
Alexander Orzechowski
028606512d wlr_scene: Add per scene node visibility 2022-08-14 01:39:20 -04:00
Alexander Orzechowski
f411ca040e wlr_scene: Damage scene on node destroy by disabling node
This removes one trivial call of scene_node_damage_whole. It's easier
to disable the node later than it is to do the damage dance later.
2022-08-14 01:39:20 -04:00
Alexander Orzechowski
7f17774d18 wlr_scene: Introduce scene_nodes_in_box
Will query the scene for all nodes that appear in the given wlr_box.
The nodes will be sent to the iterator from closest to farthest from the
eye.

Refactor wlr_scene_node_at to use this new function.
2022-08-14 01:39:20 -04:00