Commit graph

5955 commits

Author SHA1 Message Date
Simon Ser
e1ba64c4b7 render/vulkan: use initializer for VkBufferImageCopy
Missed that one it seems.
2022-11-11 19:26:48 +00:00
Simon Ser
d112c2d922 render/vulkan: wait for device to become idle in vulkan_destroy()
It's not safe to destroy any resources which might still be in-use
by the GPU. Wait for any asynchronous tasks to complete before
destroying everything.
2022-11-11 19:18:04 +00:00
Simon Ser
f4f3c15c1e render/vulkan: always wait for last stage to complete before rendering
When we have multiple command buffers in flight, we need to make
sure we don't start rendering before the previous texture uploads
are complete.
2022-11-11 19:18:04 +00:00
Simon Ser
7fdcb45e66 render/vulkan: use command buffer pool for stage 2022-11-11 19:18:04 +00:00
Simon Ser
f1eae0eeeb render/vulkan: add a command buffer pool
Before re-using a VkCommandBuffer, we need to wait for its
operations to complete. Right now we unconditionally wait for
rendering to complete in vulkan_end(), however we have plans to
fix this [1]. To fully avoid blocking, we need to handle multiple
command buffers in flight at the same time (e.g. for multi-output,
or for rendering followed by texture uploads).

Implement a pool of command buffers. When we need to render, we
pick a command buffer from the pool which has completed its
operations. If we don't find one, try to allocate a new command
buffer. If we don't have slots in the pool anymore, block like we
did before.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3574
2022-11-11 19:18:04 +00:00
Simon Ser
a8a194d695 render/vulkan: switch to timeline semaphores
Up until now we were using a VkFence for GPU-to-CPU
synchronization. This has some limitations that become a blocker
when trying to have multiple command buffers in flight at once
(e.g. for multi-output). It's desirable to implement a command
buffer pool [1], but VkFence cannot be used to track command buffer
completion for individual subpasses.

Let's just switch to timeline semaphores [2], which fix this issue,
make synchronization a lot more ergonomic and are a core Vulkan 1.2
feature.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3802
[2]: https://www.khronos.org/blog/vulkan-timeline-semaphores
2022-11-11 19:18:04 +00:00
Simon Ser
f92d1499cd render/vulkan: add helper to load command function pointer
If NULL is returned by vkGetDeviceProcAddr(), either the driver
is buggy, either the wlroots code is buggy. For a valid device and
command name, drivers are not allowed to return NULL per the spec.

This mirrors what the GLES2 renderer does in load_gl_proc().
2022-11-11 19:18:04 +00:00
Simon Ser
5b23987349 build: bump version to 0.17.0-dev 2022-11-11 18:30:56 +01:00
Simon Ser
1712a7d274 build: bump to version 0.16.0 2022-11-11 18:22:17 +01:00
Alexander Orzechowski
c58ad0f171 wlr_scene: Remove duplicate buffer check when submitting a new buffer
wlr_buffer allows mutation during its lifetime. This happens for
wlr_client_buffer which fixes damage tracking issues.
2022-11-11 15:37:22 +00:00
Simon Ser
84e727daae backend/drm: request page-flip event on modeset
The old drm_connector_set_mode() function did that by calling
drm_crtc_page_flip(). We lost this in the refactoring.

Fixes: f216e97983 ("backend/drm: drop drm_connector_set_mode()")
2022-11-11 14:46:51 +00:00
Kirill Primak
a707b7b101 output-damage: deprecate 2022-11-11 05:31:10 +00:00
Alexander Orzechowski
ea40ba4f6a wlr_scene: Fix texture reuse
Add private interface to ignore a buffer that's locking a client_buffer
for damage tracking. This should eventually be replaced by wlr_raster.
2022-11-11 00:08:04 +00:00
illiliti
eec95e3d5e backend/drm: use pnp.ids to fetch EDID data 2022-11-09 00:25:18 +03:00
Simon Ser
d75b4d8e86 Revert "backend/drm: fetch EDID manufacturer from udev_hwdb"
This reverts commit e646d882cf.

This commit has added a dependency on udev_hwdb. This API isn't
available on all platforms (e.g. FreeBSD), and further deepens
our udev dependency. A better solution is being worked on in [1].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3638
2022-11-08 19:08:43 +01:00
Kirill Primak
4152db92ef damage-ring: add missing headers 2022-11-08 17:10:56 +00:00
Simon Ser
440d7fa072 scene: destroy addons before cleaning up internal state
This allows addons to access wlr_scene_node/wlr_scene_surface
fields to clean up themselves.
2022-11-08 16:47:59 +00:00
Simon Ser
24c149fefb scene: fix whitespace 2022-11-08 16:47:59 +00:00
Kirill Primak
c284700deb Revert "render/pixman: apply source image cropping"
This reverts commit 9fefeb69d6.

It doesn't really crop anything, actually.
2022-11-08 18:24:44 +03:00
zccrs
270914d379 render/vulkan: add some interfaces to allow compositors to integrate
Added wlr_vk_renderer_get_* functions to allow get the VkInstance,
VkPhysicalDevice, VkDevice, queue family of a wlr_vk_renderer.

Added wlr_vk_renderer_get_current_image_attribs function to allow get
the VkImage of current renderer buffer to use on compositors.

