aboutsummaryrefslogtreecommitdiff
path: root/render/vulkan
AgeCommit message (Collapse)Author
2023-04-19render/vulkan: remove extra newlineSimon Ser
2023-04-18render/vulkan: use full names for extension command fieldsSimon Ser
This makes grepping much easier.
2023-03-26render/vulkan: avoid double-close on sync_file FD after semaphore importSimon Ser
Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3610
2023-02-28render/vulkan: prefer render node for wlr_renderer_get_drm_fd()Simon Ser
Instead of returning a primary node from wlr_renderer_get_drm_fd(), prefer to return a render node if any.
2023-02-24vulkan: silence -Wint-conversion on 32-bit architecturesJan Beich
render/vulkan/renderer.c:388:70: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'VkFence' (aka 'unsigned long long') [-Werror,-Wint-conversion] VkResult res = vkQueueSubmit(renderer->dev->queue, 1, &submit_info, NULL); ^~~~ render/vulkan/renderer.c:1141:81: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'VkFence' (aka 'unsigned long long') [-Werror,-Wint-conversion] VkResult res = vkQueueSubmit(renderer->dev->queue, submit_count, submit_infos, NULL); ^~~~ /usr/include/sys/_null.h:34:14: note: expanded from macro 'NULL' #define NULL ((void *)0) ^~~~~~~~~~~ /usr/local/include/vulkan/vulkan_core.h:4054:49: note: passing argument to parameter 'fence' here VkFence fence); ^ Fixes: a8a194d695af ("render/vulkan: switch to timeline semaphores")
2023-01-19render/vulkan: check that requested size is smaller than maxSimon Ser
Fail with a clearer error when the requested size is too large. Without this, we allocate a buffer with a size smaller than what was requested. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3975
2023-01-18vulkan: increase max stage size to support large buffersBrett Ernst
2023-01-18render/vulkan: use correct source offset in read_pixelsllyyr
2022-12-22render/vulkan: always finish buffer addon on texture destroyKirill Primak
2022-12-22render/vulkan: remove NULL renderer check on texture destroyKirill Primak
2022-12-06render/vulkan: wait for DMA-BUF fencesSimon Ser
The Vulkan spec doesn't guarantee that the driver will wait for implicitly synchronized client buffers before texturing from them. radv happens to perform the wait, but anv doesn't. Fix this by extracting implicit fences from DMA-BUFs, importing them into Vulkan as a VkSemaphore objects, and make the render pass wait on these VkSemaphores.
2022-12-03render/vulkan: use initializers for VkSubmitInfoSimon Ser
2022-12-03render/vulkan: remove stage_cb conditionalSimon Ser
We always have a stage_cb at this point.
2022-12-03render/vulkan: remove pre_cb in vulkan_end()Simon Ser
pre_cb was an alias for stage_cb->vk. Let's just use a single variable instead. Additionally, early return when vulkan_record_stage_cb() fails. We were crashing in vkCmdPipelineBarrier() if that happened.
2022-12-03render/vulkan: fix vkCmdClearAttachments validation errorSimon Ser
Skip clears with an empty scissor. Fixes the following validation error: 00:00:09.734 [wlr] [render/vulkan/vulkan.c:61] Validation Error: [ VUID-vkCmdClearAttachments-rect-02682 ] Object 0: handle = 0x62600001b100, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0xadbd476f | CmdClearAttachments(): pRects[0].rect.extent.width is zero. The Vulkan spec states: The rect member of each element of pRects must have an extent.width greater than 0 (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdClearAttachments-rect-02682) (VUID-vkCmdClearAttachments-rect-02682)
2022-12-02render/vulkan: fix commaSimon Ser
2022-12-02render/vulkan: use initializers for VkImageMemoryBarrierSimon Ser
2022-12-02render/vulkan: fix missing pSignalSemaphores for stage CBSimon Ser
We were filling VkTimelineSemaphoreSubmitInfoKHR.pSignalSemaphoreValues, but we were missing VkSubmitInfo.pSignalSemaphores. This was causing VkTimelineSemaphoreSubmitInfoKHR.pSignalSemaphoreValues to be ignored. By chance, the render command buffer was using the next timeline point, so we were waiting for that instead.
2022-12-02render/vulkan: move VkDescriptorSetAllocateInfo downSimon Ser
Move it down, right before it's used.
2022-12-02render/vulkan: make shm/dmabuf split clearer in wlr_vk_format_propsSimon Ser
struct wlr_vk_format_props contains a mix of properties for shm and dmabuf, and it's not immediately clear which fields are for which kind of buffer. Use a nested struct to group the fields.
2022-12-02render/vulkan: make vulkan_format_props_find_modifier() return value constSimon Ser
2022-12-02render/vulkan: check for barrier array alloc failureSimon Ser
2022-12-02render/vulkan: improve message on format prop errorSimon Ser
Use a more appropriate message on vkGetPhysicalDeviceImageFormatProperties2() error.
2022-12-02render/vulkan: simplify vulkan_format_props_query()Simon Ser
2022-12-02render/vulkan: extract DMA-BUF format query to separate functionSimon Ser
2022-12-02render/vulkan: add 64-bit UNORM and SFLOAT formatsSimon Ser
2022-12-02render/vulkan: add more packed formatsSimon Ser
2022-12-02render/vulkan: add more 8 bits per channel formatsSimon Ser
2022-12-02render/vulkan: explain format mapping with DRMSimon Ser
2022-12-02render/vulkan: drop "_format" in wlr_vk_format fieldsSimon Ser
"format" is already in the name, no need to repeat ourselves. `format->vk_format` sounds a bit redundant.
2022-12-01wlr_texture: Expose owning rendererAlexander Orzechowski
2022-11-28render/vulkan: import semaphore to DMA-BUF instead of blockingSimon Ser
Right now the Vulkan renderer blocks until the frame is complete after rendering. This is necessary because Vulkan doesn't interoperate well with implicit sync we use everywhere else. Use the new kernel API to import a sync_file into a DMA-BUF to avoid blocking.
2022-11-28render/vulkan: release stage buffers after command buffer completesSimon Ser
We need to wait for the pending command buffer to complete before re-using stage buffers. Otherwise we'll overwrite the stage buffer with new contents before the texture is fully uploaded.
2022-11-28render/vulkan: destroy textures after command buffer completesSimon Ser
We need to wait for any pending command buffer to complete before we're able to fully destroy a struct wlr_vk_texture: the Vulkan spec requires the VkDescriptorSet to be kept alive. So far we've done this in vulkan_end(), after blocking until the command buffer completes. We'll soon stop blocking, so move this logic in get_command_buffer(), where we check which commands buffers have completed in a non-blocking fashion.
2022-11-28render/vulkan: drop unused fields from wlr_vk_format_modifier_propsSimon Ser
export_imported is never used, and dmabuf_flags is already checked in query_modifier_support().
2022-11-25render/vulkan: align staging buffers for texture uploadManuel Stoeckl
vkCmdCopyBufferToImage requires that the buffer offset be a multiple of the texel block size, which for single plane uncompressed formats is the same as the number of bytes per pixel. This commit adds an alignment parameter to vulkan_get_stage_span which ensures that the provided span (and the sequence of image copy operations derived which use it) have this alignment.
2022-11-25render/vulkan: add support for RGB565 texture formatManuel Stoeckl
Since this does not have a matching _SRGB-type vulkan format, add a new shader variant/pipeline to perform the sRGB->linear texture conversion.
2022-11-24render: stop pulling <wlr/backend.h>Simon Ser
Let's just forward-declare struct wlr_backend instead. We need to fixup the Vulkan renderer: it needs makedev(), which got included by chance via <wlr/backend.h> → <wlr/backend/session.h> → <libudev.h>.
2022-11-21render/vulkan: update shm texture data in one batchManuel Stoeckl
2022-11-15render/vulkan: detect device lossSimon Ser
2022-11-15render: allow wlr_renderer_impl.begin to failSimon Ser
Make it return a bool to indicate success/failure. Adapt the various implementations to check errors.
2022-11-15render/vulkan: add wlr_vk_texture_has_alphazccrs
Allow to get whether has alpha channel of the VkImage, it can help an optimization to disable blending when the texture doesn't have alpha. Because the VkFormat isn't enough because it's always set to VK_FORMAT_B8G8R8A8_SRGB or VK_FORMAT_R8G8B8A8_SRGB.
2022-11-11render/texture: constify wlr_texture_update_from_buffer()Simon Ser
2022-11-11render/vulkan: remove hardcoded validation layersSimon Zeni
Users should use the VK_INSTANCE_LAYERS env var to set layers at runtime
2022-11-11render/vulkan: use initializer for VkBufferImageCopySimon Ser
Missed that one it seems.
2022-11-11render/vulkan: wait for device to become idle in vulkan_destroy()Simon Ser
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-11render/vulkan: always wait for last stage to complete before renderingSimon Ser
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-11render/vulkan: use command buffer pool for stageSimon Ser
2022-11-11render/vulkan: add a command buffer poolSimon Ser
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-11render/vulkan: switch to timeline semaphoresSimon Ser
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