Commit Graph

2988 Commits

Author SHA1 Message Date
Kenny Levinsen
70d3635985 drm_format_set: Add wlr_drm_format_set_remove
wlr_drm_format_set_remove lets you remove a modifier from the specified
format, useful for filtering implicit modifiers.
2024-11-08 13:45:05 +01:00
Simon Ser
c0945b6613 render/allocator: drop allocator_autocreate_with_drm_fd()
This is now unused.
2024-11-07 18:55:01 +01:00
Simon Ser
4ec1defb3e all: use public <wlr/render/allocator.h>
We don't need to use the private header in these files.
2024-11-07 18:48:20 +01:00
Kenny Levinsen
1f13bc72fe render/vulkan: Garbage collect unused buffers
Perform a primitive garbage collection of buffers that have not been
used in the past 10 seconds, an arbitrarily selected number.

As garbage collection also makes span buffer allocation happen much more
often, logging on allocation activity leads to a lot of log noise so get
rid of that while at it.
2024-11-07 09:49:29 +00:00
Kenny Levinsen
0d728f96b7 util/time: Move NSEC_PER_SEC to header
This constant can be useful whenever one has to deal with timespecs, so
let's move it to the header.
2024-11-07 10:22:56 +01:00
Simon Ser
3fdbfb0be8 buffer: add more docs 2024-11-04 19:05:38 +01:00
Kirill Primak
ea93dd5cc3 xdg-system-bell-v1: add implementation 2024-11-03 08:54:10 +03:00
Alexander Orzechowski
ebab992b44 wlr_scene: Add notes about wlr_scene_rect taking premultiplied colors 2024-10-29 15:15:41 -04:00
Kenny Levinsen
c1ce983826 backend/drm: Store only a single plane viewport
We store both queued and current buffers to be able to retain both the
framebuffer currently on screen and the one queued to replace it. From a
re-use perspective, we only care about the last committed framebuffer.

The viewport is only stored in order to be re-used together with the
last committed framebuffer, so do away with the queued/current
distinction and store a single viewport updated every time a commit
completes.
2024-10-29 11:18:48 +01:00
Kenny Levinsen
1edd5e224f backend/drm: Remove reset from interface
The reset implementations are no longer used.
2024-10-29 11:13:13 +01:00
Kenny Levinsen
0f255b46fc backend/drm: Remove automatic reset on VT switch
Instead of trying to restore the drm state when the session is activated
again, just disconnect all outputs when the session is deactivated. The
scan that triggers on session activation will rediscover the connectors.
2024-10-28 21:20:30 +01:00
Kenny Levinsen
3df1528a8f backend/drm: Store viewport with framebuffer
Accessing the output state viewport require a buffer, and that might not
have a state with a buffer when preparing the plane properties for an
atomic commit.

Instead, store the properties at the same time as the fb, and use a
similar mechanism to carry the state around.
2024-10-28 19:22:27 +00:00
Kirill Primak
1520be3c5c Make all listeners private 2024-10-28 18:07:02 +00:00
Simon Ser
3bbfae73ae render/vulkan: add support for explicit sync 2024-10-28 17:51:21 +00:00
llyyr
4c74a8843a presentation-time: bump protocol version to v2
We've actually been doing the wrong thing this whole time, for v1 of the
protocol, we should set the refresh_nsec field to 0 if the output does
not have a constant refresh rate. However we've been setting it to the
fastest rate instead since eac7c2ad2f
which is incidentally exactly what v2 of the protocol proposes.

So allow advertising v2, and fix v1 to set refresh_nsec to 0.
2024-10-28 02:58:48 +05:30
Kirill Primak
6006023a37 Use WLR_PRIVATE for private fields 2024-10-25 07:51:51 +03:00
David Turner
e51ce333bc scene: Apply output offset for direct scanout
When setting the primary buffer location for direct scanout, subtract
the offset of that output to put the buffer location in output-relative
coordinates.

Fixes #3910
2024-10-24 16:03:17 +01:00
David Turner
c87ab6465d Support direct scanout with src crop and dst boxes
Enable scene-tree direct scanout of a single buffer with various options
for scaling and source crop. This is intended to support direct scanout
for fullscreen video with/without scaling, letterboxing/pillarboxing
(e.g. 4:3 content on a 16:9 display), and source crop (e.g. when
1920x1088 planes are used for 1920x1080 video).

