Commit Graph

6994 Commits

Author SHA1 Message Date
Kirill Primak 2f3ea4590a viewporter: fix outdated docs
wlr_render_subtexture_with_matrix() has been removed.
2024-03-25 17:48:07 +00:00
Kirill Primak 072f6ed977 viewporter: fix "has buffer" check
Previously, cases when a viewport source box was updated without attaching
a buffer weren't checked for correctness properly because the state's buffer
would be NULL. Use wlr_surface_state_has_buffer() instead.
2024-03-24 02:20:18 +00:00
Vaxry 538a7a190d types/text-input-v3: assert on invalid _leave() and _enter() calls
It's invalid usage, but shouldn't cause memory mayhem, assert instead
2024-03-22 21:34:48 +00:00
Ian Forbes e3bd318547 drm/backend: add support for cursor hotspots
Enables DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT and sets the cursor hotspots on the
cursor plane so virtualized drivers can accelerate mouse movement.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3776
2024-03-22 13:54:18 -05:00
Alexander Orzechowski 94c31b824c screencopy: Add some logging 2024-03-22 11:36:12 -04:00
Alexander Orzechowski 3224fe6a51 screencopy: Remove dead code 2024-03-22 11:33:10 -04:00
Isaac Freund b7d003caef
scene: constify subsurface_tree_set_clip() 2024-03-20 12:56:28 +01:00
Simon Ser 873e8e4558 tablet-tool: document event data 2024-03-18 13:02:32 +00:00
Isaac Freund 5a5aa72571 security-context: constify lookup_client()
This is worth doing despite wl_client_get_destroy_listener() incorrectly
accepting a mutable wl_client pointer since this lookup_client()
function will primarily be used with a wl_display_global_filter_func_t
which only provides a const wl_client pointer.

Work around this libwayland API wart in wlroots so compositors don't
have to.
2024-03-18 08:18:51 +00:00
Isaac Freund c5eda09166 single-pixel-buffer: make wl_global public
I wish to use a allowlist of globals for my security context
implementation rather than a blocklist, which means I need access to
the wp_single_pixel_buffer_manager_v1 global in order to allowlist it.

I think using a allowlist will make it harder for me to accidentally
expose globals to a security context that were meant to be restricted.
2024-03-18 08:12:53 +00:00
Isaac Freund af4987c751 idle-notify: make wl_global public
I wish to use a allowlist of globals for my security context
implementation rather than a blocklist, which means I need access to
the ext_idle_notifier_v1 global in order to allowlist it.

I think using a allowlist will make it harder for me to accidentally
expose globals to a security context that were meant to be restricted.
2024-03-18 08:12:53 +00:00
Isaac Freund 0398d1b85a wlr_shm: make wl_global public
I wish to use a allowlist of globals for my security context
implementation rather than a blocklist, which means I need access to
the wl_shm global in order to allowlist it.

I think using a allowlist will make it harder for me to accidentally
expose globals to a security context that were meant to be restricted.
2024-03-18 08:12:53 +00:00
Simon Ser 65bf7d1679 examples: send xdg_toplevel configure events
Commit 811ca199c4 ("xdg-shell: drop automatic surface configuration")
has updated tinywl for the breaking change, but missed examples.
2024-03-15 13:20:35 +01:00
Simon Ser 7a8e2cd8ed backend/libinput: drop stray space 2024-03-15 12:48:27 +01:00
Simon Ser bd8796d465 backend/libinput: drop outdated gesture cap logging
We've been supporting gesture events for a long time.
2024-03-15 12:34:19 +01:00
Kirill Primak 71be993982 backend/drm: set adaptive_sync_status again
Fixes: d7d974ae30
2024-03-15 10:39:05 +03:00
Simon Ser bda1b41ee2 output-swapchain-manager: new helper
This new helper assists compositors in allocating buffers for
modesets. It degrades to different allocation parameters as
needed, and should help with screens not turning on when multiple
outputs are connected on some hardware (e.g. Intel).

