【Vulkan后端增强】Enhance Vulkan Renderer backend - #1171
Conversation
There was a problem hiding this comment.
Sorry @LFRon, your pull request is larger than the review limit of 150000 diff characters
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LFRon The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @LFRon. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
3d74e19 to
49ea9e2
Compare
|
@zccrs 对了大佬, 这个实现里我顺便把CPU-GPU的等待模型改成了GPU内异步等待模型降低了画面延迟且减少了开销, 目前测试下来没啥问题, 大佬是否能参考一下( |
c0942c0 to
ec9999c
Compare
ec9999c to
32acd40
Compare
9e19f70 to
ac5f77d
Compare
|
TAG Bot New tag: 0.8.16 |
a973cd3 to
9990d35
Compare
|
TAG Bot New tag: 0.8.17 |
9990d35 to
f47d018
Compare
Reuse wlroots wlr_vk_render_buffer for Qt Quick RHI (same path as tinywl), with FOREIGN_EXT acquire/release around the Qt pass and QRhi setNativeLayout. Keep SHM partial updates and flush stage CB before Qt samples. No parallel dmabuf VkImage import. Aligns with the core approach in linuxdeepin#1171 without pulling the full presentation/blitter rewrite. 通过复用 wlroots 的 wlr_vk_render_buffer(与 tinywl 同路径)修复 Vulkan scanout:Qt 绘制前后做 FOREIGN_EXT acquire/release,并同步 QRhi layout。 保留 SHM 局部更新与 stage flush。不再平行 import dmabuf。 Log: 修复 Vulkan scanout 与 SHM 上传 Influence: Vulkan 下输出缓冲与 tinywl 一致的所有权转移,避免白/黑屏。
25d784b to
5af243c
Compare
40c13d9 to
e5fc4d0
Compare
Expose the Vulkan texture and render-buffer primitives Waylib needs to share wlroots-owned images with Qt Quick QRhi. Add image attribute queries, queue-family ownership barriers, imported-texture sampling transitions, and direct wlr_vk_renderer_* entry points. Keep compatibility wrappers for the mainline waylib_* names while leaving GLES2 untouched.
Waiting for every imported DMA-BUF sync_file on the CPU stalls Qt Quick frame recording and serializes producer and compositor work. Collect foreign-texture fences for the frame, discard fences that are already signaled, import pending fences into reusable binary Vulkan semaphores, and submit a single wait-only batch on the renderer queue. Signal an internal timeline semaphore to retire imported semaphore payloads safely; queue ordering then covers the following Qt submission on the shared queue. Keep bounded CPU polling as a fallback when implicit-sync interop is unavailable or WLR_VK_FORCE_SYNC_POLL is set. Add batch cleanup, failure handling, and a queue accessor used to validate the shared-queue requirement.
Advertise transfer-source usage for render buffers when the selected DRM modifier supports it, and expose the actual image usage to callers. Enable and expose separate depth/stencil layouts so Qt Quick can safely split and resume render passes around backdrop copies.
The Qt/QRhi path prepares every sampled foreign texture once per pass via wlr_vk_renderer_prepare_texture_for_sampling() and releases it via wlr_vk_renderer_finish_texture_sampling(). Each call recorded its own vkCmdPipelineBarrier for the queue-family-ownership/layout transition, so a frame sampling N client textures emitted N separate acquire and N separate release barrier commands. Add an optional renderer-side barrier batch. While a batch is active, prepare/finish accumulate their VkImageMemoryBarrier into a per-phase array instead of recording it immediately; a single vkCmdPipelineBarrier covering every accumulated barrier is then recorded once per phase (acquire before the Qt draw, release after it). This mirrors how the wlroots render pass already batches its foreign-texture barriers. A call belonging to the opposite phase still records immediately, so the two phases can never mix in one flush, and when no batch is active the previous immediate behaviour is kept unchanged. The batch is driven by the compositor through the new begin/flush/abort_texture_barrier_batch() entry points; the acquire/release arrays are initialised and freed with the renderer and aborted on destroy.
Shared-memory (CPU-rendered) client buffers are uploaded through a staging buffer. The Qt/QRhi path flushed pending uploads in submit_pending_stage_uploads() via vulkan_submit_stage_wait(), which ends in vkWaitSemaphoresKHR(): the render thread blocked until the GPU finished every staging copy before it could go on recording the frame. For a redrawing shm client this stall happened once per frame. Add vulkan_submit_stage_async(), which submits the staging command buffer signalling its timeline point but does not block. The staging buffers the submission used are moved onto the command buffer's existing stage_buffers list, so they stay hidden from the span allocator and are returned (with their allocations reset) by release_command_buffer_resources() once the submission's timeline point is reached - reusing the same reclamation the render pass already relies on. The CPU therefore never reuses a span the GPU is still reading, and a consumer that submits its own command buffer to the same queue afterwards is guaranteed by queue submission ordering to sample the texture only after the upload completes. The async path is opt-in through wlr_vk_renderer_set_stage_async_enabled() (default off, blocking behaviour preserved) and can be force-disabled with WLR_VK_FORCE_STAGE_BLOCK=1 for A/B comparison, since it is only safe when the consumer shares the renderer's VkQueue.
Queue submission order alone does not make foreign DMA-BUF waits or asynchronous staging writes visible to a later Qt/QRhi submission. Record an all-commands memory barrier in a wlroots bridge command buffer, submit it with the imported semaphore waits, and carry asynchronous staging uploads through the same bridge. Keep CPU-wait fallbacks and command-buffer lifetime tracking intact.
Qt Quick may preserve and read the existing render target contents when effects split rendering into multiple passes. Include color-attachment reads in both compatible render-pass external dependencies so validation and execution dependencies cover load operations as well as attachment writes.
Bridge wlroots Vulkan textures and renderer-owned output buffers into Qt Quick QRhi render targets while preserving the existing GLES2 and software paths. Keep imported buffers, Vulkan images, render targets, and frame resources alive through submission, and provide the Waylib plumbing used by render-buffer effects and diagnostics.
Select the Qt Quick Vulkan backend automatically when WLR_RENDERER=vulkan, initialize the matching wl_shm and linux-dmabuf path, and preserve the existing GLES2 renderer setup. Treat fatal Vulkan scene-graph failures as compositor failures so rendering cannot continue with invalid GPU state.
Wrap wp_presentation with display-owned Waylib lifetime management and attach it to the Vulkan startup path. Report surfaces as textured only for their frame-pacing output and submit feedback immediately before a successful output commit.
Batch foreign-texture synchronization waits into the shared Vulkan queue before Qt Quick submits each frame. Validate that Qt and wlroots use the same device, queue family, and queue once; retain the immediate CPU-wait fallback when batching is unavailable, and abort incomplete batches on every failure path.
Read screenshot and image-copy data from renderer-owned wlroots buffers instead of relying on an OpenGL framebuffer. Track capture frame ownership and damage explicitly so the Vulkan path releases buffers safely while leaving the existing GLES2 capture path unchanged.
Advertise the legacy wl_drm global for Vulkan only when the renderer exposes an implicit-modifier DMA-BUF texture format. This prevents legacy-buffer clients such as Youdao Note from selecting DRM formats the Vulkan renderer cannot import, while leaving the non-Vulkan wl_drm path unchanged.
Render Vulkan cursor layers directly into scanout buffers, preserve software fallback when preparation fails, and scale cursor content and hotspots consistently for fractional outputs. Detach Vulkan cursor motion from the main QML scene and schedule cursor-layer frames explicitly. All behavior changes are Vulkan-gated; the GLES2 cursor path remains unchanged.
Record each render pass's foreign-texture acquire and release transitions as one Vulkan pipeline barrier per phase. Flush deferred acquires before rollback on preparation failures and abort incomplete batches on every exit path. Non-Vulkan rendering remains unchanged.
Enable wlroots GPU-side staging uploads only after the imported-texture synchronization path verifies that Qt and wlroots share the same Vulkan queue. Queue ordering then replaces per-frame semaphore waits for CPU-backed client buffers; failed validation and WLR_VK_FORCE_STAGE_BLOCK retain the blocking fallback. GLES2 is unaffected.
Give Waylib-managed Vulkan render passes the same conservative external attachment dependency for a given attachment topology, independent of load and store flags. This keeps reused Qt pipelines compatible and makes preserved color and depth contents depend on preceding writes and layout transitions. Non-Vulkan QRhi render-pass creation stays unchanged.
Use the Vulkan RenderBufferBlitter as the backdrop source for MultiEffect and GlassEffect, including rounded clipping and the existing blur and glass configuration. Keep the implementation behind the Vulkan QML file selector so the GLES2 blur component and its lifecycle are unchanged.
Drop WITH_SUBMODULE_QWLROOTS from the English and Chinese build instructions now that mainline Waylib consumes wlroots directly.
e5fc4d0 to
cb59c5f
Compare
|
TAG Bot New tag: 0.8.18 |
该PR是 #1032 的更新版, 改动的wlroots由外侧转为treeland内侧的wlroots