Commit graph

6898 commits

Author SHA1 Message Date
Kenny Levinsen
153dea9c28 backend/drm: Free current_modeinfo on error 2024-02-22 00:40:54 +01:00
Simon Ser
0d9ffef774 backend/drm: don't destroy previous DRM master blobs
On startup, we fetch the previous MODE_ID blob ID so that
compositors can keep using the previous mode if they want to.
However, that blob doesn't belong to us, it belongs to the
previous DRM master. As a result, we get an error when trying to
destroy it.

Fix this by tracking whether the blob belongs to us or not.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3811
2024-02-21 15:10:44 +00:00
Simon Ser
d8f4a3d78c backend/drm: fix broken link to KMS property docs
The Linux graphics section of 01.org is no more. Link to more
official docs instead.
2024-02-21 12:03:37 +01:00
Simon Ser
cf7b91cc5f buffer: add single-pixel-buffer-v1 special case in buffer_is_opaque() 2024-02-21 08:54:35 +00:00
Simon Ser
431e8a7fd7 scene: ignore duplicate wlr_scene_output_layout_add_output() calls
An assert was added in [1] to avoid tracking the same output multiple
times. However, this is cumbersome for compositors [2]: they need to
add a special check for this. Additionally, this is inconsistent with
wlr_output_layout_add().

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4380
[2]: https://github.com/cage-kiosk/cage/pull/315
2024-02-20 11:04:46 +01:00
Simon Ser
842093bb84 Define _POSIX_C_SOURCE globally
Stop trying to maintain a per-file _POSIX_C_SOURCE. Instead,
require POSIX.1-2008 globally. A lot of core source files depend
on that already.

Some care must be taken on a few select files where we need a bit
more than POSIX. Some files need XSI extensions (_XOPEN_SOURCE) and
some files need BSD extensions (_DEFAULT_SOURCE). In both cases,
these feature test macros imply _POSIX_C_SOURCE. Make sure to not
define both these macros and _POSIX_C_SOURCE explicitly to avoid
POSIX requirement conflicts (e.g. _POSIX_C_SOURCE says POSIX.1-2001
but _XOPEN_SOURCE says POSIX.1-2008).

Additionally, there is one special case in render/vulkan/vulkan.c.
That file needs major()/minor(), and these are system-specific.
On FreeBSD, _POSIX_C_SOURCE hides system-specific symbols so we need
to make sure it's not defined for this file. On Linux, we can
explicitly include <sys/sysmacros.h> and ensure that apart from
symbols defined there the file only uses POSIX toys.
2024-02-15 15:41:12 +01:00
Simon Ser
efa706b769 util/log: drop unnecessary _XOPEN_SOURCE
snprintf() is actually ISO C99.

We still need POSIX for clock_gettime().
2024-02-15 15:20:14 +01:00
Simon Ser
17fe87af5e backend/drm: skip reset after VT switch if possible
If all connectors and planes already have the right CRTC set, or
are disabled, we can skip the device-wide reset after a VT switch.

I've contemplated using a more fine-grained logic to only reset
the connectors, CRTCs and planes that need to be migrated. However,
writing a correct algorithm for this would be quite involved, and it
doesn't seem worth the trouble anyways.