This works by explicitly specifying the source crop and destination box
for the primary buffer in the output state.  DRM atomic and libliftoff
backends will turn this into a crop and scale of the plane (assuming the
hardware supports that).  For the Wayland/X11/DRM-legacy backends I just
reject this so scanout will be disabled.

The previous behaviour is preserved if buffer_src_box and buffer_dst_box
are unset: the buffer is displayed at native size at the top-left of the
output with no crop.

The change to `struct wlr_output_state` makes this a binary breaking
change (but this works transparently for scene-tree compositors like
labwc after a recompile).
2024-10-22 18:28:09 +01:00
Alexander Orezechowski
402a862413 output: Change wlr_output_add_software_cursors_to_render_pass to take buffer coordinates
Since wlr_damage_ring now only works with buffer local coordinates, this
creates an inpedance mismatch for compositors that want to use this
function. Instead of compositors needing to the the conversion itself,
change thu function to take buffer local coordinates directly.
2024-10-12 07:30:11 +00:00
Simon Ser
1e949402b0 output: drop output timeline flag
This has been superseded by the backend-wide feature flag.
2024-10-11 17:11:35 +00:00
Simon Ser
514c4b4cce backend: add timeline feature flag
The output feature flag has a flaw: it's not possible to check
whether the backend supports timelines during compositor
initialization when we need to figure out whether we want to enable
the linux-drm-syncobj-v1 protocol.

Introduce a backend-wide feature flag to indicate support for
timelines to address this defect.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3904
2024-10-11 17:11:35 +00:00
Alexander Orezechowski
831e7fc7ee damage_ring: Add notes about damage being in buffer local coordinates 2024-10-11 00:37:48 +03:00
Alexander Orzechowski
79e063035c damage_ring: Remove wlr_damage_ring_set_bounds
This wasn't that great:
1. Now that damage ring tracks damage across actual wlr_buffer objects,
   it can use the buffer size to do any sort of cropping that needs to
   happen.
2. The damage ring size really should be the size of the transformed
   size of the output. Compositors currently have to call
   `wlr_damage_ring_set_bounds()` where it might not be clear when to
   call the function. Compositors can just check against the actual
   output bounds that they care about when processing the damage.

Fixes: #3891
2024-10-09 06:31:46 +00:00
Alexander Orzechowski
502eb38d80 damage_ring: Remove return value of wlr_damage_ring_add/wlr_damage_ring_add_box
Compositors should compute whether the damage is part of the output
themselves.
2024-10-09 06:31:46 +00:00
Kirill Primak
dd8f4913a4 subcompositor: drop unused subsurface state 2024-10-08 19:18:38 +03:00
Simon Ser
6ada67da9b xwayland/xwm: implement somewhat asynchronous request flushing
Instead of calling xcb_flush() directly, wait until the FD is
writable.

Ideally we'd have a non-blocking variant instead of xcb_flush(),
but libxcb doesn't have this. Also libxcb blocks when its internal
buffer is full, but not much we can do here.
2024-10-07 21:51:15 +03:00
Simon Ser
95d25d833f keyboard: add utilities for pointer keys
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3803
2024-10-07 18:41:07 +00:00
Kirill Primak
ab118042ea ext-foreign-toplevel-list: add _from_resource() 2024-10-01 18:59:18 +03:00
Kirill Primak
56d69320c7 pointer: release pressed buttons on destroy 2024-09-24 19:53:54 +00:00
Simon Ser
1a7981f7c9 compositor: document surface events 2024-09-05 19:49:20 +02:00
Simon Ser
d7223eae02 backend/drm: add explicit sync support to multi-GPU blits 2024-08-26 18:09:27 +02:00
Alexander Orzechowski
3187479c07 render/color: Invert ownership model of color_transform types.
Color transform can have multiple types and these different types
want to store different metadata. We previously stored this metadata
directly on wlr_color_transform even for transforms that don't use it.

Instead, let's take the prior art from wlr_scene where each scene node
is built on a base node. Notice how wlr_color_transform_lut3d now has
a `struct wlr_color_transform base`. This is advantageous in multiple
ways:

