Commit graph

6658 commits

Author SHA1 Message Date
Simon Ser
36e7a672c7 xwayland: batch client ID request with other property requests 2023-10-06 08:35:33 +00:00
Simon Ser
f5797be8a8 xwayland: batch property requests when handling new window
Instead of sending one request, waiting for the reply, and
repeating for all properties we're interested in, we can send all
property requests in one go and then wait for the server to reply.
2023-10-06 08:35:33 +00:00
JiDe Zhang
ca19014af0 xwayland: fix double free wlr_xwayland_shell_v1 2023-10-06 10:04:11 +02:00
Simon Ser
e58c7bb792 render/drm_format_set: use published kernel doc URL
The kernel patch has been merged, so this is available in the
official docs now.
2023-10-05 21:29:25 +00:00
Manuel Stoeckl
e0adaaffb6 render/vulkan: constrain blend to output subpass to redrawn region
This commit only applies to the render pass API.
2023-10-05 11:45:32 +00:00
Manuel Stoeckl
d180f4d9b3 util: add struct to track union of rectangles
The new struct rect_union is designed to make it easier to
efficiently accumulate a list of rectangles, and then operate
on an exact cover of their union.

Using rect_union, the times needed to added t rectangles, and then
compute their exact cover will be O(t), and something between Ω(t) and
O(t^2), depending on the rectangle arrangement. If one tries to do
the same by storing a pixman_region32_t and updating it with
pixman_region32_union_rect(), then total time needed would be between
Ω(t^2) and O(t^3), depending on the input. Without changing the public
API (data structure + rectangle ordering rules) for pixman_region32_t,
it is impossible to improve its worst case time.
2023-10-05 11:45:32 +00:00
Alexander Orzechowski
d817ebb80f renderer: Don't crash when trying to fallback to pixman
Pixman won't be chosen by default if the system has a valid render node
but gles2 and vulkan creation failed.
2023-10-05 05:14:54 -04:00
Alexander Orzechowski
4f92ecde82 renderer_autocreate_with_drm_fd: Ensure fd isn't bogus 2023-10-05 05:00:44 -04: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
Simon Ser
3406c1b17a contributing: add safety section 2023-10-04 11:08:58 +02:00
Alexander Orzechowski
1b0694b794 treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical 2023-10-03 01:51:07 -04: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
Kirill Primak
016494af1b xdg-surface: assert that xdg_surface isn't inert 2023-10-02 18:37:09 +00:00
Alexander Orzechowski
5ef42e8e8a output_defer_present: Calloc right struct 2023-10-02 10:11:26 -04:00
Rose Hudson
83af3202f9 output: defer fake present events until after commit
Since headless and wayland-without-presentation-feedback were firing
present inside their commit impls, present was getting fired before
commit, which is cursed. Defer this with an idle timer so that commit
handlers can run before present handlers.
2023-10-02 12:34:06 +00:00
Simon Ser
a1679c92ce backend/drm: restore pending page-flip check when tearing
DRM_MODE_PAGE_FLIP_ASYNC doesn't allow user-space to submit new
buffers before waiting for the uevent: the kernel will return EBUSY
in that case.

Fixes: c2aa7fd965 ("backend/drm: Add async page flip support to legacy")
2023-10-02 10:26:47 +02:00
Alexander Orzechowski
c044aef5f0 cursor: Unset cursor if texture upload failed
We need to make sure cursor_output_cursor_update() will clear the old
texture references through all code paths.
2023-10-02 06:08:10 +00:00
Alexander Orzechowski
7ef2c0a506 cursor: Remove dead code
This conditional would never fire because `cursor_output_cursor_reset_image`
nulls the previous xcursor.
2023-10-02 06:08:10 +00:00
Alexander Orzechowski
00dcc68e16 cursor: Unset cursor image when there is not available xcursor theme
This fixes a crash in the case where the last cursor was a client surface
cursor but then transitioned into a server managed xcursor that isn't
available. Because the logic would return early before, we would continue
to reference a texture pointer belonging to a client surface but would
otherwise disassociate with it (we wouldn't clear the cursor if the surface
is destroyed) resulting an an eventual UAF.

Let's just make the cursor invisible if we don't know what to show. It's
compositor policy if they want to show a default.

Co-authored-by: Scott Moreau <oreaus@gmail.com>
Fixes: #3686
2023-10-02 06:08:10 +00:00
Simon Zeni
9816b59b0e types/wlr_tearing_control_v1: use safe list iteration on destroy 2023-10-01 20:41:22 -04: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
Brian J. Tarricone
eacb4cf6d2 Fix possible crash in server-decoration when surface destroyed
If the underlying surface is destroyed, but the client has not yet
destroyed the server decoration object, and then tries to call
request_mode() on it, the compositor will crash, because the
wlr_server_decoration struct has been freed, and the wl_resource's
user_data member has been NULLed out.

