Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Vulkan explicit-sync path to prefer DRM syncobj-backed timeline semaphores when supported, falling back to fences/sync files otherwise, and threads a shared eventfd cache through the rendering/copy stack to efficiently wait on syncobj points.
Changes:
- Add a
vulkan_coresync layer (VulkanTimelineSemaphore,VulkanSync) that can export either a fence-based sync file or a syncobj point. - Introduce
gfx_api::FdSyncto unify “sync file vs syncobj point” handling across Vulkan/GL/Metal/backends and buffer reservation plumbing. - Add
EventfdCacheand pass it through compositor/portal/screenshot/copy-device paths to support syncobj-point waiting via eventfds.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vulkan_core/timeline_semaphore.rs | Creates/export-checks a timeline semaphore and maps it to a DRM syncobj. |
| src/vulkan_core/sync.rs | Adds VulkanSync abstraction (fence vs timeline semaphore) and sync creation for queue submissions. |
| src/vulkan_core/fence.rs | Refactors fence into generic VulkanFence<D> using VulkanDeviceInf. |
| src/vulkan_core/device.rs | Introduces VulkanDeviceInf trait to unify device access for core sync primitives. |
| src/vulkan_core.rs | Adds core error variants and feature probing for timeline semaphore export support. |
| src/video/drm/sys.rs | Adds timeline handle-to-fd flag, query ioctl wrapper, and extends handle-to-fd API with point. |
| src/video/drm/syncobj.rs | Adds syncobj id, query-last-signaled, and blocking export path for sync files from syncobj points. |
| src/video/drm.rs | Re-exports get_drm_nodes_from_dev and extends DrmError for syncobj query/export. |
| src/utils/stack.rs | Adds Stack::len() (used by eventfd cache tests). |
| src/state.rs | Wires EventfdCache through state and changes render sync type to FdSync. |
| src/portal/ptl_display.rs | Passes EventfdCache into gfx context creation. |
| src/portal.rs | Adds EventfdCache to portal state initialization. |
| src/main.rs | Adds new eventfd_cache module. |
| src/it/test_client.rs | Updates screenshot path to supply EventfdCache to buffer readback. |
| src/ifs/wl_surface.rs | Switches buffer reservation sync tracking to FdSync and sync-file extraction when needed. |
| src/ifs/ext_image_copy/ext_image_copy_capture_frame_v1.rs | Updates capture-frame callback signatures to return FdSync. |
| src/gfx_apis/vulkan/transfer.rs | Uses VulkanDeviceSyncExt to signal either syncobj or fence and waits via FdSync. |
| src/gfx_apis/vulkan/shm_image.rs | Updates async upload/download sync plumbing to use VulkanSync/FdSync. |
| src/gfx_apis/vulkan/renderer.rs | Introduces per-render/transfer timeline semaphores and switches release signaling to VulkanSync/FdSync. |
| src/gfx_apis/vulkan/image.rs | Updates framebuffer render return type to FdSync. |
| src/gfx_apis/vulkan/device.rs | Implements VulkanDeviceInf, wires EventfdCache, and computes timeline-export support. |
| src/gfx_apis/vulkan.rs | Threads EventfdCache into Vulkan context/allocator creation and defines core sync aliases. |
| src/gfx_apis/gl/renderer/framebuffer.rs | Updates GL rendering to return FdSync. |
| src/gfx_apis/gl.rs | Wraps produced sync files into FdSync and uses AcquireSync::get_sync_file() for imports. |
| src/gfx_apis.rs | Threads EventfdCache into gfx context creation dispatch. |
| src/gfx_api.rs | Introduces FdSync, ReservedSyncobjPoint, updates AcquireSync and BufferResv API. |
| src/eventfd_cache/tests.rs | Adds tests for eventfd cache recycling behavior. |
| src/eventfd_cache.rs | Adds EventfdCache and Eventfd for async waits and recycling. |
| src/cursor_user.rs | Updates cursor swap-buffer sync type to FdSync. |
| src/copy_device.rs | Updates copy device to use VulkanSync/timeline semaphore when possible and adopt FdSync. |
| src/compositor.rs | Initializes and stores EventfdCache, passes it to gfx/copy device setup. |
| src/cli/screenshot.rs | Creates an EventfdCache for screenshot allocator path and passes it into Vulkan allocator creation. |
| src/backends/metal/video.rs | Updates cursor sync tracking to FdSync. |
| src/backends/metal/transaction.rs | Replaces per-syncfile poll loop with FdSync::signaled_blocking. |
| src/backends/metal/present.rs | Uses FdSync for cursor and framebuffer wait paths. |
| src/backends/metal/allocator.rs | Updates render/copy sync plumbing to FdSync and uses AcquireSync::from_fd_sync. |
| src/backend.rs | Updates HardwareCursorUpdate::swap_buffer to take FdSync. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.