Skip to content

Skip GPU work for caret-only host frames - #120

Merged
wieslawsoltes merged 2 commits into
mainfrom
fix/idle-webgpu-rendering-opportunity
Sep 16, 2026
Merged

wieslawsoltes merged 2 commits into
mainfrom
fix/idle-webgpu-rendering-opportunity

Conversation

@wieslawsoltes

@wieslawsoltes wieslawsoltes commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A focused native text control keeps caret demand active. With WebGPU installed, every admitted caret frame was treated as GPU work even when the document had no JavaScript RAF, GPU canvas, or current texture. That made the worker publish unchanged scenes and could sustain a display-refresh-rate redraw loop in an otherwise idle Code OSS window.

Change

  • Create a GPU rendering opportunity only when a waiting RAF may acquire a texture or an existing current texture must retire.
  • Preserve the scene-lease fixture's intentional GPU work by attaching it to a real RAF.
  • Add a hardware-independent CTest gate for the caret-only path.
  • Exercise 10,000 synthetic 120 Hz opportunities per gate run, require zero pending GPU animation tasks after every opportunity, and cap the hot loop at two seconds.

Focused validation

  • Release native engine with real V8 and pinned Dawn: built successfully.
  • webscene_graphics_idle_caret_opportunity: passed.
  • Focused gate: 25/25 runs, 250,000 opportunities, zero pending GPU frame tasks.
  • Hot-loop timing: 0.288 ms minimum, 0.307 ms average, 0.335 ms maximum per 10,000 opportunities; ceiling is 2 seconds.
  • Full webscene_graphics_v8_runtime_tests, including intentional RAF/current-texture/scene-lease behavior: passed.
  • git diff --check: passed.

The previously qualified Code OSS package at WebScene consolidation b4483f3 contains the same runtime fix (00e5e90c). Its applicable idle gates recorded 0.0 visible and hidden presentations/second, 0.077% visible idle CPU, and 0.256% hidden idle CPU. The focused current-main test above makes the causal no-GPU-work condition deterministic.

Closes #114.

@wieslawsoltes
wieslawsoltes force-pushed the fix/idle-webgpu-rendering-opportunity branch 2 times, most recently from b324083 to 724e4d0 Compare September 16, 2026 10:04
@wieslawsoltes
wieslawsoltes changed the base branch from review/code-oss-caret-gpu-base to main September 16, 2026 10:20
@wieslawsoltes
wieslawsoltes force-pushed the fix/idle-webgpu-rendering-opportunity branch from 724e4d0 to f004609 Compare September 16, 2026 21:40
@wieslawsoltes
wieslawsoltes marked this pull request as ready for review September 16, 2026 21:40
@wieslawsoltes
wieslawsoltes merged commit c9a6e62 into main Sep 16, 2026
4 of 12 checks passed
@wieslawsoltes
wieslawsoltes deleted the fix/idle-webgpu-rendering-opportunity branch September 16, 2026 21:52
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.

Do not create GPU rendering work for caret-only host frames

1 participant