mirror of
https://github.com/games-on-whales/gst-wayland-display.git
synced 2026-10-15 21:02:00 +00:00
[PR #21] [MERGED] feat: CPU optimizations for CUDA-path #24
Labels
No labels
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
games-on-whales/gst-wayland-display#24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/games-on-whales/gst-wayland-display/pull/21
Author: @DatCaptainHorse
Created: 10/12/2025
Status: ✅ Merged
Merged: 10/12/2025
Merged by: @ABeltramo
Base:
cuda-interop← Head:woof📝 Commits (2)
a7d2287feat: CPU optimizations for CUDA-path operations398ba0efix: properly using RAII for EGLImage and avoid usingeglGetCurrentDisplay()📊 Changes
7 files changed (+165 additions, -133 deletions)
View changed files
📝
Cargo.lock(+15 -15)📝
gst-plugin-wayland-display/src/waylandsrc/imp.rs(+6 -7)📝
wayland-display-core/src/comp/mod.rs(+13 -0)📝
wayland-display-core/src/lib.rs(+3 -2)📝
wayland-display-core/src/utils/allocator/cuda/ffi.rs(+52 -51)📝
wayland-display-core/src/utils/allocator/cuda/mod.rs(+35 -33)📝
wayland-display-core/src/utils/allocator/mod.rs(+41 -25)📄 Description
Profiling with flamegraph showed that some resource allocations were eating plenty of CPU cycles each frame, those are now cached, as the pointer location stays same things work out, but without recreating the resource each time 🙂
Secondly,
settings.cudabuffer_pool = Some(pool);was set indecide_allocation, which happened later when settings were already communicated to wayland-display-core, so I added extra command to send the buffer pool later on separately, this works out from my testing just before gstreamer pipeline starts rolling.Thirdly, now that buffer pool is set and available during runtime, I changed
alloc_copy_gst_memoryto return straight buffers instead and separated copy-op to it's own method. Syncing the CUDA stream after unmap was also eating some CPU cycles from simply waiting, as theCuMemcpy2DAsyncis async, it seems to be fine to let the CUDA runtime handle the unmap later after the async-op is done.I might've misplaced some comments from original locations, and I'm not sure if
UpdateCUDABufferPoolcommand is what you'd want so I marked that as TODO 😅Let me know of any issues 🙏
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.