d3d12: record a lazy publication on access on copy lists of its own #657
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/657"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by gtb-sbe on 2026-12-02T17:29:26Z.
Summary
With lazy publication on (the default), ProjectScarlett loses the device on my RX 9060 XT at the same point every time: 6 title frames after the story intro's mission is set, right after the first textures are published on access. 4 runs out of 4 on
53782eed, withradv/amdgpu: The CS has been rejected, see dmesg for more information (-22)and nothing in dmesg. WithTUXBOX_LAZY_PUBLICATION=0the run gets past that point.The rejected submission comes from the copy queue
lazy::publish_nowcreates on its first publication on access.publish_nowrecordsReadback::record(device, COPY, ..)with the readback spares of the queue that deferred the texture (Held::spares, the queue worker'sworker.spares).Parts::getreuses a spare(allocator, list)whatever its type, so after that queue has published something itself, a publication on access takes the queue's spare direct list and executes it on the copy queue. D3D12 doesn't allow that, and vkd3d-proton passes it through: a graphics-family command buffer on a compute-family VkQueue.What RADV makes of it, from a bpftrace probe on
amdgpu_cs_ioctlduring the run (kernel 6.18, Mesa 26.3.1):RADV tags every IB with the queue's index in its family (
radv_amdgpu_cs.c,ring = queue_idx), so the graphics IB from the direct list gets ring 3. A context has one graphics entity, so the kernel rejects it. On compute queue 0 the same mistake would go through. That is likely why it depends on the host and on how many queues a title creates before the copy queue: here it landed on index 3 every time.The change gives
publish_nowreadback parts of its own next to its copy queue, asheap_writesalready does for its copy queue, so it always records copy lists.Heldno longer needs the deferring queue's spares, andlazy::deferloses that parameter.Tested
Run the checks relevant to this change.
New Lanes scenario
texture-publication-copy-queue: three compute queues first; the direct queue writes a texture with a smaller alias at the same address (published at once, which leaves a direct readback list spare), then a texture that waits for an access; reading that texture's title memory publishes it on the provider's copy queue. On1b4ed472without the change it fails on my card the same way the game does (device after publishing a texture on access failed: 0x887a0005,The CS has been rejected (-22), the probe shows a graphics IB with ring 1). With the change it passes.GPU, driver and backend:
1002:7590), Mesa 26.3.1, kernel 6.18, GE-Proton11-15, NixOS.The
Evidence:linetuxbox.py checkprints last:Commands run and their results:
All four failures fail the same way on unchanged
1b4ed472on this card.texture-publicationand the newtexture-publication-copy-queuepass; without the change the new scenario fails with0x887a0005(device removed).ProjectScarlett with this change on
53782eed(the base of my four failing runs, so the caches stayed warm), lazy publication on, private views, one run: 16 textures published on access, no CS rejection, and the title ran 45 frames past the point where the four runs without the change died (6 frames after the intro mission is set). That run then ended on a GPU page fault, a TCP read withMAPPING_ERRORin draws that includePS 89f6b548. That looks like the #603 family that DrArroway's run on #634 also ended on (the same pixel program was unfinished there), and this change doesn't touch it.AI use
I worked on this with an AI coding agent (Claude Code, following
AGENTS.md). It found the common pattern in my four game logs, wrote the bpftrace probes I ran as root during the runs, traced the rejected submission to the reused spare list, wrote the fix and the Lanes scenario, and ran the checks above on my machine.