feat(dstorage): submit half-full queues and enforce capacity #34

Manually merged
github merged 1 commit from gh-pr/34/head into gh-pr/34/base 2026-11-26 19:56:35 +00:00
Owner

@⁠mrb-eel on GitHub · 2026-11-21 15:26 UTC · original
mrb-eel:codex/directstorage-queue-submission → main · +154 −31 · 2 files · 1 commits · merged 2026-11-22 09:58 UTC

ScarlettX's DirectStorage worker only sees requests after an explicit DStorageSubmit. A title following the Xbox queue contract can fill half its queue and wait for a read or notification that never gets submitted.

Automatically submit staged entries when reads, status markers or fence signals fill half the queue. Keep a single FIFO with a submitted prefix so explicit and automatic submission use the same path. Count queued and active entries against the capacity, wake blocked producers as entries retire, and wake them when the queue closes. The shim rejects a reentrant enqueue from its own signal callback when the queue is full, since that callback would otherwise block its worker.

The Xbox GDK documents the threshold for each enqueue method and the behavior at capacity. EnqueueRequest, EnqueueStatus, EnqueueSignal, queue capacity.

Verification

  • The new regression fails on upstream because reaching the threshold never completes the status marker. It passes with the fix, including separate triggers for reads, status and fence writes, a blocked producer that resumes when a slot opens, and a full-queue callback that returns promptly.
  • Eight CTest targets passed on macOS arm64. The DirectStorage test passed 20 consecutive runs and also passed linked directly against dstorage_xs.
  • Cross-built the dstorage_xs.dll and test_dstorage_xvd.exe Release targets for Windows x64 with LLVM-MinGW. Native Windows execution and retail title testing remain pending.
  • Test-merged with #33 and ran the combined DirectStorage regression successfully.

Developed with assistance from OpenAI Codex.

**@⁠mrb-eel** on GitHub · 2026-11-21 15:26 UTC · [original](https://github.com/Freminet/ScarlettX/pull/34) `mrb-eel:codex/directstorage-queue-submission` → `main` · +154 −31 · 2 files · 1 commits · merged 2026-11-22 09:58 UTC ScarlettX's DirectStorage worker only sees requests after an explicit `DStorageSubmit`. A title following the Xbox queue contract can fill half its queue and wait for a read or notification that never gets submitted. Automatically submit staged entries when reads, status markers or fence signals fill half the queue. Keep a single FIFO with a submitted prefix so explicit and automatic submission use the same path. Count queued and active entries against the capacity, wake blocked producers as entries retire, and wake them when the queue closes. The shim rejects a reentrant enqueue from its own signal callback when the queue is full, since that callback would otherwise block its worker. The Xbox GDK documents the threshold for each enqueue method and the behavior at capacity. [EnqueueRequest](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/dstorage/interfaces/idstoragequeuex/methods/idstoragequeuex_enqueuerequest), [EnqueueStatus](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/dstorage/interfaces/idstoragequeuex/methods/idstoragequeuex_enqueuestatus), [EnqueueSignal](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/system/dstorage/interfaces/idstoragequeuex/methods/idstoragequeuex_enqueuesignal), [queue capacity](https://learn.microsoft.com/en-us/xbox/gdk/docs/features/console/storage/directstorage/directstorage-overview). ### Verification - The new regression fails on upstream because reaching the threshold never completes the status marker. It passes with the fix, including separate triggers for reads, status and fence writes, a blocked producer that resumes when a slot opens, and a full-queue callback that returns promptly. - Eight CTest targets passed on macOS arm64. The DirectStorage test passed 20 consecutive runs and also passed linked directly against `dstorage_xs`. - Cross-built the `dstorage_xs.dll` and `test_dstorage_xvd.exe` Release targets for Windows x64 with LLVM-MinGW. Native Windows execution and retail title testing remain pending. - Test-merged with #33 and ran the combined DirectStorage regression successfully. Developed with assistance from OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:56:35 +00:00
github manually merged commit 13dfd0d2ea into gh-pr/34/base 2026-11-26 19:56:35 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.