For simplicity, the old logic to try allocating with explicit
modifiers first and then fallback to implicit modifiers later is
left as-is. We'll probably want to have more complicated logic
instead in the future: try the fallback on one output at a time,
and try dropping modifiers one by one instead of using implicit
modifiers (at the cost of some combinatorial explosion).

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/1873
Co-authored-by: Kenny Levinsen <kl@kl.wtf>
2024-03-14 22:08:01 +00:00
Simon Ser 52e01a9c8b backend/drm: implement wlr_backend_impl.{test,commit} 2024-03-14 22:03:10 +00:00
Simon Ser d41b5efc65 backend/drm: fix adaptive sync no-op changes
When a compositors submits a wlr_output_state with
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED set and
adaptive_sync_enabled = false on an output which doesn't support
adaptive sync, we'd fail the commit. Fix this.

This bug was previously hidden because wlr_output_commit() drops
no-op changes from wlr_output_state.committed.
2024-03-14 22:03:10 +00:00
Simon Ser 35737ab00c backend/drm: add drm_connector_prepare()
Extract bits we'll re-use for device-wide commits.
2024-03-14 22:03:10 +00:00
Simon Ser a4f54086c1 backend/drm: move post-commit disable logic to drm_connector_apply_commit()
After disabling a connector, we need to cleanup the connector to
teardown the surfaces and unlock the FBs.

Move this logic into drm_connector_apply_commit() so that it's
applied when drm_commit() is called from somewhere else than
drm_connector_commit_state().
2024-03-14 22:03:10 +00:00
Simon Ser 5efa88ee7a backend/drm: drop drm_device_state_init_single()
There is a single caller now, so we can inline the function.
2024-03-14 22:03:10 +00:00
Simon Ser ee01712847 backend/drm: unify connector test and commit codepaths
There is some duplicated logic between these two functions.

The commit codepath was calling the test function before doing the
real commit, so this also saves an unnecessary test-only commit
when performing a real commit.
2024-03-14 22:03:10 +00:00
Simon Ser 2ff3479558 output-management-v1: add wlr_output_configuration_v1_build_state()
A convenience function to make it easier for compositors to
implement the protocol.
2024-03-14 22:03:10 +00:00
Simon Ser 917c650903 backend/multi: implement wlr_backend_impl.{test,commit} 2024-03-14 22:03:10 +00:00
Simon Ser 78c76ddd09 backend: add wlr_backend_{test,commit}() 2024-03-14 22:03:10 +00:00
Simon Ser fc4996d853 backend/drm: rework struct wlr_drm_page_flip for multiple connectors
We need to store the CRTC ID for each connector at the time of the
atomic commit, because future commits may change the CRTC/connector
mapping.
2024-03-14 22:03:10 +00:00
Simon Ser 805807fd5b backend/drm: add infrastructure for device-wide commits 2024-03-14 22:03:10 +00:00
Simon Ser 4636f8c407 backend/drm: track pending atomic state in wlr_drm_connector_state
This centralizes logic common for both the atomic and libliftoff
backends. Additionally, a struct will make it easier to implement
multi-connector commits (since it can be stored in an array).
2024-03-14 22:03:10 +00:00
Simon Ser d7d974ae30 backend/drm: drop VRR debug message
These weren't super helpful and will get in our way for
multi-connector commits.
2024-03-14 22:03:10 +00:00
Simon Ser 3d72da9ed7 backend/drm: extract post-commit logic into functions
It's more readable, and we'll soon call this from a loop for
multi-connector commits.
2024-03-14 22:03:10 +00:00
Simon Ser f8f2dde1f0 backend/drm: add wlr_drm_connector_state.connector
Will be useful for multi-connector commits, to avoid having to
pass the list of connectors separately from their state.
2024-03-14 22:03:10 +00:00
Simon Ser 859373b253 scene: listen to renderer destroy in wlr_scene_buffer
When a renderer is destroyed, so are all textures. Reset the
texture in that case.
2024-03-14 22:07:42 +01:00
Simon Ser 3d9f330ee0 scene: add scene_buffer_set_texture() 2024-03-14 22:06:10 +01:00
Simon Ser f0d8377732 output: listen to renderer destroy in wlr_output_cursor
When a renderer is destroyed, so are all textures. Reset the
texture in that case.
2024-03-14 22:05:59 +01:00
Simon Ser 9e3576426d buffer: listen to renderer destroy in wlr_client_buffer
When a renderer is destroyed, so are all textures. Reset the
texture in that case.
2024-03-14 22:03:13 +01:00
Isaac Freund 5bef385ffc tablet_v2: destroy tablet seats on manager destroy
This fixes an invalid write in tablet_seat_destroy if the tablet manager
is destroyed before the wlr_seat.
2024-03-14 15:10:06 +00:00
Simon Ser 0e5034d8ba compositor: add wlr_compositor_set_renderer()
Allows compositors to switch the wlr_renderer at runtime.

