Fix PipeWire grabber performance for Wayland/HDR screen capture #1368
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.
Summary
This PR fixes significant performance issues with the PipeWire screen grabber when capturing Wayland/HDR displays, improving capture rate from ~15 FPS to ~25-30 FPS.
Changes
1. Increased FPS limit (10 → 30)
_requestedFPSin constructor and reset function2. Disabled slow EGL/DmaBuf GPU path
initEGL()functionglGetTexImage()calls for GPU-to-CPU transfer, creating a significant bottleneck3. Build configuration note
cmake -DENABLE_PIPEWIRE_EGL=OFFPerformance Impact
glGetTexImage()Technical Details
The root cause was twofold:
glGetTexImage(), which blocks the capture thread and adds significant latencyThe CPU memory path (MemFd/MemPtr) is actually faster for PipeWire screen capture because:
Testing
Tested successfully on:
Verified that:
Closes
Addresses #1133 - Software Screen Capture not working when HDR is enabled under Gnome
Additional Notes
This change makes the CPU path the default, which is counterintuitive but empirically faster for PipeWire screen capture. The EGL/GPU path may have been designed for different use cases, but for real-time screen capture with immediate processing, the CPU path provides better performance.
Users experiencing similar issues should also ensure their
systemGrabberFPS setting in the database is set appropriately (e.g., 30 FPS instead of the old 10/15 FPS defaults).