ProjectScarlett menu runs at ~1 fps on Wine because VirtualQuery on XMem section views goes through wineserver; #258 fixes it (AMD) #289

Closed
opened 2026-11-27 01:09:20 +00:00 by Kayotic1337 · 3 comments
Kayotic1337 commented 2026-11-27 01:09:20 +00:00 (Migrated from github.com)
Contributor

Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-27T01:09:20Z.


Setup: RX 9070 XT, Mesa/RADV 26.3.1, GE-Proton11-14, kernel 7.3.6 (CachyOS), main at 12e4b06, ProjectScarlett 1.0.2.1 via tuxbox.py run.

1. Start menu at ~1 fps: wineserver-bound VirtualQuery

On main the start menu ran at about 1 fps (11 frames per 10 s, warm translations, nothing compiling). Nothing looked busy:

  • GPU 4% busy, busiest game thread 9% CPU, 0 KB/s disk reads.
  • Present, frame-event and memory-label waits together took only ~45 ms per 10 s.

wineserver itself, however, was at 90% CPU. A gdb snapshot of all threads showed the busiest game thread blocked on a server reply:

read () from libc.so.6
read_reply_data () from ntdll.so
server_call_unlocked () from ntdll.so
wine_server_call () from ntdll.so
get_committed_size () from ntdll.so
get_basic_memory_info () from ntdll.so
__wine_syscall_dispatcher () from ntdll.so

Sampling /proc/<pid>/task/<tid>/syscall showed that thread in read 90% of the time. On Wine, VirtualQuery on a MEM_MAPPED view of a SEC_RESERVE-style section asks wineserver for the committed size, so each query is a server round trip. XMem backs physical pages with section views, and d3d12_xs validates ranges with VirtualQuery loops in several places (clwb.rs, clzero.rs, device/heap.rs, device/heap/shadow.rs, survey.rs). I couldn't tell which call site is the hot one: gdb doesn't unwind through the PE frames.

With #258 merged on top (XMem backings as MEM_PRIVATE), the same menu runs at 30–60 fps (300–546 frames per 10 s) and wineserver drops to ~21% CPU. #258 is written for #191, so this looks like an unnoticed side effect worth knowing, and possibly a reason to keep VirtualQuery off hot paths in general.