1. We don't allocate memory for metadata that will never be used.
2. This is more type safe: Compositors can pass around a
struct wlr_color_transform_lut3d if they know they only want to use a
3d_lut.
3. This is more scalable. As we add more transform types, we don't have
to keep growing a monolithic struct.
2024-08-24 14:33:22 -04:00
Simon Ser
fa2abbeefb render/color: return tranform in wlr_color_transform_ref()
This is more consistent with the rest of the wlroots APIs and is
more concise.
2024-08-24 11:07:58 +02:00
Simon Ser
5432108846 backend/drm: drop SKIP in match_connectors_with_crtcs()
It's unused.
2024-08-21 22:25:19 +02:00
Simon Ser
1e03719361 backend/drm: drop match_connectors_with_crtcs() return value
It's unused.
2024-08-21 22:25:19 +02:00
Simon Ser
0bf642d246 backend/drm: use more descriptive names for match_obj()
This function is only used for connectors and CRTCs, so instead of
the abstract "obj"/"resource" wording, just use the concrete names.
2024-08-21 22:25:19 +02:00
YaoBing Xiao
43554c1966 types/wlr_output: removing the useless pointer 2024-08-21 14:04:24 +00:00
Alexander Orzechowski
bfcaa4bc44 swapchain, damage_ring: Drop buffer age 2024-08-21 09:45:54 -04:00
Alexander Orzechowski
eebaca8dbf output/render: Drop buffer age from wlr_output_begin_render_pass
For compositors wanting to damage track, `wlr_damage_ring_rotate_buffer()`
should be used and the damage should be set on the passed state.
2024-08-21 09:45:54 -04:00
Simon Ser
098cb9b7a3 xdg-shell: add wlr_xdg_toplevel_configure()
A struct wlr_xdg_toplevel_configure is passed in with the whole
state. This makes it a lot clearer that the size and WM state are
always sent to the client.
2024-08-20 09:15:39 +00:00
Simon Ser
8582b45c9e xdg-shell: document struct wlr_xdg_toplevel_configure 2024-08-20 09:15:39 +00:00
Kirill Primak
a0450d219f layer-shell: introduce wlr_layer_surface_v1_get_exclusive_edge() 2024-08-18 01:02:08 +00:00
Kirill Primak
270e6f4ebb layer-shell: add v5 support 2024-08-18 01:02:08 +00:00
Isaac Freund
08495d2596 backend/drm: don't set vsync present flag if page flip was async 2024-08-15 15:11:10 +00:00
Kirill Primak
ee21deb458 linux-drm-syncobj: add missing decls in the header 2024-08-15 09:02:04 +00:00
Kirill Primak
5c98d1a04a xdg-surface: fix window geometry handling
It was completely wrong: according to the protocol, the effective
geometry is only updated on commit time if there pending state has
new state from xdg_surface.set_window_geometry or
xdg_surface.set_window_geometry has never been sent at all.

This commit adds wlr_xdg_surface.geometry which correctly matches the
effective window geometry and removes now-useless
wlr_xdg_surface_get_geometry().
2024-08-14 18:52:13 +00:00
Kirill Primak
a1298580cc compositor: add surface role map hook 2024-08-14 18:52:13 +00:00
Alexander Orzechowski
515275ee72 wlr_scene: Introduce wlr_scene_set_gamma_control_manager_v1 2024-08-14 13:18:56 -04:00
Alexander Orzechowski
23202e192c wlr_scene: Introduce wlr_scene_output_needs_frame
It seems that some scene compositors want to avoid wlr_scene_output_commit
and use the lower lever wlr_scene_output_build_state. However, build
state does not early return if a frame is not needed so compositors will
implement the check themselves. Let's add a helper function that compositors
can use to implement the check.

Technically pending_commit_damage is a private interface, so this lets
compositors not interface with private interfaces to implement the check.
2024-08-14 12:51:15 -04:00
Kirill Primak
6c8eabcecd xdg-foreign: clean up
This commit removes extra wlr_xdg_toplevel_set_parent() calls,
simplifies wlr_surface->wlr_xdg_toplevel conversion logic, makes related
structures store wlr_xdg_toplevel objects directly instead of
wlr_surface objects, and improves the code style.
2024-08-14 15:56:36 +03:00