Closes: https://github.com/swaywm/sway/issues/7956
2024-02-15 09:56:33 +01:00
Simon Ser
653e28d2a3 backend/drm: fix typo in restore_drm_device() comment 2024-02-15 09:53:13 +01:00
Simon Ser
d2acd4c362 backend/drm: move restore logic to drm.c
We'll need to use a bunch of internal functions from that file in
the next commits.
2024-02-15 09:37:46 +01:00
Simon Ser
505175e56f backend/drm: atomically reset state after VT switch
Allows the KMS driver to parallelize the modesets, so should be
faster than going through each CRTC one by one.
2024-02-14 19:13:23 +01:00
Simon Ser
836cb820d0 backend/drm: call get_drm_connector_props() when creating connector
This function fetches property IDs. These don't change for the
lifetime of the connector. Instead of refreshing the property IDs
on hotplug (and leaving property IDs unset for disconnected
connectors), only fetch the property IDs when we create the
connector.
2024-02-14 19:12:14 +01:00
Simon Ser
feb54979c0 backend/drm: extract logic to build current connector state 2024-02-14 17:13:25 +01:00
Simon Ser
c397515ee5 backend/drm: use early return in handle_session_active() 2024-02-14 17:13:25 +01:00
Simon Ser
9a685cefa9 backend/drm: add destroy_blob()
Centralizes the logic to destroy a DRM blob: check whether it's
zero, and print a nice error message.
2024-02-14 17:13:25 +01:00
Simon Ser
741aaa3f76 backend/drm: drop wlr_drm_backend arg from create_mode_blob()
No need for this, the backend can be grabbed from the connector.
2024-02-14 17:13:25 +01:00
Simon Ser
76ed82c101 backend/drm: add drm_page_flip_create() 2024-02-14 17:13:25 +01:00
Simon Ser
97a6a58a95 backend/drm: fix fb_damage_clips_arr memory leak 2024-02-14 17:04:39 +01:00
Kirill Primak
4c69bc47f4 ext-foreign-toplevel-list-v1: improve/fix update_state()
This extracts common string updating logic into a function and fixes a
possible NULL dereference.
2024-02-13 19:36:21 +03:00
Simon Ser
6ad9e89a34 backend/drm: drop unnecessary _XOPEN_SOURCE
We only need base POSIX here.
2024-02-12 19:45:49 +01:00
Paul Cercueil
220df2aa0f
Add more POSIX compliance macros to fix uClibc support
- Add POSIX 1993.09 compliance macro in source files that use
  "struct timespec";
- Add POSIX 2001.12 compliance macro in source files that use
  "struct sigaction" and the SA_SIGINFO macro, or the fchmod()
  function;
- Add POSIX 2008.09 compliance macro in source files that use the
  getline() function.

These compliance macros are enough for wlroots to compile with the
git-master version of uClibc-ng.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
2024-02-12 17:41:45 +01:00
columbarius
9e426e70e6 ext-foreign-toplevel-list-v1: new protocol implementation
This implements the new ext-foreign-toplevel-list-v1 protocol [1].
Implemented analog to the zwlr-foreign-toplevel-management-v1 implementation.
The additional _ext_ in the names was added to avoid name collisions.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/187

Co-authored-by: Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de>
2024-02-12 01:05:19 +01:00
Kirill Primak
cb815e8847 pointer-constraints: handle inert pointer resources correctly 2024-02-06 22:06:09 +03:00
Austin Shafer
4cd556ea20 linux_dmabuf_v1: allow callbacks for checking dmabuf import 2024-02-06 16:11:30 +00:00
Kirill Primak
811ca199c4 xdg-shell: drop automatic surface configuration
Compositors now are expected to wait for an initial commit by checking
wlr_xdg_surface.initial_commit on every surface commit and send
(schedule) configure events manually.
2024-02-06 13:48:00 +00:00
Austin Shafer
d368028bd5 allocator: remove backend parameter in allocator_autocreate_with_drm_fd
Since we only use the backend capabilities here we can simply pass
them in directly. This allows other locations to create an allocator
even if they don't have a backend. They can simply specify the caps
they want instead.
2024-02-02 16:36:31 -05:00
Simon Ser
a8aeadeab2 switch: add docs 2024-02-02 17:52:56 +01:00
Simon Ser
967e788bc8 backend/session: add docs 2024-02-01 16:08:47 +01:00
Kirill Primak
5b08f91004 compositor: don't handle size or viewport src change in surface_update_damage()
This is incorrectly leads to buffer reuploading.
2024-02-01 14:51:43 +00:00
Kirill Primak
7dfbd87771 compositor: drop wlr_surface.external_damage 2024-02-01 14:51:43 +00:00
Kirill Primak
56cc25185d cursor: fix and simplify region mapping
Fixes: 4462f5dcb3
2024-02-01 14:42:00 +00:00
Leo Li
60af3b6b78 render/gles2: Fixup dropping has_alpha from pixel_format
Fixes: 71fb55f3 ("render/pixel-format: Move has_alpha into it's own array")
2024-01-31 20:27:22 +01:00
Leo Li
71fb55f3bf render/pixel-format: Move has_alpha into it's own array
Some opaque pixel formats (nv12, p010) require per-plane bytes_per_block
info. However, it doesn't make sense to store them in
wlr_pixel_format_info, as they will never be useful (currently, this
info is used for shm, which doesn't have a concept of multi-planar
buffers.)