Useful for handling GPU resets.
2024-03-14 14:34:44 +01:00
Simon Ser 3075e6a6f9 compositor: use compositor to get renderer
This allows us to remove the renderer destroy listener. The
listener was buggy: compositors can't destroy surface resources on
their own.

The wlr_compositor will always outlive the wlr_surface, so no need
for a destroy listener.
2024-03-14 12:29:01 +00:00
Simon Ser 508d8c9a01 compositor: handle renderer destroy
Don't leave a stale renderer pointer behind.
2024-03-14 12:29:01 +00:00
He Yong ac1232e576 tinywl: destroy wlr_renderer, wlr_allocator and wlr_cursor
Suggested-by: Alexander Bakker <ab@alexbakker.me>
Suggested-by: Simon Ser <contact@emersion.fr>
2024-03-14 10:07:56 +00:00
Alexander Orzechowski 86e1b24d84 wlr_scene: Track damage of null textures
If we hit this case, we effectively failed to render something, this might
be because a texture failed to upload or the texture is momentarily
unavailable after a GPU reset. If we fail to render, we have to continue
to track damage for the next frame in hopes that the texture becomes
available then.

An alternative approach would be to fail the commit completely if we
find this case, but in the case of gpu resets, clients may not commit
a new buffer for a while, and a frozen display does not help.

This fixes damage tracking issues after a gpu reset.
2024-03-13 07:53:33 +00:00
Alexander Orzechowski 2aebb8e444 wlr_scene: Fix crash when committing NULL buffer
If we commit a null buffer, we want to avoid the buffer damage path and
instead just update the node to avoid it.
2024-03-13 07:50:54 +00:00
Guido Günther 341b3c8bd2 gles2: Avoid crash when glGetInteger64vEXT is missing
The spec for GL_EXT_disjoint_timer_query says

> The GetInteger64vEXT command is required only if OpenGL ES 3.0 or later
> is not supported.

Some GLES 3.2 implementations like the proprietary mali driver on the
rk3566 based OrangePi advertise GL_EXT_disjoint_timer_query but lack
glGetInteger64vEXT. Use glGetInteger64v instead.
2024-03-12 19:06:21 +01:00
Alexander Orzechowski 8da93e5936 wlr_scene: Add support for custom swapchains 2024-03-12 11:26:03 -04:00
Alexander Orzechowski 239354d644 wlr_scene: Decide when to commit output damage with buffers in damage ring
We will soon support custom swapchains. In order to track output damage
we should instead use the damage_ring which will hold all the buffers
we are currently tracking anyway across an arbitrary amount of swapchains.
2024-03-12 11:25:58 -04:00
Alexander Orzechowski 8220184a72 wlr_scene: Assert that buffer returned from swapchain is the right size 2024-03-12 11:16:30 -04:00
Simon Ser c79ed0706d scene: simplify scene_node_update() condition when setting buffer 2024-03-12 12:11:35 +01:00
Alexander Orzechowski 2d97935e82 wlr_scene: Call surface enter scale events on surface create
We would fail to call scene_node_update() which would then call output
events for us. We need to make sure to update the node when we first map
a buffer, as the comment explained.
2024-03-12 01:57:07 -04:00
Vaxry 50eae512d9 xwayland: add wlr_xwayland_get_xwm_connection
Allows the compositors to get the xwm connection
2024-03-09 11:21:17 +00:00