Commit graph

882 commits

Author SHA1 Message Date
Simon Ser
e83b06e732 render/vulkan: unify alpha pre-multiplication in output shader
Instead of handling alpha pre-multiplication in each branch, add
some common logic before and after handling OUTPUT_TRANSFORM.
2025-02-23 15:41:23 +01:00
Simon Ser
a818251aec render/pixman: drop cast for pixman_image_set_clip_region32()
The new Pixman release has made this const.
2025-01-29 23:33:50 +01:00
Simon Ser
639ca05d35 matrix: move to util/
wlr_matrix is not a standalone type like other headers in types/,
it's more of an internal utility. Move it to the appropriate place.
2025-01-27 17:48:18 +01:00
Alexander Orzechowski
c1eb053f5e render/drm_syncobj: Remove the ready signal from timeline_waiter
It's unused.
2025-01-26 18:02:14 -05:00
Alexander Orzechowski
82223e451a render/drm_syncobj: Add a callback when ready
The old approach of using a signal is fundamentally broken for a common
usecase: When the waiter is ready, it's common to immediately finish and
free any resources associated with it.
Because of the semantics of wl_signal_emit_mutable() this is UB.
wl_signal_emit_mutable() always excepts that the waiter hasn't been freed
until the signal has finished being emitted.

Instead of over engineering the solution, let's just add a callback required
by wlr_drm_syncobj_timeline_waiter_init(). In this callback, the implementation
is free to finish() or free() any resource it likes.
2025-01-26 18:02:05 -05:00
Simon Ser
211eb9d60e matrix: drop rotation
It's unused.
2025-01-26 17:56:04 +01:00
Simon Ser
9b55737cf5 Make wlr_matrix private API
36cc698bc5 ("matrix: deprecate") has deprecated wlr_matrix more
than one year ago. It's now time to drop it from our public API.
2025-01-26 17:46:50 +01:00
Kirill Primak
1c2cb4c802 drm-syncobj: return false instead of NULL 2025-01-24 21:57:28 +03:00
Kirill Primak
8f56f7ca43 Assert (almost all) signals have no attached listeners on destroy 2025-01-15 19:53:11 +03:00
Kirill Primak
7963ba6a0d buffer: introduce wlr_buffer_finish() 2025-01-08 16:06:12 +00:00
Kirill Primak
38923826c3 xwayland,render/vulkan: fix some size assertions 2024-12-30 12:47:54 +03:00
liupeng
fa4d8bbad7 render/egl: attribs len could be equal to size
Exts.KHR_display_reference makes assert fail.
2024-12-30 17:34:02 +08:00
Simon Ser
b908d865b1 backend: replace get_buffer_caps hook with a struct field
Do the same as wlr_renderer: the supported buffer capabilities are
static for the lifetime of the backend.
2024-12-25 18:40:05 +00:00
Simon Ser
9fdffba170 render/allocator: use udmabuf allocator automatically
It makes sense to use udmabuf when the backend wants shm, the
renderer wants DMA-BUFs, and we don't have a DRM FD because we're
running with a software renderer (e.g. llvmpipe or lavapipe).
2024-12-22 21:37:57 +00:00
Simon Ser
cfcf06b8b0 render: add WLR_RENDERER_FORCE_SOFTWARE env var
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3693
2024-12-22 21:37:57 +00:00
Simon Ser
24232e8e98 render/vulkan: accept negative DRM FD to select software rendering 2024-12-22 21:37:57 +00:00
Simon Ser
b4ce0d8b39 render/egl: accept negative DRM FD to select software rendering 2024-12-22 21:37:57 +00:00
Simon Ser
7cf8e80ffe render/allocator: add udmabuf allocator
udmabuf can create a DMA-BUF backed by a memfd. This is useful
when running with a software implementation of GL/Vulkan: the memfd
can be passed to the parent compositor via wl_shm and the DMA-BUF
can be imported via the usual APIs into GL/Vulkan.
2024-12-22 21:37:57 +00:00
Simon Ser
2b4f30dc1d render/gles2: validate shaders at build time
Use glslang to validate GLSL shaders at build time. This is
optional: if glslang is not found, shader validation is skipped.
2024-12-15 13:59:42 +01:00
Simon Ser
9649fbe443 render/vulkan: fix crash on OOM
Closes: https://github.com/swaywm/sway/issues/8485
2024-12-06 14:28:40 +00:00
Simon Ser
2424b1ecdd render/drm_format_set: fix corruption in wlr_drm_format_set_remove()
A single byte was moved instead of a full uint64_t. This results
in corrupted lists containing bogus modifiers.
2024-11-28 19:14:31 +00:00
Simon Ser
ca29f43a54 render/drm_syncobj: add addon set 2024-11-11 15:22:22 +00:00
Simon Ser
8e36040e88 render/drm_syncobj: de-duplicate drm_syncobj timeline init 2024-11-11 15:22:22 +00:00
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
mmcomando
c5d8f6d187 Consider using vulkan renderer in default configuration
With this change vulkan renderer can be automatically chosen in two more cases:

GLES2 renderer is disabled at compile time
GLES2 renderer failed to be created

Main purpose of this change is to automatically choose vulkan as renderer when GLES2 renderer is not enabled.
2024-11-06 08:52:58 +01:00
Simon Ser
3bbfae73ae render/vulkan: add support for explicit sync 2024-10-28 17:51:21 +00:00
Simon Ser
9351c78d70 render/vulkan: add render_pass_destroy()
De-duplicate the cleanup logic.
2024-10-28 17:51:21 +00:00
Simon Ser
7ce868bcf6 render/vulkan: make VK_KHR_external_semaphore_fd optional
We already block instead of using sync_file when the driver
doesn't support import/export.
2024-10-03 19:24:30 +02:00
Simon Ser
3da6fac1f2 render/vulkan: check size when creating shm texture 2024-09-29 15:22:56 +00:00
Simon Ser
d55c175777 render/vulkan: log size when importing too-large DMA-BUF 2024-09-29 15:22:56 +00:00
YaoBing Xiao
0db4df4c8e gles2/pass: remove duplicate variable declarations 2024-08-27 20:25:18 +08: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
52dce29e06 render/vulkan: use non-coherent memory for read_pixels()
The spec for VkMemoryPropertyFlagBits says:

> device coherent accesses may be slower than equivalent accesses
> without device coherence [...] it is generally inadvisable to
> use device coherent or device uncached memory except when really
> needed

We don't really need coherent memory so let's not require it and
invalidate the memory range after mapping instead.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3868
2024-08-22 18:19:22 +02:00
Alexander Orzechowski
bfcaa4bc44 swapchain, damage_ring: Drop buffer age 2024-08-21 09:45:54 -04:00
YaoBing Xiao
3048fb3fc6 render/egl: Release devices before return 2024-08-19 23:18:11 +08:00
Kenny Levinsen
5df2b34d2b allocator/gbm: Reset errno before gbm_bo_create
Not all paths in GBM set errno properly on error. Reset it to zero
before calling GBM to avoid accidentally printing a garbage error.
2024-08-19 14:59:44 +02:00
Kenny Levinsen
ccd4703207 allocator/gbm: Log errno if gbm_bo_create fails 2024-08-19 14:41:09 +02:00
Simon Ser
e6dbe4580e render/gles2: check for DRM_CAP_SYNCOBJ_TIMELINE
Before advertising support for timelines, check for
DRM_CAP_SYNCOBJ_TIMELINE. Without this, the user cannot
create/import drm_syncobj timelines.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4715#note_2523517
2024-08-12 22:37:34 +00:00
Simon Ser
775817e278 render: add WLR_RENDER_NO_EXPLICIT_SYNC env var
This can be handy to figure out if a bug is due to explicit sync.
2024-08-06 17:37:06 +00:00
Simon Ser
edb867bc05 render/drm_syncobj: add wlr_drm_syncobj_timeline_export() 2024-08-06 17:37:06 +00:00
Simon Ser
5552de65f8 render/drm_syncobj: add wlr_drm_syncobj_timeline_transfer() 2024-08-06 17:37:06 +00:00
Simon Ser
d2374b3e4e render/gles2: implement explicit sync API 2024-08-06 17:37:06 +00:00
Simon Ser
19ffbfe356 render/egl: add support for explicit sync extensions 2024-08-06 17:37:06 +00:00
chenyongxing
015bb8512e render/vulkan: Fix draw rect clip region invalid in blend none mod 2024-07-16 14:24:46 +08:00
Simon Ser
59138460c4 render: init wl_shm version 2 2024-07-07 18:52:24 +02:00
Simon Ser
a75c6cca54 render/color: fix return value type
../render/color_lcms2.c: In function ‘wlr_color_transform_init_linear_to_icc’:
    ../render/color_lcms2.c:26:24: error: incompatible types when returning type ‘_Bool’ but ‘struct wlr_color_transform *’ was expected
       26 |                 return false;
          |                        ^~~~~
2024-06-27 18:13:05 +00:00