Let's define a separate array and function for determining whether a
pixel format has alpha.
2024-01-31 13:47:17 -05:00
Andri Yngvason
3a91dc1b48 Create & implement transient seat protocol 2024-01-31 08:22:05 +00:00
Simon Ser
435ca39960 linux-dmabuf-v1: bump to v5
We already send a protocol error when the modifiers aren't the same
for all planes.

References: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/224
2024-01-31 08:20:17 +00:00
Simon Ser
6991f03767 linux-dmabuf-v1: switch to stable
The protocol is no longer unstable.
2024-01-31 08:20:17 +00:00
Simon Ser
ba3c1ae065 linux-dmabuf-v1: fix include guard name 2024-01-31 08:20:17 +00:00
Kirill Primak
92ff86db23 backend/drm: use wlr_drm_backend.name for fd cloning
This also fixes a memleak.
2024-01-31 11:10:55 +03:00
Alexander Orzechowski
8dff1bb9bd wlr_damage_ring: Replace wlr_damage_ring_rotate_buffer with original list impl
The seq based implementation is complex to reason about and doesn't even
work.
2024-01-29 19:17:39 +00:00
Kirill Primak
4688a371e0 compositor: don't get buffer from pending buffer resource too early
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3795
2024-01-27 17:48:07 +03:00
Simon Ser
00b869c1a9 backend/drm: add support for atomic tearing page-flips
The kernel patches [1] have been merged.

[1]: https://patchwork.freedesktop.org/series/120103/
2024-01-27 13:37:43 +01:00
Simon Ser
4ec901bb33 scene: release shm buffers once uploaded
Once a shm buffer is uploaded there's no reason for wlr_scene_buffer
to keep it locked any further. Allow the compositor to re-use it.
2024-01-27 12:21:54 +00:00
Kirill Primak
0052078bd3 compositor: introduce wlr_surface_reject_pending() 2024-01-27 12:05:05 +00:00
Félix Poisot
5ae8ce807a render/vulkan: correct sRBG gamma expansion in shader 2024-01-26 13:50:55 +00:00
Simon Ser
d1b39b5843 backend: take wl_event_loop instead of wl_display in wlr_backend_autocreate() 2024-01-25 15:05:36 +00:00
Simon Ser
f27808b8d9 backend/multi: take wl_event_loop instead of wl_display 2024-01-25 15:05:36 +00:00
Simon Ser
54f9944b48 backend/drm: drop wl_display argument
We can grab the event loop from the wlr_session instead.
2024-01-25 15:05:36 +00:00
Simon Ser
b62ac611c8 backend/x11: take wl_event_loop instead of wl_display 2024-01-25 15:05:36 +00:00
Simon Ser
ed0bba581b backend/wayland: take wl_event_loop instead of wl_display 2024-01-25 15:05:36 +00:00
Simon Ser
f5e8fa48f3 backend/libinput: drop wl_display argument
We can grab the event loop from the wlr_session instead.
2024-01-25 15:05:36 +00:00