Skip to content

Wait for the frame's uploads before drawing on V3DV - #624

Merged
stanoddly merged 2 commits into
mainfrom
issue-623
Oct 6, 2026
Merged

stanoddly merged 2 commits into
mainfrom
issue-623

Conversation

@botoddly

@botoddly botoddly commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Fixes #623.

On the Raspberry Pi 5, V3DV can bin a draw before the uploads submitted ahead of it have finished, so geometry read from a buffer updated every frame has holes on the 64 px tile grid. This PR waits for the uploads there.

  • PixelyConfig.UploadWait with Automatic (the default), On and Off. PIXELY_UPLOAD_WAIT overrides it with automatic, on or off.
  • When the wait is on, GpuMemorySystem.Submit() submits the uploads with SDL_SubmitGPUCommandBufferAndAcquireFence and waits on the fence. Render coordinators already submit the uploads before the frame, so the frame starts only after they finish. When the wait is off, the submit is unchanged.
  • Automatic turns the wait on when the device's driver name (SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING) starts with V3DV. Mesa reports exactly V3DV Mesa, with the version in a separate property.
  • In the browser, Automatic is off, and On fails at Build() with PixelyInitializationException, because the browser build cannot wait on a fence.
  • GpuMemorySystem is now created by PixelyFactory, which reads the config. Its public constructor keeps the wait off.
  • The diagnostics GPU device: line ends with upload wait on or upload wait off, read from the GpuMemorySystem.
  • PixelyConfig gets a new last positional parameter, so code compiled against the old constructor or Deconstruct must be rebuilt.
  • Docs: window-rendering.md (new section "Waiting for uploads"), diagnostics.md, headless.md, hosting.md, and a DECISIONS.md entry.

Verification

  • Pixely.Tests: 447 of 447 pass, including new tests for the resolver, the environment variable, the factory and the diagnostics line.
  • Headless StorageBuffer tutorial on an AMD GPU (radv), 60 frames each: on, off and automatic run, and the diagnostics line reports on, off and off.
  • Not verified: the Pi 5. The issue's open question remains. The measured workaround waited for the whole GPU to go idle, while this waits only on the upload fence. Acceptance: with the issue's 30-frame grim method, unset and on give 0 frames with holes, and off still shows them.

@stanoddly
stanoddly enabled auto-merge (squash) October 6, 2026 08:39
@stanoddly
stanoddly merged commit 3136d61 into main Oct 6, 2026
3 checks passed
@stanoddly
stanoddly deleted the issue-623 branch October 6, 2026 08:42
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

📦 Development package Pixely 0.0.115 is available.

Workflow run (attempt 1)

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

✅ Development package validation passed on all platforms.

Workflow run (attempt 1)

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.

Wait for the frame's uploads before drawing on V3DV, whose binning reads storage buffers before they are updated

2 participants