Refusals for comparison (same title and save; the earlier run was on the main from before #278/#281):

before 12e4b06
Failed to convert function 1011 82
Failed to remap sampler 829 6
menu fps ~1 ~1 (until #258)

So on this setup the 1 fps wasn't caused by refused shaders.

2. Story intro: black screen, then GPU page fault at address 0 (AMD side of #232)

With 12e4b06 + #258, starting story mode plays audio but the screen stays black. About 19 min after launch (title crash log: Game State: Game Running, frame 1688, 978 streaming requests) the GPU faults:

amdgpu: [gfxhub] page fault (src_id:0 ring:24 vmid:7) thread vkd3d_queue
  in page starting at address 0x0000000000000000 from client 10
  GCVM_L2_PROTECTION_FAULT_STATUS:0x00701431
  Faulty UTCL2 client ID: SQC (data) (0xa)
  PERMISSION_FAULTS: 0x3  MAPPING_ERROR: 0x0  WALKER_ERROR: 0x0

Then VK_ERROR_DEVICE_LOST, PresentX failed planes=1 HRESULT=0x80004005, and the title's breakpoint/crash handler (exit code 3; the crash upload failed offline as intended).

Just before it, the log has 14 skipped compute dispatches and 6 skipped draws. Almost all of them say its root indexes the resource heap directly, with the same guest callers as in #232 (0x248cbc1, 0x2951ba, 0x56bba, 0x4e33f98), plus one descriptor table refresh (0x80070057) at 0x2495f7d. On NVIDIA this point shows as Xid 109 (context-switch timeout). On RADV it is a scalar-data read of address 0, which fits a later pass reading output a skipped dispatch never wrote, or a descriptor left at 0.

I haven't checked whether #258 plays a part in the crash: without it the menu is too slow to reach story mode.

<!-- greyfinch-sync:brcly/TuxBox:issue:6637856831 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/issues/289). Originally posted by [Kayotic1337](https://github.com/Kayotic1337) on 2026-11-27T01:09:20Z. --- **Setup:** RX 9070 XT, Mesa/RADV 26.3.1, GE-Proton11-14, kernel 7.3.6 (CachyOS), `main` at 12e4b06, ProjectScarlett 1.0.2.1 via `tuxbox.py run`. ## 1. Start menu at ~1 fps: wineserver-bound `VirtualQuery` On `main` the start menu ran at about 1 fps (11 frames per 10 s, warm translations, nothing compiling). Nothing looked busy: - GPU 4% busy, busiest game thread 9% CPU, 0 KB/s disk reads. - Present, frame-event and memory-label waits together took only ~45 ms per 10 s. `wineserver` itself, however, was at **90% CPU**. A `gdb` snapshot of all threads showed the busiest game thread blocked on a server reply: ``` read () from libc.so.6 read_reply_data () from ntdll.so server_call_unlocked () from ntdll.so wine_server_call () from ntdll.so get_committed_size () from ntdll.so get_basic_memory_info () from ntdll.so __wine_syscall_dispatcher () from ntdll.so ``` Sampling `/proc/<pid>/task/<tid>/syscall` showed that thread in `read` 90% of the time. On Wine, `VirtualQuery` on a `MEM_MAPPED` view of a `SEC_RESERVE`-style section asks wineserver for the committed size, so each query is a server round trip. XMem backs physical pages with section views, and d3d12_xs validates ranges with `VirtualQuery` loops in several places (`clwb.rs`, `clzero.rs`, `device/heap.rs`, `device/heap/shadow.rs`, `survey.rs`). I couldn't tell which call site is the hot one: gdb doesn't unwind through the PE frames. **With #258 merged on top** (XMem backings as `MEM_PRIVATE`), the same menu runs at **30–60 fps** (300–546 frames per 10 s) and wineserver drops to ~21% CPU. #258 is written for #191, so this looks like an unnoticed side effect worth knowing, and possibly a reason to keep `VirtualQuery` off hot paths in general. Refusals for comparison (same title and save; the earlier run was on the main from before #278/#281): | | before | 12e4b06 | |---|---|---| | `Failed to convert function` | 1011 | 82 | | `Failed to remap sampler` | 829 | 6 | | menu fps | ~1 | ~1 (until #258) | So on this setup the 1 fps wasn't caused by refused shaders. ## 2. Story intro: black screen, then GPU page fault at address 0 (AMD side of #232) With 12e4b06 + #258, starting story mode plays audio but the screen stays black. About 19 min after launch (title crash log: `Game State: Game Running`, frame 1688, 978 streaming requests) the GPU faults: ``` amdgpu: [gfxhub] page fault (src_id:0 ring:24 vmid:7) thread vkd3d_queue in page starting at address 0x0000000000000000 from client 10 GCVM_L2_PROTECTION_FAULT_STATUS:0x00701431 Faulty UTCL2 client ID: SQC (data) (0xa) PERMISSION_FAULTS: 0x3 MAPPING_ERROR: 0x0 WALKER_ERROR: 0x0 ``` Then `VK_ERROR_DEVICE_LOST`, `PresentX failed planes=1 HRESULT=0x80004005`, and the title's breakpoint/crash handler (exit code 3; the crash upload failed offline as intended). Just before it, the log has 14 skipped compute dispatches and 6 skipped draws. Almost all of them say `its root indexes the resource heap directly`, with the same guest callers as in #232 (0x248cbc1, 0x2951ba, 0x56bba, 0x4e33f98), plus one `descriptor table refresh (0x80070057)` at 0x2495f7d. On NVIDIA this point shows as Xid 109 (context-switch timeout). On RADV it is a scalar-data read of address 0, which fits a later pass reading output a skipped dispatch never wrote, or a descriptor left at 0. I haven't checked whether #258 plays a part in the crash: without it the menu is too slow to reach story mode.
NickStallman commented 2026-11-27 01:20:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-27T01:20:25Z.


A data point from NVIDIA, which suggests the 1 fps menu depends on the host. On an RTX 5090 (driver 620.70.10, GE-Proton11-14, game files on local disk), runs without #258 loaded at full speed from launch through the menu. Frames presented per 10 s, first 40–80 s of each run:

build with #258 frames per 10 s
main e76ff6a + #235 no 1365, 1437, 1435, 933
main 12e4b06 + a local diagnostic probe (two runs, one also with a local d3d12 change) no 1036, 1139, 529, 301 / 1073, 978, 1018, 1205
e76ff6a + #235 + probe (two runs) no 1067, 1149, 449, 300 / 996, 1177, 422, 301
e76ff6a + #235 + probe + #258 yes 874, 1234, 1088, 1088

Three other runs did load at exactly 10 frames per 10 s for 7–10 minutes. All three had a local experiment that replaces some of #216's compute programs with no-ops, and the same build without that experiment loaded at full speed, so the slowness came from the experiment, not from #258 or main. (An earlier version of this comment blamed the first launch after moving the game to local disk; a third run ruled that out.) During those slow loads the wineserver ran at about 2,100 switches/s, so it wasn't the VirtualQuery case you found.

The intro is a different story. The NVIDIA runs that got there all died around Prestream:

  • most with Xid 109 (the #232 hang);
  • one with Xid 13, an MMU fault across many SMs, which may be the NVIDIA form of your page fault at address 0.

I haven't tied that one to a specific skipped dispatch.

<!-- greyfinch-sync:brcly/TuxBox:comment:7207209075 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/issues/289#issuecomment-7207209075). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-27T01:20:25Z. --- A data point from NVIDIA, which suggests the 1 fps menu depends on the host. On an RTX 5090 (driver 620.70.10, GE-Proton11-14, game files on local disk), runs *without* #258 loaded at full speed from launch through the menu. Frames presented per 10 s, first 40–80 s of each run: | build | with #258 | frames per 10 s | |---|---|---| | main e76ff6a + #235 | no | 1365, 1437, 1435, 933 | | main 12e4b06 + a local diagnostic probe (two runs, one also with a local d3d12 change) | no | 1036, 1139, 529, 301 / 1073, 978, 1018, 1205 | | e76ff6a + #235 + probe (two runs) | no | 1067, 1149, 449, 300 / 996, 1177, 422, 301 | | e76ff6a + #235 + probe + #258 | yes | 874, 1234, 1088, 1088 | Three other runs did load at exactly 10 frames per 10 s for 7–10 minutes. All three had a local experiment that replaces some of #216's compute programs with no-ops, and the same build without that experiment loaded at full speed, so the slowness came from the experiment, not from #258 or main. (An earlier version of this comment blamed the first launch after moving the game to local disk; a third run ruled that out.) During those slow loads the wineserver ran at about 2,100 switches/s, so it wasn't the `VirtualQuery` case you found. The intro is a different story. The NVIDIA runs that got there all died around `Prestream`: - most with Xid 109 (the #232 hang); - one with Xid 13, an MMU fault across many SMs, which may be the NVIDIA form of your page fault at address 0. I haven't tied that one to a specific skipped dispatch.
Kayotic1337 commented 2026-11-27 02:02:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-27T02:02:59Z.


Thanks, that narrows it down: it's the copy path, which only hosts that can't import game memory take. In my two runs on the same build and save, the provider logs:

  • without #258: game memory is copied for the GPU: this host cannot import it directly
  • with #258: game memory is imported through its XMem backing (and … through non-contiguous XMem backings)

So on RADV the section-backed game memory couldn't be imported before #258 (the #191 case), the provider copied it for the GPU, and that path is where the VirtualQuery calls on MEM_MAPPED views piled up in wineserver. An NVIDIA host that imports directly never takes it, which matches your full-speed menus. I'd read the 1 fps as "#191 hosts on the copy path", not as AMD in general.

On the intro: on this AMD card the page fault at address 0 went away in 2 of 2 runs once compute roots that have tables and index the heap directly also get the resource index map. Before, reflected_root returned Original for them, and every dispatch was skipped with its root indexes the resource heap directly. I've got that as a branch with a Lanes scenario that fails without it (bindless-table-compute) and will open a PR. It would be good to know whether your Xid 13 run goes away with it too. After that, both of my runs ended in the #215 label stall (a gfx ring timeout here, which looks like your Xid 109).

<!-- greyfinch-sync:brcly/TuxBox:comment:7207788450 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/issues/289#issuecomment-7207788450). Originally posted by [Kayotic1337](https://github.com/Kayotic1337) on 2026-11-27T02:02:59Z. --- Thanks, that narrows it down: it's the copy path, which only hosts that can't import game memory take. In my two runs on the same build and save, the provider logs: - without #258: `game memory is copied for the GPU: this host cannot import it directly` - with #258: `game memory is imported through its XMem backing` (and `… through non-contiguous XMem backings`) So on RADV the section-backed game memory couldn't be imported before #258 (the #191 case), the provider copied it for the GPU, and that path is where the `VirtualQuery` calls on `MEM_MAPPED` views piled up in wineserver. An NVIDIA host that imports directly never takes it, which matches your full-speed menus. I'd read the 1 fps as "#191 hosts on the copy path", not as AMD in general. On the intro: on this AMD card the page fault at address 0 went away in 2 of 2 runs once compute roots that have tables *and* index the heap directly also get the resource index map. Before, `reflected_root` returned `Original` for them, and every dispatch was skipped with `its root indexes the resource heap directly`. I've got that as a branch with a Lanes scenario that fails without it (`bindless-table-compute`) and will open a PR. It would be good to know whether your Xid 13 run goes away with it too. After that, both of my runs ended in the #215 label stall (a gfx ring timeout here, which looks like your Xid 109).
Kayotic1337 commented 2026-11-27 02:41:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from brcly/TuxBox. Originally posted by Kayotic1337 on 2026-11-27T02:41:11Z.


Correction to my last comment: the address-0 fault did not go away. In a third run (index-map change + #258 + current main), the intro again ended in a gfx ring timeout, and the amdgpu devcoredump of that hang shows the same fault: Faulty page starting at address: 0x0, status 0x601431 (SQC data read, permission fault). The kernel log only showed the ring timeout that time, so my earlier "2 of 2" was based on an incomplete signal. The fault was probably there behind the timeouts as well.

The index-map change still fixes a real skip: compute roots with tables that also index the heap directly no longer have every dispatch dropped, and a Lanes scenario fails without it. But it isn't the fix for the intro fault, and some compute dispatches and draws are still skipped there. I'll say so in the PR.

<!-- greyfinch-sync:brcly/TuxBox:comment:7208343604 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/issues/289#issuecomment-7208343604). Originally posted by [Kayotic1337](https://github.com/Kayotic1337) on 2026-11-27T02:41:11Z. --- Correction to my last comment: the address-0 fault did **not** go away. In a third run (index-map change + #258 + current main), the intro again ended in a gfx ring timeout, and the amdgpu devcoredump of that hang shows the same fault: `Faulty page starting at address: 0x0`, status `0x601431` (SQC data read, permission fault). The kernel log only showed the ring timeout that time, so my earlier "2 of 2" was based on an incomplete signal. The fault was probably there behind the timeouts as well. The index-map change still fixes a real skip: compute roots with tables that also index the heap directly no longer have every dispatch dropped, and a Lanes scenario fails without it. But it isn't the fix for the intro fault, and some compute dispatches and draws are still skipped there. I'll say so in the PR.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox#289
No description provided.