Commit graph

919 commits

Author SHA1 Message Date
Simon Ser
e95117b700 render/vulkan: remove hardcoded counts
Use the array size instead.
2025-08-27 14:26:21 -04:00
Simon Ser
1a18e47efa render/vulkan: fix VkPushConstantRange for wlr_vk_frag_texture_pcr_data
We pass an alpha multiplier plus a luminance multiplier now.

Fixes the following validation layer error:

    vkCmdPushConstants(): is called with
    stageFlags (VK_SHADER_STAGE_FRAGMENT_BIT), offset (80), size (72)
    but the VkPipelineLayout 0x510000000051 doesn't have a VkPushConstantRange with VK_SHADER_STAGE_FRAGMENT_BIT.
    The Vulkan spec states: For each byte in the range specified by offset and size and for each shader stage in stageFlags, there must be a push constant range in layout that includes that byte and that stage (https://docs.vulkan.org/spec/latest/chapters/descriptorsets.html#VUID-vkCmdPushConstants-offset-01795) (VUID-vkCmdPushConstants-offset-01795)

Fixes: 56d95c2ecb ("render/vulkan: introduce wlr_vk_frag_texture_pcr_data")
2025-08-27 14:26:21 -04:00
xurui
b0c886ec77 render/allocator/gbm: insert buffer after export gbm bo
Signed-off-by: xurui <xurui@kylinos.cn>
2025-08-25 14:05:13 +08:00
YaoBing Xiao
c14aa1d0b8 render/vulkan: destroy vulkan instance when drm phdev mismatch 2025-07-15 08:59:37 +08:00
Simon Ser
48bd1831fe render/egl: fix software rendering check
Commit b4ce0d8b39 ("render/egl: accept negative DRM FD to select
software rendering") added an EXT_device_drm check to figure out
whether the user selected a device with a DRM FD or without one.
However, for KMS-only devices, Mesa will never advertise the
selected KMS node:
3f1d40d230/src/egl/main/egldevice.c (L109)

Instead, pass down a parameter to indicate whether a DRM FD was
passed in.

Fixes: b4ce0d8b39 ("render/egl: accept negative DRM FD to select software rendering")
2025-06-29 10:57:56 +02:00
Simon Ser
ae85c31176 render/vulkan: add luminance multiplier for texture shader 2025-06-18 19:37:55 +00:00
Simon Ser
fa1feb447f render, render/vulkan: add primaries to wlr_render_texture_options 2025-06-18 19:37:55 +00:00
Simon Ser
a8144088df render/vulkan: add support for PQ for textures 2025-06-18 19:37:55 +00:00
Simon Ser
3a51a5c623 render/vulkan: add texture color transformation matrix 2025-06-18 19:37:55 +00:00
Simon Ser
56d95c2ecb render/vulkan: introduce wlr_vk_frag_texture_pcr_data
Contains UBOs for texture.frag.
2025-06-18 19:37:55 +00:00
Simon Ser
ec422ac389 render/vulkan: prepare texture shader for new transforms 2025-06-18 19:37:55 +00:00
Simon Ser
8d1c6e42ac render/vulkan: add support for texture transfer functions 2025-06-18 19:37:55 +00:00
Simon Ser
0ee0452af0 render/color, render/vulkan: add EXT_LINEAR to enum wlr_color_transfer_function 2025-06-18 19:37:55 +00:00
Simon Ser
f5a0992686 render/vulkan: fix multiplication order for output color matrix
This had the same bug as the texture side, but I forgot to fix it.

See:
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4988#note_2867416

Fixes: f3524de980 ("render, render/vulkan: add primaries to wlr_buffer_pass_options")
2025-06-18 21:25:37 +02:00
Simon Ser
7b6eec530c render/vulkan: add luminance multipler for output shader 2025-06-18 00:11:33 +02:00
Simon Ser
4470683591 render/color, render/vulkan: add support for PQ transfer function 2025-06-18 00:11:31 +02:00
Simon Ser
8430a1922d render/vulkan: add PQ inverse EOTF to output shader 2025-06-18 00:09:25 +02:00
Simon Ser
f3524de980 render, render/vulkan: add primaries to wlr_buffer_pass_options 2025-06-18 00:07:35 +02:00
Simon Ser
a5706e2fb9 render/vulkan: use array declaration in encode_proj_matrix()
This makes it more obvious what the final layout of the matrix will
be.
2025-06-17 19:41:29 +02:00
Simon Ser
1df2274f6c render/vulkan: rename mat3_to_mat4() to encode_proj_matrix()
This function is specific to projection matrices.
2025-06-17 19:35:16 +02:00
Simon Ser
30c6efedf1 render/vulkan: use output_pipe_srgb for non-NULL sRGB color transform 2025-06-17 18:50:25 +02:00
Simon Ser
2ea0e386c4 render/vulkan: add color transformation matrix 2025-06-17 18:47:50 +02:00
Simon Ser
74217a4d93 render/color: introduce COLOR_TRANSFORM_LUT_3X1D
This will be useful to apply LUTs applied via wlr_gamma_control_v1,
and to add wlr_color_transform support to wlr_output.
2025-06-16 09:06:10 +00:00
Simon Ser
3665b53e29 render/color: replace COLOR_TRANSFORM_LUT_3D with COLOR_TRANSFORM_LCMS2
Converting the LCMS2 transform to a 3D LUT early causes issues:

- It's a lossy process, the consumer will not be able to pick a
  3D LUT size on their own.
- It requires unnecessary conversions and allocations: an intermediate
  3D LUT is allocated, but the renderer already allocates one.
- It makes it harder to support arbitrary color transforms in the
  renderer, because each type needs to be handled differently.

Instead, expose a function to evaluate a color transform, and use
that to build the 3D LUT in the renderer.
2025-06-16 09:06:10 +00:00
Simon Ser
9b97e2607d render/color: use variable instead of type in sizeof()
Conforms to the wlroots code style.
2025-06-16 09:06:10 +00:00
Simon Ser
d421538b4a render/color: add wlr_color_transform_init() 2025-06-16 09:06:10 +00:00
Simon Ser
8fb4e4dabb swapchain: assert that size is not empty at creation time
Failing later (at buffer allocation time) makes it more difficult
to track down where the issue comes from.
2025-06-16 07:54:00 +00:00
Simon Ser
bb50c7a5a4 render/allocator/gbm: require GBM 21.1
Mesa 21.1 was released back in 2021. Let's require it so that we
can simplify our build and remove the workaround.
2025-06-16 07:43:01 +00:00
DreamMaoMao
a08acfcee0 render/pass: Ensure the precision is consistent during comparison 2025-05-29 21:50:21 +08:00
YaoBing Xiao
70add22e74 render/pixman: null check on newly created image 2025-05-07 21:33:22 +08:00
YaoBing Xiao
f36f856cdb render/drm_syncobj: fix return type mismatch 2025-05-06 17:48:54 +08:00
Simon Ser
e57dd9c5ef render/vulkan: check binary semaphore in vulkan_sync_render_buffer()
Ensure the binary semaphore is available when we need it.
2025-05-05 22:17:11 +02:00
Simon Ser
d4e4c9f64b render/vulkan: create binary semaphore when signal timeline is supplied
We were only creating the binary semaphore when implicit sync
interop was available. We also use the binary semaphore when
explicit sync is enabled.

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3973
2025-05-05 22:17:04 +02:00
Kirill Primak
5fd43add1c Fix/cleanup includes a bit 2025-04-15 20:13:29 +03:00
Simon Ser
10b8880fc7 render/color: add wlr_color_transfer_function_get_default_luminance() 2025-03-30 16:21:26 +02:00
Simon Ser
e11012a024 render/color: introduce wlr_color_primaries_from_named() 2025-03-30 16:21:26 +02:00
Simon Ser
156201fe71 render/color: add wlr_color_primaries_to_xyz() 2025-03-30 16:21:26 +02:00
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