Skip to content

GUI: batch framebuffer update notifications#767

Draft
moreaki wants to merge 1 commit into
VirtualBox:mainfrom
moreaki:agent/gui-framebuffer-update-batching
Draft

GUI: batch framebuffer update notifications#767
moreaki wants to merge 1 commit into
VirtualBox:mainfrom
moreaki:agent/gui-framebuffer-update-batching

Conversation

@moreaki

@moreaki moreaki commented Jul 9, 2026

Copy link
Copy Markdown

Summary

Coalesce overlapping guest framebuffer update notifications in the Qt frontend before forwarding them to the machine view.

  • Accumulate NotifyUpdate and NotifyUpdateImage rectangles in a QRegion while holding the framebuffer's existing lock.
  • Queue at most one GUI-thread callback while a flush is pending.
  • Drain the accumulated region under the same lock, then forward each non-overlapping region rectangle through the existing UIMachineView::sltHandleNotifyUpdate path.

The change is confined to UIFrameBuffer.cpp; it does not alter painting policy, widget attributes, or the dirty-rectangle coordinate conversion.

Why

This is a draft performance candidate. The macOS/Arm VMSVGA DX11 path can emit bursts of guest updates at HiDPI and 4K sizes. Coalescing overlapping rectangles may reduce queued cross-thread signal traffic without changing the existing view-update path.

No performance benefit is claimed yet. The PR should remain draft—and should be closed if it does not show a repeatable improvement in an isolated current-main A/B comparison.

Validation

  • git diff --check
  • Full clean Darwin/Arm64 build from current origin/main at this minimized patch tip: pending in the pinned comparison build.
  • Static concurrency audit: producers update the region under the framebuffer's existing lock; the GUI callback copies and clears it under that lock, releases the lock before calling the machine view, and a producer arriving after the clear queues the next callback.
  • Runtime correctness and isolated performance A/B: pending with the fixed dxmtbench functional gate at 3840x2160 in a Windows 11 Arm guest.

The performance comparison will use identical current-main-based builds and will treat any rendering, signature, context, launch, or graphics-log alert as a failed sample rather than performance evidence.

Additional lifecycle gate

The coalescing callback is queued to UIFrameBufferPrivate and then forwards through the current raw m_pMachineView after releasing the framebuffer lock. The former queued signal used the machine view itself as the Qt receiver, so view destruction automatically discarded pending deliveries. Before this draft can be considered valid, it must therefore also survive repeated windowed/fullscreen view replacement and shutdown while updates are queued, with no stale rectangle delivered to a replacement view and no use-after-free. A 4K steady-state benchmark alone is insufficient for that lifecycle check.

@oracle-contributor-agreement

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Jul 9, 2026
Accumulate overlapping guest dirty rectangles in a QRegion and deliver them from one queued GUI-thread callback instead of queuing one cross-thread signal per update.

Signed-off-by: Roberto Nibali <rnibali@gmail.com>
@moreaki
moreaki force-pushed the agent/gui-framebuffer-update-batching branch from 2bc0f87 to a389e03 Compare July 16, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant