Skip to content

UI/Qt+LibCore: Lock IOSurface for safe CPU reads on macOS#9257

Open
christianfrey wants to merge 1 commit intoLadybirdBrowser:masterfrom
christianfrey:fix-macos-intel-qt-ui
Open

UI/Qt+LibCore: Lock IOSurface for safe CPU reads on macOS#9257
christianfrey wants to merge 1 commit intoLadybirdBrowser:masterfrom
christianfrey:fix-macos-intel-qt-ui

Conversation

@christianfrey
Copy link
Copy Markdown
Contributor

On Intel Macs, the IOSurface backing the Qt QImage may be updated by the GPU, but CPU access is not guaranteed to be coherent without explicit synchronization. This results in blank pages in the Qt UI.

This change adds lock_read_only() / unlock_read_only() around the Qt rendering path to ensure proper synchronization when reading from the IOSurface.

Apple Silicon is unaffected due to unified memory, but the locking is kept for correctness.

On macOS, SharedImageBuffer bitmaps are backed by IOSurface memory that
may be written by the GPU. Qt reads this memory from the CPU side when
creating a QImage and rendering it with QPainter.

On Intel Macs, reading IOSurfaceGetBaseAddress() without first taking a
read lock results in blank pages in the Qt UI.

Add read-only IOSurface lock helpers and use them around the Qt
rendering path to ensure proper synchronization between GPU writes and
CPU reads.
@christianfrey christianfrey changed the title Fix blank rendering in Qt UI on Intel macOS UI/Qt+LibCore: Lock IOSurface for safe CPU reads on macOS May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant