Repository navigation
kernelx: textures in a GPU view read what is mapped in its CPU view (retail movie no longer green) - #323
Closed
Sr-0w wants to merge 2 commits into
Closed
kernelx: textures in a GPU view read what is mapped in its CPU view (retail movie no longer green)#323Sr-0w wants to merge 2 commits into
Sr-0w wants to merge 2 commits into
Conversation
…d (retail menu text complete) A retail game reserves 24 GB of 64 KiB pages (VirtualAlloc flags 0x20402000) and commits 2.2 GB of large pages with a graphics protection (flags 0x20003000, protection 0x2404). Neither fits a sparse or the coherent window, so both fell through to plain memory without MEM_WRITE_WATCH. Textures the title places there are kept in step with the memory (d3d12x::title_textures), which relies on GetWriteWatch to see CPU writes: they were uploaded once, empty, and never again (128+ textures in the first 45 s). One of them is the game's 2048x2048 A8_UNORM glyph atlas, which the CPU fills as text is laid out. Its GPU copy stayed zero, so every glyph drawn from it (the x-height letters: a c e m n o r s u v w x z) was missing from the menus; letters drawn by the vector path (ascenders, descenders, capitals) were fine. Found by a GPU readback of the atlas (zero) against its CPU view (glyphs) while the menu was on screen. The fallback VirtualAlloc now adds MEM_WRITE_WATCH for GPU-visible reservations (MEM_GRAPHICS, MEM_LARGE_PAGES / MEM_64K_PAGES, or a PAGE_GRAPHICS_* protection) and records them with the graphics reservations, whose ranges title_textures watches. Test: gpu_visible_fallback_memory_is_write_watched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A retail game reserves 24 GB of GPU-visible memory read-write and, right after it, 24 GB more with a graphics protection (0x801): the same memory as the GPU sees it. It maps its physical pages into the first reservation only and places the textures the CPU fills at the same offset in the second. Its movie frames are decoded on the CPU into the first; the R8 plane textures the movie shader samples are at +0x600000000 in the second. Here the second reservation is memory of its own that nothing is ever mapped into, so those textures were kept in step with reserved memory: zeros, and a YUV frame of zeros is a green screen. The game's first movie was green. A graphics-protected reservation made right after one of the same size without a graphics protection is now recorded as that one's GPU view (XCL_GPU_VIEWS=0 turns it off). title_textures reads the pages of a GPU view that hold nothing from its CPU view, watches the CPU view's pages of such textures, and uploads them again when those pages are written. Stacked on ivall#252, which makes those reservations write-watched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA
|
Heads-up (static check on
AI use: static code check of |
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #252; only the top commit (b8537b2) belongs here.
A retail game reserves 24 GB of GPU-visible memory read-write, then right after it 24 GB more with a graphics protection (0x801). The second is the same memory as the GPU sees it. The game maps its physical pages into the first reservation only, and places the textures the CPU fills at the same offset in the second. Its movies are decoded on the CPU into the first; the R8 Y/Cb/Cr plane textures the movie shader samples are at +0x600000000, in the second.
Under XCL the second reservation is memory of its own and nothing is ever mapped into it.
title_textureskept those textures in step with reserved memory, i.e. zeros, and a YUV frame of zeros is a green screen. The game's first movie was green from start to end.A reservation with a graphics protection made right after one of the same size without one is now recorded as that one's GPU view (
XCL_GPU_VIEWS=0turns this off). For textures in a GPU view,title_textures:Before / after: the first movie, window title cropped.
What is in it
crates/xcl/src/hle/kernelx.rs:pair_gpu_view/note_gpu_view, called where KernelX: GPU-visible title memory outside the windows is write-watched (retail menu text complete) #252 reserves GPU-visible memory;gpu_view_pages, which maps a GPU view's page to its CPU view's;crates/xcl/src/hle/d3d12x/title_textures.rs:read_committedreads unmapped GPU-view pages from the CPU view;Tested
cargo test --release --workspace -- --test-threads=4: 656 passed, 0 failed, 40 ignored; no SKIPPED tests.a_gpu_view_reads_its_cpu_viewfails without theread_committedchange (checked by disabling it) and passes with it.0x1581e230000 (0x600000000 bytes, protection 0x801) is the GPU view of 0x1521e230000);Regression run
main:
this PR:
Not tested
AI use
🤖 Generated with Claude Code
https://claude.ai/code/session_01SKtJseucqXR6iuAE6HBtiA