Commit graph

22 commits

Author SHA1 Message Date
Erico Nunes
1a868b7244 vulkan-renderer: fix VkMemoryDedicatedRequirements usage
This needs to extend the VkMemoryRequirements2 struct, not
VkImageMemoryRequirementsInfo2.

Fixes: ad0f4cf9 ("vulkan-renderer: make dmabuf import dedicated allocation optional")

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-11-07 14:30:29 +01:00
Erico Nunes
53895cac2f vulkan-renderer: support fragment debug binding
Add a debug binding and mode to highlight (green tint) what has
been rendered through vulkan-renderer composition. This is useful
to visually identify/debug clients which have been offloaded to
DRM planes, since those won't go through the renderer composition
process and therefore won't be highlighted the same way.
Since this is the first debug mode in vulkan-renderer, add some
initial infrastructure to handle debug bindings.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-10-28 07:43:53 +00:00
Erico Nunes
68d3d3badc vulkan-renderer: fix pipeline specialization constant offsets
The VkSpecializationMapEntry use was incorrect here, it requires the
struct offset to be in the second entry.

Fixes: 8f56d03d ("libweston: Vulkan renderer")

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-10-28 07:43:53 +00:00
Robert Mader
e9fc189189 paint-node: Consider view-alpha for is_fully_opaque
In order to be more in line with weston_view_is_opaque() - which we
use in most cases to set the value - and ensure the expectations of
existing places in the code are honored, see usages in both
draw_paint_node() implementations.

An exception here are holes - these always need to get painted as fully
opaque in the renderer path.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-10-17 15:06:11 +02:00
Derek Foreman
59e2a111fa compositor: Remove is_direct from paint node
It's the same as buffer->direct_display essentially 100% of the time,
except maybe if someone set weston_direct on a single-pixel-buffer, but
that's madness.

Just drop it entirely, and let the only existing reader of the variable
get it from the buffer directly.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2025-10-16 10:25:42 -05:00
Erico Nunes
ad0f4cf94b vulkan-renderer: make dmabuf import dedicated allocation optional
This is not strictly always necessary depending on the implementation,
so the extension requirement can be made optional.
Also improve its usage by first checking whether the dedicated
allocation is preferred/required by the driver, before importing
with dedicated allocation.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-10-02 21:22:45 +01:00
Robert Mader
9ea205e007 output-capture: Support writeback connector formats
Writeback connectors often support multiple formats, fully independent
of the input framebuffer. Wire up support for querying formats and send
them to clients.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
2025-09-25 12:39:23 +02:00
Erico Nunes
41823d237b vulkan-renderer: remove unused allocation in renderbuffer dmabuf
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-09-22 10:12:33 +02:00
Erico Nunes
1a68480421 backend-drm: use dmabuf renderbuffer for Vulkan
The initial drm backend implementation for Vulkan passes display device
allocated gbm bos directly to the renderer. This is a bit awkward since
it requires the renderer to maintain a custom output creation interface
and another code path for importing specifically gbm bos.
Since then, vulkan-renderer received support to use dmabuf renderbuffers
to support e.g. pipewire dmabuf, in an interface which is also common
with gl-renderer.
The dmabuf renderbuffer code path is similar to what the drm backend
implementation intended to do, so we can unify it to a single interface.
This has the advantages of requiring one less custom output creation
interface, as well as the renderer being able to handle the drm backend
through a single shared dmabuf renderbuffer path.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-09-12 18:04:57 +01:00
Erico Nunes
aff309fa9f vulkan-renderer: rename output options to surface/surfaceless
The fbo naming inherited from gl-renderer is confusing, and now it
is used in many places.
Rename the two options for output creation to surface and surfaceless
to hopefully make them more meaningful.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-09-12 18:04:57 +01:00
Erico Nunes
f42ccf2140 vulkan-renderer: Add query to populate shm formats
Remove the limited shm formats hardcoded list and add a query to
populate them according to the device.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-09-08 12:02:11 +01:00
Erico Nunes
9341192f51 vulkan-renderer: Drop dmabuf format print
These are fairly noisy now especially with more formats being added.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-09-08 12:02:11 +01:00
Erico Nunes
8c9f395c6c vulkan-renderer: refactor extensions to extension table
Define extension tables for all extensions that are potentially used,
and use that to enumerate and request extensions which will be used.
This allows for a bitset to hold supported extensions and makes it
less cumbersome to define new ones to use later, as well as requiring
less traversing of the extension string list to decide which extensions
to request.
This also fixes some missing dependency issues which could trigger
validation errors on some drivers with limited extension support.
It also allows some code paths that didn't require some specific
extensions that were in the default list before, by checking for
those in the code path that actually uses them at runtime.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-09-08 12:02:11 +01:00
Leandro Ribeiro
dd5e1f5047 libweston: rename get_supported_formats to get_supported_dmabuf_formats
Let's be more more specific and rename the renderer interface function
that returns the supported dma-buf formats. I.e. if we pass a dma-buf
with one of these formats for the renderer, it should be able to import
it.