Added wlr_renderer_is_vk function, it's like the wlr_renderer_is_gles2,
returns true if the wlr_renderer is a wlr_vk_renderer.

Added wlr_vk_image_get_attribs function to get a VkImage and it's
extras information (e.g. a VkImageLayout and VkImageFormat of the
VkImage) from a wlr_texture.
2022-11-08 12:56:38 +01:00
Kirill Primak
9fefeb69d6 render/pixman: apply source image cropping 2022-11-08 09:17:04 +00:00
Kirill Primak
123a08b448 scene: fix output damage expansion
This fixes e.g. `weston-simple-damage --use-viewport` which technically
renders at the buffer scale of 0.5.
2022-11-08 06:37:42 +00:00
Simon Ser
6c31f3b078 render/vulkan: use wl_array for wlr_vk_shared_buffer.allocs
Avoids the need to open-code the realloc() logic.
2022-11-07 21:22:33 +00:00
Kirill Primak
388de59df3 compositor: use the correct input region 2022-11-07 21:06:12 +00:00
Kirill Primak
b7623694ac tinywl: handle view unmap while grabbed
Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3372
2022-11-07 20:09:25 +03:00
Simon Ser
ea68506b73 render/vulkan: fix and add missing wl_list comments
In wlroots we add comments near struct wl_list members to indicate
which type it's linked to. The Vulkan renderer had some comments
with mistakes, and some members without a comment.
2022-11-07 14:08:03 +00:00
Simon Ser
9a5cc36818 render/vulkan: simplify texture VkPipelineShaderStageCreateInfo
I simplified the quad VkPipelineShaderStageCreateInfo in [1], but
missed the one for texture.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3823
2022-11-07 14:24:39 +01:00
Simon Ser
cfb768aab9 render/vulkan: use struct initializers
Instead of filling the fields one by one, use a struct initializer.
This avoids repeating the name of the variable and is more
consistent with the wlroots code style.
2022-11-06 14:20:34 +00:00
Simon Ser
7f5180af77 render/vulkan: simplify extension checks
find_extensions() is clunky to use when checking only a single
extension, and it's surprising that it returns NULL on success.

Simplify by replacing it with a check_extension() function which
just checks whether a single extension is in the list.
2022-11-06 14:18:13 +00:00
Kirill Primak
c09d3450d4 compositor: enforce surface destruction order 2022-11-06 17:00:00 +03:00
Kirill Primak
099b9de752 compositor: drop role object NULL checks in handlers
Instead, move the check to the caller.
2022-11-06 17:00:00 +03:00
Kirill Primak
32daa43a45 xwayland/xwm: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak
acd5a64fd1 xdg-shell: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak
92fbfda2ca drag-icon: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak
75af6a0a39 input-method: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak
bcf6b2bbf8 session-lock: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak
2518ace573 subcompositor: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak
3da2cf3eb3 layer-shell: use role object destroy handler 2022-11-06 17:00:00 +03:00
Kirill Primak
756260ac05 compositor: introduce wlr_surface_destroy_role_object() 2022-11-06 14:16:05 +03:00
Kirill Primak
1243a855d4 xdg-shell: fix geometry types 2022-11-05 18:30:09 +00:00
Kirill Primak
92e3c5b798 scene: fix buffer source box transforming 2022-11-05 14:44:57 +03:00
Simon Ser
3b75ab97e2 render/vulkan: drop outdated comments 2022-11-04 14:29:54 +01:00
Simon Ser
2ac2835a1f render/vulkan: remove exts arg from vulkan_instance_create() 2022-11-04 14:12:38 +01:00
David96
7a42392da2 render/vulkan: add caching to vulkan_read_pixels 2022-11-04 09:13:48 +00:00
Simon Ser
05454618cd xwayland: split headers
We're about to get one more Xwayland-related thing, and this header
already contains two things.
2022-11-02 19:00:23 +01:00
Simon Ser
fc3d8b228b backend/drm: get possible CRTCs in create_drm_connector()
This stuff is immutable for a given connector.
2022-11-02 14:48:30 +00:00
Simon Ser
92580a2f67 backend/drm: extract create_drm_connector()
Move a bit more logic out of the big loop in scan_drm_connectors().
2022-11-02 14:48:30 +00:00
Simon Ser
4d04144b92 render/gles2: de-duplicate vertex shaders
The vertex shaders for quads and textures are identical.
2022-10-28 13:49:03 +02:00
Simon Ser
d69018c195 render/gles2: move color uniform from quad.vert to quad.frag
We have no use for a v_color varying. We can use the uniform
directly from the fragment shader without getting the vertex shader
involved.
2022-10-28 13:49:03 +02:00
Simon Ser
a75f9be2e8 render/gles2: move shaders to individual files
Instead of having a C file with strings for each shader, move each
shader into its own file. Use a small POSIX shell script to convert
the files into C strings (can't wait for C23 #embed...).

The benefits from this are:

- Improved readability and syntax highlighting.
- Line numbers in shader compiler errors are easier to make sense of.
- Consistency with the Vulkan renderer.
- Shaders will become more complicated as we add color management
  features.
2022-10-28 11:46:06 +00:00