Fix #129162: High idle CPU usage with PulseAudio in Linux #129312
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#129312
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "neXyon/blender:fix_129162"
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?
Prevents the unnecessary calls to CPU intensive pulseaudio functions while the stream is corked.
I have added Sergey and Sebastian as reviewers because they're more familiar with this area.
A note for Sergey and Sebastian, the high CPU usage issue was introduced in Blender 4.3.
Joerg then commited a fix to main. I advised them that Blender 4.3 also needs the bug fix, and advised them to open a PR (as it's best to go through review for changes to 4.3 this late in the development cycle)
As a result of this there will be merge conflicts when merging 4.3 into main after this change is commited to 4.3.
I wouldn't be able to test this, as I don't have an easy access to Linux machines at this time.
The PR would definitely benefit from more explanation of what's going on, and what the fix actually does.
One of the strange things to me is a non-guarded access and write to the
m_corked
variable (which seems it can get out of sync with the parameter passed toAUD_pa_stream_cork
.Added a short description.
How is it unguarded? Please check again. All accesses to
m_corked
are properly guarded with alock_guard
!Thanks!
Ok, I've missed that! What seemed weird to me is that the
AUD_pa_stream_cork()
is guarded by the lock onm_mainloop
, whilem_corked = true;
is not:Keep in mind, not saying it is mistake in the code, just something that seemed a bit odd. If you confirm it's actually all fine -- I'm fine with it too!
Yep, its' alright. The pa main loop only needs to be locked during the flush and cork calls. It doesn't matter if
m_corked
is written while it's locked or not as it is not accessed by the main loop.I'm always trying to lock as briefly as possible though a bool assignment likely has little to no impact. That's why I put it outside.
Thanks for checking and explaining!
TL;DR: I think it's better to land the fix soon.
We are currently at the Blender conference, and I don't have access to a Linux box to test. But I'd trust your tests! Since it is for 4.3, it's better to land it soon, so that we have the best chance of people trying it out before the release (for the unlikely scenario we've missed something).
LGTM