Yes, this is certainly an error for the client to do that, but I
shouldn't be able to write a buggy (or malicious) Wayland app that can
take down the entire compositor.
2023-09-27 23:54:51 -07: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
Alexander Orzechowski
98a745d926 render/pass: Remove empty box early return 2023-09-21 02:25:34 -04:00
Alexander Orzechowski
e9706e62f5 renderer: Use wlr_render_rect_options_get_box
Fixes: #3697
2023-09-21 02:25:34 -04:00
Alexander Orzechowski
5299d973d5 render/pass: Introduce wlr_render_rect_options_get_box 2023-09-21 02:25:34 -04:00
Manuel Stoeckl
dbc7a5cada screencopy_v1: only bind, not render with, buffer in shm copy path
wlr_renderer_read_pixels does not need to be called inside a render
pass; rather, it only needs to have the correct buffer bound to
the renderer. This commit optimizes the implementation of
frame_shm_copy(...) by only binding the source buffer instead of
starting a no-op render pass with it.
2023-09-11 20:25:07 -04:00
Alexander Orzechowski
6c54c34713 output: Mutate frame_pending needs_frame when there is an explicit output commit
These states would be set if output_init is invoked with a enabled state.
This would make frame_pending == true which means wlroots will ignore
any further frame events and the compositor will appear dead.
2023-09-11 03:28:01 -04:00
Manuel Stoeckl
5aea90264f render/vulkan: fix validation error with vkCmdBlitImage
Specfically, VUID-vkCmdBlitImage-srcImage-00247.
2023-09-10 15:28:57 -04:00
Simon Ser
65bbbbbf0c render/vulkan: de-duplicate VkImageUsageFlags
The flags passed to vkCreateImage() must match the flags used when
querying formats. Make this clearer by using the same variable.
2023-09-09 23:32:28 +00:00
Leo Li
b18a849fc3 wlr_scene: Use cached node coordinates where possible
Avoids recalculating node coordinates.
2023-09-08 21:11:19 +00:00
Alexander Orzechowski
9be72ec4ca backend/drm: Compute custom mode correctly 2023-09-07 01:56:32 +00:00
Kirill Primak
e315068b98 xdg-popup: validate parent
This matches Mutter's behavior.

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3576
2023-09-01 12:48:36 +03:00
Simon Ser
2926acf60d tinywl: set minimum wlroots version in Makefile 2023-09-01 00:28:55 +09:00
Simon Ser
717ded9bb0 backend/drm: drop no-op shortcut
Since e5fc8cd4c7 ("output: trigger frame/present events on all
commits on enabled output"), any commit on an enabled output is
supposed to trigger frame/present events.

The DRM backend was skipping the commit completely for no-op
commits. Stop doing so.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3719
2023-08-25 17:16:05 +02:00
Simon Ser
7bf6c1fc6c render/pass: ensure rect has positive size
Ported from wlr_render_rect().
2023-08-24 03:54:36 +00: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
Manuel Stoeckl
a94168b5fe render: ensure wlr_render_rect_options->box is nonempty
This optimization also fixes an validation error with the Vulkan
renderer by ensuring vkCmdClearAttachments does not receive empty
regions.
2023-08-23 18:28:58 +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
462f04db9e output: don't forbid multiple commits per frame
It's still not possible to commit while a page flip is pending in DRM,
but we don't need to enforce that here and allowing it through the
common interface can be useful for other backends.

This decouples commits from frame scheduling, which is going to make the
new frame schedulers easier to implement.
2023-08-23 16:37:07 +02:00
Rose Hudson
fc81d06add backend/drm: report !presented if session is inactive 2023-08-23 16:36:43 +02:00
Rose Hudson
f7afef0b1f backend/drm: don't set frame_pending on modeset
https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3664#note_2020392
we're gonna have to trust Simon on this one 🤞
2023-08-23 16:36:43 +02:00
Simon Ser
11aba53ead render: only open DRM render node if necessary
Only open a render node if we actually need one (ie, if we're about
to attempt GLES2 or Vulkan).
2023-08-23 13:42:07 +02: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
Alexander Orzechowski
e85c79051c wlr_output: Set current_mode during new custom mode
When setting a custom mode current_mode will not be reset. That means
that next time the compositor tries to reset back from the custom mode,
it will compare against the stale current_mode and unset
WLR_OUTPUT_STATE_MODE erroneously.
2023-08-22 09:46:24 +00:00
Simon Ser
72787db98a compositor: drop wlr_surface_destroy_role_object()
This function is now unnecessary.
2023-08-21 18:56:09 +02:00