Next we'll introduce a function to query the rendering formats from
the renderer, so this distinction is important.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-02 13:34:00 +00:00
Erico Nunes
2d34d32893 vulkan-renderer: support dmabuf renderbuffers
Initial support for dmabuf renderbuffers, based on the GL renderer
implementation.
This enables Vulkan renderer to use the pipewire backend with dmabuf.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-06-25 14:12:22 +00:00
Erico Nunes
33c418a85b vulkan-renderer: rework Vulkan dmabuf import
Rework the dmabuf import Vulkan code so that it is possible to reuse
a single routine across the DRM backend gbm import and dmabuf client
import.
This is will also make it possible to reuse it for dmabuf renderbuffers
as a follow-up.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-06-25 14:12:22 +00:00
Erico Nunes
4685cb1d1c vulkan-renderer: rework render_fence_fd
Decouple render_fence_fd from the DRM output, in particular so that
it is allowed in headless outputs (for upcoming dmabuf renderbuffers).
Also simplify the code to make it clear that it is handled per-output.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-06-25 14:12:22 +00:00
Erico Nunes
1a9d46e3bc vulkan-renderer: move render_done semaphore to image
For swapchain outputs, in some cases it is possible that a frame becomes
available by its fence but the last used swapchain image has still not
been returned to the swapchain. If the render_done semaphore is part of
the frame struct it will be reused and cause a validation error.
To prevent this from happening, move the render_done semaphore to the
image struct so that each of those semaphores is only used when the
associated image is safely acquired from the swapchain.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-06-25 14:12:22 +00:00
Marius Vlad
b2c8f35c23 renderer-vulkan: Allow to compile without Vulkan renderer
As spotted in the wild, building without Vulkan still picks up
Vulkan headers. This drops the VkInstance alltogether as that's not
really used.

As this file appears to be pulling XCB headers guard them as well.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-06-02 14:37:59 +03:00
Erico Nunes
30aacca3ff vulkan-renderer: add readback for renderbuffers
This will allow use of the vnc, rdp and pipewire (memfd) backends
with the Vulkan renderer.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-05-27 17:13:02 +02:00
Erico Nunes
f8af0dbf72 vulkan-renderer: fix read pixels for sub regions
The captured buffer cannot be just memcpy'ed to the destination as
it might overwrite existing pixels outside of the capture region.
For now switch it to a pixman composition.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-05-27 10:45:00 +02:00
Erico Nunes
8f56d03d4b libweston: Vulkan renderer
A Vulkan renderer for weston, based on the GL renderer.
The goal is to impose the least requirements as possible on Vulkan
implementations, as to allow even Vulkan 1.0 (or early development)
drivers to run a Wayland compositor. Any additional features or
extensions are made optional if possible.
Currently supports drm, wayland, x11 and headless backends.
As of this implementation, this is still considered an experimental
renderer.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
2025-05-23 20:36:05 +01:00